summaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeGenDAGPatterns.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-01 22:29:19 +0000
committerChris Lattner <sabre@nondot.org>2010-03-01 22:29:19 +0000
commit405f1252b9f3937b9c30edf683375cf261967c79 (patch)
tree56d6728c6619d393510b7039f7c074a73d2d788c /utils/TableGen/CodeGenDAGPatterns.cpp
parent19d417c346d5f49d86fe447cc58d931a1b476d8e (diff)
downloadllvm-405f1252b9f3937b9c30edf683375cf261967c79.tar.gz
llvm-405f1252b9f3937b9c30edf683375cf261967c79.tar.bz2
llvm-405f1252b9f3937b9c30edf683375cf261967c79.tar.xz
resolve a fixme by having the .td file parser reject thigns like
(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
Diffstat (limited to 'utils/TableGen/CodeGenDAGPatterns.cpp')
-rw-r--r--utils/TableGen/CodeGenDAGPatterns.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp
index db90031709..ce737bf3d3 100644
--- a/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -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;