Replace deprecated MCExpr::print with MCAsmInfo::printExpr

This commit is contained in:
Fangrui Song
2025-06-15 17:41:17 -07:00
parent 22ad0359f9
commit c9d511bc64
4 changed files with 7 additions and 6 deletions

View File

@@ -195,7 +195,7 @@ std::string createRetpolineFunctionTag(BinaryContext &BC,
TagOS << "+";
if (MemRef.DispExpr)
MemRef.DispExpr->print(TagOS, BC.AsmInfo.get());
BC.AsmInfo->printExpr(TagOS, *MemRef.DispExpr);
else
TagOS << MemRef.DispImm;

View File

@@ -48,7 +48,7 @@ void MSP430InstPrinter::printPCRelImmOperand(const MCInst *MI, unsigned OpNo,
O << Imm;
} else {
assert(Op.isExpr() && "unknown pcrel immediate operand");
Op.getExpr()->print(O, &MAI);
MAI.printExpr(O, *Op.getExpr());
}
}
@@ -62,7 +62,7 @@ void MSP430InstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
} else {
assert(Op.isExpr() && "unknown operand kind in printOperand");
O << '#';
Op.getExpr()->print(O, &MAI);
MAI.printExpr(O, *Op.getExpr());
}
}
@@ -83,7 +83,7 @@ void MSP430InstPrinter::printSrcMemOperand(const MCInst *MI, unsigned OpNo,
O << '&';
if (Disp.isExpr())
Disp.getExpr()->print(O, &MAI);
MAI.printExpr(O, *Disp.getExpr());
else {
assert(Disp.isImm() && "Expected immediate in displacement field");
O << Disp.getImm();

View File

@@ -18,6 +18,7 @@
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrInfo.h"
@@ -344,7 +345,7 @@ void WebAssemblyInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
auto &Sym = static_cast<const MCSymbolWasm &>(SRE->getSymbol());
O << WebAssembly::signatureToString(Sym.getSignature());
} else {
Op.getExpr()->print(O, &MAI);
MAI.printExpr(O, *Op.getExpr());
}
}
}

View File

@@ -135,7 +135,7 @@ void XtensaInstPrinter::printCallOperand(const MCInst *MI, uint64_t Address,
O << Val;
}
} else if (MC.isExpr())
MC.getExpr()->print(O, &MAI);
MAI.printExpr(O, *MC.getExpr());
else
llvm_unreachable("Invalid operand");
}