diff options
author | Ruchira Sasanka <sasanka@students.uiuc.edu> | 2001-10-19 21:42:06 +0000 |
---|---|---|
committer | Ruchira Sasanka <sasanka@students.uiuc.edu> | 2001-10-19 21:42:06 +0000 |
commit | 44d2b947cb05cf8cbb47ad6a3b63da41e24e2581 (patch) | |
tree | 17c810aea362621bf3d1008a59bf2968409f0e6c | |
parent | b49865fa0292ece66e6aab17c67131841f2e8f39 (diff) |
Added code to support unusable Suggested Colors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@922 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/RegAlloc/LiveRange.h | 39 | ||||
-rw-r--r-- | lib/CodeGen/RegAlloc/PhyRegAlloc.h | 2 | ||||
-rw-r--r-- | lib/Target/SparcV9/RegAlloc/LiveRange.h | 39 | ||||
-rw-r--r-- | lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h | 2 |
4 files changed, 52 insertions, 30 deletions
diff --git a/lib/CodeGen/RegAlloc/LiveRange.h b/lib/CodeGen/RegAlloc/LiveRange.h index c0548d7fb9..0d0f8ae1b8 100644 --- a/lib/CodeGen/RegAlloc/LiveRange.h +++ b/lib/CodeGen/RegAlloc/LiveRange.h @@ -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; } }; diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.h b/lib/CodeGen/RegAlloc/PhyRegAlloc.h index bd41c8882c..998fa116c5 100644 --- a/lib/CodeGen/RegAlloc/PhyRegAlloc.h +++ b/lib/CodeGen/RegAlloc/PhyRegAlloc.h @@ -87,6 +87,8 @@ class PhyRegAlloc void setCallInterferences(const MachineInstr *MInst, const LiveVarSet *const LVSetAft ); + void markUnusableSugColors(); + inline void constructLiveRanges() { LRI.constructLiveRanges(); } diff --git a/lib/Target/SparcV9/RegAlloc/LiveRange.h b/lib/Target/SparcV9/RegAlloc/LiveRange.h index c0548d7fb9..0d0f8ae1b8 100644 --- a/lib/Target/SparcV9/RegAlloc/LiveRange.h +++ b/lib/Target/SparcV9/RegAlloc/LiveRange.h @@ -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; } }; diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h index bd41c8882c..998fa116c5 100644 --- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h +++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h @@ -87,6 +87,8 @@ class PhyRegAlloc void setCallInterferences(const MachineInstr *MInst, const LiveVarSet *const LVSetAft ); + void markUnusableSugColors(); + inline void constructLiveRanges() { LRI.constructLiveRanges(); } |