mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-30 06:40:53 +00:00
Accept RIP-relative symbols with 'i' constraint, and
print the (%rip) only if the 'a' modifier is present. PR 7528. llvm-svn: 107727
This commit is contained in:
parent
83ab844c9b
commit
81ea05c193
@ -388,6 +388,8 @@ bool X86AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
}
|
||||
if (MO.isGlobal() || MO.isCPI() || MO.isJTI() || MO.isSymbol()) {
|
||||
printSymbolOperand(MO, O);
|
||||
if (Subtarget->isPICStyleRIPRel())
|
||||
O << "(%rip)";
|
||||
return false;
|
||||
}
|
||||
if (MO.isReg()) {
|
||||
|
@ -10264,8 +10264,7 @@ void X86TargetLowering::LowerAsmOperandForConstraint(SDValue Op,
|
||||
// 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
|
||||
|
21
test/CodeGen/X86/2010-07-06-asm-RIP.ll
Normal file
21
test/CodeGen/X86/2010-07-06-asm-RIP.ll
Normal file
@ -0,0 +1,21 @@
|
||||
; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
|
||||
; PR 7528
|
||||
|
||||
@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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user