[llvm] r195824 - Cleanup and test X86AsmPrinter::printPCRelImm.

Rafael Espindola rafael.espindola at gmail.com
Tue Nov 26 22:53:14 PST 2013


Author: rafael
Date: Wed Nov 27 00:53:13 2013
New Revision: 195824

URL: http://llvm.org/viewvc/llvm-project?rev=195824&view=rev
Log:
Cleanup and test X86AsmPrinter::printPCRelImm.

It is only used for asm printing.

On X86 we put basic block addresses on register before passing them to inline
asm, so the MO_MachineBasicBlock case was dead.

MO_ExternalSymbol was dead since any symbol being passed to inline asm
is represented as MO_GlobalAddress.

The MO_GlobalAddress and MO_Register cases were not tested.

Modified:
    llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
    llvm/trunk/test/CodeGen/X86/inline-asm.ll

Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=195824&r1=195823&r2=195824&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Wed Nov 27 00:53:13 2013
@@ -220,11 +220,7 @@ void X86AsmPrinter::printPCRelImm(const
   case MachineOperand::MO_Immediate:
     O << MO.getImm();
     return;
-  case MachineOperand::MO_MachineBasicBlock:
-    O << *MO.getMBB()->getSymbol();
-    return;
   case MachineOperand::MO_GlobalAddress:
-  case MachineOperand::MO_ExternalSymbol:
     printSymbolOperand(MO, O);
     return;
   }

Modified: llvm/trunk/test/CodeGen/X86/inline-asm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm.ll?rev=195824&r1=195823&r2=195824&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/inline-asm.ll (original)
+++ llvm/trunk/test/CodeGen/X86/inline-asm.ll Wed Nov 27 00:53:13 2013
@@ -59,3 +59,18 @@ entry:
   %asm = tail call i32 asm sideeffect "", "={ax},i,~{eax},~{flags},~{rax}"(i64 61) nounwind
   ret i32 %asm
 }
+
+ at test8_v = global i32 42
+
+define void @test8() {
+  call void asm sideeffect "${0:P}", "i"( i32* @test8_v )
+  ret void
+}
+
+define void @test9() {
+  call void asm sideeffect "${0:P}", "X"( i8* blockaddress(@test9, %bb) )
+  br label %bb
+
+bb:
+  ret void
+}





More information about the llvm-commits mailing list