Polly 19.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
polly::VirtualUse Class Referencefinal

Determine the nature of a value's use within a statement. More...

#include <VirtualInstruction.h>

Public Types

enum  UseKind {
  Constant , Block , Synthesizable , Hoisted ,
  ReadOnly , Intra , Inter
}
 The different types of uses. More...
 

Public Member Functions

bool isConstant () const
 
bool isBlock () const
 
bool isSynthesizable () const
 
bool isHoisted () const
 
bool isReadOnly () const
 
bool isIntra () const
 
bool isInter () const
 
ScopStmtgetUser () const
 Return user statement.
 
llvm::Value * getValue () const
 Return the used value.
 
UseKind getKind () const
 Return the type of use.
 
const SCEV * getScevExpr () const
 Return the ScalarEvolution representation of Val.
 
MemoryAccessgetMemoryAccess () const
 Return the MemoryAccess that makes the value available in this statement, if any.
 
void print (raw_ostream &OS, bool Reproducible=true) const
 Print a description of this object.
 
void dump () const
 

Static Public Member Functions

static VirtualUse create (Scop *S, const Use &U, LoopInfo *LI, bool Virtual)
 Get a VirtualUse for an llvm::Use.
 
static VirtualUse create (Scop *S, ScopStmt *UserStmt, Loop *UserScope, Value *Val, bool Virtual)
 Get a VirtualUse for uses within statements.
 
static VirtualUse create (ScopStmt *UserStmt, Loop *UserScope, Value *Val, bool Virtual)
 

Private Member Functions

 VirtualUse (ScopStmt *User, Value *Val, UseKind Kind, const SCEV *ScevExpr, MemoryAccess *InputMA)
 

Private Attributes

ScopStmtUser
 The statement where a value is used.
 
Value * Val
 The value that is used.
 
UseKind Kind
 The type of value use.
 
const SCEV * ScevExpr
 The value represented as llvm::SCEV expression.
 
MemoryAccessInputMA
 If this is an inter-statement (or read-only) use, contains the MemoryAccess that makes the value available in this statement.
 

Detailed Description

Determine the nature of a value's use within a statement.

These are not always representable by llvm::Use. For instance, scalar write MemoryAccesses do use a value, but are not associated with an instruction's argument.

Despite its name it is not tied to virtual instructions (although it works fine with them), but to promote consistent handling of values used in statements.

Definition at line 31 of file VirtualInstruction.h.

Member Enumeration Documentation

◆ UseKind

The different types of uses.

Handling usually differentiates a lot between these; one can use a switch to handle each case (and get warned by the compiler if one is not handled).

Enumerator
Constant 
Block 
Synthesizable 
Hoisted 
ReadOnly 
Intra 
Inter 

Definition at line 36 of file VirtualInstruction.h.

Constructor & Destructor Documentation

◆ VirtualUse()

polly::VirtualUse::VirtualUse ( ScopStmt User,
Value *  Val,
UseKind  Kind,
const SCEV *  ScevExpr,
MemoryAccess InputMA 
)
inlineprivate

Definition at line 85 of file VirtualInstruction.h.

Member Function Documentation

◆ create() [1/3]

VirtualUse VirtualUse::create ( Scop S,
const Use &  U,
LoopInfo *  LI,
bool  Virtual 
)
static

Get a VirtualUse for an llvm::Use.

Parameters
SThe Scop object.
UThe llvm::Use the get information for.
LIThe LoopInfo analysis. Needed to determine whether the value is synthesizable.
VirtualWhether to ignore existing MemoryAccess.
Returns
The VirtualUse representing the same use as U.

Definition at line 19 of file VirtualInstruction.cpp.

References assert, create(), polly::ScopStmt::getEntryBlock(), polly::MemoryAccess::getStatement(), polly::getUseBlock(), Inter, Intra, and polly::PHI.

Referenced by create(), polly::ScopBuilder::ensureValueRead(), findReferencesByUse(), polly::BlockGenerator::getNewValue(), polly::ZoneAlgorithm::makeValInst(), polly::VirtualOperandIterator::operator*(), verifyUse(), verifyUses(), and walkReachable().

◆ create() [2/3]

VirtualUse VirtualUse::create ( Scop S,
ScopStmt UserStmt,
Loop *  UserScope,
Value *  Val,
bool  Virtual 
)
static

Get a VirtualUse for uses within statements.

It is assumed that the user is not a PHINode. Such uses are always VirtualUse::Inter unless in a regions statement.

Parameters
SThe Scop object.
UserStmtThe statement in which Val is used. Can be nullptr, in which case it assumed that the statement has been removed, which is only possible if no instruction in it had side-effects or computes a value used by another statement.
UserScopeLoop scope in which the value is used. Needed to determine whether the value is synthesizable.
ValThe value being used.
VirtualWhether to use (and prioritize over instruction location) information about MemoryAccesses.
Returns
A VirtualUse object that gives information about Val's use in UserStmt.

Definition at line 52 of file VirtualInstruction.cpp.

References assert, Block, polly::canSynthesize(), Constant, polly::ScopStmt::getParent(), Hoisted, InputMA, Inter, Intra, polly::ScopStmt::lookupValueReadOf(), ReadOnly, ScevExpr, Synthesizable, and Val.

◆ create() [3/3]

static VirtualUse polly::VirtualUse::create ( ScopStmt UserStmt,
Loop *  UserScope,
Value *  Val,
bool  Virtual 
)
inlinestatic

Definition at line 124 of file VirtualInstruction.h.

References create(), polly::ScopStmt::getParent(), and Val.

◆ dump()

LLVM_DUMP_METHOD void VirtualUse::dump ( ) const

Definition at line 148 of file VirtualInstruction.cpp.

References print().

◆ getKind()

UseKind polly::VirtualUse::getKind ( ) const
inline

Return the type of use.

Definition at line 144 of file VirtualInstruction.h.

References Kind.

Referenced by findReferencesByUse().

◆ getMemoryAccess()

MemoryAccess * polly::VirtualUse::getMemoryAccess ( ) const
inline

Return the MemoryAccess that makes the value available in this statement, if any.

Definition at line 151 of file VirtualInstruction.h.

References InputMA.

◆ getScevExpr()

const SCEV * polly::VirtualUse::getScevExpr ( ) const
inline

Return the ScalarEvolution representation of Val.

Definition at line 147 of file VirtualInstruction.h.

References ScevExpr.

Referenced by findReferencesByUse().

◆ getUser()

ScopStmt * polly::VirtualUse::getUser ( ) const
inline

Return user statement.

Definition at line 138 of file VirtualInstruction.h.

References User.

◆ getValue()

llvm::Value * polly::VirtualUse::getValue ( ) const
inline

Return the used value.

Definition at line 141 of file VirtualInstruction.h.

References Val.

◆ isBlock()

bool polly::VirtualUse::isBlock ( ) const
inline

Definition at line 130 of file VirtualInstruction.h.

References Block.

◆ isConstant()

bool polly::VirtualUse::isConstant ( ) const
inline

Definition at line 129 of file VirtualInstruction.h.

References Constant.

◆ isHoisted()

bool polly::VirtualUse::isHoisted ( ) const
inline

Definition at line 132 of file VirtualInstruction.h.

References Hoisted.

◆ isInter()

bool polly::VirtualUse::isInter ( ) const
inline

Definition at line 135 of file VirtualInstruction.h.

References Inter.

◆ isIntra()

bool polly::VirtualUse::isIntra ( ) const
inline

Definition at line 134 of file VirtualInstruction.h.

References Intra.

◆ isReadOnly()

bool polly::VirtualUse::isReadOnly ( ) const
inline

Definition at line 133 of file VirtualInstruction.h.

References ReadOnly.

◆ isSynthesizable()

bool polly::VirtualUse::isSynthesizable ( ) const
inline

Definition at line 131 of file VirtualInstruction.h.

References Synthesizable.

◆ print()

void VirtualUse::print ( raw_ostream &  OS,
bool  Reproducible = true 
) const

Print a description of this object.

Parameters
OSStream to print to.
ReproducibleIf true, ensures that the output is stable between runs and is suitable to check in regression tests. This excludes printing e.g. pointer values. If false, the output should not be used for regression tests, but may contain more information useful in debugger sessions.

Definition at line 106 of file VirtualInstruction.cpp.

References Block, Constant, polly::ScopStmt::getBaseName(), Hoisted, InputMA, Inter, Intra, ReadOnly, ScevExpr, Synthesizable, User, and Val.

Referenced by dump().

Member Data Documentation

◆ InputMA

MemoryAccess* polly::VirtualUse::InputMA
private

If this is an inter-statement (or read-only) use, contains the MemoryAccess that makes the value available in this statement.

In case of intra-statement uses, can contain a MemoryKind::Array access. In all other cases, it is a nullptr.

Definition at line 83 of file VirtualInstruction.h.

Referenced by create(), getMemoryAccess(), and print().

◆ Kind

UseKind polly::VirtualUse::Kind
private

The type of value use.

Definition at line 74 of file VirtualInstruction.h.

Referenced by getKind().

◆ ScevExpr

const SCEV* polly::VirtualUse::ScevExpr
private

The value represented as llvm::SCEV expression.

Definition at line 77 of file VirtualInstruction.h.

Referenced by create(), getScevExpr(), and print().

◆ User

ScopStmt* polly::VirtualUse::User
private

The statement where a value is used.

Definition at line 68 of file VirtualInstruction.h.

Referenced by getUser(), and print().

◆ Val

Value* polly::VirtualUse::Val
private

The value that is used.

Definition at line 71 of file VirtualInstruction.h.

Referenced by create(), getValue(), and print().


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