summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorRuchira Sasanka <sasanka@students.uiuc.edu>2002-01-08 16:29:23 +0000
committerRuchira Sasanka <sasanka@students.uiuc.edu>2002-01-08 16:29:23 +0000
commitbc28455806e900a7ced16a0e1013cd7fae5579b6 (patch)
treeb7c07c4179e72c31a013fcebc89a562cdf1f920e /llvm/lib/CodeGen
parenta42a7e78b65c469db8374b251ef7099b6bb54c0a (diff)
downloadbcm5719-llvm-bc28455806e900a7ced16a0e1013cd7fae5579b6.tar.gz
bcm5719-llvm-bc28455806e900a7ced16a0e1013cd7fae5579b6.zip
Fixed a bug in spill cost estimation
llvm-svn: 1500
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/RegAlloc/RegClass.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/RegAlloc/RegClass.cpp b/llvm/lib/CodeGen/RegAlloc/RegClass.cpp
index 3ee79e328e8..3918871d69f 100644
--- a/llvm/lib/CodeGen/RegAlloc/RegClass.cpp
+++ b/llvm/lib/CodeGen/RegAlloc/RegClass.cpp
@@ -150,9 +150,9 @@ IGNode * RegClass::getIGNodeWithMinSpillCost()
{
unsigned int IGNodeListSize = IG.getIGNodeList().size();
- long MinSpillCost = -1;
+ double MinSpillCost;
IGNode *MinCostIGNode = NULL;
-
+ bool isFirstNode = true;
// pass over IGNodeList to find the IGNode with minimum spill cost
// among all IGNodes that are not yet pushed on to the stack
@@ -165,11 +165,13 @@ IGNode * RegClass::getIGNodeWithMinSpillCost()
if( ! IGNode->isOnStack() ) {
- long SpillCost = (long) IGNode->getParentLR()->getSpillCost();
+ double SpillCost = (double) IGNode->getParentLR()->getSpillCost() /
+ (double) (IGNode->getCurDegree() + 1);
- if( MinSpillCost == -1) { // for the first IG node
+ if( isFirstNode ) { // for the first IG node
MinSpillCost = SpillCost;
MinCostIGNode = IGNode;
+ isFirstNode = false;
}
else if( MinSpillCost > SpillCost) {
OpenPOWER on IntegriCloud