blob: 78a83a8791f8de3b9df1674363bbf32ebc671d66 [file] [log] [blame]
Daniel Dunbar0dbe2272008-09-08 21:33:45 +00001//===----- CGCall.h - Encapsulate calling convention details ----*- C++ -*-===//
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// These classes wrap the information about a call or function
11// definition used to handle ABI compliancy.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef CLANG_CODEGEN_CGCALL_H
16#define CLANG_CODEGEN_CGCALL_H
17
18#include "clang/AST/Type.h"
19
Daniel Dunbar46f45b92008-09-09 01:06:48 +000020#include "CGValue.h"
21
Daniel Dunbar0dbe2272008-09-08 21:33:45 +000022namespace llvm {
23 class Function;
24 struct ParamAttrsWithIndex;
25 class Value;
26
27 template<typename T, unsigned> class SmallVector;
28}
29
30namespace clang {
31 class ASTContext;
32 class Decl;
33 class FunctionDecl;
34 class ObjCMethodDecl;
35
36namespace CodeGen {
37 typedef llvm::SmallVector<llvm::ParamAttrsWithIndex, 8> ParamAttrListType;
38
39 /// CallArgList - Type for representing both the value and type of
40 /// arguments in a call.
Daniel Dunbar46f45b92008-09-09 01:06:48 +000041 typedef llvm::SmallVector<std::pair<RValue, QualType>, 16> CallArgList;
Daniel Dunbar0dbe2272008-09-08 21:33:45 +000042
43 /// CGFunctionInfo - Class to encapsulate the information about a
44 /// function definition.
45 class CGFunctionInfo {
46 /// TheDecl - The decl we are storing information for. This is
47 /// either a Function or ObjCMethod Decl.
48 const Decl *TheDecl;
49
50 llvm::SmallVector<QualType, 16> ArgTypes;
51
52 public:
53 CGFunctionInfo(const FunctionDecl *FD);
54 CGFunctionInfo(const ObjCMethodDecl *MD,
55 const ASTContext &Context);
56
57 const Decl* getDecl() const { return TheDecl; }
58
59 void constructParamAttrList(ParamAttrListType &Args) const;
60 };
61
62 /// CGCallInfo - Class to encapsulate the arguments and clang types
63 /// used in a call.
64 class CGCallInfo {
65 QualType ResultType;
66 const CallArgList &Args;
67
68 llvm::SmallVector<QualType, 16> ArgTypes;
69
70 public:
71 CGCallInfo(QualType _ResultType, const CallArgList &Args);
72
73 void constructParamAttrList(ParamAttrListType &Args) const;
74 };
75} // end namespace CodeGen
76} // end namespace clang
77
78#endif