summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-04-02 02:24:54 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-04-02 02:24:54 +0000
commit04187ecd57c6ce2550fbcea43966c5cff234b39a (patch)
treee46b06d8d882e553420796c4c43d84315829674a /lib
parentad8ffad60ae33e834c18072a37b6b30fe45efdf6 (diff)
downloadllvm-04187ecd57c6ce2550fbcea43966c5cff234b39a.tar.gz
llvm-04187ecd57c6ce2550fbcea43966c5cff234b39a.tar.bz2
llvm-04187ecd57c6ce2550fbcea43966c5cff234b39a.tar.xz
Fixed a bug in disassembly of STR_POST, where the immediate is the second operand in am2offset;
instead of the second operand in addrmode_imm12. rdar://problem/9225289 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp b/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp
index 884a056ef5..27683e3975 100644
--- a/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp
+++ b/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp
@@ -1098,12 +1098,20 @@ static bool DisassembleLdStFrm(MCInst &MI, unsigned Opcode, uint32_t insn,
OpIdx += 1;
}
- // Disassemble the 12-bit immediate offset, which is the second operand in
- // $addrmode_imm12 => (ops GPR:$base, i32imm:$offsimm).
- //
unsigned Imm12 = slice(insn, 11, 0);
- int Offset = AddrOpcode == ARM_AM::add ? 1 * Imm12 : -1 * Imm12;
- MI.addOperand(MCOperand::CreateImm(Offset));
+ if (Opcode == ARM::LDRBi12 || Opcode == ARM::LDRi12 ||
+ Opcode == ARM::STRBi12 || Opcode == ARM::STRi12) {
+ // Disassemble the 12-bit immediate offset, which is the second operand in
+ // $addrmode_imm12 => (ops GPR:$base, i32imm:$offsimm).
+ int Offset = AddrOpcode == ARM_AM::add ? 1 * Imm12 : -1 * Imm12;
+ MI.addOperand(MCOperand::CreateImm(Offset));
+ } else {
+ // Disassemble the 12-bit immediate offset, which is the second operand in
+ // $am2offset => (ops GPR, i32imm).
+ unsigned Offset = ARM_AM::getAM2Opc(AddrOpcode, Imm12, ARM_AM::no_shift,
+ IndexMode);
+ MI.addOperand(MCOperand::CreateImm(Offset));
+ }
OpIdx += 1;
} else {
// The opcode ARM::LDRT actually corresponds to both Encoding A1 and A2 of