32 return OS <<
"ARCInstKind::Retain";
34 return OS <<
"ARCInstKind::RetainRV";
36 return OS <<
"ARCInstKind::UnsafeClaimRV";
38 return OS <<
"ARCInstKind::RetainBlock";
40 return OS <<
"ARCInstKind::Release";
42 return OS <<
"ARCInstKind::Autorelease";
44 return OS <<
"ARCInstKind::AutoreleaseRV";
46 return OS <<
"ARCInstKind::AutoreleasepoolPush";
48 return OS <<
"ARCInstKind::AutoreleasepoolPop";
50 return OS <<
"ARCInstKind::NoopCast";
52 return OS <<
"ARCInstKind::FusedRetainAutorelease";
54 return OS <<
"ARCInstKind::FusedRetainAutoreleaseRV";
56 return OS <<
"ARCInstKind::LoadWeakRetained";
58 return OS <<
"ARCInstKind::StoreWeak";
60 return OS <<
"ARCInstKind::InitWeak";
62 return OS <<
"ARCInstKind::LoadWeak";
64 return OS <<
"ARCInstKind::MoveWeak";
66 return OS <<
"ARCInstKind::CopyWeak";
68 return OS <<
"ARCInstKind::DestroyWeak";
70 return OS <<
"ARCInstKind::StoreStrong";
72 return OS <<
"ARCInstKind::CallOrUser";
74 return OS <<
"ARCInstKind::Call";
76 return OS <<
"ARCInstKind::User";
78 return OS <<
"ARCInstKind::IntrinsicUser";
80 return OS <<
"ARCInstKind::None";
91 case Intrinsic::objc_autorelease:
93 case Intrinsic::objc_autoreleasePoolPop:
95 case Intrinsic::objc_autoreleasePoolPush:
97 case Intrinsic::objc_autoreleaseReturnValue:
99 case Intrinsic::objc_copyWeak:
101 case Intrinsic::objc_destroyWeak:
103 case Intrinsic::objc_initWeak:
105 case Intrinsic::objc_loadWeak:
107 case Intrinsic::objc_loadWeakRetained:
109 case Intrinsic::objc_moveWeak:
111 case Intrinsic::objc_release:
113 case Intrinsic::objc_retain:
115 case Intrinsic::objc_retainAutorelease:
117 case Intrinsic::objc_retainAutoreleaseReturnValue:
119 case Intrinsic::objc_retainAutoreleasedReturnValue:
121 case Intrinsic::objc_retainBlock:
123 case Intrinsic::objc_storeStrong:
125 case Intrinsic::objc_storeWeak:
127 case Intrinsic::objc_clang_arc_use:
129 case Intrinsic::objc_unsafeClaimAutoreleasedReturnValue:
131 case Intrinsic::objc_retainedObject:
133 case Intrinsic::objc_unretainedObject:
135 case Intrinsic::objc_unretainedPointer:
137 case Intrinsic::objc_retain_autorelease:
139 case Intrinsic::objc_sync_enter:
141 case Intrinsic::objc_sync_exit:
143 case Intrinsic::objc_clang_arc_noop_use:
144 case Intrinsic::objc_arc_annotation_topdown_bbstart:
145 case Intrinsic::objc_arc_annotation_topdown_bbend:
146 case Intrinsic::objc_arc_annotation_bottomup_bbstart:
147 case Intrinsic::objc_arc_annotation_bottomup_bbend:
161 case Intrinsic::returnaddress:
162 case Intrinsic::addressofreturnaddress:
163 case Intrinsic::frameaddress:
164 case Intrinsic::stacksave:
165 case Intrinsic::stackrestore:
166 case Intrinsic::vastart:
167 case Intrinsic::vacopy:
168 case Intrinsic::vaend:
169 case Intrinsic::objectsize:
170 case Intrinsic::prefetch:
171 case Intrinsic::stackprotector:
172 case Intrinsic::eh_return_i32:
173 case Intrinsic::eh_return_i64:
174 case Intrinsic::eh_typeid_for:
175 case Intrinsic::eh_dwarf_cfa:
176 case Intrinsic::eh_sjlj_lsda:
177 case Intrinsic::eh_sjlj_functioncontext:
178 case Intrinsic::init_trampoline:
179 case Intrinsic::adjust_trampoline:
180 case Intrinsic::lifetime_start:
181 case Intrinsic::lifetime_end:
182 case Intrinsic::invariant_start:
183 case Intrinsic::invariant_end:
185 case Intrinsic::dbg_declare:
186 case Intrinsic::dbg_value:
187 case Intrinsic::dbg_label:
203 case Intrinsic::memcpy:
204 case Intrinsic::memmove:
205 case Intrinsic::memset:
221 switch (
I->getOpcode()) {
222 case Instruction::Call: {
239 case Instruction::Invoke:
242 case Instruction::BitCast:
243 case Instruction::GetElementPtr:
244 case Instruction::Select:
245 case Instruction::PHI:
246 case Instruction::Ret:
247 case Instruction::Br:
248 case Instruction::Switch:
249 case Instruction::IndirectBr:
250 case Instruction::Alloca:
251 case Instruction::VAArg:
252 case Instruction::Add:
253 case Instruction::FAdd:
254 case Instruction::Sub:
255 case Instruction::FSub:
256 case Instruction::Mul:
257 case Instruction::FMul:
258 case Instruction::SDiv:
259 case Instruction::UDiv:
260 case Instruction::FDiv:
261 case Instruction::SRem:
262 case Instruction::URem:
263 case Instruction::FRem:
264 case Instruction::Shl:
265 case Instruction::LShr:
266 case Instruction::AShr:
267 case Instruction::And:
268 case Instruction::Or:
269 case Instruction::Xor:
270 case Instruction::SExt:
271 case Instruction::ZExt:
272 case Instruction::Trunc:
273 case Instruction::IntToPtr:
274 case Instruction::FCmp:
275 case Instruction::FPTrunc:
276 case Instruction::FPExt:
277 case Instruction::FPToUI:
278 case Instruction::FPToSI:
279 case Instruction::UIToFP:
280 case Instruction::SIToFP:
281 case Instruction::InsertElement:
282 case Instruction::ExtractElement:
283 case Instruction::ShuffleVector:
284 case Instruction::ExtractValue:
286 case Instruction::ICmp:
299 for (
const Use &U :
I->operands())
This file defines common analysis utilities used by the ObjC ARC Optimizer.
static bool isInertIntrinsic(unsigned ID)
static bool isUseOnlyIntrinsic(unsigned ID)
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation or the function signa...
This class represents a function call, abstracting a target machine's calling convention.
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
bool IsPotentialRetainableObjPtr(const Value *Op)
Test whether the given value is possible a retainable object pointer.
bool IsUser(ARCInstKind Class)
Test if the given class is a kind of user.
raw_ostream & operator<<(raw_ostream &OS, const ARCInstKind Class)
bool IsRetain(ARCInstKind Class)
Test if the given class is objc_retain or equivalent.
bool IsNeverTail(ARCInstKind Class)
Test if the given class represents instructions which are never safe to mark with the "tail" keyword.
bool IsAlwaysTail(ARCInstKind Class)
Test if the given class represents instructions which are always safe to mark with the "tail" keyword...
ARCInstKind GetCallSiteClass(const CallBase &CB)
Helper for GetARCInstKind.
bool IsAutorelease(ARCInstKind Class)
Test if the given class is objc_autorelease or equivalent.
ARCInstKind
Equivalence classes of instructions in the ARC Model.
@ DestroyWeak
objc_destroyWeak (derived)
@ FusedRetainAutorelease
objc_retainAutorelease
@ CallOrUser
could call objc_release and/or "use" pointers
@ StoreStrong
objc_storeStrong (derived)
@ LoadWeakRetained
objc_loadWeakRetained (primitive)
@ StoreWeak
objc_storeWeak (primitive)
@ AutoreleasepoolPop
objc_autoreleasePoolPop
@ AutoreleasepoolPush
objc_autoreleasePoolPush
@ InitWeak
objc_initWeak (derived)
@ Autorelease
objc_autorelease
@ LoadWeak
objc_loadWeak (derived)
@ None
anything that is inert from an ARC perspective.
@ MoveWeak
objc_moveWeak (derived)
@ User
could "use" a pointer
@ RetainRV
objc_retainAutoreleasedReturnValue
@ RetainBlock
objc_retainBlock
@ FusedRetainAutoreleaseRV
objc_retainAutoreleaseReturnValue
@ AutoreleaseRV
objc_autoreleaseReturnValue
@ Call
could call objc_release
@ CopyWeak
objc_copyWeak (derived)
@ NoopCast
objc_retainedObject, etc.
@ UnsafeClaimRV
objc_unsafeClaimAutoreleasedReturnValue
@ IntrinsicUser
llvm.objc.clang.arc.use
ARCInstKind GetFunctionClass(const Function *F)
Determine if F is one of the special known Functions.
bool IsForwarding(ARCInstKind Class)
Test if the given class represents instructions which return their argument verbatim.
ARCInstKind GetARCInstKind(const Value *V)
Map V to its ARCInstKind equivalence class.
bool CanInterruptRV(ARCInstKind Class)
Test whether the given instruction can autorelease any pointer or cause an autoreleasepool pop.
bool IsNoThrow(ARCInstKind Class)
Test if the given class represents instructions which are always safe to mark with the nounwind attri...
bool CanDecrementRefCount(ARCInstKind Kind)
Returns false if conservatively we can prove that any instruction mapped to this kind can not decreme...
bool IsNoopOnGlobal(ARCInstKind Class)
Test if the given class represents instructions which do nothing if passed a global variable.
bool IsNoopOnNull(ARCInstKind Class)
Test if the given class represents instructions which do nothing if passed a null pointer.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.