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