Go to the documentation of this file.
9 #ifndef LLVM_TRANSFORMS_UTILS_INSTRUCTIONWORKLIST_H
10 #define LLVM_TRANSFORMS_UTILS_INSTRUCTIONWORKLIST_H
39 bool isEmpty()
const {
return Worklist.empty() && Deferred.
empty(); }
60 assert(
I->getParent() &&
"Instruction not inserted yet?");
62 if (WorklistMap.
insert(std::make_pair(
I, Worklist.size())).second) {
64 Worklist.push_back(
I);
87 if (It != WorklistMap.
end()) {
89 Worklist[It->second] =
nullptr;
90 WorklistMap.
erase(It);
107 for (
User *U :
I.users())
108 push(cast<Instruction>(U));
113 assert(WorklistMap.
empty() &&
"Worklist empty, but map not?");
114 assert(Deferred.
empty() &&
"Deferred instructions left over");
This is an optimization pass for GlobalISel generic memory operations.
InstructionWorklist & operator=(InstructionWorklist &&)=default
void addValue(Value *V)
Add value to the worklist if it is an instruction.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
void reserve(size_t Size)
bool erase(const KeyT &Val)
LLVM_NODISCARD T pop_back_val()
void add(Instruction *I)
Add instruction to the worklist.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool remove(const value_type &X)
Remove an item from the set vector.
void remove(Instruction *I)
Remove I from the worklist if it exists.
bool empty() const
Determine if the SetVector is empty or not.
InstructionWorklist()=default
void zap()
Check that the worklist is empty and nuke the backing store for the map.
Instruction * removeOne()
void push(Instruction *I)
Push the instruction onto the worklist stack.
iterator find(const_arg_type_t< KeyT > Val)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool insert(const value_type &X)
Insert a new element into the SetVector.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
LLVM_NODISCARD bool empty() const
InstructionWorklist - This is the worklist management logic for InstCombine and other simplification ...
Instruction * popDeferred()
void reserve(size_type NumEntries)
Grow the densemap so that it can contain at least NumEntries items before resizing again.
void pushUsersToWorkList(Instruction &I)
When an instruction is simplified, add all users of the instruction to the work lists because they mi...
A SetVector that performs no allocations if smaller than a certain size.
void reserve(size_type N)
LLVM_NODISCARD T pop_back_val()
LLVM Value Representation.