struct LiveInterval {
typedef SmallVector<LiveRange,4> Ranges;
unsigned reg; // the register of this interval
+ unsigned preference; // preferred register to allocate for this interval
float weight; // weight of this interval
MachineInstr* remat; // definition if the definition rematerializable
Ranges ranges; // the ranges in which this register is live
public:
LiveInterval(unsigned Reg, float Weight)
- : reg(Reg), weight(Weight), remat(NULL) {
+ : reg(Reg), preference(0), weight(Weight), remat(NULL) {
}
typedef Ranges::iterator iterator;
removeRange(LR.start, LR.end);
}
+ /// getSize - Returns the sum of sizes of all the LiveRange's.
+ ///
+ unsigned getSize() const;
+
bool operator<(const LiveInterval& other) const {
return beginNumber() < other.beginNumber();
}
ValueNumberInfo.clear();
ValueNumberInfo.append(NewValueNumberInfo.begin(), NewValueNumberInfo.end());
weight += Other.weight;
+ if (Other.preference && !preference)
+ preference = Other.preference;
}
/// MergeRangesInAsValue - Merge all of the intervals in RHS into this live
}
}
+unsigned LiveInterval::getSize() const {
+ unsigned Sum = 0;
+ for (const_iterator I = begin(), E = end(); I != E; ++I)
+ Sum += I->end - I->start;
+ return Sum;
+}
+
std::ostream& llvm::operator<<(std::ostream& os, const LiveRange &LR) {
return os << '[' << LR.start << ',' << LR.end << ':' << LR.ValId << ")";
}