]> granicus.if.org Git - clang/blob - lib/CodeGen/CGCall.h
Change CodeGen to emit calls using (RValue,Type) list:
[clang] / lib / CodeGen / CGCall.h
1 //===----- 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
20 #include "CGValue.h"
21
22 namespace llvm {
23   class Function;
24   struct ParamAttrsWithIndex;
25   class Value;
26
27   template<typename T, unsigned> class SmallVector;
28 }
29
30 namespace clang {
31   class ASTContext;
32   class Decl;
33   class FunctionDecl;
34   class ObjCMethodDecl;
35
36 namespace 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.
41   typedef llvm::SmallVector<std::pair<RValue, QualType>, 16> CallArgList;
42
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