9#ifndef LLVM_TRANSFORMS_UTILS_INSTRUCTIONWORKLIST_H
10#define LLVM_TRANSFORMS_UTILS_INSTRUCTIONWORKLIST_H
60 assert(
I->getParent() &&
"Instruction not inserted yet?");
62 if (WorklistMap.
insert(std::make_pair(
I, Worklist.
size())).second) {
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 if (
auto *
I = dyn_cast<Instruction>(V)) {
118 add(cast<Instruction>(*
I->user_begin()));
124 assert(WorklistMap.
empty() &&
"Worklist empty, but map not?");
125 assert(Deferred.
empty() &&
"Deferred instructions left over");
This file defines the DenseMap class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallVector class.
iterator find(const_arg_type_t< KeyT > Val)
bool erase(const KeyT &Val)
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
void reserve(size_type NumEntries)
Grow the densemap so that it can contain at least NumEntries items before resizing again.
InstructionWorklist - This is the worklist management logic for InstCombine and other simplification ...
Instruction * removeOne()
InstructionWorklist()=default
void pushUsersToWorkList(Instruction &I)
When an instruction is simplified, add all users of the instruction to the work lists because they mi...
void add(Instruction *I)
Add instruction to the worklist.
void push(Instruction *I)
Push the instruction onto the worklist stack.
InstructionWorklist & operator=(InstructionWorklist &&)=default
void addValue(Value *V)
Add value to the worklist if it is an instruction.
InstructionWorklist(InstructionWorklist &&)=default
void remove(Instruction *I)
Remove I from the worklist if it exists.
Instruction * popDeferred()
void zap()
Check that the worklist is empty and nuke the backing store for the map.
void handleUseCountDecrement(Value *V)
Should be called after decrementing the use-count on V.
void reserve(size_t Size)
bool remove(const value_type &X)
Remove an item from the set vector.
bool empty() const
Determine if the SetVector is empty or not.
bool insert(const value_type &X)
Insert a new element into the SetVector.
value_type pop_back_val()
A SetVector that performs no allocations if smaller than a certain size.
void reserve(size_type N)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
LLVM Value Representation.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.