[PATCH] D100697: [M68k] Change printing of absolute memory references
Ricky Taylor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 19 14:28:50 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6de262827c29: [M68k] Change printing of absolute memory references (authored by ricky26).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100697/new/
https://reviews.llvm.org/D100697
Files:
llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.cpp
llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.h
Index: llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.h
===================================================================
--- llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.h
+++ llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.h
@@ -65,7 +65,7 @@
//
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) {
Index: llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.cpp
===================================================================
--- llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.cpp
+++ llvm/lib/Target/M68k/MCTargetDesc/M68kInstPrinter.cpp
@@ -192,12 +192,14 @@
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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100697.338643.patch
Type: text/x-patch
Size: 1373 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210419/c44acd67/attachment.bin>
More information about the llvm-commits
mailing list