mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
Fixed a bug in spill cost estimation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1500 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6a3db8c117
commit
ce773da223
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user