[llvm-commits] [llvm] r97513 - in /llvm/trunk/utils/TableGen: CodeGenDAGPatterns.cpp DAGISelEmitter.cpp DAGISelMatcherGen.cpp DAGISelMatcherOpt.cpp

Chris Lattner sabre at nondot.org
Mon Mar 1 14:29:19 PST 2010


Author: lattner
Date: Mon Mar  1 16:29:19 2010
New Revision: 97513

URL: http://llvm.org/viewvc/llvm-project?rev=97513&view=rev
Log:
resolve a fixme by having the .td file parser reject thigns like

(set GPR, somecomplexpattern)

if somecomplexpattern doesn't declare what it can match.

Modified:
    llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
    llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
    llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
    llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp

Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=97513&r1=97512&r2=97513&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Mon Mar  1 16:29:19 2010
@@ -1407,7 +1407,6 @@
 // CodeGenDAGPatterns implementation
 //
 
-// FIXME: REMOVE OSTREAM ARGUMENT
 CodeGenDAGPatterns::CodeGenDAGPatterns(RecordKeeper &R) : Records(R) {
   Intrinsics = LoadIntrinsics(Records, false);
   TgtIntrinsics = LoadIntrinsics(Records, true);
@@ -2144,6 +2143,15 @@
   if (!PTM.getSrcPattern()->canPatternMatch(Reason, *this))
     Pattern->error("Pattern can never match: " + Reason);
   
+  // If the source pattern's root is a complex pattern, that complex pattern
+  // must specify the nodes it can potentially match.
+  if (const ComplexPattern *CP =
+        PTM.getSrcPattern()->getComplexPatternInfo(*this))
+    if (CP->getRootNodes().empty())
+      Pattern->error("ComplexPattern at root must specify list of opcodes it"
+                     " could match");
+  
+  
   // Find all of the named values in the input and output, ensure they have the
   // same type.
   std::map<std::string, NameRecord> SrcNames, DstNames;

Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=97513&r1=97512&r2=97513&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Mon Mar  1 16:29:19 2010
@@ -233,7 +233,6 @@
     }
   }
           
-  
   Matcher *TheMatcher = new ScopeMatcher(&PatternMatchers[0],
                                          PatternMatchers.size());
 

Modified: llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp?rev=97513&r1=97512&r2=97513&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Mon Mar  1 16:29:19 2010
@@ -505,16 +505,11 @@
   // check.
   if (const ComplexPattern *CP =
                    Pattern.getSrcPattern()->getComplexPatternInfo(CGP)) {
-    
     const std::vector<Record*> &OpNodes = CP->getRootNodes();
-    if (OpNodes.empty()) {
-      // FIXME: Empty OpNodes runs on everything, is this even valid?
-      if (Variant != 0) return true;
-    } else {
-      if (Variant >= OpNodes.size()) return true;
-      
-      AddMatcher(new CheckOpcodeMatcher(CGP.getSDNodeInfo(OpNodes[Variant])));
-    }
+    assert(!OpNodes.empty() &&"Complex Pattern must specify what it can match");
+    if (Variant >= OpNodes.size()) return true;
+    
+    AddMatcher(new CheckOpcodeMatcher(CGP.getSDNodeInfo(OpNodes[Variant])));
   } else {
     if (Variant != 0) return true;
   }

Modified: llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp?rev=97513&r1=97512&r2=97513&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp Mon Mar  1 16:29:19 2010
@@ -140,7 +140,7 @@
         return;
       }
 
-      // FIXME2: Kill off all the SelectionDAG::MorphNodeTo and getMachineNode
+      // FIXME2: Kill off all the SelectionDAG::SelectNodeTo and getMachineNode
       // variants.
     }
   





More information about the llvm-commits mailing list