1 //===----- CGCXXABI.h - Interface to C++ ABIs -------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This provides an abstract class for C++ code generation. Concrete subclasses
11 // of this implement code generation for specific C++ ABIs.
13 //===----------------------------------------------------------------------===//
15 #ifndef CLANG_CODEGEN_CXXABI_H
16 #define CLANG_CODEGEN_CXXABI_H
27 class MemberPointerType;
31 class CodeGenFunction;
35 /// Implements C++ ABI-specific code generation functions.
40 CGCXXABI(CodeGenModule &CGM) : CGM(CGM) {}
46 /// Gets the mangle context.
47 virtual MangleContext &getMangleContext() = 0;
50 EmitLoadOfMemberFunctionPointer(CodeGenFunction &CGF,
53 const MemberPointerType *MPT);
56 EmitMemberFunctionPointerConversion(CodeGenFunction &CGF,
60 // Manipulations on constant expressions.
62 /// \brief Returns true if the given member pointer can be
63 /// zero-initialized (in the C++ sense) with an LLVM
65 virtual bool isZeroInitializable(const MemberPointerType *MPT);
67 virtual llvm::Constant *
68 EmitMemberFunctionPointerConversion(llvm::Constant *C,
71 virtual llvm::Constant *
72 EmitNullMemberFunctionPointer(const MemberPointerType *MPT);
74 virtual llvm::Constant *EmitMemberFunctionPointer(const CXXMethodDecl *MD);
77 EmitMemberFunctionPointerComparison(CodeGenFunction &CGF,
80 const MemberPointerType *MPT,
84 EmitMemberFunctionPointerIsNotNull(CodeGenFunction &CGF,
86 const MemberPointerType *MPT);
89 /// Creates an instance of a C++ ABI class.
90 CGCXXABI *CreateARMCXXABI(CodeGenModule &CGM);
91 CGCXXABI *CreateItaniumCXXABI(CodeGenModule &CGM);
92 CGCXXABI *CreateMicrosoftCXXABI(CodeGenModule &CGM);