Skip to content

Commit da1678a

Browse files
committed
[llvm] Adopt WithMarkup in the MIPS backend (llvm#65384)
Adopt the new markup overload, introduced in 77d1032, in the MIPS backend. (cherry picked from commit c473215)
1 parent 1bd061b commit da1678a

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ const char* Mips::MipsFCCToString(Mips::CondCode CC) {
7272
}
7373

7474
void MipsInstPrinter::printRegName(raw_ostream &OS, MCRegister Reg) const {
75-
OS << markup("<reg:") << '$' << StringRef(getRegisterName(Reg)).lower()
76-
<< markup(">");
75+
markup(OS, Markup::Register)
76+
<< '$' << StringRef(getRegisterName(Reg)).lower();
7777
}
7878

7979
void MipsInstPrinter::printInst(const MCInst *MI, uint64_t Address,
@@ -133,7 +133,7 @@ void MipsInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
133133
}
134134

135135
if (Op.isImm()) {
136-
O << markup("<imm:") << formatImm(Op.getImm()) << markup(">");
136+
markup(O, Markup::Immediate) << formatImm(Op.getImm());
137137
return;
138138
}
139139

@@ -149,9 +149,9 @@ void MipsInstPrinter::printJumpOperand(const MCInst *MI, unsigned OpNo,
149149
return printOperand(MI, OpNo, STI, O);
150150

151151
if (PrintBranchImmAsAddress)
152-
O << markup("<imm:") << formatHex(Op.getImm()) << markup(">");
152+
markup(O, Markup::Immediate) << formatHex(Op.getImm());
153153
else
154-
O << markup("<imm:") << formatImm(Op.getImm()) << markup(">");
154+
markup(O, Markup::Immediate) << formatImm(Op.getImm());
155155
}
156156

157157
void MipsInstPrinter::printBranchOperand(const MCInst *MI, uint64_t Address,
@@ -168,9 +168,9 @@ void MipsInstPrinter::printBranchOperand(const MCInst *MI, uint64_t Address,
168168
Target &= 0xffffffff;
169169
else if (STI.hasFeature(Mips::FeatureMips16))
170170
Target &= 0xffff;
171-
O << markup("<imm:") << formatHex(Target) << markup(">");
171+
markup(O, Markup::Immediate) << formatHex(Target);
172172
} else {
173-
O << markup("<imm:") << formatImm(Op.getImm()) << markup(">");
173+
markup(O, Markup::Immediate) << formatImm(Op.getImm());
174174
}
175175
}
176176

@@ -183,7 +183,7 @@ void MipsInstPrinter::printUImm(const MCInst *MI, int opNum,
183183
Imm -= Offset;
184184
Imm &= (1 << Bits) - 1;
185185
Imm += Offset;
186-
O << markup("<imm:") << formatImm(Imm) << markup(">");
186+
markup(O, Markup::Immediate) << formatImm(Imm);
187187
return;
188188
}
189189

@@ -212,12 +212,11 @@ void MipsInstPrinter::printMemOperand(const MCInst *MI, int opNum,
212212
break;
213213
}
214214

215-
O << markup("<mem:");
215+
WithMarkup M = markup(O, Markup::Memory);
216216
printOperand(MI, opNum + 1, STI, O);
217217
O << "(";
218218
printOperand(MI, opNum, STI, O);
219219
O << ")";
220-
O << markup(">");
221220
}
222221

223222
void MipsInstPrinter::printMemOperandEA(const MCInst *MI, int opNum,

0 commit comments

Comments
 (0)