@@ -2096,7 +2096,7 @@ void TreePatternNode::RemoveAllTypes() {
20962096// / SubstituteFormalArguments - Replace the formal arguments in this tree
20972097// / with actual values specified by ArgMap.
20982098void TreePatternNode::SubstituteFormalArguments (
2099- std::map<std::string , TreePatternNodePtr> &ArgMap) {
2099+ std::map<StringRef , TreePatternNodePtr> &ArgMap) {
21002100 if (isLeaf ())
21012101 return ;
21022102
@@ -2224,7 +2224,7 @@ void TreePatternNode::InlinePatternFragments(
22242224 Scope = TP.getDAGPatterns ().allocateScope ();
22252225
22262226 // Compute the map of formal to actual arguments.
2227- std::map<std::string , TreePatternNodePtr> ArgMap;
2227+ std::map<StringRef , TreePatternNodePtr> ArgMap;
22282228 for (unsigned i = 0 , e = Frag->getNumArgs (); i != e; ++i) {
22292229 TreePatternNodePtr Child = getChildShared (i);
22302230 if (Scope != 0 ) {
@@ -3441,7 +3441,7 @@ void CodeGenDAGPatterns::ParseDefaultOperands() {
34413441// / HandleUse - Given "Pat" a leaf in the pattern, check to see if it is an
34423442// / instruction input. Return true if this is a real use.
34433443static bool HandleUse (TreePattern &I, TreePatternNodePtr Pat,
3444- std::map<std::string , TreePatternNodePtr> &InstInputs) {
3444+ std::map<StringRef , TreePatternNodePtr> &InstInputs) {
34453445 // No name -> not interesting.
34463446 if (Pat->getName ().empty ()) {
34473447 if (Pat->isLeaf ()) {
@@ -3495,11 +3495,8 @@ static bool HandleUse(TreePattern &I, TreePatternNodePtr Pat,
34953495// / part of "I", the instruction), computing the set of inputs and outputs of
34963496// / the pattern. Report errors if we see anything naughty.
34973497void CodeGenDAGPatterns::FindPatternInputsAndOutputs (
3498- TreePattern &I, TreePatternNodePtr Pat,
3499- std::map<std::string, TreePatternNodePtr> &InstInputs,
3500- MapVector<std::string, TreePatternNodePtr, std::map<std::string, unsigned >>
3501- &InstResults,
3502- std::vector<const Record *> &InstImpResults) {
3498+ TreePattern &I, TreePatternNodePtr Pat, InstInputsTy &InstInputs,
3499+ InstResultsTy &InstResults, std::vector<const Record *> &InstImpResults) {
35033500 // The instruction pattern still has unresolved fragments. For *named*
35043501 // nodes we must resolve those here. This may not result in multiple
35053502 // alternatives.
@@ -3816,11 +3813,11 @@ void CodeGenDAGPatterns::parseInstructionPattern(CodeGenInstruction &CGI,
38163813
38173814 // InstInputs - Keep track of all of the inputs of the instruction, along
38183815 // with the record they are declared as.
3819- std::map<std::string , TreePatternNodePtr> InstInputs;
3816+ std::map<StringRef , TreePatternNodePtr> InstInputs;
38203817
38213818 // InstResults - Keep track of all the virtual registers that are 'set'
38223819 // in the instruction, including what reg class they are.
3823- MapVector<std::string , TreePatternNodePtr, std::map<std::string , unsigned >>
3820+ MapVector<StringRef , TreePatternNodePtr, std::map<StringRef , unsigned >>
38243821 InstResults;
38253822
38263823 std::vector<const Record *> InstImpResults;
@@ -3862,18 +3859,17 @@ void CodeGenDAGPatterns::parseInstructionPattern(CodeGenInstruction &CGI,
38623859 SmallVector<TreePatternNodePtr, 2 > ResNodes;
38633860 for (unsigned i = 0 ; i != NumResults; ++i) {
38643861 if (i == CGI.Operands .size ()) {
3865- const std::string &OpName =
3866- llvm::find_if (
3867- InstResults,
3868- [](const std::pair<std::string, TreePatternNodePtr> &P) {
3869- return P.second ;
3870- })
3862+ StringRef OpName =
3863+ llvm::find_if (InstResults,
3864+ [](const std::pair<StringRef, TreePatternNodePtr> &P) {
3865+ return P.second ;
3866+ })
38713867 ->first ;
38723868
38733869 I.error (" '" + OpName + " ' set but does not appear in operand list!" );
38743870 }
38753871
3876- const std::string & OpName = CGI.Operands [i].Name ;
3872+ StringRef OpName = CGI.Operands [i].Name ;
38773873
38783874 // Check that it exists in InstResults.
38793875 auto InstResultIter = InstResults.find (OpName);
@@ -3906,7 +3902,7 @@ void CodeGenDAGPatterns::parseInstructionPattern(CodeGenInstruction &CGI,
39063902 std::vector<const Record *> Operands;
39073903 for (unsigned i = NumResults, e = CGI.Operands .size (); i != e; ++i) {
39083904 CGIOperandList::OperandInfo &Op = CGI.Operands [i];
3909- const std::string & OpName = Op.Name ;
3905+ StringRef OpName = Op.Name ;
39103906 if (OpName.empty ()) {
39113907 I.error (" Operand #" + Twine (i) + " in operands list has no name!" );
39123908 continue ;
@@ -4050,7 +4046,7 @@ void CodeGenDAGPatterns::ParseInstructions() {
40504046typedef std::pair<TreePatternNode *, unsigned > NameRecord;
40514047
40524048static void FindNames (TreePatternNode &P,
4053- std::map<std::string , NameRecord> &Names,
4049+ std::map<StringRef , NameRecord> &Names,
40544050 TreePattern *PatternTop) {
40554051 if (!P.getName ().empty ()) {
40564052 NameRecord &Rec = Names[P.getName ()];
@@ -4088,7 +4084,7 @@ void CodeGenDAGPatterns::AddPatternToMatch(TreePattern *Pattern,
40884084
40894085 // Find all of the named values in the input and output, ensure they have the
40904086 // same type.
4091- std::map<std::string , NameRecord> SrcNames, DstNames;
4087+ std::map<StringRef , NameRecord> SrcNames, DstNames;
40924088 FindNames (PTM.getSrcPattern (), SrcNames, Pattern);
40934089 FindNames (PTM.getDstPattern (), DstNames, Pattern);
40944090
@@ -4409,9 +4405,8 @@ void CodeGenDAGPatterns::ParsePatterns() {
44094405 " with temporaries yet!" );
44104406
44114407 // Validate that the input pattern is correct.
4412- std::map<std::string, TreePatternNodePtr> InstInputs;
4413- MapVector<std::string, TreePatternNodePtr, std::map<std::string, unsigned >>
4414- InstResults;
4408+ InstInputsTy InstInputs;
4409+ InstResultsTy InstResults;
44154410 std::vector<const Record *> InstImpResults;
44164411 for (unsigned j = 0 , ee = Pattern.getNumTrees (); j != ee; ++j)
44174412 FindPatternInputsAndOutputs (Pattern, Pattern.getTree (j), InstInputs,
0 commit comments