summaryrefslogtreecommitdiff
path: root/src/ir
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir')
-rw-r--r--src/ir/ExpressionManipulator.cpp4
-rw-r--r--src/ir/abstract.h2
-rw-r--r--src/ir/manipulation.h5
-rw-r--r--src/ir/properties.h8
4 files changed, 10 insertions, 9 deletions
diff --git a/src/ir/ExpressionManipulator.cpp b/src/ir/ExpressionManipulator.cpp
index 57048b9bd..6f64ec77b 100644
--- a/src/ir/ExpressionManipulator.cpp
+++ b/src/ir/ExpressionManipulator.cpp
@@ -227,7 +227,9 @@ flexibleCopy(Expression* original, Module& wasm, CustomCopier custom) {
builder.makeHost(curr->op, curr->nameOperand, std::move(operands));
return ret;
}
- Expression* visitRefNull(RefNull* curr) { return builder.makeRefNull(); }
+ Expression* visitRefNull(RefNull* curr) {
+ return builder.makeRefNull(curr->type);
+ }
Expression* visitRefIsNull(RefIsNull* curr) {
return builder.makeRefIsNull(copy(curr->value));
}
diff --git a/src/ir/abstract.h b/src/ir/abstract.h
index f706e9972..b00537bf5 100644
--- a/src/ir/abstract.h
+++ b/src/ir/abstract.h
@@ -103,7 +103,6 @@ inline UnaryOp getUnary(Type type, Op op) {
}
case Type::funcref:
case Type::externref:
- case Type::nullref:
case Type::exnref:
case Type::none:
case Type::unreachable: {
@@ -268,7 +267,6 @@ inline BinaryOp getBinary(Type type, Op op) {
}
case Type::funcref:
case Type::externref:
- case Type::nullref:
case Type::exnref:
case Type::none:
case Type::unreachable: {
diff --git a/src/ir/manipulation.h b/src/ir/manipulation.h
index 49ed7e11e..fb1f0181e 100644
--- a/src/ir/manipulation.h
+++ b/src/ir/manipulation.h
@@ -40,9 +40,10 @@ template<typename InputType> inline Nop* nop(InputType* target) {
return ret;
}
-template<typename InputType> inline RefNull* refNull(InputType* target) {
+template<typename InputType>
+inline RefNull* refNull(InputType* target, Type type) {
auto* ret = convert<InputType, RefNull>(target);
- ret->finalize();
+ ret->finalize(type);
return ret;
}
diff --git a/src/ir/properties.h b/src/ir/properties.h
index 0c6824e4a..ac61f787e 100644
--- a/src/ir/properties.h
+++ b/src/ir/properties.h
@@ -93,10 +93,10 @@ inline bool isConstantExpression(const Expression* curr) {
inline Literal getSingleLiteral(const Expression* curr) {
if (auto* c = curr->dynCast<Const>()) {
return c->value;
- } else if (curr->is<RefNull>()) {
- return Literal(Type::nullref);
- } else if (auto* c = curr->dynCast<RefFunc>()) {
- return Literal(c->func);
+ } else if (auto* n = curr->dynCast<RefNull>()) {
+ return Literal(n->type);
+ } else if (auto* r = curr->dynCast<RefFunc>()) {
+ return Literal(r->func);
} else {
WASM_UNREACHABLE("non-constant expression");
}