Move logic out of cton-util wasm.

Give LoopAnalysis `is_valid` and `ensure` functions similar to
DominatorTree and others, so that it can be computed on demand in the
same way.

This removes the last need for src/wasm.rs to have embedded knowledge
of the dependencies of the passes it's running.
This commit is contained in:
Dan Gohman
2017-09-12 16:15:22 -07:00
parent 9d0d6b5a1b
commit e2f0fe58d1
3 changed files with 23 additions and 16 deletions

View File

@@ -18,7 +18,7 @@ pub fn do_licm(
) {
cfg.ensure(func);
domtree.ensure(func, cfg);
loop_analysis.compute(func, cfg, domtree);
loop_analysis.ensure(func, cfg, domtree);
for lp in loop_analysis.loops() {
// For each loop that we want to optimize we determine the set of loop-invariant
// instructions