LLVM: lib/Transforms/Vectorize/VPlanCFG.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANCFG_H
13#define LLVM_TRANSFORMS_VECTORIZE_VPLANCFG_H
14
21
22namespace llvm {
23
24
25
26
27
28
29
30
31
32
33
34
35template
38 std::bidirectional_iterator_tag,
39 VPBlockBase> {
40 BlockPtrTy Block;
41
42
43
44
45 size_t SuccessorIdx;
46
47 static BlockPtrTy getBlockWithSuccs(BlockPtrTy Current) {
48 while (Current && Current->getNumSuccessors() == 0)
49 Current = Current->getParent();
50 return Current;
51 }
52
53
54
55 template static T1 deref(T1 Block, unsigned SuccIdx) {
58 return R->getEntry();
59 }
60
61
62 return getBlockWithSuccs(Block)->getSuccessors()[SuccIdx];
63 }
64
65public:
66
68
70 : Block(Block), SuccessorIdx(Idx) {}
72 : Block(Other.Block), SuccessorIdx(Other.SuccessorIdx) {}
73
75 Block = R.Block;
76 SuccessorIdx = R.SuccessorIdx;
77 return *this;
78 }
79
82
83 return {R, 1};
84 }
85 BlockPtrTy ParentWithSuccs = getBlockWithSuccs(Block);
86 unsigned NumSuccessors =
87 ParentWithSuccs ? ParentWithSuccs->getNumSuccessors() : 0;
88 return {Block, NumSuccessors};
89 }
90
92 return Block == R.Block && SuccessorIdx == R.SuccessorIdx;
93 }
94
96
97 BlockPtrTy operator*() { return deref(Block, SuccessorIdx); }
98
100 SuccessorIdx++;
101 return *this;
102 }
103
105 SuccessorIdx--;
106 return *this;
107 }
108
111 SuccessorIdx++;
112 return Orig;
113 }
114};
115
116
124
125
126
127
128
129
133
135 return N.getEntry();
136 }
137
141
145};
146
147template <>
151
154 return N.getEntry();
155 }
156
160
164};
165
166
167
175
179
181 return N.getEntry();
182 }
183
185 return N->getSuccessors().begin();
186 }
187
189 return N->getSuccessors().end();
190 }
191};
192
193template <>
197
200 return N.getEntry();
201 }
202
204 return N->getSuccessors().begin();
205 }
206
208 return N->getSuccessors().end();
209 }
210};
211
212
213
215 df_iterator<VPBlockShallowTraversalWrapper<VPBlockBase *>>>
220 df_iterator<VPBlockShallowTraversalWrapper<const VPBlockBase *>>>
224
225
226
228 po_iterator<VPBlockShallowTraversalWrapper<VPBlockBase *>>>
232
233
234
239
240
241
247 df_iterator<VPBlockDeepTraversalWrapper<const VPBlockBase *>>>
251
252
253
254
255
256
257
272
287
288
289
290
307
325
326}
327
328#endif
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 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:
typename SuperClass::const_iterator const_iterator
typename SuperClass::iterator iterator
Iterator to traverse all successors of a VPBlockBase node.
Definition VPlanCFG.h:39
const VPBlockBase * operator*() const
Definition VPlanCFG.h:95
VPAllSuccessorsIterator & operator++()
Definition VPlanCFG.h:99
bool operator==(const VPAllSuccessorsIterator &R) const
Definition VPlanCFG.h:91
BlockPtrTy operator*()
Definition VPlanCFG.h:97
VPAllSuccessorsIterator(BlockPtrTy Block, size_t Idx=0)
Definition VPlanCFG.h:69
VPAllSuccessorsIterator operator++(int X)
Definition VPlanCFG.h:109
VPAllSuccessorsIterator(const VPAllSuccessorsIterator &Other)
Definition VPlanCFG.h:71
VPAllSuccessorsIterator & operator--()
Definition VPlanCFG.h:104
BlockPtrTy reference
Used by iterator_facade_base with bidirectional_iterator_tag.
Definition VPlanCFG.h:67
VPAllSuccessorsIterator & operator=(const VPAllSuccessorsIterator &R)
Definition VPlanCFG.h:74
static VPAllSuccessorsIterator end(BlockPtrTy Block)
Definition VPlanCFG.h:80
VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
Helper for GraphTraits specialization that traverses through VPRegionBlocks.
Definition VPlanCFG.h:117
VPBlockDeepTraversalWrapper(BlockTy Entry)
Definition VPlanCFG.h:121
BlockTy getEntry()
Definition VPlanCFG.h:122
Helper for GraphTraits specialization that does not traverses through VPRegionBlocks.
Definition VPlanCFG.h:168
BlockTy getEntry()
Definition VPlanCFG.h:173
VPBlockShallowTraversalWrapper(BlockTy Entry)
Definition VPlanCFG.h:172
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 ...
#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.
decltype(auto) dyn_cast(const From &Val)
dyn_cast - 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.
Definition VPlanCFG.h:216
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...
Definition VPlanCFG.h:243
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 ...
Definition VPlanCFG.h:236
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.
Definition VPlanCFG.h:229
iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >
iterator_range< df_iterator< T > > depth_first(const T &G)
SmallVectorImpl< VPBlockBase * >::iterator ChildIteratorType
Definition VPlanCFG.h:293
static NodeRef getEntryNode(Inverse< NodeRef > B)
Definition VPlanCFG.h:295
static ChildIteratorType child_end(NodeRef N)
Definition VPlanCFG.h:303
VPBlockBase * NodeRef
Definition VPlanCFG.h:292
static ChildIteratorType child_begin(NodeRef N)
Definition VPlanCFG.h:299
static NodeRef getEntryNode(NodeRef N)
Definition VPlanCFG.h:262
VPBlockBase * NodeRef
Definition VPlanCFG.h:259
VPAllSuccessorsIterator< VPBlockBase * > ChildIteratorType
Definition VPlanCFG.h:260
static ChildIteratorType child_begin(NodeRef N)
Definition VPlanCFG.h:264
static ChildIteratorType child_end(NodeRef N)
Definition VPlanCFG.h:268
VPBlockBase * NodeRef
Definition VPlanCFG.h:131
static NodeRef getEntryNode(VPBlockDeepTraversalWrapper< VPBlockBase * > N)
Definition VPlanCFG.h:134
VPAllSuccessorsIterator< VPBlockBase * > ChildIteratorType
Definition VPlanCFG.h:132
static ChildIteratorType child_end(NodeRef N)
Definition VPlanCFG.h:142
static ChildIteratorType child_begin(NodeRef N)
Definition VPlanCFG.h:138
VPAllSuccessorsIterator< const VPBlockBase * > ChildIteratorType
Definition VPlanCFG.h:150
static ChildIteratorType child_end(NodeRef N)
Definition VPlanCFG.h:161
static ChildIteratorType child_begin(NodeRef N)
Definition VPlanCFG.h:157
const VPBlockBase * NodeRef
Definition VPlanCFG.h:149
static NodeRef getEntryNode(VPBlockDeepTraversalWrapper< const VPBlockBase * > N)
Definition VPlanCFG.h:153
static NodeRef getEntryNode(VPBlockShallowTraversalWrapper< VPBlockBase * > N)
Definition VPlanCFG.h:180
VPBlockBase * NodeRef
Definition VPlanCFG.h:177
static ChildIteratorType child_begin(NodeRef N)
Definition VPlanCFG.h:184
static ChildIteratorType child_end(NodeRef N)
Definition VPlanCFG.h:188
SmallVectorImpl< VPBlockBase * >::iterator ChildIteratorType
Definition VPlanCFG.h:178
SmallVectorImpl< VPBlockBase * >::const_iterator ChildIteratorType
Definition VPlanCFG.h:196
static ChildIteratorType child_end(NodeRef N)
Definition VPlanCFG.h:207
static ChildIteratorType child_begin(NodeRef N)
Definition VPlanCFG.h:203
const VPBlockBase * NodeRef
Definition VPlanCFG.h:195
static NodeRef getEntryNode(VPBlockShallowTraversalWrapper< const VPBlockBase * > N)
Definition VPlanCFG.h:199
static nodes_iterator nodes_end(GraphRef N)
Definition VPlanCFG.h:319
static NodeRef getEntryNode(GraphRef N)
Definition VPlanCFG.h:313
VPBlockBase * NodeRef
Definition VPlanCFG.h:310
df_iterator< NodeRef > nodes_iterator
Definition VPlanCFG.h:311
VPlan * GraphRef
Definition VPlanCFG.h:309
static nodes_iterator nodes_begin(GraphRef N)
Definition VPlanCFG.h:315
VPAllSuccessorsIterator< const VPBlockBase * > ChildIteratorType
Definition VPlanCFG.h:275
static ChildIteratorType child_end(NodeRef N)
Definition VPlanCFG.h:283
const VPBlockBase * NodeRef
Definition VPlanCFG.h:274
static ChildIteratorType child_begin(NodeRef N)
Definition VPlanCFG.h:279
static NodeRef getEntryNode(NodeRef N)
Definition VPlanCFG.h:277