diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-04 00:28:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-04 00:28:05 +0000 |
commit | 90e1c5fa44ffd11bfad488ca5053cff1771bd1de (patch) | |
tree | d88295b2e8672a94c2427c69d08e6f6d6556a570 | |
parent | 6abe39c61e8240898d286cb732099693282ebacd (diff) | |
download | bcm5719-llvm-90e1c5fa44ffd11bfad488ca5053cff1771bd1de.tar.gz bcm5719-llvm-90e1c5fa44ffd11bfad488ca5053cff1771bd1de.zip |
enhance comment output to specify what recorded slot
numbers a ComplexPat will match into.
llvm-svn: 97696
-rw-r--r-- | llvm/utils/TableGen/DAGISelMatcher.h | 8 | ||||
-rw-r--r-- | llvm/utils/TableGen/DAGISelMatcherEmitter.cpp | 7 | ||||
-rw-r--r-- | llvm/utils/TableGen/DAGISelMatcherGen.cpp | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/llvm/utils/TableGen/DAGISelMatcher.h b/llvm/utils/TableGen/DAGISelMatcher.h index c2e81711e08..8498d60b5d1 100644 --- a/llvm/utils/TableGen/DAGISelMatcher.h +++ b/llvm/utils/TableGen/DAGISelMatcher.h @@ -609,11 +609,15 @@ private: /// the current node. class CheckComplexPatMatcher : public Matcher { const ComplexPattern &Pattern; + /// FirstResult - This is the first slot in the RecordedNodes list that the + /// result of the match populates. + unsigned FirstResult; public: - CheckComplexPatMatcher(const ComplexPattern &pattern) - : Matcher(CheckComplexPat), Pattern(pattern) {} + CheckComplexPatMatcher(const ComplexPattern &pattern, unsigned firstresult) + : Matcher(CheckComplexPat), Pattern(pattern), FirstResult(firstresult) {} const ComplexPattern &getPattern() const { return Pattern; } + unsigned getFirstResult() const { return FirstResult; } static inline bool classof(const Matcher *N) { return N->getKind() == CheckComplexPat; diff --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp index 1f0405038c6..1f9e09383f2 100644 --- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp @@ -375,9 +375,12 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx, OS << "OPC_CheckComplexPat, " << getComplexPat(Pattern) << ','; if (!OmitComments) { OS.PadToColumn(CommentIndent) << "// " << Pattern.getSelectFunc(); - OS << ": " << Pattern.getNumOperands() << " operands"; + OS << ':'; + for (unsigned i = 0, e = Pattern.getNumOperands(); i != e; ++i) + OS << " #" << cast<CheckComplexPatMatcher>(N)->getFirstResult()+i; + if (Pattern.hasProperty(SDNPHasChain)) - OS << " + chain result and input"; + OS << " + chain result"; } OS << '\n'; return 2; diff --git a/llvm/utils/TableGen/DAGISelMatcherGen.cpp b/llvm/utils/TableGen/DAGISelMatcherGen.cpp index 448280345bc..f4e2b8d884e 100644 --- a/llvm/utils/TableGen/DAGISelMatcherGen.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherGen.cpp @@ -252,7 +252,7 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) { // Emit a CheckComplexPat operation, which does the match (aborting if it // fails) and pushes the matched operands onto the recorded nodes list. - AddMatcher(new CheckComplexPatMatcher(CP)); + AddMatcher(new CheckComplexPatMatcher(CP, NextRecordedOperandNo)); // Record the right number of operands. NextRecordedOperandNo += CP.getNumOperands(); |