[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Nov 17 11:40:41 PST 2005



Changes in directory llvm/lib/Target/PowerPC:

PPCAsmPrinter.cpp updated: 1.112 -> 1.113
---
Log message:

only use dyld stubs if not in ppc-static mode.  This completes support for
non-static codegen.


---
Diffs of the changes:  (+21 -15)

 PPCAsmPrinter.cpp |   36 +++++++++++++++++++++---------------
 1 files changed, 21 insertions(+), 15 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.112 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.113
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.112	Thu Nov 17 13:25:59 2005
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp	Thu Nov 17 13:40:30 2005
@@ -154,20 +154,24 @@
     void printCallOperand(const MachineInstr *MI, unsigned OpNo,
                           MVT::ValueType VT) {
       const MachineOperand &MO = MI->getOperand(OpNo);
-      if (MO.getType() == MachineOperand::MO_ExternalSymbol) {
-        std::string Name(GlobalPrefix); Name += MO.getSymbolName();
-        FnStubs.insert(Name);
-        O << "L" << Name << "$stub";
-      } else if (MO.getType() == MachineOperand::MO_GlobalAddress &&
-                 isa<Function>(MO.getGlobal()) && 
-                 cast<Function>(MO.getGlobal())->isExternal()) {
-        // Dynamically-resolved functions need a stub for the function.
-        std::string Name = Mang->getValueName(MO.getGlobal());
-        FnStubs.insert(Name);
-        O << "L" << Name << "$stub";
-      } else {
-        printOp(MI->getOperand(OpNo));
+      if (!PPCGenerateStaticCode) {
+        if (MO.getType() == MachineOperand::MO_ExternalSymbol) {
+          std::string Name(GlobalPrefix); Name += MO.getSymbolName();
+          FnStubs.insert(Name);
+          O << "L" << Name << "$stub";
+          return;
+        } else if (MO.getType() == MachineOperand::MO_GlobalAddress &&
+                   isa<Function>(MO.getGlobal()) && 
+                   cast<Function>(MO.getGlobal())->isExternal()) {
+          // Dynamically-resolved functions need a stub for the function.
+          std::string Name = Mang->getValueName(MO.getGlobal());
+          FnStubs.insert(Name);
+          O << "L" << Name << "$stub";
+          return;
+        }
       }
+      
+      printOp(MI->getOperand(OpNo));
     }
     void printAbsAddrOperand(const MachineInstr *MI, unsigned OpNo,
                              MVT::ValueType VT) {
@@ -334,7 +338,9 @@
     std::string Name = Mang->getValueName(GV);
 
     // External or weakly linked global variables need non-lazily-resolved stubs
-    if ((GV->isExternal() || GV->hasWeakLinkage() || GV->hasLinkOnceLinkage())){
+    if (!PPCGenerateStaticCode &&
+        ((GV->isExternal() || GV->hasWeakLinkage() ||
+          GV->hasLinkOnceLinkage()))) {
       if (GV->hasLinkOnceLinkage())
         LinkOnceStubs.insert(Name);
       else
@@ -343,7 +349,7 @@
       return;
     }
 
-    O << Mang->getValueName(GV);
+    O << Name;
     return;
   }
 






More information about the llvm-commits mailing list