resolve a fixme by having the .td file parser reject thigns like
authorChris Lattner <sabre@nondot.org>
Mon, 1 Mar 2010 22:29:19 +0000 (22:29 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 1 Mar 2010 22:29:19 +0000 (22:29 +0000)
(set GPR, somecomplexpattern)

if somecomplexpattern doesn't declare what it can match.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97513 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/CodeGenDAGPatterns.cpp
utils/TableGen/DAGISelEmitter.cpp
utils/TableGen/DAGISelMatcherGen.cpp
utils/TableGen/DAGISelMatcherOpt.cpp

index db90031709cc441177dc511c7453fbb4fce5caee..ce737bf3d343b1b98d86da856f13cc14cfaf0bb8 100644 (file)
@@ -1407,7 +1407,6 @@ void TreePattern::dump() const { print(errs()); }
 // CodeGenDAGPatterns implementation
 //
 
-// FIXME: REMOVE OSTREAM ARGUMENT
 CodeGenDAGPatterns::CodeGenDAGPatterns(RecordKeeper &R) : Records(R) {
   Intrinsics = LoadIntrinsics(Records, false);
   TgtIntrinsics = LoadIntrinsics(Records, true);
@@ -2144,6 +2143,15 @@ void CodeGenDAGPatterns::AddPatternToMatch(const TreePattern *Pattern,
   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;
index 03a12cd13d90261d847fe4568de2ba3a68de855c..e9cfef871a3c9101f2e5bb947839ce18b4231ac5 100644 (file)
@@ -233,7 +233,6 @@ void DAGISelEmitter::run(raw_ostream &OS) {
     }
   }
           
-  
   Matcher *TheMatcher = new ScopeMatcher(&PatternMatchers[0],
                                          PatternMatchers.size());
 
index cc3c4f14b4bac09577e93bd54f21b48a24de65ce..0c7456ef23b4c03cb94492c311e21711a2df715e 100644 (file)
@@ -505,16 +505,11 @@ bool MatcherGen::EmitMatcherCode(unsigned Variant) {
   // 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;
   }
index ce97fb47bdba18f4ff6fb2f675c55e58e216e401..a625fa85d40cf6283a27b09b6a790b375b3a81f2 100644 (file)
@@ -140,7 +140,7 @@ static void ContractNodes(OwningPtr<Matcher> &MatcherPtr,
         return;
       }
 
-      // FIXME2: Kill off all the SelectionDAG::MorphNodeTo and getMachineNode
+      // FIXME2: Kill off all the SelectionDAG::SelectNodeTo and getMachineNode
       // variants.
     }