LLVM 19.0.0git
Classes | Public Types | Public Member Functions | Friends | List of all members
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 = 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.
 
BlockTgetHeader () 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 GenericCyclegetParentCycle () const
 
GenericCyclegetParentCycle ()
 
unsigned getDepth () const
 
void getExitBlocks (SmallVectorImpl< BlockT * > &TmpStorage) const
 Return all of the successor blocks 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.
 
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
 
size_t getNumEntries () const
 
iterator_range< const_entry_iteratorentries () 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 170 of file GenericCycleInfo.h.

◆ const_child_iterator_base

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

Iteration over child cycles.

Definition at line 141 of file GenericCycleInfo.h.

◆ const_entry_iterator

template<typename ContextT >
using llvm::GenericCycle< ContextT >::const_entry_iterator = typename SmallVectorImpl<BlockT *>::const_iterator

Iteration over entry blocks.

Definition at line 186 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 172 of file GenericCycleInfo.h.

References Blocks.

Referenced by llvm::GenericCycle< ContextT >::blocks().

◆ block_end()

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

Definition at line 175 of file GenericCycleInfo.h.

References Blocks.

Referenced by llvm::GenericCycle< ContextT >::blocks().

◆ blocks()

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

◆ child_begin()

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

Definition at line 155 of file GenericCycleInfo.h.

◆ child_end()

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

Definition at line 158 of file GenericCycleInfo.h.

◆ children()

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

Definition at line 162 of file GenericCycleInfo.h.

References llvm::make_range().

Referenced by llvm::GenericCycleInfo< ContextT >::validateTree().

◆ 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 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 >::validateTree().

◆ 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 35 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 190 of file GenericCycleInfo.h.

References llvm::make_range().

◆ getCyclePredecessor()

template<typename ContextT >
auto llvm::GenericCycle< ContextT >::getCyclePredecessor

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

Definition at line 88 of file GenericCycleImpl.h.

References contains(), and llvm::predecessors().

◆ getCyclePreheader()

template<typename ContextT >
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 70 of file GenericCycleImpl.h.

References assert(), and llvm::succ_size().

◆ getDepth()

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

Definition at line 121 of file GenericCycleInfo.h.

References llvm::Depth.

Referenced by llvm::GenericCycleInfo< ContextT >::getCycleDepth().

◆ getEntries()

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

Definition at line 101 of file GenericCycleInfo.h.

Referenced by llvm::isCycleInvariant().

◆ getExitBlocks()

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

◆ getHeader()

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

◆ getNumBlocks()

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

Definition at line 178 of file GenericCycleInfo.h.

References Blocks.

◆ getNumChildren()

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

Definition at line 161 of file GenericCycleInfo.h.

◆ getNumEntries()

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

Definition at line 189 of file GenericCycleInfo.h.

◆ getParentCycle() [1/2]

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

Definition at line 120 of file GenericCycleInfo.h.

◆ getParentCycle() [2/2]

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

◆ 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 106 of file GenericCycleInfo.h.

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

Referenced by llvm::GenericCycle< ContextT >::print().

◆ isReducible()

template<typename ContextT >
bool llvm::GenericCycle< ContextT >::isReducible ( ) const
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().

◆ print()

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

◆ printEntries()

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

Definition at line 195 of file GenericCycleInfo.h.

References llvm::First.

Referenced by llvm::GenericCycle< ContextT >::print().

Friends And Related Function Documentation

◆ GenericCycleInfo

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

Definition at line 48 of file GenericCycleInfo.h.

◆ GenericCycleInfoCompute

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

Definition at line 49 of file GenericCycleInfo.h.


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