35 explicit SimpleCaptureTracker(
bool ReturnCaptures)
36 : ReturnCaptures(ReturnCaptures), Captured(
false) {}
38 void tooManyUses() { Captured =
true; }
40 bool captured(
Use *U) {
41 if (isa<ReturnInst>(U->getUser()) && !ReturnCaptures)
62 bool ReturnCaptures,
bool StoreCaptures) {
63 assert(!isa<GlobalValue>(V) &&
64 "It doesn't make sense to ask whether a global is captured.");
72 SimpleCaptureTracker SCT(ReturnCaptures);
95 Use *U = &UI.getUse();
98 Worklist.push_back(U);
101 while (!Worklist.empty()) {
102 Use *U = Worklist.pop_back_val();
108 case Instruction::Invoke: {
134 case Instruction::VAArg:
144 case Instruction::BitCast:
145 case Instruction::GetElementPtr:
157 Use *U = &UI.getUse();
160 Worklist.push_back(U);
163 case Instruction::ICmp:
168 dyn_cast<ConstantPointerNull>(I->
getOperand(1)))
169 if (CPN->getType()->getAddressSpace() == 0)
virtual void tooManyUses()=0
bool isNoAliasCall(const Value *V)
virtual ~CaptureTracker()
virtual bool captured(Use *U)=0
Value * getOperand(unsigned i) const
bool PointerMayBeCaptured(const Value *V, bool ReturnCaptures, bool StoreCaptures)
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
bool doesNotThrow() const
Determine if the call cannot unwind.
bool doesNotCapture(unsigned ArgNo) const
Determine whether this argument is not captured.
virtual bool shouldExplore(Use *U)
static int const Threshold
LLVM Value Representation.
unsigned getOpcode() const
getOpcode() returns a member of one of the enums like Instruction::Add.
bool isVoidTy() const
isVoidTy - Return true if this is 'void'.