LLVM 20.0.0git
Classes | Public Types | Public Member Functions | List of all members
llvm::StackLifetime Class Reference

Compute live ranges of allocas. More...

#include "llvm/Analysis/StackLifetime.h"

Classes

class  LifetimeAnnotationWriter
 
class  LiveRange
 This class represents a set of interesting instructions where an alloca is live. More...
 

Public Types

enum class  LivenessType { May , Must }
 

Public Member Functions

 StackLifetime (const Function &F, ArrayRef< const AllocaInst * > Allocas, LivenessType Type)
 
void run ()
 
iterator_range< filter_iterator< ArrayRef< const IntrinsicInst * >::const_iterator, std::function< bool(const IntrinsicInst *)> > > getMarkers () const
 
const LiveRangegetLiveRange (const AllocaInst *AI) const
 Returns a set of "interesting" instructions where the given alloca is live.
 
bool isReachable (const Instruction *I) const
 Returns true if instruction is reachable from entry.
 
bool isAliveAfter (const AllocaInst *AI, const Instruction *I) const
 Returns true if the alloca is alive after the instruction.
 
LiveRange getFullLiveRange () const
 Returns a live range that represents an alloca that is live throughout the entire function.
 
void print (raw_ostream &O)
 

Detailed Description

Compute live ranges of allocas.

Live ranges are represented as sets of "interesting" instructions, which are defined as instructions that may start or end an alloca's lifetime. These are:

Definition at line 37 of file StackLifetime.h.

Member Enumeration Documentation

◆ LivenessType

Enumerator
May 
Must 

Definition at line 83 of file StackLifetime.h.

Constructor & Destructor Documentation

◆ StackLifetime()

StackLifetime::StackLifetime ( const Function F,
ArrayRef< const AllocaInst * >  Allocas,
LivenessType  Type 
)

Definition at line 318 of file StackLifetime.cpp.

References I, LLVM_DEBUG, and llvm::size().

Member Function Documentation

◆ getFullLiveRange()

LiveRange llvm::StackLifetime::getFullLiveRange ( ) const
inline

Returns a live range that represents an alloca that is live throughout the entire function.

Definition at line 162 of file StackLifetime.h.

Referenced by run().

◆ getLiveRange()

const StackLifetime::LiveRange & StackLifetime::getLiveRange ( const AllocaInst AI) const

Returns a set of "interesting" instructions where the given alloca is live.

Not all instructions in a function are interesting: we pick a set that is large enough for LiveRange::Overlaps to be correct.

Definition at line 35 of file StackLifetime.cpp.

References assert(), and IT.

Referenced by isAliveAfter().

◆ getMarkers()

iterator_range< filter_iterator< ArrayRef< const IntrinsicInst * >::const_iterator, std::function< bool(const IntrinsicInst *)> > > llvm::StackLifetime::getMarkers ( ) const
inline

Definition at line 143 of file StackLifetime.h.

References I, and llvm::make_filter_range().

◆ isAliveAfter()

bool StackLifetime::isAliveAfter ( const AllocaInst AI,
const Instruction I 
) const

Returns true if the alloca is alive after the instruction.

Definition at line 45 of file StackLifetime.cpp.

References assert(), getLiveRange(), I, and llvm::StackLifetime::LiveRange::test().

◆ isReachable()

bool StackLifetime::isReachable ( const Instruction I) const

Returns true if instruction is reachable from entry.

Definition at line 41 of file StackLifetime.cpp.

References I.

◆ print()

void StackLifetime::print ( raw_ostream O)

Definition at line 396 of file StackLifetime.cpp.

References OS, and llvm::Function::print().

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

◆ run()

void StackLifetime::run ( )

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