12#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANCFG_H
13#define LLVM_TRANSFORMS_VECTORIZE_VPLANCFG_H
62template <
typename BlockPtrTy,
bool Forward = true>
65 VPHierarchicalChildrenIterator<BlockPtrTy, Forward>,
66 std::bidirectional_iterator_tag, VPBlockBase> {
74 static size_t getNumOutgoingEdges(BlockPtrTy Current) {
75 if constexpr (Forward)
76 return Current->getNumSuccessors();
78 return Current->getNumPredecessors();
82 if constexpr (Forward)
83 return Current->getSuccessors();
85 return Current->getPredecessors();
88 static BlockPtrTy getBlockWithOutgoingEdges(BlockPtrTy Current) {
89 while (Current && getNumOutgoingEdges(Current) == 0)
90 Current = Current->getParent();
96 template <
typename T1>
static T1 deref(
T1 Block,
unsigned EdgeIdx) {
99 if constexpr (Forward)
100 return R->getEntry();
102 return R->getExiting();
106 return getOutgoingEdges(getBlockWithOutgoingEdges(Block))[EdgeIdx];
114 : Block(Block), EdgeIdx(Idx) {}
116 : Block(
Other.Block), EdgeIdx(
Other.EdgeIdx) {}
130 BlockPtrTy ParentWithOutgoingEdges = getBlockWithOutgoingEdges(Block);
131 unsigned NumOutgoingEdges =
132 ParentWithOutgoingEdges ? getNumOutgoingEdges(ParentWithOutgoingEdges)
134 return {Block, NumOutgoingEdges};
138 return Block == R.Block && EdgeIdx == R.EdgeIdx;
143 BlockPtrTy
operator*() {
return deref(Block, EdgeIdx); }
231 return N->getSuccessors().begin();
235 return N->getSuccessors().end();
250 return N->getSuccessors().begin();
254 return N->getSuccessors().end();
261 df_iterator<VPBlockShallowTraversalWrapper<VPBlockBase *>>>
266 df_iterator<VPBlockShallowTraversalWrapper<const VPBlockBase *>>>
274 po_iterator<VPBlockShallowTraversalWrapper<VPBlockBase *>>>
293 df_iterator<VPBlockDeepTraversalWrapper<const VPBlockBase *>>>
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file builds on the ADT/GraphTraits.h file to build generic depth first graph iterator.
This file defines the little GraphTraits<X> template class that should be specialized by classes that...
std::pair< BasicBlock *, unsigned > BlockTy
A pair of (basic block, score).
This file builds on the ADT/GraphTraits.h file to build a generic graph post order iterator.
This file defines the SmallVector class.
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
This file contains the declarations of the Vectorization Plan base classes:
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
typename SuperClass::const_iterator const_iterator
typename SuperClass::iterator iterator
VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
Helper for GraphTraits specialization that traverses through VPRegionBlocks.
VPBlockDeepTraversalWrapper(BlockTy Entry)
Helper for GraphTraits specialization that does not traverses through VPRegionBlocks.
VPBlockShallowTraversalWrapper(BlockTy Entry)
Iterator to traverse all successors/predecessors of a VPBlockBase node, including its hierarchical su...
VPHierarchicalChildrenIterator & operator=(const VPHierarchicalChildrenIterator &R)
const VPBlockBase * operator*() const
VPHierarchicalChildrenIterator & operator++()
VPHierarchicalChildrenIterator(BlockPtrTy Block, size_t Idx=0)
BlockPtrTy reference
Used by iterator_facade_base with bidirectional_iterator_tag.
static VPHierarchicalChildrenIterator end(BlockPtrTy Block)
VPHierarchicalChildrenIterator operator++(int X)
VPHierarchicalChildrenIterator(const VPHierarchicalChildrenIterator &Other)
bool operator==(const VPHierarchicalChildrenIterator &R) const
VPHierarchicalChildrenIterator & operator--()
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
static df_iterator begin(const NodeRef &G)
static df_iterator end(const NodeRef &G)
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
iterator_range< po_iterator< T > > post_order(const T &G)
iterator_range< df_iterator< VPBlockShallowTraversalWrapper< VPBlockBase * > > > vp_depth_first_shallow(VPBlockBase *G)
Returns an iterator range to traverse the graph starting at G in depth-first order.
iterator_range< df_iterator< VPBlockDeepTraversalWrapper< VPBlockBase * > > > vp_depth_first_deep(VPBlockBase *G)
Returns an iterator range to traverse the graph starting at G in depth-first order while traversing t...
iterator_range< po_iterator< VPBlockDeepTraversalWrapper< VPBlockBase * > > > vp_post_order_deep(VPBlockBase *G)
Returns an iterator range to traverse the graph starting at G in post order while traversing through ...
iterator_range< po_iterator< VPBlockShallowTraversalWrapper< VPBlockBase * > > > vp_post_order_shallow(VPBlockBase *G)
Returns an iterator range to traverse the graph starting at G in post order.
iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >
iterator_range< df_iterator< T > > depth_first(const T &G)
VPHierarchicalChildrenIterator< VPBlockBase *, false > ChildIteratorType
static NodeRef getEntryNode(Inverse< NodeRef > B)
static ChildIteratorType child_end(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)
VPHierarchicalChildrenIterator< VPBlockBase * > ChildIteratorType
static NodeRef getEntryNode(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)
static ChildIteratorType child_end(NodeRef N)
static NodeRef getEntryNode(VPBlockDeepTraversalWrapper< VPBlockBase * > N)
static ChildIteratorType child_end(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)
VPHierarchicalChildrenIterator< VPBlockBase * > ChildIteratorType
VPHierarchicalChildrenIterator< const VPBlockBase * > ChildIteratorType
static ChildIteratorType child_end(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)
const VPBlockBase * NodeRef
static NodeRef getEntryNode(VPBlockDeepTraversalWrapper< const VPBlockBase * > N)
static NodeRef getEntryNode(VPBlockShallowTraversalWrapper< VPBlockBase * > N)
static ChildIteratorType child_begin(NodeRef N)
static ChildIteratorType child_end(NodeRef N)
SmallVectorImpl< VPBlockBase * >::iterator ChildIteratorType
SmallVectorImpl< VPBlockBase * >::const_iterator ChildIteratorType
static ChildIteratorType child_end(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)
const VPBlockBase * NodeRef
static NodeRef getEntryNode(VPBlockShallowTraversalWrapper< const VPBlockBase * > N)
static nodes_iterator nodes_end(GraphRef N)
static NodeRef getEntryNode(GraphRef N)
df_iterator< NodeRef > nodes_iterator
static nodes_iterator nodes_begin(GraphRef N)
VPHierarchicalChildrenIterator< const VPBlockBase * > ChildIteratorType
static ChildIteratorType child_end(NodeRef N)
const VPBlockBase * NodeRef
static ChildIteratorType child_begin(NodeRef N)
static NodeRef getEntryNode(NodeRef N)