10 #ifndef LLVM_TRANSFORMS_INSTCOMBINE_INSTCOMBINEWORKLIST_H
11 #define LLVM_TRANSFORMS_INSTCOMBINE_INSTCOMBINEWORKLIST_H
21 #define DEBUG_TYPE "instcombine"
37 bool isEmpty()
const {
return Worklist.empty(); }
42 if (WorklistMap.insert(std::make_pair(I, Worklist.size())).second) {
43 DEBUG(
dbgs() <<
"IC: ADD: " << *I <<
'\n');
44 Worklist.push_back(I);
57 assert(Worklist.empty() &&
"Worklist must be empty to add initial group");
58 Worklist.reserve(List.
size()+16);
59 WorklistMap.reserve(List.
size());
60 DEBUG(
dbgs() <<
"IC: ADDING: " << List.
size() <<
" instrs to worklist\n");
63 WorklistMap.insert(std::make_pair(
I, Idx++));
64 Worklist.push_back(
I);
71 if (It == WorklistMap.end())
return;
74 Worklist[It->second] =
nullptr;
76 WorklistMap.erase(It);
91 Add(cast<Instruction>(U));
98 assert(WorklistMap.empty() &&
"Worklist empty, but map not?");
Instruction * RemoveOne()
void Remove(Instruction *I)
void Add(Instruction *I)
Add - Add the specified instruction to the worklist if it isn't already in it.
InstCombineWorklist()=default
InstCombineWorklist & operator=(InstCombineWorklist &&)=default
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
size_t size() const
size - Get the array size.
void AddUsersToWorkList(Instruction &I)
AddUsersToWorkList - When an instruction is simplified, add all users of the instruction to the work ...
InstCombineWorklist - This is the worklist management logic for InstCombine.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
iterator_range< user_iterator > users()
void AddInitialGroup(ArrayRef< Instruction * > List)
AddInitialGroup - Add the specified batch of stuff in reverse order.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
void Zap()
Zap - check that the worklist is empty and nuke the backing store for the map if it is large...