Revert Christopher Lamb's load/store alignment changes.
[oota-llvm.git] / include / llvm / CodeGen / LiveInterval.h
index 86b1873d5ab65d4100e7c2a1fb6fd9147ccf02ed..1912d6429600a6df1955f596bba32e254be904e0 100644 (file)
 #define LLVM_CODEGEN_LIVEINTERVAL_H
 
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Streams.h"
 #include <iosfwd>
 #include <vector>
 #include <cassert>
 
 namespace llvm {
+  class MachineInstr;
   class MRegisterInfo;
 
   /// LiveRange structure - This represents a simple register range in the
@@ -55,12 +57,16 @@ namespace llvm {
     }
 
     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 bool operator<(unsigned V, const LiveRange &LR) {
     return V < LR.start;
   }
@@ -75,7 +81,9 @@ namespace llvm {
   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
@@ -87,7 +95,7 @@ namespace llvm {
   public:
 
     LiveInterval(unsigned Reg, float Weight)
-      : reg(Reg), weight(Weight) {
+      : reg(Reg), preference(0), weight(Weight), remat(NULL) {
     }
 
     typedef Ranges::iterator iterator;
@@ -114,6 +122,7 @@ namespace llvm {
     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);
     }
@@ -244,11 +253,22 @@ namespace llvm {
     /// the range must already be in this interval in its entirety.
     void removeRange(unsigned Start, unsigned End);
 
+    void removeRange(LiveRange LR) {
+      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(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;
 
   private: