summaryrefslogtreecommitdiff
path: root/src/passes/StackIR.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/StackIR.cpp')
-rw-r--r--src/passes/StackIR.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/src/passes/StackIR.cpp b/src/passes/StackIR.cpp
index d834655b9..9b8b9b8b1 100644
--- a/src/passes/StackIR.cpp
+++ b/src/passes/StackIR.cpp
@@ -36,27 +36,10 @@ struct GenerateStackIR : public WalkerPass<PostWalker<GenerateStackIR>> {
bool modifiesBinaryenIR() override { return false; }
void doWalkFunction(Function* func) {
- BufferWithRandomAccess buffer;
- // a shim for the parent that a stackWriter expects - we don't need
- // it to do anything, as we are just writing to Stack IR
- struct Parent {
- Module* module;
- Parent(Module* module) : module(module) {}
-
- Module* getModule() { return module; }
- void writeDebugLocation(Expression* curr, Function* func) {
- WASM_UNREACHABLE();
- }
- Index getFunctionIndex(Name name) { WASM_UNREACHABLE(); }
- Index getFunctionTypeIndex(Name name) { WASM_UNREACHABLE(); }
- Index getGlobalIndex(Name name) { WASM_UNREACHABLE(); }
- } parent(getModule());
- StackWriter<StackWriterMode::Binaryen2Stack, Parent> stackWriter(
- parent, buffer, false);
- stackWriter.setFunction(func);
- stackWriter.visitPossibleBlockContents(func->body);
+ StackIRGenerator stackIRGen(getModule()->allocator, func);
+ stackIRGen.write();
func->stackIR = make_unique<StackIR>();
- func->stackIR->swap(stackWriter.stackIR);
+ func->stackIR->swap(stackIRGen.getStackIR());
}
};