@@ -1114,7 +1114,7 @@ bool MatchableInfo::validate(StringRef CommentDelimiter, bool IsAlias) const {
1114
1114
// Verify that any operand is only mentioned once.
1115
1115
// We reject aliases and ignore instructions for now.
1116
1116
if (!IsAlias && TheDef->getValueAsString (" AsmMatchConverter" ).empty () &&
1117
- Tok[0 ] == ' $' && !OperandNames.insert (std::string ( Tok)).second ) {
1117
+ Tok[0 ] == ' $' && !OperandNames.insert (Tok. str ( )).second ) {
1118
1118
LLVM_DEBUG ({
1119
1119
errs () << " warning: '" << TheDef->getName () << " ': "
1120
1120
<< " ignoring instruction with tied operand '" << Tok << " '\n " ;
@@ -1170,15 +1170,15 @@ static std::string getEnumNameForToken(StringRef Str) {
1170
1170
}
1171
1171
1172
1172
ClassInfo *AsmMatcherInfo::getTokenClass (StringRef Token) {
1173
- ClassInfo *&Entry = TokenClasses[std::string ( Token)];
1173
+ ClassInfo *&Entry = TokenClasses[Token. str ( )];
1174
1174
1175
1175
if (!Entry) {
1176
1176
Classes.emplace_front ();
1177
1177
Entry = &Classes.front ();
1178
1178
Entry->Kind = ClassInfo::Token;
1179
1179
Entry->ClassName = " Token" ;
1180
1180
Entry->Name = " MCK_" + getEnumNameForToken (Token);
1181
- Entry->ValueName = std::string ( Token);
1181
+ Entry->ValueName = Token. str ( );
1182
1182
Entry->PredicateMethod = " <invalid>" ;
1183
1183
Entry->RenderMethod = " <invalid>" ;
1184
1184
Entry->ParserMethod = " " ;
@@ -1352,11 +1352,11 @@ void AsmMatcherInfo::buildRegisterClasses(
1352
1352
1353
1353
const Init *DiagnosticType = Def->getValueInit (" DiagnosticType" );
1354
1354
if (const StringInit *SI = dyn_cast<StringInit>(DiagnosticType))
1355
- CI->DiagnosticType = std::string ( SI->getValue ());
1355
+ CI->DiagnosticType = SI->getValue (). str ( );
1356
1356
1357
1357
const Init *DiagnosticString = Def->getValueInit (" DiagnosticString" );
1358
1358
if (const StringInit *SI = dyn_cast<StringInit>(DiagnosticString))
1359
- CI->DiagnosticString = std::string ( SI->getValue ());
1359
+ CI->DiagnosticString = SI->getValue (). str ( );
1360
1360
1361
1361
// If we have a diagnostic string but the diagnostic type is not specified
1362
1362
// explicitly, create an anonymous diagnostic type.
@@ -1376,11 +1376,12 @@ void AsmMatcherInfo::buildRegisterClasses(
1376
1376
assert (CI && " Missing singleton register class info!" );
1377
1377
1378
1378
if (CI->ValueName .empty ()) {
1379
- CI->ClassName = std::string ( Rec->getName ());
1379
+ CI->ClassName = Rec->getName (). str ( );
1380
1380
CI->Name = " MCK_" + Rec->getName ().str ();
1381
- CI->ValueName = std::string ( Rec->getName ());
1382
- } else
1381
+ CI->ValueName = Rec->getName (). str ( );
1382
+ } else {
1383
1383
CI->ValueName = CI->ValueName + " ," + Rec->getName ().str ();
1384
+ }
1384
1385
}
1385
1386
}
1386
1387
@@ -1413,14 +1414,14 @@ void AsmMatcherInfo::buildOperandClasses() {
1413
1414
else
1414
1415
CI->SuperClasses .push_back (SC);
1415
1416
}
1416
- CI->ClassName = std::string ( Rec->getValueAsString (" Name" ));
1417
+ CI->ClassName = Rec->getValueAsString (" Name" ). str ( );
1417
1418
CI->Name = " MCK_" + CI->ClassName ;
1418
- CI->ValueName = std::string ( Rec->getName ());
1419
+ CI->ValueName = Rec->getName (). str ( );
1419
1420
1420
1421
// Get or construct the predicate method name.
1421
1422
const Init *PMName = Rec->getValueInit (" PredicateMethod" );
1422
1423
if (const StringInit *SI = dyn_cast<StringInit>(PMName)) {
1423
- CI->PredicateMethod = std::string ( SI->getValue ());
1424
+ CI->PredicateMethod = SI->getValue (). str ( );
1424
1425
} else {
1425
1426
assert (isa<UnsetInit>(PMName) && " Unexpected PredicateMethod field!" );
1426
1427
CI->PredicateMethod = " is" + CI->ClassName ;
@@ -1429,7 +1430,7 @@ void AsmMatcherInfo::buildOperandClasses() {
1429
1430
// Get or construct the render method name.
1430
1431
const Init *RMName = Rec->getValueInit (" RenderMethod" );
1431
1432
if (const StringInit *SI = dyn_cast<StringInit>(RMName)) {
1432
- CI->RenderMethod = std::string ( SI->getValue ());
1433
+ CI->RenderMethod = SI->getValue (). str ( );
1433
1434
} else {
1434
1435
assert (isa<UnsetInit>(RMName) && " Unexpected RenderMethod field!" );
1435
1436
CI->RenderMethod = " add" + CI->ClassName + " Operands" ;
@@ -1438,15 +1439,15 @@ void AsmMatcherInfo::buildOperandClasses() {
1438
1439
// Get the parse method name or leave it as empty.
1439
1440
const Init *PRMName = Rec->getValueInit (" ParserMethod" );
1440
1441
if (const StringInit *SI = dyn_cast<StringInit>(PRMName))
1441
- CI->ParserMethod = std::string ( SI->getValue ());
1442
+ CI->ParserMethod = SI->getValue (). str ( );
1442
1443
1443
1444
// Get the diagnostic type and string or leave them as empty.
1444
1445
const Init *DiagnosticType = Rec->getValueInit (" DiagnosticType" );
1445
1446
if (const StringInit *SI = dyn_cast<StringInit>(DiagnosticType))
1446
- CI->DiagnosticType = std::string ( SI->getValue ());
1447
+ CI->DiagnosticType = SI->getValue (). str ( );
1447
1448
const Init *DiagnosticString = Rec->getValueInit (" DiagnosticString" );
1448
1449
if (const StringInit *SI = dyn_cast<StringInit>(DiagnosticString))
1449
- CI->DiagnosticString = std::string ( SI->getValue ());
1450
+ CI->DiagnosticString = SI->getValue (). str ( );
1450
1451
// If we have a DiagnosticString, we need a DiagnosticType for use within
1451
1452
// the matcher.
1452
1453
if (!CI->DiagnosticString .empty () && CI->DiagnosticType .empty ())
@@ -1459,7 +1460,7 @@ void AsmMatcherInfo::buildOperandClasses() {
1459
1460
// Get or construct the default method name.
1460
1461
const Init *DMName = Rec->getValueInit (" DefaultMethod" );
1461
1462
if (const StringInit *SI = dyn_cast<StringInit>(DMName)) {
1462
- CI->DefaultMethod = std::string ( SI->getValue ());
1463
+ CI->DefaultMethod = SI->getValue (). str ( );
1463
1464
} else {
1464
1465
assert (isa<UnsetInit>(DMName) && " Unexpected DefaultMethod field!" );
1465
1466
CI->DefaultMethod = " default" + CI->ClassName + " Operands" ;
@@ -1905,7 +1906,7 @@ void MatchableInfo::buildAliasResultOperands(bool AliasConstraintsAreChecked) {
1905
1906
}
1906
1907
1907
1908
// Handle all the suboperands for this operand.
1908
- const std::string & OpName = OpInfo.Name ;
1909
+ StringRef OpName = OpInfo.Name ;
1909
1910
for (; AliasOpNo < LastOpNo &&
1910
1911
CGA.ResultInstOperandIndex [AliasOpNo].first == Idx;
1911
1912
++AliasOpNo) {
@@ -3051,8 +3052,8 @@ emitCustomOperandParsing(raw_ostream &OS, CodeGenTarget &Target,
3051
3052
static void emitAsmTiedOperandConstraints (CodeGenTarget &Target,
3052
3053
AsmMatcherInfo &Info, raw_ostream &OS,
3053
3054
bool HasOptionalOperands) {
3054
- std::string AsmParserName =
3055
- std::string ( Info.AsmParser ->getValueAsString (" AsmParserClassName" ) );
3055
+ StringRef AsmParserName =
3056
+ Info.AsmParser ->getValueAsString (" AsmParserClassName" );
3056
3057
OS << " static bool " ;
3057
3058
OS << " checkAsmTiedOperandConstraints(const " << Target.getName ()
3058
3059
<< AsmParserName << " &AsmParser,\n " ;
0 commit comments