28 using namespace llvm::objcarc;
34 return OS <<
"ARCInstKind::Retain";
36 return OS <<
"ARCInstKind::RetainRV";
38 return OS <<
"ARCInstKind::ClaimRV";
40 return OS <<
"ARCInstKind::RetainBlock";
42 return OS <<
"ARCInstKind::Release";
44 return OS <<
"ARCInstKind::Autorelease";
46 return OS <<
"ARCInstKind::AutoreleaseRV";
48 return OS <<
"ARCInstKind::AutoreleasepoolPush";
50 return OS <<
"ARCInstKind::AutoreleasepoolPop";
52 return OS <<
"ARCInstKind::NoopCast";
54 return OS <<
"ARCInstKind::FusedRetainAutorelease";
56 return OS <<
"ARCInstKind::FusedRetainAutoreleaseRV";
58 return OS <<
"ARCInstKind::LoadWeakRetained";
60 return OS <<
"ARCInstKind::StoreWeak";
62 return OS <<
"ARCInstKind::InitWeak";
64 return OS <<
"ARCInstKind::LoadWeak";
66 return OS <<
"ARCInstKind::MoveWeak";
68 return OS <<
"ARCInstKind::CopyWeak";
70 return OS <<
"ARCInstKind::DestroyWeak";
72 return OS <<
"ARCInstKind::StoreStrong";
74 return OS <<
"ARCInstKind::CallOrUser";
76 return OS <<
"ARCInstKind::Call";
78 return OS <<
"ARCInstKind::User";
80 return OS <<
"ARCInstKind::IntrinsicUser";
82 return OS <<
"ARCInstKind::None";
122 .
Case(
"objc_retainAutoreleaseReturnValue",
130 if (Pte->getElementType()->isIntegerTy(8))
145 if (
PointerType *Pte = dyn_cast<PointerType>(PTy->getElementType()))
146 if (Pte->getElementType()->isIntegerTy(8))
148 Type *ETy1 = PTy1->getElementType();
157 if (
PointerType *Pte1 = dyn_cast<PointerType>(ETy1))
158 if (Pte1->getElementType()->isIntegerTy(8))
166 .
Case(
"llvm.arc.annotation.topdown.bbstart",
168 .
Case(
"llvm.arc.annotation.topdown.bbend",
170 .
Case(
"llvm.arc.annotation.bottomup.bbstart",
172 .
Case(
"llvm.arc.annotation.bottomup.bbend",
186 case Intrinsic::returnaddress:
187 case Intrinsic::addressofreturnaddress:
188 case Intrinsic::frameaddress:
189 case Intrinsic::stacksave:
190 case Intrinsic::stackrestore:
191 case Intrinsic::vastart:
192 case Intrinsic::vacopy:
193 case Intrinsic::vaend:
194 case Intrinsic::objectsize:
196 case Intrinsic::stackprotector:
197 case Intrinsic::eh_return_i32:
198 case Intrinsic::eh_return_i64:
199 case Intrinsic::eh_typeid_for:
200 case Intrinsic::eh_dwarf_cfa:
201 case Intrinsic::eh_sjlj_lsda:
202 case Intrinsic::eh_sjlj_functioncontext:
203 case Intrinsic::init_trampoline:
204 case Intrinsic::adjust_trampoline:
205 case Intrinsic::lifetime_start:
206 case Intrinsic::lifetime_end:
207 case Intrinsic::invariant_start:
208 case Intrinsic::invariant_end:
210 case Intrinsic::dbg_declare:
211 case Intrinsic::dbg_value:
227 case Intrinsic::memcpy:
228 case Intrinsic::memmove:
229 case Intrinsic::memset:
245 switch (
I->getOpcode()) {
263 case Instruction::Invoke:
266 case Instruction::BitCast:
267 case Instruction::GetElementPtr:
269 case Instruction::PHI:
271 case Instruction::Br:
273 case Instruction::IndirectBr:
274 case Instruction::Alloca:
275 case Instruction::VAArg:
277 case Instruction::FAdd:
278 case Instruction::Sub:
279 case Instruction::FSub:
280 case Instruction::Mul:
281 case Instruction::FMul:
282 case Instruction::SDiv:
283 case Instruction::UDiv:
284 case Instruction::FDiv:
285 case Instruction::SRem:
286 case Instruction::URem:
287 case Instruction::FRem:
288 case Instruction::Shl:
289 case Instruction::LShr:
290 case Instruction::AShr:
294 case Instruction::SExt:
295 case Instruction::ZExt:
296 case Instruction::Trunc:
297 case Instruction::IntToPtr:
298 case Instruction::FCmp:
299 case Instruction::FPTrunc:
300 case Instruction::FPExt:
301 case Instruction::FPToUI:
302 case Instruction::FPToSI:
303 case Instruction::UIToFP:
304 case Instruction::SIToFP:
305 case Instruction::InsertElement:
306 case Instruction::ExtractElement:
307 case Instruction::ShuffleVector:
308 case Instruction::ExtractValue:
310 case Instruction::ICmp:
ARCInstKind GetARCInstKind(const Value *V)
Map V to its ARCInstKind equivalence class.
objc_destroyWeak (derived)
bool IsUser(ARCInstKind Class)
Test if the given class is a kind of user.
LLVM Argument representation.
objc_loadWeakRetained (primitive)
could call objc_release and/or "use" pointers
This class represents a function call, abstracting a target machine's calling convention.
objc_retainedObject, etc.
Type * getElementType() const
bool IsNoopOnNull(ARCInstKind Class)
Test if the given class represents instructions which do nothing if passed a null pointer...
bool IsForwarding(ARCInstKind Class)
Test if the given class represents instructions which return their argument verbatim.
StringRef getName() const
Return a constant reference to the value's name.
objc_autoreleaseReturnValue
A Use represents the edge between a Value definition and its users.
LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(const T &Value) const
objc_retainAutoreleasedReturnValue
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Case(const char(&S)[N], const T &Value)
bool IsPotentialRetainableObjPtr(const Value *Op)
Test whether the given value is possible a retainable object pointer.
bool IsAlwaysTail(ARCInstKind Class)
Test if the given class represents instructions which are always safe to mark with the "tail" keyword...
Class to represent pointers.
raw_ostream & operator<<(raw_ostream &OS, const ARCInstKind Class)
A switch()-like statement whose cases are string literals.
The instances of the Type class are immutable: once they are created, they are never changed...
APInt Or(const APInt &LHS, const APInt &RHS)
Bitwise OR function for APInt.
APInt Xor(const APInt &LHS, const APInt &RHS)
Bitwise XOR function for APInt.
ARCInstKind GetFunctionClass(const Function *F)
Determine if F is one of the special known Functions.
This file defines common analysis utilities used by the ObjC ARC Optimizer.
anything that is inert from an ARC perspective.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool CanDecrementRefCount(ARCInstKind Kind)
Returns false if conservatively we can prove that any instruction mapped to this kind can not decreme...
Iterator for intrusive lists based on ilist_node.
static bool isInertIntrinsic(unsigned ID)
ARCInstKind
Equivalence classes of instructions in the ARC Model.
Type * getType() const
All values are typed, get the type of this value.
bool IsNoThrow(ARCInstKind Class)
Test if the given class represents instructions which are always safe to mark with the nounwind attri...
objc_unsafeClaimAutoreleasedReturnValue
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
bool isIntegerTy() const
True if this is an instance of IntegerType.
objc_storeStrong (derived)
APInt And(const APInt &LHS, const APInt &RHS)
Bitwise AND function for APInt.
bool IsRetain(ARCInstKind Class)
Test if the given class is objc_retain or equivalent.
static bool isUseOnlyIntrinsic(unsigned ID)
objc_storeWeak (primitive)
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
ARCInstKind GetCallSiteClass(ImmutableCallSite CS)
Helper for GetARCInstKind.
objc_retainAutoreleaseReturnValue
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream...
bool CanInterruptRV(ARCInstKind Class)
Test whether the given instruction can autorelease any pointer or cause an autoreleasepool pop...
bool IsNeverTail(ARCInstKind Class)
Test if the given class represents instructions which are never safe to mark with the "tail" keyword...
bool IsAutorelease(ARCInstKind Class)
Test if the given class is objc_autorelease or equivalent.