summaryrefslogtreecommitdiff
path: root/src/wasm-builder.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r--src/wasm-builder.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index 4f3a80091..0f2c333f9 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -245,6 +245,7 @@ public:
}
// Additional utility functions for building on top of nodes
+ // Convenient to have these on Builder, as it has allocation built in
static Index addParam(Function* func, Name name, WasmType type) {
// only ok to add a param if no vars, otherwise indices are invalidated
@@ -368,6 +369,11 @@ public:
if (!isConcreteWasmType(curr->type)) return curr;
return makeDrop(curr);
}
+
+ void flip(If* iff) {
+ std::swap(iff->ifTrue, iff->ifFalse);
+ iff->condition = makeUnary(EqZInt32, iff->condition);
+ }
};
} // namespace wasm