[llvm] r253276 - [WebAssembly] Fix printing of global operands
Derek Schuff via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 16 16:20:44 PST 2015
Author: dschuff
Date: Mon Nov 16 18:20:44 2015
New Revision: 253276
URL: http://llvm.org/viewvc/llvm-project?rev=253276&view=rev
Log:
[WebAssembly] Fix printing of global operands
This was regressed in r252656 which wasn't quite NFC. Instead of using a
custom instruction as before, use a pattern to select CONST_I32 for the
global addrs.
Differential Revision: http://reviews.llvm.org/D14587
Modified:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
llvm/trunk/test/CodeGen/WebAssembly/global.ll
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td?rev=253276&r1=253275&r2=253276&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrInfo.td Mon Nov 16 18:20:44 2015
@@ -106,10 +106,10 @@ def CONST_F64 : I<(outs F64:$res), (ins
[(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">;
Modified: llvm/trunk/test/CodeGen/WebAssembly/global.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/global.ll?rev=253276&r1=253275&r2=253276&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/global.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/global.ll Mon Nov 16 18:20:44 2015
@@ -9,6 +9,13 @@ target triple = "wasm32-unknown-unknown"
; 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:
More information about the llvm-commits
mailing list