diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2004-07-29 06:43:06 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2004-07-29 06:43:06 +0000 |
commit | fb8f856f149002237d11d91997be2ef34b9c18e0 (patch) | |
tree | 86115682bcbf838b51022adda5d2d2dac3c570b4 | |
parent | 988f5b530af452ded50eed9ff36becb397d5f444 (diff) |
Don't derive from ValueSet to implement class LiveRange; instead, use a
SetVector<Value *> data member.
Add << operator for LiveRanges (a dumb one, for now.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15320 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/SparcV9/RegAlloc/LiveRange.h | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/lib/Target/SparcV9/RegAlloc/LiveRange.h b/lib/Target/SparcV9/RegAlloc/LiveRange.h index 3d19bbd1fc..7a37596af0 100644 --- a/lib/Target/SparcV9/RegAlloc/LiveRange.h +++ b/lib/Target/SparcV9/RegAlloc/LiveRange.h @@ -7,11 +7,8 @@ // //===----------------------------------------------------------------------===// // -// Implements a live range using a ValueSet. A LiveRange is a simple set -// of Values. -// -// Since the Value pointed by a use is the same as of its def, it is sufficient -// to keep only defs in a LiveRange. +// Implements a live range using a SetVector of Value *s. We keep only +// defs in a LiveRange. // //===----------------------------------------------------------------------===// @@ -19,15 +16,23 @@ #define LIVERANGE_H #include "llvm/Value.h" -#include "llvm/CodeGen/ValueSet.h" +#include "Support/SetVector.h" +#include <iostream> namespace llvm { class RegClass; class IGNode; -class LiveRange : public ValueSet { - RegClass *MyRegClass; // register class (e.g., int, FP) for this LR +class LiveRange { +public: + typedef SetVector<const Value *> ValueContainerType; + typedef ValueContainerType::iterator iterator; + typedef ValueContainerType::const_iterator const_iterator; + +private: + ValueContainerType MyValues; // Values in this LiveRange + RegClass *MyRegClass; // register class (e.g., int, FP) for this LR /// doesSpanAcrossCalls - Does this live range span across calls? /// This information is used by graph coloring algo to avoid allocating @@ -70,6 +75,13 @@ class LiveRange : public ValueSet { unsigned SpillCost; public: + iterator begin() { return MyValues.begin(); } + const_iterator begin() const { return MyValues.begin(); } + iterator end() { return MyValues.end(); } + const_iterator end() const { return MyValues.end(); } + bool insert(const Value *&X) { return MyValues.insert (X); } + void insert(iterator b, iterator e) { MyValues.insert (b, e); } + LiveRange() { Color = SuggestedColor = -1; // not yet colored mustSpill = false; @@ -172,6 +184,11 @@ public: } }; +static inline std::ostream &operator << (std::ostream &os, const LiveRange &lr) { + os << "LiveRange@" << (void *)(&lr); + return os; +}; + } // End llvm namespace #endif |