23 #define DEBUG_TYPE "objc-arc-dependency"
30 using namespace llvm::objcarc;
49 assert(CS &&
"Only calls can alter reference counts!");
80 if (
const ICmpInst *ICI = dyn_cast<ICmpInst>(Inst)) {
89 OE = CS.arg_end(); OI != OE; ++OI) {
90 const Value *Op = *OI;
95 }
else if (
const StoreInst *SI = dyn_cast<StoreInst>(Inst)) {
107 const Value *Op = *OI;
132 return CanUse(Inst, Arg, PA, Class);
214 Worklist.
push_back(std::make_pair(StartBB, StartPos));
216 std::pair<BasicBlock *, BasicBlock::iterator> Pair =
222 if (LocalStartPos == StartBBBegin) {
231 if (Visited.
insert(PredBB))
232 Worklist.
push_back(std::make_pair(PredBB, PredBB->
end()));
233 }
while (++PI != PE);
238 if (
Depends(Flavor, Inst, Arg, PA)) {
239 DependingInsts.
insert(Inst);
243 }
while (!Worklist.
empty());
249 E = Visited.
end();
I != E; ++
I) {
256 if (Succ != StartBB && !Visited.
count(Succ)) {
257 DependingInsts.
insert(reinterpret_cast<Instruction *>(-1));
void push_back(const T &Elt)
const Instruction & back() const
static Value * GetObjCArg(Value *Inst)
Assuming the given instruction is one of the special calls such as objc_retain or objc_release...
Blocks objc_retainAutorelease.
static InstructionClass GetBasicInstructionClass(const Value *V)
Determine which objc runtime call instruction class V belongs to.
bool Depends(DependenceKind Flavor, Instruction *Inst, const Value *Arg, ProvenanceAnalysis &PA)
AliasAnalysis * getAA() const
T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val()
#define llvm_unreachable(msg)
InstructionClass GetInstructionClass(const Value *V)
Determine what kind of construct V is.
bool count(PtrType Ptr) const
count - Return true if the specified pointer is in the set.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
bool related(const Value *A, const Value *B)
void FindDependencies(DependenceKind Flavor, const Value *Arg, BasicBlock *StartBB, Instruction *StartInst, SmallPtrSet< Instruction *, 4 > &DependingInstructions, SmallPtrSet< const BasicBlock *, 4 > &Visited, ProvenanceAnalysis &PA)
bool onlyReadsMemory(ImmutableCallSite CS)
LLVM Basic Block Representation.
bool CanAlterRefCount(const Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA, InstructionClass Class)
InstructionClass
A simple classification for instructions.
Represent an integer comparison operator.
static bool CanInterruptRV(InstructionClass Class)
virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS)
getModRefBehavior - Return the behavior when calling the given call site.
SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
DependenceKind
Defines different dependence kinds among various ARC constructs.
bool CanUse(const Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA, InstructionClass Class)
static bool IsPotentialRetainableObjPtr(const Value *Op)
Test whether the given value is possible a retainable object pointer.
objc_autoreleaseReturnValue
static bool onlyAccessesArgPointees(ModRefBehavior MRB)
ImmutableCallSite - establish a view to a call site for examination.
Blocks objc_retainAutoreleaseReturnValue.
objc_retainAutoreleasedReturnValue
LLVM Value Representation.
This is similar to BasicAliasAnalysis, and it uses many of the same techniques, except it uses specia...
static const Value * GetUnderlyingObjCPtr(const Value *V)
This is a wrapper around getUnderlyingObject which also knows how to look through objc_retain and obj...
Blocks objc_retainAutoreleasedReturnValue.