10 #ifndef LLVM_TRANSFORMS_INSTCOMBINE_INSTCOMBINEWORKLIST_H
11 #define LLVM_TRANSFORMS_INSTCOMBINE_INSTCOMBINEWORKLIST_H
20 #define DEBUG_TYPE "instcombine"
36 : Worklist(std::move(Arg.Worklist)),
37 WorklistMap(std::move(Arg.WorklistMap)) {}
39 Worklist = std::move(RHS.Worklist);
40 WorklistMap = std::move(RHS.WorklistMap);
44 bool isEmpty()
const {
return Worklist.empty(); }
49 if (WorklistMap.insert(std::make_pair(I, Worklist.size())).second) {
50 DEBUG(
dbgs() <<
"IC: ADD: " << *I <<
'\n');
51 Worklist.push_back(I);
64 assert(Worklist.empty() &&
"Worklist must be empty to add initial group");
65 Worklist.reserve(NumEntries+16);
66 WorklistMap.resize(NumEntries);
67 DEBUG(
dbgs() <<
"IC: ADDING: " << NumEntries <<
" instrs to worklist\n");
68 for (
unsigned Idx = 0; NumEntries; --NumEntries) {
70 WorklistMap.insert(std::make_pair(I, Idx++));
71 Worklist.push_back(I);
78 if (It == WorklistMap.end())
return;
81 Worklist[It->second] =
nullptr;
83 WorklistMap.erase(It);
98 Add(cast<Instruction>(U));
105 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 & operator=(InstCombineWorklist &&RHS)
InstCombineWorklist(InstCombineWorklist &&Arg)
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(Instruction *const *List, unsigned NumEntries)
AddInitialGroup - Add the specified batch of stuff in reverse order.
LLVM Value Representation.
void Zap()
Zap - check that the worklist is empty and nuke the backing store for the map if it is large...