1 //===----- CGCall.h - Encapsulate calling convention details ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // These classes wrap the information about a call or function
11 // definition used to handle ABI compliancy.
13 //===----------------------------------------------------------------------===//
15 #ifndef CLANG_CODEGEN_CGCALL_H
16 #define CLANG_CODEGEN_CGCALL_H
18 #include <llvm/ADT/FoldingSet.h>
19 #include "clang/AST/Type.h"
23 // FIXME: Restructure so we don't have to expose so much stuff.
27 struct AttributeWithIndex;
32 template<typename T, unsigned> class SmallVector;
43 typedef llvm::SmallVector<llvm::AttributeWithIndex, 8> AttributeListType;
45 /// CallArgList - Type for representing both the value and type of
46 /// arguments in a call.
47 typedef llvm::SmallVector<std::pair<RValue, QualType>, 16> CallArgList;
49 /// FunctionArgList - Type for representing both the decl and type
50 /// of parameters to a function. The decl must be either a
51 /// ParmVarDecl or ImplicitParamDecl.
52 typedef llvm::SmallVector<std::pair<const VarDecl*, QualType>,
55 /// CGFunctionInfo - Class to encapsulate the information about a
56 /// function definition.
57 class CGFunctionInfo : public llvm::FoldingSetNode {
67 typedef const ArgInfo *const_arg_iterator;
68 typedef ArgInfo *arg_iterator;
70 CGFunctionInfo(QualType ResTy,
71 const llvm::SmallVector<QualType, 16> &ArgTys);
72 ~CGFunctionInfo() { delete[] Args; }
74 const_arg_iterator arg_begin() const { return Args + 1; }
75 const_arg_iterator arg_end() const { return Args + 1 + NumArgs; }
76 arg_iterator arg_begin() { return Args + 1; }
77 arg_iterator arg_end() { return Args + 1 + NumArgs; }
79 unsigned arg_size() const { return NumArgs; }
81 QualType getReturnType() const { return Args[0].type; }
83 ABIArgInfo &getReturnInfo() { return Args[0].info; }
84 const ABIArgInfo &getReturnInfo() const { return Args[0].info; }
86 void Profile(llvm::FoldingSetNodeID &ID) {
87 getReturnType().Profile(ID);
88 for (arg_iterator it = arg_begin(), ie = arg_end(); it != ie; ++it)
91 template<class Iterator>
92 static void Profile(llvm::FoldingSetNodeID &ID,
97 for (; begin != end; ++begin)
101 } // end namespace CodeGen
102 } // end namespace clang