31 using namespace llvm::legacy;
45 Disabled, Arguments, Structure, Executions, Details
51 cl::desc(
"Print PassManager debugging information"),
53 clEnumVal(Disabled ,
"disable debug output"),
54 clEnumVal(Arguments ,
"print pass arguments to pass to 'opt'"),
55 clEnumVal(Structure ,
"print pass structure before run()"),
56 clEnumVal(Executions,
"print pass name before it is executed"),
57 clEnumVal(Details ,
"print pass details when it is executed"),
89 PassOptionList &PassesToPrint) {
90 for (
unsigned i = 0, ie = PassesToPrint.size(); i < ie; ++i) {
122 if (V == 0 && M == 0)
123 OS <<
"Releasing pass '";
125 OS <<
"Running pass '";
127 OS <<
P->getPassName() <<
"'";
130 OS <<
" on module '" << M->getModuleIdentifier() <<
"'.\n";
139 if (isa<Function>(V))
141 else if (isa<BasicBlock>(V))
163 explicit BBPassManager()
175 bool doInitialization(
Module &M);
177 bool doFinalization(
Module &M);
181 virtual Pass *getAsPass() {
return this; }
183 virtual const char *getPassName()
const {
184 return "BasicBlock Pass Manager";
188 void dumpPassStructure(
unsigned Offset) {
190 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
193 dumpLastUses(BP, Offset+1);
198 assert(N < PassVector.size() &&
"Pass number out of range!");
220 virtual void anchor();
244 void releaseMemoryOnTheFly();
252 bool doInitialization(
Module &M);
256 bool doFinalization(
Module &M);
271 assert(N < PassManagers.size() &&
"Pass number out of range!");
277 void FunctionPassManagerImpl::anchor() {}
293 explicit MPPassManager() :
297 virtual ~MPPassManager() {
298 for (std::map<Pass *, FunctionPassManagerImpl *>::iterator
299 I = OnTheFlyManagers.begin(), E = OnTheFlyManagers.end();
307 Pass *createPrinterPass(
raw_ostream &O,
const std::string &Banner)
const {
313 bool runOnModule(
Module &M);
320 bool doInitialization();
324 bool doFinalization();
334 virtual void addLowerLevelRequiredPass(
Pass *
P,
Pass *RequiredPass);
341 virtual const char *getPassName()
const {
342 return "Module Pass Manager";
346 virtual Pass *getAsPass() {
return this; }
349 void dumpPassStructure(
unsigned Offset) {
351 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
354 std::map<Pass *, FunctionPassManagerImpl *>::const_iterator
I =
355 OnTheFlyManagers.find(MP);
356 if (I != OnTheFlyManagers.end())
357 I->second->dumpPassStructure(Offset + 2);
358 dumpLastUses(MP, Offset+1);
363 assert(N < PassVector.size() &&
"Pass number out of range!");
374 std::map<Pass *, FunctionPassManagerImpl *> OnTheFlyManagers;
390 virtual void anchor();
420 bool doInitialization();
424 bool doFinalization();
438 assert(N < PassManagers.size() &&
"Pass number out of range!");
439 MPPassManager *MP =
static_cast<MPPassManager *
>(PassManagers[
N]);
444 void PassManagerImpl::anchor() {}
465 TimingInfo() : TG(
"... Pass execution timing report ...") {}
472 E = TimingData.end();
I != E; ++
I)
480 static void createTheTimeInfo();
505 addPassManager(PMDM);
506 activeStack.push(PMDM);
517 E = AnalysisPasses.
end();
I != E; ++
I) {
530 E = IDs.
end();
I != E; ++
I) {
531 Pass *AnalysisPass = findAnalysisPass(*
I);
532 assert(AnalysisPass &&
"Expected analysis pass to exist.");
534 assert(AR &&
"Expected analysis resolver to exist.");
537 if (PDepth == APDepth)
539 else if (PDepth > APDepth)
543 setLastUser(LastUses, P);
554 LUE = LastUser.end(); LUI != LUE; ++LUI) {
555 if (LUI->second == AP)
558 LastUser[LUI->first] =
P;
567 InversedLastUser.
find(P);
568 if (DMI == InversedLastUser.
end())
573 E = LU.
end();
I != E; ++
I) {
582 if (DMI != AnUsageMap.end())
583 AnUsage = DMI->second;
587 AnUsageMap[
P] = AnUsage;
615 bool checkAnalysis =
true;
616 while (checkAnalysis) {
617 checkAnalysis =
false;
621 E = RequiredSet.
end();
I != E; ++
I) {
629 dbgs() <<
"Pass '" << P->
getPassName() <<
"' is not initialized." <<
"\n";
630 dbgs() <<
"Verify if there is a pass dependency cycle." <<
"\n";
631 dbgs() <<
"Required Passes:" <<
"\n";
633 E = RequiredSet.
end(); I2 != E && I2 !=
I; ++I2) {
638 dbgs() <<
"\t" <<
"Error: Required pass not found! Possible causes:" <<
"\n";
639 dbgs() <<
"\t\t" <<
"- Pass misconfiguration (e.g.: missing macros)" <<
"\n";
640 dbgs() <<
"\t\t" <<
"- Corruption of the global PassRegistry" <<
"\n";
645 assert(PI &&
"Expected required passes to be initialized");
657 checkAnalysis =
true;
681 dbgs(), std::string(
"*** IR Dump Before ") + P->
getPassName() +
" ***");
690 dbgs(), std::string(
"*** IR Dump After ") + P->
getPassName() +
" ***");
703 if (
Pass *
P = (*I)->findAnalysisPass(AID,
false))
708 I = IndirectPassManagers.begin(),
709 E = IndirectPassManagers.end();
I != E; ++
I)
710 if (
Pass *
P = (*I)->findAnalysisPass(AID,
false))
716 ImmutablePasses.rbegin(), E = ImmutablePasses.rend();
I != E; ++
I) {
724 assert(PassInf &&
"Expected all immutable passes to be initialized");
725 const std::vector<const PassInfo*> &ImmPI =
727 for (std::vector<const PassInfo*>::const_iterator II = ImmPI.begin(),
728 EE = ImmPI.end(); II != EE; ++II) {
729 if ((*II)->getTypeInfo() == AID)
744 for (
unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i) {
745 ImmutablePasses[i]->dumpPassStructure(0);
754 (*I)->getAsPass()->dumpPassStructure(1);
762 dbgs() <<
"Pass Arguments: ";
764 ImmutablePasses.begin(), E = ImmutablePasses.end();
I != E; ++
I)
767 assert(PI &&
"Expected all immutable passes to be initialized");
768 if (!PI->isAnalysisGroup())
769 dbgs() <<
" -" << PI->getPassArgument();
773 (*I)->dumpPassArguments();
780 (*I)->initializeAnalysisInfo();
784 I = IndirectPassManagers.begin(), E = IndirectPassManagers.end();
786 (*I)->initializeAnalysisInfo();
789 DME = LastUser.end(); DMI != DME; ++DMI) {
791 InversedLastUser.find(DMI->second);
792 if (InvDMI != InversedLastUser.end()) {
797 InversedLastUser[DMI->second] = L;
809 I = ImmutablePasses.begin(), E = ImmutablePasses.end();
I != E; ++
I)
813 DME = AnUsageMap.end(); DMI != DME; ++DMI)
824 AvailableAnalysis[PI] =
P;
826 assert(!AvailableAnalysis.empty());
831 if (PInf == 0)
return;
833 for (
unsigned i = 0, e = II.size(); i != e; ++i)
834 AvailableAnalysis[II[i]->getTypeInfo()] =
P;
846 E = HigherLevelAnalysis.end();
I != E; ++
I) {
849 std::find(PreservedSet.
begin(), PreservedSet.
end(),
869 E = PreservedSet.
end();
I != E; ++
I) {
873 AP->verifyAnalysis();
886 E = AvailableAnalysis.end();
I != E; ) {
888 if (Info->second->getAsImmutablePass() == 0 &&
889 std::find(PreservedSet.
begin(), PreservedSet.
end(), Info->first) ==
890 PreservedSet.
end()) {
893 Pass *S = Info->second;
897 AvailableAnalysis.erase(Info);
903 for (
unsigned Index = 0; Index <
PMT_Last; ++Index) {
912 if (Info->second->getAsImmutablePass() == 0 &&
913 std::find(PreservedSet.
begin(), PreservedSet.
end(), Info->first) ==
914 PreservedSet.
end()) {
917 Pass *S = Info->second;
941 dbgs() <<
"' is the last user of following pass instances.";
942 dbgs() <<
" Free these instances\n";
946 E = DeadPasses.
end();
I != E; ++
I)
965 AvailableAnalysis.erase(PI);
969 const std::vector<const PassInfo*> &II = PInf->getInterfacesImplemented();
970 for (
unsigned i = 0, e = II.size(); i != e; ++i) {
972 AvailableAnalysis.find(II[i]->getTypeInfo());
973 if (Pos != AvailableAnalysis.end() && Pos->second ==
P)
974 AvailableAnalysis.erase(Pos);
991 if (!ProcessAnalysis) {
1002 unsigned PDepth = this->
getDepth();
1005 ReqAnalysisNotAvailable, P);
1007 E = RequiredPasses.
end();
I != E; ++
I) {
1008 Pass *PRequired = *
I;
1009 unsigned RDepth = 0;
1011 assert(PRequired->
getResolver() &&
"Analysis Resolver is not set");
1013 RDepth = DM.getDepth();
1015 if (PDepth == RDepth)
1017 else if (PDepth > RDepth) {
1021 HigherLevelAnalysis.push_back(PRequired);
1033 if (!TransferLastUses.
empty()) {
1036 TransferLastUses.
clear();
1041 I = ReqAnalysisNotAvailable.
begin(),
1042 E = ReqAnalysisNotAvailable.
end() ;
I != E; ++
I) {
1067 I = RequiredSet.
begin(), E = RequiredSet.
end();
I != E; ++
I) {
1076 E = IDs.
end();
I != E; ++
I) {
1101 assert(AR &&
"Analysis Resolver is not set");
1113 if (I != AvailableAnalysis.end())
1135 E = LUses.
end();
I != E; ++
I) {
1136 llvm::dbgs() <<
"--" << std::string(Offset*2,
' ');
1137 (*I)->dumpPassStructure(0);
1145 PMD->dumpPassArguments();
1149 if (!PI->isAnalysisGroup())
1150 dbgs() <<
" -" << PI->getPassArgument();
1159 dbgs() << (
void*)
this << std::string(
getDepth()*2+1,
' ');
1175 dbgs() <<
"' on BasicBlock '" << Msg <<
"'...\n";
1178 dbgs() <<
"' on Function '" << Msg <<
"'...\n";
1181 dbgs() <<
"' on Module '" << Msg <<
"'...\n";
1184 dbgs() <<
"' on Region '" << Msg <<
"'...\n";
1187 dbgs() <<
"' on Loop '" << Msg <<
"'...\n";
1190 dbgs() <<
"' on Call Graph Nodes '" << Msg <<
"'...\n";
1203 dumpAnalysisUsage(
"Required", P, analysisUsage.
getRequiredSet());
1215 void PMDataManager::dumpAnalysisUsage(
StringRef Msg,
const Pass *
P,
1220 dbgs() << (
const void*)P << std::string(
getDepth()*2+3,
' ') << Msg <<
" Analyses:";
1221 for (
unsigned i = 0; i != Set.
size(); ++i) {
1222 if (i)
dbgs() <<
',';
1227 dbgs() <<
" Uninitialized Pass";
1290 bool BBPassManager::runOnFunction(
Function &
F) {
1294 bool Changed = doInitialization(F);
1297 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1299 bool LocalChanged =
false;
1302 dumpRequiredSet(BP);
1304 initializeAnalysisImpl(BP);
1314 Changed |= LocalChanged;
1318 dumpPreservedSet(BP);
1320 verifyPreservedAnalysis(BP);
1321 removeNotPreservedAnalysis(BP);
1322 recordAvailableAnalysis(BP);
1326 return doFinalization(F) || Changed;
1330 bool BBPassManager::doInitialization(
Module &M) {
1331 bool Changed =
false;
1333 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
1334 Changed |= getContainedPass(Index)->doInitialization(M);
1339 bool BBPassManager::doFinalization(
Module &M) {
1340 bool Changed =
false;
1342 for (
int Index = getNumContainedPasses() - 1; Index >= 0; --Index)
1343 Changed |= getContainedPass(Index)->doFinalization(M);
1348 bool BBPassManager::doInitialization(
Function &F) {
1349 bool Changed =
false;
1351 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1359 bool BBPassManager::doFinalization(
Function &F) {
1360 bool Changed =
false;
1362 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1427 bool Changed =
false;
1434 E = IPV.
end();
I != E; ++
I) {
1435 Changed |= (*I)->doInitialization(M);
1445 bool Changed =
false;
1452 E = IPV.
end();
I != E; ++
I) {
1453 Changed |= (*I)->doFinalization(M);
1461 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1464 assert(AR &&
"Analysis Resolver is not set");
1484 bool Changed =
false;
1485 TimingInfo::createTheTimeInfo();
1504 dbgs().
indent(Offset*2) <<
"FunctionPass Manager\n";
1505 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1508 dumpLastUses(FP, Offset+1);
1520 bool Changed =
false;
1523 populateInheritedAnalysis(TPM->activeStack);
1525 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1527 bool LocalChanged =
false;
1530 dumpRequiredSet(FP);
1532 initializeAnalysisImpl(FP);
1541 Changed |= LocalChanged;
1544 dumpPreservedSet(FP);
1546 verifyPreservedAnalysis(FP);
1547 removeNotPreservedAnalysis(FP);
1548 recordAvailableAnalysis(FP);
1555 bool Changed =
false;
1558 Changed |= runOnFunction(*
I);
1564 bool Changed =
false;
1566 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
1567 Changed |= getContainedPass(Index)->doInitialization(M);
1573 bool Changed =
false;
1575 for (
int Index = getNumContainedPasses() - 1; Index >= 0; --Index)
1576 Changed |= getContainedPass(Index)->doFinalization(M);
1588 MPPassManager::runOnModule(
Module &M) {
1589 bool Changed =
false;
1592 for (std::map<Pass *, FunctionPassManagerImpl *>::iterator
1593 I = OnTheFlyManagers.begin(), E = OnTheFlyManagers.end();
1600 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
1601 Changed |= getContainedPass(Index)->doInitialization(M);
1603 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1605 bool LocalChanged =
false;
1608 dumpRequiredSet(MP);
1610 initializeAnalysisImpl(MP);
1619 Changed |= LocalChanged;
1623 dumpPreservedSet(MP);
1625 verifyPreservedAnalysis(MP);
1626 removeNotPreservedAnalysis(MP);
1627 recordAvailableAnalysis(MP);
1632 for (
int Index = getNumContainedPasses() - 1; Index >= 0; --Index)
1633 Changed |= getContainedPass(Index)->doFinalization(M);
1636 for (std::map<Pass *, FunctionPassManagerImpl *>::iterator
1637 I = OnTheFlyManagers.begin(), E = OnTheFlyManagers.end();
1652 void MPPassManager::addLowerLevelRequiredPass(
Pass *P,
Pass *RequiredPass) {
1654 "Unable to handle Pass that requires lower level Analysis pass");
1657 "Unable to handle Pass that requires lower level Analysis pass");
1665 OnTheFlyManagers[
P] = FPP;
1667 FPP->
add(RequiredPass);
1682 assert(FPP &&
"Unable to find on the fly pass");
1697 bool Changed =
false;
1698 TimingInfo::createTheTimeInfo();
1705 E = IPV.
end();
I != E; ++
I) {
1706 Changed |= (*I)->doInitialization(M);
1714 E = IPV.
end();
I != E; ++
I) {
1715 Changed |= (*I)->doFinalization(M);
1755 cl::desc(
"Time each pass, printing elapsed time for each on exit"));
1760 void TimingInfo::createTheTimeInfo() {
1792 assert(PM &&
"Unable to push. Pass Manager expected");
1793 assert(PM->
getDepth()==0 &&
"Pass Manager depth set too early");
1795 if (!this->empty()) {
1797 &&
"pushing bad pass manager to PMStack");
1800 assert(TPM &&
"Unable to find top level manager");
1801 TPM->addIndirectPassManager(PM);
1803 PM->
setDepth(this->top()->getDepth()+1);
1807 &&
"pushing bad pass manager to PMStack");
1816 for (std::vector<PMDataManager *>::const_iterator
I = S.begin(),
1817 E = S.end();
I != E; ++
I)
1818 dbgs() << (*I)->getAsPass()->getPassName() <<
' ';
1829 while (!PMS.
empty()) {
1831 if (TopPMType == PreferredType)
1838 assert(!PMS.
empty() &&
"Unable to find appropriate Pass Manager");
1848 while (!PMS.
empty()) {
1860 assert(!PMS.
empty() &&
"Unable to create Function Pass Manager");
1893 BBP = (BBPassManager *)PMS.
top();
1897 assert(!PMS.
empty() &&
"Unable to create BasicBlock Pass Manager");
1901 BBP =
new BBPassManager();
1910 BBP->assignPassManager(PMS, PreferredType);
bool preserveHigherLevelAnalysis(Pass *P)
std::reverse_iterator< iterator > reverse_iterator
void push_back(const T &Elt)
const_iterator end(StringRef path)
Get end iterator over path.
static TimingInfo * TheTimeInfo
void initializeAllAnalysisInfo()
virtual Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const =0
static PassRegistry * getPassRegistry()
bool doFinalization(Module &M)
Pass * findAnalysisPass(AnalysisID AID, bool Direction)
const char * getPassName() const
static cl::opt< bool, true > EnableTiming("time-passes", cl::location(TimePassesIsEnabled), cl::desc("Time each pass, printing elapsed time for each on exit"))
virtual PMDataManager * getAsPMDataManager()
void dumpLastUses(Pass *P, unsigned Offset) const
virtual void dumpPassStructure(unsigned Offset=0)
virtual bool runOnModule(Module &M)=0
const std::vector< const PassInfo * > & getInterfacesImplemented() const
The main container class for the LLVM Intermediate Representation.
FunctionPassManagerImpl manages FPPassManagers.
AnalysisID getPassID() const
getPassID - Return the PassID number that corresponds to this pass.
virtual void releaseMemory()
virtual Pass * getAsPass()
virtual void getAnalysisUsage(AnalysisUsage &) const
unsigned getNumContainedManagers() const
virtual bool doInitialization(Function &)
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
static PassOptionList PrintBefore("print-before", llvm::cl::desc("Print IR before specified passes"), cl::Hidden)
ValuesClass< DataType > END_WITH_NULL values(const char *Arg, DataType Val, const char *Desc,...)
virtual const char * getPassName() const
static bool ShouldPrintBeforeOrAfterPass(const PassInfo *PI, PassOptionList &PassesToPrint)
const VectorType & getPreservedSet() const
void collectRequiredAnalysis(SmallVectorImpl< Pass * > &RequiredPasses, SmallVectorImpl< AnalysisID > &ReqPassNotAvailable, Pass *P)
const_iterator begin(StringRef path)
Get begin iterator over path.
void dumpRequiredSet(const Pass *P) const
bool doInitialization(Module &M)
ModulePass * createPrintModulePass(raw_ostream *OS, bool DeleteStream=false, const std::string &Banner="")
bool runOnModule(Module &M)
PMTopLevelManager(PMDataManager *PMDM)
Initialize top level manager. Create first pass manager.
virtual void preparePassManager(PMStack &)
Check if available pass managers are suitable for this pass or not.
void dumpPassInfo(Pass *P, enum PassDebuggingString S1, enum PassDebuggingString S2, StringRef Msg)
virtual PassManagerType getPassManagerType() const
void setResolver(AnalysisResolver *AR)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
DenseMap< AnalysisID, Pass * > * InheritedAnalysis[PMT_Last]
Timer * getPassTimer(Pass *)
If TimingInfo is enabled then start pass timer.
void setDepth(unsigned newDepth)
StringRef getName() const
void WriteAsOperand(raw_ostream &, const Value *, bool PrintTy=true, const Module *Context=0)
void schedulePass(Pass *P)
Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const
createPrinterPass - Get a function printer pass.
void freePass(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove P.
#define llvm_unreachable(msg)
bool isPassDebuggingExecutionsOrMore() const
virtual ~PMTopLevelManager()
Destructor.
virtual bool doFinalization(Module &)
virtual Pass * getAsPass()
void verifyPreservedAnalysis(Pass *P)
verifyPreservedAnalysis – Verify analysis presreved by pass P.
void initializeAnalysisInfo()
Initialize available analysis information.
virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass)
void populateInheritedAnalysis(PMStack &PMS)
void initializeAnalysisImpl(Pass *P)
ID
LLVM Calling Convention Representation.
const std::string & getModuleIdentifier() const
#define clEnumVal(ENUMVAL, DESC)
unsigned getDepth() const
void getAnalysisUsage(AnalysisUsage &Info) const
Pass Manager itself does not invalidate any analysis info.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
Pass * getAnalysisIfAvailable(AnalysisID ID, bool Direction) const
void add(Pass *P, bool ProcessAnalysis=true)
bool isMaterializable() const
unsigned getNumContainedPasses() const
virtual Pass * getAsPass()=0
virtual bool doFinalization(Function &)
virtual ImmutablePass * getAsImmutablePass()
virtual bool doInitialization(Module &)
bool doFinalization(Module &M)
static PassOptionList PrintAfter("print-after", llvm::cl::desc("Print IR after specified passes"), cl::Hidden)
initializer< Ty > init(const Ty &Val)
* if(!EatIfPresent(lltok::kw_thread_local)) return false
FPPassManager * getContainedManager(unsigned N)
void dumpPreservedSet(const Pass *P) const
Pass * createPass() const
createPass() - Use this method to create an instance of this pass.
const VectorType & getRequiredTransitiveSet() const
void releaseMemoryOnTheFly()
void addIndirectPassManager(PMDataManager *Manager)
static ManagedStatic< sys::SmartRWMutex< true > > Lock
void collectLastUses(SmallVectorImpl< Pass * > &LastUses, Pass *P)
Collect passes whose last user is P.
AnalysisResolver * getResolver() const
PassManagerImpl manages MPPassManagers.
static cl::opt< bool > PrintBeforeAll("print-before-all", llvm::cl::desc("Print IR before each pass"), cl::init(false))
virtual void assignPassManager(PMStack &PMS, PassManagerType T)
FunctionPass * createPrintFunctionPass(const std::string &Banner, raw_ostream *OS, bool DeleteStream=false)
SmallVectorImpl< ImmutablePass * > & getImmutablePasses()
virtual PassManagerType getTopLevelPassManagerType()
virtual PMDataManager * getAsPMDataManager()
bool doInitialization(Module &M)
static cl::opt< enum PassDebugLevel > PassDebugging("debug-pass", cl::Hidden, cl::desc("Print PassManager debugging information"), cl::values(clEnumVal(Disabled,"disable debug output"), clEnumVal(Arguments,"print pass arguments to pass to 'opt'"), clEnumVal(Structure,"print pass structure before run()"), clEnumVal(Executions,"print pass name before it is executed"), clEnumVal(Details,"print pass details when it is executed"), clEnumValEnd))
SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
void setLastUser(ArrayRef< Pass * > AnalysisPasses, Pass *P)
Set pass P as the last user of the given analysis passes.
static bool ShouldPrintBeforePass(const PassInfo *PI)
void addImmutablePass(ImmutablePass *P)
Add immutable pass and initialize it.
static bool ShouldPrintAfterPass(const PassInfo *PI)
virtual ~PassManagerBase()
void recordAvailableAnalysis(Pass *P)
Augment AvailableAnalysis by adding analysis made available by pass P.
FunctionPassManagerImpl()
bool getPreservesAll() const
void removeNotPreservedAnalysis(Pass *P)
Remove Analysis that is not preserved by the pass.
FunctionPassManager(AnalysisManager *AM=0)
void addAnalysisImplsPair(AnalysisID PI, Pass *P)
bool runOnFunction(Function &F)
void removeDeadPasses(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove dead passes used by P.
virtual PassManagerType getTopLevelPassManagerType()
virtual Pass * getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F)
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
const char * getPassArgument() const
SmallVector< Pass *, 16 > PassVector
virtual PMDataManager * getAsPMDataManager()
PMDataManager * top() const
void clearAnalysisImpls()
Pass * findImplPass(AnalysisID PI)
AnalysisUsage * findAnalysisUsage(Pass *P)
Find analysis usage information for the pass P.
virtual void assignPassManager(PMStack &PMS, PassManagerType T)
virtual void assignPassManager(PMStack &PMS, PassManagerType T)
void setTopLevelManager(PMTopLevelManager *T)
SmallVector< PMDataManager *, 8 > PassManagers
Collection of pass managers.
const VectorType & getRequiredSet() const
virtual void print(raw_ostream &OS) const
print - Emit information about this stack frame to OS.
bool isDeclaration() const
PMDataManager & getPMDataManager()
FunctionPass * getContainedPass(unsigned N)
Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const
createPrinterPass - Get a module printer pass.
void cleanup()
cleanup - After running all passes, clean up pass manager cache.
static cl::opt< bool > PrintAfterAll("print-after-all", llvm::cl::desc("Print IR after each pass"), cl::init(false))
void dumpPassStructure(unsigned Offset)
Print passes managed by this manager.
void getAnalysisUsage(AnalysisUsage &Info) const
Pass Manager itself does not invalidate any analysis info.
void dumpArguments() const
void push(PMDataManager *PM)
const PassInfo * getPassInfo(const void *TI) const
Pass * findAnalysisPass(AnalysisID AID)
void dumpPassArguments() const
MPPassManager * getContainedManager(unsigned N)
virtual bool runOnFunction(Function &F)=0
virtual bool runOnBasicBlock(BasicBlock &BB)=0
PassManager()
Create new pass manager.
bool Materialize(std::string *ErrInfo=0)
bool TimePassesIsEnabled
This is the storage for the -time-passes option.
iterator find(const KeyT &Val)
static RegisterPass< NVPTXAllocaHoisting > X("alloca-hoisting","Hoisting alloca instructions in non-entry ""blocks to the entry block")
LocationClass< Ty > location(Ty &L)
virtual PassManagerType getPotentialPassManagerType() const
Return what kind of Pass Manager can manage this pass.
virtual void assignPassManager(PMStack &, PassManagerType)