Skip to content

Commit c473215

Browse files
authored
[llvm] Adopt WithMarkup in the MIPS backend (#65384)
Adopt the new markup overload, introduced in 77d1032, in the MIPS backend.
1 parent cec1de3 commit c473215

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
@@ -73,8 +73,8 @@ const char* Mips::MipsFCCToString(Mips::CondCode CC) {
7373
}
7474

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

8080
void MipsInstPrinter::printInst(const MCInst *MI, uint64_t Address,
@@ -134,7 +134,7 @@ void MipsInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
134134
}
135135

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

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

152152
if (PrintBranchImmAsAddress)
153-
O << markup("<imm:") << formatHex(Op.getImm()) << markup(">");
153+
markup(O, Markup::Immediate) << formatHex(Op.getImm());
154154
else
155-
O << markup("<imm:") << formatImm(Op.getImm()) << markup(">");
155+
markup(O, Markup::Immediate) << formatImm(Op.getImm());
156156
}
157157

158158
void MipsInstPrinter::printBranchOperand(const MCInst *MI, uint64_t Address,
@@ -169,9 +169,9 @@ void MipsInstPrinter::printBranchOperand(const MCInst *MI, uint64_t Address,
169169
Target &= 0xffffffff;
170170
else if (STI.hasFeature(Mips::FeatureMips16))
171171
Target &= 0xffff;
172-
O << markup("<imm:") << formatHex(Target) << markup(">");
172+
markup(O, Markup::Immediate) << formatHex(Target);
173173
} else {
174-
O << markup("<imm:") << formatImm(Op.getImm()) << markup(">");
174+
markup(O, Markup::Immediate) << formatImm(Op.getImm());
175175
}
176176
}
177177

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

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

216-
O << markup("<mem:");
216+
WithMarkup M = markup(O, Markup::Memory);
217217
printOperand(MI, opNum + 1, STI, O);
218218
O << "(";
219219
printOperand(MI, opNum, STI, O);
220220
O << ")";
221-
O << markup(">");
222221
}
223222

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

0 commit comments

Comments
 (0)