1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[M68k] Change printing of absolute memory references

This also includes PC-relative addresses since they are still
referenced as absolute addresses in assembly and converted to
relative addresses by the assembler.

This changes, for example:
- `bra #-2` -> `bra $100`
- `jsr #16` -> `jsr $10`

Differential Revision: https://reviews.llvm.org/D100697
This commit is contained in:
Ricky Taylor 2021-04-17 11:03:34 +01:00
parent e33a96ca60
commit c0b7dfd047
2 changed files with 8 additions and 6 deletions

View File

@ -192,12 +192,14 @@ void M68kInstPrinter::printARIIMem(const MCInst *MI, unsigned opNum,
void M68kInstPrinter::printAbsMem(const MCInst *MI, unsigned opNum,
raw_ostream &O) {
const MCOperand &MO = MI->getOperand(opNum);
if (MO.isImm()) {
// ??? Print it in hex?
O << (unsigned int)MO.getImm();
} else {
printOperand(MI, opNum, O);
if (MO.isExpr()) {
MO.getExpr()->print(O, &MAI);
return;
}
assert(MO.isImm() && "absolute memory addressing needs an immediate");
O << format("$%0" PRIx64, (uint64_t)MO.getImm());
}
void M68kInstPrinter::printPCDMem(const MCInst *MI, uint64_t Address,

View File

@ -65,7 +65,7 @@ private:
//
void printPCRelImm(const MCInst *MI, uint64_t Address, unsigned opNum,
raw_ostream &O) {
printOperand(MI, opNum, O);
printAbsMem(MI, opNum, O);
}
void printARI8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {