Skip to content
Snippets Groups Projects
cpu.sch 1.14 KiB
Newer Older
macro simpl!(X) {
  ccp(X);
  simplify-cfg(X);
  lift-dc-math(X);
  gvn(X);
  phi-elim(X);
  dce(X);
  infer-schedules(X);
}

phi-elim(bfs);
no-memset(bfs@cost);
rarbore2's avatar
rarbore2 committed
let init = outline(bfs@cost_init);
let traverse = outline(bfs@loop1);
let collect = outline(bfs@loop2);

simpl!(*);
predication(*);
const-inline(*);
rarbore2's avatar
rarbore2 committed
loop-bound-canon(*);
simpl!(*);
fixpoint {
  forkify(*);
  fork-guard-elim(*);
}
simpl!(*);
rarbore2's avatar
rarbore2 committed
predication(*);
simpl!(*);
rarbore2's avatar
rarbore2 committed
reduce-slf(*);
simpl!(*);
slf(*);
simpl!(*);

fixpoint {
  forkify(collect);
  fork-guard-elim(collect);
}
simpl!(collect);

parallel-fork(traverse, collect);
parallel-reduce(traverse, collect);
rarbore2's avatar
rarbore2 committed
if !feature("seq") {
  fork-tile[32, 0, false, true](traverse, collect);
  let (outer, inner) = fork-reshape[[1], [0]](traverse);
  traverse = outline(inner);
  let (outer, inner) = fork-reshape[[1], [0]](collect);
  collect = outline(inner);

  fork-tile[32, 0, false, true](init);
  let (outer, inner) = fork-reshape[[1], [0]](init);
  let init_body = outline(inner);

  inline(bfs@cost_init, bfs@loop1, bfs@loop2);
  init = init_body;
}
rarbore2's avatar
rarbore2 committed
delete-uncalled(*);
const-inline(*);
rarbore2's avatar
rarbore2 committed
simpl!(*);
rarbore2's avatar
rarbore2 committed

rarbore2's avatar
rarbore2 committed
unforkify(init, traverse, collect);
rarbore2's avatar
rarbore2 committed
simpl!(*);
rarbore2's avatar
rarbore2 committed
gcm(*);