28#ifndef LLVM_ADT_GENERICCYCLEINFO_H 
   29#define LLVM_ADT_GENERICCYCLEINFO_H 
   44template <
typename ContextT> 
class GenericCycle {
 
   46  using BlockT = 
typename ContextT::BlockT;
 
   54  GenericCycle *ParentCycle = 
nullptr;
 
   62  std::vector<std::unique_ptr<GenericCycle>> Children;
 
   68  BlockSetVectorT Blocks;
 
   85    ParentCycle = 
nullptr;
 
  100  GenericCycle &operator=(
const GenericCycle &) = 
delete;
 
  102  GenericCycle &operator=(GenericCycle &&Rhs) = 
delete;
 
  130    Entries.push_back(
Block);
 
 
  234      for (
auto *Entry : Entries) {
 
  238        Out << Ctx.print(Entry);
 
 
  245      Out << 
"depth=" << Depth << 
": entries(" << 
printEntries(Ctx) << 
')';
 
  247      for (
auto *
Block : Blocks) {
 
  251        Out << 
' ' << Ctx.print(
Block);
 
 
 
  260  using BlockT = 
typename ContextT::BlockT;
 
  279  std::vector<std::unique_ptr<CycleT>> TopLevelCycles;
 
  285  void moveTopLevelCycleToNewParent(
CycleT *NewParent, 
CycleT *Child);
 
  326                              const_toplevel_iterator_base> {
 
 
  339    return const_toplevel_iterator{TopLevelCycles.begin()};
 
 
  342    return const_toplevel_iterator{TopLevelCycles.end()};
 
 
  347                            const_toplevel_iterator{TopLevelCycles.end()});
 
 
 
  362    return Ref->child_begin();
 
 
 
  387template <
typename BlockT>
 
  391template <
typename BlockT>
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
 
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
 
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
 
This file defines the DenseSet and SmallDenseSet classes.
 
This file defines the little GenericSSAContext<X> template class that can be used to implement IR ana...
 
This file defines the little GraphTraits<X> template class that should be specialized by classes that...
 
This file implements a set that has insertion order iteration characteristics.
 
Implements a dense probed hash-table based set.
 
Helper class for computing cycle information.
 
Cycle information for a function.
 
typename ContextT::FunctionT FunctionT
 
GenericCycleInfo()=default
 
void verify() const
Verify that the entire cycle tree well-formed.
 
void addBlockToCycle(BlockT *Block, CycleT *Cycle)
Assumes that Cycle is the innermost cycle containing Block.
 
typename std::vector< std::unique_ptr< CycleT > >::const_iterator const_toplevel_iterator_base
Iteration over top-level cycles.
 
iterator_range< const_toplevel_iterator > toplevel_cycles() const
 
CycleT * getSmallestCommonCycle(BlockT *A, BlockT *B) const
Find the innermost cycle containing both given blocks.
 
friend class GenericCycleInfoCompute
 
const_toplevel_iterator toplevel_end() const
 
const FunctionT * getFunction() const
 
friend class GenericCycle
 
void print(raw_ostream &Out) const
Print the cycle info.
 
CycleT * getSmallestCommonCycle(CycleT *A, CycleT *B) const
Find the innermost cycle containing both given cycles.
 
GenericCycleInfo & operator=(GenericCycleInfo &&)=default
 
void clear()
Reset the object to its initial state.
 
GenericCycle< ContextT > CycleT
 
void compute(FunctionT &F)
Compute the cycle info for a function.
 
void splitCriticalEdge(BlockT *Pred, BlockT *Succ, BlockT *New)
 
const ContextT & getSSAContext() const
 
GenericCycleInfo(GenericCycleInfo &&)=default
 
Printable print(const CycleT *Cycle)
 
unsigned getCycleDepth(const BlockT *Block) const
get the depth for the cycle which containing a given block.
 
void verifyCycleNest(bool VerifyFull=false) const
Methods for debug and self-test.
 
typename ContextT::BlockT BlockT
 
CycleT * getTopLevelParentCycle(BlockT *Block)
 
const_toplevel_iterator toplevel_begin() const
 
CycleT * getCycle(const BlockT *Block) const
Find the innermost cycle containing a given block.
 
A possibly irreducible generalization of a Loop.
 
void clearCache() const
Clear the cache of the cycle.
 
BlockT * getHeader() const
 
bool isReducible() const
Whether the cycle is a natural loop.
 
typename ContextT::FunctionT FunctionT
 
const_entry_iterator entry_end() const
 
friend class GenericCycleInfoCompute
 
void getExitingBlocks(SmallVectorImpl< BlockT * > &TmpStorage) const
Return all blocks of this cycle that have successor outside of this cycle.
 
const_entry_iterator entry_begin() const
 
void verifyCycle() const
Verify that this is actually a well-formed cycle in the CFG.
 
const_child_iterator child_begin() const
 
iterator_range< const_entry_iterator > entries() const
 
void verifyCycleNest() const
Verify the parent-child relations of this cycle.
 
typename SmallVectorImpl< BlockT * >::const_reverse_iterator const_reverse_entry_iterator
 
Printable print(const ContextT &Ctx) const
 
iterator_range< const_block_iterator > blocks() const
 
const SmallVectorImpl< BlockT * > & getEntries() const
 
BlockT * getCyclePreheader() const
Return the preheader block for this cycle.
 
typename BlockSetVectorT::const_iterator const_block_iterator
Iteration over blocks in the cycle (including entry blocks).
 
bool isEntry(const BlockT *Block) const
Return whether Block is an entry block of the cycle.
 
const_reverse_entry_iterator entry_rend() const
 
const_block_iterator block_begin() const
 
const_reverse_entry_iterator entry_rbegin() const
 
void getExitBlocks(SmallVectorImpl< BlockT * > &TmpStorage) const
Return all of the successor blocks of this cycle.
 
BlockT * getCyclePredecessor() const
If the cycle has exactly one entry with exactly one predecessor, return it, otherwise return nullptr.
 
bool contains(const BlockT *Block) const
Return whether Block is contained in the cycle.
 
Printable printEntries(const ContextT &Ctx) const
 
size_t getNumEntries() const
 
const_child_iterator child_end() const
 
size_t getNumChildren() const
 
typename SmallVectorImpl< BlockT * >::const_iterator const_entry_iterator
Iteration over entry blocks.
 
typename ContextT::BlockT BlockT
 
const GenericCycle * getParentCycle() const
 
void setSingleEntry(BlockT *Block)
Replace all entries with Block as single entry.
 
GenericCycle * getParentCycle()
 
friend class GenericCycleInfo
 
unsigned getDepth() const
 
const_block_iterator block_end() const
 
typename std::vector< std::unique_ptr< GenericCycle > >::const_iterator const_child_iterator_base
Iteration over child cycles.
 
size_t getNumBlocks() const
 
iterator_range< const_child_iterator > children() const
 
Simple wrapper around std::function<void(raw_ostream&)>.
 
A vector that has set insertion semantics.
 
typename vector_type::const_iterator const_iterator
 
bool insert(const value_type &X)
Insert a new element into the SetVector.
 
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
 
typename SuperClass::const_iterator const_iterator
 
void push_back(const T &Elt)
 
std::reverse_iterator< const_iterator > const_reverse_iterator
 
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
 
const const_child_iterator_base & wrapped() const
 
const_child_iterator_base I
 
iterator_adaptor_base()=default
 
A range adaptor for a pair of iterators.
 
This class implements an extremely fast bulk output stream that can only output to a stream.
 
@ C
The default llvm calling convention, compatible with C.
 
This is an optimization pass for GlobalISel generic memory operations.
 
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
 
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
 
@ Ref
The access may reference the value stored in memory.
 
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
 
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
 
GraphTraits for iterating over a sub-tree of the CycleT tree.
 
static ChildIteratorType child_begin(NodeRef Ref)
 
nodes_iterator ChildIteratorType
 
ChildIteratorT nodes_iterator
 
static NodeRef getEntryNode(NodeRef Graph)
 
static ChildIteratorType child_end(NodeRef Ref)
 
const_toplevel_iterator()=default
 
iterator_adaptor_base< const_toplevel_iterator, const_toplevel_iterator_base > Base
 
const const_toplevel_iterator_base & wrapped()
 
const_toplevel_iterator(const_toplevel_iterator_base I)
 
CycleT * operator*() const
 
const_child_iterator()=default
 
const_child_iterator(const_child_iterator_base I)
 
GenericCycle * operator*() const
 
const const_child_iterator_base & wrapped()
 
iterator_adaptor_base< const_child_iterator, const_child_iterator_base > Base