1 //===----- ABIInfo.h - ABI information access & encapsulation ---*- 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 #ifndef CLANG_CODEGEN_ABIINFO_H
11 #define CLANG_CODEGEN_ABIINFO_H
13 #include "clang/AST/Type.h"
14 #include "llvm/IR/Type.h"
15 #include "llvm/IR/CallingConv.h"
30 class CodeGenFunction;
34 // FIXME: All of this stuff should be part of the target interface
35 // somehow. It is currently here because it is not clear how to factor
36 // the targets to support this, since the Targets currently live in a
37 // layer below types n'stuff.
40 /// ABIInfo - Target specific hooks for defining how a type should be
41 /// passed or returned from functions.
44 CodeGen::CodeGenTypes &CGT;
46 llvm::CallingConv::ID RuntimeCC;
48 ABIInfo(CodeGen::CodeGenTypes &cgt)
49 : CGT(cgt), RuntimeCC(llvm::CallingConv::C) {}
53 CodeGen::CGCXXABI &getCXXABI() const;
54 ASTContext &getContext() const;
55 llvm::LLVMContext &getVMContext() const;
56 const llvm::DataLayout &getDataLayout() const;
57 const TargetInfo &getTarget() const;
59 /// Return the calling convention to use for system runtime
61 llvm::CallingConv::ID getRuntimeCC() const {
65 virtual void computeInfo(CodeGen::CGFunctionInfo &FI) const = 0;
67 /// EmitVAArg - Emit the target dependent code to load a value of
68 /// \arg Ty from the va_list pointed to by \arg VAListAddr.
70 // FIXME: This is a gaping layering violation if we wanted to drop
71 // the ABI information any lower than CodeGen. Of course, for
72 // VAArg handling it has to be at this level; there is no way to
74 virtual llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
75 CodeGen::CodeGenFunction &CGF) const = 0;
77 } // end namespace clang