1259701Sdim//==---- CodeGenABITypes.h - Convert Clang types to LLVM types for ABI -----==//
2259701Sdim//
3259701Sdim//                     The LLVM Compiler Infrastructure
4259701Sdim//
5259701Sdim// This file is distributed under the University of Illinois Open Source
6259701Sdim// License. See LICENSE.TXT for details.
7259701Sdim//
8259701Sdim//===----------------------------------------------------------------------===//
9259701Sdim//
10259701Sdim// CodeGenABITypes is a simple interface for getting LLVM types for
11259701Sdim// the parameters and the return value of a function given the Clang
12259701Sdim// types.
13259701Sdim//
14259701Sdim// The class is implemented as a public wrapper around the private
15259701Sdim// CodeGenTypes class in lib/CodeGen.
16259701Sdim//
17259701Sdim// It allows other clients, like LLDB, to determine the LLVM types that are
18259701Sdim// actually used in function calls, which makes it possible to then determine
19259701Sdim// the acutal ABI locations (e.g. registers, stack locations, etc.) that
20259701Sdim// these parameters are stored in.
21259701Sdim//
22259701Sdim//===----------------------------------------------------------------------===//
23259701Sdim
24259701Sdim#ifndef LLVM_CLANG_CODEGEN_ABITYPES_H
25259701Sdim#define LLVM_CLANG_CODEGEN_ABITYPES_H
26259701Sdim
27259701Sdim#include "clang/AST/CanonicalType.h"
28259701Sdim#include "clang/AST/Type.h"
29259701Sdim#include "clang/CodeGen/CGFunctionInfo.h"
30259701Sdim
31259701Sdimnamespace llvm {
32259701Sdim  class DataLayout;
33259701Sdim  class Module;
34259701Sdim}
35259701Sdim
36259701Sdimnamespace clang {
37259701Sdimclass ASTContext;
38259701Sdimclass CXXRecordDecl;
39259701Sdimclass CodeGenOptions;
40259701Sdimclass DiagnosticsEngine;
41259701Sdimclass ObjCMethodDecl;
42259701Sdim
43259701Sdimnamespace CodeGen {
44259701Sdimclass CGFunctionInfo;
45259701Sdimclass CodeGenModule;
46259701Sdim
47259701Sdimclass CodeGenABITypes
48259701Sdim{
49259701Sdimpublic:
50259701Sdim  CodeGenABITypes(ASTContext &C, const CodeGenOptions &CodeGenOpts,
51259701Sdim                  llvm::Module &M, const llvm::DataLayout &TD,
52259701Sdim                  DiagnosticsEngine &Diags);
53259701Sdim
54259701Sdim  ~CodeGenABITypes();
55259701Sdim
56259701Sdim  /// These methods all forward to methods in the private implementation class
57259701Sdim  /// CodeGenTypes.
58259701Sdim
59259701Sdim  const CGFunctionInfo &arrangeObjCMessageSendSignature(
60259701Sdim                                                     const ObjCMethodDecl *MD,
61259701Sdim                                                     QualType receiverType);
62259701Sdim  const CGFunctionInfo &arrangeFreeFunctionType(
63259701Sdim                                               CanQual<FunctionProtoType> Ty);
64259701Sdim  const CGFunctionInfo &arrangeFreeFunctionType(
65259701Sdim                                             CanQual<FunctionNoProtoType> Ty);
66259701Sdim  const CGFunctionInfo &arrangeCXXMethodType(const CXXRecordDecl *RD,
67259701Sdim                                             const FunctionProtoType *FTP);
68259701Sdim  const CGFunctionInfo &arrangeLLVMFunctionInfo(CanQualType returnType,
69259701Sdim                                         llvm::ArrayRef<CanQualType> argTypes,
70259701Sdim                                         FunctionType::ExtInfo info,
71259701Sdim                                         RequiredArgs args);
72259701Sdim
73259701Sdimprivate:
74259701Sdim  CodeGen::CodeGenModule *CGM;
75259701Sdim};
76259701Sdim
77259701Sdim}  // end namespace CodeGen
78259701Sdim}  // end namespace clang
79259701Sdim
80259701Sdim#endif
81