[PATCH] D159384: [llvm] Adopt WithMarkup in the MIPS backend

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


JDevlieghere created this revision.
JDevlieghere added reviewers: dsanders, ahatanak.
Herald added subscribers: jrtc27, hiraditya, arichardson, sdardis.
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 MIPS backend.


https://reviews.llvm.org/D159384

Files:
  llvm/lib/Target/Mips/MCTargetDesc/MipsInstPrinter.cpp


Index: llvm/lib/Target/Mips/MCTargetDesc/MipsInstPrinter.cpp
===================================================================
--- llvm/lib/Target/Mips/MCTargetDesc/MipsInstPrinter.cpp
+++ llvm/lib/Target/Mips/MCTargetDesc/MipsInstPrinter.cpp
@@ -73,8 +73,8 @@
 }
 
 void MipsInstPrinter::printRegName(raw_ostream &OS, MCRegister Reg) const {
-  OS << markup("<reg:") << '$' << StringRef(getRegisterName(Reg)).lower()
-     << markup(">");
+  markup(OS, Markup::Register)
+      << '$' << StringRef(getRegisterName(Reg)).lower();
 }
 
 void MipsInstPrinter::printInst(const MCInst *MI, uint64_t Address,
@@ -134,7 +134,7 @@
   }
 
   if (Op.isImm()) {
-    O << markup("<imm:") << formatImm(Op.getImm()) << markup(">");
+    markup(O, Markup::Immediate) << formatImm(Op.getImm());
     return;
   }
 
@@ -150,9 +150,9 @@
     return printOperand(MI, OpNo, STI, O);
 
   if (PrintBranchImmAsAddress)
-    O << markup("<imm:") << formatHex(Op.getImm()) << markup(">");
+    markup(O, Markup::Immediate) << formatHex(Op.getImm());
   else
-    O << markup("<imm:") << formatImm(Op.getImm()) << markup(">");
+    markup(O, Markup::Immediate) << formatImm(Op.getImm());
 }
 
 void MipsInstPrinter::printBranchOperand(const MCInst *MI, uint64_t Address,
@@ -169,9 +169,9 @@
       Target &= 0xffffffff;
     else if (STI.hasFeature(Mips::FeatureMips16))
       Target &= 0xffff;
-    O << markup("<imm:") << formatHex(Target) << markup(">");
+    markup(O, Markup::Immediate) << formatHex(Target);
   } else {
-    O << markup("<imm:") << formatImm(Op.getImm()) << markup(">");
+    markup(O, Markup::Immediate) << formatImm(Op.getImm());
   }
 }
 
@@ -184,7 +184,7 @@
     Imm -= Offset;
     Imm &= (1 << Bits) - 1;
     Imm += Offset;
-    O << markup("<imm:") << formatImm(Imm) << markup(">");
+    markup(O, Markup::Immediate) << formatImm(Imm);
     return;
   }
 
@@ -213,12 +213,11 @@
     break;
   }
 
-  O << markup("<mem:");
+  WithMarkup M = markup(O, Markup::Memory);
   printOperand(MI, opNum + 1, STI, O);
   O << "(";
   printOperand(MI, opNum, STI, O);
   O << ")";
-  O << markup(">");
 }
 
 void MipsInstPrinter::printMemOperandEA(const MCInst *MI, int opNum,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159384.555519.patch
Type: text/x-patch
Size: 2176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230901/e0f310ea/attachment-0001.bin>


More information about the llvm-commits mailing list