summaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeGenDAGPatterns.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/TableGen/CodeGenDAGPatterns.cpp')
-rw-r--r--utils/TableGen/CodeGenDAGPatterns.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp
index 7c41d9fad6960..03914ef98952b 100644
--- a/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -2762,8 +2762,8 @@ public:
AnalyzeNode(Pat->getTree(0));
}
- void Analyze(const PatternToMatch *Pat) {
- AnalyzeNode(Pat->getSrcPattern());
+ void Analyze(const PatternToMatch &Pat) {
+ AnalyzeNode(Pat.getSrcPattern());
}
private:
@@ -3220,7 +3220,7 @@ static void FindNames(const TreePatternNode *P,
}
void CodeGenDAGPatterns::AddPatternToMatch(TreePattern *Pattern,
- const PatternToMatch &PTM) {
+ PatternToMatch &&PTM) {
// Do some sanity checking on the pattern we're about to match.
std::string Reason;
if (!PTM.getSrcPattern()->canPatternMatch(Reason, *this)) {
@@ -3259,7 +3259,7 @@ void CodeGenDAGPatterns::AddPatternToMatch(TreePattern *Pattern,
SrcNames[Entry.first].second == 1)
Pattern->error("Pattern has dead named input: $" + Entry.first);
- PatternsToMatch.push_back(PTM);
+ PatternsToMatch.push_back(std::move(PTM));
}
@@ -3289,9 +3289,7 @@ void CodeGenDAGPatterns::InferInstructionFlags() {
// Second, look for single-instruction patterns defined outside the
// instruction.
- for (ptm_iterator I = ptm_begin(), E = ptm_end(); I != E; ++I) {
- const PatternToMatch &PTM = *I;
-
+ for (const PatternToMatch &PTM : ptms()) {
// We can only infer from single-instruction patterns, otherwise we won't
// know which instruction should get the flags.
SmallVector<Record*, 8> PatInstrs;
@@ -3307,7 +3305,7 @@ void CodeGenDAGPatterns::InferInstructionFlags() {
continue;
InstAnalyzer PatInfo(*this);
- PatInfo.Analyze(&PTM);
+ PatInfo.Analyze(PTM);
Errors += InferFromPattern(InstInfo, PatInfo, PTM.getSrcRecord());
}
@@ -3367,7 +3365,7 @@ void CodeGenDAGPatterns::VerifyInstructionFlags() {
// Analyze the source pattern.
InstAnalyzer PatInfo(*this);
- PatInfo.Analyze(&PTM);
+ PatInfo.Analyze(PTM);
// Collect error messages.
SmallVector<std::string, 4> Msgs;
@@ -3553,14 +3551,12 @@ void CodeGenDAGPatterns::ParsePatterns() {
TreePattern Temp(Result.getRecord(), DstPattern, false, *this);
Temp.InferAllTypes();
-
- AddPatternToMatch(Pattern,
- PatternToMatch(CurPattern,
- CurPattern->getValueAsListInit("Predicates"),
- Pattern->getTree(0),
- Temp.getOnlyTree(), InstImpResults,
- CurPattern->getValueAsInt("AddedComplexity"),
- CurPattern->getID()));
+ AddPatternToMatch(
+ Pattern,
+ PatternToMatch(
+ CurPattern, CurPattern->getValueAsListInit("Predicates"),
+ Pattern->getTree(0), Temp.getOnlyTree(), std::move(InstImpResults),
+ CurPattern->getValueAsInt("AddedComplexity"), CurPattern->getID()));
}
}