diff options
author | Chris Lattner <sabre@nondot.org> | 2006-02-03 18:06:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-02-03 18:06:02 +0000 |
commit | 3e1798086b2cb4b1f96fcbb1b8a084c8af092363 (patch) | |
tree | c32b5ef3919d1679640d91e71ab968249631112b /utils/TableGen/DAGISelEmitter.cpp | |
parent | 6184f9ca5eff6f7f55264d447638b7a27b806c9c (diff) | |
download | llvm-3e1798086b2cb4b1f96fcbb1b8a084c8af092363.tar.gz llvm-3e1798086b2cb4b1f96fcbb1b8a084c8af092363.tar.bz2 llvm-3e1798086b2cb4b1f96fcbb1b8a084c8af092363.tar.xz |
node predicates add to the complexity of a pattern. This ensures that the
X86 backend attempts to match small-immediate versions of instructions before
the full size immediate versions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25937 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelEmitter.cpp')
-rw-r--r-- | utils/TableGen/DAGISelEmitter.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp index b9a398f6b4..b85ee8c64c 100644 --- a/utils/TableGen/DAGISelEmitter.cpp +++ b/utils/TableGen/DAGISelEmitter.cpp @@ -1722,7 +1722,12 @@ static unsigned getPatternSize(TreePatternNode *P, DAGISelEmitter &ISE) { const ComplexPattern *AM = NodeGetComplexPattern(P, ISE); if (AM) Size += AM->getNumOperands() * 2; - + + // If this node has some predicate function that must match, it adds to the + // complexity of this node. + if (!P->getPredicateFn().empty()) + ++Size; + // 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); @@ -1730,9 +1735,11 @@ static unsigned getPatternSize(TreePatternNode *P, DAGISelEmitter &ISE) { Size += getPatternSize(Child, ISE); else if (Child->isLeaf()) { if (dynamic_cast<IntInit*>(Child->getLeafValue())) - Size += 3; // Matches a ConstantSDNode. + Size += 3; // Matches a ConstantSDNode (+2) and a specific value (+1). else if (NodeIsComplexPattern(Child)) Size += getPatternSize(Child, ISE); + else if (!Child->getPredicateFn().empty()) + ++Size; } } |