|
|
|||
File indexing completed on 2026-05-10 08:48:20
0001 //===--- SCEVValidator.h - Detect Scops -------------------------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // Checks if a SCEV expression represents a valid affine expression. 0009 //===----------------------------------------------------------------------===// 0010 0011 #ifndef POLLY_SCEV_VALIDATOR_H 0012 #define POLLY_SCEV_VALIDATOR_H 0013 0014 #include "polly/Support/ScopHelper.h" 0015 0016 namespace llvm { 0017 class SCEVConstant; 0018 } // namespace llvm 0019 0020 namespace polly { 0021 class ScopDetection; 0022 0023 /// Find the loops referenced from a SCEV expression. 0024 /// 0025 /// @param Expr The SCEV expression to scan for loops. 0026 /// @param Loops A vector into which the found loops are inserted. 0027 void findLoops(const llvm::SCEV *Expr, 0028 llvm::SetVector<const llvm::Loop *> &Loops); 0029 0030 /// Find the values referenced by SCEVUnknowns in a given SCEV 0031 /// expression. 0032 /// 0033 /// @param Expr The SCEV expression to scan for SCEVUnknowns. 0034 /// @param SE The ScalarEvolution analysis for this function. 0035 /// @param Values A vector into which the found values are inserted. 0036 void findValues(const llvm::SCEV *Expr, llvm::ScalarEvolution &SE, 0037 llvm::SetVector<llvm::Value *> &Values); 0038 0039 /// Returns true when the SCEV contains references to instructions within the 0040 /// region. 0041 /// 0042 /// @param Expr The SCEV to analyze. 0043 /// @param R The region in which we look for dependences. 0044 /// @param Scope Location where the value is needed. 0045 /// @param AllowLoops Whether loop recurrences outside the loop that are in the 0046 /// region count as dependence. 0047 bool hasScalarDepsInsideRegion(const llvm::SCEV *Expr, const llvm::Region *R, 0048 llvm::Loop *Scope, bool AllowLoops, 0049 const InvariantLoadsSetTy &ILS); 0050 bool isAffineExpr(const llvm::Region *R, llvm::Loop *Scope, 0051 const llvm::SCEV *Expression, llvm::ScalarEvolution &SE, 0052 InvariantLoadsSetTy *ILS = nullptr); 0053 0054 /// Check if @p V describes an affine constraint in @p R. 0055 bool isAffineConstraint(llvm::Value *V, const llvm::Region *R, 0056 llvm::Loop *Scope, llvm::ScalarEvolution &SE, 0057 ParameterSetTy &Params, bool OrExpr = false); 0058 0059 ParameterSetTy getParamsInAffineExpr(const llvm::Region *R, llvm::Loop *Scope, 0060 const llvm::SCEV *Expression, 0061 llvm::ScalarEvolution &SE); 0062 0063 /// Extract the constant factors from the multiplication @p M. 0064 /// 0065 /// @param M A potential SCEV multiplication. 0066 /// @param SE The ScalarEvolution analysis to create new SCEVs. 0067 /// 0068 /// @returns The constant factor in @p M and the rest of @p M. 0069 std::pair<const llvm::SCEVConstant *, const llvm::SCEV *> 0070 extractConstantFactor(const llvm::SCEV *M, llvm::ScalarEvolution &SE); 0071 0072 /// Try to look through PHI nodes, where some incoming edges come from error 0073 /// blocks. 0074 /// 0075 /// In case a PHI node follows an error block we can assume that the incoming 0076 /// value can only come from the node that is not an error block. As a result, 0077 /// conditions that seemed non-affine before are now in fact affine. 0078 const llvm::SCEV *tryForwardThroughPHI(const llvm::SCEV *Expr, llvm::Region &R, 0079 llvm::ScalarEvolution &SE, 0080 ScopDetection *SD); 0081 0082 /// Return a unique non-error block incoming value for @p PHI if available. 0083 /// 0084 /// @param R The region to run our code on. 0085 /// @param SD The ScopDetection 0086 llvm::Value *getUniqueNonErrorValue(llvm::PHINode *PHI, llvm::Region *R, 0087 ScopDetection *SD); 0088 } // namespace polly 0089 0090 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|