Daniel Dunbar | 0dbe227 | 2008-09-08 21:33:45 +0000 | [diff] [blame] | 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 | |
Daniel Dunbar | 46f45b9 | 2008-09-09 01:06:48 +0000 | [diff] [blame] | 20 | #include "CGValue.h" |
| 21 | |
Daniel Dunbar | 0dbe227 | 2008-09-08 21:33:45 +0000 | [diff] [blame] | 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; |
Daniel Dunbar | 7c08651 | 2008-09-09 23:14:03 +0000 | [diff] [blame] | 35 | class VarDecl; |
Daniel Dunbar | 0dbe227 | 2008-09-08 21:33:45 +0000 | [diff] [blame] | 36 | |
| 37 | namespace CodeGen { |
| 38 | typedef llvm::SmallVector<llvm::ParamAttrsWithIndex, 8> ParamAttrListType; |
| 39 | |
| 40 | /// CallArgList - Type for representing both the value and type of |
| 41 | /// arguments in a call. |
Daniel Dunbar | 46f45b9 | 2008-09-09 01:06:48 +0000 | [diff] [blame] | 42 | typedef llvm::SmallVector<std::pair<RValue, QualType>, 16> CallArgList; |
Daniel Dunbar | 0dbe227 | 2008-09-08 21:33:45 +0000 | [diff] [blame] | 43 | |
Daniel Dunbar | 7c08651 | 2008-09-09 23:14:03 +0000 | [diff] [blame] | 44 | /// FunctionArgList - Type for representing both the decl and type |
| 45 | /// of parameters to a function. The decl must be either a |
| 46 | /// ParmVarDecl or ImplicitParamDecl. |
| 47 | typedef llvm::SmallVector<std::pair<const VarDecl*, QualType>, |
| 48 | 16> FunctionArgList; |
| 49 | |
Daniel Dunbar | 0dbe227 | 2008-09-08 21:33:45 +0000 | [diff] [blame] | 50 | /// CGFunctionInfo - Class to encapsulate the information about a |
| 51 | /// function definition. |
| 52 | class CGFunctionInfo { |
| 53 | /// TheDecl - The decl we are storing information for. This is |
| 54 | /// either a Function or ObjCMethod Decl. |
| 55 | const Decl *TheDecl; |
| 56 | |
| 57 | llvm::SmallVector<QualType, 16> ArgTypes; |
| 58 | |
| 59 | public: |
| 60 | CGFunctionInfo(const FunctionDecl *FD); |
| 61 | CGFunctionInfo(const ObjCMethodDecl *MD, |
| 62 | const ASTContext &Context); |
| 63 | |
| 64 | const Decl* getDecl() const { return TheDecl; } |
| 65 | |
| 66 | void constructParamAttrList(ParamAttrListType &Args) const; |
| 67 | }; |
| 68 | |
| 69 | /// CGCallInfo - Class to encapsulate the arguments and clang types |
| 70 | /// used in a call. |
| 71 | class CGCallInfo { |
| 72 | QualType ResultType; |
| 73 | const CallArgList &Args; |
| 74 | |
| 75 | llvm::SmallVector<QualType, 16> ArgTypes; |
| 76 | |
| 77 | public: |
| 78 | CGCallInfo(QualType _ResultType, const CallArgList &Args); |
| 79 | |
| 80 | void constructParamAttrList(ParamAttrListType &Args) const; |
| 81 | }; |
| 82 | } // end namespace CodeGen |
| 83 | } // end namespace clang |
| 84 | |
| 85 | #endif |