9#ifndef LLVM_ANALYSIS_STACKLIFETIME_H
10#define LLVM_ANALYSIS_STACKLIFETIME_H
41 struct BlockLifetimeInfo {
42 explicit BlockLifetimeInfo(
unsigned Size)
70 void addRange(
unsigned Start,
unsigned End) { Bits.set(Start, End); }
73 return Bits.anyCommon(
Other.Bits);
78 bool test(
unsigned Idx)
const {
return Bits.test(Idx); }
94 LivenessMap BlockLiveness;
121 DenseMap<const BasicBlock *, SmallVector<std::pair<unsigned, Marker>, 4>>
125 void dumpBlockLiveness()
const;
126 void dumpLiveRanges()
const;
128 void collectMarkers();
129 void calculateLocalLiveness();
130 void calculateLiveIntervals();
139 filter_iterator<ArrayRef<const IntrinsicInst *>::const_iterator,
140 std::function<
bool(
const IntrinsicInst *)>>>
161 return LiveRange(Instructions.size(),
true);
170 for (
int Idx = V.find_first(); Idx >= 0; Idx = V.find_next(Idx))
189 : Type(Type), OS(OS) {}
This file implements the BitVector class.
static void dumpAllocas(const SmallVectorImpl< coro::AllocaInfo > &Allocas)
This file defines the DenseMap class.
This header defines various interfaces for pass management in LLVM.
SI Optimize VGPR LiveRange
This file defines the SmallVector class.
an instruction to allocate memory on the stack
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
A wrapper class for inspecting calls to intrinsic functions.
A helper class to return the specified delimiter string after the first invocation of operator String...
This class represents the liveness of a register, stack slot, etc.
A set of analyses that are preserved following a run of a transformation pass.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
void printPipeline(raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
StackLifetimePrinterPass(raw_ostream &OS, StackLifetime::LivenessType Type)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
This class represents a set of interesting instructions where an alloca is live.
bool overlaps(const LiveRange &Other) const
void addRange(unsigned Start, unsigned End)
void join(const LiveRange &Other)
bool test(unsigned Idx) const
friend raw_ostream & operator<<(raw_ostream &OS, const StackLifetime::LiveRange &R)
LiveRange(unsigned Size, bool Set=false)
void print(raw_ostream &O)
StackLifetime(const Function &F, ArrayRef< const AllocaInst * > Allocas, LivenessType Type)
iterator_range< filter_iterator< ArrayRef< const IntrinsicInst * >::const_iterator, std::function< bool(const IntrinsicInst *)> > > getMarkers() const
bool isReachable(const Instruction *I) const
Returns true if instruction is reachable from entry.
LiveRange getFullLiveRange() const
Returns a live range that represents an alloca that is live throughout the entire function.
const LiveRange & getLiveRange(const AllocaInst *AI) const
Returns a set of "interesting" instructions where the given alloca is live.
bool isAliveAfter(const AllocaInst *AI, const Instruction *I) const
Returns true if the alloca is alive after the instruction.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
ArrayRef(const T &OneElt) -> ArrayRef< T >
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
A CRTP mix-in to automatically provide informational APIs needed for passes.