summaryrefslogtreecommitdiff
path: root/src/wasm-builder.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-07-21 16:07:30 -0700
committerGitHub <noreply@github.com>2016-07-21 16:07:30 -0700
commitfdbba5eb702a945c0a72ae5c4ab00c5579730f4a (patch)
tree5d402051ae1781328fb8fe0725cf9c4286c0ff5c /src/wasm-builder.h
parent12abb63203788cba23f5c65a971a2af922e05bfc (diff)
downloadbinaryen-fdbba5eb702a945c0a72ae5c4ab00c5579730f4a.tar.gz
binaryen-fdbba5eb702a945c0a72ae5c4ab00c5579730f4a.tar.bz2
binaryen-fdbba5eb702a945c0a72ae5c4ab00c5579730f4a.zip
support wasm globals (#650)
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r--src/wasm-builder.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index e73b707b9..22e1f9a00 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -145,6 +145,19 @@ public:
ret->type = value->type;
return ret;
}
+ GetGlobal* makeGetGlobal(Index index, WasmType type) {
+ auto* ret = allocator.alloc<GetGlobal>();
+ ret->index = index;
+ ret->type = type;
+ return ret;
+ }
+ SetGlobal* makeSetGlobal(Index index, Expression* value) {
+ auto* ret = allocator.alloc<SetGlobal>();
+ ret->index = index;
+ ret->value = value;
+ ret->type = value->type;
+ return ret;
+ }
Load* makeLoad(unsigned bytes, bool signed_, uint32_t offset, unsigned align, Expression *ptr, WasmType type) {
auto* ret = allocator.alloc<Load>();
ret->bytes = bytes; ret->signed_ = signed_; ret->offset = offset; ret->align = align; ret->ptr = ptr;