[PATCH] D129867: [MipsInstPrinter] Introduce markup tags emission
Antonio Frighetto via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 15 08:45:07 PDT 2022
antoniofrighetto created this revision.
antoniofrighetto added a reviewer: MaskRay.
Herald added subscribers: StephenFan, atanasyan, jrtc27, hiraditya, arichardson, sdardis.
Herald added a project: All.
antoniofrighetto requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
MIPS assembly syntax emission now leverages markup tags, if enabled.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D129867
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
@@ -72,7 +72,8 @@
}
void MipsInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
- OS << '$' << StringRef(getRegisterName(RegNo)).lower();
+ OS << markup("<reg:") << '$' << StringRef(getRegisterName(RegNo)).lower()
+ << markup(">");
}
void MipsInstPrinter::printInst(const MCInst *MI, uint64_t Address,
@@ -132,7 +133,7 @@
}
if (Op.isImm()) {
- O << formatImm(Op.getImm());
+ O << markup("<imm:") << formatImm(Op.getImm()) << markup(">");
return;
}
@@ -148,9 +149,9 @@
return printOperand(MI, OpNo, STI, O);
if (PrintBranchImmAsAddress)
- O << formatHex(Op.getImm());
+ O << markup("<imm:") << formatHex(Op.getImm()) << markup(">");
else
- O << formatImm(Op.getImm());
+ O << markup("<imm:") << formatImm(Op.getImm()) << markup(">");
}
void MipsInstPrinter::printBranchOperand(const MCInst *MI, uint64_t Address,
@@ -167,9 +168,9 @@
Target &= 0xffffffff;
else if (STI.hasFeature(Mips::FeatureMips16))
Target &= 0xffff;
- O << formatHex(Target);
+ O << markup("<imm:") << formatHex(Target) << markup(">");
} else {
- O << formatImm(Op.getImm());
+ O << markup("<imm:") << formatImm(Op.getImm()) << markup(">");
}
}
@@ -182,7 +183,7 @@
Imm -= Offset;
Imm &= (1 << Bits) - 1;
Imm += Offset;
- O << formatImm(Imm);
+ O << markup("<imm:") << formatImm(Imm) << markup(">");
return;
}
@@ -211,10 +212,12 @@
break;
}
+ O << markup("<mem:");
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: D129867.444997.patch
Type: text/x-patch
Size: 1940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220715/41686a0a/attachment.bin>
More information about the llvm-commits
mailing list