CGCXXABI.h revision 9063302a82423cb83f002257a416741850739a70
13a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis//===----- CGCXXABI.h - Interface to C++ ABIs -------------------*- C++ -*-===//
23a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis//
33a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis//                     The LLVM Compiler Infrastructure
43a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis//
53a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis// This file is distributed under the University of Illinois Open Source
63a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis// License. See LICENSE.TXT for details.
73a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis//
83a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis//===----------------------------------------------------------------------===//
93a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis//
103a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis// This provides an abstract class for C++ code generation. Concrete subclasses
113a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis// of this implement code generation for specific C++ ABIs.
123a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis//
133a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis//===----------------------------------------------------------------------===//
143a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis
153a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis#ifndef CLANG_CODEGEN_CXXABI_H
163a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis#define CLANG_CODEGEN_CXXABI_H
173a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis
184c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall#include "CodeGenFunction.h"
1955fc873017f10f6f566b182b70f6fc22aefa3464Chandler Carruth#include "clang/Basic/LLVM.h"
204c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall
2193d557bc1867b7d7b102f87290194b4be7932c92John McCallnamespace llvm {
22cf2c85e76fdafe7e634810a292321a6c8322483dJohn McCall  class Constant;
230bab0cdab751248ca389a5592bcb70eac5d39260John McCall  class Type;
2493d557bc1867b7d7b102f87290194b4be7932c92John McCall  class Value;
2593d557bc1867b7d7b102f87290194b4be7932c92John McCall}
2693d557bc1867b7d7b102f87290194b4be7932c92John McCall
273a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davisnamespace clang {
283023def6bea3af6dbb51eea51f8cb8ea892d26cfJohn McCall  class CastExpr;
294c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  class CXXConstructorDecl;
304c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  class CXXDestructorDecl;
31875ab10245d3bf37252dd822aa1616bb0a391095John McCall  class CXXMethodDecl;
32cf2c85e76fdafe7e634810a292321a6c8322483dJohn McCall  class CXXRecordDecl;
330bab0cdab751248ca389a5592bcb70eac5d39260John McCall  class FieldDecl;
3414110477887e3dc168ffc6c191e72d705051f99ePeter Collingbourne  class MangleContext;
3593d557bc1867b7d7b102f87290194b4be7932c92John McCall
363a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davisnamespace CodeGen {
3793d557bc1867b7d7b102f87290194b4be7932c92John McCall  class CodeGenFunction;
383a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis  class CodeGenModule;
393a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis
403b2adf237ab033173d7789ec1214d654eec17697James Dennett/// \brief Implements C++ ABI-specific code generation functions.
41071cc7deffad608165b1ddd5263e8bf181861520Charles Davisclass CGCXXABI {
42d608cdb7c044365cf4e8764ade1e11e99c176078John McCallprotected:
43d608cdb7c044365cf4e8764ade1e11e99c176078John McCall  CodeGenModule &CGM;
446f42b62b6194f53bcbc349f5d17388e1936535d7Dylan Noblesmith  OwningPtr<MangleContext> MangleCtx;
45d608cdb7c044365cf4e8764ade1e11e99c176078John McCall
4614110477887e3dc168ffc6c191e72d705051f99ePeter Collingbourne  CGCXXABI(CodeGenModule &CGM)
4714110477887e3dc168ffc6c191e72d705051f99ePeter Collingbourne    : CGM(CGM), MangleCtx(CGM.getContext().createMangleContext()) {}
48d608cdb7c044365cf4e8764ade1e11e99c176078John McCall
494c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCallprotected:
504c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  ImplicitParamDecl *&getThisDecl(CodeGenFunction &CGF) {
51cec5ebd4a6a89a7023d04cec728fd340b541ed61Eli Friedman    return CGF.CXXABIThisDecl;
524c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  }
534c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  llvm::Value *&getThisValue(CodeGenFunction &CGF) {
54cec5ebd4a6a89a7023d04cec728fd340b541ed61Eli Friedman    return CGF.CXXABIThisValue;
554c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  }
564c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall
57a8a0f769ff4113a7f98c232fb0fc773a65371559Reid Kleckner  /// Issue a diagnostic about unsupported features in the ABI.
58a8a0f769ff4113a7f98c232fb0fc773a65371559Reid Kleckner  void ErrorUnsupportedABI(CodeGenFunction &CGF, StringRef S);
59a8a0f769ff4113a7f98c232fb0fc773a65371559Reid Kleckner
60a8a0f769ff4113a7f98c232fb0fc773a65371559Reid Kleckner  /// Get a null value for unsupported member pointers.
61a8a0f769ff4113a7f98c232fb0fc773a65371559Reid Kleckner  llvm::Constant *GetBogusMemberPointer(QualType T);
62a8a0f769ff4113a7f98c232fb0fc773a65371559Reid Kleckner
6359660c21178b6af518bd4b564e032d5c9cc218cbTimur Iskhodzhanov  // FIXME: Every place that calls getVTT{Decl,Value} is something
6459660c21178b6af518bd4b564e032d5c9cc218cbTimur Iskhodzhanov  // that needs to be abstracted properly.
654c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  ImplicitParamDecl *&getVTTDecl(CodeGenFunction &CGF) {
6659660c21178b6af518bd4b564e032d5c9cc218cbTimur Iskhodzhanov    return CGF.CXXStructorImplicitParamDecl;
674c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  }
684c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  llvm::Value *&getVTTValue(CodeGenFunction &CGF) {
6959660c21178b6af518bd4b564e032d5c9cc218cbTimur Iskhodzhanov    return CGF.CXXStructorImplicitParamValue;
7059660c21178b6af518bd4b564e032d5c9cc218cbTimur Iskhodzhanov  }
7159660c21178b6af518bd4b564e032d5c9cc218cbTimur Iskhodzhanov
7259660c21178b6af518bd4b564e032d5c9cc218cbTimur Iskhodzhanov  ImplicitParamDecl *&getStructorImplicitParamDecl(CodeGenFunction &CGF) {
7359660c21178b6af518bd4b564e032d5c9cc218cbTimur Iskhodzhanov    return CGF.CXXStructorImplicitParamDecl;
7459660c21178b6af518bd4b564e032d5c9cc218cbTimur Iskhodzhanov  }
7559660c21178b6af518bd4b564e032d5c9cc218cbTimur Iskhodzhanov  llvm::Value *&getStructorImplicitParamValue(CodeGenFunction &CGF) {
7659660c21178b6af518bd4b564e032d5c9cc218cbTimur Iskhodzhanov    return CGF.CXXStructorImplicitParamValue;
774c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  }
784c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall
794c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// Build a parameter variable suitable for 'this'.
804c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  void BuildThisParam(CodeGenFunction &CGF, FunctionArgList &Params);
814c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall
824c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// Perform prolog initialization of the parameter variable suitable
834c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// for 'this' emitted by BuildThisParam.
844c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  void EmitThisParam(CodeGenFunction &CGF);
854c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall
861e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ASTContext &getContext() const { return CGM.getContext(); }
871e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall
88e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  virtual bool requiresArrayCookie(const CXXDeleteExpr *E, QualType eltType);
89e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  virtual bool requiresArrayCookie(const CXXNewExpr *E);
90e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall
913a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davispublic:
92d608cdb7c044365cf4e8764ade1e11e99c176078John McCall
931af610f8533b8b4a7b0b176aa8082f5b6dde904cAnders Carlsson  virtual ~CGCXXABI();
943a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis
953a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis  /// Gets the mangle context.
9614110477887e3dc168ffc6c191e72d705051f99ePeter Collingbourne  MangleContext &getMangleContext() {
9714110477887e3dc168ffc6c191e72d705051f99ePeter Collingbourne    return *MangleCtx;
9814110477887e3dc168ffc6c191e72d705051f99ePeter Collingbourne  }
9993d557bc1867b7d7b102f87290194b4be7932c92John McCall
100d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// Returns true if the given constructor or destructor is one of the
101d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// kinds that the ABI says returns 'this' (only applies when called
102d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// non-virtually for destructors).
103d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  ///
104d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// There currently is no way to indicate if a destructor returns 'this'
105d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// when called virtually, and code generation does not support the case.
10663fd408a61ae9b94e8d8a986832f526f7cdbfa84Manman Ren  virtual bool HasThisReturn(GlobalDecl GD) const { return false; }
10763fd408a61ae9b94e8d8a986832f526f7cdbfa84Manman Ren
108ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov  /// Returns true if the given record type should be returned indirectly.
109ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov  virtual bool isReturnTypeIndirect(const CXXRecordDecl *RD) const = 0;
110ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov
111ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov  /// Specify how one should pass an argument of a record type.
112ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov  enum RecordArgABI {
113ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov    /// Pass it using the normal C aggregate rules for the ABI, potentially
114ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov    /// introducing extra copies and passing some or all of it in registers.
115ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov    RAA_Default = 0,
116ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov
117ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov    /// Pass it on the stack using its defined layout.  The argument must be
118ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov    /// evaluated directly into the correct stack position in the arguments area,
119ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov    /// and the call machinery must not move it or introduce extra copies.
120ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov    RAA_DirectInMemory,
121ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov
122ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov    /// Pass it as a pointer to temporary memory.
123ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov    RAA_Indirect
124ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov  };
125ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov
126ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov  /// Returns how an argument of the given record type should be passed.
127ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov  virtual RecordArgABI getRecordArgABI(const CXXRecordDecl *RD) const = 0;
128ed23bdf69dd63e4fd01c02b12a13d1e6cbff9c2fTimur Iskhodzhanov
1290bab0cdab751248ca389a5592bcb70eac5d39260John McCall  /// Find the LLVM type used to represent the given member pointer
1300bab0cdab751248ca389a5592bcb70eac5d39260John McCall  /// type.
1319cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner  virtual llvm::Type *
1320bab0cdab751248ca389a5592bcb70eac5d39260John McCall  ConvertMemberPointerType(const MemberPointerType *MPT);
1330bab0cdab751248ca389a5592bcb70eac5d39260John McCall
1340bab0cdab751248ca389a5592bcb70eac5d39260John McCall  /// Load a member function from an object and a member function
1350bab0cdab751248ca389a5592bcb70eac5d39260John McCall  /// pointer.  Apply the this-adjustment and set 'This' to the
1360bab0cdab751248ca389a5592bcb70eac5d39260John McCall  /// adjusted value.
13793d557bc1867b7d7b102f87290194b4be7932c92John McCall  virtual llvm::Value *
13893d557bc1867b7d7b102f87290194b4be7932c92John McCall  EmitLoadOfMemberFunctionPointer(CodeGenFunction &CGF,
13993d557bc1867b7d7b102f87290194b4be7932c92John McCall                                  llvm::Value *&This,
14093d557bc1867b7d7b102f87290194b4be7932c92John McCall                                  llvm::Value *MemPtr,
14193d557bc1867b7d7b102f87290194b4be7932c92John McCall                                  const MemberPointerType *MPT);
1423023def6bea3af6dbb51eea51f8cb8ea892d26cfJohn McCall
1436c2ab1d578c6cc1f3ddcc948532cd625f1092ef2John McCall  /// Calculate an l-value from an object and a data member pointer.
1446c2ab1d578c6cc1f3ddcc948532cd625f1092ef2John McCall  virtual llvm::Value *EmitMemberDataPointerAddress(CodeGenFunction &CGF,
1456c2ab1d578c6cc1f3ddcc948532cd625f1092ef2John McCall                                                    llvm::Value *Base,
1466c2ab1d578c6cc1f3ddcc948532cd625f1092ef2John McCall                                                    llvm::Value *MemPtr,
1476c2ab1d578c6cc1f3ddcc948532cd625f1092ef2John McCall                                            const MemberPointerType *MPT);
1486c2ab1d578c6cc1f3ddcc948532cd625f1092ef2John McCall
1494d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall  /// Perform a derived-to-base, base-to-derived, or bitcast member
1504d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall  /// pointer conversion.
1510bab0cdab751248ca389a5592bcb70eac5d39260John McCall  virtual llvm::Value *EmitMemberPointerConversion(CodeGenFunction &CGF,
1520bab0cdab751248ca389a5592bcb70eac5d39260John McCall                                                   const CastExpr *E,
1530bab0cdab751248ca389a5592bcb70eac5d39260John McCall                                                   llvm::Value *Src);
154d608cdb7c044365cf4e8764ade1e11e99c176078John McCall
1554d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall  /// Perform a derived-to-base, base-to-derived, or bitcast member
1564d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall  /// pointer conversion on a constant value.
1574d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall  virtual llvm::Constant *EmitMemberPointerConversion(const CastExpr *E,
1584d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall                                                      llvm::Constant *Src);
1594d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall
1600bab0cdab751248ca389a5592bcb70eac5d39260John McCall  /// Return true if the given member pointer can be zero-initialized
1610bab0cdab751248ca389a5592bcb70eac5d39260John McCall  /// (in the C++ sense) with an LLVM zeroinitializer.
162f16aa103d3afd42fbca2ab346f191bf745cec092John McCall  virtual bool isZeroInitializable(const MemberPointerType *MPT);
163cf2c85e76fdafe7e634810a292321a6c8322483dJohn McCall
1640bab0cdab751248ca389a5592bcb70eac5d39260John McCall  /// Create a null member pointer of the given type.
1650bab0cdab751248ca389a5592bcb70eac5d39260John McCall  virtual llvm::Constant *EmitNullMemberPointer(const MemberPointerType *MPT);
166cf2c85e76fdafe7e634810a292321a6c8322483dJohn McCall
1670bab0cdab751248ca389a5592bcb70eac5d39260John McCall  /// Create a member pointer for the given method.
168755d8497e39071aa24acc173ff07083e3256b8f8John McCall  virtual llvm::Constant *EmitMemberPointer(const CXXMethodDecl *MD);
169875ab10245d3bf37252dd822aa1616bb0a391095John McCall
1700bab0cdab751248ca389a5592bcb70eac5d39260John McCall  /// Create a member pointer for the given field.
1715808ce43f8d7e71f5acacc9ca320268c4f37565aJohn McCall  virtual llvm::Constant *EmitMemberDataPointer(const MemberPointerType *MPT,
1725808ce43f8d7e71f5acacc9ca320268c4f37565aJohn McCall                                                CharUnits offset);
173e9fd7eb6c67676dc27e84eac429aec4f3be51f26John McCall
1742d6a5670465cb3f1d811695a9f23e372508240d2Richard Smith  /// Create a member pointer for the given member pointer constant.
1752d6a5670465cb3f1d811695a9f23e372508240d2Richard Smith  virtual llvm::Constant *EmitMemberPointer(const APValue &MP, QualType MPT);
1762d6a5670465cb3f1d811695a9f23e372508240d2Richard Smith
1770bab0cdab751248ca389a5592bcb70eac5d39260John McCall  /// Emit a comparison between two member pointers.  Returns an i1.
178e9fd7eb6c67676dc27e84eac429aec4f3be51f26John McCall  virtual llvm::Value *
1790bab0cdab751248ca389a5592bcb70eac5d39260John McCall  EmitMemberPointerComparison(CodeGenFunction &CGF,
1800bab0cdab751248ca389a5592bcb70eac5d39260John McCall                              llvm::Value *L,
1810bab0cdab751248ca389a5592bcb70eac5d39260John McCall                              llvm::Value *R,
1820bab0cdab751248ca389a5592bcb70eac5d39260John McCall                              const MemberPointerType *MPT,
1830bab0cdab751248ca389a5592bcb70eac5d39260John McCall                              bool Inequality);
184e9fd7eb6c67676dc27e84eac429aec4f3be51f26John McCall
1850bab0cdab751248ca389a5592bcb70eac5d39260John McCall  /// Determine if a member pointer is non-null.  Returns an i1.
186e9fd7eb6c67676dc27e84eac429aec4f3be51f26John McCall  virtual llvm::Value *
1870bab0cdab751248ca389a5592bcb70eac5d39260John McCall  EmitMemberPointerIsNotNull(CodeGenFunction &CGF,
1880bab0cdab751248ca389a5592bcb70eac5d39260John McCall                             llvm::Value *MemPtr,
1890bab0cdab751248ca389a5592bcb70eac5d39260John McCall                             const MemberPointerType *MPT);
1904c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall
1914d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCallprotected:
1924d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall  /// A utility method for computing the offset required for the given
1934d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall  /// base-to-derived or derived-to-base member-pointer conversion.
1944d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall  /// Does not handle virtual conversions (in case we ever fully
1954d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall  /// support an ABI that allows this).  Returns null if no adjustment
1964d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall  /// is required.
1974d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall  llvm::Constant *getMemberPointerAdjustment(const CastExpr *E);
1984d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCall
199f632730ffb0b8ca531a35e737b29cc9f9774ca1dReid Kleckner  /// \brief Computes the non-virtual adjustment needed for a member pointer
200f632730ffb0b8ca531a35e737b29cc9f9774ca1dReid Kleckner  /// conversion along an inheritance path stored in an APValue.  Unlike
201f632730ffb0b8ca531a35e737b29cc9f9774ca1dReid Kleckner  /// getMemberPointerAdjustment(), the adjustment can be negative if the path
202f632730ffb0b8ca531a35e737b29cc9f9774ca1dReid Kleckner  /// is from a derived type to a base type.
203f632730ffb0b8ca531a35e737b29cc9f9774ca1dReid Kleckner  CharUnits getMemberPointerPathAdjustment(const APValue &MP);
204f632730ffb0b8ca531a35e737b29cc9f9774ca1dReid Kleckner
2054d4e5c1ae83f4510caa486b3ad19de13048f9f04John McCallpublic:
206ecd03b447bb0e2ed1954c77441d49a4a17ca8138John McCall  /// Adjust the given non-null pointer to an object of polymorphic
207ecd03b447bb0e2ed1954c77441d49a4a17ca8138John McCall  /// type to point to the complete object.
208ecd03b447bb0e2ed1954c77441d49a4a17ca8138John McCall  ///
209ecd03b447bb0e2ed1954c77441d49a4a17ca8138John McCall  /// The IR type of the result should be a pointer but is otherwise
210ecd03b447bb0e2ed1954c77441d49a4a17ca8138John McCall  /// irrelevant.
211ecd03b447bb0e2ed1954c77441d49a4a17ca8138John McCall  virtual llvm::Value *adjustToCompleteObject(CodeGenFunction &CGF,
212ecd03b447bb0e2ed1954c77441d49a4a17ca8138John McCall                                              llvm::Value *ptr,
213ecd03b447bb0e2ed1954c77441d49a4a17ca8138John McCall                                              QualType type) = 0;
214ecd03b447bb0e2ed1954c77441d49a4a17ca8138John McCall
215b0f533e716ae5a21ca5682ea235a68082fd5ed28Reid Kleckner  virtual llvm::Value *GetVirtualBaseClassOffset(CodeGenFunction &CGF,
216b0f533e716ae5a21ca5682ea235a68082fd5ed28Reid Kleckner                                                 llvm::Value *This,
217b0f533e716ae5a21ca5682ea235a68082fd5ed28Reid Kleckner                                                 const CXXRecordDecl *ClassDecl,
218b0f533e716ae5a21ca5682ea235a68082fd5ed28Reid Kleckner                                        const CXXRecordDecl *BaseClassDecl) = 0;
219b0f533e716ae5a21ca5682ea235a68082fd5ed28Reid Kleckner
2204c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// Build the signature of the given constructor variant by adding
221d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// any required parameters.  For convenience, ArgTys has been initialized
222d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// with the type of 'this' and ResTy has been initialized with the type of
223d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// 'this' if HasThisReturn(GlobalDecl(Ctor, T)) is true or 'void' otherwise
224d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// (although both may be changed by the ABI).
2254c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  ///
2264c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// If there are ever any ABIs where the implicit parameters are
2274c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// intermixed with the formal parameters, we can address those
2284c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// then.
2294c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  virtual void BuildConstructorSignature(const CXXConstructorDecl *Ctor,
2304c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall                                         CXXCtorType T,
2314c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall                                         CanQualType &ResTy,
232686775deca8b8685eb90801495880e3abdd844c2Chris Lattner                               SmallVectorImpl<CanQualType> &ArgTys) = 0;
2334c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall
2349063302a82423cb83f002257a416741850739a70Reid Kleckner  virtual llvm::BasicBlock *EmitCtorCompleteObjectHandler(CodeGenFunction &CGF,
2359063302a82423cb83f002257a416741850739a70Reid Kleckner                                                          const CXXRecordDecl *RD);
2361d4fff5551c2347010b955b4337a2aa7d65a050eTimur Iskhodzhanov
2374c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// Build the signature of the given destructor variant by adding
238d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// any required parameters.  For convenience, ArgTys has been initialized
239d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// with the type of 'this' and ResTy has been initialized with the type of
240d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// 'this' if HasThisReturn(GlobalDecl(Dtor, T)) is true or 'void' otherwise
241d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// (although both may be changed by the ABI).
2424c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  virtual void BuildDestructorSignature(const CXXDestructorDecl *Dtor,
2434c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall                                        CXXDtorType T,
2444c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall                                        CanQualType &ResTy,
245686775deca8b8685eb90801495880e3abdd844c2Chris Lattner                               SmallVectorImpl<CanQualType> &ArgTys) = 0;
2464c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall
2474c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// Build the ABI-specific portion of the parameter list for a
2484c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// function.  This generally involves a 'this' parameter and
2494c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// possibly some extra data for constructors and destructors.
2504c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  ///
2514c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// ABIs may also choose to override the return type, which has been
252d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// initialized with the type of 'this' if HasThisReturn(CGF.CurGD) is true or
253d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  /// the formal return type of the function otherwise.
2544c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  virtual void BuildInstanceFunctionParams(CodeGenFunction &CGF,
2554c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall                                           QualType &ResTy,
2564c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall                                           FunctionArgList &Params) = 0;
2574c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall
2584c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  /// Emit the ABI-specific prolog for the function.
2594c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  virtual void EmitInstanceFunctionProlog(CodeGenFunction &CGF) = 0;
2604c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall
26163fd408a61ae9b94e8d8a986832f526f7cdbfa84Manman Ren  /// Emit the constructor call. Return the function that is called.
262d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin  virtual RValue EmitConstructorCall(CodeGenFunction &CGF,
263d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin                                     const CXXConstructorDecl *D,
264d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin                                     CXXCtorType Type,
265d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin                                     bool ForVirtualBase, bool Delegating,
266d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin                                     ReturnValueSlot ReturnValue,
267d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin                                     llvm::Value *This,
268d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin                                     CallExpr::const_arg_iterator ArgBeg,
269d4c0cd07641681de6ed12164aa7a4495ab4b18e5Stephen Lin                                     CallExpr::const_arg_iterator ArgEnd) = 0;
2701d4fff5551c2347010b955b4337a2aa7d65a050eTimur Iskhodzhanov
2710f9827f5d6248d7008063768eb5f2c3e6ba83e94Timur Iskhodzhanov  /// Emit the ABI-specific virtual destructor call.
2720f9827f5d6248d7008063768eb5f2c3e6ba83e94Timur Iskhodzhanov  virtual RValue EmitVirtualDestructorCall(CodeGenFunction &CGF,
2730f9827f5d6248d7008063768eb5f2c3e6ba83e94Timur Iskhodzhanov                                           const CXXDestructorDecl *Dtor,
2740f9827f5d6248d7008063768eb5f2c3e6ba83e94Timur Iskhodzhanov                                           CXXDtorType DtorType,
2750f9827f5d6248d7008063768eb5f2c3e6ba83e94Timur Iskhodzhanov                                           SourceLocation CallLoc,
2760f9827f5d6248d7008063768eb5f2c3e6ba83e94Timur Iskhodzhanov                                           ReturnValueSlot ReturnValue,
2770f9827f5d6248d7008063768eb5f2c3e6ba83e94Timur Iskhodzhanov                                           llvm::Value *This) = 0;
2780f9827f5d6248d7008063768eb5f2c3e6ba83e94Timur Iskhodzhanov
2799063302a82423cb83f002257a416741850739a70Reid Kleckner  /// Emit any tables needed to implement virtual inheritance.  For Itanium,
2809063302a82423cb83f002257a416741850739a70Reid Kleckner  /// this emits virtual table tables.  For the MSVC++ ABI, this emits virtual
2819063302a82423cb83f002257a416741850739a70Reid Kleckner  /// base tables.
2829063302a82423cb83f002257a416741850739a70Reid Kleckner  virtual void
2839063302a82423cb83f002257a416741850739a70Reid Kleckner      EmitVirtualInheritanceTables(llvm::GlobalVariable::LinkageTypes Linkage,
2849063302a82423cb83f002257a416741850739a70Reid Kleckner                                   const CXXRecordDecl *RD) = 0;
2859063302a82423cb83f002257a416741850739a70Reid Kleckner
2864c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall  virtual void EmitReturnFromThunk(CodeGenFunction &CGF,
2874c40d98ab7acf5f27fa89b17bd8fc0ef7683df37John McCall                                   RValue RV, QualType ResultType);
2881e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall
289285baac67d722beb6854f5faa45ee1aa62a7ce92Joao Matos  /// Gets the pure virtual member call function.
290285baac67d722beb6854f5faa45ee1aa62a7ce92Joao Matos  virtual StringRef GetPureVirtualCallName() = 0;
291285baac67d722beb6854f5faa45ee1aa62a7ce92Joao Matos
2922eb9a959d24ad757a82ecab61f343635ad67749aDavid Blaikie  /// Gets the deleted virtual member call name.
2932eb9a959d24ad757a82ecab61f343635ad67749aDavid Blaikie  virtual StringRef GetDeletedVirtualCallName() = 0;
2942eb9a959d24ad757a82ecab61f343635ad67749aDavid Blaikie
2951e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /**************************** Array cookies ******************************/
2961e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall
2971e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// Returns the extra size required in order to store the array
29816ae9de07730832945204877d752db7f1c070962James Dennett  /// cookie for the given new-expression.  May return 0 to indicate that no
2991e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// array cookie is required.
3001e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ///
3011e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// Several cases are filtered out before this method is called:
3021e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ///   - non-array allocations never need a cookie
3035900103d6606edef5fc81bbac685fa3651f1b936James Dennett  ///   - calls to \::operator new(size_t, void*) never need a cookie
3041e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ///
30516ae9de07730832945204877d752db7f1c070962James Dennett  /// \param expr - the new-expression being allocated.
3066ec278d1a354517e20f13a877481453ee7940c78John McCall  virtual CharUnits GetArrayCookieSize(const CXXNewExpr *expr);
3071e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall
3081e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// Initialize the array cookie for the given allocation.
3091e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ///
3101e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// \param NewPtr - a char* which is the presumed-non-null
3111e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ///   return value of the allocation function
3121e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// \param NumElements - the computed number of elements,
313e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  ///   potentially collapsed from the multidimensional array case;
314e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  ///   always a size_t
3151e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// \param ElementType - the base element allocated type,
3161e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ///   i.e. the allocated type after stripping all array types
3171e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  virtual llvm::Value *InitializeArrayCookie(CodeGenFunction &CGF,
3181e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall                                             llvm::Value *NewPtr,
3191e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall                                             llvm::Value *NumElements,
3206ec278d1a354517e20f13a877481453ee7940c78John McCall                                             const CXXNewExpr *expr,
3211e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall                                             QualType ElementType);
3221e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall
3231e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// Reads the array cookie associated with the given pointer,
3241e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// if it has one.
3251e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ///
3261e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// \param Ptr - a pointer to the first element in the array
3271e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// \param ElementType - the base element type of elements of the array
3281e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// \param NumElements - an out parameter which will be initialized
3291e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ///   with the number of elements allocated, or zero if there is no
3301e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ///   cookie
3311e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// \param AllocPtr - an out parameter which will be initialized
3321e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ///   with a char* pointing to the address returned by the allocation
3331e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ///   function
3341e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  /// \param CookieSize - an out parameter which will be initialized
3351e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  ///   with the size of the cookie, or zero if there is no cookie
3361e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall  virtual void ReadArrayCookie(CodeGenFunction &CGF, llvm::Value *Ptr,
3376ec278d1a354517e20f13a877481453ee7940c78John McCall                               const CXXDeleteExpr *expr,
3381e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall                               QualType ElementType, llvm::Value *&NumElements,
3391e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall                               llvm::Value *&AllocPtr, CharUnits &CookieSize);
3401e7fe751466ea82665fd21e9162fd7cc9c5f412dJohn McCall
341e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCallprotected:
342e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  /// Returns the extra size required in order to store the array
343e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  /// cookie for the given type.  Assumes that an array cookie is
344e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  /// required.
345e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  virtual CharUnits getArrayCookieSizeImpl(QualType elementType);
346e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall
347e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  /// Reads the array cookie for an allocation which is known to have one.
348e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  /// This is called by the standard implementation of ReadArrayCookie.
349e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  ///
350e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  /// \param ptr - a pointer to the allocation made for an array, as a char*
351e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  /// \param cookieSize - the computed cookie size of an array
3523b2adf237ab033173d7789ec1214d654eec17697James Dennett  ///
353e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  /// Other parameters are as above.
3543b2adf237ab033173d7789ec1214d654eec17697James Dennett  ///
355e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  /// \return a size_t
356e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall  virtual llvm::Value *readArrayCookieImpl(CodeGenFunction &IGF,
357e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall                                           llvm::Value *ptr,
358e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall                                           CharUnits cookieSize);
359e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall
360e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCallpublic:
361e2b45e2a43ae46bc00026b63ba7c04ef2b78c3ffJohn McCall
3625cd91b513455fd7753e8815b54f0a49bbca6602dJohn McCall  /*************************** Static local guards ****************************/
3635cd91b513455fd7753e8815b54f0a49bbca6602dJohn McCall
3643030eb82593097502469a8b3fc26112c79c75605John McCall  /// Emits the guarded initializer and destructor setup for the given
3653030eb82593097502469a8b3fc26112c79c75605John McCall  /// variable, given that it couldn't be emitted as a constant.
3667ca4850a3e3530fa6c93b64b740446e32c97f992Richard Smith  /// If \p PerformInit is false, the initialization has been folded to a
3677ca4850a3e3530fa6c93b64b740446e32c97f992Richard Smith  /// constant and should not be performed.
3683030eb82593097502469a8b3fc26112c79c75605John McCall  ///
3693030eb82593097502469a8b3fc26112c79c75605John McCall  /// The variable may be:
3703030eb82593097502469a8b3fc26112c79c75605John McCall  ///   - a static local variable
3713030eb82593097502469a8b3fc26112c79c75605John McCall  ///   - a static data member of a class template instantiation
3723030eb82593097502469a8b3fc26112c79c75605John McCall  virtual void EmitGuardedInit(CodeGenFunction &CGF, const VarDecl &D,
3730f30a12ce7b3d4d86c9ca9072f587da77c8eef34Chandler Carruth                               llvm::GlobalVariable *DeclPtr, bool PerformInit);
3745cd91b513455fd7753e8815b54f0a49bbca6602dJohn McCall
37520bb175cb8ae5844034828db094fb948c0e3454aJohn McCall  /// Emit code to force the execution of a destructor during global
37620bb175cb8ae5844034828db094fb948c0e3454aJohn McCall  /// teardown.  The default implementation of this uses atexit.
37720bb175cb8ae5844034828db094fb948c0e3454aJohn McCall  ///
37820bb175cb8ae5844034828db094fb948c0e3454aJohn McCall  /// \param dtor - a function taking a single pointer argument
37920bb175cb8ae5844034828db094fb948c0e3454aJohn McCall  /// \param addr - a pointer to pass to the destructor function.
38004e517650569598e847c2ab609672e6df93effe5Richard Smith  virtual void registerGlobalDtor(CodeGenFunction &CGF, const VarDecl &D,
38104e517650569598e847c2ab609672e6df93effe5Richard Smith                                  llvm::Constant *dtor, llvm::Constant *addr);
382b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith
383b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  /*************************** thread_local initialization ********************/
384b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith
385b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  /// Emits ABI-required functions necessary to initialize thread_local
386b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  /// variables in this translation unit.
387b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  ///
388b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  /// \param Decls The thread_local declarations in this translation unit.
389b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  /// \param InitFunc If this translation unit contains any non-constant
390b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  ///        initialization or non-trivial destruction for thread_local
391b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  ///        variables, a function to perform the initialization. Otherwise, 0.
392b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  virtual void EmitThreadLocalInitFuncs(
393b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith      llvm::ArrayRef<std::pair<const VarDecl *, llvm::GlobalVariable *> > Decls,
394b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith      llvm::Function *InitFunc);
395b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith
396b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  /// Emit a reference to a non-local thread_local variable (including
397b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  /// triggering the initialization of all thread_local variables in its
398b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  /// translation unit).
399b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith  virtual LValue EmitThreadLocalDeclRefExpr(CodeGenFunction &CGF,
400b80a16eadd0dacabfc1c32412e243ccb99dd664dRichard Smith                                            const DeclRefExpr *DRE);
4013a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis};
4023a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis
40396fcde0b8ed8bdf99d326312ca7be6447b0fe5fcJohn McCall// Create an instance of a C++ ABI class:
40496fcde0b8ed8bdf99d326312ca7be6447b0fe5fcJohn McCall
40596fcde0b8ed8bdf99d326312ca7be6447b0fe5fcJohn McCall/// Creates an Itanium-family ABI.
406071cc7deffad608165b1ddd5263e8bf181861520Charles DavisCGCXXABI *CreateItaniumCXXABI(CodeGenModule &CGM);
40796fcde0b8ed8bdf99d326312ca7be6447b0fe5fcJohn McCall
40896fcde0b8ed8bdf99d326312ca7be6447b0fe5fcJohn McCall/// Creates a Microsoft-family ABI.
409071cc7deffad608165b1ddd5263e8bf181861520Charles DavisCGCXXABI *CreateMicrosoftCXXABI(CodeGenModule &CGM);
41093d557bc1867b7d7b102f87290194b4be7932c92John McCall
4113a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis}
4123a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis}
4133a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis
4143a811f1f4286ee3fd0c563c1cfe623956f3caa24Charles Davis#endif
415