summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveIntervals.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervals.h')
-rw-r--r--llvm/lib/CodeGen/LiveIntervals.h90
1 files changed, 40 insertions, 50 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervals.h b/llvm/lib/CodeGen/LiveIntervals.h
index dda1637984c..3e3c817acdf 100644
--- a/llvm/lib/CodeGen/LiveIntervals.h
+++ b/llvm/lib/CodeGen/LiveIntervals.h
@@ -30,62 +30,60 @@ namespace llvm {
class MRegisterInfo;
class VirtRegMap;
- class LiveIntervals : public MachineFunctionPass
- {
- public:
- struct Interval {
- typedef std::pair<unsigned, unsigned> Range;
- typedef std::vector<Range> Ranges;
- unsigned reg; // the register of this interval
- float weight; // weight of this interval (number of uses
- // * 10^loopDepth)
- Ranges ranges; // the ranges in which this register is live
- Interval(unsigned r);
+ struct Interval {
+ typedef std::pair<unsigned, unsigned> Range;
+ typedef std::vector<Range> Ranges;
+ unsigned reg; // the register of this interval
+ float weight; // weight of this interval:
+ // (number of uses *10^loopDepth)
+ Ranges ranges; // the ranges in which this register is live
- bool empty() const { return ranges.empty(); }
+ explicit Interval(unsigned r);
- bool spilled() const;
+ bool empty() const { return ranges.empty(); }
- unsigned start() const {
- assert(!empty() && "empty interval for register");
- return ranges.front().first;
- }
+ bool spilled() const;
- unsigned end() const {
- assert(!empty() && "empty interval for register");
- return ranges.back().second;
- }
+ unsigned start() const {
+ assert(!empty() && "empty interval for register");
+ return ranges.front().first;
+ }
- bool expiredAt(unsigned index) const {
- return end() <= (index + 1);
- }
+ unsigned end() const {
+ assert(!empty() && "empty interval for register");
+ return ranges.back().second;
+ }
- bool liveAt(unsigned index) const;
+ bool expiredAt(unsigned index) const {
+ return end() <= (index + 1);
+ }
- bool overlaps(const Interval& other) const;
+ bool liveAt(unsigned index) const;
- void addRange(unsigned start, unsigned end);
+ bool overlaps(const Interval& other) const;
- void join(const Interval& other);
+ void addRange(unsigned start, unsigned end);
- private:
- Ranges::iterator mergeRangesForward(Ranges::iterator it);
+ void join(const Interval& other);
- Ranges::iterator mergeRangesBackward(Ranges::iterator it);
- };
+ bool operator<(const Interval& other) const {
+ return start() < other.start();
+ }
- struct StartPointComp {
- bool operator()(const Interval& lhs, const Interval& rhs) {
- return lhs.ranges.front().first < rhs.ranges.front().first;
- }
- };
+ bool operator==(const Interval& other) const {
+ return reg == other.reg;
+ }
- struct StartPointPtrComp {
- bool operator()(const Interval* lhs, const Interval* rhs) {
- return lhs->ranges.front().first < rhs->ranges.front().first;
- }
- };
+ private:
+ Ranges::iterator mergeRangesForward(Ranges::iterator it);
+ Ranges::iterator mergeRangesBackward(Ranges::iterator it);
+ };
+ std::ostream& operator<<(std::ostream& os, const Interval& li);
+
+ class LiveIntervals : public MachineFunctionPass
+ {
+ public:
typedef std::list<Interval> Intervals;
private:
@@ -205,14 +203,6 @@ namespace llvm {
void printRegName(unsigned reg) const;
};
- inline bool operator==(const LiveIntervals::Interval& lhs,
- const LiveIntervals::Interval& rhs) {
- return lhs.reg == rhs.reg;
- }
-
- std::ostream& operator<<(std::ostream& os,
- const LiveIntervals::Interval& li);
-
} // End llvm namespace
#endif
OpenPOWER on IntegriCloud