[llvm-commits] [llvm] r93646 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfException.h lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp

Chris Lattner sabre at nondot.org
Sat Jan 16 10:37:33 PST 2010


Author: lattner
Date: Sat Jan 16 12:37:32 2010
New Revision: 93646

URL: http://llvm.org/viewvc/llvm-project?rev=93646&view=rev
Log:
rename GetPrivateGlobalValueSymbolStub -> GetSymbolWithGlobalValueBase,
and add an explicit ForcePrivate argument.

Switch FunctionEHFrameInfo to be MCSymbol based instead of string based.

Modified:
    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h
    llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
    llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
    llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
    llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp

Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=93646&r1=93645&r2=93646&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Sat Jan 16 12:37:32 2010
@@ -344,11 +344,12 @@
     /// value.
     MCSymbol *GetGlobalValueSymbol(const GlobalValue *GV) const;
 
-    /// GetPrivateGlobalValueSymbolStub - Return the MCSymbol for a symbol with
+    /// GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with
     /// global value name as its base, with the specified suffix, and where the
-    /// symbol is forced to have private linkage.
-    MCSymbol *GetPrivateGlobalValueSymbolStub(const GlobalValue *GV,
-                                              StringRef Suffix) const;
+    /// symbol is forced to have private linkage if ForcePrivate is true.
+    MCSymbol *GetSymbolWithGlobalValueBase(const GlobalValue *GV,
+                                           StringRef Suffix,
+                                           bool ForcePrivate = true) const;
     
     /// GetExternalSymbolSymbol - Return the MCSymbol for the specified
     /// ExternalSymbol.

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=93646&r1=93645&r2=93646&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Sat Jan 16 12:37:32 2010
@@ -1719,13 +1719,14 @@
   return OutContext.GetOrCreateSymbol(NameStr.str());
 }
 
-/// GetPrivateGlobalValueSymbolStub - Return the MCSymbol for a symbol with
+/// GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with
 /// global value name as its base, with the specified suffix, and where the
-/// symbol is forced to have private linkage.
-MCSymbol *AsmPrinter::GetPrivateGlobalValueSymbolStub(const GlobalValue *GV,
-                                                      StringRef Suffix) const {
+/// symbol is forced to have private linkage if ForcePrivate is true.
+MCSymbol *AsmPrinter::GetSymbolWithGlobalValueBase(const GlobalValue *GV,
+                                                   StringRef Suffix,
+                                                   bool ForcePrivate) const {
   SmallString<60> NameStr;
-  Mang->getNameWithPrefix(NameStr, GV, true);
+  Mang->getNameWithPrefix(NameStr, GV, ForcePrivate);
   NameStr.append(Suffix.begin(), Suffix.end());
   return OutContext.GetOrCreateSymbol(NameStr.str());
 }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=93646&r1=93645&r2=93646&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Sat Jan 16 12:37:32 2010
@@ -22,6 +22,7 @@
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCSection.h"
 #include "llvm/MC/MCStreamer.h"
+#include "llvm/MC/MCSymbol.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetFrameInfo.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
@@ -230,17 +231,26 @@
   // Externally visible entry into the functions eh frame info. If the
   // corresponding function is static, this should not be externally visible.
   if (!TheFunc->hasLocalLinkage())
-    if (const char *GlobalEHDirective = MAI->getGlobalEHDirective())
-      O << GlobalEHDirective << EHFrameInfo.FnName << '\n';
+    if (const char *GlobalEHDirective = MAI->getGlobalEHDirective()) {
+      O << GlobalEHDirective;
+      EHFrameInfo.FunctionEHSym->print(O, MAI);
+      O << '\n';
+    }
 
   // If corresponding function is weak definition, this should be too.
-  if (TheFunc->isWeakForLinker() && MAI->getWeakDefDirective())
-    O << MAI->getWeakDefDirective() << EHFrameInfo.FnName << '\n';
+  if (TheFunc->isWeakForLinker() && MAI->getWeakDefDirective()) {
+    O << MAI->getWeakDefDirective();
+    EHFrameInfo.FunctionEHSym->print(O, MAI);
+    O << '\n';
+  }
 
   // If corresponding function is hidden, this should be too.
   if (TheFunc->hasHiddenVisibility())
-    if (const char *HiddenDirective = MAI->getHiddenDirective())
-      O << HiddenDirective << EHFrameInfo.FnName << '\n' ;
+    if (const char *HiddenDirective = MAI->getHiddenDirective()) {
+      O << HiddenDirective;
+      EHFrameInfo.FunctionEHSym->print(O, MAI);
+      O << '\n';
+    }
 
   // If there are no calls then you can't unwind.  This may mean we can omit the
   // EH Frame, but some environments do not handle weak absolute symbols. If
@@ -250,14 +260,19 @@
       (!TheFunc->isWeakForLinker() ||
        !MAI->getWeakDefDirective() ||
        MAI->getSupportsWeakOmittedEHFrame())) {
-    O << EHFrameInfo.FnName << " = 0\n";
+    EHFrameInfo.FunctionEHSym->print(O, MAI);
+    O << " = 0\n";
     // This name has no connection to the function, so it might get
     // dead-stripped when the function is not, erroneously.  Prohibit
     // dead-stripping unconditionally.
-    if (const char *UsedDirective = MAI->getUsedDirective())
-      O << UsedDirective << EHFrameInfo.FnName << "\n\n";
+    if (const char *UsedDirective = MAI->getUsedDirective()) {
+      O << UsedDirective;
+      EHFrameInfo.FunctionEHSym->print(O, MAI);
+      O << "\n\n";
+    }
   } else {
-    O << EHFrameInfo.FnName << ":\n";
+    EHFrameInfo.FunctionEHSym->print(O, MAI);
+    O << ":\n";
 
     // EH frame header.
     EmitDifference("eh_frame_end", EHFrameInfo.Number,
@@ -328,8 +343,11 @@
     // on unused functions (calling undefined externals) being dead-stripped to
     // link correctly.  Yes, there really is.
     if (MMI->isUsedFunction(EHFrameInfo.function))
-      if (const char *UsedDirective = MAI->getUsedDirective())
-        O << UsedDirective << EHFrameInfo.FnName << "\n\n";
+      if (const char *UsedDirective = MAI->getUsedDirective()) {
+        O << UsedDirective;
+        EHFrameInfo.FunctionEHSym->print(O, MAI);
+        O << "\n\n";
+      }
   }
 
   Asm->EOL();
@@ -928,7 +946,7 @@
     PrintRelDirective();
 
     if (GV) {
-      O << Asm->Mang->getMangledName(GV);
+      Asm->GetGlobalValueSymbol(GV)->print(O, MAI);
     } else {
       O << "0x0";
     }
@@ -1019,12 +1037,12 @@
   EmitLabel("eh_func_end", SubprogramCount);
   EmitExceptionTable();
 
-  std::string FunctionEHName =
-    Asm->Mang->getMangledName(MF->getFunction(), ".eh",
-                              Asm->MAI->is_EHSymbolPrivate());
+  const MCSymbol *FunctionEHSym =
+    Asm->GetSymbolWithGlobalValueBase(MF->getFunction(), ".eh",
+                                      Asm->MAI->is_EHSymbolPrivate());
   
   // Save EH frame information
-  EHFrames.push_back(FunctionEHFrameInfo(FunctionEHName, SubprogramCount,
+  EHFrames.push_back(FunctionEHFrameInfo(FunctionEHSym, SubprogramCount,
                                          MMI->getPersonalityIndex(),
                                          MF->getFrameInfo()->hasCalls(),
                                          !MMI->getLandingPads().empty(),

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=93646&r1=93645&r2=93646&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Sat Jan 16 12:37:32 2010
@@ -34,19 +34,19 @@
 ///
 class DwarfException : public Dwarf {
   struct FunctionEHFrameInfo {
-    std::string FnName;
+    const MCSymbol *FunctionEHSym;  // L_foo.eh
     unsigned Number;
     unsigned PersonalityIndex;
     bool hasCalls;
     bool hasLandingPads;
     std::vector<MachineMove> Moves;
-    const Function * function;
+    const Function *function;
 
-    FunctionEHFrameInfo(const std::string &FN, unsigned Num, unsigned P,
+    FunctionEHFrameInfo(const MCSymbol *EHSym, unsigned Num, unsigned P,
                         bool hC, bool hL,
                         const std::vector<MachineMove> &M,
                         const Function *f):
-      FnName(FN), Number(Num), PersonalityIndex(P),
+      FunctionEHSym(EHSym), Number(Num), PersonalityIndex(P),
       hasCalls(hC), hasLandingPads(hL), Moves(M), function (f) { }
   };
 

Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=93646&r1=93645&r2=93646&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Sat Jan 16 12:37:32 2010
@@ -190,7 +190,7 @@
           GetGlobalValueSymbol(GV)->print(O, MAI);
         else {
           // FIXME: Remove this when Darwin transition to @GOT like syntax.
-          MCSymbol *Sym = GetPrivateGlobalValueSymbolStub(GV, "$non_lazy_ptr");
+          MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
           Sym->print(O, MAI);
           
           MachineModuleInfoMachO &MMIMachO =

Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=93646&r1=93645&r2=93646&view=diff

==============================================================================
--- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Sat Jan 16 12:37:32 2010
@@ -341,7 +341,7 @@
       GlobalValue *GV = MO.getGlobal();
       if (((GV->isDeclaration() || GV->hasWeakLinkage() ||
             GV->hasLinkOnceLinkage() || GV->hasCommonLinkage()))) {
-        GetPrivateGlobalValueSymbolStub(GV, "$non_lazy_ptr")->print(O, MAI);
+        GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr")->print(O, MAI);
         return;
       }
     }

Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=93646&r1=93645&r2=93646&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Sat Jan 16 12:37:32 2010
@@ -70,9 +70,9 @@
         if (Stub != 0) return;
 
         // Get the names.
-        Stub = Printer->GetPrivateGlobalValueSymbolStub(GV, "$stub");
-        LazyPtr = Printer->GetPrivateGlobalValueSymbolStub(GV, "$lazy_ptr");
-        AnonSymbol = Printer->GetPrivateGlobalValueSymbolStub(GV, "$stub$tmp");
+        Stub = Printer->GetSymbolWithGlobalValueBase(GV, "$stub");
+        LazyPtr = Printer->GetSymbolWithGlobalValueBase(GV, "$lazy_ptr");
+        AnonSymbol = Printer->GetSymbolWithGlobalValueBase(GV, "$stub$tmp");
       }
 
       void Init(StringRef GVName, Mangler *Mang, MCContext &Ctx) {
@@ -450,11 +450,11 @@
     if (TM.getRelocationModel() != Reloc::Static &&
         (GV->isDeclaration() || GV->isWeakForLinker())) {
       if (!GV->hasHiddenVisibility()) {
-        SymToPrint = GetPrivateGlobalValueSymbolStub(GV, "$non_lazy_ptr");
+        SymToPrint = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
         GVStubs[GetGlobalValueSymbol(GV)] = SymToPrint;
       } else if (GV->isDeclaration() || GV->hasCommonLinkage() ||
                  GV->hasAvailableExternallyLinkage()) {
-        SymToPrint = GetPrivateGlobalValueSymbolStub(GV, "$non_lazy_ptr");
+        SymToPrint = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
         HiddenGVStubs[GetGlobalValueSymbol(GV)] = SymToPrint;
       } else {
         SymToPrint = GetGlobalValueSymbol(GV);
@@ -1200,7 +1200,7 @@
          E = Personalities.end(); I != E; ++I) {
       if (*I)
         GVStubs[GetGlobalValueSymbol(*I)] =
-          GetPrivateGlobalValueSymbolStub(*I, "$non_lazy_ptr");
+          GetSymbolWithGlobalValueBase(*I, "$non_lazy_ptr");
     }
   }
 

Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp?rev=93646&r1=93645&r2=93646&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp Sat Jan 16 12:37:32 2010
@@ -238,11 +238,11 @@
     
     const MCSymbol *GVSym;
     if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB)
-      GVSym = GetPrivateGlobalValueSymbolStub(GV, "$stub");
+      GVSym = GetSymbolWithGlobalValueBase(GV, "$stub");
     else if (MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY ||
              MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY_PIC_BASE ||
              MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE)
-      GVSym = GetPrivateGlobalValueSymbolStub(GV, "$non_lazy_ptr");
+      GVSym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
     else
       GVSym = GetGlobalValueSymbol(GV);
 
@@ -258,7 +258,7 @@
     
     if (MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY ||
         MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY_PIC_BASE) {
-      MCSymbol *Sym = GetPrivateGlobalValueSymbolStub(GV, "$non_lazy_ptr");
+      MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
       
       const MCSymbol *&StubSym = 
         MMI->getObjFileInfo<MachineModuleInfoMachO>().getGVStubEntry(Sym);
@@ -266,13 +266,13 @@
         StubSym = GetGlobalValueSymbol(GV);
       
     } else if (MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE){
-      MCSymbol *Sym = GetPrivateGlobalValueSymbolStub(GV, "$non_lazy_ptr");
+      MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
       const MCSymbol *&StubSym =
         MMI->getObjFileInfo<MachineModuleInfoMachO>().getHiddenGVStubEntry(Sym);
       if (StubSym == 0)
         StubSym = GetGlobalValueSymbol(GV);
     } else if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
-      MCSymbol *Sym = GetPrivateGlobalValueSymbolStub(GV, "$stub");
+      MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$stub");
       const MCSymbol *&StubSym =
         MMI->getObjFileInfo<MachineModuleInfoMachO>().getFnStubEntry(Sym);
       if (StubSym == 0)





More information about the llvm-commits mailing list