[llvm-commits] [llvm] r99747 - /llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
Chris Lattner
sabre at nondot.org
Sat Mar 27 23:57:56 PDT 2010
Author: lattner
Date: Sun Mar 28 01:57:56 2010
New Revision: 99747
URL: http://llvm.org/viewvc/llvm-project?rev=99747&view=rev
Log:
validate that input sdnodes don't exist in an output pattern.
Modified:
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=99747&r1=99746&r2=99747&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Sun Mar 28 01:57:56 2010
@@ -1490,11 +1490,7 @@
Init *II = BI->convertInitializerTo(new IntRecTy());
if (II == 0 || !dynamic_cast<IntInit*>(II))
error("Bits value must be constants!");
-
- if (!OpName.empty())
- error("Constant int argument should not have a name!");
-
- return new TreePatternNode(dynamic_cast<IntInit*>(II), 1);
+ return ParseTreePattern(II, OpName);
}
DagInit *Dag = dynamic_cast<DagInit*>(TheInit);
@@ -1534,9 +1530,28 @@
error("Unrecognized node '" + Operator->getName() + "'!");
// Check to see if this is something that is illegal in an input pattern.
- if (isInputPattern && (Operator->isSubClassOf("Instruction") ||
- Operator->isSubClassOf("SDNodeXForm")))
- error("Cannot use '" + Operator->getName() + "' in an input pattern!");
+ if (isInputPattern) {
+ if (Operator->isSubClassOf("Instruction") ||
+ Operator->isSubClassOf("SDNodeXForm"))
+ error("Cannot use '" + Operator->getName() + "' in an input pattern!");
+ } else {
+ if (Operator->isSubClassOf("Intrinsic"))
+ error("Cannot use '" + Operator->getName() + "' in an output pattern!");
+
+ if (Operator->isSubClassOf("SDNode") &&
+ Operator->getName() != "imm" &&
+ Operator->getName() != "fpimm" &&
+ Operator->getName() != "tglobaltlsaddr" &&
+ Operator->getName() != "tconstpool" &&
+ Operator->getName() != "tjumptable" &&
+ Operator->getName() != "tframeindex" &&
+ Operator->getName() != "texternalsym" &&
+ Operator->getName() != "tblockaddress" &&
+ Operator->getName() != "tglobaladdr" &&
+ Operator->getName() != "bb" &&
+ Operator->getName() != "vt")
+ error("Cannot use '" + Operator->getName() + "' in an output pattern!");
+ }
std::vector<TreePatternNode*> Children;
More information about the llvm-commits
mailing list