LLVM: lib/Analysis/ObjCARCInstKind.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
24
25using namespace llvm;
27
30 switch (Class) {
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";
81 }
83}
84
86
88 switch (ID) {
89 default:
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:
148
149
150
151
153 }
154}
155
156
157
159
160 switch (ID) {
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:
184
185 case Intrinsic::dbg_declare:
186 case Intrinsic::dbg_value:
187 case Intrinsic::dbg_label:
188
189 return true;
190 default:
191 return false;
192 }
193}
194
195
196
198
199
200
201
202 switch (ID) {
203 case Intrinsic::memcpy:
204 case Intrinsic::memmove:
205 case Intrinsic::memset:
206 return true;
207 default:
208 return false;
209 }
210}
211
212
215
216
217
218
219
220
221 switch (I->getOpcode()) {
222 case Instruction::Call: {
224
228 return Class;
234 }
235
236
238 }
239 case Instruction::Invoke:
240
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:
285 break;
286 case Instruction::ICmp:
287
288
289
292 break;
293 default:
294
295
296
297
298
299 for (const Use &U : I->operands())
302 }
303 }
304
305
307}
308
309
311 switch (Class) {
315 return true;
338 return false;
339 }
341}
342
343
345 switch (Class) {
348 return true;
349
350
374 return false;
375 }
377}
378
379
381 switch (Class) {
384 return true;
408 return false;
409 }
411}
412
413
414
416 switch (Class) {
423 return true;
443 return false;
444 }
446}
447
448
449
451 switch (Class) {
459 return true;
478 return false;
479 }
481}
482
483
484
486 switch (Class) {
496 return true;
513 return false;
514 }
516}
517
518
519
521
522 switch (Class) {
527 return true;
549 return false;
550 }
552}
553
554
555
557
558
559
560
561 switch (Class) {
563 return true;
588 return false;
589 }
591}
592
593
594
596
597
598 switch (Class) {
607 return true;
625 return false;
626 }
628}
629
630
631
632
633
635 switch (Class) {
643 return true;
662 return false;
663 }
665}
666
668 switch (Kind) {
679 return false;
680
681
682
683
684
700 return true;
701 }
702
704}
This file defines common analysis utilities used by the ObjC ARC Optimizer.
static bool isInertIntrinsic(unsigned ID)
Definition ObjCARCInstKind.cpp:158
static bool isUseOnlyIntrinsic(unsigned ID)
Definition ObjCARCInstKind.cpp:197
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.
Definition ObjCARCInstKind.cpp:310
raw_ostream & operator<<(raw_ostream &OS, const ARCInstKind Class)
Definition ObjCARCInstKind.cpp:28
bool IsRetain(ARCInstKind Class)
Test if the given class is objc_retain or equivalent.
Definition ObjCARCInstKind.cpp:344
bool IsNeverTail(ARCInstKind Class)
Test if the given class represents instructions which are never safe to mark with the "tail" keyword.
Definition ObjCARCInstKind.cpp:556
bool IsAlwaysTail(ARCInstKind Class)
Test if the given class represents instructions which are always safe to mark with the "tail" keyword...
Definition ObjCARCInstKind.cpp:520
ARCInstKind GetCallSiteClass(const CallBase &CB)
Helper for GetARCInstKind.
bool IsAutorelease(ARCInstKind Class)
Test if the given class is objc_autorelease or equivalent.
Definition ObjCARCInstKind.cpp:380
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.
Definition ObjCARCInstKind.cpp:85
bool IsForwarding(ARCInstKind Class)
Test if the given class represents instructions which return their argument verbatim.
Definition ObjCARCInstKind.cpp:415
ARCInstKind GetARCInstKind(const Value *V)
Map V to its ARCInstKind equivalence class.
Definition ObjCARCInstKind.cpp:213
bool CanInterruptRV(ARCInstKind Class)
Test whether the given instruction can autorelease any pointer or cause an autoreleasepool pop.
Definition ObjCARCInstKind.cpp:634
bool IsNoThrow(ARCInstKind Class)
Test if the given class represents instructions which are always safe to mark with the nounwind attri...
Definition ObjCARCInstKind.cpp:595
bool CanDecrementRefCount(ARCInstKind Kind)
Returns false if conservatively we can prove that any instruction mapped to this kind can not decreme...
Definition ObjCARCInstKind.cpp:667
bool IsNoopOnGlobal(ARCInstKind Class)
Test if the given class represents instructions which do nothing if passed a global variable.
Definition ObjCARCInstKind.cpp:485
bool IsNoopOnNull(ARCInstKind Class)
Test if the given class represents instructions which do nothing if passed a null pointer.
Definition ObjCARCInstKind.cpp:450
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast - Return the argument parameter cast to the specified type.
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.