make isel use MO_PIC_BASE_OFFSET when lowering globalvalues on darwin in pic

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

llvm-svn: 75109
This commit is contained in:
Chris Lattner 2009-07-09 05:47:33 +00:00
parent 0667b145c4
commit e0dae0e716
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);