simplify getPICBaseSymbol a bit.
authorChris Lattner <sabre@nondot.org>
Sun, 14 Nov 2010 22:37:11 +0000 (22:37 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 14 Nov 2010 22:37:11 +0000 (22:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119088 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86AsmPrinter.cpp
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
lib/Target/X86/X86MCInstLower.cpp

index 065342f2abc84912b4ca6c2b8b1e16329d92e56a..8aa25923cac37059b2b8951a1ff1394418a22b85 100644 (file)
@@ -50,8 +50,7 @@ using namespace llvm;
 
 void X86AsmPrinter::PrintPICBaseSymbol(raw_ostream &O) const {
   const TargetLowering *TLI = TM.getTargetLowering();
-  O << *static_cast<const X86TargetLowering*>(TLI)->getPICBaseSymbol(MF,
-                                                                    OutContext);
+  O << *static_cast<const X86TargetLowering*>(TLI)->getPICBaseSymbol(*MF);
 }
 
 /// runOnMachineFunction - Emit the function body.
index 1c5c5108ae1d433e6ef1a37cebd1e8e450d604bb..103c70b86f0193e37c2ebc70b6fd982fef2fe5e9 100644 (file)
@@ -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.
index bc79719f2ce0607abe94069695ca45d0ba7edd54..b6a255332ad2931c78fa2d27f0de69941393f247 100644 (file)
@@ -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;
 
index 03c059528e5470cca77f7dbc5218a96ac353e30d..ffa4ab93c650a79bb9e71099c22d04b472baa830 100644 (file)
@@ -41,7 +41,7 @@ MachineModuleInfoMachO &X86MCInstLower::getMachOMMI() const {
 
 MCSymbol *X86MCInstLower::GetPICBaseSymbol() const {
   return static_cast<const X86TargetLowering*>(TM.getTargetLowering())->
-    getPICBaseSymbol(&MF, Ctx);
+    getPICBaseSymbol(MF);
 }
 
 /// GetSymbolFromOperand - Lower an MO_GlobalAddress or MO_ExternalSymbol