blob: aaab36ca83ece92060eb078ca252d36f75d91b30 [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;
Devang Patel761d7f72008-09-25 21:02:23 +000024 struct AttributeWithIndex;
Daniel Dunbar0dbe2272008-09-08 21:33:45 +000025 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;
Daniel Dunbar7c086512008-09-09 23:14:03 +000035 class VarDecl;
Daniel Dunbar0dbe2272008-09-08 21:33:45 +000036
37namespace CodeGen {
Devang Patel761d7f72008-09-25 21:02:23 +000038 typedef llvm::SmallVector<llvm::AttributeWithIndex, 8> AttributeListType;
Daniel Dunbar0dbe2272008-09-08 21:33:45 +000039
40 /// CallArgList - Type for representing both the value and type of
41 /// arguments in a call.
Daniel Dunbar46f45b92008-09-09 01:06:48 +000042 typedef llvm::SmallVector<std::pair<RValue, QualType>, 16> CallArgList;
Daniel Dunbar0dbe2272008-09-08 21:33:45 +000043
Daniel Dunbar7c086512008-09-09 23:14:03 +000044 /// 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;
Daniel Dunbar5323a4b2008-09-10 00:32:18 +000049
Daniel Dunbar0dbe2272008-09-08 21:33:45 +000050 /// CGFunctionInfo - Class to encapsulate the information about a
51 /// function definition.
52 class CGFunctionInfo {
Daniel Dunbar0dbe2272008-09-08 21:33:45 +000053 llvm::SmallVector<QualType, 16> ArgTypes;
54
55 public:
Daniel Dunbara0a99e02009-02-02 23:43:58 +000056 typedef llvm::SmallVector<QualType, 16>::const_iterator arg_iterator;
57
Daniel Dunbar541b63b2009-02-02 23:23:47 +000058 CGFunctionInfo(QualType ResTy,
59 const llvm::SmallVector<QualType, 16> &ArgTys);
Daniel Dunbar0dbe2272008-09-08 21:33:45 +000060
Daniel Dunbara0a99e02009-02-02 23:43:58 +000061 arg_iterator arg_begin() const;
62 arg_iterator arg_end() const;
Daniel Dunbarbb36d332009-02-02 21:43:58 +000063
64 QualType getReturnType() const { return ArgTypes[0]; }
Daniel Dunbar0dbe2272008-09-08 21:33:45 +000065 };
Daniel Dunbar0dbe2272008-09-08 21:33:45 +000066} // end namespace CodeGen
67} // end namespace clang
68
69#endif