Validate that the input to 'Pat' patterns is sane.
authorChris Lattner <sabre@nondot.org>
Thu, 17 Nov 2005 17:43:52 +0000 (17:43 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 17 Nov 2005 17:43:52 +0000 (17:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24393 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/DAGISelEmitter.cpp

index bdae7615f9bd9d6fcdac6d299e6aea593dd48afa..68248d7d6670ace163305f85a76fa6d8a095eaaa 100644 (file)
@@ -1212,6 +1212,14 @@ void DAGISelEmitter::ParsePatterns() {
     // never do anything with this pattern: report it to the user.
     if (!Pattern->InferAllTypes())
       Pattern->error("Could not infer all types in pattern!");
+
+    // Validate that the input pattern is correct.
+    {
+      std::map<std::string, TreePatternNode*> InstInputs;
+      std::map<std::string, Record*> InstResults;
+      FindPatternInputsAndOutputs(Pattern, Pattern->getOnlyTree(),
+                                  InstInputs, InstResults);
+    }
     
     ListInit *LI = Patterns[i]->getValueAsListInit("ResultInstrs");
     if (LI->getSize() == 0) continue;  // no pattern.