[llvm-commits] [llvm] r107727 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2010-07-06-asm-RIP.ll
Dale Johannesen
dalej at apple.com
Tue Jul 6 16:27:00 PDT 2010
Author: johannes
Date: Tue Jul 6 18:27:00 2010
New Revision: 107727
URL: http://llvm.org/viewvc/llvm-project?rev=107727&view=rev
Log:
Accept RIP-relative symbols with 'i' constraint, and
print the (%rip) only if the 'a' modifier is present.
PR 7528.
Added:
llvm/trunk/test/CodeGen/X86/2010-07-06-asm-RIP.ll
Modified:
llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp?rev=107727&r1=107726&r2=107727&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp Tue Jul 6 18:27:00 2010
@@ -388,6 +388,8 @@
}
if (MO.isGlobal() || MO.isCPI() || MO.isJTI() || MO.isSymbol()) {
printSymbolOperand(MO, O);
+ if (Subtarget->isPICStyleRIPRel())
+ O << "(%rip)";
return false;
}
if (MO.isReg()) {
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=107727&r1=107726&r2=107727&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jul 6 18:27:00 2010
@@ -10264,8 +10264,7 @@
// In any sort of PIC mode addresses need to be computed at runtime by
// adding in a register or some sort of table lookup. These can't
// be used as immediates.
- if (Subtarget->isPICStyleGOT() || Subtarget->isPICStyleStubPIC() ||
- Subtarget->isPICStyleRIPRel())
+ if (Subtarget->isPICStyleGOT() || Subtarget->isPICStyleStubPIC())
return;
// If we are in non-pic codegen mode, we allow the address of a global (with
Added: llvm/trunk/test/CodeGen/X86/2010-07-06-asm-RIP.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-07-06-asm-RIP.ll?rev=107727&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2010-07-06-asm-RIP.ll (added)
+++ llvm/trunk/test/CodeGen/X86/2010-07-06-asm-RIP.ll Tue Jul 6 18:27:00 2010
@@ -0,0 +1,21 @@
+; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
+; PR 7528
+
+ at n = global i32 0 ; <i32*> [#uses=2]
+
+define void @f(i32*) nounwind ssp {
+ ret void
+}
+
+define void @g() nounwind ssp {
+entry:
+; CHECK: _g:
+; CHECK: push $_f$_f
+; CHECK: call _f(%rip)
+ call void asm sideeffect "push\09$1$1\0A\09call\09${1:a}\0A\09pop\09%edx", "imr,i,~{dirflag},~{fpsr},~{flags},~{memory},~{cc},~{edi},~{esi},~{edx},~{ecx},~{ebx},~{eax}"(i32* @n, void (i32*)* @f) nounwind
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
More information about the llvm-commits
mailing list