mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
Fixed bug - added code in pushUnconstrainedIGNodes() to check whether a node
is already pushed to stack by a previous call to the same method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1154 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
54bc6b3166
commit
d1565abd68
@ -21,7 +21,7 @@ RegClass::RegClass(const Method *const M,
|
|||||||
|
|
||||||
void RegClass::colorAllRegs()
|
void RegClass::colorAllRegs()
|
||||||
{
|
{
|
||||||
if(DEBUG_RA) cout << "Coloring IGs ..." << endl;
|
if(DEBUG_RA) cout << "Coloring IG of reg class " << RegClassID << " ...\n";
|
||||||
|
|
||||||
//preColorIGNodes(); // pre-color IGNodes
|
//preColorIGNodes(); // pre-color IGNodes
|
||||||
pushAllIGNodes(); // push all IG Nodes
|
pushAllIGNodes(); // push all IG Nodes
|
||||||
@ -47,7 +47,7 @@ void RegClass::colorAllRegs()
|
|||||||
void RegClass::pushAllIGNodes()
|
void RegClass::pushAllIGNodes()
|
||||||
{
|
{
|
||||||
bool NeedMoreSpills;
|
bool NeedMoreSpills;
|
||||||
IGNode *IGNodeSpill;
|
|
||||||
|
|
||||||
IG.setCurDegreeOfIGNodes(); // calculate degree of IGNodes
|
IG.setCurDegreeOfIGNodes(); // calculate degree of IGNodes
|
||||||
|
|
||||||
@ -71,8 +71,8 @@ void RegClass::pushAllIGNodes()
|
|||||||
do{
|
do{
|
||||||
|
|
||||||
//get node with min spill cost
|
//get node with min spill cost
|
||||||
IGNodeSpill = getIGNodeWithMinSpillCost();
|
IGNode *IGNodeSpill = getIGNodeWithMinSpillCost();
|
||||||
|
|
||||||
// push that node on to stack
|
// push that node on to stack
|
||||||
IGNodeStack.push( IGNodeSpill );
|
IGNodeStack.push( IGNodeSpill );
|
||||||
|
|
||||||
@ -89,7 +89,11 @@ void RegClass::pushAllIGNodes()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// This method goes thru all IG nodes in the IGNodeList of an IG of a
|
||||||
|
// register class and push any unconstrained IG node left (that is not
|
||||||
|
// already pushed)
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
bool RegClass::pushUnconstrainedIGNodes()
|
bool RegClass::pushUnconstrainedIGNodes()
|
||||||
{
|
{
|
||||||
@ -103,9 +107,14 @@ bool RegClass::pushUnconstrainedIGNodes()
|
|||||||
// get IGNode i from IGNodeList
|
// get IGNode i from IGNodeList
|
||||||
IGNode *IGNode = IG.getIGNodeList()[i];
|
IGNode *IGNode = IG.getIGNodeList()[i];
|
||||||
|
|
||||||
if( ! IGNode ) // can be null due to merging
|
if( !IGNode ) // can be null due to merging
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// if already pushed on stack, continue. This can happen since this
|
||||||
|
// method can be called repeatedly until all constrained nodes are
|
||||||
|
// pushed
|
||||||
|
if( IGNode->isOnStack() )
|
||||||
|
continue;
|
||||||
// if the degree of IGNode is lower
|
// if the degree of IGNode is lower
|
||||||
if( (unsigned) IGNode->getCurDegree() < MRC->getNumOfAvailRegs() ) {
|
if( (unsigned) IGNode->getCurDegree() < MRC->getNumOfAvailRegs() ) {
|
||||||
IGNodeStack.push( IGNode ); // push IGNode on to the stack
|
IGNodeStack.push( IGNode ); // push IGNode on to the stack
|
||||||
|
@ -21,7 +21,7 @@ RegClass::RegClass(const Method *const M,
|
|||||||
|
|
||||||
void RegClass::colorAllRegs()
|
void RegClass::colorAllRegs()
|
||||||
{
|
{
|
||||||
if(DEBUG_RA) cout << "Coloring IGs ..." << endl;
|
if(DEBUG_RA) cout << "Coloring IG of reg class " << RegClassID << " ...\n";
|
||||||
|
|
||||||
//preColorIGNodes(); // pre-color IGNodes
|
//preColorIGNodes(); // pre-color IGNodes
|
||||||
pushAllIGNodes(); // push all IG Nodes
|
pushAllIGNodes(); // push all IG Nodes
|
||||||
@ -47,7 +47,7 @@ void RegClass::colorAllRegs()
|
|||||||
void RegClass::pushAllIGNodes()
|
void RegClass::pushAllIGNodes()
|
||||||
{
|
{
|
||||||
bool NeedMoreSpills;
|
bool NeedMoreSpills;
|
||||||
IGNode *IGNodeSpill;
|
|
||||||
|
|
||||||
IG.setCurDegreeOfIGNodes(); // calculate degree of IGNodes
|
IG.setCurDegreeOfIGNodes(); // calculate degree of IGNodes
|
||||||
|
|
||||||
@ -71,8 +71,8 @@ void RegClass::pushAllIGNodes()
|
|||||||
do{
|
do{
|
||||||
|
|
||||||
//get node with min spill cost
|
//get node with min spill cost
|
||||||
IGNodeSpill = getIGNodeWithMinSpillCost();
|
IGNode *IGNodeSpill = getIGNodeWithMinSpillCost();
|
||||||
|
|
||||||
// push that node on to stack
|
// push that node on to stack
|
||||||
IGNodeStack.push( IGNodeSpill );
|
IGNodeStack.push( IGNodeSpill );
|
||||||
|
|
||||||
@ -89,7 +89,11 @@ void RegClass::pushAllIGNodes()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// This method goes thru all IG nodes in the IGNodeList of an IG of a
|
||||||
|
// register class and push any unconstrained IG node left (that is not
|
||||||
|
// already pushed)
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
bool RegClass::pushUnconstrainedIGNodes()
|
bool RegClass::pushUnconstrainedIGNodes()
|
||||||
{
|
{
|
||||||
@ -103,9 +107,14 @@ bool RegClass::pushUnconstrainedIGNodes()
|
|||||||
// get IGNode i from IGNodeList
|
// get IGNode i from IGNodeList
|
||||||
IGNode *IGNode = IG.getIGNodeList()[i];
|
IGNode *IGNode = IG.getIGNodeList()[i];
|
||||||
|
|
||||||
if( ! IGNode ) // can be null due to merging
|
if( !IGNode ) // can be null due to merging
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// if already pushed on stack, continue. This can happen since this
|
||||||
|
// method can be called repeatedly until all constrained nodes are
|
||||||
|
// pushed
|
||||||
|
if( IGNode->isOnStack() )
|
||||||
|
continue;
|
||||||
// if the degree of IGNode is lower
|
// if the degree of IGNode is lower
|
||||||
if( (unsigned) IGNode->getCurDegree() < MRC->getNumOfAvailRegs() ) {
|
if( (unsigned) IGNode->getCurDegree() < MRC->getNumOfAvailRegs() ) {
|
||||||
IGNodeStack.push( IGNode ); // push IGNode on to the stack
|
IGNodeStack.push( IGNode ); // push IGNode on to the stack
|
||||||
|
Loading…
x
Reference in New Issue
Block a user