[llvm] 913bca7 - [llvm] Adopt WithMarkup in the SystemZ backend

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 17:39:11 PDT 2023


Author: Jonas Devlieghere
Date: 2023-09-01T17:39:06-07:00
New Revision: 913bca718a1333c6139fc1ee23970f0f1b48d298

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

LOG: [llvm] Adopt WithMarkup in the SystemZ backend

Adopt the new markup overload, introduced in 77d1032516e7, in the
SystemZ backend.

Differential revision: https://reviews.llvm.org/D159388

Added: 
    

Modified: 
    llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp
index a32dc9a2e7d5cd..b622e7f3b27b9f 100644
--- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp
+++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp
@@ -50,7 +50,7 @@ void SystemZInstPrinter::printOperand(const MCOperand &MO, const MCAsmInfo *MAI,
       printFormattedRegName(MAI, MO.getReg(), O);
   }
   else if (MO.isImm())
-    O << markup("<imm:") << MO.getImm() << markup(">");
+    markup(O, Markup::Immediate) << MO.getImm();
   else if (MO.isExpr())
     MO.getExpr()->print(O, MAI);
   else
@@ -64,9 +64,9 @@ void SystemZInstPrinter::printFormattedRegName(const MCAsmInfo *MAI,
   if (MAI->getAssemblerDialect() == AD_HLASM) {
     // Skip register prefix so that only register number is left
     assert(isalpha(RegName[0]) && isdigit(RegName[1]));
-    O << markup("<reg:") << (RegName + 1) << markup(">");
+    markup(O, Markup::Register) << (RegName + 1);
   } else
-    O << markup("<reg:") << '%' << RegName << markup(">");
+    markup(O, Markup::Register) << '%' << RegName;
 }
 
 void SystemZInstPrinter::printRegName(raw_ostream &O, MCRegister Reg) const {
@@ -90,7 +90,7 @@ void SystemZInstPrinter::printUImmOperand(const MCInst *MI, int OpNum,
   }
   uint64_t Value = static_cast<uint64_t>(MO.getImm());
   assert(isUInt<N>(Value) && "Invalid uimm argument");
-  O << markup("<imm:") << Value << markup(">");
+  markup(O, Markup::Immediate) << Value;
 }
 
 template <unsigned N>
@@ -103,7 +103,7 @@ void SystemZInstPrinter::printSImmOperand(const MCInst *MI, int OpNum,
   }
   int64_t Value = MI->getOperand(OpNum).getImm();
   assert(isInt<N>(Value) && "Invalid simm argument");
-  O << markup("<imm:") << Value << markup(">");
+  markup(O, Markup::Immediate) << Value;
 }
 
 void SystemZInstPrinter::printU1ImmOperand(const MCInst *MI, int OpNum,
@@ -170,9 +170,9 @@ void SystemZInstPrinter::printPCRelOperand(const MCInst *MI, int OpNum,
                                            raw_ostream &O) {
   const MCOperand &MO = MI->getOperand(OpNum);
   if (MO.isImm()) {
-    O << markup("<imm:") << "0x";
+    WithMarkup M = markup(O, Markup::Immediate);
+    O << "0x";
     O.write_hex(MO.getImm());
-    O << markup(">");
   } else
     MO.getExpr()->print(O, &MAI);
 }


        


More information about the llvm-commits mailing list