14 #ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENTYPES_H 15 #define LLVM_CLANG_LIB_CODEGEN_CODEGENTYPES_H 20 #include "llvm/ADT/DenseMap.h" 21 #include "llvm/IR/Module.h" 33 template <
typename>
class CanQual;
34 class CXXConstructorDecl;
35 class CXXDestructorDecl;
39 class FunctionProtoType;
40 class ObjCInterfaceDecl;
66 case StructorType::Complete:
68 case StructorType::Base:
70 case StructorType::Deleting:
71 llvm_unreachable(
"cannot have a deleting ctor");
73 llvm_unreachable(
"not a StructorType");
79 return StructorType::Complete;
81 return StructorType::Base;
83 llvm_unreachable(
"not expecting a COMDAT");
86 llvm_unreachable(
"not expecting a closure");
88 llvm_unreachable(
"not a CXXCtorType");
93 case StructorType::Complete:
95 case StructorType::Base:
97 case StructorType::Deleting:
100 llvm_unreachable(
"not a StructorType");
106 return StructorType::Deleting;
108 return StructorType::Complete;
110 return StructorType::Base;
112 llvm_unreachable(
"not expecting a COMDAT");
114 llvm_unreachable(
"not a CXXDtorType");
123 llvm::Module &TheModule;
135 llvm::DenseMap<const ObjCInterfaceType*, llvm::Type *> InterfaceTypes;
138 llvm::DenseMap<const Type*, CGRecordLayout *> CGRecordLayouts;
141 llvm::DenseMap<const Type*, llvm::StructType *> RecordDeclTypes;
144 llvm::FoldingSet<CGFunctionInfo> FunctionInfos;
150 llvm::SmallPtrSet<const Type*, 4> RecordsBeingLaidOut;
152 llvm::SmallPtrSet<const CGFunctionInfo*, 4> FunctionsBeingProcessed;
162 llvm::DenseMap<const Type *, llvm::Type *> TypeCache;
164 llvm::SmallSet<const Type *, 8> RecordsWithOpaqueMemberPointers;
171 return TheModule.getDataLayout();
181 unsigned ClangCallConvToLLVMCallConv(
CallingConv CC);
184 llvm::Type *ConvertType(
QualType T);
191 llvm::Type *ConvertFunctionType(
QualType FT,
198 llvm::Type *ConvertTypeForMem(
QualType T);
203 llvm::FunctionType *GetFunctionType(
GlobalDecl GD);
209 bool isFuncParamTypeConvertible(
QualType Ty);
219 llvm::Type *GetFunctionTypeForVTable(
GlobalDecl GD);
225 void UpdateCompletedType(
const TagDecl *TD);
277 arrangeBuiltinFunctionDeclaration(
QualType resultType,
280 arrangeBuiltinFunctionDeclaration(CanQualType resultType,
307 unsigned ExtraPrefixArgs,
308 unsigned ExtraSuffixArgs,
309 bool PassProtoArgs =
true);
314 unsigned numPrefixArgs);
339 llvm::StructType *Ty);
343 void addRecordTypeName(
const RecordDecl *RD, llvm::StructType *Ty,
349 llvm::StructType *ConvertRecordDeclType(
const RecordDecl *TD);
358 bool isZeroInitializable(
QualType T);
362 bool isPointerZeroInitializable(
QualType T);
366 bool isZeroInitializable(
const RecordDecl *RD);
368 bool isRecordLayoutComplete(
const Type *Ty)
const;
370 return RecordsBeingLaidOut.empty();
373 return RecordsBeingLaidOut.count(Ty);
bool noRecordsBeingLaidOut() const
CGCXXABI & getCXXABI() const
Represents a function declaration or definition.
A (possibly-)qualified type.
CGRecordLayout - This class handles struct and union layout info while lowering AST types to LLVM typ...
The COMDAT used for ctors.
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
const ABIInfo & getABIInfo() const
FunctionType - C99 6.7.5.3 - Function Declarators.
bool isRecordBeingLaidOut(const Type *Ty) const
const llvm::DataLayout & getDataLayout() const
The base class of the type hierarchy.
Represents a C++ constructor within a class.
Default closure variant of a ctor.
ObjCMethodDecl - Represents an instance or class method declaration.
const CGFunctionInfo & arrangeCXXMethodType(CodeGenModule &CGM, const CXXRecordDecl *RD, const FunctionProtoType *FTP, const CXXMethodDecl *MD)
Represents a struct/union/class.
Description of a constructor that was inherited from a base class.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
StructorType getFromDtorType(CXXDtorType T)
const CGFunctionInfo & arrangeFreeFunctionType(CodeGenModule &CGM, CanQual< FunctionProtoType > Ty, const FunctionDecl *FD)
Enums/classes describing ABI related information about constructors, destructors and thunks...
const CGFunctionInfo & arrangeObjCMessageSendSignature(CodeGenModule &CGM, const ObjCMethodDecl *MD, QualType receiverType)
Represents a prototype with parameter type info, e.g.
Exposes information about the current target.
CXXDtorType
C++ destructor types.
A class for recording the number of arguments that a function signature requires. ...
The COMDAT used for dtors.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
GlobalDecl - represents a global declaration.
Represents the declaration of a struct/union/class/enum.
Represents a static or instance method of a struct/union/class.
const CGFunctionInfo & arrangeFreeFunctionCall(CodeGenModule &CGM, CanQualType returnType, ArrayRef< CanQualType > argTypes, FunctionType::ExtInfo info, RequiredArgs args)
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
llvm::LLVMContext & getLLVMContext()
CXXCtorType
C++ constructor types.
FunctionArgList - Type for representing both the decl and type of parameters to a function...
const TargetInfo & getTarget() const
CGFunctionInfo - Class to encapsulate the information about a function definition.
This class organizes the cross-function state that is used while generating LLVM code.
Optional< types::ID > Type
Dataflow Directional Tag Classes.
CXXDtorType toCXXDtorType(StructorType T)
static const CGFunctionInfo & arrangeLLVMFunctionInfo(CodeGenTypes &CGT, bool instanceMethod, SmallVectorImpl< CanQualType > &prefix, CanQual< FunctionProtoType > FTP, const FunctionDecl *FD)
Arrange the LLVM function layout for a value of the given function type, on top of any implicit param...
StructorType getFromCtorType(CXXCtorType T)
Implements C++ ABI-specific code generation functions.
This class organizes the cross-module state that is used while lowering AST types to LLVM types...
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
ASTContext & getContext() const
Represents a C++ struct/union/class.
Copying closure variant of a ctor.
ABIInfo - Target specific hooks for defining how a type should be passed or returned from functions...
CXXCtorType toCXXCtorType(StructorType T)
CallArgList - Type for representing both the value and type of arguments in a call.
A class which abstracts out some details necessary for making a call.