2009-02-03 09:05:53 +08:00
|
|
|
//===----- ABIInfo.h - ABI information access & encapsulation ---*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef CLANG_CODEGEN_ABIINFO_H
|
|
|
|
#define CLANG_CODEGEN_ABIINFO_H
|
|
|
|
|
2009-06-06 06:08:42 +08:00
|
|
|
#include "clang/AST/Type.h"
|
2013-03-01 03:01:20 +08:00
|
|
|
#include "llvm/IR/CallingConv.h"
|
2014-01-07 19:51:46 +08:00
|
|
|
#include "llvm/IR/Type.h"
|
2009-06-06 06:08:42 +08:00
|
|
|
|
2009-02-03 13:31:23 +08:00
|
|
|
namespace llvm {
|
2009-06-06 06:08:42 +08:00
|
|
|
class Value;
|
2009-08-12 01:46:57 +08:00
|
|
|
class LLVMContext;
|
2012-10-09 00:25:52 +08:00
|
|
|
class DataLayout;
|
2009-02-03 13:31:23 +08:00
|
|
|
}
|
|
|
|
|
2009-02-03 09:05:53 +08:00
|
|
|
namespace clang {
|
2009-02-03 14:51:18 +08:00
|
|
|
class ASTContext;
|
2013-04-17 06:48:15 +08:00
|
|
|
class TargetInfo;
|
2009-02-03 14:51:18 +08:00
|
|
|
|
|
|
|
namespace CodeGen {
|
2013-10-06 09:33:34 +08:00
|
|
|
class CGCXXABI;
|
2009-02-03 14:51:18 +08:00
|
|
|
class CGFunctionInfo;
|
2009-02-11 05:44:36 +08:00
|
|
|
class CodeGenFunction;
|
2010-07-29 10:01:43 +08:00
|
|
|
class CodeGenTypes;
|
2009-02-03 14:51:18 +08:00
|
|
|
}
|
|
|
|
|
2010-07-29 07:46:15 +08:00
|
|
|
// FIXME: All of this stuff should be part of the target interface
|
|
|
|
// somehow. It is currently here because it is not clear how to factor
|
|
|
|
// the targets to support this, since the Targets currently live in a
|
|
|
|
// layer below types n'stuff.
|
2009-02-03 09:05:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
/// ABIInfo - Target specific hooks for defining how a type should be
|
|
|
|
/// passed or returned from functions.
|
|
|
|
class ABIInfo {
|
|
|
|
public:
|
2010-07-29 10:01:43 +08:00
|
|
|
CodeGen::CodeGenTypes &CGT;
|
2013-03-01 03:01:20 +08:00
|
|
|
protected:
|
|
|
|
llvm::CallingConv::ID RuntimeCC;
|
|
|
|
public:
|
|
|
|
ABIInfo(CodeGen::CodeGenTypes &cgt)
|
|
|
|
: CGT(cgt), RuntimeCC(llvm::CallingConv::C) {}
|
2010-10-19 14:39:39 +08:00
|
|
|
|
2009-02-03 09:05:53 +08:00
|
|
|
virtual ~ABIInfo();
|
2010-10-19 14:39:39 +08:00
|
|
|
|
2013-10-06 09:33:34 +08:00
|
|
|
CodeGen::CGCXXABI &getCXXABI() const;
|
2010-07-29 10:01:43 +08:00
|
|
|
ASTContext &getContext() const;
|
|
|
|
llvm::LLVMContext &getVMContext() const;
|
2012-10-09 00:25:52 +08:00
|
|
|
const llvm::DataLayout &getDataLayout() const;
|
2013-04-17 06:48:15 +08:00
|
|
|
const TargetInfo &getTarget() const;
|
2009-02-03 14:51:18 +08:00
|
|
|
|
2013-03-01 03:01:20 +08:00
|
|
|
/// Return the calling convention to use for system runtime
|
|
|
|
/// functions.
|
|
|
|
llvm::CallingConv::ID getRuntimeCC() const {
|
|
|
|
return RuntimeCC;
|
|
|
|
}
|
|
|
|
|
2010-07-29 10:31:05 +08:00
|
|
|
virtual void computeInfo(CodeGen::CGFunctionInfo &FI) const = 0;
|
2009-02-11 05:44:36 +08:00
|
|
|
|
|
|
|
/// EmitVAArg - Emit the target dependent code to load a value of
|
|
|
|
/// \arg Ty from the va_list pointed to by \arg VAListAddr.
|
2009-06-06 06:08:42 +08:00
|
|
|
|
2009-02-11 05:44:36 +08:00
|
|
|
// FIXME: This is a gaping layering violation if we wanted to drop
|
|
|
|
// the ABI information any lower than CodeGen. Of course, for
|
|
|
|
// VAArg handling it has to be at this level; there is no way to
|
|
|
|
// abstract this out.
|
|
|
|
virtual llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
|
|
|
|
CodeGen::CodeGenFunction &CGF) const = 0;
|
2009-02-03 09:05:53 +08:00
|
|
|
};
|
|
|
|
} // end namespace clang
|
|
|
|
|
|
|
|
#endif
|