[llvm-commits] [llvm] r96813 - /llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
Chris Lattner
sabre at nondot.org
Mon Feb 22 14:18:06 PST 2010
Author: lattner
Date: Mon Feb 22 16:18:05 2010
New Revision: 96813
URL: http://llvm.org/viewvc/llvm-project?rev=96813&view=rev
Log:
When matching patterns that have a complex pattern as their root, make
sure to only run the complex pattern on nodes where the target opts in.
This patch only handles targets with one opcode specified so far, but
fixes 16 failures, only 34 left.
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=96813&r1=96812&r2=96813&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Mon Feb 22 16:18:05 2010
@@ -239,9 +239,24 @@
errs() << "We expect complex pattern uses to have names: " << *N << "\n";
exit(1);
}
-
+
// Handle complex pattern.
const ComplexPattern &CP = CGP.getComplexPattern(LeafRec);
+
+ // If we're at the root of the pattern, we have to check that the opcode
+ // is a one of the ones requested to be matched.
+ if (N == Pattern.getSrcPattern()) {
+ const std::vector<Record*> &OpNodes = CP.getRootNodes();
+ if (OpNodes.size() == 1) {
+ StringRef OpName = CGP.getSDNodeInfo(OpNodes[0]).getEnumName();
+ AddMatcherNode(new CheckOpcodeMatcherNode(OpName));
+ } else if (!OpNodes.empty()) {
+ for (unsigned j = 0, e = OpNodes.size(); j != e; j++) {
+ // .getOpcodeName(OpNodes[j], CGP)
+ }
+ }
+ }
+
AddMatcherNode(new CheckComplexPatMatcherNode(CP));
// If the complex pattern has a chain, then we need to keep track of the
More information about the llvm-commits
mailing list