[llvm-commits] [llvm] r96412 - /llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
Chris Lattner
sabre at nondot.org
Tue Feb 16 15:16:42 PST 2010
Author: lattner
Date: Tue Feb 16 17:16:25 2010
New Revision: 96412
URL: http://llvm.org/viewvc/llvm-project?rev=96412&view=rev
Log:
complex patterns don't get 'record' nodes, they implicitly
record all their results.
Modified:
llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp?rev=96412&r1=96411&r2=96412&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Tue Feb 16 17:16:25 2010
@@ -137,6 +137,11 @@
return AddMatcherNode(new CheckCondCodeMatcherNode(LeafRec->getName()));
if (LeafRec->isSubClassOf("ComplexPattern")) {
+ if (!N->getName().empty()) {
+ errs() << "We expect complex pattern uses to have names: " << *N << "\n";
+ exit(1);
+ }
+
// Handle complex pattern.
const ComplexPattern &CP = CGP.getComplexPattern(LeafRec);
return AddMatcherNode(new CheckComplexPatMatcherNode(CP));
@@ -236,6 +241,8 @@
AddMatcherNode(new CheckFoldableChainNodeMatcherNode());
}
}
+
+ // FIXME: Need to generate IsChainCompatible checks.
for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i, ++OpNo) {
// Get the code suitable for matching this child. Move to the child, check
@@ -265,7 +272,19 @@
unsigned &VarMapEntry = VariableMap[N->getName()];
if (VarMapEntry == 0) {
VarMapEntry = ++NextRecordedOperandNo;
- AddMatcherNode(new RecordMatcherNode());
+
+ // 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 *AM = N->getComplexPatternInfo(CGP)) {
+ // Record the right number of operands.
+ // FIXME: Does this include chain?
+ VarMapEntry += AM->getNumOperands()-1;
+ } else {
+ // If it is a normal named node, we must emit a 'Record' opcode.
+ AddMatcherNode(new RecordMatcherNode());
+ }
+
} 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
More information about the llvm-commits
mailing list