mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-23 02:32:11 +00:00
pull @GOT, @GOTOFF, @GOTPCREL handling into isel from the asmprinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74378 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4c1b606ecd
commit
b1acd68fe4
@ -290,10 +290,6 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool shouldPrintGOT(TargetMachine &TM, const X86Subtarget* ST) {
|
||||
return ST->isPICStyleGOT() && TM.getRelocationModel() == Reloc::PIC_;
|
||||
}
|
||||
|
||||
static inline bool shouldPrintPLT(TargetMachine &TM, const X86Subtarget* ST) {
|
||||
return ST->isTargetELF() && TM.getRelocationModel() == Reloc::PIC_;
|
||||
}
|
||||
@ -584,42 +580,15 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
if (isThreadLocal)
|
||||
assert(0 && "Not lowered right");
|
||||
break;
|
||||
case X86II::MO_TLSGD:
|
||||
O << "@TLSGD";
|
||||
break;
|
||||
case X86II::MO_GOTTPOFF:
|
||||
O << "@GOTTPOFF";
|
||||
break;
|
||||
case X86II::MO_INDNTPOFF:
|
||||
O << "@INDNTPOFF";
|
||||
break;
|
||||
case X86II::MO_TPOFF:
|
||||
O << "@TPOFF";
|
||||
break;
|
||||
case X86II::MO_NTPOFF:
|
||||
O << "@NTPOFF";
|
||||
break;
|
||||
case X86II::MO_GOTPCREL:
|
||||
O << "@GOTPCREL";
|
||||
break;
|
||||
case X86II::MO_TLSGD: O << "@TLSGD"; break;
|
||||
case X86II::MO_GOTTPOFF: O << "@GOTTPOFF"; break;
|
||||
case X86II::MO_INDNTPOFF: O << "@INDNTPOFF"; break;
|
||||
case X86II::MO_TPOFF: O << "@TPOFF"; break;
|
||||
case X86II::MO_NTPOFF: O << "@NTPOFF"; break;
|
||||
case X86II::MO_GOTPCREL: O << "@GOTPCREL"; break;
|
||||
case X86II::MO_GOT: O << "@GOT"; break;
|
||||
case X86II::MO_GOTOFF: O << "@GOTOFF"; break;
|
||||
}
|
||||
|
||||
if (isThreadLocal) {
|
||||
// DEAD
|
||||
} else if (isMemOp) {
|
||||
if (shouldPrintGOT(TM, Subtarget)) {
|
||||
if (Subtarget->GVRequiresExtraLoad(GV, TM, false))
|
||||
O << "@GOT";
|
||||
else
|
||||
O << "@GOTOFF";
|
||||
} else if (Subtarget->isPICStyleRIPRel()) {
|
||||
if (TM.getRelocationModel() != Reloc::Static) {
|
||||
if (Subtarget->GVRequiresExtraLoad(GV, TM, false))
|
||||
O << "@GOTPCREL";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
case MachineOperand::MO_ExternalSymbol: {
|
||||
|
@ -4426,7 +4426,21 @@ X86TargetLowering::LowerGlobalAddress(const GlobalValue *GV, DebugLoc dl,
|
||||
Result = DAG.getTargetGlobalAddress(GV, getPointerTy(), Offset);
|
||||
Offset = 0;
|
||||
} else {
|
||||
Result = DAG.getTargetGlobalAddress(GV, getPointerTy(), 0);
|
||||
unsigned char OpFlags = 0;
|
||||
|
||||
if (Subtarget->isPICStyleRIPRel() &&
|
||||
getTargetMachine().getRelocationModel() != Reloc::Static) {
|
||||
if (ExtraLoadRequired)
|
||||
OpFlags = X86II::MO_GOTPCREL;
|
||||
} else if (Subtarget->isPICStyleGOT() &&
|
||||
getTargetMachine().getRelocationModel() == Reloc::PIC_) {
|
||||
if (ExtraLoadRequired)
|
||||
OpFlags = X86II::MO_GOT;
|
||||
else
|
||||
OpFlags = X86II::MO_GOTOFF;
|
||||
}
|
||||
|
||||
Result = DAG.getTargetGlobalAddress(GV, getPointerTy(), 0, OpFlags);
|
||||
}
|
||||
|
||||
if (Subtarget->isPICStyleRIPRel() &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user