[PATCH] D14587: [WebAssembly] Fix printing of global operands

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 16 16:23:28 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL253276: [WebAssembly] Fix printing of global operands (authored by dschuff).

Changed prior to commit:
  http://reviews.llvm.org/D14587?vs=40336&id=40363#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14587

Files:
  llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
  llvm/trunk/test/CodeGen/WebAssembly/global.ll

Index: llvm/trunk/test/CodeGen/WebAssembly/global.ll
===================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/global.ll
+++ llvm/trunk/test/CodeGen/WebAssembly/global.ll
@@ -9,6 +9,13 @@
 ; CHECK-NOT: llvm.metadata
 @llvm.used = appending global [1 x i32*] [i32* @g], section "llvm.metadata"
 
+; CHECK: foo:
+; CHECK: i32.const $push, answer
+define i32 @foo() {
+  %a = load i32, i32* @answer
+  ret i32 %a
+}
+
 ; CHECK: .type   g, at object
 ; CHECK: .align  2{{$}}
 ; CHECK-NEXT: g:
Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
===================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
@@ -106,10 +106,10 @@
                   [(set F64:$res, fpimm:$imm)],
                   "f64.const\t$res, $imm">;
 
-// Special types of immediates. FIXME: Hard-coded as 32-bit for now.
-def GLOBAL : I<(outs I32:$dst), (ins global:$addr),
-               [(set I32:$dst, (WebAssemblywrapper tglobaladdr:$addr))],
-               "global\t$dst, $addr">;
+
+def : Pat<(i32 (WebAssemblywrapper tglobaladdr :$dst)),
+          (CONST_I32 tglobaladdr :$dst)>;
+
 def JUMP_TABLE : I<(outs I32:$dst), (ins tjumptable_op:$addr),
                    [(set I32:$dst, (WebAssemblywrapper tjumptable:$addr))],
                    "jump_table\t$dst, $addr">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14587.40363.patch
Type: text/x-patch
Size: 1441 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151117/f0092588/attachment.bin>


More information about the llvm-commits mailing list