88#ifndef LLVM_ANALYSIS_CGSCCPASSMANAGER_H
89#define LLVM_ANALYSIS_CGSCCPASSMANAGER_H
103template <
typename T,
unsigned int N>
class SmallPriorityWorklist;
104struct CGSCCUpdateResult;
109#define DEBUG_TYPE "cgscc"
112extern template class AllAnalysesOn<LazyCallGraph::SCC>;
114extern template class AnalysisManager<LazyCallGraph::SCC, LazyCallGraph &>;
147template <
typename AnalysisT>
150 :
PassInfoMixin<RequireAnalysisPass<AnalysisT, LazyCallGraph::SCC,
151 CGSCCAnalysisManager, LazyCallGraph &,
152 CGSCCUpdateResult &>> {
155 (void)AM.template getResult<AnalysisT>(
C, CG);
160 auto ClassName = AnalysisT::name();
161 auto PassName = MapClassName2PassName(ClassName);
176 : InnerAM(&InnerAM),
G(&
G) {}
352 Pass->printPipeline(
OS, MapClassName2PassName);
359 std::unique_ptr<PassConceptT>
Pass;
364template <
typename CGSCCPassT>
365ModuleToPostOrderCGSCCPassAdaptor
373 std::unique_ptr<ModuleToPostOrderCGSCCPassAdaptor::PassConceptT>(
374 new PassModelT(std::forward<CGSCCPassT>(
Pass))));
416extern template class OuterAnalysisManagerProxy<CGSCCAnalysisManager, Function>;
458 bool EagerlyInvalidate,
bool NoRerun)
464 NoRerun(Arg.NoRerun) {}
483 if (EagerlyInvalidate || NoRerun) {
485 if (EagerlyInvalidate)
487 if (EagerlyInvalidate && NoRerun)
494 Pass->printPipeline(
OS, MapClassName2PassName);
501 std::unique_ptr<PassConceptT>
Pass;
502 bool EagerlyInvalidate;
508template <
typename FunctionPassT>
509CGSCCToFunctionPassAdaptor
511 bool EagerlyInvalidate =
false,
512 bool NoRerun =
false) {
518 std::unique_ptr<CGSCCToFunctionPassAdaptor::PassConceptT>(
519 new PassModelT(std::forward<FunctionPassT>(
Pass))),
520 EagerlyInvalidate, NoRerun);
568 OS <<
"devirt<" << MaxIterations <<
">(";
569 Pass->printPipeline(
OS, MapClassName2PassName);
574 std::unique_ptr<PassConceptT>
Pass;
580template <
typename CGSCCPassT>
589 std::unique_ptr<DevirtSCCRepeatedPass::PassConceptT>(
590 new PassModelT(std::forward<CGSCCPassT>(
Pass))),
Implements a lazy call graph analysis and related passes for the new pass manager.
Machine Check Debug Module
This file implements a map that provides insertion order iteration.
FunctionAnalysisManager FAM
This header defines various interfaces for pass management in LLVM.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const char PassName[]
API to communicate dependencies between analyses during invalidation.
A container for analyses that lazily runs them and caches their results.
CGSCCAnalysisManager & getManager()
Accessor for the analysis manager.
Result(CGSCCAnalysisManager &InnerAM, LazyCallGraph &G)
Adaptor that maps from a SCC to its functions.
CGSCCToFunctionPassAdaptor(std::unique_ptr< PassConceptT > Pass, bool EagerlyInvalidate, bool NoRerun)
void printPipeline(raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
CGSCCToFunctionPassAdaptor & operator=(CGSCCToFunctionPassAdaptor RHS)
CGSCCToFunctionPassAdaptor(CGSCCToFunctionPassAdaptor &&Arg)
friend void swap(CGSCCToFunctionPassAdaptor &LHS, CGSCCToFunctionPassAdaptor &RHS)
A helper that repeats an SCC pass each time an indirect call is refined to a direct call by that pass...
void printPipeline(raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
DevirtSCCRepeatedPass(std::unique_ptr< PassConceptT > Pass, int MaxIterations)
bool invalidate(LazyCallGraph::SCC &C, const PreservedAnalyses &PA, CGSCCAnalysisManager::Invalidator &Inv)
void updateFAM(FunctionAnalysisManager &FAM)
FunctionAnalysisManager & getManager()
Accessor for the analysis manager.
Result(FunctionAnalysisManager &FAM)
A proxy from a FunctionAnalysisManager to an SCC.
Result run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM, LazyCallGraph &)
Computes the FunctionAnalysisManager and stores it in the result proxy.
bool invalidate(IRUnitT &IR, const PreservedAnalyses &PA, typename AnalysisManager< IRUnitT, ExtraArgTs... >::Invalidator &Inv)
Handler for invalidation of the outer IR unit, IRUnitT.
An analysis over an "outer" IR unit that provides access to an analysis manager over an "inner" IR un...
Result run(IRUnitT &IR, AnalysisManager< IRUnitT, ExtraArgTs... > &AM, ExtraArgTs...)
Run the analysis pass and create our proxy result object.
A node in the call graph.
An SCC of the call graph.
A lazily constructed view of the call graph of a module.
The core module pass which does a post-order walk of the SCCs and runs a CGSCC pass over each one.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Runs the CGSCC pass across every SCC in the module.
ModuleToPostOrderCGSCCPassAdaptor & operator=(ModuleToPostOrderCGSCCPassAdaptor RHS)
ModuleToPostOrderCGSCCPassAdaptor(std::unique_ptr< PassConceptT > Pass)
friend void swap(ModuleToPostOrderCGSCCPassAdaptor &LHS, ModuleToPostOrderCGSCCPassAdaptor &RHS)
ModuleToPostOrderCGSCCPassAdaptor(ModuleToPostOrderCGSCCPassAdaptor &&Arg)
void printPipeline(raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
A Module instance is used to store all the information related to an LLVM module.
An analysis over an "inner" IR unit that provides access to an analysis manager over a "outer" IR uni...
Manages a sequence of passes over a particular unit of IR.
Pass interface - Implemented by all 'passes'.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Result run(Function &F, FunctionAnalysisManager &FAM)
Implements a dense probed hash-table based set with some number of buckets stored inline.
A version of PriorityWorklist that selects small size optimized data structures for the vector and ma...
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
DevirtSCCRepeatedPass createDevirtSCCRepeatedPass(CGSCCPassT &&Pass, int MaxIterations)
A function to deduce a function pass type and wrap it in the templated adaptor.
LazyCallGraph::SCC & updateCGAndAnalysisManagerForFunctionPass(LazyCallGraph &G, LazyCallGraph::SCC &C, LazyCallGraph::Node &N, CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR, FunctionAnalysisManager &FAM)
Helper to update the call graph after running a function pass.
LazyCallGraph::SCC & updateCGAndAnalysisManagerForCGSCCPass(LazyCallGraph &G, LazyCallGraph::SCC &C, LazyCallGraph::Node &N, CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR, FunctionAnalysisManager &FAM)
Helper to update the call graph after running a CGSCC pass.
ModuleToPostOrderCGSCCPassAdaptor createModuleToPostOrderCGSCCPassAdaptor(CGSCCPassT &&Pass)
A function to deduce a function pass type and wrap it in the templated adaptor.
CGSCCToFunctionPassAdaptor createCGSCCToFunctionPassAdaptor(FunctionPassT &&Pass, bool EagerlyInvalidate=false, bool NoRerun=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
AnalysisManager< LazyCallGraph::SCC, LazyCallGraph & > CGSCCAnalysisManager
The CGSCC analysis manager.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Implement std::hash so that hash_code can be used in STL containers.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Support structure for SCC passes to communicate updates the call graph back to the CGSCC pass manager...
SmallMapVector< Value *, WeakTrackingVH, 16 > IndirectVHs
Weak VHs to keep track of indirect calls for the purposes of detecting devirtualization.
SmallPriorityWorklist< LazyCallGraph::SCC *, 1 > & CWorklist
Worklist of the SCCs queued for processing.
SmallDenseSet< std::pair< LazyCallGraph::Node *, LazyCallGraph::SCC * >, 4 > & InlinedInternalEdges
A hacky area where the inliner can retain history about inlining decisions that mutated the call grap...
SmallVector< Function *, 4 > & DeadFunctions
Functions that a pass has considered to be dead to be removed at the end of the call graph walk in ba...
SmallPtrSetImpl< LazyCallGraph::SCC * > & InvalidatedSCCs
The set of invalidated SCCs which should be skipped if they are found in CWorklist.
SmallPtrSetImpl< LazyCallGraph::RefSCC * > & InvalidatedRefSCCs
The set of invalidated RefSCCs which should be skipped if they are found in RCWorklist.
LazyCallGraph::SCC * UpdatedC
If non-null, the updated current SCC being processed.
PreservedAnalyses CrossSCCPA
Preserved analyses across SCCs.
A CRTP mix-in to automatically provide informational APIs needed for passes.
void printPipeline(raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM, LazyCallGraph &CG, CGSCCUpdateResult &)
A utility pass template to force an analysis result to be available.
A MapVector that performs no allocations if smaller than a certain size.
Template for the abstract base class used to dispatch polymorphically over pass objects.
A template wrapper used to implement the polymorphic API.