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) {}
359 Pass->printPipeline(
OS, MapClassName2PassName);
366 std::unique_ptr<PassConceptT>
Pass;
371template <
typename CGSCCPassT>
372ModuleToPostOrderCGSCCPassAdaptor
380 std::unique_ptr<ModuleToPostOrderCGSCCPassAdaptor::PassConceptT>(
381 new PassModelT(std::forward<CGSCCPassT>(
Pass))));
423extern template class OuterAnalysisManagerProxy<CGSCCAnalysisManager, Function>;
465 bool EagerlyInvalidate,
bool NoRerun)
471 NoRerun(
Arg.NoRerun) {}
490 if (EagerlyInvalidate || NoRerun) {
492 if (EagerlyInvalidate)
494 if (EagerlyInvalidate && NoRerun)
501 Pass->printPipeline(
OS, MapClassName2PassName);
508 std::unique_ptr<PassConceptT>
Pass;
509 bool EagerlyInvalidate;
515template <
typename FunctionPassT>
516CGSCCToFunctionPassAdaptor
518 bool EagerlyInvalidate =
false,
519 bool NoRerun =
false) {
526 std::unique_ptr<CGSCCToFunctionPassAdaptor::PassConceptT>(
527 new PassModelT(std::forward<FunctionPassT>(
Pass))),
528 EagerlyInvalidate, NoRerun);
576 OS <<
"devirt<" << MaxIterations <<
">(";
577 Pass->printPipeline(
OS, MapClassName2PassName);
582 std::unique_ptr<PassConceptT>
Pass;
588template <
typename CGSCCPassT>
597 std::unique_ptr<DevirtSCCRepeatedPass::PassConceptT>(
598 new PassModelT(std::forward<CGSCCPassT>(
Pass))),
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
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)
PreservedAnalyses run(LazyCallGraph::SCC &InitialC, CGSCCAnalysisManager &AM, LazyCallGraph &CG, CGSCCUpdateResult &UR)
Runs the wrapped pass up to MaxIterations on the SCC, iterating whenever an indirect call is refined.
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...
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.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
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.
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...
SmallPriorityWorklist< LazyCallGraph::RefSCC *, 1 > & RCWorklist
Worklist of the RefSCCs queued for processing.
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...
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.