mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-17 15:38:40 +00:00
* Use C++ style comments instead of C-style
* Make file description more readable * Make code layout more consistent, include comment in assert so it's visible during execution if it hits git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9430 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1913848e33
commit
a1f64355d7
@ -7,7 +7,8 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// class IGNode for coloring-based register allocation for LLVM.
|
// This file implements an Interference graph node for coloring-based register
|
||||||
|
// allocation.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ void IGNode::pushOnStack() {
|
|||||||
|
|
||||||
void IGNode::delAdjIGNode(const IGNode *Node) {
|
void IGNode::delAdjIGNode(const IGNode *Node) {
|
||||||
std::vector<IGNode *>::iterator It=find(AdjList.begin(), AdjList.end(), Node);
|
std::vector<IGNode *>::iterator It=find(AdjList.begin(), AdjList.end(), Node);
|
||||||
assert( It != AdjList.end() ); // the node must be there
|
assert(It != AdjList.end() && "The node must be there!");
|
||||||
AdjList.erase(It);
|
AdjList.erase(It);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,13 +49,10 @@ void IGNode::delAdjIGNode(const IGNode *Node) {
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
IGNode::getCombinedDegree(const IGNode* otherNode) const
|
IGNode::getCombinedDegree(const IGNode* otherNode) const {
|
||||||
{
|
|
||||||
std::vector<IGNode*> nbrs(AdjList);
|
std::vector<IGNode*> nbrs(AdjList);
|
||||||
nbrs.insert(nbrs.end(), otherNode->AdjList.begin(), otherNode->AdjList.end());
|
nbrs.insert(nbrs.end(), otherNode->AdjList.begin(), otherNode->AdjList.end());
|
||||||
sort(nbrs.begin(), nbrs.end());
|
sort(nbrs.begin(), nbrs.end());
|
||||||
std::vector<IGNode*>::iterator new_end = unique(nbrs.begin(), nbrs.end());
|
std::vector<IGNode*>::iterator new_end = unique(nbrs.begin(), nbrs.end());
|
||||||
return new_end - nbrs.begin();
|
return new_end - nbrs.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,29 +6,26 @@
|
|||||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
/* Title: IGNode.h -*- C++ -*-
|
// This file represents a node in an interference graph.
|
||||||
Author: Ruchira Sasanka
|
//
|
||||||
Date: July 25, 01
|
// For efficiency, the AdjList is updated only once - ie. we can add but not
|
||||||
Purpose: Represents a node in an interference graph.
|
// remove nodes from AdjList.
|
||||||
Notes:
|
//
|
||||||
|
// The removal of nodes from IG is simulated by decrementing the CurDegree.
|
||||||
For efficiency, the AdjList is updated only once - ie. we can add but not
|
// If this node is put on stack (that is removed from IG), the CurDegree of all
|
||||||
remove nodes from AdjList.
|
// the neighbors are decremented and this node is marked OnStack. Hence
|
||||||
|
// the effective neighbors in the AdjList are the ones that do not have the
|
||||||
The removal of nodes from IG is simulated by decrementing the CurDegree.
|
// OnStack flag set (therefore, they are in the IG).
|
||||||
If this node is put on stack (that is removed from IG), the CurDegree of all
|
//
|
||||||
the neighbors are decremented and this node is marked OnStack. Hence
|
// The methods that modify/use the CurDegree must be called only
|
||||||
the effective neighbors in the AdjList are the ones that do not have the
|
// after all modifications to the IG are over (i.e., all neighbors are fixed).
|
||||||
OnStack flag set (therefore, they are in the IG).
|
//
|
||||||
|
// The vector representation is the most efficient one for adj list.
|
||||||
The methods that modify/use the CurDegree must be called only
|
// Though nodes are removed when coalescing is done, we access it in sequence
|
||||||
after all modifications to the IG are over (i.e., all neighbors are fixed).
|
// for far many times when coloring (colorNode()).
|
||||||
|
//
|
||||||
The vector representation is the most efficient one for adj list.
|
//===----------------------------------------------------------------------===//
|
||||||
Though nodes are removed when coalescing is done, we access it in sequence
|
|
||||||
for far many times when coloring (colorNode()).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef IGNODE_H
|
#ifndef IGNODE_H
|
||||||
#define IGNODE_H
|
#define IGNODE_H
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// class IGNode for coloring-based register allocation for LLVM.
|
// This file implements an Interference graph node for coloring-based register
|
||||||
|
// allocation.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ void IGNode::pushOnStack() {
|
|||||||
|
|
||||||
void IGNode::delAdjIGNode(const IGNode *Node) {
|
void IGNode::delAdjIGNode(const IGNode *Node) {
|
||||||
std::vector<IGNode *>::iterator It=find(AdjList.begin(), AdjList.end(), Node);
|
std::vector<IGNode *>::iterator It=find(AdjList.begin(), AdjList.end(), Node);
|
||||||
assert( It != AdjList.end() ); // the node must be there
|
assert(It != AdjList.end() && "The node must be there!");
|
||||||
AdjList.erase(It);
|
AdjList.erase(It);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,13 +49,10 @@ void IGNode::delAdjIGNode(const IGNode *Node) {
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
IGNode::getCombinedDegree(const IGNode* otherNode) const
|
IGNode::getCombinedDegree(const IGNode* otherNode) const {
|
||||||
{
|
|
||||||
std::vector<IGNode*> nbrs(AdjList);
|
std::vector<IGNode*> nbrs(AdjList);
|
||||||
nbrs.insert(nbrs.end(), otherNode->AdjList.begin(), otherNode->AdjList.end());
|
nbrs.insert(nbrs.end(), otherNode->AdjList.begin(), otherNode->AdjList.end());
|
||||||
sort(nbrs.begin(), nbrs.end());
|
sort(nbrs.begin(), nbrs.end());
|
||||||
std::vector<IGNode*>::iterator new_end = unique(nbrs.begin(), nbrs.end());
|
std::vector<IGNode*>::iterator new_end = unique(nbrs.begin(), nbrs.end());
|
||||||
return new_end - nbrs.begin();
|
return new_end - nbrs.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,29 +6,26 @@
|
|||||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
/* Title: IGNode.h -*- C++ -*-
|
// This file represents a node in an interference graph.
|
||||||
Author: Ruchira Sasanka
|
//
|
||||||
Date: July 25, 01
|
// For efficiency, the AdjList is updated only once - ie. we can add but not
|
||||||
Purpose: Represents a node in an interference graph.
|
// remove nodes from AdjList.
|
||||||
Notes:
|
//
|
||||||
|
// The removal of nodes from IG is simulated by decrementing the CurDegree.
|
||||||
For efficiency, the AdjList is updated only once - ie. we can add but not
|
// If this node is put on stack (that is removed from IG), the CurDegree of all
|
||||||
remove nodes from AdjList.
|
// the neighbors are decremented and this node is marked OnStack. Hence
|
||||||
|
// the effective neighbors in the AdjList are the ones that do not have the
|
||||||
The removal of nodes from IG is simulated by decrementing the CurDegree.
|
// OnStack flag set (therefore, they are in the IG).
|
||||||
If this node is put on stack (that is removed from IG), the CurDegree of all
|
//
|
||||||
the neighbors are decremented and this node is marked OnStack. Hence
|
// The methods that modify/use the CurDegree must be called only
|
||||||
the effective neighbors in the AdjList are the ones that do not have the
|
// after all modifications to the IG are over (i.e., all neighbors are fixed).
|
||||||
OnStack flag set (therefore, they are in the IG).
|
//
|
||||||
|
// The vector representation is the most efficient one for adj list.
|
||||||
The methods that modify/use the CurDegree must be called only
|
// Though nodes are removed when coalescing is done, we access it in sequence
|
||||||
after all modifications to the IG are over (i.e., all neighbors are fixed).
|
// for far many times when coloring (colorNode()).
|
||||||
|
//
|
||||||
The vector representation is the most efficient one for adj list.
|
//===----------------------------------------------------------------------===//
|
||||||
Though nodes are removed when coalescing is done, we access it in sequence
|
|
||||||
for far many times when coloring (colorNode()).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef IGNODE_H
|
#ifndef IGNODE_H
|
||||||
#define IGNODE_H
|
#define IGNODE_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user