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

Chris Lattner lattner at cs.uiuc.edu
Sun Nov 20 22:48:10 PST 2005



Changes in directory llvm/lib/Target/PowerPC:

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

set PrivateGlobalPrefix on darwin, use it when printing out CP references


---
Diffs of the changes:  (+9 -7)

 PPCAsmPrinter.cpp |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.113 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.114
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.113	Thu Nov 17 13:40:30 2005
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp	Mon Nov 21 00:47:58 2005
@@ -230,6 +230,7 @@
       : PPCAsmPrinter(O, TM) {
       CommentString = ";";
       GlobalPrefix = "_";
+      PrivateGlobalPrefix = "L";     // Marker for constant pool idxs
       ZeroDirective = "\t.space\t";  // ".space N" emits N zeros.
       Data64bitsDirective = 0;       // we can't emit a 64-bit unit
       AlignmentIsInBytes = false;    // Alignment is by power of 2.
@@ -326,7 +327,8 @@
   }
 
   case MachineOperand::MO_ConstantPoolIndex:
-    O << "LCPI" << FunctionNumber << '_' << MO.getConstantPoolIndex();
+    O << PrivateGlobalPrefix << "CPI" << FunctionNumber
+      << '_' << MO.getConstantPoolIndex();
     return;
 
   case MachineOperand::MO_ExternalSymbol:
@@ -447,16 +449,16 @@
 
   if (CP.empty()) return;
 
+  SwitchSection(".const", 0);
   for (unsigned i = 0, e = CP.size(); i != e; ++i) {
-    SwitchSection(".const", 0);
     // FIXME: force doubles to be naturally aligned.  We should handle this
     // more correctly in the future.
-    if (Type::DoubleTy == CP[i]->getType())
+    if (CP[i]->getType() == Type::DoubleTy)
       emitAlignment(3);
     else
       emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType()));
-    O << "LCPI" << FunctionNumber << '_' << i << ":\t\t\t\t\t" << CommentString
-      << *CP[i] << '\n';
+    O << PrivateGlobalPrefix << "CPI" << FunctionNumber << '_' << i
+      << ":\t\t\t\t\t" << CommentString << *CP[i] << '\n';
     emitGlobalConstant(CP[i]);
   }
 }
@@ -664,8 +666,8 @@
     SwitchSection(".const", 0);
     O << "\t.align " << (unsigned)TD.getTypeAlignment(CP[i]->getType())
       << "\n";
-    O << "LCPI" << FunctionNumber << '_' << i << ":\t\t\t\t\t;"
-      << *CP[i] << '\n';
+    O << PrivateGlobalPrefix << "CPI" << FunctionNumber << '_' << i
+      << ":\t\t\t\t\t;" << *CP[i] << '\n';
     emitGlobalConstant(CP[i]);
   }
 }






More information about the llvm-commits mailing list