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 acutal ABI locations (e.g. registers, stack locations, etc.) that
20// these parameters are stored in.
21//
22//===----------------------------------------------------------------------===//
23
24#ifndef LLVM_CLANG_CODEGEN_ABITYPES_H
25#define LLVM_CLANG_CODEGEN_ABITYPES_H
26
27#include "clang/AST/CanonicalType.h"
28#include "clang/AST/Type.h"
29#include "clang/CodeGen/CGFunctionInfo.h"
30
31namespace llvm {
32  class DataLayout;
33  class Module;
34}
35
36namespace clang {
37class ASTContext;
38class CXXRecordDecl;
39class CodeGenOptions;
40class DiagnosticsEngine;
41class ObjCMethodDecl;
42
43namespace CodeGen {
44class CGFunctionInfo;
45class CodeGenModule;
46
47class CodeGenABITypes
48{
49public:
50  CodeGenABITypes(ASTContext &C, llvm::Module &M, const llvm::DataLayout &TD);
51  ~CodeGenABITypes();
52
53  /// These methods all forward to methods in the private implementation class
54  /// CodeGenTypes.
55
56  const CGFunctionInfo &arrangeObjCMessageSendSignature(
57                                                     const ObjCMethodDecl *MD,
58                                                     QualType receiverType);
59  const CGFunctionInfo &arrangeFreeFunctionType(
60                                               CanQual<FunctionProtoType> Ty);
61  const CGFunctionInfo &arrangeFreeFunctionType(
62                                             CanQual<FunctionNoProtoType> Ty);
63  const CGFunctionInfo &arrangeCXXMethodType(const CXXRecordDecl *RD,
64                                             const FunctionProtoType *FTP);
65  const CGFunctionInfo &arrangeFreeFunctionCall(CanQualType returnType,
66                                                ArrayRef<CanQualType> argTypes,
67                                                FunctionType::ExtInfo info,
68                                                RequiredArgs args);
69
70private:
71  /// Default CodeGenOptions object used to initialize the
72  /// CodeGenModule and otherwise not used. More specifically, it is
73  /// not used in ABI type generation, so none of the options matter.
74  CodeGenOptions *CGO;
75
76  /// The CodeGenModule we use get to the CodeGenTypes object.
77  CodeGen::CodeGenModule *CGM;
78};
79
80}  // end namespace CodeGen
81}  // end namespace clang
82
83#endif
84