* Use C++ style comments instead of C-style
authorMisha Brukman <brukman+llvm@gmail.com>
Thu, 23 Oct 2003 18:02:47 +0000 (18:02 +0000)
committerMisha Brukman <brukman+llvm@gmail.com>
Thu, 23 Oct 2003 18:02:47 +0000 (18:02 +0000)
* 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

lib/CodeGen/RegAlloc/IGNode.cpp
lib/CodeGen/RegAlloc/IGNode.h
lib/Target/SparcV9/RegAlloc/IGNode.cpp
lib/Target/SparcV9/RegAlloc/IGNode.h

index fcd299b28c607f32f7b635f8eb4425425abcb7fa..f883fb13c1d211338fd4dc5dd8ae49d4bb672b69 100644 (file)
@@ -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.
 // 
 //===----------------------------------------------------------------------===//
 
@@ -28,7 +29,7 @@ void IGNode::pushOnStack() {
     assert(0 && "Invalid adj list size");
   }
 
-  for(int i=0; i < neighs; i++)
+  for (int i=0; i < neighs; i++)
     AdjList[i]->decCurDegree();
 }
  
@@ -39,7 +40,7 @@ void IGNode::pushOnStack() {
 
 void IGNode::delAdjIGNode(const IGNode *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);
 }
 
@@ -48,13 +49,10 @@ void IGNode::delAdjIGNode(const IGNode *Node) {
 //-----------------------------------------------------------------------------
 
 unsigned
-IGNode::getCombinedDegree(const IGNode* otherNode) const
-{
+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();
 }
-
-
index f8286e22bdcda9b8ea6b171f1c1776257c6e59d0..82f07e0c7e7449028f8f0650e2945a1c4cdae859 100644 (file)
@@ -6,29 +6,26 @@
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
 // 
 //===----------------------------------------------------------------------===//
-
-/* Title:   IGNode.h                      -*- C++ -*-
-   Author:  Ruchira Sasanka
-   Date:    July 25, 01
-   Purpose: Represents a node in an interference graph. 
-   Notes:
-
-   For efficiency, the AdjList is updated only once - ie. we can add but not
-   remove nodes from AdjList. 
-
-   The removal of nodes from IG is simulated by decrementing the CurDegree.
-   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 effective neighbors in the AdjList are the ones that do not have the
-   OnStack flag set (therefore, they are in the IG).
-
-   The methods that modify/use the CurDegree must be called only
-   after all modifications to the IG are over (i.e., all neighbors are fixed).
-
-   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()).
-*/
+//
+// This file represents a node in an interference graph. 
+//
+// For efficiency, the AdjList is updated only once - ie. we can add but not
+// remove nodes from AdjList. 
+//
+// The removal of nodes from IG is simulated by decrementing the CurDegree.
+// 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 effective neighbors in the AdjList are the ones that do not have the
+// OnStack flag set (therefore, they are in the IG).
+//
+// The methods that modify/use the CurDegree must be called only
+// after all modifications to the IG are over (i.e., all neighbors are fixed).
+//
+// 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
 #define IGNODE_H
index fcd299b28c607f32f7b635f8eb4425425abcb7fa..f883fb13c1d211338fd4dc5dd8ae49d4bb672b69 100644 (file)
@@ -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.
 // 
 //===----------------------------------------------------------------------===//
 
@@ -28,7 +29,7 @@ void IGNode::pushOnStack() {
     assert(0 && "Invalid adj list size");
   }
 
-  for(int i=0; i < neighs; i++)
+  for (int i=0; i < neighs; i++)
     AdjList[i]->decCurDegree();
 }
  
@@ -39,7 +40,7 @@ void IGNode::pushOnStack() {
 
 void IGNode::delAdjIGNode(const IGNode *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);
 }
 
@@ -48,13 +49,10 @@ void IGNode::delAdjIGNode(const IGNode *Node) {
 //-----------------------------------------------------------------------------
 
 unsigned
-IGNode::getCombinedDegree(const IGNode* otherNode) const
-{
+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();
 }
-
-
index f8286e22bdcda9b8ea6b171f1c1776257c6e59d0..82f07e0c7e7449028f8f0650e2945a1c4cdae859 100644 (file)
@@ -6,29 +6,26 @@
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
 // 
 //===----------------------------------------------------------------------===//
-
-/* Title:   IGNode.h                      -*- C++ -*-
-   Author:  Ruchira Sasanka
-   Date:    July 25, 01
-   Purpose: Represents a node in an interference graph. 
-   Notes:
-
-   For efficiency, the AdjList is updated only once - ie. we can add but not
-   remove nodes from AdjList. 
-
-   The removal of nodes from IG is simulated by decrementing the CurDegree.
-   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 effective neighbors in the AdjList are the ones that do not have the
-   OnStack flag set (therefore, they are in the IG).
-
-   The methods that modify/use the CurDegree must be called only
-   after all modifications to the IG are over (i.e., all neighbors are fixed).
-
-   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()).
-*/
+//
+// This file represents a node in an interference graph. 
+//
+// For efficiency, the AdjList is updated only once - ie. we can add but not
+// remove nodes from AdjList. 
+//
+// The removal of nodes from IG is simulated by decrementing the CurDegree.
+// 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 effective neighbors in the AdjList are the ones that do not have the
+// OnStack flag set (therefore, they are in the IG).
+//
+// The methods that modify/use the CurDegree must be called only
+// after all modifications to the IG are over (i.e., all neighbors are fixed).
+//
+// 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
 #define IGNODE_H