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 {
///
bool isZero() const;
+ /// isOne - Return true if the expression is a constant one.
+ ///
+ bool isOne() 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
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 {
/// 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.
///
/// createNodeForGEP - Provide the special handling we need to analyze GEP
/// SCEVs.
- SCEVHandle createNodeForGEP(GetElementPtrInst *GEP);
+ SCEVHandle createNodeForGEP(User *GEP);
/// ReplaceSymbolicValueWithConcrete - This looks up the computed SCEV value
/// for the specified instruction and replaces any references to the
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
/// extended, it is sign extended.
SCEVHandle getTruncateOrSignExtend(const SCEVHandle &V, const Type *Ty);
+ /// getNoopOrZeroExtend - Return a SCEV corresponding to a conversion of
+ /// the input value to the specified type. If the type must be extended,
+ /// it is zero extended. The conversion must not be narrowing.
+ SCEVHandle getNoopOrZeroExtend(const SCEVHandle &V, const Type *Ty);
+
+ /// getNoopOrSignExtend - Return a SCEV corresponding to a conversion of
+ /// the input value to the specified type. If the type must be extended,
+ /// it is sign extended. The conversion must not be narrowing.
+ SCEVHandle getNoopOrSignExtend(const SCEVHandle &V, const Type *Ty);
+
+ /// getTruncateOrNoop - Return a SCEV corresponding to a conversion of the
+ /// input value to the specified type. The conversion must not be
+ /// widening.
+ SCEVHandle getTruncateOrNoop(const SCEVHandle &V, const Type *Ty);
+
/// getIntegerSCEV - Given an integer or FP type, create a constant for the
/// specified signed integer value and return a SCEV for the constant.
SCEVHandle getIntegerSCEV(int Val, const Type *Ty);
/// 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