Polly 19.0.0git
|
Translate a SCEV to an isl::pw_aff and the domain on which it is invalid. More...
#include <SCEVAffinator.h>
Public Member Functions | |
SCEVAffinator (Scop *S, llvm::LoopInfo &LI) | |
PWACtx | getPwAff (const llvm::SCEV *E, llvm::BasicBlock *BB=nullptr, RecordedAssumptionsTy *RecordedAssumptions=nullptr) |
Translate a SCEV to an isl::pw_aff. | |
void | takeNonNegativeAssumption (PWACtx &PWAC, RecordedAssumptionsTy *RecordedAssumptions=nullptr) |
Take the assumption that PWAC is non-negative. | |
void | interpretAsUnsigned (PWACtx &PWAC, unsigned Width) |
Interpret the PWA in PWAC as an unsigned value. | |
bool | hasNSWAddRecForLoop (llvm::Loop *L) const |
Check an <nsw> AddRec for the loop L is cached. | |
llvm::LoopInfo * | getLI () const |
Return the LoopInfo used by thi object. | |
Private Types | |
using | CacheKey = std::pair< const llvm::SCEV *, llvm::BasicBlock * > |
Key to identify cached expressions. | |
Private Member Functions | |
llvm::Loop * | getScope () |
Return the loop for the current block if any. | |
PWACtx | getPWACtxFromPWA (isl::pw_aff PWA) |
Return a PWACtx for PWA that is always valid. | |
isl::pw_aff | addModuloSemantic (isl::pw_aff PWA, llvm::Type *ExprType) const |
Compute the non-wrapping version of PWA for type ExprType . | |
PWACtx | checkForWrapping (const llvm::SCEV *Expr, PWACtx PWAC) const |
If Expr might cause an integer wrap record an assumption. | |
bool | computeModuloForExpr (const llvm::SCEV *Expr) |
Whether to track the value of this expression precisely, rather than assuming it won't wrap. | |
PWACtx | visit (const llvm::SCEV *E) |
PWACtx | visitConstant (const llvm::SCEVConstant *E) |
PWACtx | visitVScale (const llvm::SCEVVScale *E) |
PWACtx | visitPtrToIntExpr (const llvm::SCEVPtrToIntExpr *E) |
PWACtx | visitTruncateExpr (const llvm::SCEVTruncateExpr *E) |
PWACtx | visitZeroExtendExpr (const llvm::SCEVZeroExtendExpr *E) |
PWACtx | visitSignExtendExpr (const llvm::SCEVSignExtendExpr *E) |
PWACtx | visitAddExpr (const llvm::SCEVAddExpr *E) |
PWACtx | visitMulExpr (const llvm::SCEVMulExpr *E) |
PWACtx | visitUDivExpr (const llvm::SCEVUDivExpr *E) |
PWACtx | visitAddRecExpr (const llvm::SCEVAddRecExpr *E) |
PWACtx | visitSMaxExpr (const llvm::SCEVSMaxExpr *E) |
PWACtx | visitSMinExpr (const llvm::SCEVSMinExpr *E) |
PWACtx | visitUMaxExpr (const llvm::SCEVUMaxExpr *E) |
PWACtx | visitUMinExpr (const llvm::SCEVUMinExpr *E) |
PWACtx | visitSequentialUMinExpr (const llvm::SCEVSequentialUMinExpr *E) |
PWACtx | visitUnknown (const llvm::SCEVUnknown *E) |
PWACtx | visitSDivInstruction (llvm::Instruction *SDiv) |
PWACtx | visitSRemInstruction (llvm::Instruction *SRem) |
PWACtx | complexityBailout () |
Private Attributes | |
llvm::DenseMap< CacheKey, PWACtx > | CachedExpressions |
Map to remembered cached expressions. | |
Scop * | S |
isl::ctx | Ctx |
unsigned | NumIterators |
llvm::ScalarEvolution & | SE |
llvm::LoopInfo & | LI |
llvm::BasicBlock * | BB |
RecordedAssumptionsTy * | RecordedAssumptions = nullptr |
const llvm::DataLayout & | TD |
Target data for element size computing. | |
Friends | |
struct | llvm::SCEVVisitor< SCEVAffinator, PWACtx > |
Translate a SCEV to an isl::pw_aff and the domain on which it is invalid.
Definition at line 30 of file SCEVAffinator.h.
|
private |
Key to identify cached expressions.
Definition at line 58 of file SCEVAffinator.h.
SCEVAffinator::SCEVAffinator | ( | Scop * | S, |
llvm::LoopInfo & | LI | ||
) |
Definition at line 83 of file SCEVAffinator.cpp.
|
private |
Compute the non-wrapping version of PWA
for type ExprType
.
PWA | The piece-wise affine function that might wrap. |
Type | The type of the SCEV that was translated to PWA . |
PWA
modulo the size constraints of ExprType
. Definition at line 159 of file SCEVAffinator.cpp.
References isl::pw_aff::add(), Ctx, Domain, isl::pw_aff::domain(), getWidthExpValOnDomain(), isl::val::int_from_ui(), isl::manage(), isl::multi_pw_aff::sub(), and TD.
Referenced by checkForWrapping(), and visit().
If Expr
might cause an integer wrap record an assumption.
Expr | The SCEV expression that might wrap. |
PWAC | The isl representation of Expr with the invalid domain. |
PWAC
with a possibly adjusted domain. Definition at line 131 of file SCEVAffinator.cpp.
References addModuloSemantic(), polly::AS_RESTRICTION, BB, isl::set::coalesce(), getNoWrapFlags(), IgnoreIntegerWrapping(), isl::set::is_empty(), isl::set::params(), polly::recordAssumption(), RecordedAssumptions, isl::set::unite(), and polly::WRAPPING.
Referenced by visit().
|
private |
Definition at line 574 of file SCEVAffinator.cpp.
References BB, polly::COMPLEXITY, SE, and visit().
Referenced by visitAddExpr(), visitMulExpr(), visitSMaxExpr(), and visitSMinExpr().
|
private |
Whether to track the value of this expression precisely, rather than assuming it won't wrap.
Definition at line 187 of file SCEVAffinator.cpp.
References MaxSmallBitWidth, and TD.
Referenced by visit(), visitTruncateExpr(), and visitZeroExtendExpr().
|
inline |
Return the LoopInfo used by thi object.
Definition at line 54 of file SCEVAffinator.h.
References LI.
Referenced by polly::Scop::getLI().
|
private |
Return a PWACtx for PWA
that is always valid.
Definition at line 112 of file SCEVAffinator.cpp.
References Ctx, isl::set::empty(), and NumIterators.
Referenced by visit(), visitConstant(), and visitUnknown().
PWACtx SCEVAffinator::getPwAff | ( | const llvm::SCEV * | E, |
llvm::BasicBlock * | BB = nullptr , |
||
RecordedAssumptionsTy * | RecordedAssumptions = nullptr |
||
) |
Translate a SCEV to an isl::pw_aff.
E | he expression that is translated. |
BB | The block in which E is executed. |
E
in Domain
. Definition at line 116 of file SCEVAffinator.cpp.
References BB, isl_set_free(), isl_set_n_dim(), NumIterators, RecordedAssumptions, and visit().
Referenced by polly::Scop::getPwAff().
|
private |
Return the loop for the current block if any.
Definition at line 87 of file SCEVAffinator.cpp.
Referenced by visit(), visitSDivInstruction(), visitSRemInstruction(), and visitUnknown().
bool SCEVAffinator::hasNSWAddRecForLoop | ( | llvm::Loop * | L | ) | const |
Check an <nsw> AddRec for the loop L
is cached.
Definition at line 173 of file SCEVAffinator.cpp.
References CachedExpressions.
Referenced by polly::Scop::hasNSWAddRecForLoop().
void SCEVAffinator::interpretAsUnsigned | ( | PWACtx & | PWAC, |
unsigned | Width | ||
) |
Interpret the PWA in PWAC
as an unsigned value.
Definition at line 89 of file SCEVAffinator.cpp.
References getWidthExpValOnDomain(), isl_pw_aff_add(), isl_pw_aff_intersect_domain(), isl_pw_aff_nonneg_set(), isl_pw_aff_union_add(), isl_set_complement(), isl_set_copy(), and isl::manage().
Referenced by visitZeroExtendExpr().
void SCEVAffinator::takeNonNegativeAssumption | ( | PWACtx & | PWAC, |
RecordedAssumptionsTy * | RecordedAssumptions = nullptr |
||
) |
Take the assumption that PWAC
is non-negative.
Definition at line 98 of file SCEVAffinator.cpp.
References polly::AS_RESTRICTION, BB, isl_pw_aff_neg(), isl_pw_aff_pos_set(), isl_set_copy(), isl_set_params(), isl_set_union(), isl::manage(), polly::recordAssumption(), RecordedAssumptions, and polly::UNSIGNED.
Referenced by polly::Scop::getPwAff(), visitUDivExpr(), and visitZeroExtendExpr().
|
private |
Definition at line 196 of file SCEVAffinator.cpp.
References addModuloSemantic(), BB, CachedExpressions, checkForWrapping(), combine(), computeModuloForExpr(), Ctx, Domain, polly::extractConstantFactor(), isl::ctx::get(), polly::getParamsInAffineExpr(), getPWACtxFromPWA(), getScope(), isl_aff_add_coefficient_si(), isl_aff_zero_on_domain(), isl_dim_param, isl_local_space_from_space(), isl_pw_aff_alloc(), isl_pw_aff_mul(), isl_set_universe(), isl_space_copy(), isl_space_set_alloc(), isl_space_set_dim_id(), isl::manage(), NumIterators, SE, and visitConstant().
Referenced by complexityBailout(), getPwAff(), visitAddExpr(), visitAddRecExpr(), visitMulExpr(), visitPtrToIntExpr(), visitSDivInstruction(), visitSignExtendExpr(), visitSMaxExpr(), visitSMinExpr(), visitSRemInstruction(), visitTruncateExpr(), visitUDivExpr(), visitUnknown(), and visitZeroExtendExpr().
|
private |
Definition at line 377 of file SCEVAffinator.cpp.
References combine(), complexityBailout(), isl_pw_aff_add(), isTooComplex(), and visit().
|
private |
Definition at line 401 of file SCEVAffinator.cpp.
References assert, combine(), Ctx, isl::ctx::get(), isl_aff_set_coefficient_si(), isl_aff_zero_on_domain(), isl_dim_in, isl_local_space_from_space(), isl_pw_aff_add(), isl_pw_aff_from_aff(), isl_space_set_alloc(), isl::manage(), NumIterators, SE, and visit().
|
private |
Definition at line 247 of file SCEVAffinator.cpp.
References Ctx, isl::ctx::get(), getPWACtxFromPWA(), isl_aff_val_on_domain(), isl_local_space_from_space(), isl_pw_aff_from_aff(), isl_space_set_alloc(), polly::isl_valFromAPInt(), isl::manage(), NumIterators, and polly::Value.
Referenced by visit().
|
private |
Definition at line 389 of file SCEVAffinator.cpp.
References combine(), complexityBailout(), isl_pw_aff_mul(), isTooComplex(), and visit().
|
private |
Definition at line 273 of file SCEVAffinator.cpp.
References visit().
|
private |
Definition at line 515 of file SCEVAffinator.cpp.
References assert, combine(), getScope(), isl_pw_aff_tdiv_q(), SE, and visit().
Referenced by visitUnknown().
|
private |
Definition at line 473 of file SCEVAffinator.cpp.
|
private |
Definition at line 372 of file SCEVAffinator.cpp.
References visit().
|
private |
Definition at line 440 of file SCEVAffinator.cpp.
References combine(), complexityBailout(), isl_pw_aff_max(), isTooComplex(), and visit().
|
private |
Definition at line 452 of file SCEVAffinator.cpp.
References combine(), complexityBailout(), isl_pw_aff_min(), isTooComplex(), and visit().
|
private |
Definition at line 532 of file SCEVAffinator.cpp.
References assert, combine(), getScope(), isl_pw_aff_tdiv_r(), SE, and visit().
Referenced by visitUnknown().
|
private |
Definition at line 277 of file SCEVAffinator.cpp.
References polly::AS_RESTRICTION, assert, BB, computeModuloForExpr(), getWidthExpValOnDomain(), isl_dim_set, isl_pw_aff_copy(), isl_pw_aff_ge_set(), isl_pw_aff_lt_set(), isl_pw_aff_neg(), isl_set_dim(), isl_set_params(), isl_set_union(), isl::manage(), isl::manage_copy(), polly::recordAssumption(), RecordedAssumptions, TD, polly::UNSIGNED, and visit().
|
private |
Definition at line 477 of file SCEVAffinator.cpp.
References assert, combine(), getWidthExpValOnDomain(), isl_pw_aff_div(), isl::manage(), RecordedAssumptions, SE, takeNonNegativeAssumption(), TD, and visit().
|
private |
Definition at line 464 of file SCEVAffinator.cpp.
|
private |
Definition at line 468 of file SCEVAffinator.cpp.
|
private |
Definition at line 549 of file SCEVAffinator.cpp.
References Ctx, getPWACtxFromPWA(), getScope(), NumIterators, SE, visit(), visitSDivInstruction(), and visitSRemInstruction().
|
private |
Definition at line 269 of file SCEVAffinator.cpp.
|
private |
Definition at line 312 of file SCEVAffinator.cpp.
References computeModuloForExpr(), interpretAsUnsigned(), RecordedAssumptions, takeNonNegativeAssumption(), TD, and visit().
|
friend |
Definition at line 119 of file SCEVAffinator.h.
|
private |
Definition at line 68 of file SCEVAffinator.h.
Referenced by checkForWrapping(), complexityBailout(), getPwAff(), getScope(), takeNonNegativeAssumption(), visit(), and visitTruncateExpr().
Map to remembered cached expressions.
Definition at line 61 of file SCEVAffinator.h.
Referenced by hasNSWAddRecForLoop(), and visit().
|
private |
Definition at line 64 of file SCEVAffinator.h.
Referenced by addModuloSemantic(), getPWACtxFromPWA(), visit(), visitAddRecExpr(), visitConstant(), and visitUnknown().
|
private |
Definition at line 67 of file SCEVAffinator.h.
Referenced by getLI(), and getScope().
|
private |
Definition at line 65 of file SCEVAffinator.h.
Referenced by getPWACtxFromPWA(), getPwAff(), visit(), visitAddRecExpr(), visitConstant(), and visitUnknown().
|
private |
Definition at line 69 of file SCEVAffinator.h.
Referenced by checkForWrapping(), getPwAff(), takeNonNegativeAssumption(), visitTruncateExpr(), visitUDivExpr(), and visitZeroExtendExpr().
|
private |
Definition at line 63 of file SCEVAffinator.h.
|
private |
Definition at line 66 of file SCEVAffinator.h.
Referenced by complexityBailout(), visit(), visitAddRecExpr(), visitSDivInstruction(), visitSRemInstruction(), visitUDivExpr(), and visitUnknown().
|
private |
Target data for element size computing.
Definition at line 72 of file SCEVAffinator.h.
Referenced by addModuloSemantic(), computeModuloForExpr(), visitTruncateExpr(), visitUDivExpr(), and visitZeroExtendExpr().