diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-05-30 09:54:23 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-05-30 09:54:23 -0700 |
commit | fa7573de6c3b17f831217e30745ea1092935eb54 (patch) | |
tree | 01b459d73f17d80387e25a665f522439d342f649 /src/passes/SimplifyLocals.cpp | |
parent | f33f1dbbee7b3f95d8437f1ee60c9075013858b6 (diff) | |
download | binaryen-fa7573de6c3b17f831217e30745ea1092935eb54.tar.gz binaryen-fa7573de6c3b17f831217e30745ea1092935eb54.tar.bz2 binaryen-fa7573de6c3b17f831217e30745ea1092935eb54.zip |
refactor walk logic into walk* and doWalk* methods, for a more regular API that is clearer where it should be overridden (#551)
Diffstat (limited to 'src/passes/SimplifyLocals.cpp')
-rw-r--r-- | src/passes/SimplifyLocals.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp index dac6cfa65..57057e8f9 100644 --- a/src/passes/SimplifyLocals.cpp +++ b/src/passes/SimplifyLocals.cpp @@ -376,7 +376,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals, self->pushTask(visitPre, currp); } - void walk(Expression*& root) { + void doWalkFunction(Function* func) { // multiple passes may be required per function, consider this: // x = load // y = store @@ -385,7 +385,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals, do { anotherCycle = false; // main operation - WalkerPass<LinearExecutionWalker<SimplifyLocals, Visitor<SimplifyLocals>>>::walk(root); + WalkerPass<LinearExecutionWalker<SimplifyLocals, Visitor<SimplifyLocals>>>::doWalkFunction(func); // enlarge blocks that were marked, for the next round if (blocksToEnlarge.size() > 0) { for (auto* block : blocksToEnlarge) { @@ -421,14 +421,14 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals, // remove the set. // First, count get_locals std::vector<int> numGetLocals; // local => # of get_locals for it - numGetLocals.resize(getFunction()->getNumLocals()); + numGetLocals.resize(func->getNumLocals()); GetLocalCounter counter; counter.numGetLocals = &numGetLocals; - counter.walk(root); + counter.walkFunction(func); // Second, remove unneeded sets SetLocalRemover remover; remover.numGetLocals = &numGetLocals; - remover.walk(root); + remover.walkFunction(func); } }; |