52 cl::desc(
"Print legacy PassManager debugging information"),
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")));
66 Module &M,
StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount) {
73 unsigned FCount =
F.getInstructionCount();
80 FunctionToInstrCount[
F.getName().str()] =
81 std::pair<unsigned, unsigned>(FCount, 0);
88 Pass *
P,
Module &M, int64_t Delta,
unsigned CountBefore,
89 StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount,
95 if (
P->getAsPMDataManager())
99 bool CouldOnlyImpactOneFunction = (
F !=
nullptr);
102 auto UpdateFunctionChanges =
103 [&FunctionToInstrCount](
Function &MaybeChangedFn) {
105 unsigned FnSize = MaybeChangedFn.getInstructionCount();
109 auto [It, Inserted] = FunctionToInstrCount.try_emplace(
110 MaybeChangedFn.getName(), 0, FnSize);
115 It->second.second = FnSize;
121 if (!CouldOnlyImpactOneFunction)
124 UpdateFunctionChanges(*
F);
127 if (!CouldOnlyImpactOneFunction) {
141 int64_t CountAfter =
static_cast<int64_t
>(CountBefore) + Delta;
148 <<
": IR instruction count changed from "
154 F->getContext().diagnose(R);
157 std::string
PassName =
P->getPassName().str();
160 auto EmitFunctionSizeChangedRemark = [&FunctionToInstrCount, &
F, &BB,
162 unsigned FnCountBefore, FnCountAfter;
163 std::pair<unsigned, unsigned> &Change = FunctionToInstrCount[Fname];
164 std::tie(FnCountBefore, FnCountAfter) = Change;
165 int64_t FnDelta =
static_cast<int64_t
>(FnCountAfter) -
166 static_cast<int64_t
>(FnCountBefore);
182 <<
": IR instruction count changed from "
190 F->getContext().diagnose(FR);
193 Change.first = FnCountAfter;
198 if (!CouldOnlyImpactOneFunction)
199 llvm::for_each(FunctionToInstrCount.keys(), EmitFunctionSizeChangedRemark);
201 EmitFunctionSizeChangedRemark(
F->getName().str());
206 OS <<
"Releasing pass '";
208 OS <<
"Running pass '";
210 OS << P->getPassName() <<
"'";
213 OS <<
" on module '" << M->getModuleIdentifier() <<
"'.\n";
230 V->printAsOperand(OS,
false, M);
245 virtual void anchor();
261 const std::string &Banner)
const override {
290 Info.setPreservesAll();
305void FunctionPassManagerImpl::anchor() {}
319 Changed |= ImPass->doInitialization(M);
334 Changed |= ImPass->doFinalization(M);
359 F.getContext().yield();
384 ~MPPassManager()
override {
385 for (
auto &OnTheFlyManager : OnTheFlyManagers) {
386 legacy::FunctionPassManagerImpl *FPP = OnTheFlyManager.second;
392 Pass *createPrinterPass(raw_ostream &O,
393 const std::string &Banner)
const override {
399 bool runOnModule(
Module &M);
405 void getAnalysisUsage(AnalysisUsage &Info)
const override {
406 Info.setPreservesAll();
412 void addLowerLevelRequiredPass(
Pass *
P,
Pass *RequiredPass)
override;
418 Function &
F)
override;
420 StringRef getPassName()
const override {
return "Module Pass Manager"; }
422 PMDataManager *getAsPMDataManager()
override {
return this; }
423 Pass *getAsPass()
override {
return this; }
426 void dumpPassStructure(
unsigned Offset)
override {
428 for (
unsigned Index = 0;
Index < getNumContainedPasses(); ++
Index) {
429 ModulePass *MP = getContainedPass(Index);
432 OnTheFlyManagers.find(MP);
433 if (
I != OnTheFlyManagers.end())
434 I->second->dumpPassStructure(
Offset + 2);
435 dumpLastUses(MP,
Offset+1);
439 ModulePass *getContainedPass(
unsigned N) {
440 assert(
N < PassVector.size() &&
"Pass number out of range!");
441 return static_cast<ModulePass *
>(PassVector[
N]);
451 MapVector<Pass *, legacy::FunctionPassManagerImpl *> OnTheFlyManagers;
454char MPPassManager::ID = 0;
467 virtual void anchor();
481 const std::string &Banner)
const override {
494 Info.setPreservesAll();
505 MPPassManager *MP =
static_cast<MPPassManager *
>(
PassManagers[
N]);
510void PassManagerImpl::anchor() {}
527 Changed |= ImPass->doInitialization(M);
532 M.getContext().yield();
536 Changed |= ImPass->doFinalization(M);
557 if (
P->getResolver())
558 PDepth =
P->getResolver()->getPMDataManager().getDepth();
560 for (
Pass *AP : AnalysisPasses) {
562 auto &LastUserOfAP = LastUser[AP];
564 InversedLastUser[LastUserOfAP].erase(AP);
566 InversedLastUser[
P].insert(AP);
578 assert(AnalysisPass &&
"Expected analysis pass to exist.");
580 assert(AR &&
"Expected analysis resolver to exist.");
583 if (PDepth == APDepth)
585 else if (PDepth > APDepth)
593 if (
P->getResolver())
594 setLastUser(LastPMUses,
P->getResolver()->getPMDataManager().getAsPass());
598 auto &LastUsedByAP = InversedLastUser[AP];
599 for (
Pass *L : LastUsedByAP)
601 InversedLastUser[
P].insert_range(LastUsedByAP);
602 LastUsedByAP.clear();
609 auto DMI = InversedLastUser.find(
P);
610 if (DMI == InversedLastUser.end())
613 auto &LU = DMI->second;
614 LastUses.
append(LU.begin(), LU.end());
619 auto DMI = AnUsageMap.find(
P);
620 if (DMI != AnUsageMap.end())
621 AnUsage = DMI->second;
630 P->getAnalysisUsage(AU);
632 AUFoldingSetNode*
Node =
nullptr;
634 AUFoldingSetNode::Profile(
ID, AU);
636 if (
auto *
N = UniqueAnalysisUsages.FindNodeOrInsertPos(
ID, IP))
639 Node =
new (AUFoldingSetNodeAllocator.Allocate()) AUFoldingSetNode(AU);
640 UniqueAnalysisUsages.InsertNode(
Node, IP);
642 assert(
Node &&
"cached analysis usage must be non null");
644 AnUsageMap[
P] = &
Node->AU;
674 bool checkAnalysis =
true;
675 while (checkAnalysis) {
676 checkAnalysis =
false;
687 dbgs() <<
"Pass '" <<
P->getPassName() <<
"' is not initialized." <<
"\n";
688 dbgs() <<
"Verify if there is a pass dependency cycle." <<
"\n";
689 dbgs() <<
"Required Passes:" <<
"\n";
697 dbgs() <<
"\t" <<
"Error: Required pass not found! Possible causes:" <<
"\n";
698 dbgs() <<
"\t\t" <<
"- Pass misconfiguration (e.g.: missing macros)" <<
"\n";
699 dbgs() <<
"\t\t" <<
"- Corruption of the global PassRegistry" <<
"\n";
704 assert(PI &&
"Expected required passes to be initialized");
706 if (
P->getPotentialPassManagerType () ==
710 else if (
P->getPotentialPassManagerType () >
716 checkAnalysis =
true;
732 DM->initializeAnalysisImpl(
P);
734 DM->recordAvailableAnalysis(IP);
740 P->createPrinterPass(
dbgs(), (
"*** IR Dump Before " +
P->getPassName() +
747 P->assignPassManager(
activeStack, getTopLevelPassManagerType());
751 P->createPrinterPass(
dbgs(), (
"*** IR Dump After " +
P->getPassName() +
764 if (
Pass *
P = ImmutablePassMap.lookup(AID))
773 for (
PMDataManager *IndirectPassManager : IndirectPassManagers)
774 if (
Pass *
P = IndirectPassManager->findAnalysisPass(AID,
false))
781 const PassInfo *&PI = AnalysisPassInfos[AID];
786 "The pass info pointer changed for an analysis ID!");
793 ImmutablePasses.push_back(
P);
799 ImmutablePassMap[AID] =
P;
817 Manager->getAsPass()->dumpPassStructure(1);
825 dbgs() <<
"Pass Arguments: ";
828 assert(PI &&
"Expected all immutable passes to be initialized");
829 dbgs() <<
" -" << PI->getPassArgument();
832 PM->dumpPassArguments();
838 PM->initializeAnalysisInfo();
842 IPM->initializeAnalysisInfo();
861 AvailableAnalysis[PI] =
P;
872 for (
Pass *P1 : HigherLevelAnalysis) {
873 if (P1->getAsImmutablePass() ==
nullptr &&
894 AP->verifyAnalysis();
906 for (
auto I = AvailableAnalysis.begin(), E = AvailableAnalysis.end();
909 if (Info->second->getAsImmutablePass() ==
nullptr &&
913 Pass *S = Info->second;
914 dbgs() <<
" -- '" <<
P->getPassName() <<
"' is not preserving '";
917 AvailableAnalysis.erase(Info);
927 for (
auto I = IA->begin(), E = IA->end();
I != E;) {
929 if (Info->second->getAsImmutablePass() ==
nullptr &&
933 Pass *S = Info->second;
934 dbgs() <<
" -- '" <<
P->getPassName() <<
"' is not preserving '";
953 TPM->collectLastUses(DeadPasses,
P);
956 dbgs() <<
" -*- '" <<
P->getPassName();
957 dbgs() <<
"' is the last user of following pass instances.";
958 dbgs() <<
" Free these instances\n";
961 for (
Pass *
P : DeadPasses)
978 AvailableAnalysis.erase(
P->getPassID());
993 if (!ProcessAnalysis) {
1004 unsigned PDepth = this->
getDepth();
1007 for (
Pass *PUsed : UsedPasses) {
1008 unsigned RDepth = 0;
1010 assert(PUsed->getResolver() &&
"Analysis Resolver is not set");
1012 RDepth =
DM.getDepth();
1014 if (PDepth == RDepth)
1016 else if (PDepth > RDepth) {
1020 HigherLevelAnalysis.push_back(PUsed);
1028 if (!
P->getAsPMDataManager())
1030 TPM->setLastUser(LastUses,
P);
1032 if (!TransferLastUses.
empty()) {
1034 TPM->setLastUser(TransferLastUses, My_PM);
1035 TransferLastUses.
clear();
1063 for (
const auto &UsedID : AnUsage->
getUsedSet())
1089 assert(AR &&
"Analysis Resolver is not set");
1099 auto I = AvailableAnalysis.find(AID);
1101 if (
I != AvailableAnalysis.end())
1106 return TPM->findAnalysisPass(AID);
1122 TPM->collectLastUses(LUses,
P);
1124 for (
Pass *
P : LUses) {
1125 dbgs() <<
"--" << std::string(
Offset*2,
' ');
1126 P->dumpPassStructure(0);
1133 PMD->dumpPassArguments();
1134 else if (
const PassInfo *PI =
TPM->findAnalysisPassInfo(
P->getPassID()))
1135 dbgs() <<
" -" << PI->getPassArgument();
1144 dbgs() <<
"[" << std::chrono::system_clock::now() <<
"] " << (
void *)
this
1145 << std::string(
getDepth() * 2 + 1,
' ');
1148 dbgs() <<
"Executing Pass '" <<
P->getPassName();
1151 dbgs() <<
"Made Modification '" <<
P->getPassName();
1154 dbgs() <<
" Freeing Pass '" <<
P->getPassName();
1161 dbgs() <<
"' on Function '" << Msg <<
"'...\n";
1164 dbgs() <<
"' on Module '" << Msg <<
"'...\n";
1167 dbgs() <<
"' on Region '" << Msg <<
"'...\n";
1170 dbgs() <<
"' on Loop '" << Msg <<
"'...\n";
1173 dbgs() <<
"' on Call Graph Nodes '" << Msg <<
"'...\n";
1185 P->getAnalysisUsage(analysisUsage);
1194 P->getAnalysisUsage(analysisUsage);
1203 P->getAnalysisUsage(analysisUsage);
1204 dumpAnalysisUsage(
"Used",
P, analysisUsage.
getUsedSet());
1207void PMDataManager::dumpAnalysisUsage(
StringRef Msg,
const Pass *
P,
1212 dbgs() << (
const void*)
P << std::string(
getDepth()*2+3,
' ') << Msg <<
" Analyses:";
1213 for (
unsigned i = 0; i != Set.size(); ++i) {
1214 if (i)
dbgs() <<
',';
1219 dbgs() <<
" Uninitialized Pass";
1233 TPM->dumpArguments();
1248 dbgs() <<
"' required by '" <<
P->getPassName() <<
"'\n";
1268 return PM.findAnalysisPass(
ID,
true);
1271std::tuple<Pass *, bool>
1273 return PM.getOnTheFlyPass(
P, AnalysisPI,
F);
1283FunctionPassManager::FunctionPassManager(
Module *m) : M(m) {
1286 FPM->setTopLevelManager(FPM);
1289 FPM->setResolver(AR);
1292FunctionPassManager::~FunctionPassManager() {
1306 report_fatal_error(Twine(
"Error reading bitcode file: ") + EIB.message());
1314bool FunctionPassManager::doInitialization() {
1315 return FPM->doInitialization(*M);
1320bool FunctionPassManager::doFinalization() {
1321 return FPM->doFinalization(*M);
1331 assert(AR &&
"Analysis Resolver is not set");
1355 if (
F.isDeclaration())
1365 bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
1369 FunctionSize =
F.getInstructionCount();
1378 bool LocalChanged =
false;
1383 "RunPass", [
FP]() {
return std::string(
FP->getPassName()); });
1393#ifdef EXPENSIVE_CHECKS
1396 LocalChanged |=
FP->runOnFunction(
F);
1398#if defined(EXPENSIVE_CHECKS) && !defined(NDEBUG)
1399 if (!LocalChanged && (RefHash !=
FP->structuralHash(
F))) {
1400 llvm::errs() <<
"Pass modifies its input and doesn't report it: "
1401 <<
FP->getPassName() <<
"\n";
1407 unsigned NewSize =
F.getInstructionCount();
1411 if (NewSize != FunctionSize) {
1412 int64_t Delta =
static_cast<int64_t
>(NewSize) -
1413 static_cast<int64_t
>(FunctionSize);
1415 FunctionToInstrCount, &
F);
1417 FunctionSize = NewSize;
1472MPPassManager::runOnModule(
Module &M) {
1478 for (
auto &OnTheFlyManager : OnTheFlyManagers) {
1484 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
1485 Changed |= getContainedPass(Index)->doInitialization(M);
1489 bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
1492 InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
1494 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1496 bool LocalChanged =
false;
1499 dumpRequiredSet(MP);
1501 initializeAnalysisImpl(MP);
1507#ifdef EXPENSIVE_CHECKS
1508 uint64_t RefHash = MP->structuralHash(M);
1513#ifdef EXPENSIVE_CHECKS
1514 assert((LocalChanged || (RefHash == MP->structuralHash(M))) &&
1515 "Pass modifies its input and doesn't report it.");
1520 unsigned ModuleCount = M.getInstructionCount();
1522 int64_t Delta =
static_cast<int64_t
>(ModuleCount) -
1524 emitInstrCountChangedRemark(MP, M, Delta,
InstrCount,
1525 FunctionToInstrCount);
1534 M.getModuleIdentifier());
1535 dumpPreservedSet(MP);
1538 verifyPreservedAnalysis(MP);
1540 removeNotPreservedAnalysis(MP);
1541 recordAvailableAnalysis(MP);
1546 for (
int Index = getNumContainedPasses() - 1;
Index >= 0; --
Index)
1547 Changed |= getContainedPass(Index)->doFinalization(M);
1550 for (
auto &OnTheFlyManager : OnTheFlyManagers) {
1564void MPPassManager::addLowerLevelRequiredPass(
Pass *
P,
Pass *RequiredPass) {
1565 assert(RequiredPass &&
"No required pass?");
1567 "Unable to handle Pass that requires lower level Analysis pass");
1568 assert((
P->getPotentialPassManagerType() <
1570 "Unable to handle Pass that requires lower level Analysis pass");
1578 OnTheFlyManagers[
P] = FPP;
1581 TPM->findAnalysisPassInfo(RequiredPass->
getPassID());
1583 Pass *FoundPass =
nullptr;
1584 if (RequiredPassPI && RequiredPassPI->
isAnalysis()) {
1589 FoundPass = RequiredPass;
1592 FPP->
add(RequiredPass);
1603std::tuple<Pass *, bool> MPPassManager::getOnTheFlyPass(
Pass *MP,
AnalysisID PI,
1606 assert(FPP &&
"Unable to find on the fly pass");
1624 PM->setTopLevelManager(PM);
1658 assert(PM &&
"Unable to push. Pass Manager expected");
1661 if (!this->
empty()) {
1663 &&
"pushing bad pass manager to PMStack");
1666 assert(TPM &&
"Unable to find top level manager");
1673 &&
"pushing bad pass manager to PMStack");
1683 dbgs() << Manager->getAsPass()->getPassName() <<
' ';
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Lower Kernel Arguments
#define clEnumVal(ENUMVAL, DESC)
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
static unsigned InstrCount
static RegisterPass< DebugifyModulePass > DM("debugify", "Attach debug info to everything")
This file contains an interface for creating legacy passes to print out IR in various granularities.
Module.h This file contains the declarations for the Module class.
static cl::opt< enum PassDebugLevel > PassDebugging("debug-pass", cl::Hidden, cl::desc("Print legacy 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")))
print mir2vec MIR2Vec Vocabulary Printer Pass
Machine Check Debug Module
This file implements a map that provides insertion order iteration.
This header defines classes/functions to handle pass execution timing information with interfaces for...
static const PassInfo * getPassInfo(StringRef PassName)
static const char PassName[]
AnalysisResolver - Simple interface used by Pass objects to pull all analysis information out of pass...
void addAnalysisImplsPair(AnalysisID PI, Pass *P)
Pass * findImplPass(AnalysisID PI)
Find pass that is implementing PI.
PMDataManager & getPMDataManager()
void clearAnalysisImpls()
Clear cache that is used to connect a pass to the analysis (PassInfo).
LLVM_ABI Pass * getAnalysisIfAvailable(AnalysisID ID) const
Return analysis result or null if it doesn't exist.
Represent the analysis usage information of a pass.
const VectorType & getRequiredSet() const
const VectorType & getRequiredTransitiveSet() const
SmallVectorImpl< AnalysisID > VectorType
const VectorType & getUsedSet() const
bool getPreservesAll() const
Determine whether a pass said it does not transform its input at all.
const VectorType & getPreservedSet() const
Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
Base class for error info classes.
FPPassManager manages BBPassManagers and FunctionPasses.
bool runOnFunction(Function &F)
run - Execute all of the passes scheduled for execution.
bool doInitialization(Module &M) override
doInitialization - Run all of the initializers for the function passes.
bool doFinalization(Module &M) override
doFinalization - Run all of the finalizers for the function passes.
FunctionPass * getContainedPass(unsigned N)
void dumpPassStructure(unsigned Offset) override
Print passes managed by this manager.
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
void cleanup()
cleanup - After running all passes, clean up pass manager cache.
This class is used to gather all the unique data bits of a node.
FunctionPass class - This class is used to implement most global optimizations.
void assignPassManager(PMStack &PMS, PassManagerType T) override
Find appropriate Function Pass Manager or Call Graph Pass Manager in the PM Stack and add self into t...
ImmutablePass class - This class is used to provide information that does not need to be run.
typename VectorType::const_iterator const_iterator
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
void assignPassManager(PMStack &PMS, PassManagerType T) override
Find appropriate Module Pass Manager in the PM Stack and add self into that manager.
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
PMDataManager provides the common place to manage the analysis data used by pass managers.
void dumpPassArguments() const
void removeDeadPasses(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove dead passes used by P.
void dumpLastUses(Pass *P, unsigned Offset) const
virtual Pass * getAsPass()=0
virtual std::tuple< Pass *, bool > getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F)
void setDepth(unsigned newDepth)
void recordAvailableAnalysis(Pass *P)
Augment AvailableAnalysis by adding analysis made available by pass P.
Pass * findAnalysisPass(AnalysisID AID, bool Direction)
Find the pass that implements Analysis AID.
bool isPassDebuggingExecutionsOrMore() const
isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified.
unsigned getDepth() const
SmallVector< Pass *, 16 > PassVector
DenseMap< AnalysisID, Pass * > * InheritedAnalysis[PMT_Last]
virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass)
Add RequiredPass into list of lower level passes required by pass P.
PMTopLevelManager * getTopLevelManager()
unsigned initSizeRemarkInfo(Module &M, StringMap< std::pair< unsigned, unsigned > > &FunctionToInstrCount)
Set the initial size of the module if the user has specified that they want remarks for size.
void setTopLevelManager(PMTopLevelManager *T)
void dumpRequiredSet(const Pass *P) const
void initializeAnalysisImpl(Pass *P)
All Required analyses should be available to the pass as it runs!
void verifyPreservedAnalysis(Pass *P)
verifyPreservedAnalysis – Verify analysis presreved by pass P.
void initializeAnalysisInfo()
Initialize available analysis information.
void freePass(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove P.
bool preserveHigherLevelAnalysis(Pass *P)
unsigned getNumContainedPasses() const
virtual PassManagerType getPassManagerType() const
void emitInstrCountChangedRemark(Pass *P, Module &M, int64_t Delta, unsigned CountBefore, StringMap< std::pair< unsigned, unsigned > > &FunctionToInstrCount, Function *F=nullptr)
Emit a remark signifying that the number of IR instructions in the module changed.
void add(Pass *P, bool ProcessAnalysis=true)
Add pass P into the PassVector.
void collectRequiredAndUsedAnalyses(SmallVectorImpl< Pass * > &UsedPasses, SmallVectorImpl< AnalysisID > &ReqPassNotAvailable, Pass *P)
Populate UsedPasses with analysis pass that are used or required by pass P and are available.
void populateInheritedAnalysis(PMStack &PMS)
void dumpPreservedSet(const Pass *P) const
void dumpUsedSet(const Pass *P) const
void removeNotPreservedAnalysis(Pass *P)
Remove Analysis that is not preserved by the pass.
void dumpPassInfo(Pass *P, enum PassDebuggingString S1, enum PassDebuggingString S2, StringRef Msg)
PMStack - This class implements a stack data structure of PMDataManager pointers.
PMDataManager * top() const
LLVM_ABI void dump() const
LLVM_ABI void push(PMDataManager *PM)
PMTopLevelManager manages LastUser info and collects common APIs used by top level pass managers.
void addIndirectPassManager(PMDataManager *Manager)
void addImmutablePass(ImmutablePass *P)
Add immutable pass and initialize it.
const PassInfo * findAnalysisPassInfo(AnalysisID AID) const
Retrieve the PassInfo for an analysis.
void setLastUser(ArrayRef< Pass * > AnalysisPasses, Pass *P)
Set pass P as the last user of the given analysis passes.
virtual ~PMTopLevelManager()
Destructor.
void schedulePass(Pass *P)
Schedule pass P for execution.
SmallVector< PMDataManager *, 8 > PassManagers
Collection of pass managers.
Pass * findAnalysisPass(AnalysisID AID)
Find the pass that implements Analysis AID.
void dumpArguments() const
AnalysisUsage * findAnalysisUsage(Pass *P)
Find analysis usage information for the pass P.
void addPassManager(PMDataManager *Manager)
unsigned getNumContainedManagers() const
void initializeAllAnalysisInfo()
SmallVectorImpl< ImmutablePass * > & getImmutablePasses()
PMTopLevelManager(PMDataManager *PMDM)
Initialize top level manager. Create first pass manager.
void collectLastUses(SmallVectorImpl< Pass * > &LastUses, Pass *P)
Collect passes whose last user is P.
PassInfo class - An instance of this class exists for every pass known by the system,...
StringRef getPassArgument() const
getPassArgument - Return the command line option that may be passed to 'opt' that will cause this pas...
StringRef getPassName() const
getPassName - Return the friendly name for the pass, never returns null
Pass * createPass() const
createPass() - Use this method to create an instance of this pass.
PassManagerPrettyStackEntry - This is used to print informative information about what pass is runnin...
void print(raw_ostream &OS) const override
print - Emit information about this stack frame to OS.
Manages a sequence of passes over a particular unit of IR.
PreservedAnalyses run(Function &IR, AnalysisManager< Function > &AM, ExtraArgTs... ExtraArgs)
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLVM_ABI const PassInfo * getPassInfo(const void *TI) const
getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass' type identifier (&MyPass::...
Pass interface - Implemented by all 'passes'.
virtual PassManagerType getPotentialPassManagerType() const
Return what kind of Pass Manager can manage this pass.
Pass(PassKind K, char &pid)
AnalysisID getPassID() const
getPassID - Return the PassID number that corresponds to this pass.
virtual void assignPassManager(PMStack &, PassManagerType)
Each pass is responsible for assigning a pass manager to itself.
AnalysisResolver * getResolver() const
virtual bool doInitialization(Module &)
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
virtual bool doFinalization(Module &)
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
virtual void dumpPassStructure(unsigned Offset=0)
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
virtual void releaseMemory()
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Represent a constant reference to a string, i.e.
The TimeRegion class is used as a helper class to call the startTimer() and stopTimer() methods of th...
The TimeTraceScope is a helper class to call the begin and end functions of the time trace profiler.
FunctionPassManagerImpl manages FPPassManagers.
Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const override
createPrinterPass - Get a function printer pass.
FPPassManager * getContainedManager(unsigned N)
FunctionPassManagerImpl()
void releaseMemoryOnTheFly()
bool doInitialization(Module &M) override
doInitialization - Run all of the initializers for the function passes.
PMDataManager * getAsPMDataManager() override
void dumpPassStructure(unsigned Offset) override
Pass * getAsPass() override
bool run(Function &F)
run - Execute all of the passes scheduled for execution.
bool doFinalization(Module &M) override
doFinalization - Run all of the finalizers for the function passes.
PassManagerType getTopLevelPassManagerType() override
void getAnalysisUsage(AnalysisUsage &Info) const override
Pass Manager itself does not invalidate any analysis info.
virtual ~PassManagerBase()
PassManagerImpl manages MPPassManagers.
PassManagerType getTopLevelPassManagerType() override
void getAnalysisUsage(AnalysisUsage &Info) const override
Pass Manager itself does not invalidate any analysis info.
void add(Pass *P)
Add a pass to the queue of passes to run.
Pass * getAsPass() override
bool run(Module &M)
run - Execute all of the passes scheduled for execution.
PMDataManager * getAsPMDataManager() override
MPPassManager * getContainedManager(unsigned N)
Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const override
createPrinterPass - Get a module printer pass.
void add(Pass *P) override
Add a pass to the queue of passes to run.
bool run(Module &M)
run - Execute all of the passes scheduled for execution.
PassManager()
Create new pass manager.
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
LLVM_ABI bool debugPassSpecified()
This is an optimization pass for GlobalISel generic memory operations.
UnaryFunction for_each(R &&Range, UnaryFunction F)
Provide wrappers to std::for_each which take ranges instead of having to pass begin/end explicitly.
void handleAllErrors(Error E, HandlerTs &&... Handlers)
Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...
PassManagerType
Different types of internal pass managers.
@ PMT_ModulePassManager
MPPassManager.
@ PMT_FunctionPassManager
FPPassManager.
LLVM_ABI Timer * getPassTimer(Pass *)
Request the timer for this legacy-pass-manager's pass instance.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
LLVM_ABI ModulePass * createPrintModulePass(raw_ostream &OS, const std::string &Banner="", bool ShouldPreserveUseListOrder=false)
Create and return a pass that writes the module to the specified raw_ostream.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
bool shouldPrintBeforePass(StringRef PassID)
bool shouldPrintAfterPass(StringRef PassID)
@ Disabled
Don't do any conversion of .debug_str_offsets tables.
LLVM_ABI FunctionPass * createPrintFunctionPass(raw_ostream &OS, const std::string &Banner="")
Create and return a pass that prints functions to the specified raw_ostream as they are processed.
Used in the streaming interface as the general argument type.