Skip to content

Commit 5034017

Browse files
committed
Review feedback
1 parent 89624c1 commit 5034017

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

llvm/utils/TableGen/CodeEmitterGen.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ bool CodeEmitterGen::addCodeToMergeInOperand(const Record *R,
142142
}
143143

144144
std::pair<unsigned, unsigned> SO = CGI.Operands.getSubOperandNumber(OpIdx);
145-
const std::string EncoderMethodName =
146-
CGI.Operands[SO.first].EncoderMethodNames[SO.second].str();
145+
StringRef EncoderMethodName =
146+
CGI.Operands[SO.first].EncoderMethodNames[SO.second];
147147

148148
if (UseAPInt)
149149
Case += " op.clearAllBits();\n";
@@ -152,13 +152,14 @@ bool CodeEmitterGen::addCodeToMergeInOperand(const Record *R,
152152

153153
// If the source operand has a custom encoder, use it.
154154
if (!EncoderMethodName.empty()) {
155+
raw_string_ostream CaseOS(Case);
156+
CaseOS << indent(6);
155157
if (UseAPInt) {
156-
Case += " " + EncoderMethodName + "(MI, " + utostr(OpIdx);
157-
Case += ", op";
158+
CaseOS << EncoderMethodName << "(MI, " + utostr(OpIdx) << ", op";
158159
} else {
159-
Case += " op = " + EncoderMethodName + "(MI, " + utostr(OpIdx);
160+
CaseOS << "op = " << EncoderMethodName << "(MI, " << utostr(OpIdx);
160161
}
161-
Case += ", Fixups, STI);\n";
162+
CaseOS << ", Fixups, STI);\n";
162163
} else {
163164
if (UseAPInt) {
164165
Case +=

0 commit comments

Comments
 (0)