summaryrefslogtreecommitdiff
path: root/src/pass.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-06-28 22:05:05 -0700
committerGitHub <noreply@github.com>2017-06-28 22:05:05 -0700
commite488da5adbef2613c08fe205db5b79b1765a4af3 (patch)
treee3cab840dcbf7d8d4ccf1f47a742fbfc41e1d5ef /src/pass.h
parente2c08d42ab0ffc05d980ae2d34fee0e77b201134 (diff)
downloadbinaryen-e488da5adbef2613c08fe205db5b79b1765a4af3.tar.gz
binaryen-e488da5adbef2613c08fe205db5b79b1765a4af3.tar.bz2
binaryen-e488da5adbef2613c08fe205db5b79b1765a4af3.zip
Code folding (#1076)
Adds a pass that folds code, i.e. merges it when possible. See details in comment in the pass implementation cpp. This is enabled by default in -Os and -Oz. Seems risky to enable anywhere else, as it does add branches - likely predictable ones so maybe no slowdown, but still some risk. Code size numbers: wasm-backend: 196331 + binaryen -Os (before): 182598 + binaryen -Os (with folding): 181943 asm2wasm -Os (before): 172463 asm2wasm -Os (with folding): 168774 So this reduces wasm-backend output by an additional 0.5% than it could before. Mainly this is because the wasm backend already has code folding, whereas on asm2wasm output, where we didn't have folding before, this saves over 2%. The 0.5% improvement on the wasm backend's output might be because this can fold more types of code than LLVM can (it can fold nested control flow, in particular).
Diffstat (limited to 'src/pass.h')
-rw-r--r--src/pass.h23
1 files changed, 0 insertions, 23 deletions
diff --git a/src/pass.h b/src/pass.h
index 198d5dcb5..21836ebf9 100644
--- a/src/pass.h
+++ b/src/pass.h
@@ -237,29 +237,6 @@ public:
// but registering them here in addition allows them to communicate
// e.g. through PassRunner::getLast
-// Handles names in a module, in particular adding names without duplicates
-class NameManager : public WalkerPass<PostWalker<NameManager>> {
- public:
- Name getUnique(std::string prefix);
- // TODO: getUniqueInFunction
-
- // visitors
- void visitBlock(Block* curr);
- void visitLoop(Loop* curr);
- void visitBreak(Break* curr);
- void visitSwitch(Switch* curr);
- void visitCall(Call* curr);
- void visitCallImport(CallImport* curr);
- void visitFunctionType(FunctionType* curr);
- void visitFunction(Function* curr);
- void visitImport(Import* curr);
- void visitExport(Export* curr);
-
-private:
- std::set<Name> names;
- size_t counter = 0;
-};
-
// Prints out a module
class Printer : public Pass {
protected: