Skip to content

Commit 28ba80e

Browse files
committed
* 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 llvm-svn: 9430
1 parent ad44de1 commit 28ba80e

File tree

2 files changed

+25
-30
lines changed

2 files changed

+25
-30
lines changed

llvm/lib/CodeGen/RegAlloc/IGNode.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
//
88
//===----------------------------------------------------------------------===//
99
//
10-
// class IGNode for coloring-based register allocation for LLVM.
10+
// This file implements an Interference graph node for coloring-based register
11+
// allocation.
1112
//
1213
//===----------------------------------------------------------------------===//
1314

@@ -28,7 +29,7 @@ void IGNode::pushOnStack() {
2829
assert(0 && "Invalid adj list size");
2930
}
3031

31-
for(int i=0; i < neighs; i++)
32+
for (int i=0; i < neighs; i++)
3233
AdjList[i]->decCurDegree();
3334
}
3435

@@ -39,7 +40,7 @@ void IGNode::pushOnStack() {
3940

4041
void IGNode::delAdjIGNode(const IGNode *Node) {
4142
std::vector<IGNode *>::iterator It=find(AdjList.begin(), AdjList.end(), Node);
42-
assert( It != AdjList.end() ); // the node must be there
43+
assert(It != AdjList.end() && "The node must be there!");
4344
AdjList.erase(It);
4445
}
4546

@@ -48,13 +49,10 @@ void IGNode::delAdjIGNode(const IGNode *Node) {
4849
//-----------------------------------------------------------------------------
4950

5051
unsigned
51-
IGNode::getCombinedDegree(const IGNode* otherNode) const
52-
{
52+
IGNode::getCombinedDegree(const IGNode* otherNode) const {
5353
std::vector<IGNode*> nbrs(AdjList);
5454
nbrs.insert(nbrs.end(), otherNode->AdjList.begin(), otherNode->AdjList.end());
5555
sort(nbrs.begin(), nbrs.end());
5656
std::vector<IGNode*>::iterator new_end = unique(nbrs.begin(), nbrs.end());
5757
return new_end - nbrs.begin();
5858
}
59-
60-

llvm/lib/CodeGen/RegAlloc/IGNode.h

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,26 @@
66
// the University of Illinois Open Source License. See LICENSE.TXT for details.
77
//
88
//===----------------------------------------------------------------------===//
9-
10-
/* Title: IGNode.h -*- C++ -*-
11-
Author: Ruchira Sasanka
12-
Date: July 25, 01
13-
Purpose: Represents a node in an interference graph.
14-
Notes:
15-
16-
For efficiency, the AdjList is updated only once - ie. we can add but not
17-
remove nodes from AdjList.
18-
19-
The removal of nodes from IG is simulated by decrementing the CurDegree.
20-
If this node is put on stack (that is removed from IG), the CurDegree of all
21-
the neighbors are decremented and this node is marked OnStack. Hence
22-
the effective neighbors in the AdjList are the ones that do not have the
23-
OnStack flag set (therefore, they are in the IG).
24-
25-
The methods that modify/use the CurDegree must be called only
26-
after all modifications to the IG are over (i.e., all neighbors are fixed).
27-
28-
The vector representation is the most efficient one for adj list.
29-
Though nodes are removed when coalescing is done, we access it in sequence
30-
for far many times when coloring (colorNode()).
31-
*/
9+
//
10+
// This file represents a node in an interference graph.
11+
//
12+
// For efficiency, the AdjList is updated only once - ie. we can add but not
13+
// remove nodes from AdjList.
14+
//
15+
// The removal of nodes from IG is simulated by decrementing the CurDegree.
16+
// If this node is put on stack (that is removed from IG), the CurDegree of all
17+
// the neighbors are decremented and this node is marked OnStack. Hence
18+
// the effective neighbors in the AdjList are the ones that do not have the
19+
// OnStack flag set (therefore, they are in the IG).
20+
//
21+
// The methods that modify/use the CurDegree must be called only
22+
// after all modifications to the IG are over (i.e., all neighbors are fixed).
23+
//
24+
// The vector representation is the most efficient one for adj list.
25+
// Though nodes are removed when coalescing is done, we access it in sequence
26+
// for far many times when coloring (colorNode()).
27+
//
28+
//===----------------------------------------------------------------------===//
3229

3330
#ifndef IGNODE_H
3431
#define IGNODE_H

0 commit comments

Comments
 (0)