diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2003-10-30 21:21:22 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2003-10-30 21:21:22 +0000 |
commit | 82c5eb7bc8f0cfe77938bbe107cf926680fc8c4d (patch) | |
tree | dd3e056181748060044e56d9c004671d45b116e7 /lib/Target/SparcV9/RegAlloc | |
parent | 74fa84fcef773ae9f830f7ade304f820685e8cf2 (diff) | |
download | external_llvm-82c5eb7bc8f0cfe77938bbe107cf926680fc8c4d.zip external_llvm-82c5eb7bc8f0cfe77938bbe107cf926680fc8c4d.tar.gz external_llvm-82c5eb7bc8f0cfe77938bbe107cf926680fc8c4d.tar.bz2 |
Make AllocState an enum.
Move the stringifying method for that enum into class AllocInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9616 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SparcV9/RegAlloc')
-rw-r--r-- | lib/Target/SparcV9/RegAlloc/AllocInfo.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Target/SparcV9/RegAlloc/AllocInfo.h b/lib/Target/SparcV9/RegAlloc/AllocInfo.h index d982afc..1f5357a 100644 --- a/lib/Target/SparcV9/RegAlloc/AllocInfo.h +++ b/lib/Target/SparcV9/RegAlloc/AllocInfo.h @@ -26,10 +26,12 @@ struct AllocInfo { unsigned Instruction; unsigned Operand; - unsigned AllocState; + enum AllocStateTy { NotAllocated = 0, Allocated, Spilled }; + AllocStateTy AllocState; int Placement; + AllocInfo (unsigned Instruction_, unsigned Operand_, - unsigned AllocState_, int Placement_) : + AllocStateTy AllocState_, int Placement_) : Instruction (Instruction_), Operand (Operand_), AllocState (AllocState_), Placement (Placement_) { } @@ -65,6 +67,14 @@ struct AllocInfo { return (X.AllocState == AllocState) && (X.Placement == Placement); } bool operator!= (const AllocInfo &X) const { return !(*this == X); } + + /// Returns a human-readable string representation of the AllocState member. + /// + const std::string allocStateToString () const { + static const char *AllocStateNames[] = + { "NotAllocated", "Allocated", "Spilled" }; + return std::string (AllocStateNames[AllocState]); + } }; #endif // ALLOCINFO_H |