Add a utility function to SDOperand for testing if a value is unused.
[oota-llvm.git] / include / llvm / CodeGen / LiveIntervalAnalysis.h
index 59d482e955e741136f9675df76bf481a4e5bd25d..671de02eeeb6b1001ec61453063bbea8c8342d76 100644 (file)
@@ -27,6 +27,7 @@
 #include "llvm/ADT/IndexedMap.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Allocator.h"
 
 namespace llvm {
 
@@ -43,6 +44,10 @@ namespace llvm {
     const TargetInstrInfo* tii_;
     LiveVariables* lv_;
 
+    /// Special pool allocator for VNInfo's (LiveInterval val#).
+    ///
+    BumpPtrAllocator VNInfoAllocator;
+
     /// MBB2IdxMap - The indexes of the first and last instructions in the
     /// specified basic block.
     std::vector<std::pair<unsigned, unsigned> > MBB2IdxMap;
@@ -194,6 +199,8 @@ namespace llvm {
       }
     }
 
+    BumpPtrAllocator& getVNInfoAllocator() { return VNInfoAllocator; }
+
     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
     virtual void releaseMemory();
 
@@ -242,11 +249,13 @@ namespace llvm {
     bool isReMaterializable(const LiveInterval &li, const VNInfo *ValNo,
                             MachineInstr *MI);
 
-    /// tryFoldMemoryOperand - Attempts to fold a spill / restore from slot
-    /// to reg into ith operand of specified MI. If it is successul, MI is
-    /// updated with the newly created MI and returns true.
-    bool tryFoldMemoryOperand(MachineInstr* &MI, VirtRegMap &vrm, unsigned index,
-                              unsigned i, int slot, unsigned reg);
+    /// tryFoldMemoryOperand - Attempts to fold either a spill / restore from
+    /// slot / to reg or any rematerialized load into ith operand of specified
+    /// MI. If it is successul, MI is updated with the newly created MI and
+    /// returns true.
+    bool tryFoldMemoryOperand(MachineInstr* &MI, VirtRegMap &vrm,
+                              unsigned index, unsigned i, bool isSS,
+                              MachineInstr *DefMI, int slot, unsigned reg);
 
     static LiveInterval createInterval(unsigned Reg);