From 44d2b947cb05cf8cbb47ad6a3b63da41e24e2581 Mon Sep 17 00:00:00 2001 From: Ruchira Sasanka Date: Fri, 19 Oct 2001 21:42:06 +0000 Subject: [PATCH] Added code to support unusable Suggested Colors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@922 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegAlloc/LiveRange.h | 39 ++++++++++++++--------- lib/CodeGen/RegAlloc/PhyRegAlloc.h | 2 ++ lib/Target/SparcV9/RegAlloc/LiveRange.h | 39 ++++++++++++++--------- 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 c0548d7fb9d..0d0f8ae1b84 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 bd41c8882c3..998fa116c59 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 c0548d7fb9d..0d0f8ae1b84 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 bd41c8882c3..998fa116c59 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(); }