Charles Davis | 3a811f1 | 2010-05-25 19:52:27 +0000 | [diff] [blame] | 1 | //===----- CGCXXABI.h - Interface to C++ ABIs -------------------*- C++ -*-===// |
| 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 C++ code generation. Concrete subclasses |
| 11 | // of this implement code generation for specific C++ ABIs. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef CLANG_CODEGEN_CXXABI_H |
| 16 | #define CLANG_CODEGEN_CXXABI_H |
| 17 | |
John McCall | 4c40d98 | 2010-08-31 07:33:07 +0000 | [diff] [blame] | 18 | #include "CodeGenFunction.h" |
Chandler Carruth | 55fc873 | 2012-12-04 09:13:33 +0000 | [diff] [blame] | 19 | #include "clang/Basic/LLVM.h" |
John McCall | 4c40d98 | 2010-08-31 07:33:07 +0000 | [diff] [blame] | 20 | |
John McCall | 93d557b | 2010-08-22 00:05:51 +0000 | [diff] [blame] | 21 | namespace llvm { |
John McCall | cf2c85e | 2010-08-22 04:16:24 +0000 | [diff] [blame] | 22 | class Constant; |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 23 | class Type; |
John McCall | 93d557b | 2010-08-22 00:05:51 +0000 | [diff] [blame] | 24 | class Value; |
| 25 | } |
| 26 | |
Charles Davis | 3a811f1 | 2010-05-25 19:52:27 +0000 | [diff] [blame] | 27 | namespace clang { |
John McCall | 3023def | 2010-08-22 03:04:22 +0000 | [diff] [blame] | 28 | class CastExpr; |
John McCall | 4c40d98 | 2010-08-31 07:33:07 +0000 | [diff] [blame] | 29 | class CXXConstructorDecl; |
| 30 | class CXXDestructorDecl; |
John McCall | 875ab10 | 2010-08-22 06:43:33 +0000 | [diff] [blame] | 31 | class CXXMethodDecl; |
John McCall | cf2c85e | 2010-08-22 04:16:24 +0000 | [diff] [blame] | 32 | class CXXRecordDecl; |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 33 | class FieldDecl; |
Peter Collingbourne | 1411047 | 2011-01-13 18:57:25 +0000 | [diff] [blame] | 34 | class MangleContext; |
John McCall | 93d557b | 2010-08-22 00:05:51 +0000 | [diff] [blame] | 35 | |
Charles Davis | 3a811f1 | 2010-05-25 19:52:27 +0000 | [diff] [blame] | 36 | namespace CodeGen { |
John McCall | 93d557b | 2010-08-22 00:05:51 +0000 | [diff] [blame] | 37 | class CodeGenFunction; |
Charles Davis | 3a811f1 | 2010-05-25 19:52:27 +0000 | [diff] [blame] | 38 | class CodeGenModule; |
Charles Davis | 3a811f1 | 2010-05-25 19:52:27 +0000 | [diff] [blame] | 39 | |
James Dennett | 3b2adf2 | 2012-06-15 07:35:42 +0000 | [diff] [blame] | 40 | /// \brief Implements C++ ABI-specific code generation functions. |
Charles Davis | 071cc7d | 2010-08-16 03:33:14 +0000 | [diff] [blame] | 41 | class CGCXXABI { |
John McCall | d608cdb | 2010-08-22 10:59:02 +0000 | [diff] [blame] | 42 | protected: |
| 43 | CodeGenModule &CGM; |
Dylan Noblesmith | 6f42b62 | 2012-02-05 02:12:40 +0000 | [diff] [blame] | 44 | OwningPtr<MangleContext> MangleCtx; |
John McCall | d608cdb | 2010-08-22 10:59:02 +0000 | [diff] [blame] | 45 | |
Peter Collingbourne | 1411047 | 2011-01-13 18:57:25 +0000 | [diff] [blame] | 46 | CGCXXABI(CodeGenModule &CGM) |
| 47 | : CGM(CGM), MangleCtx(CGM.getContext().createMangleContext()) {} |
John McCall | d608cdb | 2010-08-22 10:59:02 +0000 | [diff] [blame] | 48 | |
John McCall | 4c40d98 | 2010-08-31 07:33:07 +0000 | [diff] [blame] | 49 | protected: |
| 50 | ImplicitParamDecl *&getThisDecl(CodeGenFunction &CGF) { |
Eli Friedman | cec5ebd | 2012-02-11 02:57:39 +0000 | [diff] [blame] | 51 | return CGF.CXXABIThisDecl; |
John McCall | 4c40d98 | 2010-08-31 07:33:07 +0000 | [diff] [blame] | 52 | } |
| 53 | llvm::Value *&getThisValue(CodeGenFunction &CGF) { |
Eli Friedman | cec5ebd | 2012-02-11 02:57:39 +0000 | [diff] [blame] | 54 | return CGF.CXXABIThisValue; |
John McCall | 4c40d98 | 2010-08-31 07:33:07 +0000 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | ImplicitParamDecl *&getVTTDecl(CodeGenFunction &CGF) { |
| 58 | return CGF.CXXVTTDecl; |
| 59 | } |
| 60 | llvm::Value *&getVTTValue(CodeGenFunction &CGF) { |
| 61 | return CGF.CXXVTTValue; |
| 62 | } |
| 63 | |
| 64 | /// Build a parameter variable suitable for 'this'. |
| 65 | void BuildThisParam(CodeGenFunction &CGF, FunctionArgList &Params); |
| 66 | |
| 67 | /// Perform prolog initialization of the parameter variable suitable |
| 68 | /// for 'this' emitted by BuildThisParam. |
| 69 | void EmitThisParam(CodeGenFunction &CGF); |
| 70 | |
John McCall | 1e7fe75 | 2010-09-02 09:58:18 +0000 | [diff] [blame] | 71 | ASTContext &getContext() const { return CGM.getContext(); } |
| 72 | |
John McCall | e2b45e2 | 2012-05-01 05:23:51 +0000 | [diff] [blame] | 73 | virtual bool requiresArrayCookie(const CXXDeleteExpr *E, QualType eltType); |
| 74 | virtual bool requiresArrayCookie(const CXXNewExpr *E); |
| 75 | |
Charles Davis | 3a811f1 | 2010-05-25 19:52:27 +0000 | [diff] [blame] | 76 | public: |
John McCall | d608cdb | 2010-08-22 10:59:02 +0000 | [diff] [blame] | 77 | |
Anders Carlsson | 1af610f | 2010-11-28 17:50:09 +0000 | [diff] [blame] | 78 | virtual ~CGCXXABI(); |
Charles Davis | 3a811f1 | 2010-05-25 19:52:27 +0000 | [diff] [blame] | 79 | |
| 80 | /// Gets the mangle context. |
Peter Collingbourne | 1411047 | 2011-01-13 18:57:25 +0000 | [diff] [blame] | 81 | MangleContext &getMangleContext() { |
| 82 | return *MangleCtx; |
| 83 | } |
John McCall | 93d557b | 2010-08-22 00:05:51 +0000 | [diff] [blame] | 84 | |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 85 | /// Find the LLVM type used to represent the given member pointer |
| 86 | /// type. |
Chris Lattner | 9cbe4f0 | 2011-07-09 17:41:47 +0000 | [diff] [blame] | 87 | virtual llvm::Type * |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 88 | ConvertMemberPointerType(const MemberPointerType *MPT); |
| 89 | |
| 90 | /// Load a member function from an object and a member function |
| 91 | /// pointer. Apply the this-adjustment and set 'This' to the |
| 92 | /// adjusted value. |
John McCall | 93d557b | 2010-08-22 00:05:51 +0000 | [diff] [blame] | 93 | virtual llvm::Value * |
| 94 | EmitLoadOfMemberFunctionPointer(CodeGenFunction &CGF, |
| 95 | llvm::Value *&This, |
| 96 | llvm::Value *MemPtr, |
| 97 | const MemberPointerType *MPT); |
John McCall | 3023def | 2010-08-22 03:04:22 +0000 | [diff] [blame] | 98 | |
John McCall | 6c2ab1d | 2010-08-31 21:07:20 +0000 | [diff] [blame] | 99 | /// Calculate an l-value from an object and a data member pointer. |
| 100 | virtual llvm::Value *EmitMemberDataPointerAddress(CodeGenFunction &CGF, |
| 101 | llvm::Value *Base, |
| 102 | llvm::Value *MemPtr, |
| 103 | const MemberPointerType *MPT); |
| 104 | |
John McCall | 4d4e5c1 | 2012-02-15 01:22:51 +0000 | [diff] [blame] | 105 | /// Perform a derived-to-base, base-to-derived, or bitcast member |
| 106 | /// pointer conversion. |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 107 | virtual llvm::Value *EmitMemberPointerConversion(CodeGenFunction &CGF, |
| 108 | const CastExpr *E, |
| 109 | llvm::Value *Src); |
John McCall | cf2c85e | 2010-08-22 04:16:24 +0000 | [diff] [blame] | 110 | |
John McCall | 4d4e5c1 | 2012-02-15 01:22:51 +0000 | [diff] [blame] | 111 | /// Perform a derived-to-base, base-to-derived, or bitcast member |
| 112 | /// pointer conversion on a constant value. |
| 113 | virtual llvm::Constant *EmitMemberPointerConversion(const CastExpr *E, |
| 114 | llvm::Constant *Src); |
| 115 | |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 116 | /// Return true if the given member pointer can be zero-initialized |
| 117 | /// (in the C++ sense) with an LLVM zeroinitializer. |
John McCall | f16aa10 | 2010-08-22 21:01:12 +0000 | [diff] [blame] | 118 | virtual bool isZeroInitializable(const MemberPointerType *MPT); |
John McCall | cf2c85e | 2010-08-22 04:16:24 +0000 | [diff] [blame] | 119 | |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 120 | /// Create a null member pointer of the given type. |
| 121 | virtual llvm::Constant *EmitNullMemberPointer(const MemberPointerType *MPT); |
John McCall | cf2c85e | 2010-08-22 04:16:24 +0000 | [diff] [blame] | 122 | |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 123 | /// Create a member pointer for the given method. |
John McCall | 755d849 | 2011-04-12 00:42:48 +0000 | [diff] [blame] | 124 | virtual llvm::Constant *EmitMemberPointer(const CXXMethodDecl *MD); |
John McCall | 875ab10 | 2010-08-22 06:43:33 +0000 | [diff] [blame] | 125 | |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 126 | /// Create a member pointer for the given field. |
John McCall | 5808ce4 | 2011-02-03 08:15:49 +0000 | [diff] [blame] | 127 | virtual llvm::Constant *EmitMemberDataPointer(const MemberPointerType *MPT, |
| 128 | CharUnits offset); |
John McCall | e9fd7eb | 2010-08-22 08:30:07 +0000 | [diff] [blame] | 129 | |
Richard Smith | 2d6a567 | 2012-01-14 04:30:29 +0000 | [diff] [blame] | 130 | /// Create a member pointer for the given member pointer constant. |
| 131 | virtual llvm::Constant *EmitMemberPointer(const APValue &MP, QualType MPT); |
| 132 | |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 133 | /// Emit a comparison between two member pointers. Returns an i1. |
John McCall | e9fd7eb | 2010-08-22 08:30:07 +0000 | [diff] [blame] | 134 | virtual llvm::Value * |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 135 | EmitMemberPointerComparison(CodeGenFunction &CGF, |
| 136 | llvm::Value *L, |
| 137 | llvm::Value *R, |
| 138 | const MemberPointerType *MPT, |
| 139 | bool Inequality); |
John McCall | e9fd7eb | 2010-08-22 08:30:07 +0000 | [diff] [blame] | 140 | |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 141 | /// Determine if a member pointer is non-null. Returns an i1. |
John McCall | e9fd7eb | 2010-08-22 08:30:07 +0000 | [diff] [blame] | 142 | virtual llvm::Value * |
John McCall | 0bab0cd | 2010-08-23 01:21:21 +0000 | [diff] [blame] | 143 | EmitMemberPointerIsNotNull(CodeGenFunction &CGF, |
| 144 | llvm::Value *MemPtr, |
| 145 | const MemberPointerType *MPT); |
John McCall | 4c40d98 | 2010-08-31 07:33:07 +0000 | [diff] [blame] | 146 | |
John McCall | 4d4e5c1 | 2012-02-15 01:22:51 +0000 | [diff] [blame] | 147 | protected: |
| 148 | /// A utility method for computing the offset required for the given |
| 149 | /// base-to-derived or derived-to-base member-pointer conversion. |
| 150 | /// Does not handle virtual conversions (in case we ever fully |
| 151 | /// support an ABI that allows this). Returns null if no adjustment |
| 152 | /// is required. |
| 153 | llvm::Constant *getMemberPointerAdjustment(const CastExpr *E); |
| 154 | |
| 155 | public: |
John McCall | ecd03b4 | 2012-09-25 10:10:39 +0000 | [diff] [blame] | 156 | /// Adjust the given non-null pointer to an object of polymorphic |
| 157 | /// type to point to the complete object. |
| 158 | /// |
| 159 | /// The IR type of the result should be a pointer but is otherwise |
| 160 | /// irrelevant. |
| 161 | virtual llvm::Value *adjustToCompleteObject(CodeGenFunction &CGF, |
| 162 | llvm::Value *ptr, |
| 163 | QualType type) = 0; |
| 164 | |
John McCall | 4c40d98 | 2010-08-31 07:33:07 +0000 | [diff] [blame] | 165 | /// Build the signature of the given constructor variant by adding |
| 166 | /// any required parameters. For convenience, ResTy has been |
| 167 | /// initialized to 'void', and ArgTys has been initialized with the |
| 168 | /// type of 'this' (although this may be changed by the ABI) and |
| 169 | /// will have the formal parameters added to it afterwards. |
| 170 | /// |
| 171 | /// If there are ever any ABIs where the implicit parameters are |
| 172 | /// intermixed with the formal parameters, we can address those |
| 173 | /// then. |
| 174 | virtual void BuildConstructorSignature(const CXXConstructorDecl *Ctor, |
| 175 | CXXCtorType T, |
| 176 | CanQualType &ResTy, |
Chris Lattner | 686775d | 2011-07-20 06:58:45 +0000 | [diff] [blame] | 177 | SmallVectorImpl<CanQualType> &ArgTys) = 0; |
John McCall | 4c40d98 | 2010-08-31 07:33:07 +0000 | [diff] [blame] | 178 | |
| 179 | /// Build the signature of the given destructor variant by adding |
| 180 | /// any required parameters. For convenience, ResTy has been |
| 181 | /// initialized to 'void' and ArgTys has been initialized with the |
| 182 | /// type of 'this' (although this may be changed by the ABI). |
| 183 | virtual void BuildDestructorSignature(const CXXDestructorDecl *Dtor, |
| 184 | CXXDtorType T, |
| 185 | CanQualType &ResTy, |
Chris Lattner | 686775d | 2011-07-20 06:58:45 +0000 | [diff] [blame] | 186 | SmallVectorImpl<CanQualType> &ArgTys) = 0; |
John McCall | 4c40d98 | 2010-08-31 07:33:07 +0000 | [diff] [blame] | 187 | |
| 188 | /// Build the ABI-specific portion of the parameter list for a |
| 189 | /// function. This generally involves a 'this' parameter and |
| 190 | /// possibly some extra data for constructors and destructors. |
| 191 | /// |
| 192 | /// ABIs may also choose to override the return type, which has been |
| 193 | /// initialized with the formal return type of the function. |
| 194 | virtual void BuildInstanceFunctionParams(CodeGenFunction &CGF, |
| 195 | QualType &ResTy, |
| 196 | FunctionArgList &Params) = 0; |
| 197 | |
| 198 | /// Emit the ABI-specific prolog for the function. |
| 199 | virtual void EmitInstanceFunctionProlog(CodeGenFunction &CGF) = 0; |
| 200 | |
| 201 | virtual void EmitReturnFromThunk(CodeGenFunction &CGF, |
| 202 | RValue RV, QualType ResultType); |
John McCall | 1e7fe75 | 2010-09-02 09:58:18 +0000 | [diff] [blame] | 203 | |
Joao Matos | 285baac | 2012-07-17 17:10:11 +0000 | [diff] [blame] | 204 | /// Gets the pure virtual member call function. |
| 205 | virtual StringRef GetPureVirtualCallName() = 0; |
| 206 | |
David Blaikie | 2eb9a95 | 2012-10-16 22:56:05 +0000 | [diff] [blame] | 207 | /// Gets the deleted virtual member call name. |
| 208 | virtual StringRef GetDeletedVirtualCallName() = 0; |
| 209 | |
John McCall | 1e7fe75 | 2010-09-02 09:58:18 +0000 | [diff] [blame] | 210 | /**************************** Array cookies ******************************/ |
| 211 | |
| 212 | /// Returns the extra size required in order to store the array |
James Dennett | 16ae9de | 2012-06-22 10:16:05 +0000 | [diff] [blame] | 213 | /// cookie for the given new-expression. May return 0 to indicate that no |
John McCall | 1e7fe75 | 2010-09-02 09:58:18 +0000 | [diff] [blame] | 214 | /// array cookie is required. |
| 215 | /// |
| 216 | /// Several cases are filtered out before this method is called: |
| 217 | /// - non-array allocations never need a cookie |
James Dennett | 5900103 | 2012-06-20 00:57:15 +0000 | [diff] [blame] | 218 | /// - calls to \::operator new(size_t, void*) never need a cookie |
John McCall | 1e7fe75 | 2010-09-02 09:58:18 +0000 | [diff] [blame] | 219 | /// |
James Dennett | 16ae9de | 2012-06-22 10:16:05 +0000 | [diff] [blame] | 220 | /// \param expr - the new-expression being allocated. |
John McCall | 6ec278d | 2011-01-27 09:37:56 +0000 | [diff] [blame] | 221 | virtual CharUnits GetArrayCookieSize(const CXXNewExpr *expr); |
John McCall | 1e7fe75 | 2010-09-02 09:58:18 +0000 | [diff] [blame] | 222 | |
| 223 | /// Initialize the array cookie for the given allocation. |
| 224 | /// |
| 225 | /// \param NewPtr - a char* which is the presumed-non-null |
| 226 | /// return value of the allocation function |
| 227 | /// \param NumElements - the computed number of elements, |
John McCall | e2b45e2 | 2012-05-01 05:23:51 +0000 | [diff] [blame] | 228 | /// potentially collapsed from the multidimensional array case; |
| 229 | /// always a size_t |
John McCall | 1e7fe75 | 2010-09-02 09:58:18 +0000 | [diff] [blame] | 230 | /// \param ElementType - the base element allocated type, |
| 231 | /// i.e. the allocated type after stripping all array types |
| 232 | virtual llvm::Value *InitializeArrayCookie(CodeGenFunction &CGF, |
| 233 | llvm::Value *NewPtr, |
| 234 | llvm::Value *NumElements, |
John McCall | 6ec278d | 2011-01-27 09:37:56 +0000 | [diff] [blame] | 235 | const CXXNewExpr *expr, |
John McCall | 1e7fe75 | 2010-09-02 09:58:18 +0000 | [diff] [blame] | 236 | QualType ElementType); |
| 237 | |
| 238 | /// Reads the array cookie associated with the given pointer, |
| 239 | /// if it has one. |
| 240 | /// |
| 241 | /// \param Ptr - a pointer to the first element in the array |
| 242 | /// \param ElementType - the base element type of elements of the array |
| 243 | /// \param NumElements - an out parameter which will be initialized |
| 244 | /// with the number of elements allocated, or zero if there is no |
| 245 | /// cookie |
| 246 | /// \param AllocPtr - an out parameter which will be initialized |
| 247 | /// with a char* pointing to the address returned by the allocation |
| 248 | /// function |
| 249 | /// \param CookieSize - an out parameter which will be initialized |
| 250 | /// with the size of the cookie, or zero if there is no cookie |
| 251 | virtual void ReadArrayCookie(CodeGenFunction &CGF, llvm::Value *Ptr, |
John McCall | 6ec278d | 2011-01-27 09:37:56 +0000 | [diff] [blame] | 252 | const CXXDeleteExpr *expr, |
John McCall | 1e7fe75 | 2010-09-02 09:58:18 +0000 | [diff] [blame] | 253 | QualType ElementType, llvm::Value *&NumElements, |
| 254 | llvm::Value *&AllocPtr, CharUnits &CookieSize); |
| 255 | |
John McCall | e2b45e2 | 2012-05-01 05:23:51 +0000 | [diff] [blame] | 256 | protected: |
| 257 | /// Returns the extra size required in order to store the array |
| 258 | /// cookie for the given type. Assumes that an array cookie is |
| 259 | /// required. |
| 260 | virtual CharUnits getArrayCookieSizeImpl(QualType elementType); |
| 261 | |
| 262 | /// Reads the array cookie for an allocation which is known to have one. |
| 263 | /// This is called by the standard implementation of ReadArrayCookie. |
| 264 | /// |
| 265 | /// \param ptr - a pointer to the allocation made for an array, as a char* |
| 266 | /// \param cookieSize - the computed cookie size of an array |
James Dennett | 3b2adf2 | 2012-06-15 07:35:42 +0000 | [diff] [blame] | 267 | /// |
John McCall | e2b45e2 | 2012-05-01 05:23:51 +0000 | [diff] [blame] | 268 | /// Other parameters are as above. |
James Dennett | 3b2adf2 | 2012-06-15 07:35:42 +0000 | [diff] [blame] | 269 | /// |
John McCall | e2b45e2 | 2012-05-01 05:23:51 +0000 | [diff] [blame] | 270 | /// \return a size_t |
| 271 | virtual llvm::Value *readArrayCookieImpl(CodeGenFunction &IGF, |
| 272 | llvm::Value *ptr, |
| 273 | CharUnits cookieSize); |
| 274 | |
| 275 | public: |
| 276 | |
John McCall | 5cd91b5 | 2010-09-08 01:44:27 +0000 | [diff] [blame] | 277 | /*************************** Static local guards ****************************/ |
| 278 | |
John McCall | 3030eb8 | 2010-11-06 09:44:32 +0000 | [diff] [blame] | 279 | /// Emits the guarded initializer and destructor setup for the given |
| 280 | /// variable, given that it couldn't be emitted as a constant. |
Richard Smith | 7ca4850 | 2012-02-13 22:16:19 +0000 | [diff] [blame] | 281 | /// If \p PerformInit is false, the initialization has been folded to a |
| 282 | /// constant and should not be performed. |
John McCall | 3030eb8 | 2010-11-06 09:44:32 +0000 | [diff] [blame] | 283 | /// |
| 284 | /// The variable may be: |
| 285 | /// - a static local variable |
| 286 | /// - a static data member of a class template instantiation |
| 287 | virtual void EmitGuardedInit(CodeGenFunction &CGF, const VarDecl &D, |
Chandler Carruth | 0f30a12 | 2012-03-30 19:44:53 +0000 | [diff] [blame] | 288 | llvm::GlobalVariable *DeclPtr, bool PerformInit); |
John McCall | 5cd91b5 | 2010-09-08 01:44:27 +0000 | [diff] [blame] | 289 | |
John McCall | 20bb175 | 2012-05-01 06:13:13 +0000 | [diff] [blame] | 290 | /// Emit code to force the execution of a destructor during global |
| 291 | /// teardown. The default implementation of this uses atexit. |
| 292 | /// |
| 293 | /// \param dtor - a function taking a single pointer argument |
| 294 | /// \param addr - a pointer to pass to the destructor function. |
| 295 | virtual void registerGlobalDtor(CodeGenFunction &CGF, llvm::Constant *dtor, |
| 296 | llvm::Constant *addr); |
Charles Davis | 9ee494f | 2012-06-23 23:44:00 +0000 | [diff] [blame] | 297 | |
| 298 | /***************************** Virtual Tables *******************************/ |
| 299 | |
| 300 | /// Generates and emits the virtual tables for a class. |
| 301 | virtual void EmitVTables(const CXXRecordDecl *Class) = 0; |
Charles Davis | 3a811f1 | 2010-05-25 19:52:27 +0000 | [diff] [blame] | 302 | }; |
| 303 | |
| 304 | /// Creates an instance of a C++ ABI class. |
John McCall | ee79a4c | 2010-08-21 22:46:04 +0000 | [diff] [blame] | 305 | CGCXXABI *CreateARMCXXABI(CodeGenModule &CGM); |
Charles Davis | 071cc7d | 2010-08-16 03:33:14 +0000 | [diff] [blame] | 306 | CGCXXABI *CreateItaniumCXXABI(CodeGenModule &CGM); |
| 307 | CGCXXABI *CreateMicrosoftCXXABI(CodeGenModule &CGM); |
John McCall | 93d557b | 2010-08-22 00:05:51 +0000 | [diff] [blame] | 308 | |
Charles Davis | 3a811f1 | 2010-05-25 19:52:27 +0000 | [diff] [blame] | 309 | } |
| 310 | } |
| 311 | |
| 312 | #endif |