diff options
author | Thomas Lively <tlively@google.com> | 2023-09-22 10:37:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-22 10:37:33 -0700 |
commit | 7d4d502500bfd22a0a4e9c1762b1bddccbe14c1c (patch) | |
tree | cc7da749e2c8e816b6da548267430320a3771171 /src/parser/wat-parser.cpp | |
parent | c290aadaf6c08a35311fc6fcaee557bbd66968e4 (diff) | |
download | binaryen-7d4d502500bfd22a0a4e9c1762b1bddccbe14c1c.tar.gz binaryen-7d4d502500bfd22a0a4e9c1762b1bddccbe14c1c.tar.bz2 binaryen-7d4d502500bfd22a0a4e9c1762b1bddccbe14c1c.zip |
Support function contexts in IRBuilder (#5967)
Add a `visitFunctionStart` function to IRBuilder and make it responsible for
setting the function's body when the context is closed. This will simplify
outlining, will be necessary to support branches to function scope properly, and
removes an extra block around function bodies in the new wat parser.
Diffstat (limited to 'src/parser/wat-parser.cpp')
-rw-r--r-- | src/parser/wat-parser.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/parser/wat-parser.cpp b/src/parser/wat-parser.cpp index 7b58be4d5..7e106d3b9 100644 --- a/src/parser/wat-parser.cpp +++ b/src/parser/wat-parser.cpp @@ -157,8 +157,7 @@ Result<> parseModule(Module& wasm, std::string_view input) { for (Index i = 0; i < decls.funcDefs.size(); ++i) { ctx.index = i; - ctx.setFunction(wasm.functions[i].get()); - CHECK_ERR(ctx.irBuilder.makeBlock(Name{}, ctx.func->getResults())); + CHECK_ERR(ctx.visitFunctionStart(wasm.functions[i].get())); WithPosition with(ctx, decls.funcDefs[i].pos); auto parsed = func(ctx); CHECK_ERR(parsed); |