make isel use MO_PIC_BASE_OFFSET when lowering globalvalues on darwin in pic

mode, instead of having asmprinter just "know" to print them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75109 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-07-09 05:47:33 +00:00
parent 35c89618cf
commit 4c388b2c9d
2 changed files with 5 additions and 6 deletions

View File

@ -445,21 +445,17 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
else {
HiddenGVStubs.insert(Name);
printSuffixedName(Name, "$non_lazy_ptr");
assert(MO.getTargetFlags() == 0);
//assert(MO.getTargetFlags() == 0 || MO_PIC_BASE_OFFSET);
}
} else {
GVStubs.insert(Name);
printSuffixedName(Name, "$non_lazy_ptr");
assert(MO.getTargetFlags() == 0);
//assert(MO.getTargetFlags() == 0 || MO_PIC_BASE_OFFSET);
}
} else {
O << Name;
}
if (TM.getRelocationModel() == Reloc::PIC_) {
O << '-';
PrintPICBaseSymbol();
}
} else {
O << Name;
}

View File

@ -4575,6 +4575,9 @@ X86TargetLowering::LowerGlobalAddress(const GlobalValue *GV, DebugLoc dl,
OpFlags = X86II::MO_GOT;
else
OpFlags = X86II::MO_GOTOFF;
} else if (Subtarget->isPICStyleStub() &&
getTargetMachine().getRelocationModel() == Reloc::PIC_) {
OpFlags = X86II::MO_PIC_BASE_OFFSET;
}
Result = DAG.getTargetGlobalAddress(GV, getPointerTy(), 0, OpFlags);