LLVM 22.0.0git
MustExecute.h
Go to the documentation of this file.
1//===- MustExecute.h - Is an instruction known to execute--------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8/// \file
9/// Contains a collection of routines for determining if a given instruction is
10/// guaranteed to execute if a given point in control flow is reached. The most
11/// common example is an instruction within a loop being provably executed if we
12/// branch to the header of it's containing loop.
13///
14/// There are two interfaces available to determine if an instruction is
15/// executed once a given point in the control flow is reached:
16/// 1) A loop-centric one derived from LoopSafetyInfo.
17/// 2) A "must be executed context"-based one implemented in the
18/// MustBeExecutedContextExplorer.
19/// Please refer to the class comments for more information.
20///
21//===----------------------------------------------------------------------===//
22
23#ifndef LLVM_ANALYSIS_MUSTEXECUTE_H
24#define LLVM_ANALYSIS_MUSTEXECUTE_H
25
26#include "llvm/ADT/DenseMap.h"
27#include "llvm/ADT/DenseSet.h"
30#include "llvm/IR/PassManager.h"
32
33namespace llvm {
34
35namespace {
36template <typename T> using GetterTy = std::function<T *(const Function &F)>;
37}
38
39class BasicBlock;
40class DominatorTree;
41class Loop;
42class LoopInfo;
43class PostDominatorTree;
44class raw_ostream;
45
46/// Captures loop safety information.
47/// It keep information for loop blocks may throw exception or otherwise
48/// exit abnormally on any iteration of the loop which might actually execute
49/// at runtime. The primary way to consume this information is via
50/// isGuaranteedToExecute below, but some callers bailout or fallback to
51/// alternate reasoning if a loop contains any implicit control flow.
52/// NOTE: LoopSafetyInfo contains cached information regarding loops and their
53/// particular blocks. This information is only dropped on invocation of
54/// computeLoopSafetyInfo. If the loop or any of its block is deleted, or if
55/// any thrower instructions have been added or removed from them, or if the
56/// control flow has changed, or in case of other meaningful modifications, the
57/// LoopSafetyInfo needs to be recomputed. If a meaningful modifications to the
58/// loop were made and the info wasn't recomputed properly, the behavior of all
59/// methods except for computeLoopSafetyInfo is undefined.
61 // Used to update funclet bundle operands.
63
64protected:
65 /// Computes block colors.
66 LLVM_ABI void computeBlockColors(const Loop *CurLoop);
67
68public:
69 /// Returns block colors map that is used to update funclet operand bundles.
71
72 /// Copy colors of block \p Old into the block \p New.
74
75 /// Returns true iff the block \p BB potentially may throw exception. It can
76 /// be false-positive in cases when we want to avoid complex analysis.
77 virtual bool blockMayThrow(const BasicBlock *BB) const = 0;
78
79 /// Returns true iff any block of the loop for which this info is contains an
80 /// instruction that may throw or otherwise exit abnormally.
81 virtual bool anyBlockMayThrow() const = 0;
82
83 /// Return true if we must reach the block \p BB under assumption that the
84 /// loop \p CurLoop is entered.
85 LLVM_ABI bool allLoopPathsLeadToBlock(const Loop *CurLoop,
86 const BasicBlock *BB,
87 const DominatorTree *DT) const;
88
89 /// Computes safety information for a loop checks loop body & header for
90 /// the possibility of may throw exception, it takes LoopSafetyInfo and loop
91 /// as argument. Updates safety information in LoopSafetyInfo argument.
92 /// Note: This is defined to clear and reinitialize an already initialized
93 /// LoopSafetyInfo. Some callers rely on this fact.
94 virtual void computeLoopSafetyInfo(const Loop *CurLoop) = 0;
95
96 /// Returns true if the instruction in a loop is guaranteed to execute at
97 /// least once (under the assumption that the loop is entered).
98 virtual bool isGuaranteedToExecute(const Instruction &Inst,
99 const DominatorTree *DT,
100 const Loop *CurLoop) const = 0;
101
102 LoopSafetyInfo() = default;
103
104 virtual ~LoopSafetyInfo() = default;
105};
106
107
108/// Simple and conservative implementation of LoopSafetyInfo that can give
109/// false-positive answers to its queries in order to avoid complicated
110/// analysis.
112 bool MayThrow = false; // The current loop contains an instruction which
113 // may throw.
114 bool HeaderMayThrow = false; // Same as previous, but specific to loop header
115
116public:
117 bool blockMayThrow(const BasicBlock *BB) const override;
118
119 bool anyBlockMayThrow() const override;
120
121 void computeLoopSafetyInfo(const Loop *CurLoop) override;
122
123 bool isGuaranteedToExecute(const Instruction &Inst,
124 const DominatorTree *DT,
125 const Loop *CurLoop) const override;
126};
127
128/// This implementation of LoopSafetyInfo use ImplicitControlFlowTracking to
129/// give precise answers on "may throw" queries. This implementation uses cache
130/// that should be invalidated by calling the methods insertInstructionTo and
131/// removeInstruction whenever we modify a basic block's contents by adding or
132/// removing instructions.
134 bool MayThrow = false; // The current loop contains an instruction which
135 // may throw.
136 // Contains information about implicit control flow in this loop's blocks.
137 mutable ImplicitControlFlowTracking ICF;
138 // Contains information about instruction that may possibly write memory.
139 mutable MemoryWriteTracking MW;
140
141public:
142 bool blockMayThrow(const BasicBlock *BB) const override;
143
144 bool anyBlockMayThrow() const override;
145
146 void computeLoopSafetyInfo(const Loop *CurLoop) override;
147
148 bool isGuaranteedToExecute(const Instruction &Inst,
149 const DominatorTree *DT,
150 const Loop *CurLoop) const override;
151
152 /// Returns true if we could not execute a memory-modifying instruction before
153 /// we enter \p BB under assumption that \p CurLoop is entered.
154 bool doesNotWriteMemoryBefore(const BasicBlock *BB, const Loop *CurLoop)
155 const;
156
157 /// Returns true if we could not execute a memory-modifying instruction before
158 /// we execute \p I under assumption that \p CurLoop is entered.
159 bool doesNotWriteMemoryBefore(const Instruction &I, const Loop *CurLoop)
160 const;
161
162 /// Inform the safety info that we are planning to insert a new instruction
163 /// \p Inst into the basic block \p BB. It will make all cache updates to keep
164 /// it correct after this insertion.
165 void insertInstructionTo(const Instruction *Inst, const BasicBlock *BB);
166
167 /// Inform safety info that we are planning to remove the instruction \p Inst
168 /// from its block. It will make all cache updates to keep it correct after
169 /// this removal.
170 void removeInstruction(const Instruction *Inst);
171};
172
174 const LoopInfo *LI);
175
177
178/// Enum that allows us to spell out the direction.
180 BACKWARD = 0,
181 FORWARD = 1,
182};
183
184/// Must be executed iterators visit stretches of instructions that are
185/// guaranteed to be executed together, potentially with other instruction
186/// executed in-between.
187///
188/// Given the following code, and assuming all statements are single
189/// instructions which transfer execution to the successor (see
190/// isGuaranteedToTransferExecutionToSuccessor), there are two possible
191/// outcomes. If we start the iterator at A, B, or E, we will visit only A, B,
192/// and E. If we start at C or D, we will visit all instructions A-E.
193///
194/// \code
195/// A;
196/// B;
197/// if (...) {
198/// C;
199/// D;
200/// }
201/// E;
202/// \endcode
203///
204///
205/// Below is the example extneded with instructions F and G. Now we assume F
206/// might not transfer execution to it's successor G. As a result we get the
207/// following visit sets:
208///
209/// Start Instruction | Visit Set
210/// A | A, B, E, F
211/// B | A, B, E, F
212/// C | A, B, C, D, E, F
213/// D | A, B, C, D, E, F
214/// E | A, B, E, F
215/// F | A, B, E, F
216/// G | A, B, E, F, G
217///
218///
219/// \code
220/// A;
221/// B;
222/// if (...) {
223/// C;
224/// D;
225/// }
226/// E;
227/// F; // Might not transfer execution to its successor G.
228/// G;
229/// \endcode
230///
231///
232/// A more complex example involving conditionals, loops, break, and continue
233/// is shown below. We again assume all instructions will transmit control to
234/// the successor and we assume we can prove the inner loop to be finite. We
235/// omit non-trivial branch conditions as the exploration is oblivious to them.
236/// Constant branches are assumed to be unconditional in the CFG. The resulting
237/// visist sets are shown in the table below.
238///
239/// \code
240/// A;
241/// while (true) {
242/// B;
243/// if (...)
244/// C;
245/// if (...)
246/// continue;
247/// D;
248/// if (...)
249/// break;
250/// do {
251/// if (...)
252/// continue;
253/// E;
254/// } while (...);
255/// F;
256/// }
257/// G;
258/// \endcode
259///
260/// Start Instruction | Visit Set
261/// A | A, B
262/// B | A, B
263/// C | A, B, C
264/// D | A, B, D
265/// E | A, B, D, E, F
266/// F | A, B, D, F
267/// G | A, B, D, G
268///
269///
270/// Note that the examples show optimal visist sets but not necessarily the ones
271/// derived by the explorer depending on the available CFG analyses (see
272/// MustBeExecutedContextExplorer). Also note that we, depending on the options,
273/// the visit set can contain instructions from other functions.
275 /// Type declarations that make his class an input iterator.
276 ///{
277 typedef const Instruction *value_type;
278 typedef std::ptrdiff_t difference_type;
279 typedef const Instruction **pointer;
280 typedef const Instruction *&reference;
281 typedef std::input_iterator_tag iterator_category;
282 ///}
283
285
287
289 : Visited(std::move(Other.Visited)), Explorer(Other.Explorer),
290 CurInst(Other.CurInst), Head(Other.Head), Tail(Other.Tail) {}
291
293 if (this != &Other) {
294 std::swap(Visited, Other.Visited);
295 std::swap(CurInst, Other.CurInst);
296 std::swap(Head, Other.Head);
297 std::swap(Tail, Other.Tail);
298 }
299 return *this;
300 }
301
303
304 /// Pre- and post-increment operators.
305 ///{
307 CurInst = advance();
308 return *this;
309 }
310
312 MustBeExecutedIterator tmp(*this);
313 operator++();
314 return tmp;
315 }
316 ///}
317
318 /// Equality and inequality operators. Note that we ignore the history here.
319 ///{
321 return CurInst == Other.CurInst && Head == Other.Head && Tail == Other.Tail;
322 }
323
325 return !(*this == Other);
326 }
327 ///}
328
329 /// Return the underlying instruction.
330 const Instruction *&operator*() { return CurInst; }
331 const Instruction *getCurrentInst() const { return CurInst; }
332
333 /// Return true if \p I was encountered by this iterator already.
334 bool count(const Instruction *I) const {
335 return Visited.count({I, ExplorationDirection::FORWARD}) ||
336 Visited.count({I, ExplorationDirection::BACKWARD});
337 }
338
339private:
340 using VisitedSetTy =
342
343 /// Private constructors.
345
346 /// Reset the iterator to its initial state pointing at \p I.
347 void reset(const Instruction *I);
348
349 /// Reset the iterator to point at \p I, keep cached state.
350 void resetInstruction(const Instruction *I);
351
352 /// Try to advance one of the underlying positions (Head or Tail).
353 ///
354 /// \return The next instruction in the must be executed context, or nullptr
355 /// if none was found.
356 LLVM_ABI const Instruction *advance();
357
358 /// A set to track the visited instructions in order to deal with endless
359 /// loops and recursion.
360 VisitedSetTy Visited;
361
362 /// A reference to the explorer that created this iterator.
363 ExplorerTy &Explorer;
364
365 /// The instruction we are currently exposing to the user. There is always an
366 /// instruction that we know is executed with the given program point,
367 /// initially the program point itself.
368 const Instruction *CurInst;
369
370 /// Two positions that mark the program points where this iterator will look
371 /// for the next instruction. Note that the current instruction is either the
372 /// one pointed to by Head, Tail, or both.
373 const Instruction *Head, *Tail;
374
376};
377
378/// A "must be executed context" for a given program point PP is the set of
379/// instructions, potentially before and after PP, that are executed always when
380/// PP is reached. The MustBeExecutedContextExplorer an interface to explore
381/// "must be executed contexts" in a module through the use of
382/// MustBeExecutedIterator.
383///
384/// The explorer exposes "must be executed iterators" that traverse the must be
385/// executed context. There is little information sharing between iterators as
386/// the expected use case involves few iterators for "far apart" instructions.
387/// If that changes, we should consider caching more intermediate results.
389
390 /// In the description of the parameters we use PP to denote a program point
391 /// for which the must be executed context is explored, or put differently,
392 /// for which the MustBeExecutedIterator is created.
393 ///
394 /// \param ExploreInterBlock Flag to indicate if instructions in blocks
395 /// other than the parent of PP should be
396 /// explored.
397 /// \param ExploreCFGForward Flag to indicate if instructions located after
398 /// PP in the CFG, e.g., post-dominating PP,
399 /// should be explored.
400 /// \param ExploreCFGBackward Flag to indicate if instructions located
401 /// before PP in the CFG, e.g., dominating PP,
402 /// should be explored.
405 GetterTy<const LoopInfo> LIGetter =
406 [](const Function &) { return nullptr; },
407 GetterTy<const DominatorTree> DTGetter =
408 [](const Function &) { return nullptr; },
409 GetterTy<const PostDominatorTree> PDTGetter =
410 [](const Function &) { return nullptr; })
413 ExploreCFGBackward(ExploreCFGBackward), LIGetter(LIGetter),
414 DTGetter(DTGetter), PDTGetter(PDTGetter), EndIterator(*this, nullptr) {}
415
416 /// Iterator-based interface. \see MustBeExecutedIterator.
417 ///{
420
421 /// Return an iterator to explore the context around \p PP.
423 auto &It = InstructionIteratorMap[PP];
424 if (!It)
425 It.reset(new iterator(*this, PP));
426 return *It;
427 }
428
429 /// Return an iterator to explore the cached context around \p PP.
430 const_iterator &begin(const Instruction *PP) const {
431 return *InstructionIteratorMap.find(PP)->second;
432 }
433
434 /// Return an universal end iterator.
435 ///{
436 iterator &end() { return EndIterator; }
437 iterator &end(const Instruction *) { return EndIterator; }
438
439 const_iterator &end() const { return EndIterator; }
440 const_iterator &end(const Instruction *) const { return EndIterator; }
441 ///}
442
443 /// Return an iterator range to explore the context around \p PP.
445 return llvm::make_range(begin(PP), end(PP));
446 }
447
448 /// Return an iterator range to explore the cached context around \p PP.
450 return llvm::make_range(begin(PP), end(PP));
451 }
452 ///}
453
454 /// Check \p Pred on all instructions in the context.
455 ///
456 /// This method will evaluate \p Pred and return
457 /// true if \p Pred holds in every instruction.
459 function_ref<bool(const Instruction *)> Pred) {
460 for (auto EIt = begin(PP), EEnd = end(PP); EIt != EEnd; ++EIt)
461 if (!Pred(*EIt))
462 return false;
463 return true;
464 }
465
466 /// Helper to look for \p I in the context of \p PP.
467 ///
468 /// The context is expanded until \p I was found or no more expansion is
469 /// possible.
470 ///
471 /// \returns True, iff \p I was found.
472 bool findInContextOf(const Instruction *I, const Instruction *PP) {
473 auto EIt = begin(PP), EEnd = end(PP);
474 return findInContextOf(I, EIt, EEnd);
475 }
476
477 /// Helper to look for \p I in the context defined by \p EIt and \p EEnd.
478 ///
479 /// The context is expanded until \p I was found or no more expansion is
480 /// possible.
481 ///
482 /// \returns True, iff \p I was found.
483 bool findInContextOf(const Instruction *I, iterator &EIt, iterator &EEnd) {
484 bool Found = EIt.count(I);
485 while (!Found && EIt != EEnd)
486 Found = (++EIt).getCurrentInst() == I;
487 return Found;
488 }
489
490 /// Return the next instruction that is guaranteed to be executed after \p PP.
491 ///
492 /// \param It The iterator that is used to traverse the must be
493 /// executed context.
494 /// \param PP The program point for which the next instruction
495 /// that is guaranteed to execute is determined.
496 LLVM_ABI const Instruction *
498 const Instruction *PP);
499 /// Return the previous instr. that is guaranteed to be executed before \p PP.
500 ///
501 /// \param It The iterator that is used to traverse the must be
502 /// executed context.
503 /// \param PP The program point for which the previous instr.
504 /// that is guaranteed to execute is determined.
505 LLVM_ABI const Instruction *
507 const Instruction *PP);
508
509 /// Find the next join point from \p InitBB in forward direction.
511
512 /// Find the next join point from \p InitBB in backward direction.
514
515 /// Parameter that limit the performed exploration. See the constructor for
516 /// their meaning.
517 ///{
521 ///}
522
523private:
524 /// Getters for common CFG analyses: LoopInfo, DominatorTree, and
525 /// PostDominatorTree.
526 ///{
527 GetterTy<const LoopInfo> LIGetter;
528 GetterTy<const DominatorTree> DTGetter;
529 GetterTy<const PostDominatorTree> PDTGetter;
530 ///}
531
532 /// Map to cache isGuaranteedToTransferExecutionToSuccessor results.
534
535 /// Map to cache containsIrreducibleCFG results.
537
538 /// Map from instructions to associated must be executed iterators.
540 InstructionIteratorMap;
541
542 /// A unique end iterator.
543 MustBeExecutedIterator EndIterator;
544};
545
546class MustExecutePrinterPass : public PassInfoMixin<MustExecutePrinterPass> {
547 raw_ostream &OS;
548
549public:
552 static bool isRequired() { return true; }
553};
554
556 : public PassInfoMixin<MustBeExecutedContextPrinterPass> {
557 raw_ostream &OS;
558
559public:
562 static bool isRequired() { return true; }
563};
564
565} // namespace llvm
566
567#endif
#define LLVM_ABI
Definition: Compiler.h:213
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
raw_pwrite_stream & OS
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:255
LLVM Basic Block Representation.
Definition: BasicBlock.h:62
Implements a dense probed hash-table based set.
Definition: DenseSet.h:263
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:165
This implementation of LoopSafetyInfo use ImplicitControlFlowTracking to give precise answers on "may...
Definition: MustExecute.h:133
This class allows to keep track on instructions with implicit control flow.
Captures loop safety information.
Definition: MustExecute.h:60
LLVM_ABI bool allLoopPathsLeadToBlock(const Loop *CurLoop, const BasicBlock *BB, const DominatorTree *DT) const
Return true if we must reach the block BB under assumption that the loop CurLoop is entered.
LLVM_ABI void copyColors(BasicBlock *New, BasicBlock *Old)
Copy colors of block Old into the block New.
Definition: MustExecute.cpp:34
LLVM_ABI void computeBlockColors(const Loop *CurLoop)
Computes block colors.
LLVM_ABI const DenseMap< BasicBlock *, ColorVector > & getBlockColors() const
Returns block colors map that is used to update funclet operand bundles.
Definition: MustExecute.cpp:30
virtual ~LoopSafetyInfo()=default
virtual void computeLoopSafetyInfo(const Loop *CurLoop)=0
Computes safety information for a loop checks loop body & header for the possibility of may throw exc...
LoopSafetyInfo()=default
virtual bool anyBlockMayThrow() const =0
Returns true iff any block of the loop for which this info is contains an instruction that may throw ...
virtual bool blockMayThrow(const BasicBlock *BB) const =0
Returns true iff the block BB potentially may throw exception.
virtual bool isGuaranteedToExecute(const Instruction &Inst, const DominatorTree *DT, const Loop *CurLoop) const =0
Returns true if the instruction in a loop is guaranteed to execute at least once (under the assumptio...
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:40
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
MustBeExecutedContextPrinterPass(raw_ostream &OS)
Definition: MustExecute.h:560
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
MustExecutePrinterPass(raw_ostream &OS)
Definition: MustExecute.h:550
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:112
Simple and conservative implementation of LoopSafetyInfo that can give false-positive answers to its ...
Definition: MustExecute.h:111
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
Definition: DenseSet.h:174
An efficient, type-erasing, non-owning reference to a callable.
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:81
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
@ Other
Any other memory.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1886
LLVM_ABI bool mayContainIrreducibleControl(const Function &F, const LoopInfo *LI)
ExplorationDirection
Enum that allows us to spell out the direction.
Definition: MustExecute.h:179
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:856
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:858
A "must be executed context" for a given program point PP is the set of instructions,...
Definition: MustExecute.h:388
const bool ExploreInterBlock
Parameter that limit the performed exploration.
Definition: MustExecute.h:518
const_iterator & begin(const Instruction *PP) const
Return an iterator to explore the cached context around PP.
Definition: MustExecute.h:430
LLVM_ABI const BasicBlock * findBackwardJoinPoint(const BasicBlock *InitBB)
Find the next join point from InitBB in backward direction.
LLVM_ABI const Instruction * getMustBeExecutedNextInstruction(MustBeExecutedIterator &It, const Instruction *PP)
Return the next instruction that is guaranteed to be executed after PP.
iterator & end()
Return an universal end iterator.
Definition: MustExecute.h:436
MustBeExecutedContextExplorer(bool ExploreInterBlock, bool ExploreCFGForward, bool ExploreCFGBackward, GetterTy< const LoopInfo > LIGetter=[](const Function &) { return nullptr;}, GetterTy< const DominatorTree > DTGetter=[](const Function &) { return nullptr;}, GetterTy< const PostDominatorTree > PDTGetter=[](const Function &) { return nullptr;})
In the description of the parameters we use PP to denote a program point for which the must be execut...
Definition: MustExecute.h:403
bool findInContextOf(const Instruction *I, const Instruction *PP)
Helper to look for I in the context of PP.
Definition: MustExecute.h:472
const_iterator & end() const
Definition: MustExecute.h:439
iterator & begin(const Instruction *PP)
Return an iterator to explore the context around PP.
Definition: MustExecute.h:422
llvm::iterator_range< iterator > range(const Instruction *PP)
}
Definition: MustExecute.h:444
LLVM_ABI const Instruction * getMustBeExecutedPrevInstruction(MustBeExecutedIterator &It, const Instruction *PP)
Return the previous instr.
bool checkForAllContext(const Instruction *PP, function_ref< bool(const Instruction *)> Pred)
}
Definition: MustExecute.h:458
LLVM_ABI const BasicBlock * findForwardJoinPoint(const BasicBlock *InitBB)
Find the next join point from InitBB in forward direction.
const_iterator & end(const Instruction *) const
Definition: MustExecute.h:440
bool findInContextOf(const Instruction *I, iterator &EIt, iterator &EEnd)
Helper to look for I in the context defined by EIt and EEnd.
Definition: MustExecute.h:483
iterator & end(const Instruction *)
Definition: MustExecute.h:437
llvm::iterator_range< const_iterator > range(const Instruction *PP) const
Return an iterator range to explore the cached context around PP.
Definition: MustExecute.h:449
MustBeExecutedIterator iterator
Iterator-based interface.
Definition: MustExecute.h:418
Must be executed iterators visit stretches of instructions that are guaranteed to be executed togethe...
Definition: MustExecute.h:274
bool operator!=(const MustBeExecutedIterator &Other) const
Definition: MustExecute.h:324
const Instruction * value_type
Type declarations that make his class an input iterator.
Definition: MustExecute.h:277
MustBeExecutedIterator(const MustBeExecutedIterator &Other)=default
MustBeExecutedContextExplorer ExplorerTy
}
Definition: MustExecute.h:284
const Instruction *& reference
Definition: MustExecute.h:280
const Instruction ** pointer
Definition: MustExecute.h:279
const Instruction * getCurrentInst() const
Definition: MustExecute.h:331
bool operator==(const MustBeExecutedIterator &Other) const
}
Definition: MustExecute.h:320
std::input_iterator_tag iterator_category
Definition: MustExecute.h:281
MustBeExecutedIterator(MustBeExecutedIterator &&Other)
Definition: MustExecute.h:288
std::ptrdiff_t difference_type
Definition: MustExecute.h:278
MustBeExecutedIterator & operator=(MustBeExecutedIterator &&Other)
Definition: MustExecute.h:292
bool count(const Instruction *I) const
Return true if I was encountered by this iterator already.
Definition: MustExecute.h:334
MustBeExecutedIterator operator++(int)
Definition: MustExecute.h:311
friend struct MustBeExecutedContextExplorer
Definition: MustExecute.h:375
MustBeExecutedIterator & operator++()
Pre- and post-increment operators.
Definition: MustExecute.h:306
const Instruction *& operator*()
}
Definition: MustExecute.h:330
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:70