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

Chris Lattner lattner at cs.uiuc.edu
Mon Aug 16 16:30:29 PDT 2004



Changes in directory llvm/lib/Target/PowerPC:

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

Minor changes to make the diff be nothing against the X86 version


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

Index: llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp:1.42 llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp:1.43
--- llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp:1.42	Mon Aug 16 18:25:21 2004
+++ llvm/lib/Target/PowerPC/PPC32AsmPrinter.cpp	Mon Aug 16 18:30:16 2004
@@ -106,21 +106,6 @@
 // Include the auto-generated portion of the assembly writer
 #include "PowerPCGenAsmWriter.inc"
 
-/// isStringCompatible - Can we treat the specified array as a string?
-/// Only if it is an array of ubytes or non-negative sbytes.
-///
-static bool isStringCompatible(const ConstantArray *CVA) {
-  const Type *ETy = cast<ArrayType>(CVA->getType())->getElementType();
-  if (ETy == Type::UByteTy) return true;
-  if (ETy != Type::SByteTy) return false;
-
-  for (unsigned i = 0; i < CVA->getNumOperands(); ++i)
-    if (cast<ConstantSInt>(CVA->getOperand(i))->getValue() < 0)
-      return false;
-
-  return true;
-}
-
 /// toOctal - Convert the low order bits of X into an octal digit.
 ///
 static inline char toOctal(int X) {
@@ -128,13 +113,13 @@
 }
 
 /// getAsCString - Return the specified array as a C compatible
-/// string, only if the predicate isStringCompatible is true.
+/// string, only if the predicate isString is true.
 ///
 static void printAsCString(std::ostream &O, const ConstantArray *CVA) {
-  assert(isStringCompatible(CVA) && "Array is not string compatible!");
+  assert(CVA->isString() && "Array is not string compatible!");
 
   O << "\"";
-  for (unsigned i = 0; i < CVA->getNumOperands(); ++i) {
+  for (unsigned i = 0; i != CVA->getNumOperands(); ++i) {
     unsigned char C = cast<ConstantInt>(CVA->getOperand(i))->getRawValue();
 
     if (C == '"') {
@@ -144,7 +129,7 @@
     } else if (isprint(C)) {
       O << C;
     } else {
-      switch (C) {
+      switch(C) {
       case '\b': O << "\\b"; break;
       case '\f': O << "\\f"; break;
       case '\n': O << "\\n"; break;






More information about the llvm-commits mailing list