LLVM 20.0.0git
|
A possibly irreducible generalization of a Loop. More...
#include "llvm/ADT/GenericCycleInfo.h"
Classes | |
struct | const_child_iterator |
Public Types | |
using | BlockT = typename ContextT::BlockT |
using | FunctionT = typename ContextT::FunctionT |
using | const_child_iterator_base = typename std::vector< std::unique_ptr< GenericCycle > >::const_iterator |
Iteration over child cycles. | |
using | const_block_iterator = typename BlockSetVectorT::const_iterator |
Iteration over blocks in the cycle (including entry blocks). | |
using | const_entry_iterator = typename SmallVectorImpl< BlockT * >::const_iterator |
Iteration over entry blocks. | |
Public Member Functions | |
GenericCycle ()=default | |
bool | isReducible () const |
Whether the cycle is a natural loop. | |
BlockT * | getHeader () const |
const SmallVectorImpl< BlockT * > & | getEntries () const |
bool | isEntry (const BlockT *Block) const |
Return whether Block is an entry block of the cycle. | |
bool | contains (const BlockT *Block) const |
Return whether Block is contained in the cycle. | |
bool | contains (const GenericCycle *C) const |
Returns true iff this cycle contains C . | |
const GenericCycle * | getParentCycle () const |
GenericCycle * | getParentCycle () |
unsigned | getDepth () const |
void | getExitBlocks (SmallVectorImpl< BlockT * > &TmpStorage) const |
Return all of the successor blocks of this cycle. | |
void | getExitingBlocks (SmallVectorImpl< BlockT * > &TmpStorage) const |
Return all blocks of this cycle that have successor outside of this cycle. | |
BlockT * | getCyclePreheader () const |
Return the preheader block for this cycle. | |
BlockT * | getCyclePredecessor () const |
If the cycle has exactly one entry with exactly one predecessor, return it, otherwise return nullptr. | |
void | verifyCycle () const |
Verify that this is actually a well-formed cycle in the CFG. | |
void | verifyCycleNest () const |
Verify the parent-child relations of this cycle. | |
const_child_iterator | child_begin () const |
const_child_iterator | child_end () const |
size_t | getNumChildren () const |
iterator_range< const_child_iterator > | children () const |
const_block_iterator | block_begin () const |
const_block_iterator | block_end () const |
size_t | getNumBlocks () const |
iterator_range< const_block_iterator > | blocks () const |
size_t | getNumEntries () const |
iterator_range< const_entry_iterator > | entries () const |
Printable | printEntries (const ContextT &Ctx) const |
Printable | print (const ContextT &Ctx) const |
Friends | |
template<typename > | |
class | GenericCycleInfo |
template<typename > | |
class | GenericCycleInfoCompute |
A possibly irreducible generalization of a Loop.
Definition at line 44 of file GenericCycleInfo.h.
using llvm::GenericCycle< ContextT >::BlockT = typename ContextT::BlockT |
Definition at line 46 of file GenericCycleInfo.h.
using llvm::GenericCycle< ContextT >::const_block_iterator = typename BlockSetVectorT::const_iterator |
Iteration over blocks in the cycle (including entry blocks).
Definition at line 177 of file GenericCycleInfo.h.
using llvm::GenericCycle< ContextT >::const_child_iterator_base = typename std::vector<std::unique_ptr<GenericCycle> >::const_iterator |
Iteration over child cycles.
Definition at line 148 of file GenericCycleInfo.h.
using llvm::GenericCycle< ContextT >::const_entry_iterator = typename SmallVectorImpl<BlockT *>::const_iterator |
Iteration over entry blocks.
Definition at line 193 of file GenericCycleInfo.h.
using llvm::GenericCycle< ContextT >::FunctionT = typename ContextT::FunctionT |
Definition at line 47 of file GenericCycleInfo.h.
|
default |
|
inline |
Definition at line 179 of file GenericCycleInfo.h.
References Blocks.
Referenced by llvm::GenericCycle< ContextT >::blocks().
|
inline |
Definition at line 182 of file GenericCycleInfo.h.
References Blocks.
Referenced by llvm::GenericCycle< ContextT >::blocks().
|
inline |
Definition at line 186 of file GenericCycleInfo.h.
References llvm::GenericCycle< ContextT >::block_begin(), llvm::GenericCycle< ContextT >::block_end(), and llvm::make_range().
Referenced by llvm::GenericCycleInfo< ContextT >::verifyCycleNest().
|
inline |
Definition at line 162 of file GenericCycleInfo.h.
|
inline |
Definition at line 165 of file GenericCycleInfo.h.
|
inline |
Definition at line 169 of file GenericCycleInfo.h.
References llvm::make_range().
|
inline |
Return whether Block
is contained in the cycle.
Definition at line 111 of file GenericCycleInfo.h.
References llvm::Block, and Blocks.
Referenced by llvm::getExtDivCycle(), llvm::getIntDivCycle(), llvm::isCycleInvariant(), llvm::SIInstrInfo::isSafeToSink(), and llvm::GenericCycleInfo< ContextT >::verifyCycleNest().
bool llvm::GenericCycle< ContextT >::contains | ( | const GenericCycle< ContextT > * | C | ) | const |
Returns true iff this cycle contains C
.
Note: Non-strict containment check, i.e. returns true if C is the same cycle.
Definition at line 36 of file GenericCycleImpl.h.
References llvm::CallingConv::C, and llvm::Depth.
|
inline |
Definition at line 197 of file GenericCycleInfo.h.
References llvm::make_range().
auto llvm::GenericCycle< ContextT >::getCyclePredecessor |
If the cycle has exactly one entry with exactly one predecessor, return it, otherwise return nullptr.
Definition at line 104 of file GenericCycleImpl.h.
References contains(), and llvm::predecessors().
auto llvm::GenericCycle< ContextT >::getCyclePreheader |
Return the preheader block for this cycle.
Pre-header is well-defined for reducible cycle in docs/LoopTerminology.rst as: the only one entering block and its only edge is to the entry block. Return null for irreducible cycles.
Definition at line 86 of file GenericCycleImpl.h.
References assert(), and llvm::succ_size().
|
inline |
Definition at line 121 of file GenericCycleInfo.h.
References llvm::Depth.
Referenced by llvm::GenericCycleInfo< ContextT >::getCycleDepth().
|
inline |
Definition at line 101 of file GenericCycleInfo.h.
Referenced by llvm::isCycleInvariant().
void llvm::GenericCycle< ContextT >::getExitBlocks | ( | SmallVectorImpl< BlockT * > & | TmpStorage | ) | const |
Return all of the successor blocks of this cycle.
These are the blocks outside of the current cycle which are branched to.
Definition at line 48 of file GenericCycleImpl.h.
References llvm::append_range(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::Block, blocks, llvm::SmallVectorImpl< T >::clear(), contains(), End, Idx, llvm::SmallVectorImpl< T >::resize(), llvm::SmallVectorBase< Size_T >::size(), and llvm::successors().
Referenced by llvm::DivergencePropagator< ContextT >::computeJoinPoints().
void llvm::GenericCycle< ContextT >::getExitingBlocks | ( | SmallVectorImpl< BlockT * > & | TmpStorage | ) | const |
Return all blocks of this cycle that have successor outside of this cycle.
These blocks have cycle exit branch.
Definition at line 71 of file GenericCycleImpl.h.
References llvm::Block, blocks, llvm::SmallVectorImpl< T >::clear(), contains(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::successors().
Referenced by llvm::SIInstrInfo::isSafeToSink().
|
inline |
Definition at line 99 of file GenericCycleInfo.h.
Referenced by llvm::DivergencePropagator< ContextT >::computeJoinPoints(), llvm::getExtDivCycle(), llvm::getIntDivCycle(), and llvm::GenericCycleInfo< ContextT >::verifyCycleNest().
|
inline |
Definition at line 185 of file GenericCycleInfo.h.
References Blocks.
|
inline |
Definition at line 168 of file GenericCycleInfo.h.
|
inline |
Definition at line 196 of file GenericCycleInfo.h.
|
inline |
Definition at line 120 of file GenericCycleInfo.h.
|
inline |
Definition at line 119 of file GenericCycleInfo.h.
Referenced by llvm::DivergencePropagator< ContextT >::computeJoinPoints(), llvm::getExtDivCycle(), llvm::getIntDivCycle(), and llvm::SIInstrInfo::isSafeToSink().
|
inline |
Return whether Block
is an entry block of the cycle.
Definition at line 106 of file GenericCycleInfo.h.
References llvm::Block, and llvm::is_contained().
Referenced by llvm::GenericCycle< ContextT >::print().
|
inline |
Whether the cycle is a natural loop.
Definition at line 97 of file GenericCycleInfo.h.
Referenced by llvm::DivergencePropagator< ContextT >::computeJoinPoints(), llvm::getExtDivCycle(), and llvm::getIntDivCycle().
|
inline |
Definition at line 214 of file GenericCycleInfo.h.
References llvm::Block, Blocks, llvm::Depth, llvm::GenericCycle< ContextT >::isEntry(), and llvm::GenericCycle< ContextT >::printEntries().
Referenced by llvm::GenericCycleInfo< ContextT >::print().
|
inline |
Definition at line 202 of file GenericCycleInfo.h.
References llvm::First.
Referenced by llvm::GenericCycle< ContextT >::print().
void llvm::GenericCycle< ContextT >::verifyCycle |
Verify that this is actually a well-formed cycle in the CFG.
Definition at line 124 of file GenericCycleImpl.h.
References llvm::any_of(), assert(), B, llvm::SmallVectorTemplateCommon< T, typename >::begin(), blocks, Blocks, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains(), contains(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::dbgs(), llvm::depth_first(), llvm::depth_first_ext(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), getParent(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::df_iterator_default_set< NodeRef, SmallSize >::insert(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm_unreachable, and llvm::SmallPtrSetImplBase::size().
Referenced by llvm::GenericCycleInfo< ContextT >::verifyCycleNest().
void llvm::GenericCycle< ContextT >::verifyCycleNest |
Verify the parent-child relations of this cycle.
Note that this does not check that cycle is really a cycle in the CFG.
Definition at line 201 of file GenericCycleImpl.h.
References assert(), llvm::children(), contains(), llvm::Depth, and llvm::is_contained().
Referenced by llvm::GenericCycleInfo< ContextT >::verifyCycleNest().
Definition at line 48 of file GenericCycleInfo.h.
Definition at line 49 of file GenericCycleInfo.h.