Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 6 additions & 141 deletions llvm/include/llvm/Analysis/DependenceAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,106 +393,6 @@ class DependenceInfo {
unsigned char DirSet;
};

/// Constraint - This private class represents a constraint, as defined
/// in the paper
///
/// Practical Dependence Testing
/// Goff, Kennedy, Tseng
/// PLDI 1991
///
/// There are 5 kinds of constraint, in a hierarchy.
/// 1) Any - indicates no constraint, any dependence is possible.
/// 2) Line - A line ax + by = c, where a, b, and c are parameters,
/// representing the dependence equation.
/// 3) Distance - The value d of the dependence distance;
/// 4) Point - A point <x, y> representing the dependence from
/// iteration x to iteration y.
/// 5) Empty - No dependence is possible.
class Constraint {
private:
enum ConstraintKind { Empty, Point, Distance, Line, Any } Kind;
ScalarEvolution *SE;
const SCEV *A;
const SCEV *B;
const SCEV *C;
const Loop *AssociatedSrcLoop;
const Loop *AssociatedDstLoop;

public:
/// isEmpty - Return true if the constraint is of kind Empty.
bool isEmpty() const { return Kind == Empty; }

/// isPoint - Return true if the constraint is of kind Point.
bool isPoint() const { return Kind == Point; }

/// isDistance - Return true if the constraint is of kind Distance.
bool isDistance() const { return Kind == Distance; }

/// isLine - Return true if the constraint is of kind Line.
/// Since Distance's can also be represented as Lines, we also return
/// true if the constraint is of kind Distance.
bool isLine() const { return Kind == Line || Kind == Distance; }

/// isAny - Return true if the constraint is of kind Any;
bool isAny() const { return Kind == Any; }

/// getX - If constraint is a point <X, Y>, returns X.
/// Otherwise assert.
LLVM_ABI const SCEV *getX() const;

/// getY - If constraint is a point <X, Y>, returns Y.
/// Otherwise assert.
LLVM_ABI const SCEV *getY() const;

/// getA - If constraint is a line AX + BY = C, returns A.
/// Otherwise assert.
LLVM_ABI const SCEV *getA() const;

/// getB - If constraint is a line AX + BY = C, returns B.
/// Otherwise assert.
LLVM_ABI const SCEV *getB() const;

/// getC - If constraint is a line AX + BY = C, returns C.
/// Otherwise assert.
LLVM_ABI const SCEV *getC() const;

/// getD - If constraint is a distance, returns D.
/// Otherwise assert.
LLVM_ABI const SCEV *getD() const;

/// getAssociatedSrcLoop - Returns the source loop associated with this
/// constraint.
LLVM_ABI const Loop *getAssociatedSrcLoop() const;

/// getAssociatedDstLoop - Returns the destination loop associated with
/// this constraint.
LLVM_ABI const Loop *getAssociatedDstLoop() const;

/// setPoint - Change a constraint to Point.
LLVM_ABI void setPoint(const SCEV *X, const SCEV *Y,
const Loop *CurrentSrcLoop,
const Loop *CurrentDstLoop);

/// setLine - Change a constraint to Line.
LLVM_ABI void setLine(const SCEV *A, const SCEV *B, const SCEV *C,
const Loop *CurrentSrcLoop,
const Loop *CurrentDstLoop);

/// setDistance - Change a constraint to Distance.
LLVM_ABI void setDistance(const SCEV *D, const Loop *CurrentSrcLoop,
const Loop *CurrentDstLoop);

/// setEmpty - Change a constraint to Empty.
LLVM_ABI void setEmpty();

/// setAny - Change a constraint to Any.
LLVM_ABI void setAny(ScalarEvolution *SE);

/// dump - For debugging purposes. Dumps the constraint
/// out to OS.
LLVM_ABI void dump(raw_ostream &OS) const;
};

/// Returns true if two loops have the Same iteration Space and Depth. To be
/// more specific, two loops have SameSD if they are in the same nesting
/// depth and have the same backedge count. SameSD stands for Same iteration
Expand Down Expand Up @@ -659,7 +559,7 @@ class DependenceInfo {
/// If the dependence isn't proven to exist,
/// marks the Result as inconsistent.
bool testSIV(const SCEV *Src, const SCEV *Dst, unsigned &Level,
FullDependence &Result, Constraint &NewConstraint) const;
FullDependence &Result) const;

/// testRDIV - Tests the RDIV subscript pair (Src and Dst) for dependence.
/// Things of the form [c1 + a1*i] and [c2 + a2*j]
Expand Down Expand Up @@ -689,7 +589,7 @@ class DependenceInfo {
bool strongSIVtest(const SCEV *Coeff, const SCEV *SrcConst,
const SCEV *DstConst, const Loop *CurrentSrcLoop,
const Loop *CurrentDstLoop, unsigned Level,
FullDependence &Result, Constraint &NewConstraint) const;
FullDependence &Result) const;

/// weakCrossingSIVtest - Tests the weak-crossing SIV subscript pair
/// (Src and Dst) for dependence.
Expand All @@ -703,8 +603,7 @@ class DependenceInfo {
bool weakCrossingSIVtest(const SCEV *SrcCoeff, const SCEV *SrcConst,
const SCEV *DstConst, const Loop *CurrentSrcLoop,
const Loop *CurrentDstLoop, unsigned Level,
FullDependence &Result,
Constraint &NewConstraint) const;
FullDependence &Result) const;

/// ExactSIVtest - Tests the SIV subscript pair
/// (Src and Dst) for dependence.
Expand All @@ -718,8 +617,7 @@ class DependenceInfo {
bool exactSIVtest(const SCEV *SrcCoeff, const SCEV *DstCoeff,
const SCEV *SrcConst, const SCEV *DstConst,
const Loop *CurrentSrcLoop, const Loop *CurrentDstLoop,
unsigned Level, FullDependence &Result,
Constraint &NewConstraint) const;
unsigned Level, FullDependence &Result) const;

/// weakZeroSrcSIVtest - Tests the weak-zero SIV subscript pair
/// (Src and Dst) for dependence.
Expand All @@ -734,8 +632,7 @@ class DependenceInfo {
bool weakZeroSrcSIVtest(const SCEV *DstCoeff, const SCEV *SrcConst,
const SCEV *DstConst, const Loop *CurrentSrcLoop,
const Loop *CurrentDstLoop, unsigned Level,
FullDependence &Result,
Constraint &NewConstraint) const;
FullDependence &Result) const;

/// weakZeroDstSIVtest - Tests the weak-zero SIV subscript pair
/// (Src and Dst) for dependence.
Expand All @@ -750,8 +647,7 @@ class DependenceInfo {
bool weakZeroDstSIVtest(const SCEV *SrcCoeff, const SCEV *SrcConst,
const SCEV *DstConst, const Loop *CurrentSrcLoop,
const Loop *CurrentDstLoop, unsigned Level,
FullDependence &Result,
Constraint &NewConstraint) const;
FullDependence &Result) const;

/// exactRDIVtest - Tests the RDIV subscript pair for dependence.
/// Things of the form [c1 + a*i] and [c2 + b*j],
Expand Down Expand Up @@ -871,37 +767,6 @@ class DependenceInfo {
void findBoundsEQ(CoefficientInfo *A, CoefficientInfo *B, BoundInfo *Bound,
unsigned K) const;

/// intersectConstraints - Updates X with the intersection
/// of the Constraints X and Y. Returns true if X has changed.
bool intersectConstraints(Constraint *X, const Constraint *Y);

/// findCoefficient - Given a linear SCEV,
/// return the coefficient corresponding to specified loop.
/// If there isn't one, return the SCEV constant 0.
/// For example, given a*i + b*j + c*k, returning the coefficient
/// corresponding to the j loop would yield b.
const SCEV *findCoefficient(const SCEV *Expr, const Loop *TargetLoop) const;

/// zeroCoefficient - Given a linear SCEV,
/// return the SCEV given by zeroing out the coefficient
/// corresponding to the specified loop.
/// For example, given a*i + b*j + c*k, zeroing the coefficient
/// corresponding to the j loop would yield a*i + c*k.
const SCEV *zeroCoefficient(const SCEV *Expr, const Loop *TargetLoop) const;

/// addToCoefficient - Given a linear SCEV Expr,
/// return the SCEV given by adding some Value to the
/// coefficient corresponding to the specified TargetLoop.
/// For example, given a*i + b*j + c*k, adding 1 to the coefficient
/// corresponding to the j loop would yield a*i + (b+1)*j + c*k.
const SCEV *addToCoefficient(const SCEV *Expr, const Loop *TargetLoop,
const SCEV *Value) const;

/// updateDirection - Update direction vector entry
/// based on the current constraint.
void updateDirection(Dependence::DVEntry &Level,
const Constraint &CurConstraint) const;

/// Given a linear access function, tries to recover subscripts
/// for each dimension of the array element access.
bool tryDelinearize(Instruction *Src, Instruction *Dst,
Expand Down
Loading