LLVM 20.0.0git
Public Member Functions | List of all members
llvm::CallGraphUpdater Class Reference

Wrapper to unify "old style" CallGraph and "new style" LazyCallGraph. More...

#include "llvm/Transforms/Utils/CallGraphUpdater.h"

Public Member Functions

 CallGraphUpdater ()=default
 }
 
 ~CallGraphUpdater ()
 
void initialize (LazyCallGraph &LCG, LazyCallGraph::SCC &SCC, CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR)
 Initializers for usage outside of a CGSCC pass, inside a CGSCC pass in the old and new pass manager (PM).
 
bool finalize ()
 }
 
void removeFunction (Function &Fn)
 Remove Fn from the call graph.
 
void reanalyzeFunction (Function &Fn)
 After an CGSCC pass changes a function in ways that affect the call graph, this method can be called to update it.
 
void registerOutlinedFunction (Function &OriginalFn, Function &NewFn)
 If a new function was created by outlining, this method can be called to update the call graph for the new function.
 
void replaceFunctionWith (Function &OldFn, Function &NewFn)
 Replace OldFn in the call graph (and SCC) with NewFn.
 

Detailed 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.

Definition at line 29 of file CallGraphUpdater.h.

Constructor & Destructor Documentation

◆ CallGraphUpdater()

llvm::CallGraphUpdater::CallGraphUpdater ( )
default

}

◆ ~CallGraphUpdater()

llvm::CallGraphUpdater::~CallGraphUpdater ( )
inline

Definition at line 52 of file CallGraphUpdater.h.

References finalize().

Member Function Documentation

◆ finalize()

bool CallGraphUpdater::finalize ( )

◆ initialize()

void llvm::CallGraphUpdater::initialize ( LazyCallGraph LCG,
LazyCallGraph::SCC SCC,
CGSCCAnalysisManager AM,
CGSCCUpdateResult UR 
)
inline

Initializers for usage outside of a CGSCC pass, inside a CGSCC pass in the old and new pass manager (PM).

{

Definition at line 57 of file CallGraphUpdater.h.

References FAM, and llvm::AnalysisManager< IRUnitT, ExtraArgTs >::getResult().

Referenced by llvm::CoroAnnotationElidePass::run(), llvm::AttributorCGSCCPass::run(), llvm::AttributorLightCGSCCPass::run(), and llvm::OpenMPOptCGSCCPass::run().

◆ reanalyzeFunction()

void CallGraphUpdater::reanalyzeFunction ( Function Fn)

After an CGSCC pass changes a function in ways that affect the call graph, this method can be called to update it.

Definition at line 64 of file CallGraphUpdater.cpp.

References llvm::CallingConv::C, llvm::LazyCallGraph::get(), llvm::LazyCallGraph::lookupSCC(), N, and llvm::updateCGAndAnalysisManagerForCGSCCPass().

Referenced by runAttributorOnFunctions().

◆ registerOutlinedFunction()

void CallGraphUpdater::registerOutlinedFunction ( Function OriginalFn,
Function NewFn 
)

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.

Definition at line 72 of file CallGraphUpdater.cpp.

References llvm::LazyCallGraph::addSplitFunction().

◆ removeFunction()

void CallGraphUpdater::removeFunction ( Function Fn)

◆ replaceFunctionWith()

void CallGraphUpdater::replaceFunctionWith ( Function OldFn,
Function NewFn 
)

Replace OldFn in the call graph (and SCC) with NewFn.

The uses outside the call graph and the function OldFn are not modified. Note that OldFn is also removed from the call graph (

See also
removeFunction).

Definition at line 90 of file CallGraphUpdater.cpp.

References llvm::LazyCallGraph::get(), llvm::LazyCallGraph::SCC::getOuterRefSCC(), llvm::Constant::removeDeadConstantUsers(), removeFunction(), and llvm::LazyCallGraph::RefSCC::replaceNodeFunction().

Referenced by runAttributorOnFunctions().


The documentation for this class was generated from the following files: