Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
llvm::GenericCycle< ContextT > Class Template Reference

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
 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
 Iteration over entry blocks.
using const_reverse_entry_iterator

Public Member Functions

 GenericCycle ()=default
bool isReducible () const
 Whether the cycle is a natural loop.
BlockTgetHeader () const
const SmallVectorImpl< BlockT * > & getEntries () const
void clearCache () const
 Clear the cache of the cycle.
bool isEntry (const BlockT *Block) const
 Return whether Block is an entry block of the cycle.
void setSingleEntry (BlockT *Block)
 Replace all entries with Block as single entry.
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 GenericCyclegetParentCycle () const
GenericCyclegetParentCycle ()
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.
BlockTgetCyclePreheader () const
 Return the preheader block for this cycle.
BlockTgetCyclePredecessor () 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_iteratorchildren () const
const_block_iterator block_begin () const
const_block_iterator block_end () const
size_t getNumBlocks () const
iterator_range< const_block_iteratorblocks () const
const_entry_iterator entry_begin () const
const_entry_iterator entry_end () const
size_t getNumEntries () const
iterator_range< const_entry_iteratorentries () const
const_reverse_entry_iterator entry_rbegin () const
const_reverse_entry_iterator entry_rend () const
Printable printEntries (const ContextT &Ctx) const
Printable print (const ContextT &Ctx) const

Friends

template<typename>
class GenericCycleInfo
template<typename>
class GenericCycleInfoCompute

Detailed Description

template<typename ContextT>
class llvm::GenericCycle< ContextT >

A possibly irreducible generalization of a Loop.

Definition at line 44 of file GenericCycleInfo.h.

Member Typedef Documentation

◆ BlockT

template<typename ContextT>
using llvm::GenericCycle< ContextT >::BlockT = typename ContextT::BlockT

Definition at line 46 of file GenericCycleInfo.h.

◆ const_block_iterator

template<typename ContextT>
using llvm::GenericCycle< ContextT >::const_block_iterator = typename BlockSetVectorT::const_iterator

Iteration over blocks in the cycle (including entry blocks).

Definition at line 201 of file GenericCycleInfo.h.

◆ const_child_iterator_base

template<typename ContextT>
using llvm::GenericCycle< ContextT >::const_child_iterator_base
Initial value:
typename std::vector<std::unique_ptr<GenericCycle>>::const_iterator

Iteration over child cycles.

Definition at line 172 of file GenericCycleInfo.h.

◆ const_entry_iterator

template<typename ContextT>
using llvm::GenericCycle< ContextT >::const_entry_iterator
Initial value:
typename SuperClass::const_iterator const_iterator

Iteration over entry blocks.

Definition at line 217 of file GenericCycleInfo.h.

◆ const_reverse_entry_iterator

template<typename ContextT>
using llvm::GenericCycle< ContextT >::const_reverse_entry_iterator
Initial value:
std::reverse_iterator< const_iterator > const_reverse_iterator

Definition at line 225 of file GenericCycleInfo.h.

◆ FunctionT

template<typename ContextT>
using llvm::GenericCycle< ContextT >::FunctionT = typename ContextT::FunctionT

Definition at line 47 of file GenericCycleInfo.h.

Constructor & Destructor Documentation

◆ GenericCycle()

template<typename ContextT>
llvm::GenericCycle< ContextT >::GenericCycle ( )
default

Member Function Documentation

◆ block_begin()

template<typename ContextT>
const_block_iterator llvm::GenericCycle< ContextT >::block_begin ( ) const
inline

Definition at line 203 of file GenericCycleInfo.h.

Referenced by blocks().

◆ block_end()

template<typename ContextT>
const_block_iterator llvm::GenericCycle< ContextT >::block_end ( ) const
inline

Definition at line 206 of file GenericCycleInfo.h.

Referenced by blocks().

◆ blocks()

template<typename ContextT>
iterator_range< const_block_iterator > llvm::GenericCycle< ContextT >::blocks ( ) const
inline

Definition at line 210 of file GenericCycleInfo.h.

References block_begin(), block_end(), and llvm::make_range().

◆ child_begin()

template<typename ContextT>
const_child_iterator llvm::GenericCycle< ContextT >::child_begin ( ) const
inline

Definition at line 186 of file GenericCycleInfo.h.

◆ child_end()

template<typename ContextT>
const_child_iterator llvm::GenericCycle< ContextT >::child_end ( ) const
inline

Definition at line 189 of file GenericCycleInfo.h.

◆ children()

template<typename ContextT>
iterator_range< const_child_iterator > llvm::GenericCycle< ContextT >::children ( ) const
inline

Definition at line 193 of file GenericCycleInfo.h.

References llvm::make_range().

◆ clearCache()

template<typename ContextT>
void llvm::GenericCycle< ContextT >::clearCache ( ) const
inline

Clear the cache of the cycle.

This should be run in all non-const function in GenericCycle and GenericCycleInfo.

Definition at line 119 of file GenericCycleInfo.h.

Referenced by setSingleEntry().

◆ contains() [1/2]

template<typename ContextT>
bool llvm::GenericCycle< ContextT >::contains ( const BlockT * Block) const
inline

Return whether Block is contained in the cycle.

Definition at line 135 of file GenericCycleInfo.h.

References llvm::Block.

Referenced by llvm::SIInstrInfo::isSafeToSink(), and setSingleEntry().

◆ contains() [2/2]

template<typename ContextT>
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.

◆ entries()

template<typename ContextT>
iterator_range< const_entry_iterator > llvm::GenericCycle< ContextT >::entries ( ) const
inline

Definition at line 222 of file GenericCycleInfo.h.

References entry_begin(), entry_end(), and llvm::make_range().

Referenced by verifyCycle().

◆ entry_begin()

template<typename ContextT>
const_entry_iterator llvm::GenericCycle< ContextT >::entry_begin ( ) const
inline

Definition at line 219 of file GenericCycleInfo.h.

Referenced by entries().

◆ entry_end()

template<typename ContextT>
const_entry_iterator llvm::GenericCycle< ContextT >::entry_end ( ) const
inline

Definition at line 220 of file GenericCycleInfo.h.

Referenced by entries().

◆ entry_rbegin()

template<typename ContextT>
const_reverse_entry_iterator llvm::GenericCycle< ContextT >::entry_rbegin ( ) const
inline

Definition at line 227 of file GenericCycleInfo.h.

◆ entry_rend()

template<typename ContextT>
const_reverse_entry_iterator llvm::GenericCycle< ContextT >::entry_rend ( ) const
inline

Definition at line 228 of file GenericCycleInfo.h.

◆ getCyclePredecessor()

template<typename ContextT>
auto llvm::GenericCycle< ContextT >::getCyclePredecessor ( ) const

If the cycle has exactly one entry with exactly one predecessor, return it, otherwise return nullptr.

Definition at line 110 of file GenericCycleImpl.h.

References const, contains(), getHeader(), isReducible(), and llvm::predecessors().

Referenced by getCyclePreheader().

◆ getCyclePreheader()

template<typename ContextT>
auto llvm::GenericCycle< ContextT >::getCyclePreheader ( ) const

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 92 of file GenericCycleImpl.h.

References assert(), const, getCyclePredecessor(), isReducible(), and llvm::succ_size().

◆ getDepth()

template<typename ContextT>
unsigned llvm::GenericCycle< ContextT >::getDepth ( ) const
inline

Definition at line 145 of file GenericCycleInfo.h.

◆ getEntries()

template<typename ContextT>
const SmallVectorImpl< BlockT * > & llvm::GenericCycle< ContextT >::getEntries ( ) const
inline

Definition at line 112 of file GenericCycleInfo.h.

◆ getExitBlocks()

template<typename ContextT>
void llvm::GenericCycle< ContextT >::getExitBlocks ( SmallVectorImpl< BlockT * > & TmpStorage) const

◆ getExitingBlocks()

template<typename ContextT>
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 77 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().

◆ getHeader()

template<typename ContextT>
BlockT * llvm::GenericCycle< ContextT >::getHeader ( ) const
inline

Definition at line 110 of file GenericCycleInfo.h.

Referenced by getCyclePredecessor(), and verifyCycle().

◆ getNumBlocks()

template<typename ContextT>
size_t llvm::GenericCycle< ContextT >::getNumBlocks ( ) const
inline

Definition at line 209 of file GenericCycleInfo.h.

Referenced by verifyCycle().

◆ getNumChildren()

template<typename ContextT>
size_t llvm::GenericCycle< ContextT >::getNumChildren ( ) const
inline

Definition at line 192 of file GenericCycleInfo.h.

◆ getNumEntries()

template<typename ContextT>
size_t llvm::GenericCycle< ContextT >::getNumEntries ( ) const
inline

Definition at line 221 of file GenericCycleInfo.h.

◆ getParentCycle() [1/2]

template<typename ContextT>
GenericCycle * llvm::GenericCycle< ContextT >::getParentCycle ( )
inline

Definition at line 144 of file GenericCycleInfo.h.

◆ getParentCycle() [2/2]

template<typename ContextT>
const GenericCycle * llvm::GenericCycle< ContextT >::getParentCycle ( ) const
inline

Definition at line 143 of file GenericCycleInfo.h.

Referenced by llvm::SIInstrInfo::isSafeToSink().

◆ isEntry()

template<typename ContextT>
bool llvm::GenericCycle< ContextT >::isEntry ( const BlockT * Block) const
inline

Return whether Block is an entry block of the cycle.

Definition at line 122 of file GenericCycleInfo.h.

References llvm::Block, and llvm::is_contained().

Referenced by print().

◆ isReducible()

template<typename ContextT>
bool llvm::GenericCycle< ContextT >::isReducible ( ) const
inline

Whether the cycle is a natural loop.

Definition at line 108 of file GenericCycleInfo.h.

Referenced by getCyclePredecessor(), and getCyclePreheader().

◆ print()

template<typename ContextT>
Printable llvm::GenericCycle< ContextT >::print ( const ContextT & Ctx) const
inline

Definition at line 243 of file GenericCycleInfo.h.

References llvm::Block, isEntry(), and printEntries().

◆ printEntries()

template<typename ContextT>
Printable llvm::GenericCycle< ContextT >::printEntries ( const ContextT & Ctx) const
inline

Definition at line 231 of file GenericCycleInfo.h.

References llvm::First.

Referenced by print().

◆ setSingleEntry()

template<typename ContextT>
void llvm::GenericCycle< ContextT >::setSingleEntry ( BlockT * Block)
inline

Replace all entries with Block as single entry.

Definition at line 127 of file GenericCycleInfo.h.

References assert(), llvm::Block, clearCache(), and contains().

◆ verifyCycle()

◆ verifyCycleNest()

template<typename ContextT>
void llvm::GenericCycle< ContextT >::verifyCycleNest ( ) const

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 207 of file GenericCycleImpl.h.

References assert(), llvm::children(), contains(), and llvm::is_contained().

Referenced by verifyCycle().

◆ GenericCycleInfo

template<typename ContextT>
template<typename>
friend class GenericCycleInfo
friend

Definition at line 48 of file GenericCycleInfo.h.

References GenericCycleInfo.

Referenced by GenericCycleInfo.

◆ GenericCycleInfoCompute

template<typename ContextT>
template<typename>
friend class GenericCycleInfoCompute
friend

Definition at line 49 of file GenericCycleInfo.h.

References GenericCycleInfoCompute.

Referenced by GenericCycleInfoCompute.


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