llvm-mc: Add --show-fixups option, for displaying the instruction fixup information...
[oota-llvm.git] / include / llvm / Analysis / SparsePropagation.h
index 1e2114840ad4f08327d1a44f70f11afbc26187be..c3c2f4b0668c5761d495ac8123dc13f2716aa9fd 100644 (file)
@@ -17,7 +17,6 @@
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallPtrSet.h"
-#include <iosfwd>
 #include <vector>
 #include <set>
 
@@ -31,6 +30,7 @@ namespace llvm {
   class BasicBlock;
   class Function;
   class SparseSolver;
+  class raw_ostream;
 
   template<typename T> class SmallVectorImpl;
   
@@ -71,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
@@ -99,7 +105,7 @@ public:
   }
   
   /// PrintValue - Render the specified lattice value to the specified stream.
-  virtual void PrintValue(LatticeVal V, std::ostream &OS);
+  virtual void PrintValue(LatticeVal V, raw_ostream &OS);
 };
 
   
@@ -138,13 +144,13 @@ public:
   ///
   void Solve(Function &F);
   
-  void Print(Function &F, std::ostream &OS) const;
+  void Print(Function &F, raw_ostream &OS) const;
 
   /// getLatticeState - Return the LatticeVal object that corresponds to the
   /// 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();
   }
   
@@ -163,6 +169,13 @@ public:
   /// lattice, not when querying it.
   bool isEdgeFeasible(BasicBlock *From, BasicBlock *To,
                       bool AggressiveUndef = false);
+
+  /// isBlockExecutable - Return true if there are any known feasible
+  /// edges into the basic block.  This is generally only useful when
+  /// querying the lattice.
+  bool isBlockExecutable(BasicBlock *BB) const {
+    return BBExecutable.count(BB);
+  }
   
 private:
   /// UpdateState - When the state for some instruction is potentially updated,