[PATCH] D159388: [llvm] Adopt WithMarkup in the SystemZ backend

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 15:46:27 PDT 2023


JDevlieghere created this revision.
JDevlieghere added reviewers: uweigand, MaskRay.
Herald added a subscriber: hiraditya.
Herald added a project: All.
JDevlieghere requested review of this revision.
Herald added a project: LLVM.

Adopt the new markup overload, introduced in 77d1032516e7 <https://reviews.llvm.org/rG77d1032516e7057f185c5137071e4a97c3f3eb30>, in the SystemZ backend.


https://reviews.llvm.org/D159388

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


Index: llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp
===================================================================
--- llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp
+++ llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp
@@ -50,7 +50,7 @@
       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 @@
   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 @@
   }
   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 @@
   }
   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 @@
                                            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);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159388.555523.patch
Type: text/x-patch
Size: 1949 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230901/38ae1537/attachment.bin>


More information about the llvm-commits mailing list