9#ifndef LLVM_TRANSFORMS_UTILS_INSTRUCTIONWORKLIST_H
10#define LLVM_TRANSFORMS_UTILS_INSTRUCTIONWORKLIST_H
39 bool isEmpty()
const {
return Worklist.empty() && Deferred.empty(); }
45 if (Deferred.insert(
I))
60 assert(
I->getParent() &&
"Instruction not inserted yet?");
62 if (WorklistMap.insert(std::make_pair(
I, Worklist.size())).second) {
64 Worklist.push_back(
I);
76 return Deferred.pop_back_val();
80 Worklist.reserve(
Size + 16);
81 WorklistMap.reserve(
Size);
87 if (It != WorklistMap.end()) {
89 Worklist[It->second] =
nullptr;
90 WorklistMap.erase(It);
100 WorklistMap.erase(
I);
107 for (
User *U :
I.users())
124 assert(WorklistMap.empty() &&
"Worklist empty, but map not?");
125 assert(Deferred.empty() &&
"Deferred instructions left over");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the DenseMap class.
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallVector class.
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT > iterator
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)
A SetVector that performs no allocations if smaller than a certain size.
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.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.