summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-22 23:33:44 +0000
committerChris Lattner <sabre@nondot.org>2010-02-22 23:33:44 +0000
commit20df2420f7997cdb69c21f6bff27559cb09f7be2 (patch)
treed2d6996b2d7189e53a37043bdc75aef047006095
parent4642ad3af1cf508ac320b9afd25b065f08b36574 (diff)
downloadllvm-20df2420f7997cdb69c21f6bff27559cb09f7be2.tar.gz
llvm-20df2420f7997cdb69c21f6bff27559cb09f7be2.tar.bz2
llvm-20df2420f7997cdb69c21f6bff27559cb09f7be2.tar.xz
Change ComplexPattern handling to push the node being matched as
well as the operands produced when the pattern is matched. This allows CheckSame to work correctly when matching replicated names involving ComplexPatterns. This fixes a bunch of MSP430 failures, we're down to 13 failures, two of which are due to a sched bug. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96824 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--utils/TableGen/DAGISelMatcherGen.cpp34
1 files changed, 13 insertions, 21 deletions
diff --git a/utils/TableGen/DAGISelMatcherGen.cpp b/utils/TableGen/DAGISelMatcherGen.cpp
index 0ea165cdfd..39d51557e3 100644
--- a/utils/TableGen/DAGISelMatcherGen.cpp
+++ b/utils/TableGen/DAGISelMatcherGen.cpp
@@ -259,8 +259,15 @@ 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.
AddMatcherNode(new CheckComplexPatMatcherNode(CP));
+ // Record the right number of operands.
+ NextRecordedOperandNo += CP.getNumOperands();
+ if (CP.hasProperty(SDNPHasChain))
+ ++NextRecordedOperandNo; // Chained node operand.
+
// If the complex pattern has a chain, then we need to keep track of the
// fact that we just recorded a chain input. The chain input will be
// matched as the last operand of the predicate if it was successful.
@@ -442,26 +449,9 @@ void MatcherGen::EmitMatchCode(const TreePatternNode *N,
if (!N->getName().empty()) {
unsigned &VarMapEntry = VariableMap[N->getName()];
if (VarMapEntry == 0) {
- VarMapEntry = NextRecordedOperandNo+1;
-
- unsigned NumRecorded;
-
- // If this is a complex pattern, the match operation for it will
- // implicitly record all of the outputs of it (which may be more than
- // one).
- if (const ComplexPattern *CP = N->getComplexPatternInfo(CGP)) {
- // Record the right number of operands.
- NumRecorded = CP->getNumOperands();
-
- if (CP->hasProperty(SDNPHasChain))
- ++NumRecorded; // Chained node operand.
- } else {
- // If it is a normal named node, we must emit a 'Record' opcode.
- AddMatcherNode(new RecordMatcherNode("$" + N->getName()));
- NumRecorded = 1;
- }
- NextRecordedOperandNo += NumRecorded;
-
+ // If it is a named node, we must emit a 'Record' opcode.
+ VarMapEntry = ++NextRecordedOperandNo;
+ AddMatcherNode(new RecordMatcherNode("$" + N->getName()));
} else {
// If we get here, this is a second reference to a specific name. Since
// we already have checked that the first reference is valid, we don't
@@ -503,8 +493,10 @@ void MatcherGen::EmitResultOfNamedOperand(const TreePatternNode *N,
// A reference to a complex pattern gets all of the results of the complex
// pattern's match.
if (const ComplexPattern *CP = N->getComplexPatternInfo(CGP)) {
+ // The first slot entry is the node itself, the subsequent entries are the
+ // matched values.
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
- ResultOps.push_back(SlotNo+i);
+ ResultOps.push_back(SlotNo+i+1);
return;
}