For t2BFI disassembly, apply the same error checking as in r101205.

Change the error msg to read "Encoding error: msb < lsb".

llvm-svn: 101293
This commit is contained in:
Johnny Chen 2010-04-14 22:04:45 +00:00
parent 7a3dff329f
commit 9aaaf4d5fa
2 changed files with 6 additions and 3 deletions

View File

@ -892,8 +892,8 @@ static inline bool getBFCInvMask(uint32_t insn, uint32_t &mask) {
uint32_t lsb = slice(insn, 11, 7);
uint32_t msb = slice(insn, 20, 16);
uint32_t Val = 0;
if (lsb > msb) {
errs() << "Encoding error: lsb > msb\n";
if (msb < lsb) {
errs() << "Encoding error: msb < lsb\n";
return false;
}

View File

@ -1552,7 +1552,10 @@ static bool DisassembleThumb2DPBinImm(MCInst &MI, unsigned Opcode,
Opcode == ARM::t2BFI) && "Invalid opcode");
MI.addOperand(MCOperand::CreateImm(getLsb(insn)));
if (Opcode == ARM::t2BFI) {
assert(getMsb(insn) >= getLsb(insn) && "Encoding error");
if (getMsb(insn) < getLsb(insn)) {
errs() << "Encoding error: msb < lsb\n";
return false;
}
MI.addOperand(MCOperand::CreateImm(getMsb(insn) - getLsb(insn) + 1));
} else
MI.addOperand(MCOperand::CreateImm(getWidthMinus1(insn) + 1));