Change ConstantFoldConstantExpression to accept a null
[oota-llvm.git] / include / llvm / Analysis / ScalarEvolution.h
index a5534e89c4e2a5cb883f7c0e2db705dfdab82ad3..88002cb77530e8c0e05d042aab31506e277e3da6 100644 (file)
@@ -35,8 +35,8 @@ namespace llvm {
   class ScalarEvolution;
   class TargetData;
 
-  /// SCEV - This class represent an analyzed expression in the program.  These
-  /// are reference counted opaque objects that the client is not allowed to
+  /// SCEV - This class represents an analyzed expression in the program.  These
+  /// are reference-counted opaque objects that the client is not allowed to
   /// do much with directly.
   ///
   class SCEV {
@@ -145,16 +145,6 @@ namespace llvm {
     static bool classof(const SCEV *S);
   };
 
-  /// SCEVCallbackVH - A CallbackVH to arrange for ScalarEvolution to be
-  /// notified whenever a Value is deleted.
-  class SCEVCallbackVH : public CallbackVH {
-    ScalarEvolution *SE;
-    virtual void deleted();
-    virtual void allUsesReplacedWith(Value *New);
-  public:
-    SCEVCallbackVH(Value *V, ScalarEvolution *SE = 0);
-  };
-
   /// SCEVHandle - This class is used to maintain the SCEV object's refcounts,
   /// freeing the objects when the last reference is dropped.
   class SCEVHandle {
@@ -212,7 +202,18 @@ namespace llvm {
   /// they must ask this class for services.
   ///
   class ScalarEvolution : public FunctionPass {
+    /// SCEVCallbackVH - A CallbackVH to arrange for ScalarEvolution to be
+    /// notified whenever a Value is deleted.
+    class SCEVCallbackVH : public CallbackVH {
+      ScalarEvolution *SE;
+      virtual void deleted();
+      virtual void allUsesReplacedWith(Value *New);
+    public:
+      SCEVCallbackVH(Value *V, ScalarEvolution *SE = 0);
+    };
+
     friend class SCEVCallbackVH;
+    friend class SCEVExpander;
 
     /// F - The function we are analyzing.
     ///
@@ -341,6 +342,10 @@ namespace llvm {
     BackedgeTakenInfo HowManyLessThans(const SCEV *LHS, const SCEV *RHS,
                                        const Loop *L, bool isSigned);
 
+    /// getLoopPredecessor - If the given loop's header has exactly one unique
+    /// predecessor outside the loop, return it. Otherwise return null.
+    BasicBlock *getLoopPredecessor(const Loop *L);
+
     /// getPredecessorWithUniqueSuccessorForBB - Return a predecessor of BB
     /// (which may not be an immediate predecessor) which has exactly one
     /// successor from which BB is reachable, or null if no such block is
@@ -485,8 +490,8 @@ namespace llvm {
     /// This method can be used to compute the exit value for a variable defined
     /// in a loop by querying what the value will hold in the parent loop.
     ///
-    /// If this value is not computable at this scope, a SCEVCouldNotCompute
-    /// object is returned.
+    /// In the case that a relevant loop exit value cannot be computed, the
+    /// original value V is returned.
     SCEVHandle getSCEVAtScope(const SCEV *S, const Loop *L);
 
     /// getSCEVAtScope - This is a convenience function which does