Use instruction itinerary to determine what instructions are 'cheap'.
[oota-llvm.git] / include / llvm / Analysis / SparsePropagation.h
index cc655aa85fdf8d9ef18ab3129ee87e9baa16b239..c3c2f4b0668c5761d495ac8123dc13f2716aa9fd 100644 (file)
@@ -30,7 +30,6 @@ namespace llvm {
   class BasicBlock;
   class Function;
   class SparseSolver;
-  class LLVMContext;
   class raw_ostream;
 
   template<typename T> class SmallVectorImpl;
@@ -72,6 +71,12 @@ public:
   virtual LatticeVal ComputeConstant(Constant *C) {
     return getOverdefinedVal(); // always safe
   }
+
+  /// IsSpecialCasedPHI - Given a PHI node, determine whether this PHI node is
+  /// one that the we want to handle through ComputeInstructionState.
+  virtual bool IsSpecialCasedPHI(PHINode *PN) {
+    return false;
+  }
   
   /// GetConstant - If the specified lattice value is representable as an LLVM
   /// constant value, return it.  Otherwise return null.  The returned value
@@ -114,8 +119,6 @@ class SparseSolver {
   /// compute transfer functions.
   AbstractLatticeFunction *LatticeFunc;
   
-  LLVMContext *Context;
-  
   DenseMap<Value*, LatticeVal> ValueState;  // The state each value is in.
   SmallPtrSet<BasicBlock*, 16> BBExecutable;   // The bbs that are executable.
   
@@ -131,8 +134,8 @@ class SparseSolver {
   SparseSolver(const SparseSolver&);    // DO NOT IMPLEMENT
   void operator=(const SparseSolver&);  // DO NOT IMPLEMENT
 public:
-  explicit SparseSolver(AbstractLatticeFunction *Lattice, LLVMContext *C)
-    : LatticeFunc(Lattice), Context(C) {}
+  explicit SparseSolver(AbstractLatticeFunction *Lattice)
+    : LatticeFunc(Lattice) {}
   ~SparseSolver() {
     delete LatticeFunc;
   }
@@ -147,7 +150,7 @@ public:
   /// value.  If an value is not in the map, it is returned as untracked,
   /// unlike the getOrInitValueState method.
   LatticeVal getLatticeState(Value *V) const {
-    DenseMap<Value*, LatticeVal>::iterator I = ValueState.find(V);
+    DenseMap<Value*, LatticeVal>::const_iterator I = ValueState.find(V);
     return I != ValueState.end() ? I->second : LatticeFunc->getUntrackedVal();
   }