Added code to support unusable Suggested Colors.
authorRuchira Sasanka <sasanka@students.uiuc.edu>
Fri, 19 Oct 2001 21:42:06 +0000 (21:42 +0000)
committerRuchira Sasanka <sasanka@students.uiuc.edu>
Fri, 19 Oct 2001 21:42:06 +0000 (21:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@922 91177308-0d34-0410-b5e6-96231b3b80d8

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

index c0548d7fb9dc2206036486a44b85000be1dba242..0d0f8ae1b84172bc7c1297909296c5de4791ae07 100644 (file)
@@ -49,6 +49,12 @@ class LiveRange : public ValueSet
 
   int SuggestedColor;        // The suggested color for this LR
 
+  // if this LR has a suggested color, can it be really alloated?
+  // A suggested color cannot be allocated when the suggested color is
+  // volatile and when there are call interferences.
+
+  bool CanUseSuggestedCol;
+
  public:
 
 
@@ -70,22 +76,14 @@ class LiveRange : public ValueSet
     { Color = (int) Col ; }
 
   
-  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 void setCallInterference() { 
+    doesSpanAcrossCalls = 1;
   }
-  */
 
-  inline bool isCallInterference() const 
-    { return (doesSpanAcrossCalls == 1); } 
+
+  inline bool isCallInterference() const { 
+    return (doesSpanAcrossCalls == 1); 
+  } 
 
   
   inline void markForSpill() { mustSpill = true; }
@@ -126,6 +124,17 @@ class LiveRange : public ValueSet
     return ( SuggestedColor > -1);
   }
 
+  inline bool isSuggestedColorUsable() const {
+    assert( hasSuggestedColor() && "No suggested color");
+    return CanUseSuggestedCol;
+  }
+
+  inline void setSuggestedColorUsable(const bool val) {
+    assert( hasSuggestedColor() && "No suggested color");
+    CanUseSuggestedCol = val;
+  }
+
+
   inline LiveRange() : ValueSet() /* , CallInterferenceList() */
     {
       Color = SuggestedColor = -1;      // not yet colored 
@@ -133,7 +142,7 @@ class LiveRange : public ValueSet
       MyRegClass = NULL;
       UserIGNode = NULL;
       doesSpanAcrossCalls = false;
-
+      CanUseSuggestedCol = true;
     }
 
 };
index bd41c8882c3d7dd83a8644eb2dc0ff201f22e5f4..998fa116c59d3db8d17e95a4bee7ff4235e31ea9 100644 (file)
@@ -87,6 +87,8 @@ class PhyRegAlloc
   void setCallInterferences(const MachineInstr *MInst, 
                            const LiveVarSet *const LVSetAft );
 
+  void markUnusableSugColors();
+
   inline void constructLiveRanges() 
     { LRI.constructLiveRanges(); }      
 
index c0548d7fb9dc2206036486a44b85000be1dba242..0d0f8ae1b84172bc7c1297909296c5de4791ae07 100644 (file)
@@ -49,6 +49,12 @@ class LiveRange : public ValueSet
 
   int SuggestedColor;        // The suggested color for this LR
 
+  // if this LR has a suggested color, can it be really alloated?
+  // A suggested color cannot be allocated when the suggested color is
+  // volatile and when there are call interferences.
+
+  bool CanUseSuggestedCol;
+
  public:
 
 
@@ -70,22 +76,14 @@ class LiveRange : public ValueSet
     { Color = (int) Col ; }
 
   
-  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 void setCallInterference() { 
+    doesSpanAcrossCalls = 1;
   }
-  */
 
-  inline bool isCallInterference() const 
-    { return (doesSpanAcrossCalls == 1); } 
+
+  inline bool isCallInterference() const { 
+    return (doesSpanAcrossCalls == 1); 
+  } 
 
   
   inline void markForSpill() { mustSpill = true; }
@@ -126,6 +124,17 @@ class LiveRange : public ValueSet
     return ( SuggestedColor > -1);
   }
 
+  inline bool isSuggestedColorUsable() const {
+    assert( hasSuggestedColor() && "No suggested color");
+    return CanUseSuggestedCol;
+  }
+
+  inline void setSuggestedColorUsable(const bool val) {
+    assert( hasSuggestedColor() && "No suggested color");
+    CanUseSuggestedCol = val;
+  }
+
+
   inline LiveRange() : ValueSet() /* , CallInterferenceList() */
     {
       Color = SuggestedColor = -1;      // not yet colored 
@@ -133,7 +142,7 @@ class LiveRange : public ValueSet
       MyRegClass = NULL;
       UserIGNode = NULL;
       doesSpanAcrossCalls = false;
-
+      CanUseSuggestedCol = true;
     }
 
 };
index bd41c8882c3d7dd83a8644eb2dc0ff201f22e5f4..998fa116c59d3db8d17e95a4bee7ff4235e31ea9 100644 (file)
@@ -87,6 +87,8 @@ class PhyRegAlloc
   void setCallInterferences(const MachineInstr *MInst, 
                            const LiveVarSet *const LVSetAft );
 
+  void markUnusableSugColors();
+
   inline void constructLiveRanges() 
     { LRI.constructLiveRanges(); }