Skip to content

Commit e2831b4

Browse files
author
Dan Gohman
committed
[WebAssembly] Use the new offset syntax for memory operands in inline asm.
llvm-svn: 255788
1 parent 88a7a2e commit e2831b4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ bool WebAssemblyAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
260260
report_fatal_error("There are no defined alternate asm variants");
261261

262262
if (!ExtraCode) {
263-
OS << regToString(MI->getOperand(OpNo));
263+
// TODO: For now, we just hard-code 0 as the constant offset; teach
264+
// SelectInlineAsmMemoryOperand how to do address mode matching.
265+
OS << "0(" + regToString(MI->getOperand(OpNo)) + ')';
264266
return false;
265267
}
266268

llvm/test/CodeGen/WebAssembly/inline-asm.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ entry:
2121
; CHECK-LABEL: bar:
2222
; CHECK-NEXT: .param i32, i32{{$}}
2323
; CHECK-NEXT: #APP{{$}}
24-
; CHECK-NEXT: # $1 = bbb($0){{$}}
24+
; CHECK-NEXT: # 0($1) = bbb(0($0)){{$}}
2525
; CHECK-NEXT: #NO_APP{{$}}
2626
; CHECK-NEXT: return{{$}}
2727
define void @bar(i32* %r, i32* %s) {

0 commit comments

Comments
 (0)