Go to the documentation of this file.
9 #ifndef LLVM_ANALYSIS_STACKLIFETIME_H
10 #define LLVM_ANALYSIS_STACKLIFETIME_H
41 struct BlockLifetimeInfo {
42 explicit BlockLifetimeInfo(
unsigned Size)
43 : Begin(Size), End(Size), LiveIn(Size), LiveOut(Size) {}
69 LiveRange(
unsigned Size,
bool Set =
false) : Bits(Size, Set) {}
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>>
124 bool HasUnknownLifetimeStartOrEnd =
false;
126 void dumpAllocas()
const;
127 void dumpBlockLiveness()
const;
128 void dumpLiveRanges()
const;
130 void collectMarkers();
131 void calculateLocalLiveness();
132 void calculateLiveIntervals();
135 StackLifetime(
const Function &F, ArrayRef<const AllocaInst *> Allocas,
141 filter_iterator<ArrayRef<const IntrinsicInst *>::const_iterator,
199 #endif // LLVM_ANALYSIS_STACKLIFETIME_H
A set of analyses that are preserved following a run of a transformation pass.
This is an optimization pass for GlobalISel generic memory operations.
bool isAliveAfter(const AllocaInst *AI, const Instruction *I) const
Returns true if the alloca is alive after the instruction.
iterator_range< filter_iterator< ArrayRef< const IntrinsicInst * >::const_iterator, std::function< bool(const IntrinsicInst *)> > > getMarkers() const
A CRTP mix-in to automatically provide informational APIs needed for passes.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StackLifetime(const Function &F, ArrayRef< const AllocaInst * > Allocas, LivenessType Type)
The instances of the Type class are immutable: once they are created, they are never changed.
Printer pass for testing.
Code Generation Notes for reduce the size of the ISel and reduce repetition in the implementation In a small number of this can cause even when no optimisation has taken place Instructions
void addRange(unsigned Start, unsigned End)
void print(raw_ostream &O)
bool isReachable(const Instruction *I) const
Returns true if instruction is reachable from entry.
friend raw_ostream & operator<<(raw_ostream &OS, const StackLifetime::LiveRange &R)
StackLifetimePrinterPass(raw_ostream &OS, StackLifetime::LivenessType Type)
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
An efficient, type-erasing, non-owning reference to a callable.
This class represents the liveness of a register, stack slot, etc.
const LiveRange & getLiveRange(const AllocaInst *AI) const
Returns a set of "interesting" instructions where the given alloca is live.
Compute live ranges of allocas.
void join(const LiveRange &Other)
@ BasicBlock
Various leaf nodes.
print Print MemDeps of function
SI Optimize VGPR LiveRange
void printPipeline(raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
This class represents a set of interesting instructions where an alloca is live.
LiveRange getFullLiveRange() const
Returns a live range that represents an alloca that is live throughout the entire function.
bool overlaps(const LiveRange &Other) const
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...
int find_next(unsigned Prev) const
find_next - Returns the index of the next set bit following the "Prev" bit.
A wrapper class for inspecting calls to intrinsic functions.
std::optional< std::vector< StOtherPiece > > Other
LiveRange(unsigned Size, bool Set=false)
int find_first() const
find_first - Returns the index of the first set bit, -1 if none of the bits are set.
A container for analyses that lazily runs them and caches their results.
bool test(unsigned Idx) const
an instruction to allocate memory on the stack