summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2018-01-23 17:02:02 +0000
committerDan Gohman <dan433584@gmail.com>2018-01-23 17:02:02 +0000
commit5464941a6a5ad85f8d041bf95181980b9eb45498 (patch)
tree9bd9bf12919e32b39b06c060fc8776a273bda47a /llvm/lib/Target
parent8e2fc4f3f836a082b0599a6bd74ada26e6c44b7a (diff)
downloadbcm5719-llvm-5464941a6a5ad85f8d041bf95181980b9eb45498.tar.gz
bcm5719-llvm-5464941a6a5ad85f8d041bf95181980b9eb45498.zip
[WebAssembly] Add mem.* intrinsics.
The grow_memory and current_memory instructions are expected to be officially renamed to mem.grow and mem.size. Introduce new intrinsics with the new names. These new names aren't yet official, so for now, use them at your own risk. Also, take this opportunity to add arguments for the currently unused immediate field in those instructions. llvm-svn: 323222
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
index 9d58895ca5a..660f0abfcab 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
@@ -523,12 +523,21 @@ def : Pat<(truncstorei32 I64:$val, (WebAssemblywrapper texternalsym:$off)),
let Defs = [ARGUMENTS] in {
// Current memory size.
+def MEM_SIZE_I32 : I<(outs I32:$dst), (ins i32imm:$flags),
+ [(set I32:$dst, (int_wasm_mem_size (i32 imm:$flags)))],
+ "mem.size\t$dst, $flags", 0x3f>,
+ Requires<[HasAddr32]>;
def CURRENT_MEMORY_I32 : I<(outs I32:$dst), (ins i32imm:$flags),
[],
"current_memory\t$dst", 0x3f>,
Requires<[HasAddr32]>;
// Grow memory.
+def MEM_GROW_I32 : I<(outs I32:$dst), (ins i32imm:$flags, I32:$delta),
+ [(set I32:$dst,
+ (int_wasm_mem_grow (i32 imm:$flags), I32:$delta))],
+ "mem.grow\t$dst, $flags, $delta", 0x3f>,
+ Requires<[HasAddr32]>;
def GROW_MEMORY_I32 : I<(outs I32:$dst), (ins i32imm:$flags, I32:$delta),
[],
"grow_memory\t$dst, $delta", 0x40>,
OpenPOWER on IntegriCloud