diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-09-08 21:33:45 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-09-08 21:33:45 +0000 |
commit | 0dbe227feccf6a8dbadfff8ca3f80416b7bf2f28 (patch) | |
tree | b2b084796bf8841734e7fec1f6aad7c547e7105b /lib/CodeGen/CGCall.h | |
parent | 6f0200e9ebf7f65df74b3cf55b4319b075b244a2 (diff) |
Refactor parameter attribute handling:
- Add CGCall.h for dealing with ABI issues related to calls.
- Add CGFunctionInfo and CGCallInfo for capturing ABI relevant
information about functions and calls.
- Isolate LLVM parameter attribute handling inside CGCall.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55963 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.h')
-rw-r--r-- | lib/CodeGen/CGCall.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCall.h b/lib/CodeGen/CGCall.h new file mode 100644 index 0000000000..b4e8d1f6da --- /dev/null +++ b/lib/CodeGen/CGCall.h @@ -0,0 +1,76 @@ +//===----- CGCall.h - Encapsulate calling convention details ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// These classes wrap the information about a call or function +// definition used to handle ABI compliancy. +// +//===----------------------------------------------------------------------===// + +#ifndef CLANG_CODEGEN_CGCALL_H +#define CLANG_CODEGEN_CGCALL_H + +#include "clang/AST/Type.h" + +namespace llvm { + class Function; + struct ParamAttrsWithIndex; + class Value; + + template<typename T, unsigned> class SmallVector; +} + +namespace clang { + class ASTContext; + class Decl; + class FunctionDecl; + class ObjCMethodDecl; + +namespace CodeGen { + typedef llvm::SmallVector<llvm::ParamAttrsWithIndex, 8> ParamAttrListType; + + /// CallArgList - Type for representing both the value and type of + /// arguments in a call. + typedef llvm::SmallVector<std::pair<llvm::Value*, QualType>, 16> CallArgList; + + /// CGFunctionInfo - Class to encapsulate the information about a + /// function definition. + class CGFunctionInfo { + /// TheDecl - The decl we are storing information for. This is + /// either a Function or ObjCMethod Decl. + const Decl *TheDecl; + + llvm::SmallVector<QualType, 16> ArgTypes; + + public: + CGFunctionInfo(const FunctionDecl *FD); + CGFunctionInfo(const ObjCMethodDecl *MD, + const ASTContext &Context); + + const Decl* getDecl() const { return TheDecl; } + + void constructParamAttrList(ParamAttrListType &Args) const; + }; + + /// CGCallInfo - Class to encapsulate the arguments and clang types + /// used in a call. + class CGCallInfo { + QualType ResultType; + const CallArgList &Args; + + llvm::SmallVector<QualType, 16> ArgTypes; + + public: + CGCallInfo(QualType _ResultType, const CallArgList &Args); + + void constructParamAttrList(ParamAttrListType &Args) const; + }; +} // end namespace CodeGen +} // end namespace clang + +#endif |