40 #ifndef LLVM_ANALYSIS_DEPENDENCEANALYSIS_H
41 #define LLVM_ANALYSIS_DEPENDENCEANALYSIS_H
51 class ScalarEvolution;
76 NextPredecessor(NULL),
77 NextSuccessor(NULL) {}
179 return NextPredecessor;
185 return NextSuccessor;
191 NextPredecessor = pred;
197 NextSuccessor = succ;
205 const Dependence *NextPredecessor, *NextSuccessor;
222 bool LoopIndependent,
270 unsigned short Levels;
271 bool LoopIndependent;
292 bool PossiblyLoopIndependent);
348 enum ClassificationKind { ZIV, SIV, RDIV, MIV, NonLinear } Classification;
354 struct CoefficientInfo {
358 const SCEV *Iterations;
362 const SCEV *Iterations;
363 const SCEV *Upper[8];
364 const SCEV *Lower[8];
365 unsigned char Direction;
366 unsigned char DirSet;
386 enum ConstraintKind { Empty, Point, Distance, Line,
Any } Kind;
391 const Loop *AssociatedLoop;
394 bool isEmpty()
const {
return Kind == Empty; }
397 bool isPoint()
const {
return Kind == Point; }
400 bool isDistance()
const {
return Kind == Distance; }
405 bool isLine()
const {
return Kind == Line || Kind == Distance; }
408 bool isAny()
const {
return Kind ==
Any; }
412 const SCEV *getX()
const;
416 const SCEV *getY()
const;
420 const SCEV *getA()
const;
424 const SCEV *getB()
const;
428 const SCEV *getC()
const;
432 const SCEV *getD()
const;
435 const Loop *getAssociatedLoop()
const;
438 void setPoint(
const SCEV *
X,
const SCEV *
Y,
const Loop *CurrentLoop);
441 void setLine(
const SCEV *
A,
const SCEV *B,
445 void setDistance(
const SCEV *D,
const Loop *CurrentLoop);
509 void establishNestingLevels(
const Instruction *Src,
512 unsigned CommonLevels, SrcLevels, MaxLevels;
516 unsigned mapSrcLoop(
const Loop *SrcLoop)
const;
520 unsigned mapDstLoop(
const Loop *DstLoop)
const;
524 bool isLoopInvariant(
const SCEV *Expression,
const Loop *LoopNest)
const;
530 void removeMatchingExtensions(Subscript *Pair);
534 void collectCommonLoops(
const SCEV *Expression,
535 const Loop *LoopNest,
540 bool checkSrcSubscript(
const SCEV *Src,
541 const Loop *LoopNest,
546 bool checkDstSubscript(
const SCEV *Dst,
547 const Loop *LoopNest,
556 const SCEV *
Y)
const;
573 Subscript::ClassificationKind classifyPair(
const SCEV *Src,
574 const Loop *SrcLoopNest,
576 const Loop *DstLoopNest,
584 bool testZIV(
const SCEV *Src,
598 bool testSIV(
const SCEV *Src,
602 Constraint &NewConstraint,
603 const SCEV *&SplitIter)
const;
614 bool testRDIV(
const SCEV *Src,
621 bool testMIV(
const SCEV *Src,
634 bool strongSIVtest(
const SCEV *Coeff,
635 const SCEV *SrcConst,
636 const SCEV *DstConst,
637 const Loop *CurrentLoop,
640 Constraint &NewConstraint)
const;
652 bool weakCrossingSIVtest(
const SCEV *SrcCoeff,
653 const SCEV *SrcConst,
654 const SCEV *DstConst,
655 const Loop *CurrentLoop,
658 Constraint &NewConstraint,
659 const SCEV *&SplitIter)
const;
670 bool exactSIVtest(
const SCEV *SrcCoeff,
671 const SCEV *DstCoeff,
672 const SCEV *SrcConst,
673 const SCEV *DstConst,
674 const Loop *CurrentLoop,
677 Constraint &NewConstraint)
const;
689 bool weakZeroSrcSIVtest(
const SCEV *DstCoeff,
690 const SCEV *SrcConst,
691 const SCEV *DstConst,
692 const Loop *CurrentLoop,
695 Constraint &NewConstraint)
const;
707 bool weakZeroDstSIVtest(
const SCEV *SrcCoeff,
708 const SCEV *SrcConst,
709 const SCEV *DstConst,
710 const Loop *CurrentLoop,
713 Constraint &NewConstraint)
const;
723 bool exactRDIVtest(
const SCEV *SrcCoeff,
724 const SCEV *DstCoeff,
725 const SCEV *SrcConst,
726 const SCEV *DstConst,
740 bool symbolicRDIVtest(
const SCEV *SrcCoeff,
741 const SCEV *DstCoeff,
742 const SCEV *SrcConst,
743 const SCEV *DstConst,
745 const Loop *DstLoop)
const;
753 bool gcdMIVtest(
const SCEV *Src,
761 bool banerjeeMIVtest(
const SCEV *Src,
769 CoefficientInfo *collectCoeffInfo(
const SCEV *Subscript,
775 const SCEV *getPositivePart(
const SCEV *X)
const;
779 const SCEV *getNegativePart(
const SCEV *X)
const;
784 const SCEV *getLowerBound(BoundInfo *Bound)
const;
789 const SCEV *getUpperBound(BoundInfo *Bound)
const;
796 unsigned exploreDirections(
unsigned Level,
801 unsigned &DepthExpanded,
802 const SCEV *Delta)
const;
806 bool testBounds(
unsigned char DirKind,
809 const SCEV *Delta)
const;
813 void findBoundsALL(CoefficientInfo *A,
820 void findBoundsLT(CoefficientInfo *A,
827 void findBoundsGT(CoefficientInfo *A,
834 void findBoundsEQ(CoefficientInfo *A,
841 bool intersectConstraints(Constraint *X,
842 const Constraint *Y);
849 bool propagate(
const SCEV *&Src,
860 bool propagateDistance(
const SCEV *&Src,
862 Constraint &CurConstraint,
868 bool propagatePoint(
const SCEV *&Src,
870 Constraint &CurConstraint);
877 bool propagateLine(
const SCEV *&Src,
879 Constraint &CurConstraint,
887 const SCEV *findCoefficient(
const SCEV *Expr,
888 const Loop *TargetLoop)
const;
895 const SCEV *zeroCoefficient(
const SCEV *Expr,
896 const Loop *TargetLoop)
const;
903 const SCEV *addToCoefficient(
const SCEV *Expr,
904 const Loop *TargetLoop,
910 const Constraint &CurConstraint)
const;
912 bool tryDelinearize(
const SCEV *SrcSCEV,
const SCEV *DstSCEV,
bool isPeelFirst(unsigned Level) const
static PassRegistry * getPassRegistry()
virtual bool isConfused() const
The main container class for the LLVM Intermediate Representation.
virtual bool isPeelFirst(unsigned Level) const
FunctionPass * createDependenceAnalysisPass()
bool runOnFunction(Function &F)
bool isScalar(unsigned Level) const
const SCEV * getDistance(unsigned Level) const
virtual bool isSplitable(unsigned Level) const
unsigned getLevels() const
bool isConsistent() const
void setNextPredecessor(const Dependence *pred)
void getAnalysisUsage(AnalysisUsage &) const
void print(raw_ostream &, const Module *=0) const
const Dependence * getNextSuccessor() const
Dependence * depends(Instruction *Src, Instruction *Dst, bool PossiblyLoopIndependent)
LLVM Constant Representation.
virtual bool isScalar(unsigned Level) const
Instr is a loop (backwards branch).
unsigned getDirection(unsigned Level) const
const SCEV * getSplitIteration(const Dependence *Dep, unsigned Level)
bool isLoopIndependent() const
virtual const SCEV * getDistance(unsigned Level) const
Instruction * getSrc() const
virtual unsigned getDirection(unsigned Level) const
virtual bool isConsistent() const
bool isPeelLast(unsigned Level) const
void initializeDependenceAnalysisPass(PassRegistry &)
const Dependence * getNextPredecessor() const
virtual unsigned getLevels() const
virtual bool isPeelLast(unsigned Level) const
Dependence(Instruction *Source, Instruction *Destination)
#define LLVM_DELETED_FUNCTION
FullDependence(Instruction *Src, Instruction *Dst, bool LoopIndependent, unsigned Levels)
virtual bool isLoopIndependent() const
Instruction * getDst() const
void dump(raw_ostream &OS) const
LLVM Value Representation.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
void setNextSuccessor(const Dependence *succ)
static RegisterPass< NVPTXAllocaHoisting > X("alloca-hoisting","Hoisting alloca instructions in non-entry ""blocks to the entry block")
bool isSplitable(unsigned Level) const