[llvm] dca2b26 - Lanai: Replace deprecated MCExpr::print with MCAsmInfo::printExpr
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 15 17:25:18 PDT 2025
Author: Fangrui Song
Date: 2025-06-15T17:25:13-07:00
New Revision: dca2b261d77a9b758587b660e5b88b6a312d057c
URL: https://github.com/llvm/llvm-project/commit/dca2b261d77a9b758587b660e5b88b6a312d057c
DIFF: https://github.com/llvm/llvm-project/commit/dca2b261d77a9b758587b660e5b88b6a312d057c.diff
LOG: Lanai: Replace deprecated MCExpr::print with MCAsmInfo::printExpr
Added:
Modified:
llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.cpp
llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.cpp b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.cpp
index 837d8fea1c896..add4096ef9365 100644
--- a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.cpp
+++ b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.cpp
@@ -152,7 +152,7 @@ void LanaiInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
OS << formatHex(Op.getImm());
else {
assert(Op.isExpr() && "Expected an expression");
- Op.getExpr()->print(OS, &MAI);
+ MAI.printExpr(OS, *Op.getExpr());
}
}
@@ -165,7 +165,7 @@ void LanaiInstPrinter::printMemImmOperand(const MCInst *MI, unsigned OpNo,
// Symbolic operand will be lowered to immediate value by linker
assert(Op.isExpr() && "Expected an expression");
OS << '[';
- Op.getExpr()->print(OS, &MAI);
+ MAI.printExpr(OS, *Op.getExpr());
OS << ']';
}
}
@@ -178,7 +178,7 @@ void LanaiInstPrinter::printHi16ImmOperand(const MCInst *MI, unsigned OpNo,
} else {
// Symbolic operand will be lowered to immediate value by linker
assert(Op.isExpr() && "Expected an expression");
- Op.getExpr()->print(OS, &MAI);
+ MAI.printExpr(OS, *Op.getExpr());
}
}
@@ -190,7 +190,7 @@ void LanaiInstPrinter::printHi16AndImmOperand(const MCInst *MI, unsigned OpNo,
} else {
// Symbolic operand will be lowered to immediate value by linker
assert(Op.isExpr() && "Expected an expression");
- Op.getExpr()->print(OS, &MAI);
+ MAI.printExpr(OS, *Op.getExpr());
}
}
@@ -202,7 +202,7 @@ void LanaiInstPrinter::printLo16AndImmOperand(const MCInst *MI, unsigned OpNo,
} else {
// Symbolic operand will be lowered to immediate value by linker
assert(Op.isExpr() && "Expected an expression");
- Op.getExpr()->print(OS, &MAI);
+ MAI.printExpr(OS, *Op.getExpr());
}
}
@@ -227,7 +227,7 @@ static void printMemoryImmediateOffset(const MCAsmInfo &MAI,
assert(isInt<SizeInBits>(OffsetOp.getImm()) && "Constant value truncated");
OS << OffsetOp.getImm();
} else
- OffsetOp.getExpr()->print(OS, &MAI);
+ MAI.printExpr(OS, *OffsetOp.getExpr());
}
void LanaiInstPrinter::printMemRiOperand(const MCInst *MI, int OpNo,
diff --git a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.cpp b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.cpp
index eec1b7f482f18..b75a09915660c 100644
--- a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.cpp
+++ b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "LanaiMCExpr.h"
+#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCStreamer.h"
@@ -21,7 +22,7 @@ const LanaiMCExpr *LanaiMCExpr::create(Spec S, const MCExpr *Expr,
void LanaiMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
if (specifier == VK_Lanai_None) {
- Expr->print(OS, MAI);
+ MAI->printExpr(OS, *Expr);
return;
}
@@ -38,6 +39,6 @@ void LanaiMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
OS << '(';
const MCExpr *Expr = getSubExpr();
- Expr->print(OS, MAI);
+ MAI->printExpr(OS, *Expr);
OS << ')';
}
More information about the llvm-commits
mailing list