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.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index 346f2f5ba..f992b1e03 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -836,6 +836,13 @@ public:
ret->finalize();
return ret;
}
+ template<typename T> StructNew* makeStructNew(HeapType type, const T& args) {
+ auto* ret = wasm.allocator.alloc<StructNew>();
+ ret->operands.set(args);
+ ret->type = Type(type, NonNullable);
+ ret->finalize();
+ return ret;
+ }
StructGet*
makeStructGet(Index index, Expression* ref, Type type, bool signed_ = false) {
auto* ret = wasm.allocator.alloc<StructGet>();
@@ -863,6 +870,15 @@ public:
ret->finalize();
return ret;
}
+ ArrayNew*
+ makeArrayNew(HeapType type, Expression* size, Expression* init = nullptr) {
+ auto* ret = wasm.allocator.alloc<ArrayNew>();
+ ret->size = size;
+ ret->init = init;
+ ret->type = Type(type, NonNullable);
+ ret->finalize();
+ return ret;
+ }
ArrayInit* makeArrayInit(Expression* rtt,
const std::vector<Expression*>& values) {
auto* ret = wasm.allocator.alloc<ArrayInit>();
@@ -871,6 +887,14 @@ public:
ret->finalize();
return ret;
}
+ ArrayInit* makeArrayInit(HeapType type,
+ const std::vector<Expression*>& values) {
+ auto* ret = wasm.allocator.alloc<ArrayInit>();
+ ret->values.set(values);
+ ret->type = Type(type, NonNullable);
+ ret->finalize();
+ return ret;
+ }
ArrayGet*
makeArrayGet(Expression* ref, Expression* index, bool signed_ = false) {
auto* ret = wasm.allocator.alloc<ArrayGet>();