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 LLVM_CLANG_LIB_CODEGEN_ABIINFO_H
11 #define LLVM_CLANG_LIB_CODEGEN_ABIINFO_H
13 #include "clang/AST/Type.h"
14 #include "llvm/IR/CallingConv.h"
15 #include "llvm/IR/Type.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;
47 llvm::CallingConv::ID BuiltinCC;
49 ABIInfo(CodeGen::CodeGenTypes &cgt)
51 RuntimeCC(llvm::CallingConv::C),
52 BuiltinCC(llvm::CallingConv::C) {}
56 CodeGen::CGCXXABI &getCXXABI() const;
57 ASTContext &getContext() const;
58 llvm::LLVMContext &getVMContext() const;
59 const llvm::DataLayout &getDataLayout() const;
60 const TargetInfo &getTarget() const;
62 /// Return the calling convention to use for system runtime
64 llvm::CallingConv::ID getRuntimeCC() const {
68 /// Return the calling convention to use for compiler builtins
69 llvm::CallingConv::ID getBuiltinCC() const {
73 virtual void computeInfo(CodeGen::CGFunctionInfo &FI) const = 0;
75 /// EmitVAArg - Emit the target dependent code to load a value of
76 /// \arg Ty from the va_list pointed to by \arg VAListAddr.
78 // FIXME: This is a gaping layering violation if we wanted to drop
79 // the ABI information any lower than CodeGen. Of course, for
80 // VAArg handling it has to be at this level; there is no way to
82 virtual llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
83 CodeGen::CodeGenFunction &CGF) const = 0;
85 virtual bool isHomogeneousAggregateBaseType(QualType Ty) const;
87 virtual bool isHomogeneousAggregateSmallEnough(const Type *Base,
88 uint64_t Members) const;
90 virtual bool shouldSignExtUnsignedType(QualType Ty) const;
92 bool isHomogeneousAggregate(QualType Ty, const Type *&Base,
93 uint64_t &Members) const;
96 } // end namespace clang