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

This commit is contained in:
Fangrui Song
2025-06-15 17:34:31 -07:00
parent 178fac3d61
commit 22ad0359f9
3 changed files with 5 additions and 3 deletions

View File

@@ -15,6 +15,7 @@
#include "NVPTXUtilities.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/NVVMIntrinsicUtils.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrInfo.h"
@@ -90,7 +91,7 @@ void NVPTXInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
markup(O, Markup::Immediate) << formatImm(Op.getImm());
} else {
assert(Op.isExpr() && "Unknown operand kind in printOperand");
Op.getExpr()->print(O, &MAI);
MAI.printExpr(O, *Op.getExpr());
}
}

View File

@@ -1850,7 +1850,7 @@ NVPTXAsmPrinter::lowerConstantForGV(const Constant *CV,
}
void NVPTXAsmPrinter::printMCExpr(const MCExpr &Expr, raw_ostream &OS) const {
Expr.print(OS, OutContext.getAsmInfo());
OutContext.getAsmInfo()->printExpr(OS, Expr);
}
/// PrintAsmOperand - Print out an operand for an inline asm expression.

View File

@@ -8,6 +8,7 @@
#include "NVPTXMCExpr.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/Format.h"
@@ -64,6 +65,6 @@ NVPTXGenericMCSymbolRefExpr::create(const MCSymbolRefExpr *SymExpr,
void NVPTXGenericMCSymbolRefExpr::printImpl(raw_ostream &OS,
const MCAsmInfo *MAI) const {
OS << "generic(";
SymExpr->print(OS, MAI);
MAI->printExpr(OS, *SymExpr);
OS << ")";
}