From 09c033962bf26b2b35f18a2ead2d86748a030cef Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 17 Nov 2005 17:43:52 +0000 Subject: [PATCH] Validate that the input to 'Pat' patterns is sane. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24393 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/DAGISelEmitter.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp index bdae7615f9b..68248d7d667 100644 --- a/utils/TableGen/DAGISelEmitter.cpp +++ b/utils/TableGen/DAGISelEmitter.cpp @@ -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 InstInputs; + std::map InstResults; + FindPatternInputsAndOutputs(Pattern, Pattern->getOnlyTree(), + InstInputs, InstResults); + } ListInit *LI = Patterns[i]->getValueAsListInit("ResultInstrs"); if (LI->getSize() == 0) continue; // no pattern.