summaryrefslogtreecommitdiff
path: root/utils/TableGen/DAGISelEmitter.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-02-01 06:06:31 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-02-01 06:06:31 +0000
commit657416cfba9f0b2823cf885391441971edcf4190 (patch)
tree3c02df0026ff2fd559f84df1868bcbc724baeab6 /utils/TableGen/DAGISelEmitter.cpp
parent09f0bd39b16eec73e067561c0c7546902ce97c30 (diff)
downloadllvm-657416cfba9f0b2823cf885391441971edcf4190.tar.gz
llvm-657416cfba9f0b2823cf885391441971edcf4190.tar.bz2
llvm-657416cfba9f0b2823cf885391441971edcf4190.tar.xz
If a pattern's root node is a constant, its size should be 3 rather than 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25870 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelEmitter.cpp')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index c384f53623..f0ecd66fb2 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -1709,6 +1709,10 @@ static unsigned getPatternSize(TreePatternNode *P, DAGISelEmitter &ISE) {
P->getExtTypeNum(0) == MVT::Flag &&
"Not a valid pattern node to size!");
unsigned Size = 2; // The node itself.
+ // If the root node is a ConstantSDNode, increases its size.
+ // e.g. (set R32:$dst, 0).
+ if (P->isLeaf() && dynamic_cast<IntInit*>(P->getLeafValue()))
+ Size++;
// FIXME: This is a hack to statically increase the priority of patterns
// which maps a sub-dag to a complex pattern. e.g. favors LEA over ADD.