#include "llvm/Pass.h"
#include "llvm/Instructions.h"
#include "llvm/Function.h"
-#include "llvm/Support/DataTypes.h"
+#include "llvm/System/DataTypes.h"
#include "llvm/Support/ValueHandle.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/ConstantRange.h"
};
friend class SCEVCallbackVH;
- friend struct SCEVExpander;
+ friend class SCEVExpander;
/// F - The function we are analyzing.
///
///
TargetData *TD;
+ /// DT - The dominator tree.
+ ///
+ DominatorTree *DT;
+
/// CouldNotCompute - This SCEV is used to represent unknown trip
/// counts and things.
SCEVCouldNotCompute CouldNotCompute;
/// createNodeForGEP - Provide the special handling we need to analyze GEP
/// SCEVs.
- const SCEV *createNodeForGEP(Operator *GEP);
+ const SCEV *createNodeForGEP(GEPOperator *GEP);
/// computeSCEVAtScope - Implementation code for getSCEVAtScope; called
/// at most once for each SCEV+Loop pair.
const SCEV *getZeroExtendExpr(const SCEV *Op, const Type *Ty);
const SCEV *getSignExtendExpr(const SCEV *Op, const Type *Ty);
const SCEV *getAnyExtendExpr(const SCEV *Op, const Type *Ty);
- const SCEV *getAddExpr(SmallVectorImpl<const SCEV *> &Ops);
- const SCEV *getAddExpr(const SCEV *LHS, const SCEV *RHS) {
+ const SCEV *getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
+ bool HasNUW = false, bool HasNSW = false);
+ const SCEV *getAddExpr(const SCEV *LHS, const SCEV *RHS,
+ bool HasNUW = false, bool HasNSW = false) {
SmallVector<const SCEV *, 2> Ops;
Ops.push_back(LHS);
Ops.push_back(RHS);
- return getAddExpr(Ops);
+ return getAddExpr(Ops, HasNUW, HasNSW);
}
const SCEV *getAddExpr(const SCEV *Op0, const SCEV *Op1,
- const SCEV *Op2) {
+ const SCEV *Op2,
+ bool HasNUW = false, bool HasNSW = false) {
SmallVector<const SCEV *, 3> Ops;
Ops.push_back(Op0);
Ops.push_back(Op1);
Ops.push_back(Op2);
- return getAddExpr(Ops);
+ return getAddExpr(Ops, HasNUW, HasNSW);
}
- const SCEV *getMulExpr(SmallVectorImpl<const SCEV *> &Ops);
- const SCEV *getMulExpr(const SCEV *LHS, const SCEV *RHS) {
+ const SCEV *getMulExpr(SmallVectorImpl<const SCEV *> &Ops,
+ bool HasNUW = false, bool HasNSW = false);
+ const SCEV *getMulExpr(const SCEV *LHS, const SCEV *RHS,
+ bool HasNUW = false, bool HasNSW = false) {
SmallVector<const SCEV *, 2> Ops;
Ops.push_back(LHS);
Ops.push_back(RHS);
- return getMulExpr(Ops);
+ return getMulExpr(Ops, HasNUW, HasNSW);
}
const SCEV *getUDivExpr(const SCEV *LHS, const SCEV *RHS);
const SCEV *getAddRecExpr(const SCEV *Start, const SCEV *Step,
- const Loop *L);
+ const Loop *L,
+ bool HasNUW = false, bool HasNSW = false);
const SCEV *getAddRecExpr(SmallVectorImpl<const SCEV *> &Operands,
- const Loop *L);
+ const Loop *L,
+ bool HasNUW = false, bool HasNSW = false);
const SCEV *getAddRecExpr(const SmallVectorImpl<const SCEV *> &Operands,
- const Loop *L) {
+ const Loop *L,
+ bool HasNUW = false, bool HasNSW = false) {
SmallVector<const SCEV *, 4> NewOp(Operands.begin(), Operands.end());
- return getAddRecExpr(NewOp, L);
+ return getAddRecExpr(NewOp, L, HasNUW, HasNSW);
}
const SCEV *getSMaxExpr(const SCEV *LHS, const SCEV *RHS);
const SCEV *getSMaxExpr(SmallVectorImpl<const SCEV *> &Operands);
const SCEV *getUMaxExpr(SmallVectorImpl<const SCEV *> &Operands);
const SCEV *getSMinExpr(const SCEV *LHS, const SCEV *RHS);
const SCEV *getUMinExpr(const SCEV *LHS, const SCEV *RHS);
- const SCEV *getFieldOffsetExpr(const StructType *STy, unsigned FieldNo);
- const SCEV *getAllocSizeExpr(const Type *AllocTy);
const SCEV *getUnknown(Value *V);
const SCEV *getCouldNotCompute();
+ /// getSizeOfExpr - Return an expression for sizeof on the given type.
+ ///
+ const SCEV *getSizeOfExpr(const Type *AllocTy);
+
+ /// getAlignOfExpr - Return an expression for alignof on the given type.
+ ///
+ const SCEV *getAlignOfExpr(const Type *AllocTy);
+
+ /// getOffsetOfExpr - Return an expression for offsetof on the given field.
+ ///
+ const SCEV *getOffsetOfExpr(const StructType *STy, unsigned FieldNo);
+
+ /// getOffsetOfExpr - Return an expression for offsetof on the given field.
+ ///
+ const SCEV *getOffsetOfExpr(const Type *CTy, Constant *FieldNo);
+
/// getNegativeSCEV - Return the SCEV object corresponding to -V.
///
const SCEV *getNegativeSCEV(const SCEV *V);
/// has an analyzable loop-invariant backedge-taken count.
bool hasLoopInvariantBackedgeTakenCount(const Loop *L);
- /// forgetLoopBackedgeTakenCount - This method should be called by the
- /// client when it has changed a loop in a way that may effect
- /// ScalarEvolution's ability to compute a trip count, or if the loop
- /// is deleted.
- void forgetLoopBackedgeTakenCount(const Loop *L);
+ /// forgetLoop - This method should be called by the client when it has
+ /// changed a loop in a way that may effect ScalarEvolution's ability to
+ /// compute a trip count, or if the loop is deleted.
+ void forgetLoop(const Loop *L);
/// GetMinTrailingZeros - Determine the minimum number of zero bits that S
/// is guaranteed to end in (at every loop iteration). It is, at the same