[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
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
index 9d58895..660f0ab 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
@@ -523,12 +523,21 @@
 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>,