54 cl::desc(
"Print legacy PassManager debugging information"),
57 clEnumVal(Structure,
"print pass structure before run()"),
58 clEnumVal(Executions,
"print pass name before it is executed"),
59 clEnumVal(Details,
"print pass details when it is executed")));
68 Module &M,
StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount) {
75 unsigned FCount =
F.getInstructionCount();
82 FunctionToInstrCount[
F.getName().str()] =
83 std::pair<unsigned, unsigned>(FCount, 0);
90 Pass *
P,
Module &M, int64_t Delta,
unsigned CountBefore,
91 StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount,
97 if (
P->getAsPMDataManager())
101 bool CouldOnlyImpactOneFunction = (
F !=
nullptr);
104 auto UpdateFunctionChanges =
105 [&FunctionToInstrCount](
Function &MaybeChangedFn) {
107 unsigned FnSize = MaybeChangedFn.getInstructionCount();
111 auto [It, Inserted] = FunctionToInstrCount.try_emplace(
112 MaybeChangedFn.getName(), 0, FnSize);
117 It->second.second = FnSize;
123 if (!CouldOnlyImpactOneFunction)
126 UpdateFunctionChanges(*
F);
129 if (!CouldOnlyImpactOneFunction) {
143 int64_t CountAfter =
static_cast<int64_t
>(CountBefore) + Delta;
150 <<
": IR instruction count changed from "
156 F->getContext().diagnose(R);
159 std::string
PassName =
P->getPassName().str();
162 auto EmitFunctionSizeChangedRemark = [&FunctionToInstrCount, &
F, &BB,
164 unsigned FnCountBefore, FnCountAfter;
165 std::pair<unsigned, unsigned> &Change = FunctionToInstrCount[Fname];
166 std::tie(FnCountBefore, FnCountAfter) = Change;
167 int64_t FnDelta =
static_cast<int64_t
>(FnCountAfter) -
168 static_cast<int64_t
>(FnCountBefore);
184 <<
": IR instruction count changed from "
192 F->getContext().diagnose(FR);
195 Change.first = FnCountAfter;
200 if (!CouldOnlyImpactOneFunction)
201 llvm::for_each(FunctionToInstrCount.keys(), EmitFunctionSizeChangedRemark);
203 EmitFunctionSizeChangedRemark(
F->getName().str());
208 OS <<
"Releasing pass '";
210 OS <<
"Running pass '";
212 OS << P->getPassName() <<
"'";
215 OS <<
" on module '" << M->getModuleIdentifier() <<
"'.\n";
232 V->printAsOperand(OS,
false, M);
247 virtual void anchor();
263 const std::string &Banner)
const override {
292 Info.setPreservesAll();
307void FunctionPassManagerImpl::anchor() {}
321 Changed |= ImPass->doInitialization(M);
336 Changed |= ImPass->doFinalization(M);
361 F.getContext().yield();
386 ~MPPassManager()
override {
387 for (
auto &OnTheFlyManager : OnTheFlyManagers) {
388 legacy::FunctionPassManagerImpl *FPP = OnTheFlyManager.second;
394 Pass *createPrinterPass(raw_ostream &O,
395 const std::string &Banner)
const override {
401 bool runOnModule(
Module &M);
407 void getAnalysisUsage(AnalysisUsage &Info)
const override {
408 Info.setPreservesAll();
414 void addLowerLevelRequiredPass(
Pass *
P,
Pass *RequiredPass)
override;
420 Function &
F)
override;
422 StringRef getPassName()
const override {
return "Module Pass Manager"; }
424 PMDataManager *getAsPMDataManager()
override {
return this; }
425 Pass *getAsPass()
override {
return this; }
428 void dumpPassStructure(
unsigned Offset)
override {
430 for (
unsigned Index = 0;
Index < getNumContainedPasses(); ++
Index) {
431 ModulePass *MP = getContainedPass(Index);
434 OnTheFlyManagers.find(MP);
435 if (
I != OnTheFlyManagers.end())
436 I->second->dumpPassStructure(
Offset + 2);
437 dumpLastUses(MP,
Offset+1);
441 ModulePass *getContainedPass(
unsigned N) {
442 assert(
N < PassVector.size() &&
"Pass number out of range!");
443 return static_cast<ModulePass *
>(PassVector[
N]);
453 MapVector<Pass *, legacy::FunctionPassManagerImpl *> OnTheFlyManagers;
456char MPPassManager::ID = 0;
469 virtual void anchor();
483 const std::string &Banner)
const override {
496 Info.setPreservesAll();
507 MPPassManager *MP =
static_cast<MPPassManager *
>(
PassManagers[
N]);
512void PassManagerImpl::anchor() {}
529 Changed |= ImPass->doInitialization(M);
534 M.getContext().yield();
538 Changed |= ImPass->doFinalization(M);
559 if (
P->getResolver())
560 PDepth =
P->getResolver()->getPMDataManager().getDepth();
562 for (
Pass *AP : AnalysisPasses) {
564 auto &LastUserOfAP = LastUser[AP];
566 InversedLastUser[LastUserOfAP].erase(AP);
568 InversedLastUser[
P].insert(AP);
580 assert(AnalysisPass &&
"Expected analysis pass to exist.");
582 assert(AR &&
"Expected analysis resolver to exist.");
585 if (PDepth == APDepth)
587 else if (PDepth > APDepth)
595 if (
P->getResolver())
596 setLastUser(LastPMUses,
P->getResolver()->getPMDataManager().getAsPass());
600 auto &LastUsedByAP = InversedLastUser[AP];
601 for (
Pass *L : LastUsedByAP)
603 InversedLastUser[
P].insert_range(LastUsedByAP);
604 LastUsedByAP.clear();
611 auto DMI = InversedLastUser.find(
P);
612 if (DMI == InversedLastUser.end())
615 auto &LU = DMI->second;
616 LastUses.
append(LU.begin(), LU.end());
621 auto DMI = AnUsageMap.find(
P);
622 if (DMI != AnUsageMap.end())
623 AnUsage = DMI->second;
632 P->getAnalysisUsage(AU);
634 AUFoldingSetNode*
Node =
nullptr;
636 AUFoldingSetNode::Profile(
ID, AU);
638 if (
auto *
N = UniqueAnalysisUsages.FindNodeOrInsertPos(
ID, IP))
641 Node =
new (AUFoldingSetNodeAllocator.Allocate()) AUFoldingSetNode(AU);
642 UniqueAnalysisUsages.InsertNode(
Node, IP);
644 assert(
Node &&
"cached analysis usage must be non null");
646 AnUsageMap[
P] = &
Node->AU;
676 bool checkAnalysis =
true;
677 while (checkAnalysis) {
678 checkAnalysis =
false;
689 dbgs() <<
"Pass '" <<
P->getPassName() <<
"' is not initialized." <<
"\n";
690 dbgs() <<
"Verify if there is a pass dependency cycle." <<
"\n";
691 dbgs() <<
"Required Passes:" <<
"\n";
699 dbgs() <<
"\t" <<
"Error: Required pass not found! Possible causes:" <<
"\n";
700 dbgs() <<
"\t\t" <<
"- Pass misconfiguration (e.g.: missing macros)" <<
"\n";
701 dbgs() <<
"\t\t" <<
"- Corruption of the global PassRegistry" <<
"\n";
706 assert(PI &&
"Expected required passes to be initialized");
708 if (
P->getPotentialPassManagerType () ==
712 else if (
P->getPotentialPassManagerType () >
718 checkAnalysis =
true;
734 DM->initializeAnalysisImpl(
P);
736 DM->recordAvailableAnalysis(IP);
742 P->createPrinterPass(
dbgs(), (
"*** IR Dump Before " +
P->getPassName() +
749 P->assignPassManager(
activeStack, getTopLevelPassManagerType());
753 P->createPrinterPass(
dbgs(), (
"*** IR Dump After " +
P->getPassName() +
766 if (
Pass *
P = ImmutablePassMap.lookup(AID))
775 for (
PMDataManager *IndirectPassManager : IndirectPassManagers)
776 if (
Pass *
P = IndirectPassManager->findAnalysisPass(AID,
false))
783 const PassInfo *&PI = AnalysisPassInfos[AID];
788 "The pass info pointer changed for an analysis ID!");
795 ImmutablePasses.push_back(
P);
801 ImmutablePassMap[AID] =
P;
819 Manager->getAsPass()->dumpPassStructure(1);
827 dbgs() <<
"Pass Arguments: ";
830 assert(PI &&
"Expected all immutable passes to be initialized");
831 dbgs() <<
" -" << PI->getPassArgument();
834 PM->dumpPassArguments();
840 PM->initializeAnalysisInfo();
844 IPM->initializeAnalysisInfo();
863 AvailableAnalysis[PI] =
P;
874 for (
Pass *P1 : HigherLevelAnalysis) {
875 if (P1->getAsImmutablePass() ==
nullptr &&
896 AP->verifyAnalysis();
924 M->remove_if([&](
const auto &Entry) {
925 if (Entry.second->getAsImmutablePass() !=
nullptr ||
930 Pass *S = Entry.second;
931 dbgs() <<
" -- '" <<
P->getPassName() <<
"' is not preserving '";
949 TPM->collectLastUses(DeadPasses,
P);
952 dbgs() <<
" -*- '" <<
P->getPassName();
953 dbgs() <<
"' is the last user of following pass instances.";
954 dbgs() <<
" Free these instances\n";
957 for (
Pass *
P : DeadPasses)
974 AvailableAnalysis.erase(
P->getPassID());
989 if (!ProcessAnalysis) {
1000 unsigned PDepth = this->
getDepth();
1003 for (
Pass *PUsed : UsedPasses) {
1004 unsigned RDepth = 0;
1006 assert(PUsed->getResolver() &&
"Analysis Resolver is not set");
1008 RDepth =
DM.getDepth();
1010 if (PDepth == RDepth)
1012 else if (PDepth > RDepth) {
1016 HigherLevelAnalysis.push_back(PUsed);
1024 if (!
P->getAsPMDataManager())
1026 TPM->setLastUser(LastUses,
P);
1028 if (!TransferLastUses.
empty()) {
1030 TPM->setLastUser(TransferLastUses, My_PM);
1031 TransferLastUses.
clear();
1059 for (
const auto &UsedID : AnUsage->
getUsedSet())
1085 assert(AR &&
"Analysis Resolver is not set");
1095 auto I = AvailableAnalysis.find(AID);
1097 if (
I != AvailableAnalysis.end())
1102 return TPM->findAnalysisPass(AID);
1118 TPM->collectLastUses(LUses,
P);
1120 for (
Pass *
P : LUses) {
1121 dbgs() <<
"--" << std::string(
Offset*2,
' ');
1122 P->dumpPassStructure(0);
1129 PMD->dumpPassArguments();
1130 else if (
const PassInfo *PI =
TPM->findAnalysisPassInfo(
P->getPassID()))
1131 dbgs() <<
" -" << PI->getPassArgument();
1140 dbgs() <<
"[" << std::chrono::system_clock::now() <<
"] " << (
void *)
this
1141 << std::string(
getDepth() * 2 + 1,
' ');
1144 dbgs() <<
"Executing Pass '" <<
P->getPassName();
1147 dbgs() <<
"Made Modification '" <<
P->getPassName();
1150 dbgs() <<
" Freeing Pass '" <<
P->getPassName();
1157 dbgs() <<
"' on Function '" << Msg <<
"'...\n";
1160 dbgs() <<
"' on Module '" << Msg <<
"'...\n";
1163 dbgs() <<
"' on Region '" << Msg <<
"'...\n";
1166 dbgs() <<
"' on Loop '" << Msg <<
"'...\n";
1169 dbgs() <<
"' on Call Graph Nodes '" << Msg <<
"'...\n";
1181 P->getAnalysisUsage(analysisUsage);
1190 P->getAnalysisUsage(analysisUsage);
1199 P->getAnalysisUsage(analysisUsage);
1200 dumpAnalysisUsage(
"Used",
P, analysisUsage.
getUsedSet());
1203void PMDataManager::dumpAnalysisUsage(
StringRef Msg,
const Pass *
P,
1208 dbgs() << (
const void*)
P << std::string(
getDepth()*2+3,
' ') << Msg <<
" Analyses:";
1209 for (
unsigned i = 0; i != Set.size(); ++i) {
1210 if (i)
dbgs() <<
',';
1215 dbgs() <<
" Uninitialized Pass";
1229 TPM->dumpArguments();
1244 dbgs() <<
"' required by '" <<
P->getPassName() <<
"'\n";
1264 return PM.findAnalysisPass(
ID,
true);
1267std::tuple<Pass *, bool>
1269 return PM.getOnTheFlyPass(
P, AnalysisPI,
F);
1279FunctionPassManager::FunctionPassManager(
Module *m) : M(m) {
1282 FPM->setTopLevelManager(FPM);
1285 FPM->setResolver(AR);
1288FunctionPassManager::~FunctionPassManager() {
1302 report_fatal_error(Twine(
"Error reading bitcode file: ") + EIB.message());
1310bool FunctionPassManager::doInitialization() {
1311 return FPM->doInitialization(*M);
1316bool FunctionPassManager::doFinalization() {
1317 return FPM->doFinalization(*M);
1327 assert(AR &&
"Analysis Resolver is not set");
1351 if (
F.isDeclaration())
1361 bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
1365 FunctionSize =
F.getInstructionCount();
1374 bool LocalChanged =
false;
1379 "RunPass", [
FP]() {
return std::string(
FP->getPassName()); });
1391 bool IsInteresting =
false, ShouldPrintChanged =
false;
1392 if (ReportChanged) {
1399 ReportChanged =
false;
1402 if (ShouldPrintChanged) {
1407 ShouldPrintChanged =
FP->printIRUnit(OS,
F);
1413#ifdef EXPENSIVE_CHECKS
1416 LocalChanged |=
FP->runOnFunction(
F);
1418#if defined(EXPENSIVE_CHECKS) && !defined(NDEBUG)
1419 if (!LocalChanged && (RefHash !=
FP->structuralHash(
F))) {
1420 llvm::errs() <<
"Pass modifies its input and doesn't report it: "
1421 <<
FP->getPassName() <<
"\n";
1427 unsigned NewSize =
F.getInstructionCount();
1431 if (NewSize != FunctionSize) {
1432 int64_t Delta =
static_cast<int64_t
>(NewSize) -
1433 static_cast<int64_t
>(FunctionSize);
1435 FunctionToInstrCount, &
F);
1437 FunctionSize = NewSize;
1442 if (ShouldPrintChanged) {
1444 FP->printIRUnit(OS,
F);
1448 IsInteresting, ShouldPrintChanged);
1500MPPassManager::runOnModule(
Module &M) {
1506 for (
auto &OnTheFlyManager : OnTheFlyManagers) {
1512 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
1513 Changed |= getContainedPass(Index)->doInitialization(M);
1517 bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
1520 InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
1523 for (
unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
1525 bool LocalChanged =
false;
1528 dumpRequiredSet(MP);
1530 initializeAnalysisImpl(MP);
1536 bool IsInteresting =
false, ShouldPrintChanged =
false;
1537 if (ReportChanged) {
1543 ReportChanged =
false;
1546 if (ShouldPrintChanged) {
1550 M.print(OS,
nullptr);
1557#ifdef EXPENSIVE_CHECKS
1558 uint64_t RefHash = MP->structuralHash(M);
1563#ifdef EXPENSIVE_CHECKS
1564 assert((LocalChanged || (RefHash == MP->structuralHash(M))) &&
1565 "Pass modifies its input and doesn't report it.");
1570 unsigned ModuleCount =
M.getInstructionCount();
1572 int64_t Delta =
static_cast<int64_t
>(ModuleCount) -
1574 emitInstrCountChangedRemark(MP, M, Delta,
InstrCount,
1575 FunctionToInstrCount);
1581 if (ShouldPrintChanged) {
1583 M.print(OS,
nullptr);
1587 M.getModuleIdentifier(), IsInteresting,
1588 ShouldPrintChanged);
1593 M.getModuleIdentifier());
1594 dumpPreservedSet(MP);
1597 verifyPreservedAnalysis(MP);
1599 removeNotPreservedAnalysis(MP);
1600 recordAvailableAnalysis(MP);
1605 for (
int Index = getNumContainedPasses() - 1;
Index >= 0; --
Index)
1606 Changed |= getContainedPass(Index)->doFinalization(M);
1609 for (
auto &OnTheFlyManager : OnTheFlyManagers) {
1623void MPPassManager::addLowerLevelRequiredPass(
Pass *
P,
Pass *RequiredPass) {
1624 assert(RequiredPass &&
"No required pass?");
1626 "Unable to handle Pass that requires lower level Analysis pass");
1627 assert((
P->getPotentialPassManagerType() <
1629 "Unable to handle Pass that requires lower level Analysis pass");
1637 OnTheFlyManagers[
P] = FPP;
1640 TPM->findAnalysisPassInfo(RequiredPass->
getPassID());
1642 Pass *FoundPass =
nullptr;
1643 if (RequiredPassPI && RequiredPassPI->
isAnalysis()) {
1648 FoundPass = RequiredPass;
1651 FPP->
add(RequiredPass);
1662std::tuple<Pass *, bool> MPPassManager::getOnTheFlyPass(
Pass *MP,
AnalysisID PI,
1665 assert(FPP &&
"Unable to find on the fly pass");
1683 PM->setTopLevelManager(PM);
1717 assert(PM &&
"Unable to push. Pass Manager expected");
1720 if (!this->
empty()) {
1722 &&
"pushing bad pass manager to PMStack");
1725 assert(TPM &&
"Unable to find top level manager");
1732 &&
"pushing bad pass manager to PMStack");
1742 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...
This file defines the SmallString class.
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
static const PassInfo * lookupPassInfo(const void *TI)
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...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
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.
A raw_ostream that writes to an SmallVector or SmallString.
#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.
LLVM_ABI void reportChangedIR(StringRef Before, StringRef After, StringRef PassName, StringRef PassID, StringRef IRName, bool IsInteresting, bool ShouldReport)
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 cl::opt< ChangePrinter > PrintChanged
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.
LLVM_ABI bool isFunctionInPrintList(StringRef FunctionName)
LLVM_ABI bool isPassInPrintList(StringRef PassName)
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.
LLVM_ABI bool shouldPrintBeforePass(StringRef PassID)
LLVM_ABI 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.