#ifndef LLVM_PASSMANAGERS_H
#define LLVM_PASSMANAGERS_H
-#include "llvm/Pass.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
-#include <vector>
+#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Pass.h"
#include <map>
+#include <vector>
//===----------------------------------------------------------------------===//
// Overview:
// relies on PassManagerImpl to do all the tasks.
//
// [o] class PassManagerImpl : public Pass, public PMDataManager,
-// public PMDTopLevelManager
+// public PMTopLevelManager
//
// PassManagerImpl is a top level pass manager responsible for managing
// MPPassManagers.
protected:
explicit PMTopLevelManager(PMDataManager *PMDM);
- virtual unsigned getNumContainedManagers() const {
+ unsigned getNumContainedManagers() const {
return (unsigned)PassManagers.size();
}
void initializeAllAnalysisInfo();
private:
- /// This is implemented by top level pass manager and used by
- /// schedulePass() to add analysis info passes that are not available.
- virtual void addTopLevelPass(Pass *P) = 0;
+ virtual PMDataManager *getAsPMDataManager() = 0;
+ virtual PassManagerType getTopLevelPassManagerType() = 0;
public:
/// Schedule pass P for execution. Make sure that passes required by
void schedulePass(Pass *P);
/// Set pass P as the last user of the given analysis passes.
- void setLastUser(const SmallVectorImpl<Pass *> &AnalysisPasses, Pass *P);
+ void setLastUser(ArrayRef<Pass*> AnalysisPasses, Pass *P);
/// Collect passes whose last user is P
void collectLastUses(SmallVectorImpl<Pass *> &LastUses, Pass *P);
void dumpRequiredSet(const Pass *P) const;
void dumpPreservedSet(const Pass *P) const;
- virtual unsigned getNumContainedPasses() const {
+ unsigned getNumContainedPasses() const {
return (unsigned)PassVector.size();
}
return PMT_Unknown;
}
- std::map<AnalysisID, Pass*> *getAvailableAnalysis() {
+ DenseMap<AnalysisID, Pass*> *getAvailableAnalysis() {
return &AvailableAnalysis;
}
// Collection of Analysis provided by Parent pass manager and
// used by current pass manager. At at time there can not be more
// then PMT_Last active pass mangers.
- std::map<AnalysisID, Pass *> *InheritedAnalysis[PMT_Last];
-
+ DenseMap<AnalysisID, Pass *> *InheritedAnalysis[PMT_Last];
/// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions
/// or higher is specified.
// pass. If a pass requires an analysis which is not available then
// the required analysis pass is scheduled to run before the pass itself is
// scheduled to run.
- std::map<AnalysisID, Pass*> AvailableAnalysis;
+ DenseMap<AnalysisID, Pass*> AvailableAnalysis;
// Collection of higher level analysis used by the pass managed by
// this manager.
/// cleanup - After running all passes, clean up pass manager cache.
void cleanup();
+ /// doInitialization - Overrides ModulePass doInitialization for global
+ /// initialization tasks
+ ///
+ using ModulePass::doInitialization;
+
/// doInitialization - Run all of the initializers for the function passes.
///
bool doInitialization(Module &M);
+ /// doFinalization - Overrides ModulePass doFinalization for global
+ /// finalization tasks
+ ///
+ using ModulePass::doFinalization;
+
/// doFinalization - Run all of the finalizers for the function passes.
///
bool doFinalization(Module &M);