LLVM 20.0.0git
|
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 LiveRange & | getLiveRange (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) |
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.
|
strong |
Enumerator | |
---|---|
May | |
Must |
Definition at line 83 of file StackLifetime.h.
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().
|
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().
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.
Referenced by isAliveAfter().
|
inline |
Definition at line 143 of file StackLifetime.h.
References I, and llvm::make_filter_range().
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().
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.
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().
void StackLifetime::run | ( | ) |
Definition at line 330 of file StackLifetime.cpp.
References getFullLiveRange(), I, LLVM_DEBUG, May, Must, and llvm::BitVector::test().
Referenced by llvm::StackLifetimePrinterPass::run().