# Changeset View

Changeset View

# Standalone View

Standalone View

# ../include/llvm/Transforms/Utils/LoopUtils.h

Show First 20 Lines • Show All 257 Lines • ▼ Show 20 Line(s) | |||||

258 | 258 | | |||

259 | /// A struct for saving information about induction variables. | 259 | /// A struct for saving information about induction variables. | ||

260 | class InductionDescriptor { | 260 | class InductionDescriptor { | ||

261 | public: | 261 | public: | ||

262 | /// This enum represents the kinds of inductions that we support. | 262 | /// This enum represents the kinds of inductions that we support. | ||

263 | enum InductionKind { | 263 | enum InductionKind { | ||

264 | IK_NoInduction, ///< Not an induction variable. | 264 | IK_NoInduction, ///< Not an induction variable. | ||

265 | IK_IntInduction, ///< Integer induction variable. Step = C. | 265 | IK_IntInduction, ///< Integer induction variable. Step = C. | ||

266 | IK_PtrInduction ///< Pointer induction var. Step = C / sizeof(elem). | 266 | IK_PtrInduction, ///< Pointer induction var. Step = C / sizeof(elem). | ||

267 | IK_FpInduction ///< Floating point induction variable. | ||||

267 | }; | 268 | }; | ||

268 | 269 | | |||

269 | public: | 270 | public: | ||

270 | /// Default constructor - creates an invalid induction. | 271 | /// Default constructor - creates an invalid induction. | ||

271 | InductionDescriptor() | 272 | InductionDescriptor() | ||

272 | : StartValue(nullptr), IK(IK_NoInduction), Step(nullptr) {} | 273 | : StartValue(nullptr), IK(IK_NoInduction), Step(nullptr) {} | ||

273 | 274 | | |||

274 | /// Get the consecutive direction. Returns: | 275 | /// Get the consecutive direction. Returns: | ||

Show All 20 Lines | |||||

295 | /// the induction descriptor \p D will contain the data describing this | 296 | /// the induction descriptor \p D will contain the data describing this | ||

296 | /// induction. If by some other means the caller has a better SCEV | 297 | /// induction. If by some other means the caller has a better SCEV | ||

297 | /// expression for \p Phi than the one returned by the ScalarEvolution | 298 | /// expression for \p Phi than the one returned by the ScalarEvolution | ||

298 | /// analysis, it can be passed through \p Expr. | 299 | /// analysis, it can be passed through \p Expr. | ||

299 | static bool isInductionPHI(PHINode *Phi, ScalarEvolution *SE, | 300 | static bool isInductionPHI(PHINode *Phi, ScalarEvolution *SE, | ||

300 | InductionDescriptor &D, | 301 | InductionDescriptor &D, | ||

301 | const SCEV *Expr = nullptr); | 302 | const SCEV *Expr = nullptr); | ||

302 | 303 | | |||

304 | /// Returns true if \p Phi is a floating point induction. | ||||

305 | /// If \p Phi is an induction, the induction descriptor \p D will contain | ||||

306 | /// the data describing this induction. | ||||

307 | static bool isFpInductionPHI(PHINode *Phi, ScalarEvolution *SE, | ||||

308 | InductionDescriptor &D); | ||||

309 | | ||||

303 | /// Returns true if \p Phi is an induction, in the context associated with | 310 | /// Returns true if \p Phi is an induction, in the context associated with | ||

304 | /// the run-time predicate of PSE. If \p Assume is true, this can add further | 311 | /// the run-time predicate of PSE. If \p Assume is true, this can add further | ||

305 | /// SCEV predicates to \p PSE in order to prove that \p Phi is an induction. | 312 | /// SCEV predicates to \p PSE in order to prove that \p Phi is an induction. | ||

306 | /// If \p Phi is an induction, \p D will contain the data describing this | 313 | /// If \p Phi is an induction, \p D will contain the data describing this | ||

307 | /// induction. | 314 | /// induction. | ||

308 | static bool isInductionPHI(PHINode *Phi, PredicatedScalarEvolution &PSE, | 315 | static bool isInductionPHI(PHINode *Phi, PredicatedScalarEvolution &PSE, | ||

309 | InductionDescriptor &D, bool Assume = false); | 316 | InductionDescriptor &D, bool Assume = false); | ||

310 | 317 | | |||

▲ Show 20 Lines • Show All 114 Lines • Show Last 20 Lines |