remove the string form of printVisibility.
authorChris Lattner <sabre@nondot.org>
Sat, 16 Jan 2010 01:17:26 +0000 (01:17 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 16 Jan 2010 01:17:26 +0000 (01:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93609 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 0ebb4b1ba16fbfb86ed034b7988cb1a2c715ded5..d3df48ead2b0f3cac249546b61d044765d3dc18d 100644 (file)
@@ -421,9 +421,6 @@ namespace llvm {
     /// 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;
  
index 16eec0c44a35b5998ebf301712a90a4f2818c833..577d173ff13ba2677748781428edbb305f40d0a5 100644 (file)
@@ -178,21 +178,30 @@ bool AsmPrinter::doFinalization(Module &M) {
     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::printDataDirective(const Type *type, unsigned AddrSpace) {
   }
 }
 
-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) {
index 87f5aad02a63cdd5f6c20bb36de8573f3116ac11..ac4776e657ffb1ca532011ed74d8d1e9371bc195 100644 (file)
@@ -128,7 +128,8 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   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 @@ void PIC16AsmPrinter::EmitFunctionFrame(MachineFunction &MF) {
   // 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)); 
index 86958b98e2f40e882016a077d998a7d6af65848d..b546358bb140d702fb88c01e4b26c4b4c3a2959d 100644 (file)
@@ -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 @@ void SystemZAsmPrinter::printPCRelImmOperand(const MachineInstr *MI, int OpNum){
     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 @@ void SystemZAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
 
     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: