diff options
author | Chris Lattner <sabre@nondot.org> | 2010-02-21 06:03:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-02-21 06:03:07 +0000 |
commit | 77f2e2724dc488bbf032e87f8f25f333730a0fb5 (patch) | |
tree | a7448610c2bdd7da61f0f95a5d6d0a94b3aa430d /utils/TableGen/DAGISelMatcher.h | |
parent | f1c6428164f6f5e07cbc88c1c1440efbf29c0d5f (diff) |
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
Diffstat (limited to 'utils/TableGen/DAGISelMatcher.h')
-rw-r--r-- | utils/TableGen/DAGISelMatcher.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/utils/TableGen/DAGISelMatcher.h b/utils/TableGen/DAGISelMatcher.h index 4dcb4d6af7..c162a0cbaa 100644 --- a/utils/TableGen/DAGISelMatcher.h +++ b/utils/TableGen/DAGISelMatcher.h @@ -70,7 +70,7 @@ public: 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 @@ public: 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; |