mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-20 10:24:12 +00:00
Fix assembly/disassembly of Thumb2 ADR instructions with immediate operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139422 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -299,6 +299,8 @@ static DecodeStatus DecodeT2LDRDPreInstruction(llvm::MCInst &Inst,unsigned Insn,
|
||||
uint64_t Address, const void *Decoder);
|
||||
static DecodeStatus DecodeT2STRDPreInstruction(llvm::MCInst &Inst,unsigned Insn,
|
||||
uint64_t Address, const void *Decoder);
|
||||
static DecodeStatus DecodeT2Adr(llvm::MCInst &Inst, unsigned Val,
|
||||
uint64_t Address, const void *Decoder);
|
||||
|
||||
#include "ARMGenDisassemblerTables.inc"
|
||||
#include "ARMGenInstrInfo.inc"
|
||||
@ -3762,3 +3764,19 @@ DecodeT2STRDPreInstruction(llvm::MCInst &Inst, unsigned Insn,
|
||||
|
||||
return S;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeT2Adr(llvm::MCInst &Inst, uint32_t Insn,
|
||||
uint64_t Address, const void *Decoder) {
|
||||
unsigned sign1 = fieldFromInstruction32(Insn, 21, 1);
|
||||
unsigned sign2 = fieldFromInstruction32(Insn, 23, 1);
|
||||
if (sign1 != sign2) return MCDisassembler::Fail;
|
||||
|
||||
unsigned Val = fieldFromInstruction32(Insn, 0, 8);
|
||||
Val |= fieldFromInstruction32(Insn, 12, 3) << 8;
|
||||
Val |= fieldFromInstruction32(Insn, 26, 1) << 11;
|
||||
Val |= sign1 << 12;
|
||||
Inst.addOperand(MCOperand::CreateImm(SignExtend32<13>(Val)));
|
||||
|
||||
return MCDisassembler::Success;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user