[llvm-commits] [llvm] r74378 - in /llvm/trunk/lib/Target/X86: AsmPrinter/X86ATTAsmPrinter.cpp X86ISelLowering.cpp
Chris Lattner
sabre at nondot.org
Fri Jun 26 22:39:57 PDT 2009
Author: lattner
Date: Sat Jun 27 00:39:56 2009
New Revision: 74378
URL: http://llvm.org/viewvc/llvm-project?rev=74378&view=rev
Log:
pull @GOT, @GOTOFF, @GOTPCREL handling into isel from the asmprinter.
Modified:
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=74378&r1=74377&r2=74378&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Sat Jun 27 00:39:56 2009
@@ -290,10 +290,6 @@
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 @@
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;
- }
-
- 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";
- }
- }
+ 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;
}
-
return;
}
case MachineOperand::MO_ExternalSymbol: {
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=74378&r1=74377&r2=74378&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Jun 27 00:39:56 2009
@@ -4426,7 +4426,21 @@
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() &&
More information about the llvm-commits
mailing list