summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/Disassembler
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-04-12 17:09:04 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-04-12 17:09:04 +0000
commitd0e2be39ea6977c4f8278e5b8a624fcf2dc4ff39 (patch)
tree205bbe9b464dee4413ce6f2c6854c7c77780c0cb /llvm/lib/Target/ARM/Disassembler
parentf3539ad5c77273bbdcf10bcbbd3a6de94d2768f2 (diff)
downloadbcm5719-llvm-d0e2be39ea6977c4f8278e5b8a624fcf2dc4ff39.tar.gz
bcm5719-llvm-d0e2be39ea6977c4f8278e5b8a624fcf2dc4ff39.zip
Print out a debug message when the reglist fails the sanity check for Thumb Ld/St Multiple.
llvm-svn: 129365
Diffstat (limited to 'llvm/lib/Target/ARM/Disassembler')
-rw-r--r--llvm/lib/Target/ARM/Disassembler/ARMDisassemblerCore.h25
-rw-r--r--llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h4
2 files changed, 29 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/Disassembler/ARMDisassemblerCore.h b/llvm/lib/Target/ARM/Disassembler/ARMDisassemblerCore.h
index 41e2a6049d8..a7ba14141c0 100644
--- a/llvm/lib/Target/ARM/Disassembler/ARMDisassemblerCore.h
+++ b/llvm/lib/Target/ARM/Disassembler/ARMDisassemblerCore.h
@@ -139,6 +139,31 @@ static inline void setSlice(unsigned &Bits, unsigned From, unsigned To,
Bits |= (Val & Mask) << To;
}
+// Return an integer result equal to the number of bits of x that are ones.
+static inline uint32_t
+BitCount (uint64_t x)
+{
+ // c accumulates the total bits set in x
+ uint32_t c;
+ for (c = 0; x; ++c)
+ {
+ x &= x - 1; // clear the least significant bit set
+ }
+ return c;
+}
+
+static inline bool
+BitIsSet (const uint64_t value, const uint64_t bit)
+{
+ return (value & (1ull << bit)) != 0;
+}
+
+static inline bool
+BitIsClear (const uint64_t value, const uint64_t bit)
+{
+ return (value & (1ull << bit)) == 0;
+}
+
/// Various utilities for checking the target specific flags.
/// A unary data processing instruction doesn't have an Rn operand.
diff --git a/llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h b/llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h
index 480f8bb2bd7..b1a389abfd8 100644
--- a/llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h
+++ b/llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h
@@ -901,6 +901,10 @@ static bool DisassembleThumb1LdStMul(bool Ld, MCInst &MI, unsigned Opcode,
}
unsigned RegListBits = slice(insn, 7, 0);
+ if (BitCount(RegListBits) < 1) {
+ DEBUG(errs() << "if BitCount(registers) < 1 then UNPREDICTABLE\n");
+ return false;
+ }
// Fill the variadic part of reglist.
for (unsigned i = 0; i < 8; ++i)
OpenPOWER on IntegriCloud