DependenceAnalysis.h (256281) | DependenceAnalysis.h (263508) |
---|---|
1//===-- llvm/Analysis/DependenceAnalysis.h -------------------- -*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 47 unchanged lines hidden (view full) --- 56 /// Dependence - This class represents a dependence between two memory 57 /// memory references in a function. It contains minimal information and 58 /// is used in the very common situation where the compiler is unable to 59 /// determine anything beyond the existence of a dependence; that is, it 60 /// represents a confused dependence (see also FullDependence). In most 61 /// cases (for output, flow, and anti dependences), the dependence implies 62 /// an ordering, where the source must precede the destination; in contrast, 63 /// input dependences are unordered. | 1//===-- llvm/Analysis/DependenceAnalysis.h -------------------- -*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 47 unchanged lines hidden (view full) --- 56 /// Dependence - This class represents a dependence between two memory 57 /// memory references in a function. It contains minimal information and 58 /// is used in the very common situation where the compiler is unable to 59 /// determine anything beyond the existence of a dependence; that is, it 60 /// represents a confused dependence (see also FullDependence). In most 61 /// cases (for output, flow, and anti dependences), the dependence implies 62 /// an ordering, where the source must precede the destination; in contrast, 63 /// input dependences are unordered. |
64 /// 65 /// When a dependence graph is built, each Dependence will be a member of 66 /// the set of predecessor edges for its destination instruction and a set 67 /// if successor edges for its source instruction. These sets are represented 68 /// as singly-linked lists, with the "next" fields stored in the dependence 69 /// itelf. |
|
64 class Dependence { 65 public: 66 Dependence(Instruction *Source, 67 Instruction *Destination) : | 70 class Dependence { 71 public: 72 Dependence(Instruction *Source, 73 Instruction *Destination) : |
68 Src(Source), Dst(Destination) {} | 74 Src(Source), 75 Dst(Destination), 76 NextPredecessor(NULL), 77 NextSuccessor(NULL) {} |
69 virtual ~Dependence() {} 70 71 /// Dependence::DVEntry - Each level in the distance/direction vector 72 /// has a direction (or perhaps a union of several directions), and 73 /// perhaps a distance. 74 struct DVEntry { 75 enum { NONE = 0, 76 LT = 1, --- 82 unchanged lines hidden (view full) --- 159 /// the dependence. 160 virtual bool isSplitable(unsigned Level) const { return false; } 161 162 /// isScalar - Returns true if a particular level is scalar; that is, 163 /// if no subscript in the source or destination mention the induction 164 /// variable associated with the loop at this level. 165 virtual bool isScalar(unsigned Level) const; 166 | 78 virtual ~Dependence() {} 79 80 /// Dependence::DVEntry - Each level in the distance/direction vector 81 /// has a direction (or perhaps a union of several directions), and 82 /// perhaps a distance. 83 struct DVEntry { 84 enum { NONE = 0, 85 LT = 1, --- 82 unchanged lines hidden (view full) --- 168 /// the dependence. 169 virtual bool isSplitable(unsigned Level) const { return false; } 170 171 /// isScalar - Returns true if a particular level is scalar; that is, 172 /// if no subscript in the source or destination mention the induction 173 /// variable associated with the loop at this level. 174 virtual bool isScalar(unsigned Level) const; 175 |
176 /// getNextPredecessor - Returns the value of the NextPredecessor 177 /// field. 178 const Dependence *getNextPredecessor() const { 179 return NextPredecessor; 180 } 181 182 /// getNextSuccessor - Returns the value of the NextSuccessor 183 /// field. 184 const Dependence *getNextSuccessor() const { 185 return NextSuccessor; 186 } 187 188 /// setNextPredecessor - Sets the value of the NextPredecessor 189 /// field. 190 void setNextPredecessor(const Dependence *pred) { 191 NextPredecessor = pred; 192 } 193 194 /// setNextSuccessor - Sets the value of the NextSuccessor 195 /// field. 196 void setNextSuccessor(const Dependence *succ) { 197 NextSuccessor = succ; 198 } 199 |
|
167 /// dump - For debugging purposes, dumps a dependence to OS. 168 /// 169 void dump(raw_ostream &OS) const; 170 private: 171 Instruction *Src, *Dst; | 200 /// dump - For debugging purposes, dumps a dependence to OS. 201 /// 202 void dump(raw_ostream &OS) const; 203 private: 204 Instruction *Src, *Dst; |
205 const Dependence *NextPredecessor, *NextSuccessor; |
|
172 friend class DependenceAnalysis; 173 }; 174 175 176 /// FullDependence - This class represents a dependence between two memory 177 /// references in a function. It contains detailed information about the 178 /// dependence (direction vectors, etc.) and is used when the compiler is 179 /// able to accurately analyze the interaction of the references; that is, --- 630 unchanged lines hidden (view full) --- 810 /// propagate - Review the constraints, looking for opportunities 811 /// to simplify a subscript pair (Src and Dst). 812 /// Return true if some simplification occurs. 813 /// If the simplification isn't exact (that is, if it is conservative 814 /// in terms of dependence), set consistent to false. 815 bool propagate(const SCEV *&Src, 816 const SCEV *&Dst, 817 SmallBitVector &Loops, | 206 friend class DependenceAnalysis; 207 }; 208 209 210 /// FullDependence - This class represents a dependence between two memory 211 /// references in a function. It contains detailed information about the 212 /// dependence (direction vectors, etc.) and is used when the compiler is 213 /// able to accurately analyze the interaction of the references; that is, --- 630 unchanged lines hidden (view full) --- 844 /// propagate - Review the constraints, looking for opportunities 845 /// to simplify a subscript pair (Src and Dst). 846 /// Return true if some simplification occurs. 847 /// If the simplification isn't exact (that is, if it is conservative 848 /// in terms of dependence), set consistent to false. 849 bool propagate(const SCEV *&Src, 850 const SCEV *&Dst, 851 SmallBitVector &Loops, |
818 SmallVector<Constraint, 4> &Constraints, | 852 SmallVectorImpl<Constraint> &Constraints, |
819 bool &Consistent); 820 821 /// propagateDistance - Attempt to propagate a distance 822 /// constraint into a subscript pair (Src and Dst). 823 /// Return true if some simplification occurs. 824 /// If the simplification isn't exact (that is, if it is conservative 825 /// in terms of dependence), set consistent to false. 826 bool propagateDistance(const SCEV *&Src, --- 42 unchanged lines hidden (view full) --- 869 const SCEV *addToCoefficient(const SCEV *Expr, 870 const Loop *TargetLoop, 871 const SCEV *Value) const; 872 873 /// updateDirection - Update direction vector entry 874 /// based on the current constraint. 875 void updateDirection(Dependence::DVEntry &Level, 876 const Constraint &CurConstraint) const; | 853 bool &Consistent); 854 855 /// propagateDistance - Attempt to propagate a distance 856 /// constraint into a subscript pair (Src and Dst). 857 /// Return true if some simplification occurs. 858 /// If the simplification isn't exact (that is, if it is conservative 859 /// in terms of dependence), set consistent to false. 860 bool propagateDistance(const SCEV *&Src, --- 42 unchanged lines hidden (view full) --- 903 const SCEV *addToCoefficient(const SCEV *Expr, 904 const Loop *TargetLoop, 905 const SCEV *Value) const; 906 907 /// updateDirection - Update direction vector entry 908 /// based on the current constraint. 909 void updateDirection(Dependence::DVEntry &Level, 910 const Constraint &CurConstraint) const; |
911 912 bool tryDelinearize(const SCEV *SrcSCEV, const SCEV *DstSCEV, 913 SmallVectorImpl<Subscript> &Pair) const; 914 |
|
877 public: 878 static char ID; // Class identification, replacement for typeinfo 879 DependenceAnalysis() : FunctionPass(ID) { 880 initializeDependenceAnalysisPass(*PassRegistry::getPassRegistry()); 881 } 882 883 bool runOnFunction(Function &F); 884 void releaseMemory(); 885 void getAnalysisUsage(AnalysisUsage &) const; 886 void print(raw_ostream &, const Module * = 0) const; 887 }; // class DependenceAnalysis 888 889 /// createDependenceAnalysisPass - This creates an instance of the 890 /// DependenceAnalysis pass. 891 FunctionPass *createDependenceAnalysisPass(); 892 893} // namespace llvm 894 895#endif | 915 public: 916 static char ID; // Class identification, replacement for typeinfo 917 DependenceAnalysis() : FunctionPass(ID) { 918 initializeDependenceAnalysisPass(*PassRegistry::getPassRegistry()); 919 } 920 921 bool runOnFunction(Function &F); 922 void releaseMemory(); 923 void getAnalysisUsage(AnalysisUsage &) const; 924 void print(raw_ostream &, const Module * = 0) const; 925 }; // class DependenceAnalysis 926 927 /// createDependenceAnalysisPass - This creates an instance of the 928 /// DependenceAnalysis pass. 929 FunctionPass *createDependenceAnalysisPass(); 930 931} // namespace llvm 932 933#endif |