implement the last known missing feature: updating uses of results
of the matched pattern to use the newly created node results. Onto
the "making it actually work" phase!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96724 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/DAGISelMatcher.h b/utils/TableGen/DAGISelMatcher.h
index 4dcb4d6..c162a0c 100644
--- a/utils/TableGen/DAGISelMatcher.h
+++ b/utils/TableGen/DAGISelMatcher.h
@@ -70,7 +70,7 @@
EmitCopyToReg, // Emit a copytoreg into a physreg.
EmitNode, // Create a DAG node
EmitNodeXForm, // Run a SDNodeXForm
- PatternMarker // Comment for printing.
+ CompleteMatch // Finish a match and update the results.
};
const KindTy Kind;
@@ -601,19 +601,25 @@
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
};
-
-/// PatternMarkerMatcherNode - This prints as a comment indicating the source
-/// and dest patterns.
-class PatternMarkerMatcherNode : public MatcherNode {
+
+/// CompleteMatchMatcherNode - Complete a match by replacing the results of the
+/// pattern with the newly generated nodes. This also prints a comment
+/// indicating the source and dest patterns.
+class CompleteMatchMatcherNode : public MatcherNode {
+ SmallVector<unsigned, 2> Results;
const PatternToMatch &Pattern;
public:
- PatternMarkerMatcherNode(const PatternToMatch &pattern)
- : MatcherNode(PatternMarker), Pattern(pattern) {}
-
+ CompleteMatchMatcherNode(const unsigned *results, unsigned numresults,
+ const PatternToMatch &pattern)
+ : MatcherNode(CompleteMatch), Results(results, results+numresults),
+ Pattern(pattern) {}
+
+ unsigned getNumResults() const { return Results.size(); }
+ unsigned getResult(unsigned R) const { return Results[R]; }
const PatternToMatch &getPattern() const { return Pattern; }
static inline bool classof(const MatcherNode *N) {
- return N->getKind() == PatternMarker;
+ return N->getKind() == CompleteMatch;
}
virtual void print(raw_ostream &OS, unsigned indent = 0) const;