blob: b4e8d1f6da88c767bd295ed89975c19927d3656c [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
20namespace llvm {
21 class Function;
22 struct ParamAttrsWithIndex;
23 class Value;
24
25 template<typename T, unsigned> class SmallVector;
26}
27
28namespace clang {
29 class ASTContext;
30 class Decl;
31 class FunctionDecl;
32 class ObjCMethodDecl;
33
34namespace CodeGen {
35 typedef llvm::SmallVector<llvm::ParamAttrsWithIndex, 8> ParamAttrListType;
36
37 /// CallArgList - Type for representing both the value and type of
38 /// arguments in a call.
39 typedef llvm::SmallVector<std::pair<llvm::Value*, QualType>, 16> CallArgList;
40
41 /// CGFunctionInfo - Class to encapsulate the information about a
42 /// function definition.
43 class CGFunctionInfo {
44 /// TheDecl - The decl we are storing information for. This is
45 /// either a Function or ObjCMethod Decl.
46 const Decl *TheDecl;
47
48 llvm::SmallVector<QualType, 16> ArgTypes;
49
50 public:
51 CGFunctionInfo(const FunctionDecl *FD);
52 CGFunctionInfo(const ObjCMethodDecl *MD,
53 const ASTContext &Context);
54
55 const Decl* getDecl() const { return TheDecl; }
56
57 void constructParamAttrList(ParamAttrListType &Args) const;
58 };
59
60 /// CGCallInfo - Class to encapsulate the arguments and clang types
61 /// used in a call.
62 class CGCallInfo {
63 QualType ResultType;
64 const CallArgList &Args;
65
66 llvm::SmallVector<QualType, 16> ArgTypes;
67
68 public:
69 CGCallInfo(QualType _ResultType, const CallArgList &Args);
70
71 void constructParamAttrList(ParamAttrListType &Args) const;
72 };
73} // end namespace CodeGen
74} // end namespace clang
75
76#endif