LLVM 20.0.0git
Public Member Functions | Protected Attributes | List of all members
llvm::LoadAndStorePromoter Class Reference

Helper class for promoting a collection of loads and stores into SSA Form using the SSAUpdater. More...

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

Public Member Functions

 LoadAndStorePromoter (ArrayRef< const Instruction * > Insts, SSAUpdater &S, StringRef Name=StringRef())
 
virtual ~LoadAndStorePromoter ()=default
 
void run (const SmallVectorImpl< Instruction * > &Insts)
 This does the promotion.
 
virtual bool isInstInList (Instruction *I, const SmallVectorImpl< Instruction * > &Insts) const
 Return true if the specified instruction is in the Inst list.
 
virtual void doExtraRewritesBeforeFinalDeletion ()
 This hook is invoked after all the stores are found and inserted as available values.
 
virtual void replaceLoadWithValue (LoadInst *LI, Value *V) const
 Clients can choose to implement this to get notified right before a load is RAUW'd another value.
 
virtual void instructionDeleted (Instruction *I) const
 Called before each instruction is deleted.
 
virtual void updateDebugInfo (Instruction *I) const
 Called to update debug info associated with the instruction.
 
virtual bool shouldDelete (Instruction *I) const
 Return false if a sub-class wants to keep one of the loads/stores after the SSA construction.
 

Protected Attributes

SSAUpdaterSSA
 

Detailed Description

Helper class for promoting a collection of loads and stores into SSA Form using the SSAUpdater.

This handles complexities that SSAUpdater doesn't, such as multiple loads and stores in one block.

Clients of this class are expected to subclass this and implement the virtual methods.

Definition at line 151 of file SSAUpdater.h.

Constructor & Destructor Documentation

◆ LoadAndStorePromoter()

LoadAndStorePromoter::LoadAndStorePromoter ( ArrayRef< const Instruction * >  Insts,
SSAUpdater S,
StringRef  Name = StringRef() 
)

◆ ~LoadAndStorePromoter()

virtual llvm::LoadAndStorePromoter::~LoadAndStorePromoter ( )
virtualdefault

Member Function Documentation

◆ doExtraRewritesBeforeFinalDeletion()

virtual void llvm::LoadAndStorePromoter::doExtraRewritesBeforeFinalDeletion ( )
inlinevirtual

This hook is invoked after all the stores are found and inserted as available values.

Definition at line 176 of file SSAUpdater.h.

Referenced by run().

◆ instructionDeleted()

virtual void llvm::LoadAndStorePromoter::instructionDeleted ( Instruction I) const
inlinevirtual

Called before each instruction is deleted.

Definition at line 183 of file SSAUpdater.h.

Referenced by run().

◆ isInstInList()

bool LoadAndStorePromoter::isInstInList ( Instruction I,
const SmallVectorImpl< Instruction * > &  Insts 
) const
virtual

Return true if the specified instruction is in the Inst list.

The Insts list is the one passed into the constructor. Clients should implement this with a more efficient version if possible.

Definition at line 529 of file SSAUpdater.cpp.

References I, and llvm::is_contained().

Referenced by run().

◆ replaceLoadWithValue()

virtual void llvm::LoadAndStorePromoter::replaceLoadWithValue ( LoadInst LI,
Value V 
) const
inlinevirtual

Clients can choose to implement this to get notified right before a load is RAUW'd another value.

Definition at line 180 of file SSAUpdater.h.

Referenced by run().

◆ run()

void LoadAndStorePromoter::run ( const SmallVectorImpl< Instruction * > &  Insts)

◆ shouldDelete()

virtual bool llvm::LoadAndStorePromoter::shouldDelete ( Instruction I) const
inlinevirtual

Return false if a sub-class wants to keep one of the loads/stores after the SSA construction.

Definition at line 190 of file SSAUpdater.h.

Referenced by run().

◆ updateDebugInfo()

virtual void llvm::LoadAndStorePromoter::updateDebugInfo ( Instruction I) const
inlinevirtual

Called to update debug info associated with the instruction.

Definition at line 186 of file SSAUpdater.h.

Referenced by run().

Member Data Documentation

◆ SSA

SSAUpdater& llvm::LoadAndStorePromoter::SSA
protected

Definition at line 153 of file SSAUpdater.h.

Referenced by LoadAndStorePromoter(), and run().


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