summaryrefslogtreecommitdiff
path: root/src/ir/literal-utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir/literal-utils.h')
-rw-r--r--src/ir/literal-utils.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ir/literal-utils.h b/src/ir/literal-utils.h
index 3c2f36d9a..fbe5b3716 100644
--- a/src/ir/literal-utils.h
+++ b/src/ir/literal-utils.h
@@ -31,6 +31,12 @@ inline Expression* makeFromInt32(int32_t x, Type type, Module& wasm) {
return ret;
}
+inline bool canMakeZero(Type type) {
+ // We can make a "zero" - a 0, or a null, or a trivial rtt, etc. - for pretty
+ // much anything except a non-nullable reference type.
+ return !type.isRef() || type.isNullable();
+}
+
inline Expression* makeZero(Type type, Module& wasm) {
// TODO: Remove this function once V8 supports v128.const
// (https://bugs.chromium.org/p/v8/issues/detail?id=8460)