clang: lib/CodeGen/CodeGenTypes.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENTYPES_H

14#define LLVM_CLANG_LIB_CODEGEN_CODEGENTYPES_H

15

19#include "llvm/ADT/DenseMap.h"

20#include "llvm/IR/Module.h"

21

22namespace llvm {

23class FunctionType;

24class DataLayout;

26class LLVMContext;

27class StructType;

28}

29

31class ASTContext;

32template <typename> class CanQual;

33class CXXConstructorDecl;

34class CXXMethodDecl;

35class CodeGenOptions;

36class FunctionProtoType;

37class QualType;

38class RecordDecl;

39class TagDecl;

40class TargetInfo;

43class GlobalDecl;

44

45namespace CodeGen {

46class ABIInfo;

47class CGCXXABI;

48class CGRecordLayout;

49class CodeGenModule;

50class RequiredArgs;

51

52

53

56

58 llvm::Module &TheModule;

60

61

62

63

64

65 llvm::DenseMap<const ObjCInterfaceType*, llvm::Type *> InterfaceTypes;

66

67

68 llvm::DenseMap<const Type*, std::unique_ptr> CGRecordLayouts;

69

70

71 llvm::DenseMap<const Type*, llvm::StructType *> RecordDeclTypes;

72

73

74 llvm::FoldingSet FunctionInfos{FunctionInfosLog2InitSize};

75

77

78

79

80 bool SkippedLayout;

81

82

83 bool LongDoubleReferenced;

84

85

86

87 llvm::DenseMap<const Type *, llvm::Type *> TypeCache;

88

89 llvm::DenseMap<const Type *, llvm::Type *> RecordsWithOpaqueMemberPointers;

90

91 static constexpr unsigned FunctionInfosLog2InitSize = 9;

92

93 llvm::Type *ConvertFunctionTypeInternal(QualType FT);

94

95public:

98

100 return TheModule.getDataLayout();

101 }

106 llvm::LLVMContext &getLLVMContext() { return TheModule.getContext(); }

108

109

111

112

113

115

116

118

119

120

121

122

124

125

126

127

128

129

130

132 llvm::Type *LLVMTy = nullptr);

133

134

135

136

137

138

139

140

141

142

143

144

145

147

148

150

152

153

154

155

158

159

160

163

164

165

166

168

170

171

172

174

175

176

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

200

201

202

203

204

207

208

209

213 bool ChainCall);

216

217

218

220

221

222

231

232

239

240

246

247

253 unsigned ExtraPrefixArgs,

254 unsigned ExtraSuffixArgs,

255 bool PassProtoArgs = true);

256

260 unsigned numPrefixArgs);

268

269

270

271

272

273

274

280

281

283 llvm::StructType *Ty);

284

285

286

288 StringRef suffix);

289

290

291public:

292

294

295

296

299

300

301

303

304

305

307

308

309

311

315};

316

317}

318}

319

320#endif

Enums/classes describing ABI related information about constructors, destructors and thunks.

llvm::MachO::Target Target

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

Represents a C++ constructor within a class.

Represents a static or instance method of a struct/union/class.

Represents a C++ struct/union/class.

CodeGenOptions - Track various options which control how the code is optimized and passed to the back...

Implements C++ ABI-specific code generation functions.

CGFunctionInfo - Class to encapsulate the information about a function definition.

CGRecordLayout - This class handles struct and union layout info while lowering AST types to LLVM typ...

CallArgList - Type for representing both the value and type of arguments in a call.

This class organizes the cross-function state that is used while generating LLVM code.

This class organizes the cross-module state that is used while lowering AST types to LLVM types.

const CGFunctionInfo & arrangeCXXMethodType(const CXXRecordDecl *RD, const FunctionProtoType *FTP, const CXXMethodDecl *MD)

Arrange the argument and result information for a call to an unknown C++ non-static member function o...

llvm::Type * ConvertType(QualType T)

ConvertType - Convert type T into a llvm::Type.

CGCXXABI & getCXXABI() const

const CGFunctionInfo & arrangeCXXMethodDeclaration(const CXXMethodDecl *MD)

C++ methods have some special rules and also have implicit parameters.

bool isPointerZeroInitializable(QualType T)

Check if the pointer type can be zero-initialized (in the C++ sense) with an LLVM zeroinitializer.

const CodeGenOptions & getCodeGenOpts() const

ASTContext & getContext() const

const CGFunctionInfo & arrangeLLVMFunctionInfo(CanQualType returnType, FnInfoOpts opts, ArrayRef< CanQualType > argTypes, FunctionType::ExtInfo info, ArrayRef< FunctionProtoType::ExtParameterInfo > paramInfos, RequiredArgs args)

"Arrange" the LLVM information for a call or type with the given signature.

const CGFunctionInfo & arrangeFreeFunctionType(CanQual< FunctionProtoType > Ty)

Arrange the argument and result information for a value of the given freestanding function type.

CanQualType DeriveThisType(const CXXRecordDecl *RD, const CXXMethodDecl *MD)

Derives the 'this' type for codegen purposes, i.e.

llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)

GetFunctionType - Get the LLVM function type for.

bool inheritingCtorHasParams(const InheritedConstructor &Inherited, CXXCtorType Type)

Determine if a C++ inheriting constructor should have parameters matching those of its inherited cons...

bool isFuncTypeConvertible(const FunctionType *FT)

isFuncTypeConvertible - Utility to check whether a function type can be converted to an LLVM type (i....

const CGFunctionInfo & arrangeBlockFunctionCall(const CallArgList &args, const FunctionType *type)

A block function is essentially a free function with an extra implicit argument.

const CGFunctionInfo & arrangeBuiltinFunctionDeclaration(QualType resultType, const FunctionArgList &args)

A builtin function is a freestanding function using the default C conventions.

const CGFunctionInfo & arrangeUnprototypedObjCMessageSend(QualType returnType, const CallArgList &args)

const TargetInfo & getTarget() const

std::unique_ptr< CGRecordLayout > ComputeRecordLayout(const RecordDecl *D, llvm::StructType *Ty)

Compute a new LLVM record layout object for the given record.

llvm::Type * convertTypeForLoadStore(QualType T, llvm::Type *LLVMTy=nullptr)

Given that T is a scalar type, return the IR type that should be used for load and store operations.

const CGRecordLayout & getCGRecordLayout(const RecordDecl *)

getCGRecordLayout - Return record layout info for the given record decl.

unsigned getTargetAddressSpace(QualType T) const

void getExpandedTypes(QualType Ty, SmallVectorImpl< llvm::Type * >::iterator &TI)

getExpandedTypes - Expand the type

llvm::StructType * ConvertRecordDeclType(const RecordDecl *TD)

ConvertRecordDeclType - Lay out a tagged decl type like struct or union.

void RefreshTypeCacheForClass(const CXXRecordDecl *RD)

Remove stale types from the type cache when an inheritance model gets assigned to a class.

bool isRecordLayoutComplete(const Type *Ty) const

isRecordLayoutComplete - Return true if the specified type is already completely laid out.

llvm::Type * ConvertTypeForMem(QualType T)

ConvertTypeForMem - Convert type T into a llvm::Type.

const CGFunctionInfo & arrangeObjCMethodDeclaration(const ObjCMethodDecl *MD)

Objective-C methods are C functions with some implicit parameters.

CodeGenModule & getCGM() const

void UpdateCompletedType(const TagDecl *TD)

UpdateCompletedType - When we find the full definition for a TagDecl, replace the 'opaque' type we pr...

llvm::LLVMContext & getLLVMContext()

bool typeRequiresSplitIntoByteArray(QualType ASTTy, llvm::Type *LLVMTy=nullptr)

Check whether the given type needs to be laid out in memory using an opaque byte-array type because i...

const CGFunctionInfo & arrangeGlobalDeclaration(GlobalDecl GD)

bool isLongDoubleReferenced() const

const CGFunctionInfo & arrangeUnprototypedMustTailThunk(const CXXMethodDecl *MD)

Arrange a thunk that takes 'this' as the first parameter followed by varargs.

const CGFunctionInfo & arrangeCXXMethodCall(const CallArgList &args, const FunctionProtoType *type, RequiredArgs required, unsigned numPrefixArgs)

Arrange a call to a C++ method, passing the given arguments.

const llvm::DataLayout & getDataLayout() const

const CGFunctionInfo & arrangeFreeFunctionCall(const CallArgList &Args, const FunctionType *Ty, bool ChainCall)

Figure out the rules for calling a function with the given formal type using the given arguments.

bool isFuncParamTypeConvertible(QualType Ty)

isFuncParamTypeConvertible - Return true if the specified type in a function parameter or result posi...

const CGFunctionInfo & arrangeBuiltinFunctionCall(QualType resultType, const CallArgList &args)

const CGFunctionInfo & arrangeFunctionDeclaration(const FunctionDecl *FD)

Free functions are functions that are compatible with an ordinary C function pointer type.

bool isZeroInitializable(QualType T)

IsZeroInitializable - Return whether a type can be zero-initialized (in the C++ sense) with an LLVM z...

const CGFunctionInfo & arrangeBlockFunctionDeclaration(const FunctionProtoType *type, const FunctionArgList &args)

Block invocation functions are C functions with an implicit parameter.

unsigned ClangCallConvToLLVMCallConv(CallingConv CC)

Convert clang calling convention to LLVM callilng convention.

llvm::Type * GetFunctionTypeForVTable(GlobalDecl GD)

GetFunctionTypeForVTable - Get the LLVM function type for use in a vtable, given a CXXMethodDecl.

void addRecordTypeName(const RecordDecl *RD, llvm::StructType *Ty, StringRef suffix)

addRecordTypeName - Compute a name from the given record decl with an optional suffix and name the gi...

const CGFunctionInfo & arrangeCXXConstructorCall(const CallArgList &Args, const CXXConstructorDecl *D, CXXCtorType CtorKind, unsigned ExtraPrefixArgs, unsigned ExtraSuffixArgs, bool PassProtoArgs=true)

Arrange a call to a C++ method, passing the given arguments.

const CGFunctionInfo & arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD, QualType receiverType)

Arrange the argument and result information for the function type through which to perform a send to ...

const CGFunctionInfo & arrangeCXXStructorDeclaration(GlobalDecl GD)

const CGFunctionInfo & arrangeMSCtorClosure(const CXXConstructorDecl *CD, CXXCtorType CT)

const CGFunctionInfo & arrangeCall(const CGFunctionInfo &declFI, const CallArgList &args)

Given a function info for a declaration, return the function info for a call with the given arguments...

const CGFunctionInfo & arrangeNullaryFunction()

A nullary function is a freestanding function of type 'void ()'.

FunctionArgList - Type for representing both the decl and type of parameters to a function.

A class for recording the number of arguments that a function signature requires.

Represents a function declaration or definition.

Represents a prototype with parameter type info, e.g.

A class which abstracts out some details necessary for making a call.

FunctionType - C99 6.7.5.3 - Function Declarators.

GlobalDecl - represents a global declaration.

Description of a constructor that was inherited from a base class.

ObjCMethodDecl - Represents an instance or class method declaration.

A (possibly-)qualified type.

Represents a struct/union/class.

Represents the declaration of a struct/union/class/enum.

Exposes information about the current target.

The base class of the type hierarchy.

const internal::VariadicAllOfMatcher< Type > type

Matches Types in the clang AST.

The JSON file list parser is used to communicate input to InstallAPI.

CXXCtorType

C++ constructor types.

CanQual< Type > CanQualType

Represents a canonical, potentially-qualified type.

const FunctionProtoType * T

CallingConv

CallingConv - Specifies the calling convention that a function uses.

Diagnostic wrappers for TextAPI types for error reporting.