CSKY: Replace deprecated MCExpr::print with MCAsmInfo::printExpr

This commit is contained in:
Fangrui Song
2025-06-28 15:14:55 -07:00
parent bdb299a67e
commit d2e8e55e02
3 changed files with 7 additions and 5 deletions

View File

@@ -474,7 +474,7 @@ unsigned DIEExpr::sizeOf(const dwarf::FormParams &FormParams,
LLVM_DUMP_METHOD
void DIEExpr::print(raw_ostream &O) const {
O << "Expr: ";
Expr->print(O, nullptr);
MCAsmInfo().printExpr(O, *Expr);
}
//===----------------------------------------------------------------------===//

View File

@@ -138,7 +138,7 @@ void CSKYInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
}
assert(MO.isExpr() && "Unknown operand kind in printOperand");
MO.getExpr()->print(O, &MAI);
MAI.printExpr(O, *MO.getExpr());
}
void CSKYInstPrinter::printDataSymbol(const MCInst *MI, unsigned OpNo,
@@ -150,7 +150,7 @@ void CSKYInstPrinter::printDataSymbol(const MCInst *MI, unsigned OpNo,
if (MO.isImm())
O << MO.getImm();
else
MO.getExpr()->print(O, &MAI);
MAI.printExpr(O, *MO.getExpr());
O << "]";
}
@@ -173,7 +173,7 @@ void CSKYInstPrinter::printConstpool(const MCInst *MI, uint64_t Address,
assert(MO.isExpr() && "Unknown operand kind in printConstpool");
O << "[";
MO.getExpr()->print(O, &MAI);
MAI.printExpr(O, *MO.getExpr());
O << "]";
}

View File

@@ -8,6 +8,7 @@
#include "CSKYMCExpr.h"
#include "CSKYFixupKinds.h"
#include "MCTargetDesc/CSKYMCAsmInfo.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
@@ -63,7 +64,8 @@ void CSKYMCExpr::visitUsedExpr(MCStreamer &Streamer) const {
}
void CSKYMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
Expr->print(OS, MAI);
if (MAI)
MAI->printExpr(OS, *Expr);
OS << getVariantKindName(getSpecifier());
}