LLVM 19.0.0git
Public Member Functions | Friends | List of all members
llvm::LPMUpdater Class Reference

This class provides an interface for updating the loop pass manager based on mutations to the loop nest. More...

#include "llvm/Transforms/Scalar/LoopPassManager.h"

Public Member Functions

bool skipCurrentLoop () const
 This can be queried by loop passes which run other loop passes (like pass managers) to know whether the loop needs to be skipped due to updates to the loop nest.
 
void markLoopAsDeleted (Loop &L, llvm::StringRef Name)
 Loop passes should use this method to indicate they have deleted a loop from the nest.
 
void setParentLoop (Loop *L)
 
void addChildLoops (ArrayRef< Loop * > NewChildLoops)
 Loop passes should use this method to indicate they have added new child loops of the current loop.
 
void addSiblingLoops (ArrayRef< Loop * > NewSibLoops)
 Loop passes should use this method to indicate they have added new sibling loops to the current loop.
 
void revisitCurrentLoop ()
 Restart the current loop.
 
bool isLoopNestChanged () const
 
void markLoopNestChanged (bool Changed)
 Loopnest passes should use this method to indicate if the loopnest has been modified.
 

Friends

class llvm::FunctionToLoopPassAdaptor
 

Detailed Description

This class provides an interface for updating the loop pass manager based on mutations to the loop nest.

A reference to an instance of this class is passed as an argument to each Loop pass, and Loop passes should use it to update LPM infrastructure if they modify the loop nest structure.

LPMUpdater comes with two modes: the loop mode and the loop-nest mode. In loop mode, all the loops in the function will be pushed into the worklist and when new loops are added to the pipeline, their subloops are also inserted recursively. On the other hand, in loop-nest mode, only top-level loops are contained in the worklist and the addition of new (top-level) loops will not trigger the addition of their subloops.

Definition at line 259 of file LoopPassManager.h.

Member Function Documentation

◆ addChildLoops()

void llvm::LPMUpdater::addChildLoops ( ArrayRef< Loop * >  NewChildLoops)
inline

Loop passes should use this method to indicate they have added new child loops of the current loop.

NewChildLoops must contain only the immediate children. Any nested loops within them will be visited in postorder as usual for the loop pass manager.

Definition at line 300 of file LoopPassManager.h.

References llvm::appendLoopsToWorklist(), and assert().

Referenced by llvm::LoopFullUnrollPass::run().

◆ addSiblingLoops()

void llvm::LPMUpdater::addSiblingLoops ( ArrayRef< Loop * >  NewSibLoops)
inline

Loop passes should use this method to indicate they have added new sibling loops to the current loop.

NewSibLoops must only contain the immediate sibling loops. Any nested loops within them will be visited in postorder as usual for the loop pass manager.

Definition at line 327 of file LoopPassManager.h.

References llvm::appendLoopsToWorklist(), and assert().

Referenced by llvm::LoopFullUnrollPass::run().

◆ isLoopNestChanged()

bool llvm::LPMUpdater::isLoopNestChanged ( ) const
inline

Definition at line 356 of file LoopPassManager.h.

◆ markLoopAsDeleted()

void llvm::LPMUpdater::markLoopAsDeleted ( Loop L,
llvm::StringRef  Name 
)
inline

Loop passes should use this method to indicate they have deleted a loop from the nest.

Note that this loop must either be the current loop or a subloop of the current loop. This routine must be called prior to removing the loop from the loop nest.

If this is called for the current loop, in addition to clearing any state, this routine will mark that the current loop should be skipped by the rest of the pass management infrastructure.

Definition at line 279 of file LoopPassManager.h.

References assert(), llvm::AnalysisManager< IRUnitT, ExtraArgTs >::clear(), llvm::LoopBase< BlockT, LoopT >::contains(), and Name.

Referenced by deleteDeadBlocksFromLoop(), llvm::LoopDeletionPass::run(), llvm::LoopSimplifyCFGPass::run(), and llvm::LoopFullUnrollPass::run().

◆ markLoopNestChanged()

void llvm::LPMUpdater::markLoopNestChanged ( bool  Changed)
inline

Loopnest passes should use this method to indicate if the loopnest has been modified.

Definition at line 362 of file LoopPassManager.h.

◆ revisitCurrentLoop()

void llvm::LPMUpdater::revisitCurrentLoop ( )
inline

Restart the current loop.

Loop passes should call this method to indicate the current loop has been sufficiently changed that it should be re-visited from the begining of the loop pass pipeline rather than continuing.

Definition at line 348 of file LoopPassManager.h.

◆ setParentLoop()

void llvm::LPMUpdater::setParentLoop ( Loop L)
inline

Definition at line 288 of file LoopPassManager.h.

◆ skipCurrentLoop()

bool llvm::LPMUpdater::skipCurrentLoop ( ) const
inline

This can be queried by loop passes which run other loop passes (like pass managers) to know whether the loop needs to be skipped due to updates to the loop nest.

If this returns true, the loop object may have been deleted, so passes should take care not to touch the object.

Definition at line 267 of file LoopPassManager.h.

Referenced by llvm::FunctionToLoopPassAdaptor::run().

Friends And Related Function Documentation

◆ llvm::FunctionToLoopPassAdaptor

friend class llvm::FunctionToLoopPassAdaptor
friend

Definition at line 367 of file LoopPassManager.h.


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