12#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANCFG_H
13#define LLVM_TRANSFORMS_VECTORIZE_VPLANCFG_H
33template <
typename BlockPtrTy>
36 std::bidirectional_iterator_tag,
45 static BlockPtrTy getBlockWithSuccs(BlockPtrTy Current) {
46 while (Current && Current->getNumSuccessors() == 0)
47 Current = Current->getParent();
53 template <
typename T1>
static T1 deref(
T1 Block,
unsigned SuccIdx) {
54 if (
auto *R = dyn_cast<VPRegionBlock>(Block)) {
60 return getBlockWithSuccs(Block)->getSuccessors()[SuccIdx];
68 : Block(Block), SuccessorIdx(
Idx) {}
70 : Block(
Other.Block), SuccessorIdx(
Other.SuccessorIdx) {}
74 SuccessorIdx = R.SuccessorIdx;
79 if (
auto *R = dyn_cast<VPRegionBlock>(Block)) {
83 BlockPtrTy ParentWithSuccs = getBlockWithSuccs(Block);
84 unsigned NumSuccessors =
85 ParentWithSuccs ? ParentWithSuccs->getNumSuccessors() : 0;
86 return {Block, NumSuccessors};
90 return Block == R.Block && SuccessorIdx == R.SuccessorIdx;
141 return ChildIteratorType::end(
N);
160 return ChildIteratorType::end(
N);
183 return N->getSuccessors().begin();
187 return N->getSuccessors().end();
202 return N->getSuccessors().begin();
206 return N->getSuccessors().end();
212inline iterator_range<
213 df_iterator<VPBlockShallowTraversalWrapper<VPBlockBase *>>>
217inline iterator_range<
218 df_iterator<VPBlockShallowTraversalWrapper<const VPBlockBase *>>>
225inline iterator_range<df_iterator<VPBlockDeepTraversalWrapper<VPBlockBase *>>>
229inline iterator_range<
230 df_iterator<VPBlockDeepTraversalWrapper<const VPBlockBase *>>>
252 return ChildIteratorType::end(
N);
267 return ChildIteratorType::end(
N);
299 return nodes_iterator::begin(
N->getEntry());
305 return nodes_iterator::end(
N->getEntry());
312 VPBlockUtils::blocksOnly<VPIRBasicBlock>(
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).
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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.
size_t getNumSuccessors() const
Helper for GraphTraits specialization that traverses through VPRegionBlocks.
VPBlockDeepTraversalWrapper(BlockTy Entry)
Helper for GraphTraits specialization that does not traverses through VPRegionBlocks.
VPBlockShallowTraversalWrapper(BlockTy Entry)
A special type of VPBasicBlock that wraps an existing IR basic block.
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
auto getExitBlocks()
Return an iterator range over the VPIRBasicBlock wrapping the exit blocks of the VPlan,...
VPRegionBlock * getVectorLoopRegion()
Returns the VPRegionBlock of the vector loop.
VPIRBasicBlock * getScalarHeader() const
Return the VPIRBasicBlock wrapping the header of the scalar loop.
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< 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< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
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.