llvm.org GIT mirror llvm / 03e36d7
[Modules] Move CFG.h to the IR library as it defines graph traits over IR types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202827 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 5 years ago
54 changed file(s) with 435 addition(s) and 435 deletion(s). Raw diff Collapse all Expand all
1515
1616 #include "llvm/ADT/DenseMap.h"
1717 #include "llvm/ADT/SmallPtrSet.h"
18 #include "llvm/IR/CFG.h"
1819 #include "llvm/InitializePasses.h"
1920 #include "llvm/Pass.h"
2021 #include "llvm/Support/BranchProbability.h"
21 #include "llvm/Support/CFG.h"
2222
2323 namespace llvm {
2424 class LoopInfo;
1515 #define LLVM_ANALYSIS_CFG_H
1616
1717 #include "llvm/IR/BasicBlock.h"
18 #include "llvm/Support/CFG.h"
18 #include "llvm/IR/CFG.h"
1919
2020 namespace llvm {
2121
1414 #ifndef LLVM_ANALYSIS_CFGPRINTER_H
1515 #define LLVM_ANALYSIS_CFGPRINTER_H
1616
17 #include "llvm/IR/CFG.h"
1718 #include "llvm/IR/Constants.h"
1819 #include "llvm/IR/Function.h"
1920 #include "llvm/IR/Instructions.h"
20 #include "llvm/Support/CFG.h"
2121 #include "llvm/Support/GraphWriter.h"
2222
2323 namespace llvm {
3333 #define LLVM_ANALYSIS_INTERVALITERATOR_H
3434
3535 #include "llvm/Analysis/IntervalPartition.h"
36 #include "llvm/IR/CFG.h"
3637 #include "llvm/IR/Function.h"
37 #include "llvm/Support/CFG.h"
3838 #include
3939 #include
4040 #include
3434 #include "llvm/ADT/GraphTraits.h"
3535 #include "llvm/ADT/SmallPtrSet.h"
3636 #include "llvm/ADT/SmallVector.h"
37 #include "llvm/IR/CFG.h"
3738 #include "llvm/IR/Instruction.h"
3839 #include "llvm/Pass.h"
39 #include "llvm/Support/CFG.h"
4040 #include
4141
4242 namespace llvm {
1414 #include "llvm/ADT/PointerIntPair.h"
1515 #include "llvm/ADT/SmallPtrSet.h"
1616 #include "llvm/Analysis/RegionInfo.h"
17 #include "llvm/Support/CFG.h"
17 #include "llvm/IR/CFG.h"
1818 #include "llvm/Support/raw_ostream.h"
1919
2020 namespace llvm {
0 //===- CFG.h - Process LLVM structures as graphs ----------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines specializations of GraphTraits that allow Function and
10 // BasicBlock graphs to be treated as proper graphs for generic algorithms.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_IR_CFG_H
15 #define LLVM_IR_CFG_H
16
17 #include "llvm/ADT/GraphTraits.h"
18 #include "llvm/IR/Function.h"
19 #include "llvm/IR/InstrTypes.h"
20
21 namespace llvm {
22
23 //===----------------------------------------------------------------------===//
24 // BasicBlock pred_iterator definition
25 //===----------------------------------------------------------------------===//
26
27 template // Predecessor Iterator
28 class PredIterator : public std::iterator
29 Ptr, ptrdiff_t, Ptr*, Ptr*> {
30 typedef std::iterator
31 Ptr*> super;
32 typedef PredIterator Self;
33 USE_iterator It;
34
35 inline void advancePastNonTerminators() {
36 // Loop to ignore non-terminator uses (for example BlockAddresses).
37 while (!It.atEnd() && !isa(*It))
38 ++It;
39 }
40
41 public:
42 typedef typename super::pointer pointer;
43 typedef typename super::reference reference;
44
45 PredIterator() {}
46 explicit inline PredIterator(Ptr *bb) : It(bb->use_begin()) {
47 advancePastNonTerminators();
48 }
49 inline PredIterator(Ptr *bb, bool) : It(bb->use_end()) {}
50
51 inline bool operator==(const Self& x) const { return It == x.It; }
52 inline bool operator!=(const Self& x) const { return !operator==(x); }
53
54 inline reference operator*() const {
55 assert(!It.atEnd() && "pred_iterator out of range!");
56 return cast(*It)->getParent();
57 }
58 inline pointer *operator->() const { return &operator*(); }
59
60 inline Self& operator++() { // Preincrement
61 assert(!It.atEnd() && "pred_iterator out of range!");
62 ++It; advancePastNonTerminators();
63 return *this;
64 }
65
66 inline Self operator++(int) { // Postincrement
67 Self tmp = *this; ++*this; return tmp;
68 }
69
70 /// getOperandNo - Return the operand number in the predecessor's
71 /// terminator of the successor.
72 unsigned getOperandNo() const {
73 return It.getOperandNo();
74 }
75
76 /// getUse - Return the operand Use in the predecessor's terminator
77 /// of the successor.
78 Use &getUse() const {
79 return It.getUse();
80 }
81 };
82
83 typedef PredIterator pred_iterator;
84 typedef PredIterator
85 Value::const_use_iterator> const_pred_iterator;
86
87 inline pred_iterator pred_begin(BasicBlock *BB) { return pred_iterator(BB); }
88 inline const_pred_iterator pred_begin(const BasicBlock *BB) {
89 return const_pred_iterator(BB);
90 }
91 inline pred_iterator pred_end(BasicBlock *BB) { return pred_iterator(BB, true);}
92 inline const_pred_iterator pred_end(const BasicBlock *BB) {
93 return const_pred_iterator(BB, true);
94 }
95
96
97
98 //===----------------------------------------------------------------------===//
99 // BasicBlock succ_iterator definition
100 //===----------------------------------------------------------------------===//
101
102 template // Successor Iterator
103 class SuccIterator : public std::iterator
104 int, BB_ *, BB_ *> {
105 typedef std::iterator
106 super;
107
108 public:
109 typedef typename super::pointer pointer;
110 typedef typename super::reference reference;
111
112 private:
113 const Term_ Term;
114 unsigned idx;
115 typedef SuccIterator Self;
116
117 inline bool index_is_valid(int idx) {
118 return idx >= 0 && (unsigned) idx < Term->getNumSuccessors();
119 }
120
121 /// \brief Proxy object to allow write access in operator[]
122 class SuccessorProxy {
123 Self it;
124
125 public:
126 explicit SuccessorProxy(const Self &it) : it(it) {}
127
128 SuccessorProxy &operator=(SuccessorProxy r) {
129 *this = reference(r);
130 return *this;
131 }
132
133 SuccessorProxy &operator=(reference r) {
134 it.Term->setSuccessor(it.idx, r);
135 return *this;
136 }
137
138 operator reference() const { return *it; }
139 };
140
141 public:
142 explicit inline SuccIterator(Term_ T) : Term(T), idx(0) {// begin iterator
143 }
144 inline SuccIterator(Term_ T, bool) // end iterator
145 : Term(T) {
146 if (Term)
147 idx = Term->getNumSuccessors();
148 else
149 // Term == NULL happens, if a basic block is not fully constructed and
150 // consequently getTerminator() returns NULL. In this case we construct a
151 // SuccIterator which describes a basic block that has zero successors.
152 // Defining SuccIterator for incomplete and malformed CFGs is especially
153 // useful for debugging.
154 idx = 0;
155 }
156
157 inline const Self &operator=(const Self &I) {
158 assert(Term == I.Term &&"Cannot assign iterators to two different blocks!");
159 idx = I.idx;
160 return *this;
161 }
162
163 /// getSuccessorIndex - This is used to interface between code that wants to
164 /// operate on terminator instructions directly.
165 unsigned getSuccessorIndex() const { return idx; }
166
167 inline bool operator==(const Self& x) const { return idx == x.idx; }
168 inline bool operator!=(const Self& x) const { return !operator==(x); }
169
170 inline reference operator*() const { return Term->getSuccessor(idx); }
171 inline pointer operator->() const { return operator*(); }
172
173 inline Self& operator++() { ++idx; return *this; } // Preincrement
174
175 inline Self operator++(int) { // Postincrement
176 Self tmp = *this; ++*this; return tmp;
177 }
178
179 inline Self& operator--() { --idx; return *this; } // Predecrement
180 inline Self operator--(int) { // Postdecrement
181 Self tmp = *this; --*this; return tmp;
182 }
183
184 inline bool operator<(const Self& x) const {
185 assert(Term == x.Term && "Cannot compare iterators of different blocks!");
186 return idx < x.idx;
187 }
188
189 inline bool operator<=(const Self& x) const {
190 assert(Term == x.Term && "Cannot compare iterators of different blocks!");
191 return idx <= x.idx;
192 }
193 inline bool operator>=(const Self& x) const {
194 assert(Term == x.Term && "Cannot compare iterators of different blocks!");
195 return idx >= x.idx;
196 }
197
198 inline bool operator>(const Self& x) const {
199 assert(Term == x.Term && "Cannot compare iterators of different blocks!");
200 return idx > x.idx;
201 }
202
203 inline Self& operator+=(int Right) {
204 unsigned new_idx = idx + Right;
205 assert(index_is_valid(new_idx) && "Iterator index out of bound");
206 idx = new_idx;
207 return *this;
208 }
209
210 inline Self operator+(int Right) const {
211 Self tmp = *this;
212 tmp += Right;
213 return tmp;
214 }
215
216 inline Self& operator-=(int Right) {
217 return operator+=(-Right);
218 }
219
220 inline Self operator-(int Right) const {
221 return operator+(-Right);
222 }
223
224 inline int operator-(const Self& x) const {
225 assert(Term == x.Term && "Cannot work on iterators of different blocks!");
226 int distance = idx - x.idx;
227 return distance;
228 }
229
230 inline SuccessorProxy operator[](int offset) {
231 Self tmp = *this;
232 tmp += offset;
233 return SuccessorProxy(tmp);
234 }
235
236 /// Get the source BB of this iterator.
237 inline BB_ *getSource() {
238 assert(Term && "Source not available, if basic block was malformed");
239 return Term->getParent();
240 }
241 };
242
243 typedef SuccIterator succ_iterator;
244 typedef SuccIterator
245 const BasicBlock> succ_const_iterator;
246
247 inline succ_iterator succ_begin(BasicBlock *BB) {
248 return succ_iterator(BB->getTerminator());
249 }
250 inline succ_const_iterator succ_begin(const BasicBlock *BB) {
251 return succ_const_iterator(BB->getTerminator());
252 }
253 inline succ_iterator succ_end(BasicBlock *BB) {
254 return succ_iterator(BB->getTerminator(), true);
255 }
256 inline succ_const_iterator succ_end(const BasicBlock *BB) {
257 return succ_const_iterator(BB->getTerminator(), true);
258 }
259
260 template struct isPodLike > {
261 static const bool value = isPodLike::value;
262 };
263
264
265
266 //===--------------------------------------------------------------------===//
267 // GraphTraits specializations for basic block graphs (CFGs)
268 //===--------------------------------------------------------------------===//
269
270 // Provide specializations of GraphTraits to be able to treat a function as a
271 // graph of basic blocks...
272
273 template <> struct GraphTraits {
274 typedef BasicBlock NodeType;
275 typedef succ_iterator ChildIteratorType;
276
277 static NodeType *getEntryNode(BasicBlock *BB) { return BB; }
278 static inline ChildIteratorType child_begin(NodeType *N) {
279 return succ_begin(N);
280 }
281 static inline ChildIteratorType child_end(NodeType *N) {
282 return succ_end(N);
283 }
284 };
285
286 template <> struct GraphTraits {
287 typedef const BasicBlock NodeType;
288 typedef succ_const_iterator ChildIteratorType;
289
290 static NodeType *getEntryNode(const BasicBlock *BB) { return BB; }
291
292 static inline ChildIteratorType child_begin(NodeType *N) {
293 return succ_begin(N);
294 }
295 static inline ChildIteratorType child_end(NodeType *N) {
296 return succ_end(N);
297 }
298 };
299
300 // Provide specializations of GraphTraits to be able to treat a function as a
301 // graph of basic blocks... and to walk it in inverse order. Inverse order for
302 // a function is considered to be when traversing the predecessor edges of a BB
303 // instead of the successor edges.
304 //
305 template <> struct GraphTraits > {
306 typedef BasicBlock NodeType;
307 typedef pred_iterator ChildIteratorType;
308 static NodeType *getEntryNode(Inverse G) { return G.Graph; }
309 static inline ChildIteratorType child_begin(NodeType *N) {
310 return pred_begin(N);
311 }
312 static inline ChildIteratorType child_end(NodeType *N) {
313 return pred_end(N);
314 }
315 };
316
317 template <> struct GraphTraits > {
318 typedef const BasicBlock NodeType;
319 typedef const_pred_iterator ChildIteratorType;
320 static NodeType *getEntryNode(Inverse G) {
321 return G.Graph;
322 }
323 static inline ChildIteratorType child_begin(NodeType *N) {
324 return pred_begin(N);
325 }
326 static inline ChildIteratorType child_end(NodeType *N) {
327 return pred_end(N);
328 }
329 };
330
331
332
333 //===--------------------------------------------------------------------===//
334 // GraphTraits specializations for function basic block graphs (CFGs)
335 //===--------------------------------------------------------------------===//
336
337 // Provide specializations of GraphTraits to be able to treat a function as a
338 // graph of basic blocks... these are the same as the basic block iterators,
339 // except that the root node is implicitly the first node of the function.
340 //
341 template <> struct GraphTraits : public GraphTraits {
342 static NodeType *getEntryNode(Function *F) { return &F->getEntryBlock(); }
343
344 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
345 typedef Function::iterator nodes_iterator;
346 static nodes_iterator nodes_begin(Function *F) { return F->begin(); }
347 static nodes_iterator nodes_end (Function *F) { return F->end(); }
348 static size_t size (Function *F) { return F->size(); }
349 };
350 template <> struct GraphTraits :
351 public GraphTraits {
352 static NodeType *getEntryNode(const Function *F) {return &F->getEntryBlock();}
353
354 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
355 typedef Function::const_iterator nodes_iterator;
356 static nodes_iterator nodes_begin(const Function *F) { return F->begin(); }
357 static nodes_iterator nodes_end (const Function *F) { return F->end(); }
358 static size_t size (const Function *F) { return F->size(); }
359 };
360
361
362 // Provide specializations of GraphTraits to be able to treat a function as a
363 // graph of basic blocks... and to walk it in inverse order. Inverse order for
364 // a function is considered to be when traversing the predecessor edges of a BB
365 // instead of the successor edges.
366 //
367 template <> struct GraphTraits > :
368 public GraphTraits > {
369 static NodeType *getEntryNode(Inverse G) {
370 return &G.Graph->getEntryBlock();
371 }
372 };
373 template <> struct GraphTraits > :
374 public GraphTraits > {
375 static NodeType *getEntryNode(Inverse G) {
376 return &G.Graph->getEntryBlock();
377 }
378 };
379
380 } // End llvm namespace
381
382 #endif
2020 #include "llvm/ADT/SmallPtrSet.h"
2121 #include "llvm/ADT/SmallVector.h"
2222 #include "llvm/IR/BasicBlock.h"
23 #include "llvm/IR/CFG.h"
2324 #include "llvm/IR/Function.h"
2425 #include "llvm/Pass.h"
25 #include "llvm/Support/CFG.h"
2626 #include "llvm/Support/Compiler.h"
2727 #include "llvm/Support/GenericDomTree.h"
2828 #include "llvm/Support/raw_ostream.h"
+0
-383
include/llvm/Support/CFG.h less more
None //===-- llvm/Support/CFG.h - Process LLVM structures as graphs --*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines specializations of GraphTraits that allow Function and
10 // BasicBlock graphs to be treated as proper graphs for generic algorithms.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_SUPPORT_CFG_H
15 #define LLVM_SUPPORT_CFG_H
16
17 #include "llvm/ADT/GraphTraits.h"
18 #include "llvm/IR/Function.h"
19 #include "llvm/IR/InstrTypes.h"
20
21 namespace llvm {
22
23 //===----------------------------------------------------------------------===//
24 // BasicBlock pred_iterator definition
25 //===----------------------------------------------------------------------===//
26
27 template // Predecessor Iterator
28 class PredIterator : public std::iterator
29 Ptr, ptrdiff_t, Ptr*, Ptr*> {
30 typedef std::iterator
31 Ptr*> super;
32 typedef PredIterator Self;
33 USE_iterator It;
34
35 inline void advancePastNonTerminators() {
36 // Loop to ignore non-terminator uses (for example BlockAddresses).
37 while (!It.atEnd() && !isa(*It))
38 ++It;
39 }
40
41 public:
42 typedef typename super::pointer pointer;
43 typedef typename super::reference reference;
44
45 PredIterator() {}
46 explicit inline PredIterator(Ptr *bb) : It(bb->use_begin()) {
47 advancePastNonTerminators();
48 }
49 inline PredIterator(Ptr *bb, bool) : It(bb->use_end()) {}
50
51 inline bool operator==(const Self& x) const { return It == x.It; }
52 inline bool operator!=(const Self& x) const { return !operator==(x); }
53
54 inline reference operator*() const {
55 assert(!It.atEnd() && "pred_iterator out of range!");
56 return cast(*It)->getParent();
57 }
58 inline pointer *operator->() const { return &operator*(); }
59
60 inline Self& operator++() { // Preincrement
61 assert(!It.atEnd() && "pred_iterator out of range!");
62 ++It; advancePastNonTerminators();
63 return *this;
64 }
65
66 inline Self operator++(int) { // Postincrement
67 Self tmp = *this; ++*this; return tmp;
68 }
69
70 /// getOperandNo - Return the operand number in the predecessor's
71 /// terminator of the successor.
72 unsigned getOperandNo() const {
73 return It.getOperandNo();
74 }
75
76 /// getUse - Return the operand Use in the predecessor's terminator
77 /// of the successor.
78 Use &getUse() const {
79 return It.getUse();
80 }
81 };
82
83 typedef PredIterator pred_iterator;
84 typedef PredIterator
85 Value::const_use_iterator> const_pred_iterator;
86
87 inline pred_iterator pred_begin(BasicBlock *BB) { return pred_iterator(BB); }
88 inline const_pred_iterator pred_begin(const BasicBlock *BB) {
89 return const_pred_iterator(BB);
90 }
91 inline pred_iterator pred_end(BasicBlock *BB) { return pred_iterator(BB, true);}
92 inline const_pred_iterator pred_end(const BasicBlock *BB) {
93 return const_pred_iterator(BB, true);
94 }
95
96
97
98 //===----------------------------------------------------------------------===//
99 // BasicBlock succ_iterator definition
100 //===----------------------------------------------------------------------===//
101
102 template // Successor Iterator
103 class SuccIterator : public std::iterator
104 int, BB_ *, BB_ *> {
105 typedef std::iterator
106 super;
107
108 public:
109 typedef typename super::pointer pointer;
110 typedef typename super::reference reference;
111
112 private:
113 const Term_ Term;
114 unsigned idx;
115 typedef SuccIterator Self;
116
117 inline bool index_is_valid(int idx) {
118 return idx >= 0 && (unsigned) idx < Term->getNumSuccessors();
119 }
120
121 /// \brief Proxy object to allow write access in operator[]
122 class SuccessorProxy {
123 Self it;
124
125 public:
126 explicit SuccessorProxy(const Self &it) : it(it) {}
127
128 SuccessorProxy &operator=(SuccessorProxy r) {
129 *this = reference(r);
130 return *this;
131 }
132
133 SuccessorProxy &operator=(reference r) {
134 it.Term->setSuccessor(it.idx, r);
135 return *this;
136 }
137
138 operator reference() const { return *it; }
139 };
140
141 public:
142 explicit inline SuccIterator(Term_ T) : Term(T), idx(0) {// begin iterator
143 }
144 inline SuccIterator(Term_ T, bool) // end iterator
145 : Term(T) {
146 if (Term)
147 idx = Term->getNumSuccessors();
148 else
149 // Term == NULL happens, if a basic block is not fully constructed and
150 // consequently getTerminator() returns NULL. In this case we construct a
151 // SuccIterator which describes a basic block that has zero successors.
152 // Defining SuccIterator for incomplete and malformed CFGs is especially
153 // useful for debugging.
154 idx = 0;
155 }
156
157 inline const Self &operator=(const Self &I) {
158 assert(Term == I.Term &&"Cannot assign iterators to two different blocks!");
159 idx = I.idx;
160 return *this;
161 }
162
163 /// getSuccessorIndex - This is used to interface between code that wants to
164 /// operate on terminator instructions directly.
165 unsigned getSuccessorIndex() const { return idx; }
166
167 inline bool operator==(const Self& x) const { return idx == x.idx; }
168 inline bool operator!=(const Self& x) const { return !operator==(x); }
169
170 inline reference operator*() const { return Term->getSuccessor(idx); }
171 inline pointer operator->() const { return operator*(); }
172
173 inline Self& operator++() { ++idx; return *this; } // Preincrement
174
175 inline Self operator++(int) { // Postincrement
176 Self tmp = *this; ++*this; return tmp;
177 }
178
179 inline Self& operator--() { --idx; return *this; } // Predecrement
180 inline Self operator--(int) { // Postdecrement
181 Self tmp = *this; --*this; return tmp;
182 }
183
184 inline bool operator<(const Self& x) const {
185 assert(Term == x.Term && "Cannot compare iterators of different blocks!");
186 return idx < x.idx;
187 }
188
189 inline bool operator<=(const Self& x) const {
190 assert(Term == x.Term && "Cannot compare iterators of different blocks!");
191 return idx <= x.idx;
192 }
193 inline bool operator>=(const Self& x) const {
194 assert(Term == x.Term && "Cannot compare iterators of different blocks!");
195 return idx >= x.idx;
196 }
197
198 inline bool operator>(const Self& x) const {
199 assert(Term == x.Term && "Cannot compare iterators of different blocks!");
200 return idx > x.idx;
201 }
202
203 inline Self& operator+=(int Right) {
204 unsigned new_idx = idx + Right;
205 assert(index_is_valid(new_idx) && "Iterator index out of bound");
206 idx = new_idx;
207 return *this;
208 }
209
210 inline Self operator+(int Right) const {
211 Self tmp = *this;
212 tmp += Right;
213 return tmp;
214 }
215
216 inline Self& operator-=(int Right) {
217 return operator+=(-Right);
218 }
219
220 inline Self operator-(int Right) const {
221 return operator+(-Right);
222 }
223
224 inline int operator-(const Self& x) const {
225 assert(Term == x.Term && "Cannot work on iterators of different blocks!");
226 int distance = idx - x.idx;
227 return distance;
228 }
229
230 inline SuccessorProxy operator[](int offset) {
231 Self tmp = *this;
232 tmp += offset;
233 return SuccessorProxy(tmp);
234 }
235
236 /// Get the source BB of this iterator.
237 inline BB_ *getSource() {
238 assert(Term && "Source not available, if basic block was malformed");
239 return Term->getParent();
240 }
241 };
242
243 typedef SuccIterator succ_iterator;
244 typedef SuccIterator
245 const BasicBlock> succ_const_iterator;
246
247 inline succ_iterator succ_begin(BasicBlock *BB) {
248 return succ_iterator(BB->getTerminator());
249 }
250 inline succ_const_iterator succ_begin(const BasicBlock *BB) {
251 return succ_const_iterator(BB->getTerminator());
252 }
253 inline succ_iterator succ_end(BasicBlock *BB) {
254 return succ_iterator(BB->getTerminator(), true);
255 }
256 inline succ_const_iterator succ_end(const BasicBlock *BB) {
257 return succ_const_iterator(BB->getTerminator(), true);
258 }
259
260 template struct isPodLike > {
261 static const bool value = isPodLike::value;
262 };
263
264
265
266 //===--------------------------------------------------------------------===//
267 // GraphTraits specializations for basic block graphs (CFGs)
268 //===--------------------------------------------------------------------===//
269
270 // Provide specializations of GraphTraits to be able to treat a function as a
271 // graph of basic blocks...
272
273 template <> struct GraphTraits {
274 typedef BasicBlock NodeType;
275 typedef succ_iterator ChildIteratorType;
276
277 static NodeType *getEntryNode(BasicBlock *BB) { return BB; }
278 static inline ChildIteratorType child_begin(NodeType *N) {
279 return succ_begin(N);
280 }
281 static inline ChildIteratorType child_end(NodeType *N) {
282 return succ_end(N);
283 }
284 };
285
286 template <> struct GraphTraits {
287 typedef const BasicBlock NodeType;
288 typedef succ_const_iterator ChildIteratorType;
289
290 static NodeType *getEntryNode(const BasicBlock *BB) { return BB; }
291
292 static inline ChildIteratorType child_begin(NodeType *N) {
293 return succ_begin(N);
294 }
295 static inline ChildIteratorType child_end(NodeType *N) {
296 return succ_end(N);
297 }
298 };
299
300 // Provide specializations of GraphTraits to be able to treat a function as a
301 // graph of basic blocks... and to walk it in inverse order. Inverse order for
302 // a function is considered to be when traversing the predecessor edges of a BB
303 // instead of the successor edges.
304 //
305 template <> struct GraphTraits > {
306 typedef BasicBlock NodeType;
307 typedef pred_iterator ChildIteratorType;
308 static NodeType *getEntryNode(Inverse G) { return G.Graph; }
309 static inline ChildIteratorType child_begin(NodeType *N) {
310 return pred_begin(N);
311 }
312 static inline ChildIteratorType child_end(NodeType *N) {
313 return pred_end(N);
314 }
315 };
316
317 template <> struct GraphTraits > {
318 typedef const BasicBlock NodeType;
319 typedef const_pred_iterator ChildIteratorType;
320 static NodeType *getEntryNode(Inverse G) {
321 return G.Graph;
322 }
323 static inline ChildIteratorType child_begin(NodeType *N) {
324 return pred_begin(N);
325 }
326 static inline ChildIteratorType child_end(NodeType *N) {
327 return pred_end(N);
328 }
329 };
330
331
332
333 //===--------------------------------------------------------------------===//
334 // GraphTraits specializations for function basic block graphs (CFGs)
335 //===--------------------------------------------------------------------===//
336
337 // Provide specializations of GraphTraits to be able to treat a function as a
338 // graph of basic blocks... these are the same as the basic block iterators,
339 // except that the root node is implicitly the first node of the function.
340 //
341 template <> struct GraphTraits : public GraphTraits {
342 static NodeType *getEntryNode(Function *F) { return &F->getEntryBlock(); }
343
344 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
345 typedef Function::iterator nodes_iterator;
346 static nodes_iterator nodes_begin(Function *F) { return F->begin(); }
347 static nodes_iterator nodes_end (Function *F) { return F->end(); }
348 static size_t size (Function *F) { return F->size(); }
349 };
350 template <> struct GraphTraits :
351 public GraphTraits {
352 static NodeType *getEntryNode(const Function *F) {return &F->getEntryBlock();}
353
354 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
355 typedef Function::const_iterator nodes_iterator;
356 static nodes_iterator nodes_begin(const Function *F) { return F->begin(); }
357 static nodes_iterator nodes_end (const Function *F) { return F->end(); }
358 static size_t size (const Function *F) { return F->size(); }
359 };
360
361
362 // Provide specializations of GraphTraits to be able to treat a function as a
363 // graph of basic blocks... and to walk it in inverse order. Inverse order for
364 // a function is considered to be when traversing the predecessor edges of a BB
365 // instead of the successor edges.
366 //
367 template <> struct GraphTraits > :
368 public GraphTraits > {
369 static NodeType *getEntryNode(Inverse G) {
370 return &G.Graph->getEntryBlock();
371 }
372 };
373 template <> struct GraphTraits > :
374 public GraphTraits > {
375 static NodeType *getEntryNode(Inverse G) {
376 return &G.Graph->getEntryBlock();
377 }
378 };
379
380 } // End llvm namespace
381
382 #endif
2222 #include "llvm/ADT/GraphTraits.h"
2323 #include "llvm/ADT/SmallPtrSet.h"
2424 #include "llvm/ADT/SmallVector.h"
25 #include "llvm/Support/CFG.h"
25 #include "llvm/IR/CFG.h"
2626 #include "llvm/Support/Compiler.h"
2727 #include "llvm/Support/raw_ostream.h"
2828 #include
1212
1313 #include "llvm/ADT/DenseMap.h"
1414 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/IR/CFG.h"
1516 #include "llvm/Support/Allocator.h"
16 #include "llvm/Support/CFG.h"
1717
1818 #ifndef LLVM_SUPPORT_PREDITERATORCACHE_H
1919 #define LLVM_SUPPORT_PREDITERATORCACHE_H
1717 // FIXME: Move to this file: BasicBlock::removePredecessor, BB::splitBasicBlock
1818
1919 #include "llvm/IR/BasicBlock.h"
20 #include "llvm/Support/CFG.h"
20 #include "llvm/IR/CFG.h"
2121
2222 namespace llvm {
2323
1515 #include "llvm/Analysis/BranchProbabilityInfo.h"
1616 #include "llvm/Analysis/LoopInfo.h"
1717 #include "llvm/Analysis/Passes.h"
18 #include "llvm/IR/CFG.h"
1819 #include "llvm/InitializePasses.h"
19 #include "llvm/Support/CFG.h"
2020 #include "llvm/Support/CommandLine.h"
2121 #include "llvm/Support/Debug.h"
2222 #include "llvm/Support/GraphWriter.h"
1414 #include "llvm/Analysis/BranchProbabilityInfo.h"
1515 #include "llvm/ADT/PostOrderIterator.h"
1616 #include "llvm/Analysis/LoopInfo.h"
17 #include "llvm/IR/CFG.h"
1718 #include "llvm/IR/Constants.h"
1819 #include "llvm/IR/Function.h"
1920 #include "llvm/IR/Instructions.h"
2021 #include "llvm/IR/LLVMContext.h"
2122 #include "llvm/IR/Metadata.h"
22 #include "llvm/Support/CFG.h"
2323 #include "llvm/Support/Debug.h"
2424
2525 using namespace llvm;
1313
1414 #include "llvm/Analysis/Interval.h"
1515 #include "llvm/IR/BasicBlock.h"
16 #include "llvm/Support/CFG.h"
16 #include "llvm/IR/CFG.h"
1717 #include "llvm/Support/raw_ostream.h"
1818 #include
1919
1717 #include "llvm/ADT/STLExtras.h"
1818 #include "llvm/Analysis/ConstantFolding.h"
1919 #include "llvm/Analysis/ValueTracking.h"
20 #include "llvm/IR/CFG.h"
2021 #include "llvm/IR/Constants.h"
2122 #include "llvm/IR/DataLayout.h"
2223 #include "llvm/IR/Instructions.h"
2324 #include "llvm/IR/IntrinsicInst.h"
2425 #include "llvm/IR/PatternMatch.h"
2526 #include "llvm/IR/ValueHandle.h"
26 #include "llvm/Support/CFG.h"
2727 #include "llvm/Support/ConstantRange.h"
2828 #include "llvm/Support/Debug.h"
2929 #include "llvm/Support/raw_ostream.h"
1919 #include "llvm/Analysis/LoopInfoImpl.h"
2020 #include "llvm/Analysis/LoopIterator.h"
2121 #include "llvm/Analysis/ValueTracking.h"
22 #include "llvm/IR/CFG.h"
2223 #include "llvm/IR/Constants.h"
2324 #include "llvm/IR/Dominators.h"
2425 #include "llvm/IR/Instructions.h"
2526 #include "llvm/IR/Metadata.h"
26 #include "llvm/Support/CFG.h"
2727 #include "llvm/Support/CommandLine.h"
2828 #include "llvm/Support/Debug.h"
2929 #include
1515 #include "llvm/Analysis/PostDominators.h"
1616 #include "llvm/ADT/DepthFirstIterator.h"
1717 #include "llvm/ADT/SetOperations.h"
18 #include "llvm/IR/CFG.h"
1819 #include "llvm/IR/Instructions.h"
19 #include "llvm/Support/CFG.h"
2020 #include "llvm/Support/Debug.h"
2121 #include "llvm/Support/GenericDomTreeConstruction.h"
2222 using namespace llvm;
2727 #include "llvm/CodeGen/MachineLoopInfo.h"
2828 #include "llvm/CodeGen/MachineModuleInfo.h"
2929 #include "llvm/CodeGen/MachineRegisterInfo.h"
30 #include "llvm/IR/CFG.h"
3031 #include "llvm/IR/Constant.h"
3132 #include "llvm/IR/Dominators.h"
3233 #include "llvm/IR/Function.h"
3334 #include "llvm/IR/Instructions.h"
3435 #include "llvm/IR/Type.h"
3536 #include "llvm/Pass.h"
36 #include "llvm/Support/CFG.h"
3737 #include "llvm/Target/TargetInstrInfo.h"
3838 using namespace llvm;
3939
2020 #include "llvm/ADT/StringExtras.h"
2121 #include "llvm/DebugInfo.h"
2222 #include "llvm/IR/AssemblyAnnotationWriter.h"
23 #include "llvm/IR/CFG.h"
2324 #include "llvm/IR/CallingConv.h"
2425 #include "llvm/IR/Constants.h"
2526 #include "llvm/IR/DerivedTypes.h"
3132 #include "llvm/IR/Operator.h"
3233 #include "llvm/IR/TypeFinder.h"
3334 #include "llvm/IR/ValueSymbolTable.h"
34 #include "llvm/Support/CFG.h"
3535 #include "llvm/Support/Debug.h"
3636 #include "llvm/Support/Dwarf.h"
3737 #include "llvm/Support/ErrorHandling.h"
1212
1313 #include "llvm/AutoUpgrade.h"
1414 #include "llvm/DebugInfo.h"
15 #include "llvm/IR/CFG.h"
1516 #include "llvm/IR/CallSite.h"
1617 #include "llvm/IR/Constants.h"
1718 #include "llvm/IR/DiagnosticInfo.h"
2122 #include "llvm/IR/IntrinsicInst.h"
2223 #include "llvm/IR/LLVMContext.h"
2324 #include "llvm/IR/Module.h"
24 #include "llvm/Support/CFG.h"
2525 #include "llvm/Support/ErrorHandling.h"
2626 #include
2727 using namespace llvm;
1313 #include "llvm/IR/BasicBlock.h"
1414 #include "SymbolTableListTraitsImpl.h"
1515 #include "llvm/ADT/STLExtras.h"
16 #include "llvm/IR/CFG.h"
1617 #include "llvm/IR/Constants.h"
1718 #include "llvm/IR/Instructions.h"
1819 #include "llvm/IR/IntrinsicInst.h"
1920 #include "llvm/IR/LLVMContext.h"
2021 #include "llvm/IR/Type.h"
21 #include "llvm/Support/CFG.h"
2222 #include "llvm/Support/LeakDetector.h"
2323 #include
2424 using namespace llvm;
1717 #include "llvm/ADT/DepthFirstIterator.h"
1818 #include "llvm/ADT/SmallPtrSet.h"
1919 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/IR/CFG.h"
2021 #include "llvm/IR/Instructions.h"
21 #include "llvm/Support/CFG.h"
2222 #include "llvm/Support/CommandLine.h"
2323 #include "llvm/Support/Compiler.h"
2424 #include "llvm/Support/Debug.h"
5151 #include "llvm/ADT/SmallVector.h"
5252 #include "llvm/ADT/StringExtras.h"
5353 #include "llvm/DebugInfo.h"
54 #include "llvm/IR/CFG.h"
5455 #include "llvm/IR/CallSite.h"
5556 #include "llvm/IR/CallingConv.h"
5657 #include "llvm/IR/Constants.h"
6566 #include "llvm/IR/PassManager.h"
6667 #include "llvm/InstVisitor.h"
6768 #include "llvm/Pass.h"
68 #include "llvm/Support/CFG.h"
6969 #include "llvm/Support/CommandLine.h"
7070 #include "llvm/Support/ConstantRange.h"
7171 #include "llvm/Support/Debug.h"
2323 #include "llvm/CodeGen/MachineInstrBuilder.h"
2424 #include "llvm/CodeGen/MachineRegisterInfo.h"
2525 #include "llvm/CodeGen/SelectionDAGNodes.h"
26 #include "llvm/IR/CFG.h"
2627 #include "llvm/IR/GlobalValue.h"
2728 #include "llvm/IR/Instructions.h"
2829 #include "llvm/IR/Intrinsics.h"
2930 #include "llvm/IR/Type.h"
30 #include "llvm/Support/CFG.h"
3131 #include "llvm/Support/Debug.h"
3232 #include "llvm/Support/ErrorHandling.h"
3333 #include "llvm/Support/raw_ostream.h"
2424 #include "llvm/CodeGen/MachineInstrBuilder.h"
2525 #include "llvm/CodeGen/MachineRegisterInfo.h"
2626 #include "llvm/CodeGen/SelectionDAGNodes.h"
27 #include "llvm/IR/CFG.h"
2728 #include "llvm/IR/GlobalValue.h"
2829 #include "llvm/IR/Instructions.h"
2930 #include "llvm/IR/Intrinsics.h"
3031 #include "llvm/IR/Type.h"
31 #include "llvm/Support/CFG.h"
3232 #include "llvm/Support/Debug.h"
3333 #include "llvm/Support/ErrorHandling.h"
3434 #include "llvm/Support/raw_ostream.h"
2323 #include "llvm/CodeGen/MachineInstrBuilder.h"
2424 #include "llvm/CodeGen/MachineRegisterInfo.h"
2525 #include "llvm/CodeGen/SelectionDAGNodes.h"
26 #include "llvm/IR/CFG.h"
2627 #include "llvm/IR/GlobalValue.h"
2728 #include "llvm/IR/Instructions.h"
2829 #include "llvm/IR/Intrinsics.h"
2930 #include "llvm/IR/Type.h"
30 #include "llvm/Support/CFG.h"
3131 #include "llvm/Support/Debug.h"
3232 #include "llvm/Support/ErrorHandling.h"
3333 #include "llvm/Support/raw_ostream.h"
3636 #include "llvm/Analysis/AliasAnalysis.h"
3737 #include "llvm/Analysis/CallGraph.h"
3838 #include "llvm/Analysis/CallGraphSCCPass.h"
39 #include "llvm/IR/CFG.h"
3940 #include "llvm/IR/CallSite.h"
4041 #include "llvm/IR/Constants.h"
4142 #include "llvm/IR/DerivedTypes.h"
4243 #include "llvm/IR/Instructions.h"
4344 #include "llvm/IR/LLVMContext.h"
4445 #include "llvm/IR/Module.h"
45 #include "llvm/Support/CFG.h"
4646 #include "llvm/Support/Debug.h"
4747 #include "llvm/Support/raw_ostream.h"
4848 #include
1414 #define DEBUG_TYPE "partialinlining"
1515 #include "llvm/Transforms/IPO.h"
1616 #include "llvm/ADT/Statistic.h"
17 #include "llvm/IR/CFG.h"
1718 #include "llvm/IR/Dominators.h"
1819 #include "llvm/IR/Instructions.h"
1920 #include "llvm/IR/Module.h"
2021 #include "llvm/Pass.h"
21 #include "llvm/Support/CFG.h"
2222 #include "llvm/Transforms/Utils/Cloning.h"
2323 #include "llvm/Transforms/Utils/CodeExtractor.h"
2424 using namespace llvm;
2020 #include "llvm/ADT/Statistic.h"
2121 #include "llvm/Analysis/CallGraph.h"
2222 #include "llvm/Analysis/CallGraphSCCPass.h"
23 #include "llvm/IR/CFG.h"
2324 #include "llvm/IR/Constants.h"
2425 #include "llvm/IR/Function.h"
2526 #include "llvm/IR/Instructions.h"
2627 #include "llvm/IR/IntrinsicInst.h"
2728 #include "llvm/IR/LLVMContext.h"
28 #include "llvm/Support/CFG.h"
2929 #include
3030 using namespace llvm;
3131
4242 #include "llvm/Analysis/ConstantFolding.h"
4343 #include "llvm/Analysis/InstructionSimplify.h"
4444 #include "llvm/Analysis/MemoryBuiltins.h"
45 #include "llvm/IR/CFG.h"
4546 #include "llvm/IR/DataLayout.h"
4647 #include "llvm/IR/GetElementPtrTypeIterator.h"
4748 #include "llvm/IR/IntrinsicInst.h"
4849 #include "llvm/IR/PatternMatch.h"
4950 #include "llvm/IR/ValueHandle.h"
50 #include "llvm/Support/CFG.h"
5151 #include "llvm/Support/CommandLine.h"
5252 #include "llvm/Support/Debug.h"
5353 #include "llvm/Target/TargetLibraryInfo.h"
2323 #include "ObjCARC.h"
2424 #include "DependencyAnalysis.h"
2525 #include "ProvenanceAnalysis.h"
26 #include "llvm/Support/CFG.h"
26 #include "llvm/IR/CFG.h"
2727
2828 using namespace llvm;
2929 using namespace llvm::objcarc;
3434 #include "llvm/ADT/STLExtras.h"
3535 #include "llvm/ADT/SmallPtrSet.h"
3636 #include "llvm/ADT/Statistic.h"
37 #include "llvm/IR/CFG.h"
3738 #include "llvm/IR/IRBuilder.h"
3839 #include "llvm/IR/LLVMContext.h"
39 #include "llvm/Support/CFG.h"
4040 #include "llvm/Support/Debug.h"
4141 #include "llvm/Support/raw_ostream.h"
4242
2020 #include "llvm/ADT/SmallVector.h"
2121 #include "llvm/ADT/Statistic.h"
2222 #include "llvm/IR/BasicBlock.h"
23 #include "llvm/IR/CFG.h"
2324 #include "llvm/IR/InstIterator.h"
2425 #include "llvm/IR/Instructions.h"
2526 #include "llvm/IR/IntrinsicInst.h"
2627 #include "llvm/Pass.h"
27 #include "llvm/Support/CFG.h"
2828 using namespace llvm;
2929
3030 STATISTIC(NumRemoved, "Number of instructions removed");
1515 #include "llvm/ADT/Statistic.h"
1616 #include "llvm/Analysis/InstructionSimplify.h"
1717 #include "llvm/Analysis/LazyValueInfo.h"
18 #include "llvm/IR/CFG.h"
1819 #include "llvm/IR/Constants.h"
1920 #include "llvm/IR/Function.h"
2021 #include "llvm/IR/Instructions.h"
2122 #include "llvm/Pass.h"
22 #include "llvm/Support/CFG.h"
2323 #include "llvm/Support/Debug.h"
2424 #include "llvm/Support/raw_ostream.h"
2525 #include "llvm/Transforms/Utils/Local.h"
1313 #define DEBUG_TYPE "flattencfg"
1414 #include "llvm/Transforms/Scalar.h"
1515 #include "llvm/Analysis/AliasAnalysis.h"
16 #include "llvm/IR/CFG.h"
1617 #include "llvm/Pass.h"
17 #include "llvm/Support/CFG.h"
1818 #include "llvm/Transforms/Utils/Local.h"
1919 using namespace llvm;
2020
3232 #include "llvm/Analysis/LoopPass.h"
3333 #include "llvm/Analysis/ScalarEvolutionExpander.h"
3434 #include "llvm/IR/BasicBlock.h"
35 #include "llvm/IR/CFG.h"
3536 #include "llvm/IR/Constants.h"
3637 #include "llvm/IR/DataLayout.h"
3738 #include "llvm/IR/Dominators.h"
3940 #include "llvm/IR/IntrinsicInst.h"
4041 #include "llvm/IR/LLVMContext.h"
4142 #include "llvm/IR/Type.h"
42 #include "llvm/Support/CFG.h"
4343 #include "llvm/Support/CommandLine.h"
4444 #include "llvm/Support/Debug.h"
4545 #include "llvm/Support/raw_ostream.h"
3939 #include "llvm/Analysis/LoopPass.h"
4040 #include "llvm/Analysis/ScalarEvolution.h"
4141 #include "llvm/Analysis/ValueTracking.h"
42 #include "llvm/IR/CFG.h"
4243 #include "llvm/IR/Constants.h"
4344 #include "llvm/IR/DataLayout.h"
4445 #include "llvm/IR/DerivedTypes.h"
4748 #include "llvm/IR/IntrinsicInst.h"
4849 #include "llvm/IR/LLVMContext.h"
4950 #include "llvm/IR/Metadata.h"
50 #include "llvm/Support/CFG.h"
5151 #include "llvm/Support/CommandLine.h"
5252 #include "llvm/Support/Debug.h"
5353 #include "llvm/Support/PredIteratorCache.h"
1919 #include "llvm/Analysis/ScalarEvolution.h"
2020 #include "llvm/Analysis/TargetTransformInfo.h"
2121 #include "llvm/Analysis/ValueTracking.h"
22 #include "llvm/IR/CFG.h"
2223 #include "llvm/IR/Dominators.h"
2324 #include "llvm/IR/Function.h"
2425 #include "llvm/IR/IntrinsicInst.h"
25 #include "llvm/Support/CFG.h"
2626 #include "llvm/Support/Debug.h"
2727 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
2828 #include "llvm/Transforms/Utils/Local.h"
2626 #include "llvm/ADT/STLExtras.h"
2727 #include "llvm/ADT/SetVector.h"
2828 #include "llvm/ADT/Statistic.h"
29 #include "llvm/IR/CFG.h"
2930 #include "llvm/IR/Constants.h"
3031 #include "llvm/IR/DerivedTypes.h"
3132 #include "llvm/IR/Function.h"
3435 #include "llvm/IR/IntrinsicInst.h"
3536 #include "llvm/IR/ValueHandle.h"
3637 #include "llvm/Pass.h"
37 #include "llvm/Support/CFG.h"
3838 #include "llvm/Support/Debug.h"
3939 #include "llvm/Support/raw_ostream.h"
4040 #include "llvm/Transforms/Utils/Local.h"
1919 #include "llvm/Transforms/Scalar.h"
2020 #include "llvm/ADT/Statistic.h"
2121 #include "llvm/IR/BasicBlock.h"
22 #include "llvm/IR/CFG.h"
2223 #include "llvm/IR/Function.h"
2324 #include "llvm/IR/Instructions.h"
2425 #include "llvm/IR/LLVMContext.h"
2526 #include "llvm/IR/Module.h"
2627 #include "llvm/Pass.h"
27 #include "llvm/Support/CFG.h"
2828 #include "llvm/Transforms/Utils/Local.h"
2929 #include
3030 using namespace llvm;
2727 #include "llvm/ADT/Statistic.h"
2828 #include "llvm/Analysis/TargetTransformInfo.h"
2929 #include "llvm/IR/Attributes.h"
30 #include "llvm/IR/CFG.h"
3031 #include "llvm/IR/Constants.h"
3132 #include "llvm/IR/DataLayout.h"
3233 #include "llvm/IR/Instructions.h"
3334 #include "llvm/IR/IntrinsicInst.h"
3435 #include "llvm/IR/Module.h"
3536 #include "llvm/Pass.h"
36 #include "llvm/Support/CFG.h"
3737 #include "llvm/Transforms/Utils/Local.h"
3838 using namespace llvm;
3939
1717 #include "llvm/Analysis/AliasAnalysis.h"
1818 #include "llvm/Analysis/LoopInfo.h"
1919 #include "llvm/Analysis/ValueTracking.h"
20 #include "llvm/IR/CFG.h"
2021 #include "llvm/IR/Dominators.h"
2122 #include "llvm/IR/IntrinsicInst.h"
22 #include "llvm/Support/CFG.h"
2323 #include "llvm/Support/Debug.h"
2424 #include "llvm/Support/raw_ostream.h"
2525 using namespace llvm;
5959 #include "llvm/Analysis/InstructionSimplify.h"
6060 #include "llvm/Analysis/Loads.h"
6161 #include "llvm/Analysis/TargetTransformInfo.h"
62 #include "llvm/IR/CFG.h"
6263 #include "llvm/IR/CallSite.h"
6364 #include "llvm/IR/Constants.h"
6465 #include "llvm/IR/DerivedTypes.h"
6869 #include "llvm/IR/Module.h"
6970 #include "llvm/IR/ValueHandle.h"
7071 #include "llvm/Pass.h"
71 #include "llvm/Support/CFG.h"
7272 #include "llvm/Support/Debug.h"
7373 #include "llvm/Support/raw_ostream.h"
7474 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
2020 #include "llvm/ADT/Statistic.h"
2121 #include "llvm/Analysis/CFG.h"
2222 #include "llvm/Analysis/LoopInfo.h"
23 #include "llvm/IR/CFG.h"
2324 #include "llvm/IR/Dominators.h"
2425 #include "llvm/IR/Function.h"
2526 #include "llvm/IR/Instructions.h"
2627 #include "llvm/IR/Type.h"
27 #include "llvm/Support/CFG.h"
2828 #include "llvm/Support/ErrorHandling.h"
2929 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
3030 using namespace llvm;
1717 #include "llvm/Analysis/ConstantFolding.h"
1818 #include "llvm/Analysis/InstructionSimplify.h"
1919 #include "llvm/DebugInfo.h"
20 #include "llvm/IR/CFG.h"
2021 #include "llvm/IR/Constants.h"
2122 #include "llvm/IR/DerivedTypes.h"
2223 #include "llvm/IR/Function.h"
2526 #include "llvm/IR/IntrinsicInst.h"
2627 #include "llvm/IR/LLVMContext.h"
2728 #include "llvm/IR/Metadata.h"
28 #include "llvm/Support/CFG.h"
2929 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
3030 #include "llvm/Transforms/Utils/Local.h"
3131 #include "llvm/Transforms/Utils/ValueMapper.h"
2121 #include "llvm/Analysis/ValueTracking.h"
2222 #include "llvm/DIBuilder.h"
2323 #include "llvm/DebugInfo.h"
24 #include "llvm/IR/CFG.h"
2425 #include "llvm/IR/Constants.h"
2526 #include "llvm/IR/DataLayout.h"
2627 #include "llvm/IR/DerivedTypes.h"
3637 #include "llvm/IR/Metadata.h"
3738 #include "llvm/IR/Operator.h"
3839 #include "llvm/IR/ValueHandle.h"
39 #include "llvm/Support/CFG.h"
4040 #include "llvm/Support/Debug.h"
4141 #include "llvm/Support/MathExtras.h"
4242 #include "llvm/Support/raw_ostream.h"
4848 #include "llvm/Analysis/InstructionSimplify.h"
4949 #include "llvm/Analysis/LoopInfo.h"
5050 #include "llvm/Analysis/ScalarEvolution.h"
51 #include "llvm/IR/CFG.h"
5152 #include "llvm/IR/Constants.h"
5253 #include "llvm/IR/Dominators.h"
5354 #include "llvm/IR/Function.h"
5556 #include "llvm/IR/IntrinsicInst.h"
5657 #include "llvm/IR/LLVMContext.h"
5758 #include "llvm/IR/Type.h"
58 #include "llvm/Support/CFG.h"
5959 #include "llvm/Support/Debug.h"
6060 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
6161 #include "llvm/Transforms/Utils/Local.h"
3737 #include "llvm/Analysis/ValueTracking.h"
3838 #include "llvm/DIBuilder.h"
3939 #include "llvm/DebugInfo.h"
40 #include "llvm/IR/CFG.h"
4041 #include "llvm/IR/Constants.h"
4142 #include "llvm/IR/DerivedTypes.h"
4243 #include "llvm/IR/Dominators.h"
4445 #include "llvm/IR/Instructions.h"
4546 #include "llvm/IR/IntrinsicInst.h"
4647 #include "llvm/IR/Metadata.h"
47 #include "llvm/Support/CFG.h"
4848 #include "llvm/Transforms/Utils/Local.h"
4949 #include
5050 #include
1515 #include "llvm/ADT/DenseMap.h"
1616 #include "llvm/ADT/TinyPtrVector.h"
1717 #include "llvm/Analysis/InstructionSimplify.h"
18 #include "llvm/IR/CFG.h"
1819 #include "llvm/IR/Constants.h"
1920 #include "llvm/IR/Instructions.h"
2021 #include "llvm/IR/IntrinsicInst.h"
21 #include "llvm/Support/CFG.h"
2222 #include "llvm/Support/Debug.h"
2323 #include "llvm/Support/raw_ostream.h"
2424 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
2222 #include "llvm/Analysis/InstructionSimplify.h"
2323 #include "llvm/Analysis/TargetTransformInfo.h"
2424 #include "llvm/Analysis/ValueTracking.h"
25 #include "llvm/IR/CFG.h"
2526 #include "llvm/IR/Constants.h"
2627 #include "llvm/IR/DataLayout.h"
2728 #include "llvm/IR/DerivedTypes.h"
3637 #include "llvm/IR/Operator.h"
3738 #include "llvm/IR/PatternMatch.h"
3839 #include "llvm/IR/Type.h"
39 #include "llvm/Support/CFG.h"
4040 #include "llvm/Support/CommandLine.h"
4141 #include "llvm/Support/ConstantRange.h"
4242 #include "llvm/Support/Debug.h"
1414 #include "ListReducer.h"
1515 #include "ToolRunner.h"
1616 #include "llvm/ADT/SmallPtrSet.h"
17 #include "llvm/IR/CFG.h"
1718 #include "llvm/IR/Constants.h"
1819 #include "llvm/IR/DerivedTypes.h"
1920 #include "llvm/IR/Instructions.h"
2223 #include "llvm/IR/Verifier.h"
2324 #include "llvm/Pass.h"
2425 #include "llvm/PassManager.h"
25 #include "llvm/Support/CFG.h"
2626 #include "llvm/Support/CommandLine.h"
2727 #include "llvm/Support/FileUtilities.h"
2828 #include "llvm/Transforms/Scalar.h"
1717 #include "llvm/ADT/SmallVector.h"
1818 #include "llvm/ADT/StringRef.h"
1919 #include "llvm/ADT/StringSet.h"
20 #include "llvm/IR/CFG.h"
2021 #include "llvm/IR/CallSite.h"
2122 #include "llvm/IR/Constants.h"
2223 #include "llvm/IR/Function.h"
2324 #include "llvm/IR/Instructions.h"
2425 #include "llvm/IR/Module.h"
25 #include "llvm/Support/CFG.h"
2626 #include "llvm/Support/ErrorHandling.h"
2727 #include "llvm/Support/raw_ostream.h"
2828 #include "llvm/Support/type_traits.h"
2626
2727 #include "llvm/ADT/SCCIterator.h"
2828 #include "llvm/Analysis/CallGraph.h"
29 #include "llvm/IR/CFG.h"
2930 #include "llvm/IR/Module.h"
3031 #include "llvm/Pass.h"
31 #include "llvm/Support/CFG.h"
3232 #include "llvm/Support/raw_ostream.h"
3333 using namespace llvm;
3434