[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp SlotCalculator.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Feb 14 23:56:36 PST 2004


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.121 -> 1.122
SlotCalculator.cpp updated: 1.51 -> 1.52

---
Log message:

Adjustments to support the new ConstantAggregateZero class



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

Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.121 llvm/lib/VMCore/AsmWriter.cpp:1.122
--- llvm/lib/VMCore/AsmWriter.cpp:1.121	Sun Feb  8 22:37:31 2004
+++ llvm/lib/VMCore/AsmWriter.cpp	Sat Feb 14 23:55:15 2004
@@ -288,12 +288,9 @@
            "assuming that double is 64 bits!");
     Out << "0x" << utohexstr(*(uint64_t*)Ptr);
 
+  } else if (isa<ConstantAggregateZero>(CV)) {
+    Out << "zeroinitializer";
   } else if (const ConstantArray *CA = dyn_cast<ConstantArray>(CV)) {
-    if (CA->getNumOperands() > 5 && CA->isNullValue()) {
-      Out << "zeroinitializer";
-      return;
-    }
-
     // As a special case, print the array as a string if it is an array of
     // ubytes or an array of sbytes with positive values.
     // 
@@ -339,11 +336,6 @@
       Out << " ]";
     }
   } else if (const ConstantStruct *CS = dyn_cast<ConstantStruct>(CV)) {
-    if (CS->getNumOperands() > 5 && CS->isNullValue()) {
-      Out << "zeroinitializer";
-      return;
-    }
-
     Out << "{";
     if (CS->getNumOperands()) {
       Out << " ";


Index: llvm/lib/VMCore/SlotCalculator.cpp
diff -u llvm/lib/VMCore/SlotCalculator.cpp:1.51 llvm/lib/VMCore/SlotCalculator.cpp:1.52
--- llvm/lib/VMCore/SlotCalculator.cpp:1.51	Sun Feb  8 18:15:41 2004
+++ llvm/lib/VMCore/SlotCalculator.cpp	Sat Feb 14 23:55:15 2004
@@ -146,7 +146,8 @@
           TypePlane &Plane = Table[plane];
           unsigned FirstNonStringID = 0;
           for (unsigned i = 0, e = Plane.size(); i != e; ++i)
-            if (cast<ConstantArray>(Plane[i])->isString()) {
+            if (isa<ConstantAggregateZero>(Plane[i]) ||
+                cast<ConstantArray>(Plane[i])->isString()) {
               // Check to see if we have to shuffle this string around.  If not,
               // don't do anything.
               if (i != FirstNonStringID) {





More information about the llvm-commits mailing list