aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-01-06 22:19:44 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-01-06 22:19:44 +0000
commit4a7c284b3564079b89cab1bea827f0ea78e74ffa (patch)
tree30f8ad53f5d6265dde14879de20cc23714c99263 /utils
parent0114e949034dd3032599799fda9dc9d62aa60088 (diff)
downloadexternal_llvm-4a7c284b3564079b89cab1bea827f0ea78e74ffa.zip
external_llvm-4a7c284b3564079b89cab1bea827f0ea78e74ffa.tar.gz
external_llvm-4a7c284b3564079b89cab1bea827f0ea78e74ffa.tar.bz2
Pattern complexity calculation fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25133 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index 21e5ed3..ed341db 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -1691,6 +1691,11 @@ static const ComplexPattern *NodeGetComplexPattern(TreePatternNode *N,
/// patterns before small ones. This is used to determine the size of a
/// pattern.
static unsigned getPatternSize(TreePatternNode *P, DAGISelEmitter &ISE) {
+ assert(isExtIntegerInVTs(P->getExtTypes()) ||
+ isExtFloatingPointInVTs(P->getExtTypes()) ||
+ P->getExtTypeNum(0) == MVT::isVoid ||
+ P->getExtTypeNum(0) == MVT::Flag &&
+ "Not a valid pattern node to size!");
unsigned Size = 2; // The node itself.
// FIXME: This is a hack to statically increase the priority of patterns
@@ -1700,7 +1705,7 @@ static unsigned getPatternSize(TreePatternNode *P, DAGISelEmitter &ISE) {
// calculate the complexity of all patterns a dag can potentially map to.
const ComplexPattern *AM = NodeGetComplexPattern(P, ISE);
if (AM)
- Size += AM->getNumOperands();
+ Size += AM->getNumOperands() * 2;
// Count children in the count if they are also nodes.
for (unsigned i = 0, e = P->getNumChildren(); i != e; ++i) {
@@ -1708,10 +1713,10 @@ static unsigned getPatternSize(TreePatternNode *P, DAGISelEmitter &ISE) {
if (!Child->isLeaf() && Child->getExtTypeNum(0) != MVT::Other)
Size += getPatternSize(Child, ISE);
else if (Child->isLeaf()) {
- Size += getPatternSize(Child, ISE);
if (dynamic_cast<IntInit*>(Child->getLeafValue()))
- // Matches a ConstantSDNode. More specific to any immediate.
- ++Size;
+ Size += 3; // Matches a ConstantSDNode.
+ else if (NodeIsComplexPattern(Child))
+ Size += getPatternSize(Child, ISE);
}
}