diff options
author | Ruchira Sasanka <sasanka@students.uiuc.edu> | 2001-09-30 23:19:57 +0000 |
---|---|---|
committer | Ruchira Sasanka <sasanka@students.uiuc.edu> | 2001-09-30 23:19:57 +0000 |
commit | ab304c42c2d7c3ab1109c423774bddb85867715f (patch) | |
tree | b06c187568404dcc3ba8e04e3ceb8017be40dba8 /lib/CodeGen | |
parent | 06faeee041dc2f24f2fd657ecc1bb5647d64fd40 (diff) |
added suggesting color support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@673 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/RegAlloc/LiveRange.h | 23 | ||||
-rw-r--r-- | lib/CodeGen/RegAlloc/LiveRangeInfo.h | 14 | ||||
-rw-r--r-- | lib/CodeGen/RegAlloc/PhyRegAlloc.h | 10 |
3 files changed, 41 insertions, 6 deletions
diff --git a/lib/CodeGen/RegAlloc/LiveRange.h b/lib/CodeGen/RegAlloc/LiveRange.h index d8e130a329..9c4d450880 100644 --- a/lib/CodeGen/RegAlloc/LiveRange.h +++ b/lib/CodeGen/RegAlloc/LiveRange.h @@ -39,6 +39,9 @@ class LiveRange : public ValueSet // bool mustLoadFromStack; // must load from stack at start of method + + int SuggestedColor; // The suggested color for this LR + public: @@ -92,9 +95,27 @@ class LiveRange : public ValueSet } + inline void setSuggestedColor(int Col) { + //assert( (SuggestedColor == -1) && "Changing an already suggested color"); + + if(SuggestedColor == -1 ) + SuggestedColor = Col; + else if (DEBUG_RA) + cout << "Already has a suggested color " << Col << endl; + } + + inline unsigned getSuggestedColor() const { + assert( SuggestedColor != -1); // only a valid color is obtained + return (unsigned) SuggestedColor; + } + + inline bool hasSuggestedColor() const { + return ( SuggestedColor > -1); + } + inline LiveRange() : ValueSet() , CallInterferenceList() { - Color = -1; // not yet colored + Color = SuggestedColor = -1; // not yet colored mustSpill = mustSaveAcrossCalls = false; MyRegClass = NULL; UserIGNode = NULL; diff --git a/lib/CodeGen/RegAlloc/LiveRangeInfo.h b/lib/CodeGen/RegAlloc/LiveRangeInfo.h index da5601790a..2a8eb2ffb6 100644 --- a/lib/CodeGen/RegAlloc/LiveRangeInfo.h +++ b/lib/CodeGen/RegAlloc/LiveRangeInfo.h @@ -42,7 +42,7 @@ typedef hash_map <const Value *, LiveRange *, hashFuncValue> LiveRangeMapType; - +typedef vector <const Instruction *> CallRetInstrListType; class LiveRangeInfo { @@ -56,7 +56,9 @@ private: const TargetMachine& TM; // target machine description vector<RegClass *> & RegClassList;// a vector containing register classess + const MachineRegInfo& MRI; // machine reg info + CallRetInstrListType CallRetInstrList; // a list of all call/ret instrs void unionAndUpdateLRs(LiveRange *L1, LiveRange *L2); @@ -72,12 +74,22 @@ public: void constructLiveRanges(); + inline void addLRToMap(const Value *Val, LiveRange *LR) { + assert( Val && LR && "Val/LR is NULL!\n"); + assert( (! LiveRangeMap[ Val ]) && "LR already set in map"); + LiveRangeMap[ Val ] = LR; + } + + inline const LiveRangeMapType *const getLiveRangeMap() const { return &LiveRangeMap; } inline LiveRange *getLiveRangeForValue( const Value *const Val) { return LiveRangeMap[ Val ]; } + inline CallRetInstrListType &getCallRetInstrList() { + return CallRetInstrList; + } diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.h b/lib/CodeGen/RegAlloc/PhyRegAlloc.h index fcf28320cc..f96f27bdfb 100644 --- a/lib/CodeGen/RegAlloc/PhyRegAlloc.h +++ b/lib/CodeGen/RegAlloc/PhyRegAlloc.h @@ -43,8 +43,8 @@ class AddedInstrns { public: - vector<const MachineInstr *> InstrnsBefore; - vector<const MachineInstr *> InstrnsAfter; + vector<MachineInstr *> InstrnsBefore; + vector<MachineInstr *> InstrnsAfter; AddedInstrns() : InstrnsBefore(), InstrnsAfter() { } }; @@ -65,8 +65,8 @@ class PhyRegAlloc const MachineRegInfo &MRI; // Machine Register information const unsigned NumOfRegClasses; // recorded here for efficiency - vector<const Instruction *> CallInstrList; // a list of all call instrs - vector<const Instruction *> RetInstrList; // a list of all return instrs + //vector<const Instruction *> CallInstrList; // a list of all call instrs + //vector<const Instruction *> RetInstrList; // a list of all return instrs AddedInstrMapType AddedInstrMap; // to store instrns added in this phase @@ -85,7 +85,9 @@ class PhyRegAlloc { LRI.constructLiveRanges(); } void colorIncomingArgs(); + void colorCallRetArgs(); void updateMachineCode(); + void printLabel(const Value *const Val); void printMachineCode(); |