From 88ef839433ac0cf58c2a29f369d0268a22b5ae0e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 19 Jul 2019 16:01:15 -0700 Subject: 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. --- src/ir/module-utils.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/ir/module-utils.h') 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 struct ParallelFunctionMap { // Run on the implemented functions. struct Mapper : public WalkerPass> { - bool isFunctionParallel() override { return true; } Mapper(Info* info) : info(info) {} @@ -338,9 +337,7 @@ template struct ParallelFunctionMap { Info info = {&map, work}; PassRunner runner(&wasm); - runner.setIsNested(true); - runner.add(&info); - runner.run(); + Mapper(&info).run(&runner, &wasm); } }; -- cgit v1.2.3