diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 065342f2abc..8aa25923cac 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -50,8 +50,7 @@ using namespace llvm; void X86AsmPrinter::PrintPICBaseSymbol(raw_ostream &O) const { const TargetLowering *TLI = TM.getTargetLowering(); - O << *static_cast(TLI)->getPICBaseSymbol(MF, - OutContext); + O << *static_cast(TLI)->getPICBaseSymbol(*MF); } /// runOnMachineFunction - Emit the function body. diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 1c5c5108ae1..103c70b86f0 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -1104,11 +1104,12 @@ unsigned X86TargetLowering::getJumpTableEncoding() const { /// getPICBaseSymbol - Return the X86-32 PIC base. MCSymbol * -X86TargetLowering::getPICBaseSymbol(const MachineFunction *MF, - MCContext &Ctx) const { +X86TargetLowering::getPICBaseSymbol(const MachineFunction &MF) const { + const MCAsmInfo &MAI = *getTargetMachine().getMCAsmInfo(); + MCContext &Ctx = MF.getContext(); return Ctx.GetOrCreateSymbol(Twine(MAI.getPrivateGlobalPrefix())+ - Twine(MF->getFunctionNumber())+"$pb"); + Twine(MF.getFunctionNumber())+"$pb"); } @@ -1146,7 +1147,7 @@ getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, return TargetLowering::getPICJumpTableRelocBaseExpr(MF, JTI, Ctx); // Otherwise, the reference is relative to the PIC base. - return MCSymbolRefExpr::Create(getPICBaseSymbol(MF, Ctx), Ctx); + return MCSymbolRefExpr::Create(getPICBaseSymbol(*MF), Ctx); } /// getFunctionAlignment - Return the Log2 alignment of this function. diff --git a/lib/Target/X86/X86ISelLowering.h b/lib/Target/X86/X86ISelLowering.h index bc79719f2ce..b6a255332ad 100644 --- a/lib/Target/X86/X86ISelLowering.h +++ b/lib/Target/X86/X86ISelLowering.h @@ -431,7 +431,7 @@ namespace llvm { explicit X86TargetLowering(X86TargetMachine &TM); /// getPICBaseSymbol - Return the X86-32 PIC base. - MCSymbol *getPICBaseSymbol(const MachineFunction *MF, MCContext &Ctx) const; + MCSymbol *getPICBaseSymbol(const MachineFunction &MF) const; virtual unsigned getJumpTableEncoding() const; diff --git a/lib/Target/X86/X86MCInstLower.cpp b/lib/Target/X86/X86MCInstLower.cpp index 03c059528e5..ffa4ab93c65 100644 --- a/lib/Target/X86/X86MCInstLower.cpp +++ b/lib/Target/X86/X86MCInstLower.cpp @@ -41,7 +41,7 @@ MachineModuleInfoMachO &X86MCInstLower::getMachOMMI() const { MCSymbol *X86MCInstLower::GetPICBaseSymbol() const { return static_cast(TM.getTargetLowering())-> - getPICBaseSymbol(&MF, Ctx); + getPICBaseSymbol(MF); } /// GetSymbolFromOperand - Lower an MO_GlobalAddress or MO_ExternalSymbol