13#ifndef LLVM_ANALYSIS_CAPTURETRACKING_H
14#define LLVM_ANALYSIS_CAPTURETRACKING_H
30 template <
typename Fn>
class function_ref;
49 unsigned MaxUsesToExplore = 0);
61 unsigned MaxUsesToExplore = 0);
79 const DominatorTree *DT,
80 bool IncludeI =
false,
81 unsigned MaxUsesToExplore = 0,
82 const LoopInfo *LI =
nullptr);
93 const Value *V,
bool ReturnCaptures,
const Instruction *
I,
96 const LoopInfo *LI =
nullptr,
unsigned MaxUsesToExplore = 0);
109 LLVM_ABI std::pair<Instruction *, CaptureComponents>
112 unsigned MaxUsesToExplore = 0);
166 virtual bool shouldExplore(
const Use *U);
197 unsigned MaxUsesToExplore = 0);
This file defines the DenseMap class.
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
NodeAddr< UseNode * > Use
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::pair< Instruction *, CaptureComponents > FindEarliestCapture(const Value *V, Function &F, bool ReturnCaptures, const DominatorTree &DT, CaptureComponents Mask, unsigned MaxUsesToExplore=0)
LLVM_ABI unsigned getDefaultMaxUsesToExploreForCaptureTracking()
getDefaultMaxUsesToExploreForCaptureTracking - Return default value of the maximal number of uses to ...
LLVM_ABI bool PointerMayBeCapturedBefore(const Value *V, bool ReturnCaptures, const Instruction *I, const DominatorTree *DT, bool IncludeI=false, unsigned MaxUsesToExplore=0, const LoopInfo *LI=nullptr)
PointerMayBeCapturedBefore - Return true if this pointer value may be captured by the enclosing funct...
CaptureComponents
Components of the pointer that may be captured.
LLVM_ABI bool PointerMayBeCaptured(const Value *V, bool ReturnCaptures, unsigned MaxUsesToExplore=0)
PointerMayBeCaptured - Return true if this pointer value may be captured by the enclosing function (w...
bool capturesAnything(CaptureComponents CC)
LLVM_ABI UseCaptureInfo DetermineUseCaptureKind(const Use &U, const Value *Base)
Determine what kind of capture behaviour U may exhibit.
bool capturesNothing(CaptureComponents CC)
This callback is used in conjunction with PointerMayBeCaptured.
Action
Action returned from captures().
@ ContinueIgnoringReturn
Continue traversal, but do not follow the return value of the user, even if it has additional capture...
@ Continue
Continue traversal, and also follow the return value of the user if it has additional capture compone...
@ Stop
Stop the traversal.
virtual Action captured(const Use *U, UseCaptureInfo CI)=0
Use U directly captures CI.UseCC and additionally CI.ResultCC through the return value of the user of...
virtual void tooManyUses()=0
tooManyUses - The depth of traversal has breached a limit.
virtual ~CaptureTracker()
Capture information for a specific Use.
bool isPassthrough() const
CaptureComponents UseCC
Components captured by this use.
UseCaptureInfo(CaptureComponents UseCC, CaptureComponents ResultCC=CaptureComponents::None)
CaptureComponents ResultCC
Components captured by the return value of the user of this Use.
static UseCaptureInfo passthrough()