eliminate the horrid AsmPrinter::getGlobalLinkName method, inlining
authorChris Lattner <sabre@nondot.org>
Wed, 16 Sep 2009 00:08:41 +0000 (00:08 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 16 Sep 2009 00:08:41 +0000 (00:08 +0000)
it into all of its call sites and simplifying them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81962 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/AsmPrinter.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfException.cpp

index decbea73197554122f66eab291bde01a384af8cb..8404841b5a3f70ebadced0ec98b6b78f536f0249 100644 (file)
@@ -159,12 +159,6 @@ namespace llvm {
     ///
     bool isVerbose() const { return VerboseAsm; }
 
-    /// getGlobalLinkName - Returns the asm/link name of of the specified
-    /// global variable.  Should be overridden by each target asm printer to
-    /// generate the appropriate value.
-    virtual const std::string &getGlobalLinkName(const GlobalVariable *GV,
-                                                 std::string &LinkName) const;
-
     /// EmitExternalGlobal - Emit the external reference to a global variable.
     /// Should be overridden if an indirect reference should be used.
     virtual void EmitExternalGlobal(const GlobalVariable *GV);
index 745696cc87907d604c94c9d3ff913071d0fe95a4..a457421b90711b01732a86452e54eb637482ebc9 100644 (file)
@@ -509,20 +509,10 @@ void AsmPrinter::EmitXXStructorList(Constant *List) {
     }
 }
 
-/// getGlobalLinkName - Returns the asm/link name of of the specified
-/// global variable.  Should be overridden by each target asm printer to
-/// generate the appropriate value.
-const std::string &AsmPrinter::getGlobalLinkName(const GlobalVariable *GV,
-                                                 std::string &LinkName) const {
-  LinkName += Mang->getMangledName(GV);
-  return LinkName;
-}
-
 /// EmitExternalGlobal - Emit the external reference to a global variable.
 /// Should be overridden if an indirect reference should be used.
 void AsmPrinter::EmitExternalGlobal(const GlobalVariable *GV) {
-  std::string GLN;
-  O << getGlobalLinkName(GV, GLN);
+  O << Mang->getMangledName(GV);
 }
 
 
index 577f111ff60265a1a9f9b76636b8bd8af5bb6936..750f3cb4a6a5a9201d02a9bf94d50709c778d842 100644 (file)
@@ -23,6 +23,7 @@
 #include "llvm/Target/TargetLoweringObjectFile.h"
 #include "llvm/Target/TargetRegisterInfo.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Mangler.h"
 #include "llvm/Support/Timer.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/System/Path.h"
@@ -1501,9 +1502,8 @@ void DwarfDebug::ConstructGlobalVariableDIE(MDNode *N) {
   // Add address.
   DIEBlock *Block = new DIEBlock();
   AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);
-  std::string GLN;
   AddObjectLabel(Block, 0, dwarf::DW_FORM_udata,
-                 Asm->getGlobalLinkName(DI_GV.getGlobal(), GLN));
+                 Asm->Mang->getMangledName(DI_GV.getGlobal()));
   AddBlock(VariableDie, dwarf::DW_AT_location, 0, Block);
 
   // Add to map.
index 9efa1eadac78fcedd6763ee7e4e6bd49c07ccaa8..abd2e6fe80d30bb80fda99a3ea772f5cd689d0f7 100644 (file)
@@ -872,8 +872,7 @@ void DwarfException::EmitExceptionTable() {
     PrintRelDirective();
 
     if (GV) {
-      std::string GLN;
-      O << Asm->getGlobalLinkName(GV, GLN);
+      O << Asm->Mang->getMangledName(GV);
     } else {
       O << "0x0";
     }