summaryrefslogtreecommitdiff
path: root/src/ir/ExpressionManipulator.cpp
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-09-24 12:02:09 +0200
committerGitHub <noreply@github.com>2020-09-24 12:02:09 +0200
commite9e1b2ff00aeb05aaeb57af3811add267dc25323 (patch)
tree4e19032813858b2e650f0cda46fe9fa227aa0a7f /src/ir/ExpressionManipulator.cpp
parenta42423fafa8cf731c69303ddc0acbe80c890e0ab (diff)
downloadbinaryen-e9e1b2ff00aeb05aaeb57af3811add267dc25323.tar.gz
binaryen-e9e1b2ff00aeb05aaeb57af3811add267dc25323.tar.bz2
binaryen-e9e1b2ff00aeb05aaeb57af3811add267dc25323.zip
GC: Add i31 instructions (#3154)
Adds the `i31.new` and `i31.get_s/u` instructions for creating and working with `i31ref` typed values. Does not include fuzzer integration just yet because the fuzzer expects that trivial values it creates are suitable in global initializers, which is not the case for trivial `i31ref` expressions.
Diffstat (limited to 'src/ir/ExpressionManipulator.cpp')
-rw-r--r--src/ir/ExpressionManipulator.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ir/ExpressionManipulator.cpp b/src/ir/ExpressionManipulator.cpp
index 95fee632f..b0616e34d 100644
--- a/src/ir/ExpressionManipulator.cpp
+++ b/src/ir/ExpressionManipulator.cpp
@@ -269,6 +269,12 @@ flexibleCopy(Expression* original, Module& wasm, CustomCopier custom) {
Expression* visitTupleExtract(TupleExtract* curr) {
return builder.makeTupleExtract(copy(curr->tuple), curr->index);
}
+ Expression* visitI31New(I31New* curr) {
+ return builder.makeI31New(copy(curr->value));
+ }
+ Expression* visitI31Get(I31Get* curr) {
+ return builder.makeI31Get(copy(curr->i31), curr->signed_);
+ }
};
Copier copier(wasm, custom);