summaryrefslogtreecommitdiff
path: root/utils/TableGen/DAGISelEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-15 06:00:16 +0000
committerChris Lattner <sabre@nondot.org>2010-03-15 06:00:16 +0000
commit2cacec55f947c716b058a39038889550d7e39b3c (patch)
treedc66a0d042a020fd18baa16e52fe5e205ef0e073 /utils/TableGen/DAGISelEmitter.cpp
parent6894b07996757134b7036753fcad85f354a0f5bd (diff)
downloadllvm-2cacec55f947c716b058a39038889550d7e39b3c.tar.gz
llvm-2cacec55f947c716b058a39038889550d7e39b3c.tar.bz2
llvm-2cacec55f947c716b058a39038889550d7e39b3c.tar.xz
Completely rewrite tblgen's type inference mechanism,
changing the primary datastructure from being a "std::vector<unsigned char>" to being a new TypeSet class that actually has (gasp) invariants! This changes more things than I remember, but one major innovation here is that it enforces that named input values agree in type with their output values. This also eliminates code that transparently assumes (in some cases) that SDNodeXForm input/output types are the same, because this is wrong in many case. This also eliminates a bug which caused a lot of ambiguous patterns to go undetected, where a register class would sometimes pick the first possible type, causing an ambiguous pattern to get arbitrary results. With all the recent target changes, this causes no functionality change! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98534 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelEmitter.cpp')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index e0fa7c82f8..73feac1651 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -25,13 +25,7 @@ using namespace llvm;
/// patterns before small ones. This is used to determine the size of a
/// pattern.
static unsigned getPatternSize(TreePatternNode *P, CodeGenDAGPatterns &CGP) {
- assert((EEVT::isExtIntegerInVTs(P->getExtTypes()) ||
- EEVT::isExtFloatingPointInVTs(P->getExtTypes()) ||
- P->getExtTypeNum(0) == MVT::isVoid ||
- P->getExtTypeNum(0) == MVT::Flag ||
- P->getExtTypeNum(0) == MVT::iPTR ||
- P->getExtTypeNum(0) == MVT::iPTRAny) &&
- "Not a valid pattern node to size!");
+ assert(P->hasTypeSet() && "Not a valid pattern node to size!");
unsigned Size = 3; // The node itself.
// If the root node is a ConstantSDNode, increases its size.
// e.g. (set R32:$dst, 0).
@@ -55,7 +49,7 @@ static unsigned getPatternSize(TreePatternNode *P, CodeGenDAGPatterns &CGP) {
// Count children in the count if they are also nodes.
for (unsigned i = 0, e = P->getNumChildren(); i != e; ++i) {
TreePatternNode *Child = P->getChild(i);
- if (!Child->isLeaf() && Child->getExtTypeNum(0) != MVT::Other)
+ if (!Child->isLeaf() && Child->getType() != MVT::Other)
Size += getPatternSize(Child, CGP);
else if (Child->isLeaf()) {
if (dynamic_cast<IntInit*>(Child->getLeafValue()))