9#ifndef LLVM_ANALYSIS_STACKLIFETIME_H
10#define LLVM_ANALYSIS_STACKLIFETIME_H
41 struct BlockLifetimeInfo {
42 explicit BlockLifetimeInfo(
unsigned Size)
73 return Bits.anyCommon(
Other.Bits);
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,
142 std::function<
bool(
const IntrinsicInst *)>>>
163 return LiveRange(Instructions.size(),
true);
172 for (
int Idx = V.find_first();
Idx >= 0;
Idx = V.find_next(
Idx))
This file implements the BitVector class.
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
This header defines various interfaces for pass management in LLVM.
This file defines the SmallVector class.
an instruction to allocate memory on the stack
A container for analyses that lazily runs them and caches their results.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
A wrapper class for inspecting calls to intrinsic functions.
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.
Printer pass for testing.
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)
Compute live ranges of allocas.
void print(raw_ostream &O)
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.
@ BasicBlock
Various leaf nodes.
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...
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
A CRTP mix-in to automatically provide informational APIs needed for passes.