LLVM 20.0.0git
Public Attributes | List of all members
llvm::CGSCCUpdateResult Struct Reference

Support structure for SCC passes to communicate updates the call graph back to the CGSCC pass manager infrastructure. More...

#include "llvm/Analysis/CGSCCPassManager.h"

Public Attributes

SmallPriorityWorklist< LazyCallGraph::SCC *, 1 > & CWorklist
 Worklist of the SCCs queued for processing.
 
SmallPtrSetImpl< LazyCallGraph::SCC * > & InvalidatedSCCs
 The set of invalidated SCCs which should be skipped if they are found in CWorklist.
 
LazyCallGraph::SCCUpdatedC
 If non-null, the updated current SCC being processed.
 
PreservedAnalyses CrossSCCPA
 Preserved analyses across SCCs.
 
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 graph's SCC structure in order to avoid infinite inlining.
 
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 batch.
 
SmallMapVector< Value *, WeakTrackingVH, 16 > IndirectVHs
 Weak VHs to keep track of indirect calls for the purposes of detecting devirtualization.
 

Detailed Description

Support structure for SCC passes to communicate updates the call graph back to the CGSCC pass manager infrastructure.

The CGSCC pass manager runs SCC passes which are allowed to update the call graph and SCC structures. This means the structure the pass manager works on is mutating underneath it. In order to support that, there needs to be careful communication about the precise nature and ramifications of these updates to the pass management infrastructure.

All SCC passes will have to accept a reference to the management layer's update result struct and use it to reflect the results of any CG updates performed.

Passes which do not change the call graph structure in any way can just ignore this argument to their run method.

Definition at line 231 of file CGSCCPassManager.h.

Member Data Documentation

◆ CrossSCCPA

PreservedAnalyses llvm::CGSCCUpdateResult::CrossSCCPA

Preserved analyses across SCCs.

We specifically want to allow CGSCC passes to mutate ancestor IR (changing both the CG structure and the function IR itself). However, this means we need to take special care to correctly mark what analyses are preserved across SCCs. We have to track this out-of-band here because within the main PassManager infrastructure we need to mark everything within an SCC as preserved in order to avoid repeatedly invalidating the same analyses as we unnest pass managers and adaptors. So we track the cross-SCC version of the preserved analyses here from any code that does direct invalidation of SCC analyses, and then use it whenever we move forward in the post-order walk of SCCs before running passes over the new SCC.

Definition at line 278 of file CGSCCPassManager.h.

Referenced by llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::run(), and llvm::ModuleToPostOrderCGSCCPassAdaptor::run().

◆ CWorklist

SmallPriorityWorklist<LazyCallGraph::SCC *, 1>& llvm::CGSCCUpdateResult::CWorklist

Worklist of the SCCs queued for processing.

When a pass refines the graph and creates new SCCs or causes them to have a different shape or set of component functions it should add the SCCs to this worklist so that we visit them in the refined form.

Note that if the SCCs are part of a RefSCC that is added to the RCWorklist, they don't need to be added here as visiting the RefSCC will be sufficient to re-visit the SCCs within it.

This worklist is in reverse post-order, as we pop off the back in order to observe SCCs in post-order. When adding SCCs, clients should add them in reverse post-order.

Definition at line 245 of file CGSCCPassManager.h.

Referenced by incorporateNewSCCRange(), llvm::CoroSplitPass::run(), and updateCGAndAnalysisManagerForPass().

◆ DeadFunctions

SmallVector<Function *, 4>& llvm::CGSCCUpdateResult::DeadFunctions

Functions that a pass has considered to be dead to be removed at the end of the call graph walk in batch.

Definition at line 291 of file CGSCCPassManager.h.

Referenced by llvm::CallGraphUpdater::finalize().

◆ IndirectVHs

SmallMapVector<Value *, WeakTrackingVH, 16> llvm::CGSCCUpdateResult::IndirectVHs

Weak VHs to keep track of indirect calls for the purposes of detecting devirtualization.

This is a map to avoid having duplicate entries. If a Value is deallocated, its corresponding WeakTrackingVH will be nulled out. When checking if a Value is in the map or not, also check if the corresponding WeakTrackingVH is null to avoid issues with a new Value sharing the same address as a deallocated one.

Definition at line 301 of file CGSCCPassManager.h.

Referenced by llvm::DevirtSCCRepeatedPass::run(), and updateCGAndAnalysisManagerForPass().

◆ InlinedInternalEdges

SmallDenseSet<std::pair<LazyCallGraph::Node *, LazyCallGraph::SCC *>, 4>& llvm::CGSCCUpdateResult::InlinedInternalEdges

A hacky area where the inliner can retain history about inlining decisions that mutated the call graph's SCC structure in order to avoid infinite inlining.

See the comments in the inliner's CG update logic.

FIXME: Keeping this here seems like a big layering issue, we should look for a better technique.

Definition at line 287 of file CGSCCPassManager.h.

◆ InvalidatedSCCs

SmallPtrSetImpl<LazyCallGraph::SCC *>& llvm::CGSCCUpdateResult::InvalidatedSCCs

The set of invalidated SCCs which should be skipped if they are found in CWorklist.

This is used to quickly prune out SCCs when they get deleted and happen to already be on the worklist. We use this primarily to avoid scanning the list and removing entries from it.

Definition at line 253 of file CGSCCPassManager.h.

Referenced by llvm::CallGraphUpdater::finalize(), llvm::DevirtSCCRepeatedPass::run(), llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::run(), llvm::ModuleToPostOrderCGSCCPassAdaptor::run(), and updateCGAndAnalysisManagerForPass().

◆ UpdatedC

LazyCallGraph::SCC* llvm::CGSCCUpdateResult::UpdatedC

If non-null, the updated current SCC being processed.

This is set when a graph refinement takes place and the "current" point in the graph moves "down" or earlier in the post-order walk. This will often cause the "current" SCC to be a newly created SCC object and the old one to be added to the above worklist. When that happens, this pointer is non-null and can be used to continue processing the "top" of the post-order walk.

Definition at line 263 of file CGSCCPassManager.h.

Referenced by llvm::DevirtSCCRepeatedPass::run(), llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::run(), llvm::ModuleToPostOrderCGSCCPassAdaptor::run(), and updateCGAndAnalysisManagerForPass().


The documentation for this struct was generated from the following file: