summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-03-18 00:38:03 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-03-18 00:38:03 +0000
commite387f8a5e928abe5e382361d5948a638ed4ba338 (patch)
tree84196878cde8747f5a32ab88ab8683b1ba7efa76 /llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h
parentf8f67f01888282e0f87f98b9e446cecf6c74a619 (diff)
downloadbcm5719-llvm-e387f8a5e928abe5e382361d5948a638ed4ba338.tar.gz
bcm5719-llvm-e387f8a5e928abe5e382361d5948a638ed4ba338.zip
The disassembler for Thumb was wrongly adding 4 to the computed imm32 offset.
Remove the offending logic and update the test cases. llvm-svn: 127843
Diffstat (limited to 'llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h')
-rw-r--r--llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h12
1 files changed, 2 insertions, 10 deletions
diff --git a/llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h b/llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h
index fcfe1de17a4..da4faf4971a 100644
--- a/llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h
+++ b/llvm/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;
OpenPOWER on IntegriCloud