[llvm] d2e8e55 - CSKY: Replace deprecated MCExpr::print with MCAsmInfo::printExpr

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 28 15:14:59 PDT 2025


Author: Fangrui Song
Date: 2025-06-28T15:14:55-07:00
New Revision: d2e8e55e02f7e082cd7bae4d834ba5ee08f8b46c

URL: https://github.com/llvm/llvm-project/commit/d2e8e55e02f7e082cd7bae4d834ba5ee08f8b46c
DIFF: https://github.com/llvm/llvm-project/commit/d2e8e55e02f7e082cd7bae4d834ba5ee08f8b46c.diff

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/DIE.cpp
    llvm/lib/Target/CSKY/MCTargetDesc/CSKYInstPrinter.cpp
    llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
index 52b26c95c0755..a2252d8f00f00 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -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);
 }
 
 //===----------------------------------------------------------------------===//

diff  --git a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYInstPrinter.cpp b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYInstPrinter.cpp
index 47c05d67296e3..981712a5089a1 100644
--- a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYInstPrinter.cpp
+++ b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYInstPrinter.cpp
@@ -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 << "]";
 }
 

diff  --git a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp
index 696cd1daa035c..86e731bb231c6 100644
--- a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp
+++ b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp
@@ -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());
 }
 


        


More information about the llvm-commits mailing list