53 cl::desc(
"Print legacy PassManager debugging information"),
56 clEnumVal(Structure,
"print pass structure before run()"),
57 clEnumVal(Executions,
"print pass name before it is executed"),
58 clEnumVal(Details,
"print pass details when it is executed")));
67 Module &M,
StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount) {
74 unsigned FCount =
F.getInstructionCount();
81 FunctionToInstrCount[
F.getName().str()] =
82 std::pair<unsigned, unsigned>(FCount, 0);
89 Pass *
P,
Module &M, int64_t Delta,
unsigned CountBefore,
90 StringMap<std::pair<unsigned, unsigned>> &FunctionToInstrCount,
96 if (
P->getAsPMDataManager())
100 bool CouldOnlyImpactOneFunction = (
F !=
nullptr);
103 auto UpdateFunctionChanges =
104 [&FunctionToInstrCount](
Function &MaybeChangedFn) {
106 unsigned FnSize = MaybeChangedFn.getInstructionCount();
107 auto It = FunctionToInstrCount.find(MaybeChangedFn.getName());
111 if (It == FunctionToInstrCount.end()) {
112 FunctionToInstrCount[MaybeChangedFn.getName()] =
113 std::pair<unsigned, unsigned>(0, FnSize);
118 It->second.second = FnSize;
124 if (!CouldOnlyImpactOneFunction)
125 std::for_each(M.begin(), M.end(), UpdateFunctionChanges);
127 UpdateFunctionChanges(*
F);
130 if (!CouldOnlyImpactOneFunction) {
144 int64_t CountAfter =
static_cast<int64_t
>(CountBefore) + Delta;
151 <<
": IR instruction count changed from "
157 F->getContext().diagnose(R);
160 std::string
PassName =
P->getPassName().str();
163 auto EmitFunctionSizeChangedRemark = [&FunctionToInstrCount, &
F, &BB,
165 unsigned FnCountBefore, FnCountAfter;
166 std::pair<unsigned, unsigned> &Change = FunctionToInstrCount[Fname];
167 std::tie(FnCountBefore, FnCountAfter) = Change;
168 int64_t FnDelta =
static_cast<int64_t
>(FnCountAfter) -
169 static_cast<int64_t
>(FnCountBefore);
185 <<
": IR instruction count changed from "
193 F->getContext().diagnose(FR);
196 Change.first = FnCountAfter;
201 if (!CouldOnlyImpactOneFunction)
202 std::for_each(FunctionToInstrCount.keys().begin(),
203 FunctionToInstrCount.keys().end(),
204 EmitFunctionSizeChangedRemark);
206 EmitFunctionSizeChangedRemark(
F->getName().str());
211 OS <<
"Releasing pass '";
213 OS <<
"Running pass '";
227 if (isa<Function>(V))
229 else if (isa<BasicBlock>(V))
250 virtual void anchor();
266 const std::string &Banner)
const override {
295 Info.setPreservesAll();
310void FunctionPassManagerImpl::anchor() {}
318 bool Changed =
false;
324 Changed |= ImPass->doInitialization(M);
333 bool Changed =
false;
339 Changed |= ImPass->doFinalization(M);
359 bool Changed =
false;
364 F.getContext().yield();
389 ~MPPassManager()
override {
390 for (
auto &OnTheFlyManager : OnTheFlyManagers) {
398 const std::string &Banner)
const override {
404 bool runOnModule(
Module &M);
411 Info.setPreservesAll();
437 OnTheFlyManagers.find(MP);
438 if (
I != OnTheFlyManagers.end())
439 I->second->dumpPassStructure(
Offset + 2);
445 assert(
N < PassVector.size() &&
"Pass number out of range!");
459char MPPassManager::ID = 0;
472 virtual void anchor();
486 const std::string &Banner)
const override {
499 Info.setPreservesAll();
510 MPPassManager *MP =
static_cast<MPPassManager *
>(
PassManagers[
N]);
515void PassManagerImpl::anchor() {}
526 bool Changed =
false;
535 M.convertToNewDbgValues();
538 Changed |= ImPass->doInitialization(M);
543 M.getContext().yield();
547 Changed |= ImPass->doFinalization(M);
550 M.convertFromNewDbgValues();
571 if (
P->getResolver())
572 PDepth =
P->getResolver()->getPMDataManager().getDepth();
574 for (
Pass *AP : AnalysisPasses) {
576 auto &LastUserOfAP = LastUser[AP];
578 InversedLastUser[LastUserOfAP].erase(AP);
580 InversedLastUser[
P].insert(AP);
592 assert(AnalysisPass &&
"Expected analysis pass to exist.");
594 assert(AR &&
"Expected analysis resolver to exist.");
597 if (PDepth == APDepth)
599 else if (PDepth > APDepth)
607 if (
P->getResolver())
608 setLastUser(LastPMUses,
P->getResolver()->getPMDataManager().getAsPass());
612 auto &LastUsedByAP = InversedLastUser[AP];
613 for (
Pass *L : LastUsedByAP)
615 InversedLastUser[
P].insert(LastUsedByAP.begin(), LastUsedByAP.end());
616 LastUsedByAP.clear();
623 auto DMI = InversedLastUser.find(
P);
624 if (DMI == InversedLastUser.end())
627 auto &LU = DMI->second;
628 LastUses.
append(LU.begin(), LU.end());
633 auto DMI = AnUsageMap.find(
P);
634 if (DMI != AnUsageMap.end())
635 AnUsage = DMI->second;
644 P->getAnalysisUsage(AU);
646 AUFoldingSetNode* Node =
nullptr;
648 AUFoldingSetNode::Profile(
ID, AU);
653 Node =
new (AUFoldingSetNodeAllocator.
Allocate()) AUFoldingSetNode(AU);
656 assert(Node &&
"cached analysis usage must be non null");
658 AnUsageMap[
P] = &Node->AU;
688 bool checkAnalysis =
true;
689 while (checkAnalysis) {
690 checkAnalysis =
false;
701 dbgs() <<
"Pass '" <<
P->getPassName() <<
"' is not initialized." <<
"\n";
702 dbgs() <<
"Verify if there is a pass dependency cycle." <<
"\n";
703 dbgs() <<
"Required Passes:" <<
"\n";
711 dbgs() <<
"\t" <<
"Error: Required pass not found! Possible causes:" <<
"\n";
712 dbgs() <<
"\t\t" <<
"- Pass misconfiguration (e.g.: missing macros)" <<
"\n";
713 dbgs() <<
"\t\t" <<
"- Corruption of the global PassRegistry" <<
"\n";
718 assert(PI &&
"Expected required passes to be initialized");
720 if (
P->getPotentialPassManagerType () ==
724 else if (
P->getPotentialPassManagerType () >
730 checkAnalysis =
true;
746 DM->initializeAnalysisImpl(
P);
748 DM->recordAvailableAnalysis(IP);
754 P->createPrinterPass(
dbgs(), (
"*** IR Dump Before " +
P->getPassName() +
761 P->assignPassManager(
activeStack, getTopLevelPassManagerType());
765 P->createPrinterPass(
dbgs(), (
"*** IR Dump After " +
P->getPassName() +
778 if (
Pass *
P = ImmutablePassMap.lookup(AID))
787 for (
PMDataManager *IndirectPassManager : IndirectPassManagers)
788 if (
Pass *
P = IndirectPassManager->findAnalysisPass(AID,
false))
795 const PassInfo *&PI = AnalysisPassInfos[AID];
800 "The pass info pointer changed for an analysis ID!");
807 ImmutablePasses.push_back(
P);
813 ImmutablePassMap[AID] =
P;
818 assert(PassInf &&
"Expected all immutable passes to be initialized");
820 ImmutablePassMap[ImmPI->getTypeInfo()] =
P;
830 for (
unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i) {
831 ImmutablePasses[i]->dumpPassStructure(0);
839 Manager->getAsPass()->dumpPassStructure(1);
847 dbgs() <<
"Pass Arguments: ";
850 assert(PI &&
"Expected all immutable passes to be initialized");
851 if (!PI->isAnalysisGroup())
852 dbgs() <<
" -" << PI->getPassArgument();
855 PM->dumpPassArguments();
861 PM->initializeAnalysisInfo();
865 IPM->initializeAnalysisInfo();
884 AvailableAnalysis[PI] =
P;
886 assert(!AvailableAnalysis.empty());
893 AvailableAnalysis[PI->getTypeInfo()] =
P;
904 for (
Pass *P1 : HigherLevelAnalysis) {
905 if (P1->getAsImmutablePass() ==
nullptr &&
926 AP->verifyAnalysis();
939 E = AvailableAnalysis.end();
I !=
E; ) {
941 if (
Info->second->getAsImmutablePass() ==
nullptr &&
946 dbgs() <<
" -- '" <<
P->getPassName() <<
"' is not preserving '";
949 AvailableAnalysis.erase(
Info);
963 if (
Info->second->getAsImmutablePass() ==
nullptr &&
968 dbgs() <<
" -- '" <<
P->getPassName() <<
"' is not preserving '";
990 dbgs() <<
" -*- '" <<
P->getPassName();
991 dbgs() <<
"' is the last user of following pass instances.";
992 dbgs() <<
" Free these instances\n";
995 for (
Pass *
P : DeadPasses)
1014 AvailableAnalysis.erase(PI);
1020 AvailableAnalysis.find(PI->getTypeInfo());
1021 if (Pos != AvailableAnalysis.end() && Pos->second ==
P)
1022 AvailableAnalysis.erase(Pos);
1039 if (!ProcessAnalysis) {
1050 unsigned PDepth = this->
getDepth();
1053 for (
Pass *PUsed : UsedPasses) {
1054 unsigned RDepth = 0;
1056 assert(PUsed->getResolver() &&
"Analysis Resolver is not set");
1058 RDepth =
DM.getDepth();
1060 if (PDepth == RDepth)
1062 else if (PDepth > RDepth) {
1066 HigherLevelAnalysis.push_back(PUsed);
1074 if (!
P->getAsPMDataManager())
1078 if (!TransferLastUses.
empty()) {
1081 TransferLastUses.
clear();
1109 for (
const auto &UsedID : AnUsage->
getUsedSet())
1135 assert(AR &&
"Analysis Resolver is not set");
1147 if (
I != AvailableAnalysis.end())
1170 for (
Pass *
P : LUses) {
1171 dbgs() <<
"--" << std::string(
Offset*2,
' ');
1172 P->dumpPassStructure(0);
1179 PMD->dumpPassArguments();
1183 if (!PI->isAnalysisGroup())
1184 dbgs() <<
" -" << PI->getPassArgument();
1193 dbgs() <<
"[" << std::chrono::system_clock::now() <<
"] " << (
void *)
this
1194 << std::string(
getDepth() * 2 + 1,
' ');
1197 dbgs() <<
"Executing Pass '" <<
P->getPassName();
1200 dbgs() <<
"Made Modification '" <<
P->getPassName();
1203 dbgs() <<
" Freeing Pass '" <<
P->getPassName();
1210 dbgs() <<
"' on Function '" << Msg <<
"'...\n";
1213 dbgs() <<
"' on Module '" << Msg <<
"'...\n";
1216 dbgs() <<
"' on Region '" << Msg <<
"'...\n";
1219 dbgs() <<
"' on Loop '" << Msg <<
"'...\n";
1222 dbgs() <<
"' on Call Graph Nodes '" << Msg <<
"'...\n";
1234 P->getAnalysisUsage(analysisUsage);
1243 P->getAnalysisUsage(analysisUsage);
1252 P->getAnalysisUsage(analysisUsage);
1253 dumpAnalysisUsage(
"Used",
P, analysisUsage.
getUsedSet());
1256void PMDataManager::dumpAnalysisUsage(
StringRef Msg,
const Pass *
P,
1261 dbgs() << (
const void*)
P << std::string(
getDepth()*2+3,
' ') << Msg <<
" Analyses:";
1262 for (
unsigned i = 0; i != Set.
size(); ++i) {
1263 if (i)
dbgs() <<
',';
1268 dbgs() <<
" Uninitialized Pass";
1297 dbgs() <<
"' required by '" <<
P->getPassName() <<
"'\n";
1320std::tuple<Pass *, bool>
1332FunctionPassManager::FunctionPassManager(
Module *m) : M(m) {
1341FunctionPassManager::~FunctionPassManager() {
1355 report_fatal_error(Twine(
"Error reading bitcode file: ") + EIB.message());
1363bool FunctionPassManager::doInitialization() {
1369bool FunctionPassManager::doFinalization() {
1380 assert(AR &&
"Analysis Resolver is not set");
1404 if (
F.isDeclaration())
1407 bool Changed =
false;
1414 bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
1418 FunctionSize =
F.getInstructionCount();
1427 bool LocalChanged =
false;
1432 "RunPass", [
FP]() {
return std::string(
FP->getPassName()); });
1442#ifdef EXPENSIVE_CHECKS
1445 LocalChanged |=
FP->runOnFunction(
F);
1447#if defined(EXPENSIVE_CHECKS) && !defined(NDEBUG)
1448 if (!LocalChanged && (RefHash !=
FP->structuralHash(
F))) {
1449 llvm::errs() <<
"Pass modifies its input and doesn't report it: "
1450 <<
FP->getPassName() <<
"\n";
1456 unsigned NewSize =
F.getInstructionCount();
1460 if (NewSize != FunctionSize) {
1461 int64_t Delta =
static_cast<int64_t
>(NewSize) -
1462 static_cast<int64_t
>(FunctionSize);
1464 FunctionToInstrCount, &
F);
1466 FunctionSize = NewSize;
1471 Changed |= LocalChanged;
1488 bool Changed =
false;
1497 bool Changed =
false;
1506 bool Changed =
false;
1521MPPassManager::runOnModule(
Module &M) {
1524 bool Changed =
false;
1527 for (
auto &OnTheFlyManager : OnTheFlyManagers) {
1534 Changed |= getContainedPass(
Index)->doInitialization(M);
1538 bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
1541 InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
1545 bool LocalChanged =
false;
1548 dumpRequiredSet(MP);
1550 initializeAnalysisImpl(MP);
1556#ifdef EXPENSIVE_CHECKS
1557 uint64_t RefHash = MP->structuralHash(M);
1562#ifdef EXPENSIVE_CHECKS
1563 assert((LocalChanged || (RefHash == MP->structuralHash(M))) &&
1564 "Pass modifies its input and doesn't report it.");
1569 unsigned ModuleCount = M.getInstructionCount();
1571 int64_t Delta =
static_cast<int64_t
>(ModuleCount) -
1573 emitInstrCountChangedRemark(MP, M, Delta,
InstrCount,
1574 FunctionToInstrCount);
1580 Changed |= LocalChanged;
1583 M.getModuleIdentifier());
1584 dumpPreservedSet(MP);
1587 verifyPreservedAnalysis(MP);
1589 removeNotPreservedAnalysis(MP);
1590 recordAvailableAnalysis(MP);
1596 Changed |= getContainedPass(
Index)->doFinalization(M);
1599 for (
auto &OnTheFlyManager : OnTheFlyManagers) {
1613void MPPassManager::addLowerLevelRequiredPass(
Pass *
P,
Pass *RequiredPass) {
1614 assert(RequiredPass &&
"No required pass?");
1616 "Unable to handle Pass that requires lower level Analysis pass");
1617 assert((
P->getPotentialPassManagerType() <
1619 "Unable to handle Pass that requires lower level Analysis pass");
1627 OnTheFlyManagers[
P] = FPP;
1630 TPM->findAnalysisPassInfo(RequiredPass->
getPassID());
1632 Pass *FoundPass =
nullptr;
1633 if (RequiredPassPI && RequiredPassPI->
isAnalysis()) {
1638 FoundPass = RequiredPass;
1641 FPP->
add(RequiredPass);
1652std::tuple<Pass *, bool> MPPassManager::getOnTheFlyPass(
Pass *MP,
AnalysisID PI,
1655 assert(FPP &&
"Unable to find on the fly pass");
1658 bool Changed = FPP->
run(
F);
1707 assert(PM &&
"Unable to push. Pass Manager expected");
1710 if (!this->
empty()) {
1712 &&
"pushing bad pass manager to PMStack");
1715 assert(TPM &&
"Unable to find top level manager");
1722 &&
"pushing bad pass manager to PMStack");
1732 dbgs() << Manager->getAsPass()->getPassName() <<
' ';
AMDGPU Lower Kernel Arguments
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Analysis containing CSE Info
#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")
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
This file contains an interface for creating legacy passes to print out IR in various granularities.
cl::opt< bool > UseNewDbgInfoFormat
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")))
This file implements a map that provides insertion order iteration.
Module.h This file contains the declarations for the Module class.
llvm::cl::opt< bool > UseNewDbgInfoFormat
This header defines classes/functions to handle pass execution timing information with interfaces for...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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).
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
const VectorType & getUsedSet() const
bool getPreservesAll() const
Determine whether a pass said it does not transform its input at all.
const VectorType & getPreservedSet() const
ArrayRef - 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.
void InsertNode(T *N, void *InsertPos)
InsertNode - Insert the specified node into the folding set, knowing that it is not already in the fo...
T * FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos)
FindNodeOrInsertPos - Look up the node specified by ID.
FoldingSetNodeID - 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.
This class implements a map that also provides access to all stored values in a deterministic order.
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.
const std::string & getModuleIdentifier() const
Get the module identifier which is, essentially, the name of the 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! Here we fill in the AnalysisImpls m...
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
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,...
const std::vector< const PassInfo * > & getInterfacesImplemented() const
getInterfacesImplemented - Return a list of all of the analysis group interfaces implemented by this ...
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)
Run all of the passes in this manager over the given unit of IR.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
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.
void setResolver(AnalysisResolver *AR)
virtual PMDataManager * getAsPMDataManager()
AnalysisID getPassID() const
getPassID - Return the PassID number that corresponds to this pass.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
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 Pass * createPrinterPass(raw_ostream &OS, const std::string &Banner) const =0
createPrinterPass - Get a Pass appropriate to print the IR this pass operates on (Module,...
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...
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.
T * Allocate(size_t num=1)
Allocate space for an array of objects without constructing them.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - 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...
void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
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 ...
bool debugPassSpecified()
This is an optimization pass for GlobalISel generic memory operations.
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.
Timer * getPassTimer(Pass *)
Request the timer for this legacy-pass-manager's pass instance.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool shouldConvertDbgInfo(IRUnitT &IR)
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
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.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
bool shouldPrintBeforePass(StringRef PassID)
bool shouldPrintAfterPass(StringRef PassID)
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.
The TimeTraceScope is a helper class to call the begin and end functions of the time trace profiler.