mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
ARM: fix thumb literal loads decoding
This fixes two previous issues: - Negative offsets were not correctly disassembled - The decoded opcodes were not the right one git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184180 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -315,15 +315,29 @@ void ARMInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
|
||||
void ARMInstPrinter::printThumbLdrLabelOperand(const MCInst *MI, unsigned OpNum,
|
||||
raw_ostream &O) {
|
||||
const MCOperand &MO1 = MI->getOperand(OpNum);
|
||||
if (MO1.isExpr())
|
||||
if (MO1.isExpr()) {
|
||||
O << *MO1.getExpr();
|
||||
else if (MO1.isImm()) {
|
||||
O << markup("<mem:") << "[pc, "
|
||||
<< markup("<imm:") << "#" << formatImm(MO1.getImm())
|
||||
<< markup(">]>", "]");
|
||||
return;
|
||||
}
|
||||
else
|
||||
llvm_unreachable("Unknown LDR label operand?");
|
||||
|
||||
O << markup("<mem:") << "[pc, ";
|
||||
|
||||
int32_t OffImm = (int32_t)MO1.getImm();
|
||||
bool isSub = OffImm < 0;
|
||||
|
||||
// Special value for #-0. All others are normal.
|
||||
if (OffImm == INT32_MIN)
|
||||
OffImm = 0;
|
||||
if (isSub) {
|
||||
O << markup("<imm:")
|
||||
<< "#-" << formatImm(-OffImm)
|
||||
<< markup(">");
|
||||
} else {
|
||||
O << markup("<imm:")
|
||||
<< "#" << formatImm(OffImm)
|
||||
<< markup(">");
|
||||
}
|
||||
O << "]" << markup(">");
|
||||
}
|
||||
|
||||
// so_reg is a 4-operand unit corresponding to register forms of the A5.1
|
||||
|
||||
Reference in New Issue
Block a user