Clang Project

clang_source_code/include/clang/CodeGen/CodeGenABITypes.h
1//==---- CodeGenABITypes.h - Convert Clang types to LLVM types for ABI -----==//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// CodeGenABITypes is a simple interface for getting LLVM types for
10// the parameters and the return value of a function given the Clang
11// types.
12//
13// The class is implemented as a public wrapper around the private
14// CodeGenTypes class in lib/CodeGen.
15//
16// It allows other clients, like LLDB, to determine the LLVM types that are
17// actually used in function calls, which makes it possible to then determine
18// the actual ABI locations (e.g. registers, stack locations, etc.) that
19// these parameters are stored in.
20//
21//===----------------------------------------------------------------------===//
22
23#ifndef LLVM_CLANG_CODEGEN_CODEGENABITYPES_H
24#define LLVM_CLANG_CODEGEN_CODEGENABITYPES_H
25
26#include "clang/AST/CanonicalType.h"
27#include "clang/AST/Type.h"
28#include "clang/CodeGen/CGFunctionInfo.h"
29
30namespace llvm {
31  class DataLayout;
32  class Module;
33  class FunctionType;
34  class Type;
35}
36
37namespace clang {
38class ASTContext;
39class CXXRecordDecl;
40class CXXMethodDecl;
41class CodeGenOptions;
42class CoverageSourceInfo;
43class DiagnosticsEngine;
44class HeaderSearchOptions;
45class ObjCMethodDecl;
46class PreprocessorOptions;
47
48namespace CodeGen {
49class CGFunctionInfo;
50class CodeGenModule;
51
52const CGFunctionInfo &arrangeObjCMessageSendSignature(CodeGenModule &CGM,
53                                                      const ObjCMethodDecl *MD,
54                                                      QualType receiverType);
55
56const CGFunctionInfo &arrangeFreeFunctionType(CodeGenModule &CGM,
57                                              CanQual<FunctionProtoTypeTy);
58
59const CGFunctionInfo &arrangeFreeFunctionType(CodeGenModule &CGM,
60                                              CanQual<FunctionNoProtoTypeTy);
61
62const CGFunctionInfo &arrangeCXXMethodType(CodeGenModule &CGM,
63                                           const CXXRecordDecl *RD,
64                                           const FunctionProtoType *FTP,
65                                           const CXXMethodDecl *MD);
66
67const CGFunctionInfo &arrangeFreeFunctionCall(CodeGenModule &CGM,
68                                              CanQualType returnType,
69                                              ArrayRef<CanQualTypeargTypes,
70                                              FunctionType::ExtInfo info,
71                                              RequiredArgs args);
72
73/// Returns null if the function type is incomplete and can't be lowered.
74llvm::FunctionType *convertFreeFunctionType(CodeGenModule &CGM,
75                                            const FunctionDecl *FD);
76
77llvm::Type *convertTypeForMemory(CodeGenModule &CGMQualType T);
78
79/// Given a non-bitfield struct field, return its index within the elements of
80/// the struct's converted type.  The returned index refers to a field number in
81/// the complete object type which is returned by convertTypeForMemory.  FD must
82/// be a field in RD directly (i.e. not an inherited field).
83unsigned getLLVMFieldNumber(CodeGenModule &CGM,
84                            const RecordDecl *RDconst FieldDecl *FD);
85
86}  // end namespace CodeGen
87}  // end namespace clang
88
89#endif
90