summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pass.h8
-rw-r--r--src/passes/ConstantFieldPropagation.cpp2
-rw-r--r--src/passes/GlobalTypeOptimization.cpp2
-rw-r--r--src/passes/LegalizeJSInterface.cpp2
-rw-r--r--src/passes/opt-utils.h2
5 files changed, 11 insertions, 5 deletions
diff --git a/src/pass.h b/src/pass.h
index 2bb34aeea..cc63971fe 100644
--- a/src/pass.h
+++ b/src/pass.h
@@ -391,7 +391,7 @@ protected:
//
template<typename WalkerType>
class WalkerPass : public Pass, public WalkerType {
- PassRunner* runner;
+ PassRunner* runner = nullptr;
protected:
typedef WalkerPass<WalkerType> super;
@@ -421,6 +421,12 @@ public:
WalkerType::walkFunction(func);
}
+ void runOnModuleCode(PassRunner* runner, Module* module) {
+ setPassRunner(runner);
+ WalkerType::setModule(module);
+ WalkerType::walkModuleCode(module);
+ }
+
PassRunner* getPassRunner() { return runner; }
PassOptions& getPassOptions() { return runner->options; }
diff --git a/src/passes/ConstantFieldPropagation.cpp b/src/passes/ConstantFieldPropagation.cpp
index 0894a822a..2fdd8333c 100644
--- a/src/passes/ConstantFieldPropagation.cpp
+++ b/src/passes/ConstantFieldPropagation.cpp
@@ -274,7 +274,7 @@ struct ConstantFieldPropagation : public Pass {
functionSetInfos(*module);
PCVScanner scanner(functionNewInfos, functionSetInfos);
scanner.run(runner, module);
- scanner.walkModuleCode(module);
+ scanner.runOnModuleCode(runner, module);
// Combine the data from the functions.
PCVStructValuesMap combinedNewInfos, combinedSetInfos;
diff --git a/src/passes/GlobalTypeOptimization.cpp b/src/passes/GlobalTypeOptimization.cpp
index 89d5b8c0a..35b10bfff 100644
--- a/src/passes/GlobalTypeOptimization.cpp
+++ b/src/passes/GlobalTypeOptimization.cpp
@@ -93,7 +93,7 @@ struct GlobalTypeOptimization : public Pass {
functionSetInfos(*module);
FieldInfoScanner scanner(functionNewInfos, functionSetInfos);
scanner.run(runner, module);
- scanner.walkModuleCode(module);
+ scanner.runOnModuleCode(runner, module);
// Combine the data from the functions.
StructValuesMap<FieldInfo> combinedNewInfos, combinedSetInfos;
diff --git a/src/passes/LegalizeJSInterface.cpp b/src/passes/LegalizeJSInterface.cpp
index e7a5f9220..e5a69beb1 100644
--- a/src/passes/LegalizeJSInterface.cpp
+++ b/src/passes/LegalizeJSInterface.cpp
@@ -143,7 +143,7 @@ struct LegalizeJSInterface : public Pass {
Fixer fixer(&illegalImportsToLegal);
fixer.run(runner, module);
- fixer.walkModuleCode(module);
+ fixer.runOnModuleCode(runner, module);
// Finally we can remove all the now-unused illegal imports
for (const auto& pair : illegalImportsToLegal) {
diff --git a/src/passes/opt-utils.h b/src/passes/opt-utils.h
index 326f75f95..28ace047a 100644
--- a/src/passes/opt-utils.h
+++ b/src/passes/opt-utils.h
@@ -88,7 +88,7 @@ inline void replaceFunctions(PassRunner* runner,
// replace direct calls in code both functions and module elements
FunctionRefReplacer replacer(maybeReplace);
replacer.run(runner, &module);
- replacer.walkModuleCode(&module);
+ replacer.runOnModuleCode(runner, &module);
// replace in start
if (module.start.is()) {