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

Chris Lattner lattner at cs.uiuc.edu
Mon Aug 16 16:38:48 PDT 2004



Changes in directory llvm/lib/Target/PowerPC:

PPC32AsmPrinter.cpp updated: 1.43 -> 1.44
---
Log message:

More changes to make PPC32 and X86 more similar


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

Index: llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp:1.43 llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp:1.44
--- llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp:1.43	Mon Aug 16 18:30:16 2004
+++ llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp	Mon Aug 16 18:38:36 2004
@@ -152,13 +152,16 @@
 void PowerPCAsmPrinter::emitGlobalConstant(const Constant *CV) {  
   const TargetData &TD = TM.getTargetData();
 
-  if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
-    if (isStringCompatible(CVA)) {
-      O << "\t.ascii ";
+  if (CV->isNullValue()) {
+    O << "\t.space\t" << TD.getTypeSize(CV->getType()) << "\n";
+    return;
+  } else if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
+    if (CVA->isString()) {
+      O << "\t.ascii\t";
       printAsCString(O, CVA);
       O << "\n";
     } else { // Not a string.  Print the values in successive locations
-      for (unsigned i=0, e = CVA->getNumOperands(); i != e; i++)
+      for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i)
         emitGlobalConstant(CVA->getOperand(i));
     }
     return;
@@ -166,7 +169,7 @@
     // Print the fields in successive locations. Pad to align if needed!
     const StructLayout *cvsLayout = TD.getStructLayout(CVS->getType());
     unsigned sizeSoFar = 0;
-    for (unsigned i = 0, e = CVS->getNumOperands(); i != e; i++) {
+    for (unsigned i = 0, e = CVS->getNumOperands(); i != e; ++i) {
       const Constant* field = CVS->getOperand(i);
 
       // Check if padding is needed and insert one or more 0s.
@@ -243,12 +246,7 @@
   case Type::FloatTyID: case Type::DoubleTyID:
     assert (0 && "Should have already output floating point constant.");
   default:
-    if (CV == Constant::getNullValue(type)) {  // Zero initializer?
-      O << ".space\t" << TD.getTypeSize(type) << "\n";      
-      return;
-    }
-    std::cerr << "Can't handle printing: " << *CV;
-    abort();
+    assert (0 && "Can't handle printing this type of thing");
     break;
   }
   O << "\t";






More information about the llvm-commits mailing list