[llvm] r195857 - Use a switch.
Rafael Espindola
rafael.espindola at gmail.com
Wed Nov 27 10:18:24 PST 2013
Author: rafael
Date: Wed Nov 27 12:18:24 2013
New Revision: 195857
URL: http://llvm.org/viewvc/llvm-project?rev=195857&view=rev
Log:
Use a switch.
Modified:
llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=195857&r1=195856&r2=195857&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Wed Nov 27 12:18:24 2013
@@ -281,14 +281,20 @@ static void printLeaMemReference(X86AsmP
// HasParenPart - True if we will print out the () part of the mem ref.
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();
if (DispVal || !HasParenPart)
O << DispVal;
- } else {
- assert(DispSpec.isGlobal() || DispSpec.isCPI() ||
- DispSpec.isJTI() || DispSpec.isSymbol());
- printSymbolOperand(P, MI->getOperand(Op+3), O);
+ break;
+ }
+ case MachineOperand::MO_GlobalAddress:
+ 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)
More information about the llvm-commits
mailing list