[llvm-commits] [llvm] r97696 - in /llvm/trunk/utils/TableGen: DAGISelMatcher.h DAGISelMatcherEmitter.cpp DAGISelMatcherGen.cpp
Chris Lattner
sabre at nondot.org
Wed Mar 3 16:28:05 PST 2010
Author: lattner
Date: Wed Mar 3 18:28:05 2010
New Revision: 97696
URL: http://llvm.org/viewvc/llvm-project?rev=97696&view=rev
Log:
enhance comment output to specify what recorded slot
numbers a ComplexPat will match into.
Modified:
llvm/trunk/utils/TableGen/DAGISelMatcher.h
llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
Modified: llvm/trunk/utils/TableGen/DAGISelMatcher.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcher.h?rev=97696&r1=97695&r2=97696&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcher.h (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcher.h Wed Mar 3 18:28:05 2010
@@ -609,11 +609,15 @@
/// 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;
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp?rev=97696&r1=97695&r2=97696&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp Wed Mar 3 18:28:05 2010
@@ -375,9 +375,12 @@
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;
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp?rev=97696&r1=97695&r2=97696&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Wed Mar 3 18:28:05 2010
@@ -252,7 +252,7 @@
// 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();
More information about the llvm-commits
mailing list