diff options
Diffstat (limited to 'include/llvm/Analysis/SparsePropagation.h')
-rw-r--r-- | include/llvm/Analysis/SparsePropagation.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/include/llvm/Analysis/SparsePropagation.h b/include/llvm/Analysis/SparsePropagation.h index c75531a..820e1bd1 100644 --- a/include/llvm/Analysis/SparsePropagation.h +++ b/include/llvm/Analysis/SparsePropagation.h @@ -17,7 +17,6 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" -#include <iosfwd> #include <vector> #include <set> @@ -31,6 +30,8 @@ namespace llvm { class BasicBlock; class Function; class SparseSolver; + class LLVMContext; + class raw_ostream; template<typename T> class SmallVectorImpl; @@ -71,6 +72,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 +106,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); }; @@ -113,6 +120,8 @@ 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. @@ -128,8 +137,8 @@ class SparseSolver { SparseSolver(const SparseSolver&); // DO NOT IMPLEMENT void operator=(const SparseSolver&); // DO NOT IMPLEMENT public: - explicit SparseSolver(AbstractLatticeFunction *Lattice) - : LatticeFunc(Lattice) {} + explicit SparseSolver(AbstractLatticeFunction *Lattice, LLVMContext *C) + : LatticeFunc(Lattice), Context(C) {} ~SparseSolver() { delete LatticeFunc; } @@ -138,7 +147,7 @@ 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, |