Polly 20.0.0git
Functions
VirtualInstruction.cpp File Reference
#include "polly/Support/VirtualInstruction.h"

Go to the source code of this file.

Functions

static bool isRoot (const Instruction *Inst)
 Return true if Inst cannot be removed, even if it is nowhere referenced.
 
static bool isEscaping (MemoryAccess *MA)
 Return true for MemoryAccesses that cannot be removed because it represents an llvm::Value that is used after the SCoP.
 
static void addInstructionRoots (ScopStmt *Stmt, SmallVectorImpl< VirtualInstruction > &RootInsts)
 Add non-removable virtual instructions in Stmt to RootInsts.
 
static void addAccessRoots (ScopStmt *Stmt, SmallVectorImpl< MemoryAccess * > &RootAccs, bool Local)
 Add non-removable memory accesses in Stmt to RootInsts.
 
static void addRoots (ScopStmt *Stmt, SmallVectorImpl< VirtualInstruction > &RootInsts, SmallVectorImpl< MemoryAccess * > &RootAccs, bool Local)
 Determine all instruction and access roots.
 
static void walkReachable (Scop *S, LoopInfo *LI, ArrayRef< VirtualInstruction > RootInsts, ArrayRef< MemoryAccess * > RootAccs, DenseSet< VirtualInstruction > &UsedInsts, DenseSet< MemoryAccess * > &UsedAccs, ScopStmt *OnlyLocal=nullptr)
 Mark accesses and instructions as used if they are reachable from a root, walking the operand trees.
 

Function Documentation

◆ addAccessRoots()

static void addAccessRoots ( ScopStmt Stmt,
SmallVectorImpl< MemoryAccess * > &  RootAccs,
bool  Local 
)
static

Add non-removable memory accesses in Stmt to RootInsts.

Parameters
LocalIf true, all writes are assumed to escape. markAndSweep algorithms can use this to be applicable to a single ScopStmt only without the risk of removing definitions required by other statements. If false, only writes for SCoP-escaping values are roots. This is global mode, where such writes must be marked by theirs uses in order to be reachable.

Definition at line 228 of file VirtualInstruction.cpp.

References isEscaping().

Referenced by addRoots().

◆ addInstructionRoots()

static void addInstructionRoots ( ScopStmt Stmt,
SmallVectorImpl< VirtualInstruction > &  RootInsts 
)
static

Add non-removable virtual instructions in Stmt to RootInsts.

Definition at line 200 of file VirtualInstruction.cpp.

References polly::ScopStmt::getInstructions(), polly::ScopStmt::getRegion(), polly::ScopStmt::isBlockStmt(), and isRoot().

Referenced by addRoots().

◆ addRoots()

static void addRoots ( ScopStmt Stmt,
SmallVectorImpl< VirtualInstruction > &  RootInsts,
SmallVectorImpl< MemoryAccess * > &  RootAccs,
bool  Local 
)
static

Determine all instruction and access roots.

Definition at line 257 of file VirtualInstruction.cpp.

References addAccessRoots(), and addInstructionRoots().

Referenced by polly::markReachable().

◆ isEscaping()

static bool isEscaping ( MemoryAccess MA)
static

Return true for MemoryAccesses that cannot be removed because it represents an llvm::Value that is used after the SCoP.

Definition at line 192 of file VirtualInstruction.cpp.

References assert, polly::MemoryAccess::getAccessValue(), polly::ScopStmt::getParent(), polly::MemoryAccess::getStatement(), and polly::MemoryAccess::isOriginalValueKind().

Referenced by addAccessRoots().

◆ isRoot()

static bool isRoot ( const Instruction *  Inst)
static

Return true if Inst cannot be removed, even if it is nowhere referenced.

Definition at line 172 of file VirtualInstruction.cpp.

Referenced by addInstructionRoots().

◆ walkReachable()

static void walkReachable ( Scop S,
LoopInfo *  LI,
ArrayRef< VirtualInstruction RootInsts,
ArrayRef< MemoryAccess * >  RootAccs,
DenseSet< VirtualInstruction > &  UsedInsts,
DenseSet< MemoryAccess * > &  UsedAccs,
ScopStmt OnlyLocal = nullptr 
)
static

Mark accesses and instructions as used if they are reachable from a root, walking the operand trees.

Parameters
SThe SCoP to walk.
LIThe LoopInfo Analysis.
RootInstsList of root instructions.
RootAccsList of root accesses.
UsesInsts[out]Receives all reachable instructions, including the roots.
UsedAccs[out]Receives all reachable accesses, including the roots.
OnlyLocalIf non-nullptr, restricts walking to a single statement.

Definition at line 276 of file VirtualInstruction.cpp.

References assert, polly::VirtualUse::Block, polly::VirtualUse::Constant, polly::VirtualUse::create(), polly::ScopStmt::getEntryBlock(), polly::VirtualInstruction::getInstruction(), polly::VirtualInstruction::getStmt(), polly::ScopStmt::getSurroundingLoop(), polly::VirtualUse::Hoisted, polly::VirtualUse::Inter, polly::VirtualUse::Intra, polly::ScopStmt::lookupArrayAccessesFor(), polly::ScopStmt::lookupPHIReadOf(), polly::VirtualInstruction::operands(), polly::PHI, polly::VirtualUse::ReadOnly, and polly::VirtualUse::Synthesizable.

Referenced by polly::markReachable().