9#ifndef LLVM_TRANSFORMS_UTILS_LOCKSTEPREVERSEITERATOR_H
10#define LLVM_TRANSFORMS_UTILS_LOCKSTEPREVERSEITERATOR_H
40template <
bool EarlyFailure = true>
42 :
private std::conditional_t<EarlyFailure, NoActiveBlocksOption,
58 if constexpr (!EarlyFailure) {
59 this->ActiveBlocks.clear();
60 this->ActiveBlocks.insert_range(
Blocks);
67 if constexpr (EarlyFailure) {
71 this->ActiveBlocks.remove(BB);
91 return Base::getActiveBlocks();
95 static_assert(!EarlyFailure,
"Unknown method");
96 for (
auto It = Insts.
begin(); It != Insts.
end();) {
97 if (!
Blocks.contains((*It)->getParent())) {
98 this->ActiveBlocks.remove((*It)->getParent());
113 if constexpr (!EarlyFailure) {
114 this->ActiveBlocks.remove(Inst->getParent());
123 if (NewInsts.
empty())
131 static_assert(EarlyFailure,
"Unknown method");
144 if (NewInsts.
empty())
DenseMap< Block *, BlockRelaxAux > Blocks
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
Iterates through instructions in a set of blocks in reverse order from the first non-terminator.
LockstepReverseIterator(ArrayRef< BasicBlock * > Blocks)
void restrictToBlocks(SmallSetVector< BasicBlock *, 4 > &Blocks)
ArrayRef< Instruction * > operator*() const
LockstepReverseIterator & operator--()
SmallSetVector< BasicBlock *, 4 > & getActiveBlocks()
LockstepReverseIterator & operator++()
A SetVector that performs no allocations if smaller than a certain size.
iterator erase(const_iterator CI)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
This is an optimization pass for GlobalISel generic memory operations.
ActiveBlocksOption()=default
SmallSetVector< BasicBlock *, 4 > ActiveBlocks
SmallSetVector< BasicBlock *, 4 > & getActiveBlocks()