diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-12-30 17:55:20 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-30 17:55:20 -0800 |
commit | bcc76146fed433cbc8ba01a9f568d979c145110b (patch) | |
tree | ab70ad24afc257b73513c3e62f3aab9938d05944 /src/ir/manipulation.h | |
parent | a30f1df5696ccb3490e2eaa3a9ed5e7e487c7b0e (diff) | |
download | binaryen-bcc76146fed433cbc8ba01a9f568d979c145110b.tar.gz binaryen-bcc76146fed433cbc8ba01a9f568d979c145110b.tar.bz2 binaryen-bcc76146fed433cbc8ba01a9f568d979c145110b.zip |
Add support for reference types proposal (#2451)
This adds support for the reference type proposal. This includes support
for all reference types (`anyref`, `funcref`(=`anyfunc`), and `nullref`)
and four new instructions: `ref.null`, `ref.is_null`, `ref.func`, and
new typed `select`. This also adds subtype relationship support between
reference types.
This does not include table instructions yet. This also does not include
wasm2js support.
Fixes #2444 and fixes #2447.
Diffstat (limited to 'src/ir/manipulation.h')
-rw-r--r-- | src/ir/manipulation.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ir/manipulation.h b/src/ir/manipulation.h index ec137d372..49ed7e11e 100644 --- a/src/ir/manipulation.h +++ b/src/ir/manipulation.h @@ -33,14 +33,24 @@ inline OutputType* convert(InputType* input) { return output; } -// Convenience method for nop, which is a common conversion +// Convenience methods for certain instructions, which are common conversions template<typename InputType> inline Nop* nop(InputType* target) { - return convert<InputType, Nop>(target); + auto* ret = convert<InputType, Nop>(target); + ret->finalize(); + return ret; +} + +template<typename InputType> inline RefNull* refNull(InputType* target) { + auto* ret = convert<InputType, RefNull>(target); + ret->finalize(); + return ret; } template<typename InputType> inline Unreachable* unreachable(InputType* target) { - return convert<InputType, Unreachable>(target); + auto* ret = convert<InputType, Unreachable>(target); + ret->finalize(); + return ret; } // Convert a node that allocates |