summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
diff options
context:
space:
mode:
authorOliver Stannard <oliver.stannard@arm.com>2018-02-08 13:06:08 +0000
committerOliver Stannard <oliver.stannard@arm.com>2018-02-08 13:06:08 +0000
commitdb982b25ff719ad4e161a66e1978c6357dcb2b8b (patch)
treed08fbcc26faf083164b715e5eae2d56046d8adb9 /llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
parent7aca05102c8dcf1cdfd0bb128c35be357afaf014 (diff)
downloadbcm5719-llvm-db982b25ff719ad4e161a66e1978c6357dcb2b8b.tar.gz
bcm5719-llvm-db982b25ff719ad4e161a66e1978c6357dcb2b8b.zip
[ARM] Fix disassembly of invalid banked register moves
When disassembling banked register move instructions, we don't have an assembly syntax for the unallocated register numbers, so we have to return Fail rather than SoftFail. Previously we were returning SoftFail, then crashing in the InstPrinter as we have no way to represent these encodings in an assembly string. This also switches the decoder to use the table-generated list of banked registers, removing the duplicated list of encodings. Differential revision: https://reviews.llvm.org/D43066 llvm-svn: 324600
Diffstat (limited to 'llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp')
-rw-r--r--llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp b/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
index 658a67511ff..f9a0a74bf8b 100644
--- a/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
+++ b/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
@@ -4205,15 +4205,8 @@ static DecodeStatus DecodeBankedReg(MCInst &Inst, unsigned Val,
// The table of encodings for these banked registers comes from B9.2.3 of the
// ARM ARM. There are patterns, but nothing regular enough to make this logic
// neater. So by fiat, these values are UNPREDICTABLE:
- if (!R) {
- if (SysM == 0x7 || SysM == 0xf || SysM == 0x18 || SysM == 0x19 ||
- SysM == 0x1a || SysM == 0x1b)
- return MCDisassembler::SoftFail;
- } else {
- if (SysM != 0xe && SysM != 0x10 && SysM != 0x12 && SysM != 0x14 &&
- SysM != 0x16 && SysM != 0x1c && SysM != 0x1e)
- return MCDisassembler::SoftFail;
- }
+ if (!ARMBankedReg::lookupBankedRegByEncoding((R << 5) | SysM))
+ return MCDisassembler::Fail;
Inst.addOperand(MCOperand::createImm(Val));
return MCDisassembler::Success;
OpenPOWER on IntegriCloud