Go to the documentation of this file.
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();
106 auto It = FunctionToInstrCount.find(MaybeChangedFn.getName());
110 if (It == FunctionToInstrCount.end()) {
111 FunctionToInstrCount[MaybeChangedFn.getName()] =
112 std::pair<unsigned, unsigned>(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)
202 FunctionToInstrCount.keys().end(),
203 EmitFunctionSizeChangedRemark);
205 EmitFunctionSizeChangedRemark(
F->getName().str());
210 OS <<
"Releasing pass '";
212 OS <<
"Running pass '";
226 if (isa<Function>(V))
228 else if (isa<BasicBlock>(V))
249 virtual void anchor();
265 const std::string &Banner)
const override {
294 Info.setPreservesAll();
309 void FunctionPassManagerImpl::anchor() {}
317 bool Changed =
false;
323 Changed |= ImPass->doInitialization(
M);
332 bool Changed =
false;
338 Changed |= ImPass->doFinalization(
M);
358 bool Changed =
false;
363 F.getContext().yield();
388 ~MPPassManager()
override {
389 for (
auto &OnTheFlyManager : OnTheFlyManagers) {
397 const std::string &Banner)
const override {
410 Info.setPreservesAll();
436 OnTheFlyManagers.find(MP);
437 if (
I != OnTheFlyManagers.end())
438 I->second->dumpPassStructure(
Offset + 2);
444 assert(
N < PassVector.size() &&
"Pass number out of range!");
471 virtual void anchor();
485 const std::string &Banner)
const override {
498 Info.setPreservesAll();
509 MPPassManager *MP =
static_cast<MPPassManager *
>(
PassManagers[
N]);
514 void PassManagerImpl::anchor() {}
525 bool Changed =
false;
531 Changed |= ImPass->doInitialization(
M);
536 M.getContext().yield();
540 Changed |= ImPass->doFinalization(
M);
561 if (
P->getResolver())
562 PDepth =
P->getResolver()->getPMDataManager().getDepth();
564 for (
Pass *AP : AnalysisPasses) {
566 auto &LastUserOfAP = LastUser[AP];
568 InversedLastUser[LastUserOfAP].erase(AP);
570 InversedLastUser[
P].insert(AP);
582 assert(AnalysisPass &&
"Expected analysis pass to exist.");
584 assert(AR &&
"Expected analysis resolver to exist.");
587 if (PDepth == APDepth)
588 LastUses.push_back(AnalysisPass);
589 else if (PDepth > APDepth)
590 LastPMUses.push_back(AnalysisPass);
597 if (
P->getResolver())
598 setLastUser(LastPMUses,
P->getResolver()->getPMDataManager().getAsPass());
602 auto &LastUsedByAP = InversedLastUser[AP];
603 for (
Pass *L : LastUsedByAP)
605 InversedLastUser[
P].insert(LastUsedByAP.begin(), LastUsedByAP.end());
606 LastUsedByAP.clear();
613 auto DMI = InversedLastUser.find(
P);
614 if (DMI == InversedLastUser.end())
617 auto &LU = DMI->second;
618 LastUses.
append(LU.begin(), LU.end());
623 auto DMI = AnUsageMap.find(
P);
624 if (DMI != AnUsageMap.end())
625 AnUsage = DMI->second;
634 P->getAnalysisUsage(AU);
636 AUFoldingSetNode* Node =
nullptr;
643 Node =
new (AUFoldingSetNodeAllocator.
Allocate()) AUFoldingSetNode(AU);
646 assert(Node &&
"cached analysis usage must be non null");
648 AnUsageMap[
P] = &Node->AU;
678 bool checkAnalysis =
true;
679 while (checkAnalysis) {
680 checkAnalysis =
false;
691 dbgs() <<
"Pass '" <<
P->getPassName() <<
"' is not initialized." <<
"\n";
692 dbgs() <<
"Verify if there is a pass dependency cycle." <<
"\n";
693 dbgs() <<
"Required Passes:" <<
"\n";
701 dbgs() <<
"\t" <<
"Error: Required pass not found! Possible causes:" <<
"\n";
702 dbgs() <<
"\t\t" <<
"- Pass misconfiguration (e.g.: missing macros)" <<
"\n";
703 dbgs() <<
"\t\t" <<
"- Corruption of the global PassRegistry" <<
"\n";
708 assert(PI &&
"Expected required passes to be initialized");
710 if (
P->getPotentialPassManagerType () ==
714 else if (
P->getPotentialPassManagerType () >
720 checkAnalysis =
true;
736 DM->initializeAnalysisImpl(
P);
738 DM->recordAvailableAnalysis(
IP);
744 P->createPrinterPass(
dbgs(), (
"*** IR Dump Before " +
P->getPassName() +
751 P->assignPassManager(
activeStack, getTopLevelPassManagerType());
755 P->createPrinterPass(
dbgs(), (
"*** IR Dump After " +
P->getPassName() +
768 if (
Pass *
P = ImmutablePassMap.lookup(AID))
777 for (
PMDataManager *IndirectPassManager : IndirectPassManagers)
778 if (
Pass *
P = IndirectPassManager->findAnalysisPass(AID,
false))
785 const PassInfo *&PI = AnalysisPassInfos[AID];
790 "The pass info pointer changed for an analysis ID!");
797 ImmutablePasses.push_back(
P);
803 ImmutablePassMap[AID] =
P;
808 assert(PassInf &&
"Expected all immutable passes to be initialized");
810 ImmutablePassMap[ImmPI->getTypeInfo()] =
P;
820 for (
unsigned i = 0,
e = ImmutablePasses.size();
i !=
e; ++
i) {
821 ImmutablePasses[
i]->dumpPassStructure(0);
829 Manager->getAsPass()->dumpPassStructure(1);
837 dbgs() <<
"Pass Arguments: ";
840 assert(PI &&
"Expected all immutable passes to be initialized");
841 if (!PI->isAnalysisGroup())
842 dbgs() <<
" -" << PI->getPassArgument();
845 PM->dumpPassArguments();
851 PM->initializeAnalysisInfo();
855 IPM->initializeAnalysisInfo();
874 AvailableAnalysis[PI] =
P;
876 assert(!AvailableAnalysis.empty());
883 AvailableAnalysis[PI->getTypeInfo()] =
P;
894 for (
Pass *P1 : HigherLevelAnalysis) {
895 if (P1->getAsImmutablePass() ==
nullptr &&
916 AP->verifyAnalysis();
929 E = AvailableAnalysis.end();
I !=
E; ) {
931 if (
Info->second->getAsImmutablePass() ==
nullptr &&
936 dbgs() <<
" -- '" <<
P->getPassName() <<
"' is not preserving '";
937 dbgs() <<
S->getPassName() <<
"'\n";
939 AvailableAnalysis.erase(
Info);
953 if (
Info->second->getAsImmutablePass() ==
nullptr &&
958 dbgs() <<
" -- '" <<
P->getPassName() <<
"' is not preserving '";
959 dbgs() <<
S->getPassName() <<
"'\n";
980 dbgs() <<
" -*- '" <<
P->getPassName();
981 dbgs() <<
"' is the last user of following pass instances.";
982 dbgs() <<
" Free these instances\n";
985 for (
Pass *
P : DeadPasses)
1004 AvailableAnalysis.erase(PI);
1010 AvailableAnalysis.find(PI->getTypeInfo());
1011 if (Pos != AvailableAnalysis.end() && Pos->second ==
P)
1012 AvailableAnalysis.erase(Pos);
1029 if (!ProcessAnalysis) {
1040 unsigned PDepth = this->
getDepth();
1043 for (
Pass *PUsed : UsedPasses) {
1044 unsigned RDepth = 0;
1046 assert(PUsed->getResolver() &&
"Analysis Resolver is not set");
1048 RDepth =
DM.getDepth();
1050 if (PDepth == RDepth)
1051 LastUses.push_back(PUsed);
1052 else if (PDepth > RDepth) {
1054 TransferLastUses.push_back(PUsed);
1056 HigherLevelAnalysis.push_back(PUsed);
1064 if (!
P->getAsPMDataManager())
1065 LastUses.push_back(
P);
1068 if (!TransferLastUses.empty()) {
1071 TransferLastUses.
clear();
1099 for (
const auto &UsedID : AnUsage->
getUsedSet())
1101 UP.push_back(AnalysisPass);
1105 UP.push_back(AnalysisPass);
1107 RP_NotAvail.push_back(RequiredID);
1125 assert(AR &&
"Analysis Resolver is not set");
1137 if (
I != AvailableAnalysis.end())
1160 for (
Pass *
P : LUses) {
1161 dbgs() <<
"--" << std::string(Offset*2,
' ');
1162 P->dumpPassStructure(0);
1169 PMD->dumpPassArguments();
1173 if (!PI->isAnalysisGroup())
1174 dbgs() <<
" -" << PI->getPassArgument();
1184 << std::string(
getDepth() * 2 + 1,
' ');
1187 dbgs() <<
"Executing Pass '" <<
P->getPassName();
1190 dbgs() <<
"Made Modification '" <<
P->getPassName();
1193 dbgs() <<
" Freeing Pass '" <<
P->getPassName();
1200 dbgs() <<
"' on Function '" <<
Msg <<
"'...\n";
1203 dbgs() <<
"' on Module '" <<
Msg <<
"'...\n";
1206 dbgs() <<
"' on Region '" <<
Msg <<
"'...\n";
1209 dbgs() <<
"' on Loop '" <<
Msg <<
"'...\n";
1212 dbgs() <<
"' on Call Graph Nodes '" <<
Msg <<
"'...\n";
1224 P->getAnalysisUsage(analysisUsage);
1233 P->getAnalysisUsage(analysisUsage);
1242 P->getAnalysisUsage(analysisUsage);
1243 dumpAnalysisUsage(
"Used",
P, analysisUsage.
getUsedSet());
1251 dbgs() << (
const void*)
P << std::string(
getDepth()*2+3,
' ') <<
Msg <<
" Analyses:";
1252 for (
unsigned i = 0;
i != Set.size(); ++
i) {
1253 if (
i)
dbgs() <<
',';
1258 dbgs() <<
" Uninitialized Pass";
1287 dbgs() <<
"' required by '" <<
P->getPassName() <<
"'\n";
1310 std::tuple<Pass *, bool>
1345 report_fatal_error(Twine(
"Error reading bitcode file: ") + EIB.message());
1370 assert(AR &&
"Analysis Resolver is not set");
1382 dbgs().
indent(Offset*2) <<
"FunctionPass Manager\n";
1385 FP->dumpPassStructure(Offset + 1);
1394 if (
F.isDeclaration())
1397 bool Changed =
false;
1404 bool EmitICRemark =
M.shouldEmitInstrCountChangedRemark();
1408 FunctionSize =
F.getInstructionCount();
1415 bool LocalChanged =
false;
1427 #ifdef EXPENSIVE_CHECKS
1430 LocalChanged |=
FP->runOnFunction(
F);
1432 #if defined(EXPENSIVE_CHECKS) && !defined(NDEBUG)
1433 if (!LocalChanged && (RefHash !=
FP->structuralHash(
F))) {
1434 llvm::errs() <<
"Pass modifies its input and doesn't report it: "
1435 <<
FP->getPassName() <<
"\n";
1441 unsigned NewSize =
F.getInstructionCount();
1445 if (NewSize != FunctionSize) {
1446 int64_t Delta =
static_cast<int64_t
>(NewSize) -
1447 static_cast<int64_t
>(FunctionSize);
1449 FunctionToInstrCount, &
F);
1451 FunctionSize = NewSize;
1456 Changed |= LocalChanged;
1473 bool Changed =
false;
1482 bool Changed =
false;
1491 bool Changed =
false;
1506 MPPassManager::runOnModule(
Module &M) {
1509 bool Changed =
false;
1512 for (
auto &OnTheFlyManager : OnTheFlyManagers) {
1519 Changed |= getContainedPass(
Index)->doInitialization(M);
1523 bool EmitICRemark =
M.shouldEmitInstrCountChangedRemark();
1526 InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
1530 bool LocalChanged =
false;
1533 dumpRequiredSet(MP);
1535 initializeAnalysisImpl(MP);
1541 #ifdef EXPENSIVE_CHECKS
1542 uint64_t RefHash = MP->structuralHash(M);
1547 #ifdef EXPENSIVE_CHECKS
1548 assert((LocalChanged || (RefHash == MP->structuralHash(M))) &&
1549 "Pass modifies its input and doesn't report it.");
1554 unsigned ModuleCount =
M.getInstructionCount();
1556 int64_t Delta =
static_cast<int64_t
>(ModuleCount) -
1558 emitInstrCountChangedRemark(MP, M, Delta,
InstrCount,
1559 FunctionToInstrCount);
1565 Changed |= LocalChanged;
1568 M.getModuleIdentifier());
1569 dumpPreservedSet(MP);
1572 verifyPreservedAnalysis(MP);
1574 removeNotPreservedAnalysis(MP);
1575 recordAvailableAnalysis(MP);
1581 Changed |= getContainedPass(
Index)->doFinalization(M);
1584 for (
auto &OnTheFlyManager : OnTheFlyManagers) {
1598 void MPPassManager::addLowerLevelRequiredPass(
Pass *
P,
Pass *RequiredPass) {
1599 assert(RequiredPass &&
"No required pass?");
1601 "Unable to handle Pass that requires lower level Analysis pass");
1602 assert((
P->getPotentialPassManagerType() <
1604 "Unable to handle Pass that requires lower level Analysis pass");
1612 OnTheFlyManagers[
P] = FPP;
1615 TPM->findAnalysisPassInfo(RequiredPass->
getPassID());
1617 Pass *FoundPass =
nullptr;
1618 if (RequiredPassPI && RequiredPassPI->
isAnalysis()) {
1623 FoundPass = RequiredPass;
1626 FPP->
add(RequiredPass);
1630 LU.push_back(FoundPass);
1637 std::tuple<Pass *, bool> MPPassManager::getOnTheFlyPass(
Pass *MP,
AnalysisID PI,
1640 assert(FPP &&
"Unable to find on the fly pass");
1643 bool Changed = FPP->
run(
F);
1682 void PMStack::pop() {
1692 assert(PM &&
"Unable to push. Pass Manager expected");
1695 if (!this->
empty()) {
1697 &&
"pushing bad pass manager to PMStack");
1700 assert(TPM &&
"Unable to find top level manager");
1707 &&
"pushing bad pass manager to PMStack");
1717 dbgs() << Manager->getAsPass()->getPassName() <<
' ';
void addImmutablePass(ImmutablePass *P)
Add immutable pass and initialize it.
void recordAvailableAnalysis(Pass *P)
Augment AvailableAnalysis by adding analysis made available by pass P.
void assignPassManager(PMStack &PMS, PassManagerType T) override
Find appropriate Module Pass Manager in the PM Stack and add self into that manager.
const VectorType & getRequiredTransitiveSet() const
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This is an optimization pass for GlobalISel generic memory operations.
virtual void assignPassManager(PMStack &, PassManagerType)
Each pass is responsible for assigning a pass manager to itself.
bool runOnFunction(Function &F)
run - Execute all of the passes scheduled for execution.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
void getAnalysisUsage(AnalysisUsage &Info) const override
Pass Manager itself does not invalidate any analysis info.
The TimeTraceScope is a helper class to call the begin and end functions of the time trace profiler.
Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const override
createPrinterPass - Get a module printer pass.
void releaseMemoryOnTheFly()
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
void print(raw_ostream &OS) const override
print - Emit information about this stack frame to OS.
AnalysisUsage * findAnalysisUsage(Pass *P)
Find analysis usage information for the pass P.
ImmutablePass class - This class is used to provide information that does not need to be run.
SmallVector< PMDataManager *, 8 > PassManagers
Collection of pass managers.
AnalysisID getPassID() const
getPassID - Return the PassID number that corresponds to this pass.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
void schedulePass(Pass *P)
Schedule pass P for execution.
static RegisterPass< DebugifyModulePass > DM("debugify", "Attach debug info to everything")
void InsertNode(T *N, void *InsertPos)
InsertNode - Insert the specified node into the folding set, knowing that it is not already in the fo...
MPPassManager * getContainedManager(unsigned N)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
void dumpPassInfo(Pass *P, enum PassDebuggingString S1, enum PassDebuggingString S2, StringRef Msg)
FunctionPassManager(Module *M)
FunctionPassManager ctor - This initializes the pass manager.
static void cleanup(BlockFrequencyInfoImplBase &BFI)
Clear all memory not needed downstream.
unsigned getNumContainedManagers() const
PassManagerType
Different types of internal pass managers.
static unsigned InstrCount
T * FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos)
FindNodeOrInsertPos - Look up the node specified by ID.
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")))
PassInfo class - An instance of this class exists for every pass known by the system,...
const PassInfo * findAnalysisPassInfo(AnalysisID AID) const
Retrieve the PassInfo for an analysis.
This class implements a map that also provides access to all stored values in a deterministic order.
PMDataManager * getAsPMDataManager() override
static const PassInfo * getPassInfo(StringRef PassName)
void push(PMDataManager *PM)
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
FunctionPassManagerImpl manages FPPassManagers.
PassManagerPrettyStackEntry - This is used to print informative information about what pass is runnin...
Pass * createPass() const
createPass() - Use this method to create an instance of this pass.
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.
#define clEnumVal(ENUMVAL, DESC)
bool doInitialization(Module &M) override
doInitialization - Run all of the initializers for the function passes.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM ID Predecessors according to mbb< bb27, 0x8b0a7c0 > Note ADDri is not a two address instruction its result reg1037 is an operand of the PHI node in bb76 and its operand reg1039 is the result of the PHI node We should treat it as a two address code and make sure the ADDri is scheduled after any node that reads reg1039 Use info(i.e. register scavenger) to assign it a free register to allow reuse the collector could move the objects and invalidate the derived pointer This is bad enough in the first but safe points can crop up unpredictably **array_addr i32 n y store obj * new
LLVM Basic Block Representation.
FunctionPassManagerImpl()
@ PMT_ModulePassManager
MPPassManager.
bool doFinalization(Module &M) override
doFinalization - Run all of the finalizers for the function passes.
Pass * getAsPass() override
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
typename VectorType::const_iterator const_iterator
PMDataManager provides the common place to manage the analysis data used by pass managers.
PassManager()
Create new pass manager.
void dumpLastUses(Pass *P, unsigned Offset) const
Pass * getAsPass() override
bool getPreservesAll() const
Determine whether a pass said it does not transform its input at all.
unsigned getNumContainedPasses() const
The TimeRegion class is used as a helper class to call the startTimer() and stopTimer() methods of th...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
bool doFinalization()
doFinalization - Run all of the finalizers for the function passes.
StringRef getPassName() const
getPassName - Return the friendly name for the pass, never returns null
const std::vector< const PassInfo * > & getInterfacesImplemented() const
getInterfacesImplemented - Return a list of all of the analysis group interfaces implemented by this ...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
bool debugPassSpecified()
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...
SmallVectorImpl< ImmutablePass * > & getImmutablePasses()
void collectLastUses(SmallVectorImpl< Pass * > &LastUses, Pass *P)
Collect passes whose last user is P.
const VectorType & getUsedSet() const
void dumpPreservedSet(const Pass *P) const
Represent the analysis usage information of a pass.
Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const override
createPrinterPass - Get a function printer pass.
AnalysisResolver - Simple interface used by Pass objects to pull all analysis information out of pass...
void initializeAnalysisImpl(Pass *P)
All Required analyses should be available to the pass as it runs! Here we fill in the AnalysisImpls m...
PassManagerType getTopLevelPassManagerType() override
void setDepth(unsigned newDepth)
void add(Pass *P)
Add a pass to the queue of passes to run.
This class implements an extremely fast bulk output stream that can only output to a stream.
void cleanup()
cleanup - After running all passes, clean up pass manager cache.
void dumpArguments() const
void dumpPassArguments() const
Analysis containing CSE Info
FunctionPass * getContainedPass(unsigned N)
Pass * getAnalysisIfAvailable(AnalysisID ID) const
Return analysis result or null if it doesn't exist.
PMDataManager * top() const
static sys::TimePoint< std::chrono::seconds > now(bool Deterministic)
Base class for error info classes.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
bool doFinalization(Module &M) override
doFinalization - Run all of the finalizers for the function passes.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
virtual ~PassManagerBase()
const VectorType & getRequiredSet() const
Used in the streaming interface as the general argument type.
void initializeAnalysisInfo()
Initialize available analysis information.
void clearAnalysisImpls()
Clear cache that is used to connect a pass to the analysis (PassInfo).
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
PMTopLevelManager * getTopLevelManager()
UnaryFunction for_each(R &&Range, UnaryFunction F)
Provide wrappers to std::for_each which take ranges instead of having to pass begin/end explicitly.
StringRef getPassArgument() const
getPassArgument - Return the command line option that may be passed to 'opt' that will cause this pas...
AnalysisResolver * getResolver() const
Timer * getPassTimer(Pass *)
Request the timer for this legacy-pass-manager's pass instance.
void addPassManager(PMDataManager *Manager)
void removeDeadPasses(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove dead passes used by P.
bool run(Module &M)
run - Execute all of the passes scheduled for execution.
bool doInitialization()
doInitialization - Run all of the initializers for the function passes.
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
bool preserveHigherLevelAnalysis(Pass *P)
Pass * findImplPass(AnalysisID PI)
Find pass that is implementing PI.
DenseMap< AnalysisID, Pass * > * InheritedAnalysis[PMT_Last]
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void dumpRequiredSet(const Pass *P) const
bool run(Function &F)
run - Execute all of the passes scheduled for execution.
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
const std::string & getModuleIdentifier() const
Get the module identifier which is, essentially, the name of the module.
A Module instance is used to store all the information related to an LLVM module.
void add(Pass *P) override
Add a pass to the queue of passes to run.
void dumpPassStructure(unsigned Offset) override
Print passes managed by this manager.
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.
void setTopLevelManager(PMTopLevelManager *T)
void dumpUsedSet(const Pass *P) const
virtual bool doFinalization(Module &)
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
virtual void releaseMemory()
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
virtual bool doInitialization(Module &)
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
StringRef - Represent a constant reference to a string, i.e.
Analysis the ScalarEvolution expression for r is this
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
@ PMT_FunctionPassManager
FPPassManager.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void getAnalysisUsage(AnalysisUsage &Info) const override
Pass Manager itself does not invalidate any analysis info.
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
virtual PassManagerType getPassManagerType() const
virtual PMDataManager * getAsPMDataManager()
T * Allocate(size_t num=1)
Allocate space for an array of objects without constructing them.
bool doInitialization(Module &M) override
doInitialization - Run all of the initializers for the function passes.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
const CustomOperand< const MCSubtargetInfo & > Msg[]
void verifyPreservedAnalysis(Pass *P)
verifyPreservedAnalysis – Verify analysis presreved by pass P.
Manages a sequence of passes over a particular unit of IR.
void removeNotPreservedAnalysis(Pass *P)
Remove Analysis that is not preserved by the pass.
FPPassManager manages BBPassManagers and FunctionPasses.
virtual Pass * getAsPass()=0
virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass)
Add RequiredPass into list of lower level passes required by pass P.
PMStack - This class implements a stack data structure of PMDataManager pointers.
virtual void dumpPassStructure(unsigned Offset=0)
bool run(Function &F)
run - Execute all of the passes scheduled for execution.
void add(Pass *P, bool ProcessAnalysis=true)
Add pass P into the PassVector.
virtual std::tuple< Pass *, bool > getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F)
void addAnalysisImplsPair(AnalysisID PI, Pass *P)
SmallVector< Pass *, 16 > PassVector
AMDGPU Lower Kernel Arguments
bool shouldPrintAfterPass(StringRef PassID)
PMDataManager * getAsPMDataManager() override
void initializeAllAnalysisInfo()
void add(Pass *P) override
Add a pass to the queue of passes to run.
bool shouldPrintBeforePass(StringRef PassID)
void addIndirectPassManager(PMDataManager *Manager)
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
unsigned getDepth() const
void setResolver(AnalysisResolver *AR)
~FunctionPassManager() override
virtual PassManagerType getPotentialPassManagerType() const
Return what kind of Pass Manager can manage this pass.
void setLastUser(ArrayRef< Pass * > AnalysisPasses, Pass *P)
Set pass P as the last user of the given analysis passes.
FPPassManager * getContainedManager(unsigned N)
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.
Pass interface - Implemented by all 'passes'.
void freePass(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove P.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
PMDataManager & getPMDataManager()
PassManagerImpl manages MPPassManagers.
const VectorType & getPreservedSet() const
virtual ~PMTopLevelManager()
Destructor.
PMTopLevelManager manages LastUser info and collects common APIs used by top level pass managers.
bool run(Module &M)
run - Execute all of the passes scheduled for execution.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
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,...
FunctionPass class - This class is used to implement most global optimizations.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
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.
Pass * findAnalysisPass(AnalysisID AID)
Find the pass that implements Analysis AID.
PassManagerType getTopLevelPassManagerType() override
const PassInfo * getPassInfo(const void *TI) const
getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass' type identifier (&MyPass::...
bool isPassDebuggingExecutionsOrMore() const
isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified.
void populateInheritedAnalysis(PMStack &PMS)
void add(Pass *P)
Add a pass to the queue of passes to run.
void handleAllErrors(Error E, HandlerTs &&... Handlers)
Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...
static const char PassName[]
void dumpPassStructure(unsigned Offset) override
Pass * findAnalysisPass(AnalysisID AID, bool Direction)
Find the pass that implements Analysis AID.
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.
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.