14 #ifndef LLVM_IR_LEGACYPASSMANAGERS_H
15 #define LLVM_IR_LEGACYPASSMANAGERS_H
123 : P(p), V(nullptr), M(nullptr) {}
125 : P(p), V(&v), M(nullptr) {}
127 : P(p), V(nullptr), M(&m) {}
146 typedef std::vector<PMDataManager *>::const_reverse_iterator
iterator;
153 bool empty()
const {
return S.empty(); }
158 std::vector<PMDataManager *> S;
209 ImmutablePasses.push_back(P);
213 return ImmutablePasses;
223 IndirectPassManagers.push_back(Manager);
302 void add(
Pass *
P,
bool ProcessAnalysis =
true);
313 AvailableAnalysis.clear();
314 for (
unsigned i = 0; i <
PMT_Last; ++i)
345 void setDepth(
unsigned newDepth) { Depth = newDepth; }
360 assert ( 0 &&
"Invalid use of getPassManagerType");
365 return &AvailableAnalysis;
461 return "Function Pass Manager";
465 assert ( N <
PassVector.size() &&
"Pass number out of range!");
Pass interface - Implemented by all 'passes'.
bool preserveHigherLevelAnalysis(Pass *P)
PassManagerType
Different types of internal pass managers.
void initializeAllAnalysisInfo()
PassManagerPrettyStackEntry(Pass *p, Value &v)
Pass * findAnalysisPass(AnalysisID AID, bool Direction)
Find the pass that implements Analysis AID.
void dumpLastUses(Pass *P, unsigned Offset) const
A Module instance is used to store all the information related to an LLVM module. ...
bool doInitialization(Module &M) override
doInitialization - Run all of the initializers for the function passes.
std::vector< PMDataManager * >::const_reverse_iterator iterator
const char * getPassName() const override
getPassName - Return a nice clean name for a pass.
unsigned getNumContainedManagers() const
void collectRequiredAnalysis(SmallVectorImpl< Pass * > &RequiredPasses, SmallVectorImpl< AnalysisID > &ReqPassNotAvailable, Pass *P)
Populate RequiredPasses with analysis pass that are required by pass P and are available.
void dumpRequiredSet(const Pass *P) const
PMDataManager * getAsPMDataManager() override
PMTopLevelManager(PMDataManager *PMDM)
Initialize top level manager. Create first pass manager.
void dumpPassInfo(Pass *P, enum PassDebuggingString S1, enum PassDebuggingString S2, StringRef Msg)
virtual void initializePass()
initializePass - This method may be overriden by immutable passes to allow them to perform various in...
virtual PassManagerType getPassManagerType() const
DenseMap< AnalysisID, Pass * > * InheritedAnalysis[PMT_Last]
PMTopLevelManager manages LastUser info and collects common APIs used by top level pass managers...
Timer * getPassTimer(Pass *)
If TimingInfo is enabled then start pass timer.
void setDepth(unsigned newDepth)
void addPassManager(PMDataManager *Manager)
void schedulePass(Pass *P)
Schedule pass P for execution.
void freePass(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove P.
void dumpPassStructure(unsigned Offset) override
Print passes managed by this manager.
bool isPassDebuggingExecutionsOrMore() const
isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified...
virtual ~PMTopLevelManager()
Destructor.
virtual bool doFinalization(Module &)
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void verifyPreservedAnalysis(Pass *P)
verifyPreservedAnalysis – Verify analysis presreved by pass P.
void initializeAnalysisInfo()
Initialize available analysis information.
virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass)
Add RequiredPass into list of lower level passes required by pass P.
void populateInheritedAnalysis(PMStack &PMS)
FPPassManager manages BBPassManagers and FunctionPasses.
PMStack - This class implements a stack data structure of PMDataManager pointers. ...
void initializeAnalysisImpl(Pass *P)
All Required analyses should be available to the pass as it runs! Here we fill in the AnalysisImpls m...
PassManagerPrettyStackEntry - This is used to print informative information about what pass is runnin...
unsigned getDepth() const
PassManagerPrettyStackEntry(Pass *p, Module &m)
void add(Pass *P, bool ProcessAnalysis=true)
Add pass P into the PassVector.
unsigned getNumContainedPasses() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
virtual Pass * getAsPass()=0
bool doFinalization(Module &M) override
doFinalization - Run all of the finalizers for the function passes.
virtual bool doInitialization(Module &)
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
void dumpPreservedSet(const Pass *P) const
void print(raw_ostream &OS) const override
print - Emit information about this stack frame to OS.
void addIndirectPassManager(PMDataManager *Manager)
void collectLastUses(SmallVectorImpl< Pass * > &LastUses, Pass *P)
Collect passes whose last user is P.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
SmallVectorImpl< ImmutablePass * > & getImmutablePasses()
PassManagerPrettyStackEntry(Pass *p)
PassInfo class - An instance of this class exists for every pass known by the system, and can be obtained from a live Pass by calling its getPassInfo() method.
PrettyStackTraceEntry - This class is used to represent a frame of the "pretty" stack trace that is d...
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on...
void setLastUser(ArrayRef< Pass * > AnalysisPasses, Pass *P)
Set pass P as the last user of the given analysis passes.
void addImmutablePass(ImmutablePass *P)
Add immutable pass and initialize it.
ImmutablePass class - This class is used to provide information that does not need to be run...
void recordAvailableAnalysis(Pass *P)
Augment AvailableAnalysis by adding analysis made available by pass P.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void removeNotPreservedAnalysis(Pass *P)
Remove Analysis that is not preserved by the pass.
bool runOnFunction(Function &F)
run - Execute all of the passes scheduled for execution.
void removeDeadPasses(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove dead passes used by P.
virtual Pass * getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F)
SmallVector< Pass *, 16 > PassVector
PMDataManager * top() const
Pass * getAsPass() override
void getAnalysisUsage(AnalysisUsage &Info) const override
Pass Manager itself does not invalidate any analysis info.
DenseMap< AnalysisID, Pass * > * getAvailableAnalysis()
void setPreservesAll()
Set by analyses that do not transform their input at all.
AnalysisUsage * findAnalysisUsage(Pass *P)
Find analysis usage information for the pass P.
const PassInfo * findAnalysisPassInfo(AnalysisID AID) const
Retrieve the PassInfo for an analysis.
void setTopLevelManager(PMTopLevelManager *T)
SmallVector< PMDataManager *, 8 > PassManagers
Collection of pass managers.
FunctionPass * getContainedPass(unsigned N)
void cleanup()
cleanup - After running all passes, clean up pass manager cache.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
void dumpArguments() const
void push(PMDataManager *PM)
PMDataManager provides the common place to manage the analysis data used by pass managers.
Pass * findAnalysisPass(AnalysisID AID)
Find the pass that implements Analysis AID.
void dumpPassArguments() const
LLVM Value Representation.
PMTopLevelManager * getTopLevelManager()
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
PassManagerType getPassManagerType() const override