Skip to content

Commit c9d7d10

Browse files
authored
[TableGen][DecoderEmitter] Use StringRef in a few places (NFC) (llvm#156051)
1 parent ca14a8a commit c9d7d10

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

llvm/utils/TableGen/DecoderEmitter.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ struct DecoderTableInfo {
326326
}
327327
};
328328

329-
using NamespacesHwModesMap = std::map<std::string, std::set<unsigned>>;
329+
using NamespacesHwModesMap = std::map<StringRef, std::set<unsigned>>;
330330

331331
class DecoderEmitter {
332332
const RecordKeeper &RK;
@@ -1052,8 +1052,6 @@ FilterChooser::getIslands(const KnownBits &EncodingBits) const {
10521052

10531053
void DecoderTableBuilder::emitBinaryParser(raw_ostream &OS, indent Indent,
10541054
const OperandInfo &OpInfo) const {
1055-
const std::string &Decoder = OpInfo.Decoder;
1056-
10571055
bool UseInsertBits = OpInfo.numFields() != 1 || OpInfo.InitValue != 0;
10581056

10591057
if (UseInsertBits) {
@@ -1076,6 +1074,7 @@ void DecoderTableBuilder::emitBinaryParser(raw_ostream &OS, indent Indent,
10761074
OS << ";\n";
10771075
}
10781076

1077+
StringRef Decoder = OpInfo.Decoder;
10791078
if (!Decoder.empty()) {
10801079
OS << Indent << "if (!Check(S, " << Decoder
10811080
<< "(MI, tmp, Address, Decoder))) { "
@@ -2317,8 +2316,8 @@ void DecoderEmitter::collectHwModesReferencedForEncodings(
23172316
for (const auto &MS : CGH.getHwModeSelects()) {
23182317
for (auto [HwModeID, EncodingDef] : MS.second.Items) {
23192318
if (EncodingDef->isSubClassOf("InstructionEncoding")) {
2320-
std::string DecoderNamespace =
2321-
EncodingDef->getValueAsString("DecoderNamespace").str();
2319+
StringRef DecoderNamespace =
2320+
EncodingDef->getValueAsString("DecoderNamespace");
23222321
NamespacesWithHwModes[DecoderNamespace].insert(HwModeID);
23232322
BV.set(HwModeID);
23242323
}
@@ -2341,8 +2340,7 @@ void DecoderEmitter::handleHwModesUnrelatedEncodings(
23412340
}
23422341
case SUPPRESSION_LEVEL1: {
23432342
const Record *InstDef = Encodings[EncodingID].getInstruction()->TheDef;
2344-
std::string DecoderNamespace =
2345-
InstDef->getValueAsString("DecoderNamespace").str();
2343+
StringRef DecoderNamespace = InstDef->getValueAsString("DecoderNamespace");
23462344
auto It = NamespacesWithHwModes.find(DecoderNamespace);
23472345
if (It != NamespacesWithHwModes.end()) {
23482346
for (unsigned HwModeID : It->second)

0 commit comments

Comments
 (0)