Polly 20.0.0git
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ScopExpander Struct Referencefinal

ScopExpander generates IR the the value of a SCEV that represents a value from a SCoP. More...

Inheritance diagram for ScopExpander:
Inheritance graph
[legend]

Public Member Functions

 ScopExpander (const Region &R, ScalarEvolution &SE, Function *GenFn, ScalarEvolution &GenSE, const DataLayout &DL, const char *Name, ValueMapT *VMap, LoopToScevMapT *LoopMap, BasicBlock *RTCBB)
 
Value * expandCodeFor (const SCEV *E, Type *Ty, Instruction *IP)
 
const SCEV * visit (const SCEV *E)
 

Private Member Functions

bool isInOrigRegion (Instruction *Inst)
 Is the instruction part of the original SCoP (in contrast to be located in the code-generated region)?
 
bool isInGenRegion (Instruction *Inst)
 
const SCEV * visitGenericInst (const SCEVUnknown *E, Instruction *Inst, Instruction *IP)
 
const SCEV * visitUnknown (const SCEVUnknown *E)
 
const SCEV * visitConstant (const SCEVConstant *E)
 The following functions will just traverse the SCEV and rebuild it using GenSE and the new operands returned by the traversal.
 
const SCEV * visitVScale (const SCEVVScale *E)
 
const SCEV * visitPtrToIntExpr (const SCEVPtrToIntExpr *E)
 
const SCEV * visitTruncateExpr (const SCEVTruncateExpr *E)
 
const SCEV * visitZeroExtendExpr (const SCEVZeroExtendExpr *E)
 
const SCEV * visitSignExtendExpr (const SCEVSignExtendExpr *E)
 
const SCEV * visitUDivExpr (const SCEVUDivExpr *E)
 
const SCEV * visitAddExpr (const SCEVAddExpr *E)
 
const SCEV * visitMulExpr (const SCEVMulExpr *E)
 
const SCEV * visitUMaxExpr (const SCEVUMaxExpr *E)
 
const SCEV * visitSMaxExpr (const SCEVSMaxExpr *E)
 
const SCEV * visitUMinExpr (const SCEVUMinExpr *E)
 
const SCEV * visitSMinExpr (const SCEVSMinExpr *E)
 
const SCEV * visitSequentialUMinExpr (const SCEVSequentialUMinExpr *E)
 
const SCEV * visitAddRecExpr (const SCEVAddRecExpr *E)
 

Private Attributes

SCEVExpander Expander
 
const char * Name
 
const Region & R
 
ValueMapTVMap
 
LoopToScevMapTLoopMap
 
BasicBlock * RTCBB
 
DenseMap< const SCEV *, const SCEV * > SCEVCache
 
ScalarEvolution & GenSE
 
Function * GenFn
 

Friends

struct SCEVVisitor< ScopExpander, const SCEV * >
 

Detailed Description

ScopExpander generates IR the the value of a SCEV that represents a value from a SCoP.

IMPORTANT: There are two ScalarEvolutions at play here. First, the SE that was used to analyze the original SCoP (not actually referenced anywhere here, but passed as argument to make the distinction clear). Second, GenSE which is the SE for the function that the code is emitted into. SE and GenSE may be different when the generated code is to be emitted into an outlined function, e.g. for a parallel loop. That is, each SCEV is to be used only by the SE that "owns" it and ScopExpander handles the translation between them. The SCEVVisitor methods are only to be called on SCEVs of the original SE. Their job is to create a new SCEV for GenSE. The nested SCEVExpander is to be used only with SCEVs belonging to GenSE. Currently SCEVs do not store a reference to the ScalarEvolution they belong to, so a mixup does not immediately cause a crash but certainly is a violation of its interface.

The SCEVExpander will not generate any code for an existing SDiv/SRem instruction but just use it, if it is referenced as a SCEVUnknown. We want however to generate new code if the instruction is in the analyzed region and we generate code outside/in front of that region. Hence, we generate the code for the SDiv/SRem operands in front of the analyzed region and then create a new SDiv/SRem operation there too.

Definition at line 253 of file ScopHelper.cpp.

Constructor & Destructor Documentation

◆ ScopExpander()

ScopExpander::ScopExpander ( const Region &  R,
ScalarEvolution &  SE,
Function *  GenFn,
ScalarEvolution &  GenSE,
const DataLayout &  DL,
const char *  Name,
ValueMapT VMap,
LoopToScevMapT LoopMap,
BasicBlock *  RTCBB 
)
inlineexplicit

Definition at line 256 of file ScopHelper.cpp.

Member Function Documentation

◆ expandCodeFor()

Value * ScopExpander::expandCodeFor ( const SCEV *  E,
Type *  Ty,
Instruction *  IP 
)
inline

Definition at line 264 of file ScopHelper.cpp.

References assert, Expander, isInGenRegion(), polly::Value, and visit().

Referenced by visitGenericInst(), and visitUnknown().

◆ isInGenRegion()

bool ScopExpander::isInGenRegion ( Instruction *  Inst)
inlineprivate

Definition at line 305 of file ScopHelper.cpp.

References isInOrigRegion().

Referenced by expandCodeFor(), visitGenericInst(), and visitUnknown().

◆ isInOrigRegion()

bool ScopExpander::isInOrigRegion ( Instruction *  Inst)
inlineprivate

Is the instruction part of the original SCoP (in contrast to be located in the code-generated region)?

Definition at line 296 of file ScopHelper.cpp.

References assert, Function, GenFn, isInOrigRegion(), and R.

Referenced by isInGenRegion(), and isInOrigRegion().

◆ visit()

const SCEV * ScopExpander::visit ( const SCEV *  E)
inline

◆ visitAddExpr()

const SCEV * ScopExpander::visitAddExpr ( const SCEVAddExpr *  E)
inlineprivate

Definition at line 401 of file ScopHelper.cpp.

References GenSE, and visit().

◆ visitAddRecExpr()

const SCEV * ScopExpander::visitAddRecExpr ( const SCEVAddRecExpr *  E)
inlineprivate

Definition at line 443 of file ScopHelper.cpp.

References GenSE, LoopMap, and visit().

◆ visitConstant()

const SCEV * ScopExpander::visitConstant ( const SCEVConstant *  E)
inlineprivate

The following functions will just traverse the SCEV and rebuild it using GenSE and the new operands returned by the traversal.

{

Definition at line 381 of file ScopHelper.cpp.

◆ visitGenericInst()

const SCEV * ScopExpander::visitGenericInst ( const SCEVUnknown *  E,
Instruction *  Inst,
Instruction *  IP 
)
inlineprivate

Definition at line 307 of file ScopHelper.cpp.

References assert, expandCodeFor(), GenSE, isInGenRegion(), and Name.

Referenced by visitUnknown().

◆ visitMulExpr()

const SCEV * ScopExpander::visitMulExpr ( const SCEVMulExpr *  E)
inlineprivate

Definition at line 407 of file ScopHelper.cpp.

References GenSE, and visit().

◆ visitPtrToIntExpr()

const SCEV * ScopExpander::visitPtrToIntExpr ( const SCEVPtrToIntExpr *  E)
inlineprivate

Definition at line 383 of file ScopHelper.cpp.

References GenSE, and visit().

◆ visitSequentialUMinExpr()

const SCEV * ScopExpander::visitSequentialUMinExpr ( const SCEVSequentialUMinExpr *  E)
inlineprivate

Definition at line 437 of file ScopHelper.cpp.

References GenSE, and visit().

◆ visitSignExtendExpr()

const SCEV * ScopExpander::visitSignExtendExpr ( const SCEVSignExtendExpr *  E)
inlineprivate

Definition at line 392 of file ScopHelper.cpp.

References GenSE, and visit().

◆ visitSMaxExpr()

const SCEV * ScopExpander::visitSMaxExpr ( const SCEVSMaxExpr *  E)
inlineprivate

Definition at line 419 of file ScopHelper.cpp.

References GenSE, and visit().

◆ visitSMinExpr()

const SCEV * ScopExpander::visitSMinExpr ( const SCEVSMinExpr *  E)
inlineprivate

Definition at line 431 of file ScopHelper.cpp.

References GenSE, and visit().

◆ visitTruncateExpr()

const SCEV * ScopExpander::visitTruncateExpr ( const SCEVTruncateExpr *  E)
inlineprivate

Definition at line 386 of file ScopHelper.cpp.

References GenSE, and visit().

◆ visitUDivExpr()

const SCEV * ScopExpander::visitUDivExpr ( const SCEVUDivExpr *  E)
inlineprivate

Definition at line 395 of file ScopHelper.cpp.

References GenSE, and visit().

◆ visitUMaxExpr()

const SCEV * ScopExpander::visitUMaxExpr ( const SCEVUMaxExpr *  E)
inlineprivate

Definition at line 413 of file ScopHelper.cpp.

References GenSE, and visit().

◆ visitUMinExpr()

const SCEV * ScopExpander::visitUMinExpr ( const SCEVUMinExpr *  E)
inlineprivate

Definition at line 425 of file ScopHelper.cpp.

References GenSE, and visit().

◆ visitUnknown()

const SCEV * ScopExpander::visitUnknown ( const SCEVUnknown *  E)
inlineprivate

◆ visitVScale()

const SCEV * ScopExpander::visitVScale ( const SCEVVScale *  E)
inlineprivate

Definition at line 382 of file ScopHelper.cpp.

◆ visitZeroExtendExpr()

const SCEV * ScopExpander::visitZeroExtendExpr ( const SCEVZeroExtendExpr *  E)
inlineprivate

Definition at line 389 of file ScopHelper.cpp.

References GenSE, and visit().

Friends And Related Function Documentation

◆ SCEVVisitor< ScopExpander, const SCEV * >

friend struct SCEVVisitor< ScopExpander, const SCEV * >
friend

Definition at line 871 of file ScopHelper.cpp.

Member Data Documentation

◆ Expander

SCEVExpander ScopExpander::Expander
private

Definition at line 283 of file ScopHelper.cpp.

Referenced by expandCodeFor().

◆ GenFn

Function* ScopExpander::GenFn
private

Definition at line 292 of file ScopHelper.cpp.

Referenced by isInOrigRegion(), and visitUnknown().

◆ GenSE

ScalarEvolution& ScopExpander::GenSE
private

◆ LoopMap

LoopToScevMapT* ScopExpander::LoopMap
private

Definition at line 287 of file ScopHelper.cpp.

Referenced by visitAddRecExpr().

◆ Name

const char* ScopExpander::Name
private

Definition at line 284 of file ScopHelper.cpp.

Referenced by visitGenericInst(), and visitUnknown().

◆ R

const Region& ScopExpander::R
private

Definition at line 285 of file ScopHelper.cpp.

Referenced by isInOrigRegion(), and visitUnknown().

◆ RTCBB

BasicBlock* ScopExpander::RTCBB
private

Definition at line 288 of file ScopHelper.cpp.

Referenced by visitUnknown().

◆ SCEVCache

DenseMap<const SCEV *, const SCEV *> ScopExpander::SCEVCache
private

Definition at line 289 of file ScopHelper.cpp.

Referenced by visit().

◆ VMap

ValueMapT* ScopExpander::VMap
private

Definition at line 286 of file ScopHelper.cpp.

Referenced by visitUnknown().


The documentation for this struct was generated from the following file: