Skip to content

Commit 0456f6f

Browse files
committed
Add LDS/STS disassemble
1 parent ee414e3 commit 0456f6f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

llvm/lib/Target/AVR/Disassembler/AVRDisassembler.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,22 @@ static DecodeStatus decodeLoadStore(MCInst &Inst, unsigned Insn,
433433
return MCDisassembler::Success;
434434
}
435435

436+
static DecodeStatus decodeLoadStore32(MCInst &Inst, unsigned Insn,
437+
uint64_t Address,
438+
const MCDisassembler *Decoder) {
439+
// Get the register that will be loaded or stored.
440+
unsigned RegVal = GPRDecoderTable[(Insn >> 20) & 0x1f];
441+
442+
// Decode LDS/STS
443+
if ((Insn & 0xfc0f0000) == 0x90000000) {
444+
Inst.setOpcode((Insn & 0x02000000) ? AVR::STSKRr : AVR::LDSRdK);
445+
Inst.addOperand(MCOperand::createReg(RegVal));
446+
Inst.addOperand(MCOperand::createImm(Insn & 0xFFFF));
447+
return MCDisassembler::Success;
448+
}
449+
return MCDisassembler::Fail;
450+
}
451+
436452
static DecodeStatus readInstruction16(ArrayRef<uint8_t> Bytes, uint64_t Address,
437453
uint64_t &Size, uint32_t &Insn) {
438454
if (Bytes.size() < 2) {
@@ -523,6 +539,10 @@ DecodeStatus AVRDisassembler::getInstruction(MCInst &Instr, uint64_t &Size,
523539
return Result;
524540
}
525541

542+
Result = decodeLoadStore32(Instr, Insn, Address, this);
543+
if (Result != MCDisassembler::Fail)
544+
return Result;
545+
526546
return MCDisassembler::Fail;
527547
}
528548
}

0 commit comments

Comments
 (0)