mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
ARM: add operands pre-writeback variants when needed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184181 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1079,6 +1079,7 @@ void ARMInstPrinter::printAddrModeImm12Operand(const MCInst *MI, unsigned OpNum,
|
||||
O << "]" << markup(">");
|
||||
}
|
||||
|
||||
template<bool AlwaysPrintImm0>
|
||||
void ARMInstPrinter::printT2AddrModeImm8Operand(const MCInst *MI,
|
||||
unsigned OpNum,
|
||||
raw_ostream &O) {
|
||||
@@ -1089,22 +1090,25 @@ void ARMInstPrinter::printT2AddrModeImm8Operand(const MCInst *MI,
|
||||
printRegName(O, MO1.getReg());
|
||||
|
||||
int32_t OffImm = (int32_t)MO2.getImm();
|
||||
bool isSub = OffImm < 0;
|
||||
// Don't print +0.
|
||||
if (OffImm != 0)
|
||||
O << ", ";
|
||||
if (OffImm != 0 && UseMarkup)
|
||||
O << "<imm:";
|
||||
if (OffImm == INT32_MIN)
|
||||
O << "#-0";
|
||||
else if (OffImm < 0)
|
||||
O << "#-" << -OffImm;
|
||||
else if (OffImm > 0)
|
||||
O << "#" << OffImm;
|
||||
if (OffImm != 0 && UseMarkup)
|
||||
O << ">";
|
||||
OffImm = 0;
|
||||
if (isSub) {
|
||||
O << ", "
|
||||
<< markup("<imm:")
|
||||
<< "#-" << -OffImm
|
||||
<< markup(">");
|
||||
} else if (AlwaysPrintImm0 || OffImm > 0) {
|
||||
O << ", "
|
||||
<< markup("<imm:")
|
||||
<< "#" << OffImm
|
||||
<< markup(">");
|
||||
}
|
||||
O << "]" << markup(">");
|
||||
}
|
||||
|
||||
template<bool AlwaysPrintImm0>
|
||||
void ARMInstPrinter::printT2AddrModeImm8s4Operand(const MCInst *MI,
|
||||
unsigned OpNum,
|
||||
raw_ostream &O) {
|
||||
@@ -1120,22 +1124,24 @@ void ARMInstPrinter::printT2AddrModeImm8s4Operand(const MCInst *MI,
|
||||
printRegName(O, MO1.getReg());
|
||||
|
||||
int32_t OffImm = (int32_t)MO2.getImm();
|
||||
bool isSub = OffImm < 0;
|
||||
|
||||
assert(((OffImm & 0x3) == 0) && "Not a valid immediate!");
|
||||
|
||||
// Don't print +0.
|
||||
if (OffImm != 0)
|
||||
O << ", ";
|
||||
if (OffImm != 0 && UseMarkup)
|
||||
O << "<imm:";
|
||||
if (OffImm == INT32_MIN)
|
||||
O << "#-0";
|
||||
else if (OffImm < 0)
|
||||
O << "#-" << -OffImm;
|
||||
else if (OffImm > 0)
|
||||
O << "#" << OffImm;
|
||||
if (OffImm != 0 && UseMarkup)
|
||||
O << ">";
|
||||
OffImm = 0;
|
||||
if (isSub) {
|
||||
O << ", "
|
||||
<< markup("<imm:")
|
||||
<< "#-" << -OffImm
|
||||
<< markup(">");
|
||||
} else if (AlwaysPrintImm0 || OffImm > 0) {
|
||||
O << ", "
|
||||
<< markup("<imm:")
|
||||
<< "#" << OffImm
|
||||
<< markup(">");
|
||||
}
|
||||
O << "]" << markup(">");
|
||||
}
|
||||
|
||||
|
@@ -97,8 +97,10 @@ public:
|
||||
template<bool AlwaysPrintImm0>
|
||||
void printAddrModeImm12Operand(const MCInst *MI, unsigned OpNum,
|
||||
raw_ostream &O);
|
||||
template<bool AlwaysPrintImm0>
|
||||
void printT2AddrModeImm8Operand(const MCInst *MI, unsigned OpNum,
|
||||
raw_ostream &O);
|
||||
template<bool AlwaysPrintImm0>
|
||||
void printT2AddrModeImm8s4Operand(const MCInst *MI, unsigned OpNum,
|
||||
raw_ostream &O);
|
||||
void printT2AddrModeImm0_1020s4Operand(const MCInst *MI, unsigned OpNum,
|
||||
|
Reference in New Issue
Block a user