[llvm-commits] [llvm] r93609 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp

Chris Lattner sabre at nondot.org
Fri Jan 15 17:17:26 PST 2010


Author: lattner
Date: Fri Jan 15 19:17:26 2010
New Revision: 93609

URL: http://llvm.org/viewvc/llvm-project?rev=93609&view=rev
Log:
remove the string form of printVisibility.

Modified:
    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
    llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp

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

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Fri Jan 15 19:17:26 2010
@@ -421,9 +421,6 @@
     /// this is suported by the target.
     void printVisibility(const MCSymbol *Sym, unsigned Visibility) const;
     
-    // FIXME: This is deprecated and should be removed.
-    void printVisibility(const std::string& Name, unsigned Visibility) const;
-
     /// printOffset - This is just convenient handler for printing offsets.
     void printOffset(int64_t Offset) const;
  

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

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Jan 15 19:17:26 2010
@@ -178,21 +178,30 @@
     O << '\n';
     for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
          I != E; ++I) {
-      std::string Name = Mang->getMangledName(I);
+      MCSymbol *Name = GetGlobalValueSymbol(I);
 
       const GlobalValue *GV = cast<GlobalValue>(I->getAliasedGlobal());
-      std::string Target = Mang->getMangledName(GV);
+      MCSymbol *Target = GetGlobalValueSymbol(GV);
 
-      if (I->hasExternalLinkage() || !MAI->getWeakRefDirective())
-        O << "\t.globl\t" << Name << '\n';
-      else if (I->hasWeakLinkage())
-        O << MAI->getWeakRefDirective() << Name << '\n';
-      else if (!I->hasLocalLinkage())
-        llvm_unreachable("Invalid alias linkage");
+      if (I->hasExternalLinkage() || !MAI->getWeakRefDirective()) {
+        O << "\t.globl\t";
+        Name->print(O, MAI);
+        O << '\n';
+      } else if (I->hasWeakLinkage()) {
+        O << MAI->getWeakRefDirective();
+        Name->print(O, MAI);
+        O << '\n';
+      } else {
+        assert(!I->hasLocalLinkage() && "Invalid alias linkage");
+      }
 
       printVisibility(Name, I->getVisibility());
 
-      O << MAI->getSetDirective() << ' ' << Name << ", " << Target << '\n';
+      O << MAI->getSetDirective() << ' ';
+      Name->print(O, MAI);
+      O << ", ";
+      Target->print(O, MAI);
+      O << '\n';
     }
   }
 
@@ -1846,17 +1855,6 @@
   }
 }
 
-void AsmPrinter::printVisibility(const std::string& Name,
-                                 unsigned Visibility) const {
-  if (Visibility == GlobalValue::HiddenVisibility) {
-    if (const char *Directive = MAI->getHiddenDirective())
-      O << Directive << Name << '\n';
-  } else if (Visibility == GlobalValue::ProtectedVisibility) {
-    if (const char *Directive = MAI->getProtectedDirective())
-      O << Directive << Name << '\n';
-  }
-}
-
 void AsmPrinter::printVisibility(const MCSymbol *Sym,
                                  unsigned Visibility) const {
   if (Visibility == GlobalValue::HiddenVisibility) {

Modified: llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp?rev=93609&r1=93608&r2=93609&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp Fri Jan 15 19:17:26 2010
@@ -128,7 +128,8 @@
   O << "\tretlw  high(" << PAN::getFrameLabel(CurrentFnName) << ")\n";
 
   // Emit function start label.
-  O << CurrentFnName << ":\n";
+  CurrentFnSym->print(O, MAI);
+  O << ":\n";
 
   DebugLoc CurDL;
   O << "\n"; 
@@ -399,7 +400,8 @@
   // Emit the data section name.
   O << "\n"; 
   
-  PIC16Section *fPDataSection = const_cast<PIC16Section *>(getObjFileLowering().
+  PIC16Section *fPDataSection =
+    const_cast<PIC16Section *>(getObjFileLowering().
                                 SectionForFrame(CurrentFnName));
  
   fPDataSection->setColor(getFunctionColor(F)); 

Modified: llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp?rev=93609&r1=93608&r2=93609&view=diff

==============================================================================
--- llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp Fri Jan 15 19:17:26 2010
@@ -35,7 +35,6 @@
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormattedStream.h"
-#include "llvm/Support/Mangler.h"
 using namespace llvm;
 
 STATISTIC(EmittedInsts, "Number of machine instrs printed");
@@ -184,9 +183,7 @@
     return;
   case MachineOperand::MO_GlobalAddress: {
     const GlobalValue *GV = MO.getGlobal();
-    std::string Name = Mang->getMangledName(GV);
-
-    O << Name;
+    GetGlobalValueSymbol(GV)->print(O, MAI);
 
     // Assemble calls via PLT for externally visible symbols if PIC.
     if (TM.getRelocationModel() == Reloc::PIC_ &&
@@ -250,17 +247,11 @@
 
     printOffset(MO.getOffset());
     break;
-  case MachineOperand::MO_GlobalAddress: {
-    const GlobalValue *GV = MO.getGlobal();
-    std::string Name = Mang->getMangledName(GV);
-
-    O << Name;
+  case MachineOperand::MO_GlobalAddress:
+    GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
     break;
-  }
   case MachineOperand::MO_ExternalSymbol: {
-    std::string Name(MAI->getGlobalPrefix());
-    Name += MO.getSymbolName();
-    O << Name;
+    GetExternalSymbolSymbol(MO.getSymbolName())->print(O, MAI);
     break;
   }
   default:





More information about the llvm-commits mailing list