clang  3.7.0
ABIInfo.h
Go to the documentation of this file.
1 //===----- ABIInfo.h - ABI information access & encapsulation ---*- 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 #ifndef LLVM_CLANG_LIB_CODEGEN_ABIINFO_H
11 #define LLVM_CLANG_LIB_CODEGEN_ABIINFO_H
12 
13 #include "clang/AST/Type.h"
14 #include "llvm/IR/CallingConv.h"
15 #include "llvm/IR/Type.h"
16 
17 namespace llvm {
18  class Value;
19  class LLVMContext;
20  class DataLayout;
21 }
22 
23 namespace clang {
24  class ASTContext;
25  class TargetInfo;
26 
27  namespace CodeGen {
28  class CGCXXABI;
29  class CGFunctionInfo;
30  class CodeGenFunction;
31  class CodeGenTypes;
32  }
33 
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.
38 
39 
40  /// ABIInfo - Target specific hooks for defining how a type should be
41  /// passed or returned from functions.
42  class ABIInfo {
43  public:
45  protected:
48  public:
50  : CGT(cgt),
51  RuntimeCC(llvm::CallingConv::C),
52  BuiltinCC(llvm::CallingConv::C) {}
53 
54  virtual ~ABIInfo();
55 
57  ASTContext &getContext() const;
58  llvm::LLVMContext &getVMContext() const;
59  const llvm::DataLayout &getDataLayout() const;
60  const TargetInfo &getTarget() const;
61 
62  /// Return the calling convention to use for system runtime
63  /// functions.
65  return RuntimeCC;
66  }
67 
68  /// Return the calling convention to use for compiler builtins
70  return BuiltinCC;
71  }
72 
73  virtual void computeInfo(CodeGen::CGFunctionInfo &FI) const = 0;
74 
75  /// EmitVAArg - Emit the target dependent code to load a value of
76  /// \arg Ty from the va_list pointed to by \arg VAListAddr.
77 
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
81  // abstract this out.
82  virtual llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
83  CodeGen::CodeGenFunction &CGF) const = 0;
84 
85  virtual bool isHomogeneousAggregateBaseType(QualType Ty) const;
86 
87  virtual bool isHomogeneousAggregateSmallEnough(const Type *Base,
88  uint64_t Members) const;
89 
90  virtual bool shouldSignExtUnsignedType(QualType Ty) const;
91 
92  bool isHomogeneousAggregate(QualType Ty, const Type *&Base,
93  uint64_t &Members) const;
94 
95  };
96 } // end namespace clang
97 
98 #endif
virtual llvm::Value * EmitVAArg(llvm::Value *VAListAddr, QualType Ty, CodeGen::CodeGenFunction &CGF) const =0
const TargetInfo & getTarget() const
virtual void computeInfo(CodeGen::CGFunctionInfo &FI) const =0
ABIInfo(CodeGen::CodeGenTypes &cgt)
Definition: ABIInfo.h:49
llvm::CallingConv::ID getRuntimeCC() const
Definition: ABIInfo.h:64
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:89
llvm::CallingConv::ID BuiltinCC
Definition: ABIInfo.h:47
CodeGen::CodeGenTypes & CGT
Definition: ABIInfo.h:44
ID
Defines the set of possible language-specific address spaces.
Definition: AddressSpaces.h:27
Exposes information about the current target.
llvm::LLVMContext & getVMContext() const
ASTContext & getContext() const
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:204
llvm::CallingConv::ID getBuiltinCC() const
Return the calling convention to use for compiler builtins.
Definition: ABIInfo.h:69
virtual bool shouldSignExtUnsignedType(QualType Ty) const
bool isHomogeneousAggregate(QualType Ty, const Type *&Base, uint64_t &Members) const
llvm::CallingConv::ID RuntimeCC
Definition: ABIInfo.h:46
Implements C++ ABI-specific code generation functions.
Definition: CGCXXABI.h:42
virtual bool isHomogeneousAggregateSmallEnough(const Type *Base, uint64_t Members) const
CodeGen::CGCXXABI & getCXXABI() const
const llvm::DataLayout & getDataLayout() const
virtual bool isHomogeneousAggregateBaseType(QualType Ty) const