|
clang 23.0.0git
|
#include "CGDebugInfo.h"#include "CGObjCRuntime.h"#include "CodeGenFunction.h"#include "CodeGenModule.h"#include "CodeGenPGO.h"#include "ConstantEmitter.h"#include "TargetInfo.h"#include "clang/AST/ASTContext.h"#include "clang/AST/Attr.h"#include "clang/AST/DeclObjC.h"#include "clang/AST/NSAPI.h"#include "clang/AST/StmtObjC.h"#include "clang/Basic/Diagnostic.h"#include "clang/CodeGen/CGFunctionInfo.h"#include "clang/CodeGen/CodeGenABITypes.h"#include "llvm/Analysis/ObjCARCUtil.h"#include "llvm/BinaryFormat/MachO.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/InlineAsm.h"#include <optional>Go to the source code of this file.
Typedefs | |
| typedef llvm::PointerIntPair< llvm::Value *, 1, bool > | TryEmitResult |
| typedef llvm::function_ref< llvm::Value *(CodeGenFunction &CGF, llvm::Value *value)> | ValueTransform |
Functions | |
| static TryEmitResult | tryEmitARCRetainScalarExpr (CodeGenFunction &CGF, const Expr *e) |
| static RValue | AdjustObjCObjectType (CodeGenFunction &CGF, QualType ExpT, RValue Result) |
| Adjust the type of an Objective-C object that doesn't match up due to type erasure at various points, e.g., related result types or the use of parameterized classes. | |
| static llvm::Constant * | getNullForVariable (Address addr) |
| Given the address of a variable of pointer type, find the correct null to store into it. | |
| static bool | shouldExtendReceiverForInnerPointerMessage (const ObjCMessageExpr *message) |
| Decide whether to extend the lifetime of the receiver of a returns-inner-pointer message. | |
| static const Expr * | findWeakLValue (const Expr *E) |
| Given an expression of ObjC pointer type, check whether it was immediately loaded from an ARC __weak l-value. | |
| static std::optional< llvm::Value * > | tryGenerateSpecializedMessageSend (CodeGenFunction &CGF, QualType ResultType, llvm::Value *Receiver, const CallArgList &Args, Selector Sel, const ObjCMethodDecl *method, bool isClassMessage) |
| The ObjC runtime may provide entrypoints that are likely to be faster than an ordinary message send of the appropriate selector. | |
| static void | AppendFirstImpliedRuntimeProtocols (const ObjCProtocolDecl *PD, llvm::UniqueVector< const ObjCProtocolDecl * > &PDs) |
| static std::optional< llvm::Value * > | tryEmitSpecializedAllocInit (CodeGenFunction &CGF, const ObjCMessageExpr *OME) |
| Instead of '[[MyClass alloc] init]', try to generate 'objc_alloc_init(MyClass)'. | |
| static llvm::Value * | emitARCRetainLoadOfScalar (CodeGenFunction &CGF, LValue lvalue, QualType type) |
| static void | emitStructGetterCall (CodeGenFunction &CGF, ObjCIvarDecl *ivar, bool isAtomic, bool hasStrong) |
| emitStructGetterCall - Call the runtime function to load a property into the return value slot. | |
| static bool | hasUnalignedAtomics (llvm::Triple::ArchType arch) |
| Determine whether the given architecture supports unaligned atomic accesses. | |
| static CharUnits | getMaxAtomicAccessSize (CodeGenModule &CGM, llvm::Triple::ArchType arch) |
| Return the maximum size that permits atomic accesses for the given architecture. | |
| static bool | hasTrivialGetExpr (const ObjCPropertyImplDecl *propImpl) |
| static void | emitCPPObjectAtomicGetterCall (CodeGenFunction &CGF, llvm::Value *returnAddr, ObjCIvarDecl *ivar, llvm::Constant *AtomicHelperFn) |
| emitCPPObjectAtomicGetterCall - Call the runtime function to copy the ivar into the resturn slot. | |
| static llvm::Value * | emitCmdValueForGetterSetterBody (CodeGenFunction &CGF, ObjCMethodDecl *MD) |
| static void | emitStructSetterCall (CodeGenFunction &CGF, ObjCMethodDecl *OMD, ObjCIvarDecl *ivar) |
| emitStructSetterCall - Call the runtime function to store the value from the first formal parameter into the given ivar. | |
| static void | emitCPPObjectAtomicSetterCall (CodeGenFunction &CGF, ObjCMethodDecl *OMD, ObjCIvarDecl *ivar, llvm::Constant *AtomicHelperFn) |
| emitCPPObjectAtomicSetterCall - Call the runtime function to store the value from the first formal parameter into the given ivar, using the Cpp API for atomic Cpp objects with non-trivial copy assignment. | |
| static bool | hasTrivialSetExpr (const ObjCPropertyImplDecl *PID) |
| static bool | UseOptimizedSetter (CodeGenModule &CGM) |
| static void | destroyARCStrongWithStore (CodeGenFunction &CGF, Address addr, QualType type) |
| Like CodeGenFunction::destroyARCStrong, but do it with a call. | |
| static void | emitCXXDestructMethod (CodeGenFunction &CGF, ObjCImplementationDecl *impl) |
| static void | setARCRuntimeFunctionLinkage (CodeGenModule &CGM, llvm::Value *RTF) |
| static void | setARCRuntimeFunctionLinkage (CodeGenModule &CGM, llvm::FunctionCallee RTF) |
| static llvm::Function * | getARCIntrinsic (llvm::Intrinsic::ID IntID, CodeGenModule &CGM) |
| static llvm::Value * | emitARCValueOperation (CodeGenFunction &CGF, llvm::Value *value, llvm::Type *returnType, llvm::Function *&fn, llvm::Intrinsic::ID IntID, llvm::CallInst::TailCallKind tailKind=llvm::CallInst::TCK_None) |
| Perform an operation having the signature i8* (i8*) where a null input causes a no-op and returns null. | |
| static llvm::Value * | emitARCLoadOperation (CodeGenFunction &CGF, Address addr, llvm::Function *&fn, llvm::Intrinsic::ID IntID) |
| Perform an operation having the following signature: i8* (i8**) | |
| static llvm::Value * | emitARCStoreOperation (CodeGenFunction &CGF, Address addr, llvm::Value *value, llvm::Function *&fn, llvm::Intrinsic::ID IntID, bool ignored) |
| Perform an operation having the following signature: i8* (i8**, i8*) | |
| static void | emitARCCopyOperation (CodeGenFunction &CGF, Address dst, Address src, llvm::Function *&fn, llvm::Intrinsic::ID IntID) |
| Perform an operation having the following signature: void (i8**, i8**) | |
| static llvm::Value * | emitObjCValueOperation (CodeGenFunction &CGF, llvm::Value *value, llvm::Type *returnType, llvm::FunctionCallee &fn, StringRef fnName) |
| Perform an operation having the signature i8* (i8*) where a null input causes a no-op and returns null. | |
| static void | emitAutoreleasedReturnValueMarker (CodeGenFunction &CGF) |
| static llvm::Value * | emitOptimizedARCReturnCall (llvm::Value *value, bool IsRetainRV, CodeGenFunction &CGF) |
| static bool | shouldRetainObjCLifetime (Qualifiers::ObjCLifetime lifetime) |
| static TryEmitResult | tryEmitARCRetainLoadOfScalar (CodeGenFunction &CGF, LValue lvalue, QualType type) |
| static TryEmitResult | tryEmitARCRetainLoadOfScalar (CodeGenFunction &CGF, const Expr *e) |
| static llvm::Value * | emitARCOperationAfterCall (CodeGenFunction &CGF, llvm::Value *value, ValueTransform doAfterCall, ValueTransform doFallback) |
| Insert code immediately after a call. | |
| static llvm::Value * | emitARCRetainCallResult (CodeGenFunction &CGF, const Expr *e) |
| Given that the given expression is some sort of call (which does not return retained), emit a retain following it. | |
| static llvm::Value * | emitARCUnsafeClaimCallResult (CodeGenFunction &CGF, const Expr *e) |
| Given that the given expression is some sort of call (which does not return retained), perform an unsafeClaim following it. | |
| static bool | shouldEmitSeparateBlockRetain (const Expr *e) |
| Determine whether it might be important to emit a separate objc_retain_block on the result of the given expression, or whether it's okay to just emit it in a +1 context. | |
| static llvm::Value * | emitARCUnsafeUnretainedScalarExpr (CodeGenFunction &CGF, const Expr *e) |
| static unsigned | getBaseMachOPlatformID (const llvm::Triple &TT) |
| static llvm::Value * | emitIsPlatformVersionAtLeast (CodeGenFunction &CGF, const VersionTuple &Version) |
| static bool | isFoundationNeededForDarwinAvailabilityCheck (const llvm::Triple &TT, const VersionTuple &TargetVersion) |
| typedef llvm::PointerIntPair<llvm::Value*,1,bool> TryEmitResult |
Definition at line 37 of file CGObjC.cpp.
| typedef llvm::function_ref<llvm::Value *(CodeGenFunction &CGF, llvm::Value *value)> ValueTransform |
Definition at line 3028 of file CGObjC.cpp.
|
static |
Adjust the type of an Objective-C object that doesn't match up due to type erasure at various points, e.g., related result types or the use of parameterized classes.
Definition at line 291 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::RValue::get(), and clang::Type::isObjCRetainableType().
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCMessageExpr().
|
static |
Definition at line 470 of file CGObjC.cpp.
References AppendFirstImpliedRuntimeProtocols(), clang::ObjCProtocolDecl::getCanonicalDecl(), clang::ObjCProtocolDecl::isNonRuntimeProtocol(), and clang::ObjCProtocolDecl::protocols().
Referenced by AppendFirstImpliedRuntimeProtocols(), and clang::CodeGen::CGObjCRuntime::GetRuntimeProtocolList().
|
static |
Like CodeGenFunction::destroyARCStrong, but do it with a call.
Definition at line 1736 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::EmitARCStoreStrongCall(), getNullForVariable(), and clang::ast_matchers::type.
Referenced by emitCXXDestructMethod().
|
static |
Perform an operation having the following signature: void (i8**, i8**)
Definition at line 2299 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), clang::CodeGen::Address::emitRawPointer(), getARCIntrinsic(), clang::CodeGen::Address::getType(), and clang::CodeGen::CodeGenTypeCache::Int8PtrPtrTy.
Referenced by clang::CodeGen::CodeGenFunction::EmitARCCopyWeak(), and clang::CodeGen::CodeGenFunction::EmitARCMoveWeak().
|
static |
Perform an operation having the following signature: i8* (i8**)
Definition at line 2264 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), clang::CodeGen::Address::emitRawPointer(), and getARCIntrinsic().
Referenced by clang::CodeGen::CodeGenFunction::EmitARCLoadWeak(), and clang::CodeGen::CodeGenFunction::EmitARCLoadWeakRetained().
|
static |
Insert code immediately after a call.
Definition at line 3034 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::Builder, emitARCOperationAfterCall(), and clang::isa().
Referenced by emitARCOperationAfterCall(), emitARCRetainCallResult(), and emitARCUnsafeClaimCallResult().
|
static |
Given that the given expression is some sort of call (which does not return retained), emit a retain following it.
Definition at line 3090 of file CGObjC.cpp.
References emitARCOperationAfterCall(), clang::CodeGen::CodeGenFunction::EmitARCRetainAutoreleasedReturnValue(), clang::CodeGen::CodeGenFunction::EmitARCRetainNonBlock(), and clang::CodeGen::CodeGenFunction::EmitScalarExpr().
Referenced by clang::CodeGen::CodeGenFunction::EmitARCReclaimReturnedObject().
|
static |
Definition at line 3506 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::EmitARCRetain(), tryEmitARCRetainLoadOfScalar(), and clang::ast_matchers::type.
Referenced by clang::CodeGen::CodeGenFunction::generateObjCGetterBody().
|
static |
Perform an operation having the following signature: i8* (i8**, i8*)
Definition at line 2275 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), clang::CodeGen::Address::emitRawPointer(), getARCIntrinsic(), clang::CodeGen::Address::getElementType(), clang::CodeGen::CodeGenTypeCache::Int8PtrPtrTy, and clang::CodeGen::CodeGenTypeCache::Int8PtrTy.
Referenced by clang::CodeGen::CodeGenFunction::EmitARCInitWeak(), and clang::CodeGen::CodeGenFunction::EmitARCStoreWeak().
|
static |
Given that the given expression is some sort of call (which does not return retained), perform an unsafeClaim following it.
Definition at line 3104 of file CGObjC.cpp.
References emitARCOperationAfterCall(), clang::CodeGen::CodeGenFunction::EmitARCUnsafeClaimAutoreleasedReturnValue(), and clang::CodeGen::CodeGenFunction::EmitScalarExpr().
Referenced by clang::CodeGen::CodeGenFunction::EmitARCReclaimReturnedObject().
|
static |
Definition at line 3636 of file CGObjC.cpp.
Referenced by clang::CodeGen::CodeGenFunction::EmitARCUnsafeUnretainedScalarExpr().
|
static |
Perform an operation having the signature i8* (i8*) where a null input causes a no-op and returns null.
Definition at line 2240 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), getARCIntrinsic(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, and clang::isa().
Referenced by clang::CodeGen::CodeGenFunction::EmitARCAutorelease(), clang::CodeGen::CodeGenFunction::EmitARCAutoreleaseReturnValue(), clang::CodeGen::CodeGenFunction::EmitARCRetainAutoreleaseNonBlock(), clang::CodeGen::CodeGenFunction::EmitARCRetainAutoreleaseReturnValue(), clang::CodeGen::CodeGenFunction::EmitARCRetainBlock(), clang::CodeGen::CodeGenFunction::EmitARCRetainNonBlock(), and emitOptimizedARCReturnCall().
|
static |
Definition at line 2400 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::TargetCodeGenInfo::getARCRetainAutoreleasedReturnValueMarker(), clang::CodeGen::CodeGenFunction::getBundlesForFunclet(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getObjCEntrypoints(), clang::CodeGen::CodeGenModule::getTargetCodeGenInfo(), clang::CodeGen::ObjCEntrypoints::retainAutoreleasedReturnValueMarker, clang::ast_matchers::type, and clang::CodeGen::CodeGenTypeCache::VoidTy.
Referenced by emitOptimizedARCReturnCall().
|
static |
Definition at line 1148 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::ObjCMethodDecl::getCmdDecl(), clang::CodeGen::CodeGenFunction::getContext(), clang::ASTContext::getObjCSelType(), and clang::ObjCMethodDecl::isDirectMethod().
Referenced by clang::CodeGen::CodeGenFunction::generateObjCGetterBody(), and clang::CodeGen::CodeGenFunction::generateObjCSetterBody().
|
static |
emitCPPObjectAtomicGetterCall - Call the runtime function to copy the ivar into the resturn slot.
Definition at line 1114 of file CGObjC.cpp.
References clang::CodeGen::CallArgList::add(), clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionCall(), clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitCall(), clang::CodeGen::CodeGenFunction::EmitLValueForIvar(), clang::CodeGen::CGCallee::forDirect(), clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CGObjCRuntime::GetCppAtomicObjectGetFunction(), clang::CodeGen::CodeGenModule::getObjCRuntime(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::CodeGenFunction::getTypes(), clang::CodeGen::CodeGenFunction::LoadObjCSelf(), clang::CodeGen::CodeGenFunction::TypeOfSelfObject(), clang::ASTContext::VoidPtrTy, and clang::ASTContext::VoidTy.
Referenced by clang::CodeGen::CodeGenFunction::generateObjCGetterBody().
|
static |
emitCPPObjectAtomicSetterCall - Call the runtime function to store the value from the first formal parameter into the given ivar, using the Cpp API for atomic Cpp objects with non-trivial copy assignment.
Definition at line 1430 of file CGObjC.cpp.
References clang::CodeGen::CallArgList::add(), clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionCall(), clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitCall(), clang::CodeGen::CodeGenFunction::EmitLValue(), clang::CodeGen::CodeGenFunction::EmitLValueForIvar(), clang::CodeGen::CGCallee::forDirect(), clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CGObjCRuntime::GetCppAtomicObjectSetFunction(), clang::QualType::getNonReferenceType(), clang::CodeGen::CodeGenModule::getObjCRuntime(), clang::CodeGen::LValue::getPointer(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenFunction::getTypes(), clang::CodeGen::CodeGenFunction::LoadObjCSelf(), clang::ObjCMethodDecl::param_begin(), clang::CodeGen::CodeGenFunction::TypeOfSelfObject(), clang::VK_LValue, clang::ASTContext::VoidPtrTy, and clang::ASTContext::VoidTy.
Referenced by clang::CodeGen::CodeGenFunction::generateObjCSetterBody().
|
static |
Definition at line 1743 of file CGObjC.cpp.
References clang::ObjCInterfaceDecl::all_declared_ivar_begin(), destroyARCStrongWithStore(), clang::QualType::DK_objc_strong_lifetime, clang::CodeGen::EHCleanup, clang::CodeGen::CodeGenFunction::EHStack, clang::ObjCImplDecl::getClassInterface(), clang::CodeGen::CodeGenFunction::getCleanupKind(), clang::CodeGen::CodeGenFunction::getDestroyer(), clang::ObjCIvarDecl::getNextIvar(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenFunction::LoadObjCSelf(), clang::CodeGen::CodeGenFunction::RunCleanupsScope::requiresCleanups(), and clang::ast_matchers::type.
Referenced by clang::CodeGen::CodeGenFunction::GenerateObjCCtorDtorMethod().
|
static |
Definition at line 4024 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), getBaseMachOPlatformID(), clang::CodeGen::CodeGenModule::getTarget(), clang::TargetInfo::getTriple(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenModule::IsPlatformVersionAtLeastFn, and clang::Min.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinAvailable().
|
static |
Perform an operation having the signature i8* (i8*) where a null input causes a no-op and returns null.
Definition at line 2316 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::Call, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenFunction::EmitCallOrInvoke(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, and clang::isa().
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCAlloc(), clang::CodeGen::CodeGenFunction::EmitObjCAllocInit(), clang::CodeGen::CodeGenFunction::EmitObjCAllocWithZone(), clang::CodeGen::CodeGenFunction::EmitObjCAutorelease(), and clang::CodeGen::CodeGenFunction::EmitObjCRetainNonBlock().
|
static |
Definition at line 2439 of file CGObjC.cpp.
References Arch, clang::cast(), clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitARCNoopIntrinsicUse(), emitARCValueOperation(), emitAutoreleasedReturnValueMarker(), getARCIntrinsic(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getObjCEntrypoints(), clang::CodeGen::CodeGenModule::getTargetCodeGenInfo(), clang::CodeGen::CodeGenModule::getTriple(), clang::CodeGen::TargetCodeGenInfo::markARCOptimizedReturnCallsAsNoTail(), clang::CodeGen::ObjCEntrypoints::objc_retainAutoreleasedReturnValue, and clang::CodeGen::ObjCEntrypoints::objc_unsafeClaimAutoreleasedReturnValue.
Referenced by clang::CodeGen::CodeGenFunction::EmitARCRetainAutoreleasedReturnValue(), and clang::CodeGen::CodeGenFunction::EmitARCUnsafeClaimAutoreleasedReturnValue().
|
static |
emitStructGetterCall - Call the runtime function to load a property into the return value slot.
Definition at line 845 of file CGObjC.cpp.
References clang::CodeGen::CallArgList::add(), clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionCall(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitCall(), clang::CodeGen::CodeGenFunction::EmitLValueForIvar(), clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::CGCallee::forDirect(), clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CGObjCRuntime::GetGetStructFunction(), clang::CodeGen::CodeGenModule::getObjCRuntime(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::CodeGenModule::getSize(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenFunction::getTypes(), clang::ASTContext::getTypeSizeInChars(), clang::CodeGen::CodeGenFunction::LoadObjCSelf(), clang::CodeGen::CodeGenFunction::ReturnValue, and clang::CodeGen::CodeGenFunction::TypeOfSelfObject().
Referenced by clang::CodeGen::CodeGenFunction::generateObjCGetterBody().
|
static |
emitStructSetterCall - Call the runtime function to store the value from the first formal parameter into the given ivar.
Definition at line 1387 of file CGObjC.cpp.
References clang::CodeGen::CallArgList::add(), clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionCall(), clang::ASTContext::BoolTy, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitCall(), clang::CodeGen::CodeGenFunction::EmitLValue(), clang::CodeGen::CodeGenFunction::EmitLValueForIvar(), clang::CodeGen::CGCallee::forDirect(), clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenFunction::getContext(), clang::QualType::getNonReferenceType(), clang::CodeGen::CodeGenModule::getObjCRuntime(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::CGObjCRuntime::GetSetStructFunction(), clang::CodeGen::CodeGenModule::getSize(), clang::ASTContext::getSizeType(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenFunction::getTypes(), clang::ASTContext::getTypeSizeInChars(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::CodeGen::CodeGenFunction::LoadObjCSelf(), clang::ObjCMethodDecl::param_begin(), clang::CodeGen::CodeGenFunction::TypeOfSelfObject(), clang::VK_LValue, clang::ASTContext::VoidPtrTy, and clang::ASTContext::VoidTy.
Referenced by clang::CodeGen::CodeGenFunction::generateObjCSetterBody().
Given an expression of ObjC pointer type, check whether it was immediately loaded from an ARC __weak l-value.
Definition at line 368 of file CGObjC.cpp.
References clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::Type::isObjCRetainableType(), and clang::Qualifiers::OCL_Weak.
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCMessageExpr().
|
static |
Definition at line 2230 of file CGObjC.cpp.
References clang::CodeGen::CodeGenModule::getIntrinsic(), and setARCRuntimeFunctionLinkage().
Referenced by emitARCCopyOperation(), clang::CodeGen::CodeGenFunction::EmitARCDestroyWeak(), emitARCLoadOperation(), clang::CodeGen::CodeGenFunction::EmitARCRelease(), emitARCStoreOperation(), clang::CodeGen::CodeGenFunction::EmitARCStoreStrongCall(), emitARCValueOperation(), clang::CodeGen::CodeGenFunction::EmitObjCAutoreleasePoolPop(), clang::CodeGen::CodeGenFunction::EmitObjCAutoreleasePoolPush(), and emitOptimizedARCReturnCall().
|
static |
Definition at line 4004 of file CGObjC.cpp.
Referenced by emitIsPlatformVersionAtLeast().
|
static |
Return the maximum size that permits atomic accesses for the given architecture.
Definition at line 883 of file CGObjC.cpp.
References clang::CharUnits::fromQuantity(), and clang::CodeGen::CodeGenTypeCache::PointerSizeInBytes.
|
static |
Given the address of a variable of pointer type, find the correct null to store into it.
Definition at line 46 of file CGObjC.cpp.
References clang::cast(), clang::CodeGen::Address::getElementType(), and clang::ast_matchers::type.
Referenced by destroyARCStrongWithStore(), clang::CodeGen::CodeGenFunction::EmitARCDestroyStrong(), clang::CodeGen::CodeGenFunction::EmitObjCMessageExpr(), and tryEmitARCRetainLoadOfScalar().
|
static |
Definition at line 1089 of file CGObjC.cpp.
References clang::ObjCPropertyImplDecl::getGetterCXXConstructor(), clang::isa(), and clang::Expr::isGLValue().
Referenced by clang::CodeGen::CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction(), and clang::CodeGen::CodeGenFunction::generateObjCGetterBody().
|
static |
Definition at line 1464 of file CGObjC.cpp.
References clang::ObjCPropertyImplDecl::getSetterCXXAssignment(), and clang::isa().
Referenced by clang::CodeGen::CodeGenFunction::GenerateObjCAtomicSetterCopyHelperFunction(), and clang::CodeGen::CodeGenFunction::generateObjCSetterBody().
|
static |
Determine whether the given architecture supports unaligned atomic accesses.
They don't have to be fast, just faster than a function call and a mutex.
Definition at line 875 of file CGObjC.cpp.
|
static |
Definition at line 4085 of file CGObjC.cpp.
References clang::TargetVersion.
|
static |
Definition at line 2225 of file CGObjC.cpp.
References setARCRuntimeFunctionLinkage().
|
static |
Definition at line 2213 of file CGObjC.cpp.
References clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getTriple(), clang::ObjCRuntime::hasNativeARC(), and clang::LangOptions::ObjCRuntime.
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCAutoreleasePoolPop(), clang::CodeGen::CodeGenFunction::EmitObjCRelease(), getARCIntrinsic(), and setARCRuntimeFunctionLinkage().
Determine whether it might be important to emit a separate objc_retain_block on the result of the given expression, or whether it's okay to just emit it in a +1 context.
Definition at line 3130 of file CGObjC.cpp.
References clang::cast(), clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::isa(), clang::Type::isBlockPointerType(), and shouldEmitSeparateBlockRetain().
Referenced by clang::CodeGen::CodeGenFunction::EmitARCExtendBlockObject(), and shouldEmitSeparateBlockRetain().
|
static |
Decide whether to extend the lifetime of the receiver of a returns-inner-pointer message.
Definition at line 309 of file CGObjC.cpp.
References clang::ObjCMessageExpr::Class, clang::CastExpr::getCastKind(), clang::DeclRefExpr::getDecl(), clang::ObjCMessageExpr::getInstanceReceiver(), clang::QualType::getObjCLifetime(), clang::ObjCMessageExpr::getReceiverKind(), clang::CastExpr::getSubExpr(), clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::ObjCMessageExpr::Instance, clang::isa(), clang::Qualifiers::OCL_Strong, clang::ObjCMessageExpr::SuperClass, and clang::ObjCMessageExpr::SuperInstance.
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCMessageExpr().
|
static |
Definition at line 2950 of file CGObjC.cpp.
References clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, and clang::Qualifiers::OCL_Weak.
Referenced by tryEmitARCRetainLoadOfScalar(), and tryEmitARCRetainLoadOfScalar().
|
static |
Definition at line 2979 of file CGObjC.cpp.
References clang::cast(), clang::CodeGen::CodeGenFunction::EmitLoadOfLValue(), clang::CodeGen::CodeGenFunction::EmitLValue(), clang::CodeGen::CodeGenFunction::emitScalarConstant(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::CodeGenFunction::getLangOpts(), getNullForVariable(), clang::CodeGen::RValue::getScalarVal(), clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::isa(), clang::Expr::isXValue(), clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, shouldRetainObjCLifetime(), tryEmitARCRetainLoadOfScalar(), clang::CodeGen::CodeGenFunction::tryEmitAsConstant(), and clang::ast_matchers::type.
|
static |
Definition at line 2965 of file CGObjC.cpp.
References clang::CodeGen::CodeGenFunction::EmitARCLoadWeakRetained(), clang::CodeGen::CodeGenFunction::EmitLoadOfLValue(), clang::CodeGen::RValue::getScalarVal(), clang::Qualifiers::OCL_Weak, shouldRetainObjCLifetime(), and clang::ast_matchers::type.
Referenced by emitARCRetainLoadOfScalar(), and tryEmitARCRetainLoadOfScalar().
|
static |
Definition at line 3502 of file CGObjC.cpp.
Referenced by clang::CodeGen::CodeGenFunction::EmitARCExtendBlockObject(), clang::CodeGen::CodeGenFunction::EmitARCRetainAutoreleaseScalarExpr(), clang::CodeGen::CodeGenFunction::EmitARCRetainScalarExpr(), clang::CodeGen::CodeGenFunction::EmitARCStoreStrong(), and clang::CodeGen::CodeGenFunction::EmitObjCMessageExpr().
|
static |
Instead of '[[MyClass alloc] init]', try to generate 'objc_alloc_init(MyClass)'.
This provides a code size improvement on the caller side, as well as the optimized objc_alloc.
Definition at line 543 of file CGObjC.cpp.
References clang::Type::castAs(), clang::CodeGen::CodeGenFunction::CGM, clang::ObjCMessageExpr::Class, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CodeGenFunction::EmitObjCAllocInit(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CGObjCRuntime::GetClass(), clang::ObjCMessageExpr::getInstanceReceiver(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::Selector::getNameForSlot(), clang::CodeGen::CodeGenModule::getObjCRuntime(), clang::ObjCMessageExpr::getReceiverKind(), clang::ObjCMessageExpr::getSelector(), clang::Expr::getType(), clang::Expr::IgnoreParenCasts(), clang::ObjCMessageExpr::Instance, clang::Type::isObjCObjectPointerType(), clang::Selector::isUnarySelector(), clang::LangOptions::ObjCRuntime, clang::ObjCMessageExpr::SuperClass, and clang::ObjCMessageExpr::SuperInstance.
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCMessageExpr().
|
static |
The ObjC runtime may provide entrypoints that are likely to be faster than an ordinary message send of the appropriate selector.
The entrypoints are guaranteed to be equivalent to just sending the corresponding message. If the entrypoint is implemented naively as just a message send, using it is a trade-off: it sacrifices a few cycles of overhead to save a small amount of code. However, it's possible for runtimes to detect and special-case classes that use "standard" behavior; if that's dynamically a large proportion of all objects, using the entrypoint will also be faster than using a message send.
If the runtime does support a required entrypoint, then this method will generate a call and return the resulting value. Otherwise it will return std::nullopt and the caller can generate a msgSend instead.
Definition at line 395 of file CGObjC.cpp.
References clang::CodeGen::ARCPreciseLifetime, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CodeGenFunction::EmitObjCAlloc(), clang::CodeGen::CodeGenFunction::EmitObjCAllocWithZone(), clang::CodeGen::CodeGenFunction::EmitObjCAutorelease(), clang::CodeGen::CodeGenFunction::EmitObjCRelease(), clang::CodeGen::CodeGenFunction::EmitObjCRetainNonBlock(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::Selector::getMethodFamily(), clang::Selector::getNameForSlot(), clang::Selector::getNumArgs(), clang::isa(), clang::Selector::isKeywordSelector(), clang::Type::isObjCObjectPointerType(), clang::Selector::isUnarySelector(), clang::Type::isVoidType(), clang::LangOptionsBase::NonGC, clang::LangOptions::ObjCRuntime, clang::OMF_alloc, clang::OMF_autorelease, clang::OMF_release, and clang::OMF_retain.
Referenced by clang::CodeGen::CGObjCRuntime::GeneratePossiblySpecializedMessageSend().
|
static |
Definition at line 1488 of file CGObjC.cpp.
References clang::CodeGen::CodeGenModule::getLangOpts(), clang::ObjCRuntime::hasOptimizedSetter(), clang::LangOptionsBase::NonGC, and clang::LangOptions::ObjCRuntime.
Referenced by clang::CodeGen::CodeGenFunction::generateObjCSetterBody().