Added code to support unusable Suggested Colors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@922 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ruchira Sasanka 2001-10-19 21:42:06 +00:00
parent b49865fa02
commit 44d2b947cb
4 changed files with 52 additions and 30 deletions

View File

@ -49,6 +49,12 @@ class LiveRange : public ValueSet
int SuggestedColor; // The suggested color for this LR 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: public:
@ -70,22 +76,14 @@ class LiveRange : public ValueSet
{ Color = (int) Col ; } { Color = (int) Col ; }
inline void setCallInterference() inline void setCallInterference() {
{ doesSpanAcrossCalls = 1; doesSpanAcrossCalls = 1;
//CallInterferenceList.push_back( Inst );
}
/*
inline const Instruction *const getCallInterference(const unsigned i) const {
assert( i < CallInterferenceList.size() );
return CallInterferenceList[i];
} }
*/
inline bool isCallInterference() const
{ return (doesSpanAcrossCalls == 1); } inline bool isCallInterference() const {
return (doesSpanAcrossCalls == 1);
}
inline void markForSpill() { mustSpill = true; } inline void markForSpill() { mustSpill = true; }
@ -126,6 +124,17 @@ class LiveRange : public ValueSet
return ( SuggestedColor > -1); 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() */ inline LiveRange() : ValueSet() /* , CallInterferenceList() */
{ {
Color = SuggestedColor = -1; // not yet colored Color = SuggestedColor = -1; // not yet colored
@ -133,7 +142,7 @@ class LiveRange : public ValueSet
MyRegClass = NULL; MyRegClass = NULL;
UserIGNode = NULL; UserIGNode = NULL;
doesSpanAcrossCalls = false; doesSpanAcrossCalls = false;
CanUseSuggestedCol = true;
} }
}; };

View File

@ -87,6 +87,8 @@ class PhyRegAlloc
void setCallInterferences(const MachineInstr *MInst, void setCallInterferences(const MachineInstr *MInst,
const LiveVarSet *const LVSetAft ); const LiveVarSet *const LVSetAft );
void markUnusableSugColors();
inline void constructLiveRanges() inline void constructLiveRanges()
{ LRI.constructLiveRanges(); } { LRI.constructLiveRanges(); }

View File

@ -49,6 +49,12 @@ class LiveRange : public ValueSet
int SuggestedColor; // The suggested color for this LR 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: public:
@ -70,22 +76,14 @@ class LiveRange : public ValueSet
{ Color = (int) Col ; } { Color = (int) Col ; }
inline void setCallInterference() inline void setCallInterference() {
{ doesSpanAcrossCalls = 1; doesSpanAcrossCalls = 1;
//CallInterferenceList.push_back( Inst );
}
/*
inline const Instruction *const getCallInterference(const unsigned i) const {
assert( i < CallInterferenceList.size() );
return CallInterferenceList[i];
} }
*/
inline bool isCallInterference() const
{ return (doesSpanAcrossCalls == 1); } inline bool isCallInterference() const {
return (doesSpanAcrossCalls == 1);
}
inline void markForSpill() { mustSpill = true; } inline void markForSpill() { mustSpill = true; }
@ -126,6 +124,17 @@ class LiveRange : public ValueSet
return ( SuggestedColor > -1); 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() */ inline LiveRange() : ValueSet() /* , CallInterferenceList() */
{ {
Color = SuggestedColor = -1; // not yet colored Color = SuggestedColor = -1; // not yet colored
@ -133,7 +142,7 @@ class LiveRange : public ValueSet
MyRegClass = NULL; MyRegClass = NULL;
UserIGNode = NULL; UserIGNode = NULL;
doesSpanAcrossCalls = false; doesSpanAcrossCalls = false;
CanUseSuggestedCol = true;
} }
}; };

View File

@ -87,6 +87,8 @@ class PhyRegAlloc
void setCallInterferences(const MachineInstr *MInst, void setCallInterferences(const MachineInstr *MInst,
const LiveVarSet *const LVSetAft ); const LiveVarSet *const LVSetAft );
void markUnusableSugColors();
inline void constructLiveRanges() inline void constructLiveRanges()
{ LRI.constructLiveRanges(); } { LRI.constructLiveRanges(); }