[PATCH] D15197: [WebAssembly] Support constant offsets on loads and stores

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 3 10:43:22 PST 2015


dschuff added inline comments.

================
Comment at: lib/Target/WebAssembly/WebAssemblyInstrMemory.td:106
@@ +105,3 @@
+def : Pat<(store I32:$val, (add I32:$addr, (i32 imm:$off))),
+          (STORE_I32 imm:$off, I32:$addr, I32:$val)>;
+
----------------
writing the offset operand as 'imm:$off' turns out to be critical here to getting an immediate in the output. If you say just $off or I32:$off you still get a pattern match but it generates an i32.const and uses that instead of putting it directly as an immediate in the store instruction. (The same applies if you use this kind of pattern to match a load, but if you put it directly in the definition for the load as I did here, then it doesn't matter if you use the imm: prefix or not). I'm not sure why that is.


http://reviews.llvm.org/D15197





More information about the llvm-commits mailing list