Go to the documentation of this file.
15 #ifndef LLVM_CLANG_LIB_CODEGEN_CGOBJCRUNTIME_H
16 #define LLVM_CLANG_LIB_CODEGEN_CGOBJCRUNTIME_H
23 #include "llvm/ADT/UniqueVector.h"
37 class CodeGenFunction;
42 class ObjCAtThrowStmt;
43 class ObjCAtSynchronizedStmt;
44 class ObjCContainerDecl;
45 class ObjCCategoryImplDecl;
46 class ObjCImplementationDecl;
47 class ObjCInterfaceDecl;
48 class ObjCMessageExpr;
50 class ObjCProtocolDecl;
53 class ObjCStringLiteral;
54 class BlockDeclRefExpr;
88 llvm::Value *BaseValue,
90 unsigned CVRQualifiers,
100 llvm::FunctionCallee beginCatchFn,
101 llvm::FunctionCallee endCatchFn,
102 llvm::FunctionCallee exceptionRethrowFn);
113 llvm::FunctionCallee syncEnterFn,
114 llvm::FunctionCallee syncExitFn);
120 bool includeCategoryName =
true);
171 llvm::Value *Receiver,
185 llvm::Value *Receiver,
189 bool isClassMessage);
215 std::vector<const ObjCProtocolDecl *>
276 llvm_unreachable(
"autoreleasepool unsupported in this ABI");
289 bool ClearInsertionPoint=
true) = 0;
293 llvm::Value *src,
Address dest) = 0;
295 llvm::Value *src,
Address dest,
296 bool threadlocal=
false) = 0;
298 llvm::Value *src,
Address dest,
299 llvm::Value *ivarOffset) = 0;
301 llvm::Value *src,
Address dest) = 0;
305 llvm::Value *BaseValue,
307 unsigned CVRQualifiers) = 0;
314 llvm::Value *Size) = 0;
333 llvm::PointerType *messengerType)
344 llvm::Value *receiver);
virtual llvm::Constant * BuildByrefLayout(CodeGen::CodeGenModule &CGM, QualType T)=0
Returns an i8* which points to the byref layout information.
Represents an ObjC class declaration.
virtual llvm::Value * GetClass(CodeGenFunction &CGF, const ObjCInterfaceDecl *OID)=0
GetClass - Return a reference to the class for the given interface decl.
ObjCCompatibleAliasDecl - Represents alias of a class.
YAML serialization mapping.
A specialization of Address that requires the address to be an LLVM Constant.
CodeGen::CodeGenModule & CGM
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
virtual llvm::FunctionCallee GetPropertyGetFunction()=0
Return the runtime function for getting properties.
virtual CodeGen::RValue GenerateMessageSend(CodeGen::CodeGenFunction &CGF, ReturnValueSlot ReturnSlot, QualType ResultType, Selector Sel, llvm::Value *Receiver, const CallArgList &CallArgs, const ObjCInterfaceDecl *Class=nullptr, const ObjCMethodDecl *Method=nullptr)=0
Generate an Objective-C message send operation.
virtual void EmitGCMemmoveCollectable(CodeGen::CodeGenFunction &CGF, Address DestPtr, Address SrcPtr, llvm::Value *Size)=0
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
virtual llvm::FunctionCallee GetOptimizedPropertySetFunction(bool atomic, bool copy)=0
Return the runtime function for optimized setting properties.
void EmitAtSynchronizedStmt(CodeGenFunction &CGF, const ObjCAtSynchronizedStmt &S, llvm::FunctionCallee syncEnterFn, llvm::FunctionCallee syncExitFn)
Emits an @synchronize() statement, using the syncEnterFn and syncExitFn arguments as the functions ca...
LValue EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF, const ObjCInterfaceDecl *OID, llvm::Value *BaseValue, const ObjCIvarDecl *Ivar, unsigned CVRQualifiers, llvm::Value *Offset)
CGObjCRuntime(CodeGen::CodeGenModule &CGM)
std::vector< const ObjCProtocolDecl * > GetRuntimeProtocolList(ObjCProtocolDecl::protocol_iterator begin, ObjCProtocolDecl::protocol_iterator end)
Walk the list of protocol references from a class, category or protocol to traverse the DAG formed fr...
A (possibly-)qualified type.
virtual LValue EmitObjCValueForIvar(CodeGen::CodeGenFunction &CGF, QualType ObjectTy, llvm::Value *BaseValue, const ObjCIvarDecl *Ivar, unsigned CVRQualifiers)=0
CGBlockInfo - Information to generate a block literal.
Represents Objective-C's @try ... @catch ... @finally statement.
MessageSendInfo getMessageSendInfo(const ObjCMethodDecl *method, QualType resultType, CallArgList &callArgs)
Compute the pointer-to-function type to which a message send should be casted in order to correctly c...
static void destroyCalleeDestroyedArguments(CodeGenFunction &CGF, const ObjCMethodDecl *method, const CallArgList &callArgs)
Destroy the callee-destroyed arguments of the given method, if it has any.
virtual llvm::Function * ModuleInitFunction()=0
Generate the function required to register all Objective-C components in this compilation unit with t...
virtual void EmitObjCIvarAssign(CodeGen::CodeGenFunction &CGF, llvm::Value *src, Address dest, llvm::Value *ivarOffset)=0
virtual llvm::FunctionCallee GetCppAtomicObjectGetFunction()=0
API for atomic copying of qualified aggregates with non-trivial copy assignment (c++) in getter.
ReturnValueSlot - Contains the address where the return value of a function can be stored,...
virtual std::string getRCBlockLayoutStr(CodeGen::CodeGenModule &CGM, const CGBlockInfo &blockInfo)
virtual void EmitThrowStmt(CodeGen::CodeGenFunction &CGF, const ObjCAtThrowStmt &S, bool ClearInsertionPoint=true)=0
virtual llvm::Value * GetSelector(CodeGenFunction &CGF, Selector Sel)=0
Get a selector for the specified name and type values.
virtual void GenerateProtocol(const ObjCProtocolDecl *OPD)=0
Generate the named protocol.
virtual llvm::Constant * BuildRCBlockLayout(CodeGen::CodeGenModule &CGM, const CodeGen::CGBlockInfo &blockInfo)=0
virtual llvm::Value * EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF)
Represents Objective-C's @throw statement.
std::string getSymbolNameForMethod(const ObjCMethodDecl *method, bool includeCategoryName=true)
Represents Objective-C's @synchronized statement.
virtual void EmitTryStmt(CodeGen::CodeGenFunction &CGF, const ObjCAtTryStmt &S)=0
virtual llvm::Value * EmitObjCWeakRead(CodeGen::CodeGenFunction &CGF, Address AddrWeakObj)=0
virtual llvm::FunctionCallee EnumerationMutationFunction()=0
EnumerationMutationFunction - Return the function that's called by the compiler when a mutation is de...
Represents a variable declaration or definition.
virtual llvm::FunctionCallee GetGetStructFunction()=0
virtual void GenerateCategory(const ObjCCategoryImplDecl *OCD)=0
Generate a category.
MessageSendInfo(const CGFunctionInfo &callInfo, llvm::PointerType *messengerType)
StringLiteral - This represents a string literal expression, e.g.
virtual llvm::Value * GenerateProtocolRef(CodeGenFunction &CGF, const ObjCProtocolDecl *OPD)=0
Emit the code to return the named protocol as an object, as in a @protocol expression.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
void EmitInitOfCatchParam(CodeGenFunction &CGF, llvm::Value *exn, const VarDecl *paramDecl)
virtual llvm::FunctionCallee GetPropertySetFunction()=0
Return the runtime function for setting properties.
virtual CodeGen::RValue GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, ReturnValueSlot ReturnSlot, QualType ResultType, Selector Sel, const ObjCInterfaceDecl *Class, bool isCategoryImpl, llvm::Value *Self, bool IsClassMessage, const CallArgList &CallArgs, const ObjCMethodDecl *Method=nullptr)=0
Generate an Objective-C message send operation to the super class initiated in a method for Class and...
virtual llvm::Value * EmitIvarOffset(CodeGen::CodeGenFunction &CGF, const ObjCInterfaceDecl *Interface, const ObjCIvarDecl *Ivar)=0
virtual void EmitSynchronizedStmt(CodeGen::CodeGenFunction &CGF, const ObjCAtSynchronizedStmt &S)=0
CGObjCRuntime * CreateMacObjCRuntime(CodeGenModule &CGM)
CGObjCRuntime * CreateGNUObjCRuntime(CodeGenModule &CGM)
Creates an instance of an Objective-C runtime class.
CodeGen::RValue GeneratePossiblySpecializedMessageSend(CodeGenFunction &CGF, ReturnValueSlot Return, QualType ResultType, Selector Sel, llvm::Value *Receiver, const CallArgList &Args, const ObjCInterfaceDecl *OID, const ObjCMethodDecl *Method, bool isClassMessage)
Generate an Objective-C message send operation.
LValue - This represents an lvalue references.
virtual llvm::Function * GenerateMethod(const ObjCMethodDecl *OMD, const ObjCContainerDecl *CD)=0
Generate a function preamble for a method with the specified types.
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
virtual void GenerateDirectMethodPrologue(CodeGenFunction &CGF, llvm::Function *Fn, const ObjCMethodDecl *OMD, const ObjCContainerDecl *CD)=0
Generates prologue for direct Objective-C Methods.
virtual void EmitObjCWeakAssign(CodeGen::CodeGenFunction &CGF, llvm::Value *src, Address dest)=0
This class organizes the cross-function state that is used while generating LLVM code.
virtual void RegisterAlias(const ObjCCompatibleAliasDecl *OAD)=0
Register an class alias.
virtual ConstantAddress GenerateConstantString(const StringLiteral *)=0
Generate a constant string object.
unsigned ComputeBitfieldBitOffset(CodeGen::CodeGenModule &CGM, const ObjCInterfaceDecl *ID, const ObjCIvarDecl *Ivar)
virtual llvm::FunctionCallee GetCppAtomicObjectSetFunction()=0
API for atomic copying of qualified aggregates with non-trivial copy assignment (c++) in setter.
virtual void GenerateClass(const ObjCImplementationDecl *OID)=0
Generate a class structure for this class.
bool canMessageReceiverBeNull(CodeGenFunction &CGF, const ObjCMethodDecl *method, bool isSuper, const ObjCInterfaceDecl *classReceiver, llvm::Value *receiver)
virtual llvm::FunctionCallee GetSetStructFunction()=0
CGFunctionInfo - Class to encapsulate the information about a function definition.
ObjCMethodDecl - Represents an instance or class method declaration.
virtual CatchTypeInfo getCatchAllTypeInfo()
Smart pointer class that efficiently represents Objective-C method names.
The MS C++ ABI needs a pointer to RTTI data plus some flags to describe the type of a catch handler,...
ObjCIvarDecl - Represents an ObjC instance variable.
virtual llvm::Constant * GetOrEmitProtocol(const ObjCProtocolDecl *PD)=0
GetOrEmitProtocol - Get the protocol object for the given declaration, emitting it if necessary.
static bool isWeakLinkedClass(const ObjCInterfaceDecl *cls)
const CGFunctionInfo & CallInfo
Represents an Objective-C protocol declaration.
virtual llvm::Constant * BuildGCBlockLayout(CodeGen::CodeGenModule &CGM, const CodeGen::CGBlockInfo &blockInfo)=0
virtual void EmitObjCGlobalAssign(CodeGen::CodeGenFunction &CGF, llvm::Value *src, Address dest, bool threadlocal=false)=0
virtual void EmitObjCStrongCastAssign(CodeGen::CodeGenFunction &CGF, llvm::Value *src, Address dest)=0
ObjCContainerDecl - Represents a container for method declarations.
uint64_t ComputeIvarBaseOffset(CodeGen::CodeGenModule &CGM, const ObjCInterfaceDecl *OID, const ObjCIvarDecl *Ivar)
Compute an offset to the given ivar, suitable for passing to EmitValueForIvarAtOffset.
void EmitTryCatchStmt(CodeGenFunction &CGF, const ObjCAtTryStmt &S, llvm::FunctionCallee beginCatchFn, llvm::FunctionCallee endCatchFn, llvm::FunctionCallee exceptionRethrowFn)
Emits a try / catch statement.
ObjCProtocolList::iterator protocol_iterator
virtual Address GetAddrOfSelector(CodeGenFunction &CGF, Selector Sel)=0
Get the address of a selector for the specified name and type values.
CallArgList - Type for representing both the value and type of arguments in a call.
virtual llvm::Constant * GetEHType(QualType T)=0
Get the type constant to catch for the given ObjC pointer type.
Implements runtime-specific code generation functions.
llvm::PointerType * MessengerType