[WebAssembly] Use the new offset syntax for memory operands in inline asm.
authorDan Gohman <dan433584@gmail.com>
Wed, 16 Dec 2015 18:14:49 +0000 (18:14 +0000)
committerDan Gohman <dan433584@gmail.com>
Wed, 16 Dec 2015 18:14:49 +0000 (18:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255788 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
test/CodeGen/WebAssembly/inline-asm.ll

index 68cfee42802c345df77e70efcd61bbb40956e742..079c864c7bc1c15e9a7bc5c8d238fad2829ea0af 100644 (file)
@@ -260,7 +260,9 @@ bool WebAssemblyAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
     report_fatal_error("There are no defined alternate asm variants");
 
   if (!ExtraCode) {
-    OS << regToString(MI->getOperand(OpNo));
+    // TODO: For now, we just hard-code 0 as the constant offset; teach
+    // SelectInlineAsmMemoryOperand how to do address mode matching.
+    OS << "0(" + regToString(MI->getOperand(OpNo)) + ')';
     return false;
   }
 
index 5eea83a771c05709e2e0540fe2b0ef2df567944c..fc066c4b812f89cfe5feb6b7b4845809ce2fc0d1 100644 (file)
@@ -21,7 +21,7 @@ entry:
 ; CHECK-LABEL: bar:
 ; CHECK-NEXT: .param i32, i32{{$}}
 ; CHECK-NEXT: #APP{{$}}
-; CHECK-NEXT: # $1 = bbb($0){{$}}
+; CHECK-NEXT: # 0($1) = bbb(0($0)){{$}}
 ; CHECK-NEXT: #NO_APP{{$}}
 ; CHECK-NEXT: return{{$}}
 define void @bar(i32* %r, i32* %s) {