mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-30 02:25:19 +00:00
Allow copy coalescing in more cases: if sum of node degrees is more than
than #available regs, compute the sum excluding duplicates and if that is less than #regs, go ahead and coalesce. Add method IGNode::getCombinedDegree to count excluding duplicates. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3842 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -36,3 +36,19 @@ void IGNode::delAdjIGNode(const IGNode *Node) {
|
||||
assert( It != AdjList.end() ); // the node must be there
|
||||
AdjList.erase(It);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Get the number of unique neighbors if these two nodes are merged
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
unsigned
|
||||
IGNode::getCombinedDegree(const IGNode* otherNode) const
|
||||
{
|
||||
std::vector<IGNode*> nbrs(AdjList);
|
||||
nbrs.insert(nbrs.end(), otherNode->AdjList.begin(), otherNode->AdjList.end());
|
||||
sort(nbrs.begin(), nbrs.end());
|
||||
std::vector<IGNode*>::iterator new_end = unique(nbrs.begin(), nbrs.end());
|
||||
return new_end - nbrs.begin();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user