Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions llvm/lib/Target/AVR/Disassembler/AVRDisassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,22 @@ static DecodeStatus decodeLoadStore(MCInst &Inst, unsigned Insn,
return MCDisassembler::Success;
}

static DecodeStatus decodeLoadStore32(MCInst &Inst, unsigned Insn,
uint64_t Address,
const MCDisassembler *Decoder) {
// Get the register that will be loaded or stored.
unsigned RegVal = GPRDecoderTable[(Insn >> 20) & 0x1f];

// Decode LDS/STS
if ((Insn & 0xfc0f0000) == 0x90000000) {
Inst.setOpcode((Insn & 0x02000000) ? AVR::STSKRr : AVR::LDSRdK);
Inst.addOperand(MCOperand::createReg(RegVal));
Inst.addOperand(MCOperand::createImm(Insn & 0xFFFF));
return MCDisassembler::Success;
}
return MCDisassembler::Fail;
}

static DecodeStatus readInstruction16(ArrayRef<uint8_t> Bytes, uint64_t Address,
uint64_t &Size, uint32_t &Insn) {
if (Bytes.size() < 2) {
Expand Down Expand Up @@ -523,6 +539,10 @@ DecodeStatus AVRDisassembler::getInstruction(MCInst &Instr, uint64_t &Size,
return Result;
}

Result = decodeLoadStore32(Instr, Insn, Address, this);
if (Result != MCDisassembler::Fail)
return Result;

return MCDisassembler::Fail;
}
}
Expand Down
Loading