Polly 20.0.0git
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
polly::SCEVAffinator Class Referencefinal

Translate a SCEV to an isl::pw_aff and the domain on which it is invalid. More...

#include <SCEVAffinator.h>

Inheritance diagram for polly::SCEVAffinator:
Inheritance graph
[legend]

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, PWACtxCachedExpressions
 Map to remembered cached expressions.
 
ScopS
 
isl::ctx Ctx
 
unsigned NumIterators
 
llvm::ScalarEvolution & SE
 
llvm::LoopInfo & LI
 
llvm::BasicBlock * BB
 
RecordedAssumptionsTyRecordedAssumptions = nullptr
 
const llvm::DataLayout & TD
 Target data for element size computing.
 

Friends

struct llvm::SCEVVisitor< SCEVAffinator, PWACtx >
 

Detailed Description

Translate a SCEV to an isl::pw_aff and the domain on which it is invalid.

Definition at line 30 of file SCEVAffinator.h.

Member Typedef Documentation

◆ CacheKey

using polly::SCEVAffinator::CacheKey = std::pair<const llvm::SCEV *, llvm::BasicBlock *>
private

Key to identify cached expressions.

Definition at line 58 of file SCEVAffinator.h.

Constructor & Destructor Documentation

◆ SCEVAffinator()

SCEVAffinator::SCEVAffinator ( Scop S,
llvm::LoopInfo &  LI 
)

Definition at line 84 of file SCEVAffinator.cpp.

Member Function Documentation

◆ addModuloSemantic()

isl::pw_aff SCEVAffinator::addModuloSemantic ( isl::pw_aff  PWA,
llvm::Type *  ExprType 
) const
private

Compute the non-wrapping version of PWA for type ExprType.

Parameters
PWAThe piece-wise affine function that might wrap.
TypeThe type of the SCEV that was translated to PWA.
Returns
The expr PWA modulo the size constraints of ExprType.

Definition at line 160 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().

◆ checkForWrapping()

PWACtx SCEVAffinator::checkForWrapping ( const llvm::SCEV *  Expr,
PWACtx  PWAC 
) const
private

If Expr might cause an integer wrap record an assumption.

Parameters
ExprThe SCEV expression that might wrap.
PWACThe isl representation of Expr with the invalid domain.
Returns
The isl representation PWAC with a possibly adjusted domain.

Definition at line 132 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().

◆ complexityBailout()

PWACtx SCEVAffinator::complexityBailout ( )
private

Definition at line 575 of file SCEVAffinator.cpp.

References BB, polly::COMPLEXITY, SE, and visit().

Referenced by visitAddExpr(), visitMulExpr(), visitSMaxExpr(), and visitSMinExpr().

◆ computeModuloForExpr()

bool SCEVAffinator::computeModuloForExpr ( const llvm::SCEV *  Expr)
private

Whether to track the value of this expression precisely, rather than assuming it won't wrap.

Definition at line 188 of file SCEVAffinator.cpp.

References MaxSmallBitWidth, and TD.

Referenced by visit(), visitTruncateExpr(), and visitZeroExtendExpr().

◆ getLI()

llvm::LoopInfo * polly::SCEVAffinator::getLI ( ) const
inline

Return the LoopInfo used by thi object.

Definition at line 54 of file SCEVAffinator.h.

References LI.

Referenced by polly::Scop::getLI().

◆ getPWACtxFromPWA()

PWACtx SCEVAffinator::getPWACtxFromPWA ( isl::pw_aff  PWA)
private

Return a PWACtx for PWA that is always valid.

Definition at line 113 of file SCEVAffinator.cpp.

References Ctx, isl::set::empty(), and NumIterators.

Referenced by visit(), visitConstant(), and visitUnknown().

◆ getPwAff()

PWACtx SCEVAffinator::getPwAff ( const llvm::SCEV *  E,
llvm::BasicBlock *  BB = nullptr,
RecordedAssumptionsTy RecordedAssumptions = nullptr 
)

Translate a SCEV to an isl::pw_aff.

Parameters
Ehe expression that is translated.
BBThe block in which E is executed.
Returns
The isl representation of the SCEV E in Domain.

Definition at line 117 of file SCEVAffinator.cpp.

References BB, isl_set_free(), isl_set_n_dim(), NumIterators, RecordedAssumptions, and visit().

Referenced by polly::Scop::getPwAff().

◆ getScope()

Loop * SCEVAffinator::getScope ( )
private

Return the loop for the current block if any.

Definition at line 88 of file SCEVAffinator.cpp.

References BB, and LI.

Referenced by visit(), visitSDivInstruction(), visitSRemInstruction(), and visitUnknown().

◆ hasNSWAddRecForLoop()

bool SCEVAffinator::hasNSWAddRecForLoop ( llvm::Loop *  L) const

Check an <nsw> AddRec for the loop L is cached.

Definition at line 174 of file SCEVAffinator.cpp.

References CachedExpressions.

Referenced by polly::Scop::hasNSWAddRecForLoop().

◆ interpretAsUnsigned()

void SCEVAffinator::interpretAsUnsigned ( PWACtx PWAC,
unsigned  Width 
)

◆ takeNonNegativeAssumption()

void SCEVAffinator::takeNonNegativeAssumption ( PWACtx PWAC,
RecordedAssumptionsTy RecordedAssumptions = nullptr 
)

◆ visit()

PWACtx SCEVAffinator::visit ( const llvm::SCEV *  E)
private

◆ visitAddExpr()

PWACtx SCEVAffinator::visitAddExpr ( const llvm::SCEVAddExpr *  E)
private

◆ visitAddRecExpr()

PWACtx SCEVAffinator::visitAddRecExpr ( const llvm::SCEVAddRecExpr *  E)
private

◆ visitConstant()

PWACtx SCEVAffinator::visitConstant ( const llvm::SCEVConstant *  E)
private

◆ visitMulExpr()

PWACtx SCEVAffinator::visitMulExpr ( const llvm::SCEVMulExpr *  E)
private

◆ visitPtrToIntExpr()

PWACtx SCEVAffinator::visitPtrToIntExpr ( const llvm::SCEVPtrToIntExpr *  E)
private

Definition at line 274 of file SCEVAffinator.cpp.

References visit().

◆ visitSDivInstruction()

PWACtx SCEVAffinator::visitSDivInstruction ( llvm::Instruction *  SDiv)
private

Definition at line 516 of file SCEVAffinator.cpp.

References assert, combine(), getScope(), isl_pw_aff_tdiv_q(), SE, and visit().

Referenced by visitUnknown().

◆ visitSequentialUMinExpr()

PWACtx SCEVAffinator::visitSequentialUMinExpr ( const llvm::SCEVSequentialUMinExpr *  E)
private

Definition at line 474 of file SCEVAffinator.cpp.

◆ visitSignExtendExpr()

PWACtx SCEVAffinator::visitSignExtendExpr ( const llvm::SCEVSignExtendExpr *  E)
private

Definition at line 373 of file SCEVAffinator.cpp.

References visit().

◆ visitSMaxExpr()

PWACtx SCEVAffinator::visitSMaxExpr ( const llvm::SCEVSMaxExpr *  E)
private

◆ visitSMinExpr()

PWACtx SCEVAffinator::visitSMinExpr ( const llvm::SCEVSMinExpr *  E)
private

◆ visitSRemInstruction()

PWACtx SCEVAffinator::visitSRemInstruction ( llvm::Instruction *  SRem)
private

Definition at line 533 of file SCEVAffinator.cpp.

References assert, combine(), getScope(), isl_pw_aff_tdiv_r(), SE, and visit().

Referenced by visitUnknown().

◆ visitTruncateExpr()

PWACtx SCEVAffinator::visitTruncateExpr ( const llvm::SCEVTruncateExpr *  E)
private

◆ visitUDivExpr()

PWACtx SCEVAffinator::visitUDivExpr ( const llvm::SCEVUDivExpr *  E)
private

◆ visitUMaxExpr()

PWACtx SCEVAffinator::visitUMaxExpr ( const llvm::SCEVUMaxExpr *  E)
private

Definition at line 465 of file SCEVAffinator.cpp.

◆ visitUMinExpr()

PWACtx SCEVAffinator::visitUMinExpr ( const llvm::SCEVUMinExpr *  E)
private

Definition at line 469 of file SCEVAffinator.cpp.

◆ visitUnknown()

PWACtx SCEVAffinator::visitUnknown ( const llvm::SCEVUnknown *  E)
private

◆ visitVScale()

PWACtx SCEVAffinator::visitVScale ( const llvm::SCEVVScale *  E)
private

Definition at line 270 of file SCEVAffinator.cpp.

◆ visitZeroExtendExpr()

PWACtx SCEVAffinator::visitZeroExtendExpr ( const llvm::SCEVZeroExtendExpr *  E)
private

Friends And Related Function Documentation

◆ llvm::SCEVVisitor< SCEVAffinator, PWACtx >

friend struct llvm::SCEVVisitor< SCEVAffinator, PWACtx >
friend

Definition at line 119 of file SCEVAffinator.h.

Member Data Documentation

◆ BB

llvm::BasicBlock* polly::SCEVAffinator::BB
private

◆ CachedExpressions

llvm::DenseMap<CacheKey, PWACtx> polly::SCEVAffinator::CachedExpressions
private

Map to remembered cached expressions.

Definition at line 61 of file SCEVAffinator.h.

Referenced by hasNSWAddRecForLoop(), and visit().

◆ Ctx

isl::ctx polly::SCEVAffinator::Ctx
private

◆ LI

llvm::LoopInfo& polly::SCEVAffinator::LI
private

Definition at line 67 of file SCEVAffinator.h.

Referenced by getLI(), and getScope().

◆ NumIterators

unsigned polly::SCEVAffinator::NumIterators
private

◆ RecordedAssumptions

RecordedAssumptionsTy* polly::SCEVAffinator::RecordedAssumptions = nullptr
private

◆ S

Scop* polly::SCEVAffinator::S
private

Definition at line 63 of file SCEVAffinator.h.

◆ SE

llvm::ScalarEvolution& polly::SCEVAffinator::SE
private

◆ TD

const llvm::DataLayout& polly::SCEVAffinator::TD
private

Target data for element size computing.

Definition at line 72 of file SCEVAffinator.h.

Referenced by addModuloSemantic(), computeModuloForExpr(), visitTruncateExpr(), visitUDivExpr(), and visitZeroExtendExpr().


The documentation for this class was generated from the following files: