From aa1cf3d0c20d5bc6f98ac3ab96c06f0ff6c2eb61 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 5 May 2016 09:31:19 -0700 Subject: simplify PassRunner API, get a module directly --- src/pass.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/pass.h') diff --git a/src/pass.h b/src/pass.h index 85aec624f..d2bd787df 100644 --- a/src/pass.h +++ b/src/pass.h @@ -66,12 +66,13 @@ struct RegisterPass { // Runs a set of passes, in order // struct PassRunner { + Module* wasm; MixedArena* allocator; std::vector passes; Pass* currPass; bool debug = false; - PassRunner(MixedArena* allocator) : allocator(allocator) {} + PassRunner(Module* wasm) : wasm(wasm), allocator(&wasm->allocator) {} void setDebug(bool debug_) { debug = debug_; } @@ -95,7 +96,7 @@ struct PassRunner { // what -O does. void addDefaultOptimizationPasses(); - void run(Module* module); + void run(); // Get the last pass that was already executed of a certain type. template -- cgit v1.2.3 From 5d91adec8d601faba388960b15b630f3895b4009 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 5 May 2016 09:43:29 -0700 Subject: better error on missing passes --- src/pass.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/pass.h') diff --git a/src/pass.h b/src/pass.h index d2bd787df..bfbcb26d8 100644 --- a/src/pass.h +++ b/src/pass.h @@ -22,6 +22,7 @@ #include "wasm.h" #include "wasm-traversal.h" #include "mixed_arena.h" +#include "support/utilities.h" namespace wasm { @@ -78,7 +79,7 @@ struct PassRunner { void add(std::string passName) { auto pass = PassRegistry::get()->createPass(passName); - assert(pass); + if (!pass) Fatal() << "Could not find pass: " << passName << "\n"; passes.push_back(pass); } -- cgit v1.2.3