summaryrefslogtreecommitdiff
path: root/src/ir/module-utils.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-07-19 16:01:15 -0700
committerGitHub <noreply@github.com>2019-07-19 16:01:15 -0700
commit88ef839433ac0cf58c2a29f369d0268a22b5ae0e (patch)
tree13488bb2eda5657d7cb440cacacab4369b7fda1e /src/ir/module-utils.h
parent7bc5f1891f77e53f5a4e6905e02e80c680c728c3 (diff)
downloadbinaryen-88ef839433ac0cf58c2a29f369d0268a22b5ae0e.tar.gz
binaryen-88ef839433ac0cf58c2a29f369d0268a22b5ae0e.tar.bz2
binaryen-88ef839433ac0cf58c2a29f369d0268a22b5ae0e.zip
Simpify PassRunner.add() and automatically parallelize parallel functions (#2242)
Main change here is in pass.h, everything else is changes to work with the new API. The add("name") remains as before, while the weird variadic add(..) which constructed the pass now just gets a std::unique_ptr of a pass. This also makes the memory management internally fully automatic. And it makes it trivial to parallelize WalkerPass::run on parallel passes. As a benefit, this allows removing a lot of code since in many cases there is no need to create a new pass runner, and running a pass can be just a single line.
Diffstat (limited to 'src/ir/module-utils.h')
-rw-r--r--src/ir/module-utils.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/ir/module-utils.h b/src/ir/module-utils.h
index 88298fd43..16ecd54b0 100644
--- a/src/ir/module-utils.h
+++ b/src/ir/module-utils.h
@@ -319,7 +319,6 @@ template<typename T> struct ParallelFunctionMap {
// Run on the implemented functions.
struct Mapper : public WalkerPass<PostWalker<Mapper>> {
-
bool isFunctionParallel() override { return true; }
Mapper(Info* info) : info(info) {}
@@ -338,9 +337,7 @@ template<typename T> struct ParallelFunctionMap {
Info info = {&map, work};
PassRunner runner(&wasm);
- runner.setIsNested(true);
- runner.add<Mapper>(&info);
- runner.run();
+ Mapper(&info).run(&runner, &wasm);
}
};