Make assertIGNode be private to the InterferenceGraph.cpp file
authorChris Lattner <sabre@nondot.org>
Tue, 29 Oct 2002 16:42:34 +0000 (16:42 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 29 Oct 2002 16:42:34 +0000 (16:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4375 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/InterferenceGraph.h
lib/CodeGen/RegAlloc/InterferenceGraph.cpp
lib/CodeGen/RegAlloc/InterferenceGraph.h
lib/Target/SparcV9/RegAlloc/InterferenceGraph.cpp
lib/Target/SparcV9/RegAlloc/InterferenceGraph.h

index 408bee4558aa02e77c0da2452b502f01253779fa..5af8149a329d94f4ef5da49ae9191773c5357f89 100644 (file)
 typedef std::vector <IGNode *> IGNodeListType;
 
 
-class InterferenceGraph
-{
+class InterferenceGraph {
   char **IG;                            // a poiner to the interference graph
   unsigned int Size;                    // size of a side of the IG
   RegClass *const RegCl;                // RegCl contains this IG
   IGNodeListType IGNodeList;            // a list of all IGNodes in a reg class
                             
-  // for asserting this IG node is infact in the IGNodeList of this class
-  inline void assertIGNode(const IGNode *const Node) const {     
-    assert( IGNodeList[ Node->getIndex() ] == Node );
-  }
-
-
-
  public:
-
   // the matrix is not yet created by the constructor. Call createGraph() 
   // to create it after adding all IGNodes to the IGNodeList
-
-  InterferenceGraph(RegClass *const RC);
+  InterferenceGraph(RegClass *RC);
   ~InterferenceGraph();
 
   void createGraph();
 
-  void addLRToIG(LiveRange *const LR);
+  void addLRToIG(LiveRange *LR);
 
-  void setInterference(const LiveRange *const LR1,
-                             const LiveRange *const LR2 );
+  void setInterference(const LiveRange *LR1,
+                       const LiveRange *LR2);
 
-  unsigned getInterference(const LiveRange *const LR1,
-                                 const LiveRange *const LR2 ) const ;
+  unsigned getInterference(const LiveRange *LR1,
+                           const LiveRange *LR2) const ;
 
-  void mergeIGNodesOfLRs(const LiveRange *const LR1, LiveRange *const LR2);
+  void mergeIGNodesOfLRs(const LiveRange *LR1, LiveRange *LR2);
 
-  inline IGNodeListType &getIGNodeList() { return IGNodeList; } 
+  IGNodeListType &getIGNodeList() { return IGNodeList; } 
+  const IGNodeListType &getIGNodeList() const { return IGNodeList; } 
 
   void setCurDegreeOfIGNodes();
 
index 5f14631b069d594e5cc6361a91d13e87b35624a7..9e7372177b3bdf9daf1dccafd1ec2ae72d93f3ac 100644 (file)
 #include <algorithm>
 using std::cerr;
 
+// for asserting this IG node is infact in the IGNodeList of this class
+inline static void assertIGNode(const InterferenceGraph *IG,
+                                const IGNode *Node) {
+  assert(IG->getIGNodeList()[Node->getIndex()] == Node);
+}
+
 //-----------------------------------------------------------------------------
 // Constructor: Records the RegClass and initalizes IGNodeList.
 // The matrix is NOT yet created by the constructor. Call createGraph() 
@@ -79,14 +85,14 @@ void InterferenceGraph::setInterference(const LiveRange *const LR1,
                                        const LiveRange *const LR2 ) {
   assert(LR1 != LR2);   
 
-  IGNode *const IGNode1 = LR1->getUserIGNode();
-  IGNode *const IGNode2 = LR2->getUserIGNode();
+  IGNode *IGNode1 = LR1->getUserIGNode();
+  IGNode *IGNode2 = LR2->getUserIGNode();
 
-  assertIGNode( IGNode1 );   
-  assertIGNode( IGNode2 );
+  assertIGNode(this, IGNode1);   
+  assertIGNode(this, IGNode2);
   
-  const unsigned int row = IGNode1->getIndex();
-  const unsigned int col = IGNode2->getIndex();
+  unsigned row = IGNode1->getIndex();
+  unsigned col = IGNode2->getIndex();
 
   char *val;
 
@@ -111,8 +117,8 @@ unsigned InterferenceGraph::getInterference(const LiveRange *const LR1,
                                           const LiveRange *const LR2 ) const {
 
   assert(LR1 != LR2);
-  assertIGNode( LR1->getUserIGNode() );  
-  assertIGNode( LR2->getUserIGNode() );
+  assertIGNode(this, LR1->getUserIGNode());  
+  assertIGNode(this, LR2->getUserIGNode());
 
   const unsigned int row = LR1->getUserIGNode()->getIndex();
   const unsigned int col = LR2->getUserIGNode()->getIndex();
@@ -142,8 +148,8 @@ void InterferenceGraph::mergeIGNodesOfLRs(const LiveRange *LR1,
   IGNode *const DestNode = LR1->getUserIGNode();
   IGNode *SrcNode = LR2->getUserIGNode();
 
-  assertIGNode( DestNode );
-  assertIGNode( SrcNode );
+  assertIGNode(this, DestNode);
+  assertIGNode(this, SrcNode);
 
   if( DEBUG_RA >= RA_DEBUG_Interference) {
     cerr << "Merging LRs: \""; printSet(*LR1); 
index 408bee4558aa02e77c0da2452b502f01253779fa..5af8149a329d94f4ef5da49ae9191773c5357f89 100644 (file)
 typedef std::vector <IGNode *> IGNodeListType;
 
 
-class InterferenceGraph
-{
+class InterferenceGraph {
   char **IG;                            // a poiner to the interference graph
   unsigned int Size;                    // size of a side of the IG
   RegClass *const RegCl;                // RegCl contains this IG
   IGNodeListType IGNodeList;            // a list of all IGNodes in a reg class
                             
-  // for asserting this IG node is infact in the IGNodeList of this class
-  inline void assertIGNode(const IGNode *const Node) const {     
-    assert( IGNodeList[ Node->getIndex() ] == Node );
-  }
-
-
-
  public:
-
   // the matrix is not yet created by the constructor. Call createGraph() 
   // to create it after adding all IGNodes to the IGNodeList
-
-  InterferenceGraph(RegClass *const RC);
+  InterferenceGraph(RegClass *RC);
   ~InterferenceGraph();
 
   void createGraph();
 
-  void addLRToIG(LiveRange *const LR);
+  void addLRToIG(LiveRange *LR);
 
-  void setInterference(const LiveRange *const LR1,
-                             const LiveRange *const LR2 );
+  void setInterference(const LiveRange *LR1,
+                       const LiveRange *LR2);
 
-  unsigned getInterference(const LiveRange *const LR1,
-                                 const LiveRange *const LR2 ) const ;
+  unsigned getInterference(const LiveRange *LR1,
+                           const LiveRange *LR2) const ;
 
-  void mergeIGNodesOfLRs(const LiveRange *const LR1, LiveRange *const LR2);
+  void mergeIGNodesOfLRs(const LiveRange *LR1, LiveRange *LR2);
 
-  inline IGNodeListType &getIGNodeList() { return IGNodeList; } 
+  IGNodeListType &getIGNodeList() { return IGNodeList; } 
+  const IGNodeListType &getIGNodeList() const { return IGNodeList; } 
 
   void setCurDegreeOfIGNodes();
 
index 5f14631b069d594e5cc6361a91d13e87b35624a7..9e7372177b3bdf9daf1dccafd1ec2ae72d93f3ac 100644 (file)
 #include <algorithm>
 using std::cerr;
 
+// for asserting this IG node is infact in the IGNodeList of this class
+inline static void assertIGNode(const InterferenceGraph *IG,
+                                const IGNode *Node) {
+  assert(IG->getIGNodeList()[Node->getIndex()] == Node);
+}
+
 //-----------------------------------------------------------------------------
 // Constructor: Records the RegClass and initalizes IGNodeList.
 // The matrix is NOT yet created by the constructor. Call createGraph() 
@@ -79,14 +85,14 @@ void InterferenceGraph::setInterference(const LiveRange *const LR1,
                                        const LiveRange *const LR2 ) {
   assert(LR1 != LR2);   
 
-  IGNode *const IGNode1 = LR1->getUserIGNode();
-  IGNode *const IGNode2 = LR2->getUserIGNode();
+  IGNode *IGNode1 = LR1->getUserIGNode();
+  IGNode *IGNode2 = LR2->getUserIGNode();
 
-  assertIGNode( IGNode1 );   
-  assertIGNode( IGNode2 );
+  assertIGNode(this, IGNode1);   
+  assertIGNode(this, IGNode2);
   
-  const unsigned int row = IGNode1->getIndex();
-  const unsigned int col = IGNode2->getIndex();
+  unsigned row = IGNode1->getIndex();
+  unsigned col = IGNode2->getIndex();
 
   char *val;
 
@@ -111,8 +117,8 @@ unsigned InterferenceGraph::getInterference(const LiveRange *const LR1,
                                           const LiveRange *const LR2 ) const {
 
   assert(LR1 != LR2);
-  assertIGNode( LR1->getUserIGNode() );  
-  assertIGNode( LR2->getUserIGNode() );
+  assertIGNode(this, LR1->getUserIGNode());  
+  assertIGNode(this, LR2->getUserIGNode());
 
   const unsigned int row = LR1->getUserIGNode()->getIndex();
   const unsigned int col = LR2->getUserIGNode()->getIndex();
@@ -142,8 +148,8 @@ void InterferenceGraph::mergeIGNodesOfLRs(const LiveRange *LR1,
   IGNode *const DestNode = LR1->getUserIGNode();
   IGNode *SrcNode = LR2->getUserIGNode();
 
-  assertIGNode( DestNode );
-  assertIGNode( SrcNode );
+  assertIGNode(this, DestNode);
+  assertIGNode(this, SrcNode);
 
   if( DEBUG_RA >= RA_DEBUG_Interference) {
     cerr << "Merging LRs: \""; printSet(*LR1); 
index 408bee4558aa02e77c0da2452b502f01253779fa..5af8149a329d94f4ef5da49ae9191773c5357f89 100644 (file)
 typedef std::vector <IGNode *> IGNodeListType;
 
 
-class InterferenceGraph
-{
+class InterferenceGraph {
   char **IG;                            // a poiner to the interference graph
   unsigned int Size;                    // size of a side of the IG
   RegClass *const RegCl;                // RegCl contains this IG
   IGNodeListType IGNodeList;            // a list of all IGNodes in a reg class
                             
-  // for asserting this IG node is infact in the IGNodeList of this class
-  inline void assertIGNode(const IGNode *const Node) const {     
-    assert( IGNodeList[ Node->getIndex() ] == Node );
-  }
-
-
-
  public:
-
   // the matrix is not yet created by the constructor. Call createGraph() 
   // to create it after adding all IGNodes to the IGNodeList
-
-  InterferenceGraph(RegClass *const RC);
+  InterferenceGraph(RegClass *RC);
   ~InterferenceGraph();
 
   void createGraph();
 
-  void addLRToIG(LiveRange *const LR);
+  void addLRToIG(LiveRange *LR);
 
-  void setInterference(const LiveRange *const LR1,
-                             const LiveRange *const LR2 );
+  void setInterference(const LiveRange *LR1,
+                       const LiveRange *LR2);
 
-  unsigned getInterference(const LiveRange *const LR1,
-                                 const LiveRange *const LR2 ) const ;
+  unsigned getInterference(const LiveRange *LR1,
+                           const LiveRange *LR2) const ;
 
-  void mergeIGNodesOfLRs(const LiveRange *const LR1, LiveRange *const LR2);
+  void mergeIGNodesOfLRs(const LiveRange *LR1, LiveRange *LR2);
 
-  inline IGNodeListType &getIGNodeList() { return IGNodeList; } 
+  IGNodeListType &getIGNodeList() { return IGNodeList; } 
+  const IGNodeListType &getIGNodeList() const { return IGNodeList; } 
 
   void setCurDegreeOfIGNodes();