[llvm-commits] [llvm] r75736 - /llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

Chris Lattner sabre at nondot.org
Tue Jul 14 20:12:44 PDT 2009


Author: lattner
Date: Tue Jul 14 22:12:43 2009
New Revision: 75736

URL: http://llvm.org/viewvc/llvm-project?rev=75736&view=rev
Log:
convert [Hidden]GVNonLazyPtrs to compute the global and stub names
with the mangler (like x86 and ppc), instead of going through 
printSuffixedName.

Modified:
    llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

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=75736&r1=75735&r2=75736&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Jul 14 22:12:43 2009
@@ -69,11 +69,11 @@
 
     /// GVNonLazyPtrs - Keeps the set of GlobalValues that require
     /// non-lazy-pointers for indirect access.
-    StringSet<> GVNonLazyPtrs;
+    StringMap<std::string> GVNonLazyPtrs;
 
     /// HiddenGVNonLazyPtrs - Keeps the set of GlobalValues with hidden
     /// visibility that require non-lazy-pointers for indirect access.
-    StringSet<> HiddenGVNonLazyPtrs;
+    StringMap<std::string> HiddenGVNonLazyPtrs;
 
     /// FnStubs - Keeps the set of external function GlobalAddresses that the
     /// asm printer should generate stubs for.
@@ -156,21 +156,40 @@
       ARMConstantPoolValue *ACPV = static_cast<ARMConstantPoolValue*>(MCPV);
       GlobalValue *GV = ACPV->getGV();
       std::string Name;
-      if (GV)
-        Name = Mang->getMangledName(GV);
-      else
-        Name = std::string(TAI->getGlobalPrefix()) + ACPV->getSymbol();
+      
+      
       if (ACPV->isNonLazyPointer()) {
+        std::string SymName = Mang->getMangledName(GV);
+        Name = Mang->getMangledName(GV, "$non_lazy_ptr", true);
+        
         if (GV->hasHiddenVisibility())
-          HiddenGVNonLazyPtrs.insert(Name);
+          HiddenGVNonLazyPtrs[SymName] = Name;
         else
-          GVNonLazyPtrs.insert(Name);
-        printSuffixedName(Name, "$non_lazy_ptr");
+          GVNonLazyPtrs[SymName] = Name;
+        O << Name;
       } else if (ACPV->isStub()) {
+        //if (GV)
+        //Name = Mang->getMangledName(GV, "$stub", true);
+        //else
+        //Name = Mang->makeNameProper(ACPV->getSymbol()+"$stub", true);
+        
+        if (GV)
+          Name = Mang->getMangledName(GV);
+        else
+          Name = Mang->makeNameProper(ACPV->getSymbol());
+        
         FnStubs.insert(Name);
         printSuffixedName(Name, "$stub");
-      } else
+      } else {
+        if (GV)
+          Name = Mang->getMangledName(GV);
+        else
+          Name = Mang->makeNameProper(ACPV->getSymbol());
         O << Name;
+      }
+      
+      
+      
       if (ACPV->hasModifier()) O << "(" << ACPV->getModifier() << ")";
       if (ACPV->getPCAdjustment() != 0) {
         O << "-(" << TAI->getPrivateGlobalPrefix() << "PC"
@@ -345,8 +364,7 @@
   }
   case MachineOperand::MO_ExternalSymbol: {
     bool isCallOp = Modifier && !strcmp(Modifier, "call");
-    std::string Name(TAI->getGlobalPrefix());
-    Name += MO.getSymbolName();
+    std::string Name = Mang->makeNameProper(MO.getSymbolName());
     if (isCallOp && Subtarget->isTargetDarwin() &&
         TM.getRelocationModel() != Reloc::Static) {
       printSuffixedName(Name, "$stub");
@@ -1168,8 +1186,8 @@
     SwitchToDataSection("");
 
     // Output stubs for dynamically-linked functions
-    for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end();
-         i != e; ++i) {
+    for (StringSet<>::iterator I = FnStubs.begin(), E = FnStubs.end();
+         I != E; ++I) {
       if (TM.getRelocationModel() == Reloc::PIC_)
         SwitchToTextSection(".section __TEXT,__picsymbolstub4,symbol_stubs,"
                             "none,16", 0);
@@ -1180,7 +1198,7 @@
       EmitAlignment(2);
       O << "\t.code\t32\n";
 
-      const char *p = i->getKeyData();
+      const char *p = I->getKeyData();
       printSuffixedName(p, "$stub");
       O << ":\n";
       O << "\t.indirect_symbol " << p << "\n";
@@ -1214,25 +1232,21 @@
     // Output non-lazy-pointers for external and common global variables.
     if (!GVNonLazyPtrs.empty()) {
       SwitchToDataSection("\t.non_lazy_symbol_pointer", 0);
-      for (StringSet<>::iterator i =  GVNonLazyPtrs.begin(),
-             e = GVNonLazyPtrs.end(); i != e; ++i) {
-        const char *p = i->getKeyData();
-        printSuffixedName(p, "$non_lazy_ptr");
-        O << ":\n";
-        O << "\t.indirect_symbol " << p << "\n";
+      for (StringMap<std::string>::iterator I =  GVNonLazyPtrs.begin(),
+             E = GVNonLazyPtrs.end(); I != E; ++I) {
+        O << I->second << ":\n";
+        O << "\t.indirect_symbol " << I->getKeyData() << "\n";
         O << "\t.long\t0\n";
       }
     }
 
     if (!HiddenGVNonLazyPtrs.empty()) {
       SwitchToSection(TAI->getDataSection());
-      for (StringSet<>::iterator i = HiddenGVNonLazyPtrs.begin(),
-             e = HiddenGVNonLazyPtrs.end(); i != e; ++i) {
-        const char *p = i->getKeyData();
+      for (StringMap<std::string>::iterator I = HiddenGVNonLazyPtrs.begin(),
+             E = HiddenGVNonLazyPtrs.end(); I != E; ++I) {
         EmitAlignment(2);
-        printSuffixedName(p, "$non_lazy_ptr");
-        O << ":\n";
-        O << "\t.long " << p << "\n";
+        O << I->second << ":\n";
+        O << "\t.long " << I->getKeyData() << "\n";
       }
     }
 





More information about the llvm-commits mailing list