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

Anton Korobeynikov asl at math.spbu.ru
Sun Feb 4 15:27:58 PST 2007



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.143 -> 1.144
---
Log message:

Fixing silly "not-implemented" bug in AsmPrinter. This fixes PR1169: http://llvm.org/PR1169 .


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

 AsmPrinter.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.143 llvm/lib/CodeGen/AsmPrinter.cpp:1.144
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.143	Thu Feb  1 11:46:10 2007
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Sun Feb  4 17:27:42 2007
@@ -608,7 +608,8 @@
     }
   } else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
     const TargetData *TD = TM.getTargetData();
-    switch(CE->getOpcode()) {
+    unsigned Opcode = CE->getOpcode();    
+    switch (Opcode) {
     case Instruction::GetElementPtr: {
       // generate a symbolic expression for the byte address
       const Constant *ptrVal = CE->getOperand(0);
@@ -666,9 +667,10 @@
       break;
     }
     case Instruction::Add:
+    case Instruction::Sub:
       O << "(";
       EmitConstantValueOnly(CE->getOperand(0));
-      O << ") + (";
+      O << (Opcode==Instruction::Add ? ") + (" : ") - (");
       EmitConstantValueOnly(CE->getOperand(1));
       O << ")";
       break;






More information about the llvm-commits mailing list