LLVM 20.0.0git
|
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 . | |
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.
|
default |
}
|
inline |
Definition at line 52 of file CallGraphUpdater.h.
References finalize().
bool CallGraphUpdater::finalize | ( | ) |
}
Finalizer that will trigger actions like function removal from the CG.
Definition at line 21 of file CallGraphUpdater.cpp.
References assert(), llvm::AnalysisManager< IRUnitT, ExtraArgTs >::clear(), llvm::CGSCCUpdateResult::DeadFunctions, llvm::filterDeadComdatFunctions(), llvm::LazyCallGraph::get(), llvm::PoisonValue::get(), llvm::CGSCCUpdateResult::InvalidatedSCCs, llvm::LazyCallGraph::lookupSCC(), llvm::LazyCallGraph::markDeadFunction(), and N.
Referenced by ~CallGraphUpdater().
|
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().
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().
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().
void CallGraphUpdater::removeFunction | ( | Function & | Fn | ) |
Remove Fn
from the call graph.
Definition at line 78 of file CallGraphUpdater.cpp.
References llvm::AnalysisManager< IRUnitT, ExtraArgTs >::clear(), llvm::Function::deleteBody(), llvm::GlobalValue::ExternalLinkage, llvm::Value::getName(), llvm::GlobalObject::hasComdat(), and llvm::GlobalValue::setLinkage().
Referenced by replaceFunctionWith().
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 (
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().