diff options
Diffstat (limited to 'src/passes')
-rw-r--r-- | src/passes/MergeBlocks.cpp | 2 | ||||
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 2 | ||||
-rw-r--r-- | src/passes/PostEmscripten.cpp | 2 | ||||
-rw-r--r-- | src/passes/RemoveUnusedBrs.cpp | 2 | ||||
-rw-r--r-- | src/passes/RemoveUnusedNames.cpp | 2 | ||||
-rw-r--r-- | src/passes/ReorderLocals.cpp | 1 | ||||
-rw-r--r-- | src/passes/SimplifyLocals.cpp | 7 | ||||
-rw-r--r-- | src/passes/Vacuum.cpp | 2 |
8 files changed, 18 insertions, 2 deletions
diff --git a/src/passes/MergeBlocks.cpp b/src/passes/MergeBlocks.cpp index 578d4fc45..5033d4016 100644 --- a/src/passes/MergeBlocks.cpp +++ b/src/passes/MergeBlocks.cpp @@ -24,6 +24,8 @@ namespace wasm { struct MergeBlocks : public WalkerPass<PostWalker<MergeBlocks>> { + bool isFunctionParallel() { return true; } + void visitBlock(Block *curr) { bool more = true; while (more) { diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index ca79468f5..28cac726a 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -26,6 +26,8 @@ namespace wasm { struct OptimizeInstructions : public WalkerPass<PostWalker<OptimizeInstructions>> { + bool isFunctionParallel() { return true; } + void visitIf(If* curr) { // flip branches to get rid of an i32.eqz if (curr->ifFalse) { diff --git a/src/passes/PostEmscripten.cpp b/src/passes/PostEmscripten.cpp index effbad30a..ef01b11fe 100644 --- a/src/passes/PostEmscripten.cpp +++ b/src/passes/PostEmscripten.cpp @@ -25,6 +25,8 @@ namespace wasm { struct PostEmscripten : public WalkerPass<PostWalker<PostEmscripten>> { + bool isFunctionParallel() { return true; } + // When we have a Load from a local value (typically a GetLocal) plus a constant offset, // we may be able to fold it in. // The semantics of the Add are to wrap, while wasm offset semantics purposefully do diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp index 41db36d2c..6718fc14b 100644 --- a/src/passes/RemoveUnusedBrs.cpp +++ b/src/passes/RemoveUnusedBrs.cpp @@ -24,6 +24,8 @@ namespace wasm { struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> { + bool isFunctionParallel() { return true; } + // preparation: try to unify branches, as the fewer there are, the higher a chance we can remove them // specifically for if-else, turn an if-else with branches to the same target at the end of each // child, and with a value, to a branch to that target containing the if-else diff --git a/src/passes/RemoveUnusedNames.cpp b/src/passes/RemoveUnusedNames.cpp index 71569eefb..d33b5081a 100644 --- a/src/passes/RemoveUnusedNames.cpp +++ b/src/passes/RemoveUnusedNames.cpp @@ -24,6 +24,8 @@ namespace wasm { struct RemoveUnusedNames : public WalkerPass<PostWalker<RemoveUnusedNames>> { + bool isFunctionParallel() { return true; } + // We maintain a list of branches that we saw in children, then when we reach // a parent block, we know if it was branched to std::set<Name> branchesSeen; diff --git a/src/passes/ReorderLocals.cpp b/src/passes/ReorderLocals.cpp index ca046773b..66ea131de 100644 --- a/src/passes/ReorderLocals.cpp +++ b/src/passes/ReorderLocals.cpp @@ -27,6 +27,7 @@ namespace wasm { struct ReorderLocals : public WalkerPass<PostWalker<ReorderLocals>> { + bool isFunctionParallel() { return true; } std::map<Name, uint32_t> counts; diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp index 408fea7ab..6220d0780 100644 --- a/src/passes/SimplifyLocals.cpp +++ b/src/passes/SimplifyLocals.cpp @@ -33,6 +33,8 @@ namespace wasm { struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals>> { + bool isFunctionParallel() { return true; } + struct SinkableInfo { Expression** item; EffectAnalyzer effects; @@ -157,7 +159,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals>> self->pushTask(visitPre, currp); } - void startWalk(Function *func) { + void walk(Expression*& root) { // multiple passes may be required per function, consider this: // x = load // y = store @@ -166,7 +168,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals>> do { sunk = false; // main operation - walk(func->body); + WalkerPass<LinearExecutionWalker<SimplifyLocals>>::walk(root); // after optimizing a function, we can see if we have set_locals // for a local with no remaining gets, in which case, we can // remove the set. @@ -192,6 +194,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals>> // clean up numGetLocals.clear(); setLocalOrigins.clear(); + sinkables.clear(); } while (sunk); } }; diff --git a/src/passes/Vacuum.cpp b/src/passes/Vacuum.cpp index ef83958c4..060dcd9dc 100644 --- a/src/passes/Vacuum.cpp +++ b/src/passes/Vacuum.cpp @@ -24,6 +24,8 @@ namespace wasm { struct Vacuum : public WalkerPass<PostWalker<Vacuum>> { + bool isFunctionParallel() { return true; } + void visitBlock(Block *curr) { // compress out nops int skip = 0; |