From b7e71e35a9d49ae097c524411248a3ed783d895c Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 27 Nov 2013 18:18:24 +0000 Subject: [PATCH] Use a switch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195857 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86AsmPrinter.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 924c4e9166a..cb3833c2970 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -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. 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) -- 2.34.1