make X86ATTAsmPrinter::PrintPICBaseSymbol forward to X86MCInstLower.
authorChris Lattner <sabre@nondot.org>
Sun, 13 Sep 2009 18:33:59 +0000 (18:33 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 13 Sep 2009 18:33:59 +0000 (18:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81685 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86MCInstLower.h

index 8eac2df29b38c5b9d0749b75d7352ec52e0e7c9c..13304c0abf90bcc38d4eda29e4df8ef6a3fe531c 100644 (file)
@@ -15,6 +15,7 @@
 
 #define DEBUG_TYPE "asm-printer"
 #include "X86ATTAsmPrinter.h"
+#include "X86MCInstLower.h"
 #include "X86.h"
 #include "X86COFF.h"
 #include "X86MachineFunctionInfo.h"
@@ -46,14 +47,9 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed");
 //===----------------------------------------------------------------------===//
 
 void X86ATTAsmPrinter::PrintPICBaseSymbol() const {
-  // FIXME: the actual label generated doesn't matter here!  Just mangle in
-  // something unique (the function number) with Private prefix.
-  if (Subtarget->isTargetDarwin())
-    O << "\"L" << getFunctionNumber() << "$pb\"";
-  else {
-    assert(Subtarget->isTargetELF() && "Don't know how to print PIC label!");
-    O << ".Lllvm$" << getFunctionNumber() << ".$piclabel";
-  }
+  // FIXME: Gross const cast hack.
+  X86ATTAsmPrinter *AP = const_cast<X86ATTAsmPrinter*>(this);
+  X86MCInstLower(OutContext, 0, *AP).GetPICBaseSymbol()->print(O, MAI);
 }
 
 static X86MachineFunctionInfo calculateFunctionInfo(const Function *F,
index bf529fd44e85e6024885ea26e44940a5067ac019..6bf557462eb52c7bb383c3a46667c1485cf8d97c 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef X86_MCINSTLOWER_H
 #define X86_MCINSTLOWER_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
   class MCContext;
   class MCInst;
@@ -22,7 +24,7 @@ namespace llvm {
   class X86Subtarget;
   
 /// X86MCInstLower - This class is used to lower an MachineInstr into an MCInst.
-class X86MCInstLower {
+class VISIBILITY_HIDDEN X86MCInstLower {
   MCContext &Ctx;
   Mangler *Mang;
   X86ATTAsmPrinter &AsmPrinter;