class CallGraphUpdater
Declaration
class CallGraphUpdater { /* full declaration omitted */ };
Description
Wrapper to unify "old style" CallGraph and "new style" LazyCallGraph. This simplifies the interface and the call sites, e.g., new and old pass manager passes can share the same code.
Declared at: llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h:29
Member Variables
- private SmallPtrSet<llvm::Function*, 16> ReplacedFunctions
- Containers for functions which we did replace or want to delete when `finalize` is called. This can happen explicitly or as part of the destructor. Dead functions in comdat sections are tracked separately because a function with discardable linakage in a COMDAT should only be dropped if the entire COMDAT is dropped, see git ac07703842cf. {
- private SmallVector<llvm::Function*, 16> DeadFunctions
- private SmallVector<llvm::Function*, 16> DeadFunctionsInComdats
- private llvm::CallGraph* CG = nullptr
- Old PM variables {
- private llvm::CallGraphSCC* CGSCC = nullptr
- private llvm::LazyCallGraph* LCG = nullptr
- New PM variables {
- private LazyCallGraph::SCC* SCC = nullptr
- private llvm::CGSCCAnalysisManager* AM = nullptr
- private llvm::CGSCCUpdateResult* UR = nullptr
- private llvm::FunctionAnalysisManager* FAM = nullptr
Method Overview
- public CallGraphUpdater()
- public bool finalize()
- public void initialize(llvm::CallGraph & CG, llvm::CallGraphSCC & SCC)
- public void initialize(llvm::LazyCallGraph & LCG, LazyCallGraph::SCC & SCC, llvm::CGSCCAnalysisManager & AM, llvm::CGSCCUpdateResult & UR)
- public void reanalyzeFunction(llvm::Function & Fn)
- public void registerOutlinedFunction(llvm::Function & OriginalFn, llvm::Function & NewFn)
- public void removeCallSite(llvm::CallBase & CS)
- public void removeFunction(llvm::Function & Fn)
- public bool replaceCallSite(llvm::CallBase & OldCS, llvm::CallBase & NewCS)
- public void replaceFunctionWith(llvm::Function & OldFn, llvm::Function & NewFn)
- public ~CallGraphUpdater()
Methods
¶CallGraphUpdater()
CallGraphUpdater()
Description
}
Declared at: llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h:57
¶bool finalize()
bool finalize()
Description
Finalizer that will trigger actions like function removal from the CG.
Declared at: llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h:79
¶void initialize(llvm::CallGraph& CG,
llvm::CallGraphSCC& SCC)
void initialize(llvm::CallGraph& CG,
llvm::CallGraphSCC& SCC)
Description
Initializers for usage outside of a CGSCC pass, inside a CGSCC pass in the old and new pass manager (PM). {
Declared at: llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h:63
Parameters
- llvm::CallGraph& CG
- llvm::CallGraphSCC& SCC
¶void initialize(llvm::LazyCallGraph& LCG,
LazyCallGraph::SCC& SCC,
llvm::CGSCCAnalysisManager& AM,
llvm::CGSCCUpdateResult& UR)
void initialize(llvm::LazyCallGraph& LCG,
LazyCallGraph::SCC& SCC,
llvm::CGSCCAnalysisManager& AM,
llvm::CGSCCUpdateResult& UR)
Declared at: llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h:67
Parameters
- llvm::LazyCallGraph& LCG
- LazyCallGraph::SCC& SCC
- llvm::CGSCCAnalysisManager& AM
- llvm::CGSCCUpdateResult& UR
¶void reanalyzeFunction(llvm::Function& Fn)
void reanalyzeFunction(llvm::Function& Fn)
Description
After an CGSCC pass changes a function in ways that affect the call graph, this method can be called to update it.
Declared at: llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h:86
Parameters
- llvm::Function& Fn
¶void registerOutlinedFunction(
llvm::Function& OriginalFn,
llvm::Function& NewFn)
void registerOutlinedFunction(
llvm::Function& OriginalFn,
llvm::Function& NewFn)
Description
If a new function was created by outlining, this method can be called to update the call graph for the new function. Note that the old one still needs to be re-analyzed or manually updated.
Declared at: llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h:91
Parameters
- llvm::Function& OriginalFn
- llvm::Function& NewFn
¶void removeCallSite(llvm::CallBase& CS)
void removeCallSite(llvm::CallBase& CS)
Description
Remove the call site \p CS from the call graph.
Declared at: llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h:100
Parameters
- llvm::CallBase& CS
¶void removeFunction(llvm::Function& Fn)
void removeFunction(llvm::Function& Fn)
Description
Remove \p Fn from the call graph.
Declared at: llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h:82
Parameters
- llvm::Function& Fn
¶bool replaceCallSite(llvm::CallBase& OldCS,
llvm::CallBase& NewCS)
bool replaceCallSite(llvm::CallBase& OldCS,
llvm::CallBase& NewCS)
Description
Replace \p OldCS with the new call site \p NewCS.
Declared at: llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h:105
Parameters
- llvm::CallBase& OldCS
- llvm::CallBase& NewCS
Returns
True if the replacement was successful, otherwise False. In the latter case the parent function of \p OldCB needs to be re-analyzed.
¶void replaceFunctionWith(llvm::Function& OldFn,
llvm::Function& NewFn)
void replaceFunctionWith(llvm::Function& OldFn,
llvm::Function& NewFn)
Description
Replace \p OldFn in the call graph (and SCC) with \p NewFn. The uses outside the call graph and the function \p OldFn are not modified. Note that \p OldFn is also removed from the call graph (
Declared at: llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h:97
Parameters
- llvm::Function& OldFn
- llvm::Function& NewFn
¶~CallGraphUpdater()
~CallGraphUpdater()
Declared at: llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h:58