[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp

Jeff Cohen jeffc at jolt-lang.org
Mon May 1 18:16:41 PDT 2006



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.60 -> 1.61
---
Log message:

Make Intel syntax mode friendlier to Microsoft ML assembler (still needs more work).

---
Diffs of the changes:  (+16 -10)

 AsmPrinter.cpp |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.60 llvm/lib/CodeGen/AsmPrinter.cpp:1.61
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.60	Sun Apr 30 23:11:03 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Mon May  1 20:16:28 2006
@@ -372,6 +372,21 @@
   O << "\"";
 }
 
+/// EmitString - Emit a zero-byte-terminated string constant.
+///
+void AsmPrinter::EmitString(const ConstantArray *CVA) const {
+  unsigned NumElts = CVA->getNumOperands();
+  if (AscizDirective && NumElts && 
+      cast<ConstantInt>(CVA->getOperand(NumElts-1))->getRawValue() == 0) {
+    O << AscizDirective;
+    printAsCString(O, CVA, NumElts-1);
+  } else {
+    O << AsciiDirective;
+    printAsCString(O, CVA, NumElts);
+  }
+  O << "\n";
+}
+
 /// EmitGlobalConstant - Print a general LLVM constant to the .s file.
 ///
 void AsmPrinter::EmitGlobalConstant(const Constant *CV) {
@@ -382,16 +397,7 @@
     return;
   } else if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
     if (CVA->isString()) {
-      unsigned NumElts = CVA->getNumOperands();
-      if (AscizDirective && NumElts && 
-          cast<ConstantInt>(CVA->getOperand(NumElts-1))->getRawValue() == 0) {
-        O << AscizDirective;
-        printAsCString(O, CVA, NumElts-1);
-      } else {
-        O << AsciiDirective;
-        printAsCString(O, CVA, NumElts);
-      }
-      O << "\n";
+      EmitString(CVA);
     } else { // Not a string.  Print the values in successive locations
       for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i)
         EmitGlobalConstant(CVA->getOperand(i));






More information about the llvm-commits mailing list