12#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANCFG_H
13#define LLVM_TRANSFORMS_VECTORIZE_VPLANCFG_H
35template <
typename BlockPtrTy>
38 std::bidirectional_iterator_tag,
47 static BlockPtrTy getBlockWithSuccs(BlockPtrTy Current) {
48 while (Current && Current->getNumSuccessors() == 0)
49 Current = Current->getParent();
55 template <
typename T1>
static T1 deref(
T1 Block,
unsigned SuccIdx) {
56 if (
auto *R = dyn_cast<VPRegionBlock>(Block)) {
62 return getBlockWithSuccs(Block)->getSuccessors()[SuccIdx];
70 : Block(Block), SuccessorIdx(
Idx) {}
72 : Block(
Other.Block), SuccessorIdx(
Other.SuccessorIdx) {}
76 SuccessorIdx = R.SuccessorIdx;
81 if (
auto *R = dyn_cast<VPRegionBlock>(Block)) {
85 BlockPtrTy ParentWithSuccs = getBlockWithSuccs(Block);
86 unsigned NumSuccessors =
87 ParentWithSuccs ? ParentWithSuccs->getNumSuccessors() : 0;
88 return {Block, NumSuccessors};
92 return Block == R.Block && SuccessorIdx == R.SuccessorIdx;
143 return ChildIteratorType::end(
N);
162 return ChildIteratorType::end(
N);
185 return N->getSuccessors().begin();
189 return N->getSuccessors().end();
204 return N->getSuccessors().begin();
208 return N->getSuccessors().end();
214inline iterator_range<
215 df_iterator<VPBlockShallowTraversalWrapper<VPBlockBase *>>>
219inline iterator_range<
220 df_iterator<VPBlockShallowTraversalWrapper<const VPBlockBase *>>>
227inline iterator_range<
228 po_iterator<VPBlockShallowTraversalWrapper<VPBlockBase *>>>
235inline iterator_range<po_iterator<VPBlockDeepTraversalWrapper<VPBlockBase *>>>
242inline iterator_range<df_iterator<VPBlockDeepTraversalWrapper<VPBlockBase *>>>
246inline iterator_range<
247 df_iterator<VPBlockDeepTraversalWrapper<const VPBlockBase *>>>
269 return ChildIteratorType::end(
N);
284 return ChildIteratorType::end(
N);
316 return nodes_iterator::begin(
N->getEntry());
322 return nodes_iterator::end(
N->getEntry());
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file builds on the ADT/GraphTraits.h file to build generic depth first graph iterator.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
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.
This file contains the declarations of the Vectorization Plan base classes:
typename SuperClass::const_iterator const_iterator
typename SuperClass::iterator iterator
Iterator to traverse all successors of a VPBlockBase node.
const VPBlockBase * operator*() const
VPAllSuccessorsIterator & operator++()
bool operator==(const VPAllSuccessorsIterator &R) const
VPAllSuccessorsIterator(BlockPtrTy Block, size_t Idx=0)
VPAllSuccessorsIterator operator++(int X)
VPAllSuccessorsIterator(const VPAllSuccessorsIterator &Other)
VPAllSuccessorsIterator & operator--()
BlockPtrTy reference
Used by iterator_facade_base with bidirectional_iterator_tag.
VPAllSuccessorsIterator & operator=(const VPAllSuccessorsIterator &R)
static VPAllSuccessorsIterator end(BlockPtrTy Block)
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)
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
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< df_iterator< T > > depth_first(const T &G)
SmallVectorImpl< VPBlockBase * >::iterator ChildIteratorType
static NodeRef getEntryNode(Inverse< NodeRef > B)
static ChildIteratorType child_end(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)
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)
static ChildIteratorType child_end(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)
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)
static NodeRef getEntryNode(VPBlockShallowTraversalWrapper< const VPBlockBase * > N)
static nodes_iterator nodes_end(GraphRef N)
static NodeRef getEntryNode(GraphRef N)
static nodes_iterator nodes_begin(GraphRef N)
static ChildIteratorType child_end(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)
static NodeRef getEntryNode(NodeRef N)
Binary functor that adapts to any other binary functor after dereferencing operands.