LLVM  14.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  LivenessType { LivenessType::May, LivenessType::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. More...
 
bool isReachable (const Instruction *I) const
 Returns true if instruction is reachable from entry. More...
 
bool isAliveAfter (const AllocaInst *AI, const Instruction *I) const
 Returns true if the alloca is alive after the instruction. More...
 
LiveRange getFullLiveRange () const
 Returns a live range that represents an alloca that is live throughout the entire function. More...
 
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 38 of file StackLifetime.h.

Member Enumeration Documentation

◆ LivenessType

Enumerator
May 
Must 

Definition at line 84 of file StackLifetime.h.

Constructor & Destructor Documentation

◆ StackLifetime()

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

Definition at line 307 of file StackLifetime.cpp.

References I, and LLVM_DEBUG.

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 163 of file StackLifetime.h.

References Instructions, and LiveRange.

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 40 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 144 of file StackLifetime.h.

References function, I, Instructions, 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 50 of file StackLifetime.cpp.

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

◆ isReachable()

bool StackLifetime::isReachable ( const Instruction I) const

Returns true if instruction is reachable from entry.

Definition at line 46 of file StackLifetime.cpp.

References I.

◆ print()

void StackLifetime::print ( raw_ostream O)

Definition at line 385 of file StackLifetime.cpp.

References llvm::Function::print().

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

◆ run()

void StackLifetime::run ( )

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