#include <cassert>
namespace llvm {
+ class MachineInstr;
class MRegisterInfo;
/// LiveRange structure - This represents a simple register range in the
}
void dump() const;
+ void print(std::ostream &os) const;
+ void print(std::ostream *os) const { if (os) print(*os); }
private:
LiveRange(); // DO NOT IMPLEMENT
};
std::ostream& operator<<(std::ostream& os, const LiveRange &LR);
- inline llvm_ostream& operator<<(llvm_ostream& os, const LiveRange &LR) {
- if (os.stream()) *os.stream() << LR;
- return os;
- }
+
inline bool operator<(unsigned V, const LiveRange &LR) {
return V < LR.start;
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
private:
/// ValueNumberInfo - If this value number is not defined by a copy, this
public:
LiveInterval(unsigned Reg, float Weight)
- : reg(Reg), weight(Weight) {
+ : reg(Reg), preference(0), weight(Weight), remat(NULL) {
}
typedef Ranges::iterator iterator;
void swap(LiveInterval& other) {
std::swap(reg, other.reg);
std::swap(weight, other.weight);
+ std::swap(remat, other.remat);
std::swap(ranges, other.ranges);
std::swap(ValueNumberInfo, other.ValueNumberInfo);
}
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();
}
- void print(llvm_ostream OS, const MRegisterInfo *MRI = 0) const;
- void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const {
- print(llvm_ostream(OS), MRI);
+ void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const;
+ void print(std::ostream *OS, const MRegisterInfo *MRI = 0) const {
+ if (OS) print(*OS, MRI);
}
void dump() const;
LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT
};
- inline llvm_ostream &operator<<(llvm_ostream &OS, const LiveInterval &LI) {
- LI.print(OS);
- return OS;
- }
-
inline std::ostream &operator<<(std::ostream &OS, const LiveInterval &LI) {
LI.print(OS);
return OS;