Support more insane CEP's in AsmPrinter (Yes, PyPy folks do really use them).
authorAnton Korobeynikov <asl@math.spbu.ru>
Tue, 18 Dec 2007 20:53:41 +0000 (20:53 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Tue, 18 Dec 2007 20:53:41 +0000 (20:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45172 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter.cpp

index ce89337f36fbf2c4f3e83dd299fd3d0b86e726c1..1b4a575d4372ef6cf04ece8efae6351438cbf104 100644 (file)
@@ -773,9 +773,32 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
     }
     case Instruction::Add:
     case Instruction::Sub:
+    case Instruction::And:
+    case Instruction::Or:
+    case Instruction::Xor:
       O << "(";
       EmitConstantValueOnly(CE->getOperand(0));
-      O << (Opcode==Instruction::Add ? ") + (" : ") - (");
+      O << ")";
+      switch (Opcode) {
+      case Instruction::Add:
+       O << " + ";
+       break;
+      case Instruction::Sub:
+       O << " - ";
+       break;
+      case Instruction::And:
+       O << " & ";
+       break;
+      case Instruction::Or:
+       O << " | ";
+       break;
+      case Instruction::Xor:
+       O << " ^ ";
+       break;
+      default:
+       break;
+      }
+      O << "(";
       EmitConstantValueOnly(CE->getOperand(1));
       O << ")";
       break;