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.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index 6fc5c4dda..3a4ae97c1 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -838,6 +838,9 @@ public:
if (type.isFunction()) {
return makeRefFunc(value.getFunc(), type);
}
+ if (type.isRtt()) {
+ return makeRtt(value.type);
+ }
TODO_SINGLE_COMPOUND(type);
switch (type.getBasic()) {
case Type::externref:
@@ -865,6 +868,18 @@ public:
}
}
+ // Given a type, creates an RTT expression of that type, using a combination
+ // of rtt.canon and rtt.subs.
+ Expression* makeRtt(Type type) {
+ Expression* ret = makeRttCanon(type.getHeapType());
+ if (type.getRtt().hasDepth()) {
+ for (Index i = 0; i < type.getRtt().depth; i++) {
+ ret = makeRttSub(type.getHeapType(), ret);
+ }
+ }
+ return ret;
+ }
+
// Additional utility functions for building on top of nodes
// Convenient to have these on Builder, as it has allocation built in