Support more insane CEP's in AsmPrinter (Yes, PyPy folks do really use them).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45172 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov 2007-12-18 20:53:41 +00:00
parent 1d87cb1c12
commit feb8893d17

View 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;