diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-03-18 00:38:03 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-03-18 00:38:03 +0000 |
commit | 5e5a40867a1adce1178ed226b77b0a1b0cb6a5c0 (patch) | |
tree | f4b3a72301ef01edd556c6d8c06ad91ec8991c86 /lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h | |
parent | f3e6774880762674dc845b25dbf01ad212f21d03 (diff) | |
download | external_llvm-5e5a40867a1adce1178ed226b77b0a1b0cb6a5c0.tar.gz external_llvm-5e5a40867a1adce1178ed226b77b0a1b0cb6a5c0.tar.bz2 external_llvm-5e5a40867a1adce1178ed226b77b0a1b0cb6a5c0.zip |
The disassembler for Thumb was wrongly adding 4 to the computed imm32 offset.
Remove the offending logic and update the test cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127843 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h')
-rw-r--r-- | lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h b/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h index fcfe1de17a..da4faf4971 100644 --- a/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h +++ b/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h @@ -962,11 +962,7 @@ static bool DisassembleThumb1Br(MCInst &MI, unsigned Opcode, uint32_t insn, unsigned Imm11 = getT1Imm11(insn); - // When executing a Thumb instruction, PC reads as the address of the current - // instruction plus 4. The assembler subtracts 4 from the difference between - // the branch instruction and the target address, disassembler has to add 4 to - // to compensate. - MI.addOperand(MCOperand::CreateImm(SignExtend32<12>(Imm11 << 1) + 4)); + MI.addOperand(MCOperand::CreateImm(SignExtend32<12>(Imm11 << 1))); NumOpsAdded = 1; @@ -1747,11 +1743,7 @@ static bool DisassembleThumb2BrMiscCtrl(MCInst &MI, unsigned Opcode, Offset = decodeImm32_BLX(insn); break; } - // When executing a Thumb instruction, PC reads as the address of the current - // instruction plus 4. The assembler subtracts 4 from the difference between - // the branch instruction and the target address, disassembler has to add 4 to - // to compensate. - MI.addOperand(MCOperand::CreateImm(Offset + 4)); + MI.addOperand(MCOperand::CreateImm(Offset)); // This is an increment as some predicate operands may have been added first. NumOpsAdded += 1; |