From: Matt Arsenault Date: Sat, 21 Feb 2015 21:29:04 +0000 (+0000) Subject: R600/SI: Don't crash when getting immediate operand size X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=90363904984ad712f9581332aa54a77bf34f605a;p=oota-llvm.git R600/SI: Don't crash when getting immediate operand size git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230147 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/R600/SIInstrInfo.h b/lib/Target/R600/SIInstrInfo.h index f3285cff6c4..4d3371b1aec 100644 --- a/lib/Target/R600/SIInstrInfo.h +++ b/lib/Target/R600/SIInstrInfo.h @@ -254,6 +254,13 @@ public: // instruction opcode. unsigned getOpSize(uint16_t Opcode, unsigned OpNo) const { const MCOperandInfo &OpInfo = get(Opcode).OpInfo[OpNo]; + + if (OpInfo.RegClass == -1) { + // If this is an immediate operand, this must be a 32-bit literal. + assert(OpInfo.OperandType == MCOI::OPERAND_IMMEDIATE); + return 4; + } + return RI.getRegClass(OpInfo.RegClass)->getSize(); }