struct MustBeExecutedContextExplorer
Declaration
struct MustBeExecutedContextExplorer { /* full declaration omitted */ };
Description
A "must be executed context" for a given program point PP is the set of instructions, potentially before and after PP, that are executed always when PP is reached. The MustBeExecutedContextExplorer an interface to explore "must be executed contexts" in a module through the use of MustBeExecutedIterator. The explorer exposes "must be executed iterators" that traverse the must be executed context. There is little information sharing between iterators as the expected use case involves few iterators for "far apart" instructions. If that changes, we should consider caching more intermediate results.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:386
Member Variables
- public const bool ExploreInterBlock
- Parameter that limit the performed exploration. See the constructor for their meaning. {
- public const bool ExploreCFGForward
- public const bool ExploreCFGBackward
- private GetterTy<const llvm::LoopInfo> LIGetter
- Getters for common CFG analyses: LoopInfo, DominatorTree, and PostDominatorTree. {
- private GetterTy<const llvm::DominatorTree> DTGetter
- private GetterTy<const llvm::PostDominatorTree> PDTGetter
- private DenseMap<const llvm::BasicBlock*, Optional<bool>> BlockTransferMap
- Map to cache isGuaranteedToTransferExecutionToSuccessor results.
- private DenseMap<const llvm::Function*, Optional<bool>> IrreducibleControlMap
- Map to cache containsIrreducibleCFG results.
- private DenseMap<const llvm::Instruction*, std::unique_ptr<MustBeExecutedIterator>> InstructionIteratorMap
- Map from instructions to associated must be executed iterators.
- private llvm::MustBeExecutedIterator EndIterator
- A unique end iterator.
Method Overview
- public MustBeExecutedContextExplorer(bool ExploreInterBlock, bool ExploreCFGForward, bool ExploreCFGBackward, GetterTy<const llvm::LoopInfo> LIGetter = [](const llvm::Function &) { return nullptr; }, GetterTy<const llvm::DominatorTree> DTGetter = [](const llvm::Function &) { return nullptr; }, GetterTy<const llvm::PostDominatorTree> PDTGetter = [](const llvm::Function &) { return nullptr; })
- public llvm::MustBeExecutedContextExplorer::iterator & begin(const llvm::Instruction * PP)
- public llvm::MustBeExecutedContextExplorer::const_iterator & begin(const llvm::Instruction * PP) const
- public bool checkForAllContext(const llvm::Instruction * PP, function_ref<bool (const llvm::Instruction *)> Pred)
- public llvm::MustBeExecutedContextExplorer::iterator & end()
- public llvm::MustBeExecutedContextExplorer::iterator & end(const llvm::Instruction *)
- public llvm::MustBeExecutedContextExplorer::const_iterator & end() const
- public llvm::MustBeExecutedContextExplorer::const_iterator & end(const llvm::Instruction *) const
- public const llvm::BasicBlock * findBackwardJoinPoint(const llvm::BasicBlock * InitBB)
- public const llvm::BasicBlock * findForwardJoinPoint(const llvm::BasicBlock * InitBB)
- public bool findInContextOf(const llvm::Instruction * I, const llvm::Instruction * PP)
- public bool findInContextOf(const llvm::Instruction * I, llvm::MustBeExecutedContextExplorer::iterator & EIt, llvm::MustBeExecutedContextExplorer::iterator & EEnd)
- public const llvm::Instruction * getMustBeExecutedNextInstruction(llvm::MustBeExecutedIterator & It, const llvm::Instruction * PP)
- public const llvm::Instruction * getMustBeExecutedPrevInstruction(llvm::MustBeExecutedIterator & It, const llvm::Instruction * PP)
- public llvm::iterator_range<iterator> range(const llvm::Instruction * PP)
- public llvm::iterator_range<const_iterator> range(const llvm::Instruction * PP) const
Methods
¶MustBeExecutedContextExplorer(
bool ExploreInterBlock,
bool ExploreCFGForward,
bool ExploreCFGBackward,
GetterTy<const llvm::LoopInfo> LIGetter =
[](const llvm::Function&) {
return nullptr;
},
GetterTy<const llvm::DominatorTree> DTGetter =
[](const llvm::Function&) {
return nullptr;
},
GetterTy<const llvm::PostDominatorTree>
PDTGetter =
[](const llvm::Function&) {
return nullptr;
})
MustBeExecutedContextExplorer(
bool ExploreInterBlock,
bool ExploreCFGForward,
bool ExploreCFGBackward,
GetterTy<const llvm::LoopInfo> LIGetter =
[](const llvm::Function&) {
return nullptr;
},
GetterTy<const llvm::DominatorTree> DTGetter =
[](const llvm::Function&) {
return nullptr;
},
GetterTy<const llvm::PostDominatorTree>
PDTGetter =
[](const llvm::Function&) {
return nullptr;
})
Description
In the description of the parameters we use PP to denote a program point for which the must be executed context is explored, or put differently, for which the MustBeExecutedIterator is created.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:401
Parameters
- bool ExploreInterBlock
- Flag to indicate if instructions in blocks other than the parent of PP should be explored.
- bool ExploreCFGForward
- Flag to indicate if instructions located after PP in the CFG, e.g., post-dominating PP, should be explored.
- bool ExploreCFGBackward
- Flag to indicate if instructions located before PP in the CFG, e.g., dominating PP, should be explored.
- GetterTy<const llvm::LoopInfo> LIGetter = [](const llvm::Function &) { return nullptr; }
- GetterTy<const llvm::DominatorTree> DTGetter = [](const llvm::Function &) { return nullptr; }
- GetterTy<const llvm::PostDominatorTree> PDTGetter = [](const llvm::Function &) { return nullptr; }
¶llvm::MustBeExecutedContextExplorer::iterator&
begin(const llvm::Instruction* PP)
llvm::MustBeExecutedContextExplorer::iterator&
begin(const llvm::Instruction* PP)
Description
Return an iterator to explore the context around \p PP.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:420
Parameters
- const llvm::Instruction* PP
¶llvm::MustBeExecutedContextExplorer::
const_iterator&
begin(const llvm::Instruction* PP) const
llvm::MustBeExecutedContextExplorer::
const_iterator&
begin(const llvm::Instruction* PP) const
Description
Return an iterator to explore the cached context around \p PP.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:428
Parameters
- const llvm::Instruction* PP
¶bool checkForAllContext(
const llvm::Instruction* PP,
function_ref<bool(const llvm::Instruction*)>
Pred)
bool checkForAllContext(
const llvm::Instruction* PP,
function_ref<bool(const llvm::Instruction*)>
Pred)
Description
Check \p Pred on all instructions in the context. This method will evaluate \p Pred and return true if \p Pred holds in every instruction.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:456
Parameters
- const llvm::Instruction* PP
- function_ref<bool(const llvm::Instruction*)> Pred
¶llvm::MustBeExecutedContextExplorer::iterator&
end()
llvm::MustBeExecutedContextExplorer::iterator&
end()
Description
Return an universal end iterator. {
Declared at: llvm/include/llvm/Analysis/MustExecute.h:434
¶llvm::MustBeExecutedContextExplorer::iterator&
end(const llvm::Instruction*)
llvm::MustBeExecutedContextExplorer::iterator&
end(const llvm::Instruction*)
Declared at: llvm/include/llvm/Analysis/MustExecute.h:435
Parameters
- const llvm::Instruction*
¶llvm::MustBeExecutedContextExplorer::
const_iterator&
end() const
llvm::MustBeExecutedContextExplorer::
const_iterator&
end() const
Declared at: llvm/include/llvm/Analysis/MustExecute.h:437
¶llvm::MustBeExecutedContextExplorer::
const_iterator&
end(const llvm::Instruction*) const
llvm::MustBeExecutedContextExplorer::
const_iterator&
end(const llvm::Instruction*) const
Declared at: llvm/include/llvm/Analysis/MustExecute.h:438
Parameters
- const llvm::Instruction*
¶const llvm::BasicBlock* findBackwardJoinPoint(
const llvm::BasicBlock* InitBB)
const llvm::BasicBlock* findBackwardJoinPoint(
const llvm::BasicBlock* InitBB)
Description
Find the next join point from \p InitBB in backward direction.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:511
Parameters
- const llvm::BasicBlock* InitBB
¶const llvm::BasicBlock* findForwardJoinPoint(
const llvm::BasicBlock* InitBB)
const llvm::BasicBlock* findForwardJoinPoint(
const llvm::BasicBlock* InitBB)
Description
Find the next join point from \p InitBB in forward direction.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:508
Parameters
- const llvm::BasicBlock* InitBB
¶bool findInContextOf(const llvm::Instruction* I,
const llvm::Instruction* PP)
bool findInContextOf(const llvm::Instruction* I,
const llvm::Instruction* PP)
Description
Helper to look for \p I in the context of \p PP. The context is expanded until \p I was found or no more expansion is possible.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:470
Parameters
- const llvm::Instruction* I
- const llvm::Instruction* PP
Returns
True, iff \p I was found.
¶bool findInContextOf(
const llvm::Instruction* I,
llvm::MustBeExecutedContextExplorer::iterator&
EIt,
llvm::MustBeExecutedContextExplorer::iterator&
EEnd)
bool findInContextOf(
const llvm::Instruction* I,
llvm::MustBeExecutedContextExplorer::iterator&
EIt,
llvm::MustBeExecutedContextExplorer::iterator&
EEnd)
Description
Helper to look for \p I in the context defined by \p EIt and \p EEnd. The context is expanded until \p I was found or no more expansion is possible.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:481
Parameters
- const llvm::Instruction* I
- llvm::MustBeExecutedContextExplorer::iterator& EIt
- llvm::MustBeExecutedContextExplorer::iterator& EEnd
Returns
True, iff \p I was found.
¶const llvm::Instruction*
getMustBeExecutedNextInstruction(
llvm::MustBeExecutedIterator& It,
const llvm::Instruction* PP)
const llvm::Instruction*
getMustBeExecutedNextInstruction(
llvm::MustBeExecutedIterator& It,
const llvm::Instruction* PP)
Description
Return the next instruction that is guaranteed to be executed after \p PP.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:495
Parameters
- llvm::MustBeExecutedIterator& It
- The iterator that is used to traverse the must be executed context.
- const llvm::Instruction* PP
- The program point for which the next instruction that is guaranteed to execute is determined.
¶const llvm::Instruction*
getMustBeExecutedPrevInstruction(
llvm::MustBeExecutedIterator& It,
const llvm::Instruction* PP)
const llvm::Instruction*
getMustBeExecutedPrevInstruction(
llvm::MustBeExecutedIterator& It,
const llvm::Instruction* PP)
Description
Return the previous instr. that is guaranteed to be executed before \p PP.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:504
Parameters
- llvm::MustBeExecutedIterator& It
- The iterator that is used to traverse the must be executed context.
- const llvm::Instruction* PP
- The program point for which the previous instr. that is guaranteed to execute is determined.
¶llvm::iterator_range<iterator> range(
const llvm::Instruction* PP)
llvm::iterator_range<iterator> range(
const llvm::Instruction* PP)
Description
Return an iterator range to explore the context around \p PP.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:442
Parameters
- const llvm::Instruction* PP
¶llvm::iterator_range<const_iterator> range(
const llvm::Instruction* PP) const
llvm::iterator_range<const_iterator> range(
const llvm::Instruction* PP) const
Description
Return an iterator range to explore the cached context around \p PP.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:447
Parameters
- const llvm::Instruction* PP