Use a switch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195857 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2013-11-27 18:18:24 +00:00
parent 0de6255877
commit b7e71e35a9

View File

@@ -281,14 +281,20 @@ static void printLeaMemReference(X86AsmPrinter &P, const MachineInstr *MI,
// HasParenPart - True if we will print out the () part of the mem ref. // HasParenPart - True if we will print out the () part of the mem ref.
bool HasParenPart = IndexReg.getReg() || HasBaseReg; bool HasParenPart = IndexReg.getReg() || HasBaseReg;
if (DispSpec.isImm()) { switch (DispSpec.getType()) {
default:
llvm_unreachable("unknown operand type!");
case MachineOperand::MO_Immediate: {
int DispVal = DispSpec.getImm(); int DispVal = DispSpec.getImm();
if (DispVal || !HasParenPart) if (DispVal || !HasParenPart)
O << DispVal; O << DispVal;
} else { break;
assert(DispSpec.isGlobal() || DispSpec.isCPI() || }
DispSpec.isJTI() || DispSpec.isSymbol()); case MachineOperand::MO_GlobalAddress:
printSymbolOperand(P, MI->getOperand(Op+3), O); case MachineOperand::MO_ConstantPoolIndex:
case MachineOperand::MO_JumpTableIndex:
case MachineOperand::MO_ExternalSymbol:
printSymbolOperand(P, MI->getOperand(Op + 3), O);
} }
if (Modifier && strcmp(Modifier, "H") == 0) if (Modifier && strcmp(Modifier, "H") == 0)