Daniel Dunbar | c17a4d3 | 2008-08-11 02:45:11 +0000 | [diff] [blame] | 1 | //===----- CGObjCRuntime.h - Interface to ObjC Runtimes ---------*- C++ -*-===// |
Chris Lattner | 0f98426 | 2008-03-01 08:50:34 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This provides an abstract class for Objective-C code generation. Concrete |
| 11 | // subclasses of this implement code generation for specific Objective-C |
| 12 | // runtime libraries. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef CLANG_CODEGEN_OBCJRUNTIME_H |
| 17 | #define CLANG_CODEGEN_OBCJRUNTIME_H |
Daniel Dunbar | e91593e | 2008-08-11 04:54:23 +0000 | [diff] [blame] | 18 | #include "clang/Basic/IdentifierTable.h" // Selector |
Fariborz Jahanian | df9ccc6 | 2009-05-05 21:36:57 +0000 | [diff] [blame] | 19 | #include "clang/AST/DeclObjC.h" |
Chris Lattner | 0f98426 | 2008-03-01 08:50:34 +0000 | [diff] [blame] | 20 | |
Daniel Dunbar | 45d196b | 2008-11-01 01:53:16 +0000 | [diff] [blame] | 21 | #include "CGBuilder.h" |
Daniel Dunbar | 46f45b9 | 2008-09-09 01:06:48 +0000 | [diff] [blame] | 22 | #include "CGCall.h" |
Daniel Dunbar | 45d196b | 2008-11-01 01:53:16 +0000 | [diff] [blame] | 23 | #include "CGValue.h" |
Daniel Dunbar | 8f2926b | 2008-08-23 03:46:30 +0000 | [diff] [blame] | 24 | |
Chris Lattner | 0f98426 | 2008-03-01 08:50:34 +0000 | [diff] [blame] | 25 | namespace llvm { |
Chris Lattner | 0f98426 | 2008-03-01 08:50:34 +0000 | [diff] [blame] | 26 | class Constant; |
Daniel Dunbar | 9777687 | 2009-04-22 07:32:20 +0000 | [diff] [blame] | 27 | class Function; |
| 28 | class Module; |
| 29 | class StructLayout; |
Daniel Dunbar | 84ad77a | 2009-04-22 09:39:34 +0000 | [diff] [blame] | 30 | class StructType; |
Chris Lattner | 0f98426 | 2008-03-01 08:50:34 +0000 | [diff] [blame] | 31 | class Type; |
| 32 | class Value; |
Chris Lattner | 0f98426 | 2008-03-01 08:50:34 +0000 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | namespace clang { |
Daniel Dunbar | 46f45b9 | 2008-09-09 01:06:48 +0000 | [diff] [blame] | 36 | namespace CodeGen { |
| 37 | class CodeGenFunction; |
| 38 | } |
Daniel Dunbar | 8f2926b | 2008-08-23 03:46:30 +0000 | [diff] [blame] | 39 | |
Daniel Dunbar | 9777687 | 2009-04-22 07:32:20 +0000 | [diff] [blame] | 40 | class FieldDecl; |
Anders Carlsson | 64d5d6c | 2008-09-09 10:04:29 +0000 | [diff] [blame] | 41 | class ObjCAtTryStmt; |
| 42 | class ObjCAtThrowStmt; |
Chris Lattner | 10cac6f | 2008-11-15 21:26:17 +0000 | [diff] [blame] | 43 | class ObjCAtSynchronizedStmt; |
Fariborz Jahanian | 679a502 | 2009-01-10 21:06:09 +0000 | [diff] [blame] | 44 | class ObjCContainerDecl; |
Daniel Dunbar | 7ded7f4 | 2008-08-15 22:20:32 +0000 | [diff] [blame] | 45 | class ObjCCategoryImplDecl; |
| 46 | class ObjCImplementationDecl; |
Daniel Dunbar | ddb2a3d | 2008-08-16 00:25:02 +0000 | [diff] [blame] | 47 | class ObjCInterfaceDecl; |
Daniel Dunbar | 8f2926b | 2008-08-23 03:46:30 +0000 | [diff] [blame] | 48 | class ObjCMessageExpr; |
Daniel Dunbar | 7ded7f4 | 2008-08-15 22:20:32 +0000 | [diff] [blame] | 49 | class ObjCMethodDecl; |
Daniel Dunbar | af2f62c | 2008-08-13 00:59:25 +0000 | [diff] [blame] | 50 | class ObjCProtocolDecl; |
Chris Lattner | 8e67b63 | 2008-06-26 04:37:12 +0000 | [diff] [blame] | 51 | class Selector; |
Fariborz Jahanian | 0bb2036 | 2009-02-02 20:02:29 +0000 | [diff] [blame] | 52 | class ObjCIvarDecl; |
Steve Naroff | 33fdb73 | 2009-03-31 16:53:37 +0000 | [diff] [blame] | 53 | class ObjCStringLiteral; |
Fariborz Jahanian | 89ecd41 | 2010-08-04 16:57:49 +0000 | [diff] [blame] | 54 | class BlockDeclRefExpr; |
Daniel Dunbar | af2f62c | 2008-08-13 00:59:25 +0000 | [diff] [blame] | 55 | |
Chris Lattner | 0f98426 | 2008-03-01 08:50:34 +0000 | [diff] [blame] | 56 | namespace CodeGen { |
Chris Lattner | dce1406 | 2008-06-26 04:19:03 +0000 | [diff] [blame] | 57 | class CodeGenModule; |
John McCall | 6b5a61b | 2011-02-07 10:33:21 +0000 | [diff] [blame] | 58 | class CGBlockInfo; |
Chris Lattner | 0f98426 | 2008-03-01 08:50:34 +0000 | [diff] [blame] | 59 | |
Mike Stump | f5408fe | 2009-05-16 07:57:57 +0000 | [diff] [blame] | 60 | // FIXME: Several methods should be pure virtual but aren't to avoid the |
| 61 | // partially-implemented subclass breaking. |
Anton Korobeynikov | 20ff310 | 2008-06-01 14:13:53 +0000 | [diff] [blame] | 62 | |
| 63 | /// Implements runtime-specific code generation functions. |
Chris Lattner | 0f98426 | 2008-03-01 08:50:34 +0000 | [diff] [blame] | 64 | class CGObjCRuntime { |
Daniel Dunbar | f0fe5bc | 2010-04-05 21:36:35 +0000 | [diff] [blame] | 65 | protected: |
Daniel Dunbar | 9777687 | 2009-04-22 07:32:20 +0000 | [diff] [blame] | 66 | // Utility functions for unified ivar access. These need to |
| 67 | // eventually be folded into other places (the structure layout |
| 68 | // code). |
| 69 | |
Daniel Dunbar | 84ad77a | 2009-04-22 09:39:34 +0000 | [diff] [blame] | 70 | /// Compute an offset to the given ivar, suitable for passing to |
| 71 | /// EmitValueForIvarAtOffset. Note that the correct handling of |
| 72 | /// bit-fields is carefully coordinated by these two, use caution! |
Daniel Dunbar | 9f89f2b | 2009-05-03 12:57:56 +0000 | [diff] [blame] | 73 | /// |
| 74 | /// The latter overload is suitable for computing the offset of a |
| 75 | /// sythesized ivar. |
Daniel Dunbar | 9777687 | 2009-04-22 07:32:20 +0000 | [diff] [blame] | 76 | uint64_t ComputeIvarBaseOffset(CodeGen::CodeGenModule &CGM, |
| 77 | const ObjCInterfaceDecl *OID, |
| 78 | const ObjCIvarDecl *Ivar); |
Daniel Dunbar | 9f89f2b | 2009-05-03 12:57:56 +0000 | [diff] [blame] | 79 | uint64_t ComputeIvarBaseOffset(CodeGen::CodeGenModule &CGM, |
| 80 | const ObjCImplementationDecl *OID, |
| 81 | const ObjCIvarDecl *Ivar); |
Daniel Dunbar | 9777687 | 2009-04-22 07:32:20 +0000 | [diff] [blame] | 82 | |
| 83 | LValue EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF, |
| 84 | const ObjCInterfaceDecl *OID, |
| 85 | llvm::Value *BaseValue, |
| 86 | const ObjCIvarDecl *Ivar, |
| 87 | unsigned CVRQualifiers, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 88 | llvm::Value *Offset); |
David Chisnall | 9735ca6 | 2011-03-25 11:57:33 +0000 | [diff] [blame] | 89 | /// Emits a try / catch statement. This function is intended to be called by |
| 90 | /// subclasses, and provides a generic mechanism for generating these, which |
| 91 | /// should be usable by all runtimes. The caller must provide the functions to |
| 92 | /// call when entering and exiting a @catch() block, and the function used to |
| 93 | /// rethrow exceptions. If the begin and end catch functions are NULL, then |
| 94 | /// the function assumes that the EH personality function provides the |
| 95 | /// thrown object directly. |
| 96 | void EmitTryCatchStmt(CodeGenFunction &CGF, |
| 97 | const ObjCAtTryStmt &S, |
David Chisnall | 789ecde | 2011-05-23 22:33:28 +0000 | [diff] [blame] | 98 | llvm::Constant *beginCatchFn, |
| 99 | llvm::Constant *endCatchFn, |
| 100 | llvm::Constant *exceptionRethrowFn); |
David Chisnall | 9735ca6 | 2011-03-25 11:57:33 +0000 | [diff] [blame] | 101 | /// Emits an @synchronize() statement, using the syncEnterFn and syncExitFn |
| 102 | /// arguments as the functions called to lock and unlock the object. This |
| 103 | /// function can be called by subclasses that use zero-cost exception |
| 104 | /// handling. |
| 105 | void EmitAtSynchronizedStmt(CodeGenFunction &CGF, |
| 106 | const ObjCAtSynchronizedStmt &S, |
| 107 | llvm::Function *syncEnterFn, |
| 108 | llvm::Function *syncExitFn); |
Daniel Dunbar | 58bf610 | 2008-08-11 16:50:21 +0000 | [diff] [blame] | 109 | |
Chris Lattner | 0f98426 | 2008-03-01 08:50:34 +0000 | [diff] [blame] | 110 | public: |
| 111 | virtual ~CGObjCRuntime(); |
Daniel Dunbar | 7ded7f4 | 2008-08-15 22:20:32 +0000 | [diff] [blame] | 112 | |
| 113 | /// Generate the function required to register all Objective-C components in |
| 114 | /// this compilation unit with the runtime library. |
| 115 | virtual llvm::Function *ModuleInitFunction() = 0; |
| 116 | |
| 117 | /// Get a selector for the specified name and type values. The |
| 118 | /// return value should have the LLVM type for pointer-to |
| 119 | /// ASTContext::getObjCSelType(). |
Daniel Dunbar | 45d196b | 2008-11-01 01:53:16 +0000 | [diff] [blame] | 120 | virtual llvm::Value *GetSelector(CGBuilderTy &Builder, |
Fariborz Jahanian | 03b2960 | 2010-06-17 19:56:20 +0000 | [diff] [blame] | 121 | Selector Sel, bool lval=false) = 0; |
Daniel Dunbar | 7ded7f4 | 2008-08-15 22:20:32 +0000 | [diff] [blame] | 122 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 123 | /// Get a typed selector. |
Fariborz Jahanian | df9ccc6 | 2009-05-05 21:36:57 +0000 | [diff] [blame] | 124 | virtual llvm::Value *GetSelector(CGBuilderTy &Builder, |
| 125 | const ObjCMethodDecl *Method) = 0; |
| 126 | |
John McCall | 5a18039 | 2010-07-24 00:37:23 +0000 | [diff] [blame] | 127 | /// Get the type constant to catch for the given ObjC pointer type. |
| 128 | /// This is used externally to implement catching ObjC types in C++. |
| 129 | /// Runtimes which don't support this should add the appropriate |
| 130 | /// error to Sema. |
Fariborz Jahanian | cf5abc7 | 2011-06-23 19:00:08 +0000 | [diff] [blame] | 131 | virtual llvm::Constant *GetEHType(QualType T) = 0; |
John McCall | 5a18039 | 2010-07-24 00:37:23 +0000 | [diff] [blame] | 132 | |
Daniel Dunbar | 7ded7f4 | 2008-08-15 22:20:32 +0000 | [diff] [blame] | 133 | /// Generate a constant string object. |
David Chisnall | 0d13f6f | 2010-01-23 02:40:42 +0000 | [diff] [blame] | 134 | virtual llvm::Constant *GenerateConstantString(const StringLiteral *) = 0; |
Daniel Dunbar | 7ded7f4 | 2008-08-15 22:20:32 +0000 | [diff] [blame] | 135 | |
| 136 | /// Generate a category. A category contains a list of methods (and |
| 137 | /// accompanying metadata) and a list of protocols. |
| 138 | virtual void GenerateCategory(const ObjCCategoryImplDecl *OCD) = 0; |
| 139 | |
Chris Lattner | fc8f0e1 | 2011-04-15 05:22:18 +0000 | [diff] [blame] | 140 | /// Generate a class structure for this class. |
Daniel Dunbar | 7ded7f4 | 2008-08-15 22:20:32 +0000 | [diff] [blame] | 141 | virtual void GenerateClass(const ObjCImplementationDecl *OID) = 0; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 142 | |
| 143 | /// Generate an Objective-C message send operation. |
Daniel Dunbar | d6c93d7 | 2009-09-17 04:01:22 +0000 | [diff] [blame] | 144 | /// |
| 145 | /// \param Method - The method being called, this may be null if synthesizing |
| 146 | /// a property setter or getter. |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 147 | virtual CodeGen::RValue |
Daniel Dunbar | 8f2926b | 2008-08-23 03:46:30 +0000 | [diff] [blame] | 148 | GenerateMessageSend(CodeGen::CodeGenFunction &CGF, |
John McCall | ef072fd | 2010-05-22 01:48:05 +0000 | [diff] [blame] | 149 | ReturnValueSlot ReturnSlot, |
Daniel Dunbar | 7f8ea5c | 2008-08-30 05:35:15 +0000 | [diff] [blame] | 150 | QualType ResultType, |
| 151 | Selector Sel, |
Daniel Dunbar | f56f191 | 2008-08-25 08:19:24 +0000 | [diff] [blame] | 152 | llvm::Value *Receiver, |
Fariborz Jahanian | df9ccc6 | 2009-05-05 21:36:57 +0000 | [diff] [blame] | 153 | const CallArgList &CallArgs, |
David Chisnall | c6cd5fd | 2010-04-28 19:33:36 +0000 | [diff] [blame] | 154 | const ObjCInterfaceDecl *Class = 0, |
Daniel Dunbar | d6c93d7 | 2009-09-17 04:01:22 +0000 | [diff] [blame] | 155 | const ObjCMethodDecl *Method = 0) = 0; |
Daniel Dunbar | af2f62c | 2008-08-13 00:59:25 +0000 | [diff] [blame] | 156 | |
Daniel Dunbar | 7ded7f4 | 2008-08-15 22:20:32 +0000 | [diff] [blame] | 157 | /// Generate an Objective-C message send operation to the super |
Daniel Dunbar | f56f191 | 2008-08-25 08:19:24 +0000 | [diff] [blame] | 158 | /// class initiated in a method for Class and with the given Self |
| 159 | /// object. |
Daniel Dunbar | d6c93d7 | 2009-09-17 04:01:22 +0000 | [diff] [blame] | 160 | /// |
| 161 | /// \param Method - The method being called, this may be null if synthesizing |
| 162 | /// a property setter or getter. |
Daniel Dunbar | 8f2926b | 2008-08-23 03:46:30 +0000 | [diff] [blame] | 163 | virtual CodeGen::RValue |
| 164 | GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, |
John McCall | ef072fd | 2010-05-22 01:48:05 +0000 | [diff] [blame] | 165 | ReturnValueSlot ReturnSlot, |
Daniel Dunbar | 7f8ea5c | 2008-08-30 05:35:15 +0000 | [diff] [blame] | 166 | QualType ResultType, |
| 167 | Selector Sel, |
Daniel Dunbar | f56f191 | 2008-08-25 08:19:24 +0000 | [diff] [blame] | 168 | const ObjCInterfaceDecl *Class, |
Fariborz Jahanian | 7ce7792 | 2009-02-28 20:07:56 +0000 | [diff] [blame] | 169 | bool isCategoryImpl, |
Daniel Dunbar | f56f191 | 2008-08-25 08:19:24 +0000 | [diff] [blame] | 170 | llvm::Value *Self, |
Daniel Dunbar | 19cd87e | 2008-08-30 03:02:31 +0000 | [diff] [blame] | 171 | bool IsClassMessage, |
Daniel Dunbar | d6c93d7 | 2009-09-17 04:01:22 +0000 | [diff] [blame] | 172 | const CallArgList &CallArgs, |
| 173 | const ObjCMethodDecl *Method = 0) = 0; |
Daniel Dunbar | 98c5ead | 2008-08-12 05:08:18 +0000 | [diff] [blame] | 174 | |
| 175 | /// Emit the code to return the named protocol as an object, as in a |
| 176 | /// @protocol expression. |
Daniel Dunbar | 45d196b | 2008-11-01 01:53:16 +0000 | [diff] [blame] | 177 | virtual llvm::Value *GenerateProtocolRef(CGBuilderTy &Builder, |
Daniel Dunbar | 7ded7f4 | 2008-08-15 22:20:32 +0000 | [diff] [blame] | 178 | const ObjCProtocolDecl *OPD) = 0; |
Daniel Dunbar | 98c5ead | 2008-08-12 05:08:18 +0000 | [diff] [blame] | 179 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 180 | /// Generate the named protocol. Protocols contain method metadata but no |
| 181 | /// implementations. |
Daniel Dunbar | 7ded7f4 | 2008-08-15 22:20:32 +0000 | [diff] [blame] | 182 | virtual void GenerateProtocol(const ObjCProtocolDecl *OPD) = 0; |
Daniel Dunbar | af2f62c | 2008-08-13 00:59:25 +0000 | [diff] [blame] | 183 | |
Daniel Dunbar | 7ded7f4 | 2008-08-15 22:20:32 +0000 | [diff] [blame] | 184 | /// Generate a function preamble for a method with the specified |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 185 | /// types. |
Daniel Dunbar | 7ded7f4 | 2008-08-15 22:20:32 +0000 | [diff] [blame] | 186 | |
Mike Stump | f5408fe | 2009-05-16 07:57:57 +0000 | [diff] [blame] | 187 | // FIXME: Current this just generates the Function definition, but really this |
| 188 | // should also be generating the loads of the parameters, as the runtime |
| 189 | // should have full control over how parameters are passed. |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 190 | virtual llvm::Function *GenerateMethod(const ObjCMethodDecl *OMD, |
Fariborz Jahanian | 679a502 | 2009-01-10 21:06:09 +0000 | [diff] [blame] | 191 | const ObjCContainerDecl *CD) = 0; |
Daniel Dunbar | af2f62c | 2008-08-13 00:59:25 +0000 | [diff] [blame] | 192 | |
Daniel Dunbar | 49f6602 | 2008-09-24 03:38:44 +0000 | [diff] [blame] | 193 | /// Return the runtime function for getting properties. |
Chris Lattner | 74391b4 | 2009-03-22 21:03:39 +0000 | [diff] [blame] | 194 | virtual llvm::Constant *GetPropertyGetFunction() = 0; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 195 | |
Daniel Dunbar | 49f6602 | 2008-09-24 03:38:44 +0000 | [diff] [blame] | 196 | /// Return the runtime function for setting properties. |
Chris Lattner | 74391b4 | 2009-03-22 21:03:39 +0000 | [diff] [blame] | 197 | virtual llvm::Constant *GetPropertySetFunction() = 0; |
Daniel Dunbar | 49f6602 | 2008-09-24 03:38:44 +0000 | [diff] [blame] | 198 | |
David Chisnall | 8fac25d | 2010-12-26 22:13:16 +0000 | [diff] [blame] | 199 | // API for atomic copying of qualified aggregates in getter. |
| 200 | virtual llvm::Constant *GetGetStructFunction() = 0; |
| 201 | // API for atomic copying of qualified aggregates in setter. |
| 202 | virtual llvm::Constant *GetSetStructFunction() = 0; |
Fariborz Jahanian | 6cc5906 | 2010-04-12 18:18:10 +0000 | [diff] [blame] | 203 | |
Daniel Dunbar | ddb2a3d | 2008-08-16 00:25:02 +0000 | [diff] [blame] | 204 | /// GetClass - Return a reference to the class for the given |
| 205 | /// interface decl. |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 206 | virtual llvm::Value *GetClass(CGBuilderTy &Builder, |
Daniel Dunbar | ddb2a3d | 2008-08-16 00:25:02 +0000 | [diff] [blame] | 207 | const ObjCInterfaceDecl *OID) = 0; |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 208 | |
| 209 | |
| 210 | virtual llvm::Value *EmitNSAutoreleasePoolClassRef(CGBuilderTy &Builder) { |
| 211 | assert(false &&"autoreleasepool unsupported in this ABI"); |
| 212 | return 0; |
| 213 | } |
| 214 | |
Anders Carlsson | 2abd89c | 2008-08-31 04:05:03 +0000 | [diff] [blame] | 215 | /// EnumerationMutationFunction - Return the function that's called by the |
| 216 | /// compiler when a mutation is detected during foreach iteration. |
Chris Lattner | 74391b4 | 2009-03-22 21:03:39 +0000 | [diff] [blame] | 217 | virtual llvm::Constant *EnumerationMutationFunction() = 0; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 218 | |
John McCall | f1549f6 | 2010-07-06 01:34:17 +0000 | [diff] [blame] | 219 | virtual void EmitSynchronizedStmt(CodeGen::CodeGenFunction &CGF, |
| 220 | const ObjCAtSynchronizedStmt &S) = 0; |
| 221 | virtual void EmitTryStmt(CodeGen::CodeGenFunction &CGF, |
| 222 | const ObjCAtTryStmt &S) = 0; |
Anders Carlsson | 64d5d6c | 2008-09-09 10:04:29 +0000 | [diff] [blame] | 223 | virtual void EmitThrowStmt(CodeGen::CodeGenFunction &CGF, |
| 224 | const ObjCAtThrowStmt &S) = 0; |
Daniel Dunbar | 6bf2ae0 | 2009-04-21 00:49:20 +0000 | [diff] [blame] | 225 | virtual llvm::Value *EmitObjCWeakRead(CodeGen::CodeGenFunction &CGF, |
| 226 | llvm::Value *AddrWeakObj) = 0; |
Fariborz Jahanian | 3e283e3 | 2008-11-18 22:37:34 +0000 | [diff] [blame] | 227 | virtual void EmitObjCWeakAssign(CodeGen::CodeGenFunction &CGF, |
| 228 | llvm::Value *src, llvm::Value *dest) = 0; |
Fariborz Jahanian | 5862650 | 2008-11-19 00:59:10 +0000 | [diff] [blame] | 229 | virtual void EmitObjCGlobalAssign(CodeGen::CodeGenFunction &CGF, |
Fariborz Jahanian | 021a7a6 | 2010-07-20 20:30:03 +0000 | [diff] [blame] | 230 | llvm::Value *src, llvm::Value *dest, |
| 231 | bool threadlocal=false) = 0; |
Fariborz Jahanian | 7eda836 | 2008-11-20 19:23:36 +0000 | [diff] [blame] | 232 | virtual void EmitObjCIvarAssign(CodeGen::CodeGenFunction &CGF, |
Fariborz Jahanian | 6c7a1f3 | 2009-09-24 22:25:38 +0000 | [diff] [blame] | 233 | llvm::Value *src, llvm::Value *dest, |
| 234 | llvm::Value *ivarOffset) = 0; |
Fariborz Jahanian | 5862650 | 2008-11-19 00:59:10 +0000 | [diff] [blame] | 235 | virtual void EmitObjCStrongCastAssign(CodeGen::CodeGenFunction &CGF, |
| 236 | llvm::Value *src, llvm::Value *dest) = 0; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 237 | |
Fariborz Jahanian | 598d3f6 | 2009-02-03 19:03:09 +0000 | [diff] [blame] | 238 | virtual LValue EmitObjCValueForIvar(CodeGen::CodeGenFunction &CGF, |
| 239 | QualType ObjectTy, |
| 240 | llvm::Value *BaseValue, |
| 241 | const ObjCIvarDecl *Ivar, |
Fariborz Jahanian | 598d3f6 | 2009-02-03 19:03:09 +0000 | [diff] [blame] | 242 | unsigned CVRQualifiers) = 0; |
Fariborz Jahanian | f63aa3f | 2009-02-10 19:02:04 +0000 | [diff] [blame] | 243 | virtual llvm::Value *EmitIvarOffset(CodeGen::CodeGenFunction &CGF, |
Daniel Dunbar | 2a03192 | 2009-04-22 05:08:15 +0000 | [diff] [blame] | 244 | const ObjCInterfaceDecl *Interface, |
Fariborz Jahanian | f63aa3f | 2009-02-10 19:02:04 +0000 | [diff] [blame] | 245 | const ObjCIvarDecl *Ivar) = 0; |
Fariborz Jahanian | 082b02e | 2009-07-08 01:18:33 +0000 | [diff] [blame] | 246 | virtual void EmitGCMemmoveCollectable(CodeGen::CodeGenFunction &CGF, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 247 | llvm::Value *DestPtr, |
Fariborz Jahanian | 082b02e | 2009-07-08 01:18:33 +0000 | [diff] [blame] | 248 | llvm::Value *SrcPtr, |
Fariborz Jahanian | 55bcace | 2010-06-15 22:44:06 +0000 | [diff] [blame] | 249 | llvm::Value *Size) = 0; |
John McCall | 6b5a61b | 2011-02-07 10:33:21 +0000 | [diff] [blame] | 250 | virtual llvm::Constant *BuildGCBlockLayout(CodeGen::CodeGenModule &CGM, |
| 251 | const CodeGen::CGBlockInfo &blockInfo) = 0; |
Fariborz Jahanian | 6f40e22 | 2011-05-17 22:21:16 +0000 | [diff] [blame] | 252 | virtual llvm::GlobalVariable *GetClassGlobal(const std::string &Name) = 0; |
Chris Lattner | 0f98426 | 2008-03-01 08:50:34 +0000 | [diff] [blame] | 253 | }; |
| 254 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 255 | /// Creates an instance of an Objective-C runtime class. |
Chris Lattner | 391d77a | 2008-03-30 23:03:07 +0000 | [diff] [blame] | 256 | //TODO: This should include some way of selecting which runtime to target. |
Daniel Dunbar | c17a4d3 | 2008-08-11 02:45:11 +0000 | [diff] [blame] | 257 | CGObjCRuntime *CreateGNUObjCRuntime(CodeGenModule &CGM); |
| 258 | CGObjCRuntime *CreateMacObjCRuntime(CodeGenModule &CGM); |
Chris Lattner | 0f98426 | 2008-03-01 08:50:34 +0000 | [diff] [blame] | 259 | } |
| 260 | } |
| 261 | #endif |