summaryrefslogtreecommitdiff
path: root/src/wasm-ir-builder.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-ir-builder.h')
-rw-r--r--src/wasm-ir-builder.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/wasm-ir-builder.h b/src/wasm-ir-builder.h
index 40689a879..0210c55e5 100644
--- a/src/wasm-ir-builder.h
+++ b/src/wasm-ir-builder.h
@@ -40,8 +40,7 @@ namespace wasm {
// globals, tables, functions, etc.) to already exist in the module.
class IRBuilder : public UnifiedExpressionVisitor<IRBuilder, Result<>> {
public:
- IRBuilder(Module& wasm, Function* func = nullptr)
- : wasm(wasm), func(func), builder(wasm) {}
+ IRBuilder(Module& wasm) : wasm(wasm), builder(wasm) {}
// Get the valid Binaryen IR expression representing the sequence of visited
// instructions. The IRBuilder is reset and can be used with a fresh sequence
@@ -60,6 +59,10 @@ public:
// pushed instruction.
void setDebugLocation(const std::optional<Function::DebugLocation>&);
+ // Set the function used to add scratch locals when constructing an isolated
+ // sequence of IR.
+ void setFunction(Function* func) { this->func = func; }
+
// Handle the boundaries of control flow structures. Users may choose to use
// the corresponding `makeXYZ` function below instead of `visitXYZStart`, but
// either way must call `visitEnd` and friends at the appropriate times.
@@ -234,7 +237,7 @@ public:
private:
Module& wasm;
- Function* func;
+ Function* func = nullptr;
Builder builder;
// The location lacks debug info as it was marked as not having it.