Add getPotentialPassManagerType(). No functionality change, yet.
[oota-llvm.git] / include / llvm / Analysis / ScalarEvolution.h
index a3dbb762ac70a1570f19edda2a3c0561b4103d3c..27d7e04a3e25cc042ce2624b3ea9d893f9b6aa73 100644 (file)
@@ -1,10 +1,10 @@
 //===- llvm/Analysis/ScalarEvolution.h - Scalar Evolution -------*- C++ -*-===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // The ScalarEvolution class is an LLVM pass which can be used to analyze and
 //
 // This analysis is primarily useful for induction variable substitution and
 // strength reduction.
-// 
+//
 //===----------------------------------------------------------------------===//
 
 #ifndef LLVM_ANALYSIS_SCALAREVOLUTION_H
 #define LLVM_ANALYSIS_SCALAREVOLUTION_H
 
 #include "llvm/Pass.h"
+#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/Streams.h"
 #include <set>
 
 namespace llvm {
@@ -84,12 +86,16 @@ namespace llvm {
     ///
     virtual const Type *getType() const = 0;
 
+    /// getBitWidth - Get the bit width of the type, if it has one, 0 otherwise.
+    /// 
+    uint32_t getBitWidth() const;
+
     /// replaceSymbolicValuesWithConcrete - If this SCEV internally references
     /// the symbolic value "Sym", construct and return a new SCEV that produces
     /// the same value, but which uses the concrete value Conc instead of the
     /// symbolic value.  If this SCEV does not use the symbolic value, it
     /// returns itself.
-    virtual SCEVHandle 
+    virtual SCEVHandle
     replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
                                       const SCEVHandle &Conc) const = 0;
 
@@ -97,12 +103,13 @@ namespace llvm {
     /// specified stream.  This should really only be used for debugging
     /// purposes.
     virtual void print(std::ostream &OS) const = 0;
+    void print(std::ostream *OS) const { if (OS) print(*OS); }
 
     /// dump - This method is used for debugging.
     ///
     void dump() const;
   };
-  
+
   inline std::ostream &operator<<(std::ostream &OS, const SCEV &S) {
     S.print(OS);
     return OS;
@@ -121,7 +128,8 @@ namespace llvm {
     virtual const Type *getType() const;
     virtual bool hasComputableLoopEvolution(const Loop *L) const;
     virtual void print(std::ostream &OS) const;
-    virtual SCEVHandle 
+    void print(std::ostream *OS) const { if (OS) print(*OS); }
+    virtual SCEVHandle
     replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
                                       const SCEVHandle &Conc) const;
 
@@ -141,7 +149,7 @@ namespace llvm {
       S->addRef();
     }
     SCEVHandle(const SCEVHandle &RHS) : S(RHS.S) {
-      S->addRef();      
+      S->addRef();
     }
     ~SCEVHandle() { S->dropRef(); }
 
@@ -190,11 +198,19 @@ namespace llvm {
     void *Impl;    // ScalarEvolution uses the pimpl pattern
   public:
     ScalarEvolution() : Impl(0) {}
-    
+
     /// getSCEV - Return a SCEV expression handle for the full generality of the
     /// specified expression.
     SCEVHandle getSCEV(Value *V) const;
 
+    /// hasSCEV - Return true if the SCEV for this value has already been
+    /// computed.
+    bool hasSCEV(Value *V) const;
+
+    /// setSCEV - Insert the specified SCEV into the map of current SCEVs for
+    /// the specified value.
+    void setSCEV(Value *V, const SCEVHandle &H);
+
     /// getSCEVAtScope - Return a SCEV expression handle for the specified value
     /// at the specified scope in the program.  The L value specifies a loop
     /// nest to evaluate the expression at, where null is the top-level or a
@@ -224,6 +240,9 @@ namespace llvm {
     virtual void releaseMemory();
     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
     virtual void print(std::ostream &OS, const Module* = 0) const;
+    void print(std::ostream *OS, const Module* M = 0) const {
+      if (OS) print(*OS, M);
+    }
   };
 }