Changed Call interference info
authorRuchira Sasanka <sasanka@students.uiuc.edu>
Fri, 19 Oct 2001 17:21:59 +0000 (17:21 +0000)
committerRuchira Sasanka <sasanka@students.uiuc.edu>
Fri, 19 Oct 2001 17:21:59 +0000 (17:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@917 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/RegAlloc/IGNode.h
lib/CodeGen/RegAlloc/LiveRange.h
lib/CodeGen/RegAlloc/PhyRegAlloc.h
lib/Target/SparcV9/RegAlloc/IGNode.h
lib/Target/SparcV9/RegAlloc/LiveRange.h
lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h

index 2f437f9a574de2e60f8594f649bb9d6731bbc1c4..bcaf439b7f53ae74a1d74ba84af4bcaf13afaafd 100644 (file)
@@ -122,8 +122,8 @@ class IGNode
   //  { ParentLR->markForLoadFromStack();  }
 
 
-  inline unsigned int getNumOfCallInterferences() const 
-    { return ParentLR->getNumOfCallInterferences(); } 
+  inline unsigned int isCallInterference() const 
+  { return ParentLR->isCallInterference(); } 
 
   inline LiveRange *getParentLR() const 
     { return ParentLR; }
index 28e0712283917592977a7d6df90d1856ab93f1cc..c0548d7fb9dc2206036486a44b85000be1dba242 100644 (file)
@@ -28,13 +28,20 @@ class LiveRange : public ValueSet
   RegClass *MyRegClass;       // register classs (e.g., int, FP) for this LR
 
   // a list of call instructions that interferes with this live range
-  vector<const Instruction *> CallInterferenceList;  
+  //vector<const Instruction *> CallInterferenceList;  
+
+  // does this live range span across calls? 
+  // This information is used by graph
+  // coloring algo to avoid allocating volatile colors to live ranges
+  // that span across calls (since they have to be saved/restored)
+
+  bool doesSpanAcrossCalls;
 
   IGNode *UserIGNode;         // IGNode which uses this LR
   int Color;                  // color assigned to this live range
   bool mustSpill;             // whether this LR must be spilt
 
-  // whether this LR must be saved accross calls
+  // whether this LR must be saved accross calls ***TODO REMOVE this
   bool mustSaveAcrossCalls;        
 
   // bool mustLoadFromStack;     // must load from stack at start of method
@@ -55,7 +62,7 @@ class LiveRange : public ValueSet
 
   inline bool hasColor() const 
     { return Color != -1; }
-
+  
   inline unsigned int getColor() const 
     { assert( Color != -1); return (unsigned) Color ; }
 
@@ -63,16 +70,22 @@ class LiveRange : public ValueSet
     { Color = (int) Col ; }
 
   
-  inline void addCallInterference(const Instruction *const  Inst) 
-    { CallInterferenceList.push_back( Inst ); }
+  inline void setCallInterference() 
+    { doesSpanAcrossCalls = 1;
+      //CallInterferenceList.push_back( Inst ); 
+    }
+
 
+
+  /*
   inline const Instruction *const getCallInterference(const unsigned i) const {
     assert( i < CallInterferenceList.size() ); 
     return CallInterferenceList[i];  
   }
+  */
 
-  inline unsigned int getNumOfCallInterferences() const 
-    { return CallInterferenceList.size(); } 
+  inline bool isCallInterference() const 
+    { return (doesSpanAcrossCalls == 1); } 
 
   
   inline void markForSpill() { mustSpill = true; }
@@ -113,12 +126,14 @@ class LiveRange : public ValueSet
     return ( SuggestedColor > -1);
   }
 
-  inline LiveRange() : ValueSet() , CallInterferenceList() 
+  inline LiveRange() : ValueSet() /* , CallInterferenceList() */
     {
       Color = SuggestedColor = -1;      // not yet colored 
       mustSpill = mustSaveAcrossCalls = false;
       MyRegClass = NULL;
       UserIGNode = NULL;
+      doesSpanAcrossCalls = false;
+
     }
 
 };
index 243b3fa3c2ffb2f3713a86608f4e25821d228cd1..bd41c8882c3d7dd83a8644eb2dc0ff201f22e5f4 100644 (file)
@@ -84,6 +84,8 @@ class PhyRegAlloc
   void insertCallerSavingCode(const MachineInstr *MInst, 
                              const BasicBlock *BB );
 
+  void setCallInterferences(const MachineInstr *MInst, 
+                           const LiveVarSet *const LVSetAft );
 
   inline void constructLiveRanges() 
     { LRI.constructLiveRanges(); }      
index 2f437f9a574de2e60f8594f649bb9d6731bbc1c4..bcaf439b7f53ae74a1d74ba84af4bcaf13afaafd 100644 (file)
@@ -122,8 +122,8 @@ class IGNode
   //  { ParentLR->markForLoadFromStack();  }
 
 
-  inline unsigned int getNumOfCallInterferences() const 
-    { return ParentLR->getNumOfCallInterferences(); } 
+  inline unsigned int isCallInterference() const 
+  { return ParentLR->isCallInterference(); } 
 
   inline LiveRange *getParentLR() const 
     { return ParentLR; }
index 28e0712283917592977a7d6df90d1856ab93f1cc..c0548d7fb9dc2206036486a44b85000be1dba242 100644 (file)
@@ -28,13 +28,20 @@ class LiveRange : public ValueSet
   RegClass *MyRegClass;       // register classs (e.g., int, FP) for this LR
 
   // a list of call instructions that interferes with this live range
-  vector<const Instruction *> CallInterferenceList;  
+  //vector<const Instruction *> CallInterferenceList;  
+
+  // does this live range span across calls? 
+  // This information is used by graph
+  // coloring algo to avoid allocating volatile colors to live ranges
+  // that span across calls (since they have to be saved/restored)
+
+  bool doesSpanAcrossCalls;
 
   IGNode *UserIGNode;         // IGNode which uses this LR
   int Color;                  // color assigned to this live range
   bool mustSpill;             // whether this LR must be spilt
 
-  // whether this LR must be saved accross calls
+  // whether this LR must be saved accross calls ***TODO REMOVE this
   bool mustSaveAcrossCalls;        
 
   // bool mustLoadFromStack;     // must load from stack at start of method
@@ -55,7 +62,7 @@ class LiveRange : public ValueSet
 
   inline bool hasColor() const 
     { return Color != -1; }
-
+  
   inline unsigned int getColor() const 
     { assert( Color != -1); return (unsigned) Color ; }
 
@@ -63,16 +70,22 @@ class LiveRange : public ValueSet
     { Color = (int) Col ; }
 
   
-  inline void addCallInterference(const Instruction *const  Inst) 
-    { CallInterferenceList.push_back( Inst ); }
+  inline void setCallInterference() 
+    { doesSpanAcrossCalls = 1;
+      //CallInterferenceList.push_back( Inst ); 
+    }
+
 
+
+  /*
   inline const Instruction *const getCallInterference(const unsigned i) const {
     assert( i < CallInterferenceList.size() ); 
     return CallInterferenceList[i];  
   }
+  */
 
-  inline unsigned int getNumOfCallInterferences() const 
-    { return CallInterferenceList.size(); } 
+  inline bool isCallInterference() const 
+    { return (doesSpanAcrossCalls == 1); } 
 
   
   inline void markForSpill() { mustSpill = true; }
@@ -113,12 +126,14 @@ class LiveRange : public ValueSet
     return ( SuggestedColor > -1);
   }
 
-  inline LiveRange() : ValueSet() , CallInterferenceList() 
+  inline LiveRange() : ValueSet() /* , CallInterferenceList() */
     {
       Color = SuggestedColor = -1;      // not yet colored 
       mustSpill = mustSaveAcrossCalls = false;
       MyRegClass = NULL;
       UserIGNode = NULL;
+      doesSpanAcrossCalls = false;
+
     }
 
 };
index 243b3fa3c2ffb2f3713a86608f4e25821d228cd1..bd41c8882c3d7dd83a8644eb2dc0ff201f22e5f4 100644 (file)
@@ -84,6 +84,8 @@ class PhyRegAlloc
   void insertCallerSavingCode(const MachineInstr *MInst, 
                              const BasicBlock *BB );
 
+  void setCallInterferences(const MachineInstr *MInst, 
+                           const LiveVarSet *const LVSetAft );
 
   inline void constructLiveRanges() 
     { LRI.constructLiveRanges(); }