clang  6.0.0svn
CodeGenTypeCache.h
Go to the documentation of this file.
1 //===--- CodeGenTypeCache.h - Commonly used LLVM types and info -*- 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 // This structure provides a set of common types useful during IR emission.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENTYPECACHE_H
15 #define LLVM_CLANG_LIB_CODEGEN_CODEGENTYPECACHE_H
16 
17 #include "clang/AST/CharUnits.h"
19 #include "llvm/IR/CallingConv.h"
20 
21 namespace llvm {
22  class Type;
23  class IntegerType;
24  class PointerType;
25 }
26 
27 namespace clang {
28 namespace CodeGen {
29 
30 /// This structure provides a set of types that are commonly used
31 /// during IR emission. It's initialized once in CodeGenModule's
32 /// constructor and then copied around into new CodeGenFunctions.
34  /// void
35  llvm::Type *VoidTy;
36 
37  /// i8, i16, i32, and i64
38  llvm::IntegerType *Int8Ty, *Int16Ty, *Int32Ty, *Int64Ty;
39  /// float, double
40  llvm::Type *FloatTy, *DoubleTy;
41 
42  /// int
43  llvm::IntegerType *IntTy;
44 
45  /// intptr_t, size_t, and ptrdiff_t, which we assume are the same size.
46  union {
47  llvm::IntegerType *IntPtrTy;
48  llvm::IntegerType *SizeTy;
49  llvm::IntegerType *PtrDiffTy;
50  };
51 
52  /// void* in address space 0
53  union {
54  llvm::PointerType *VoidPtrTy;
55  llvm::PointerType *Int8PtrTy;
56  };
57 
58  /// void** in address space 0
59  union {
60  llvm::PointerType *VoidPtrPtrTy;
61  llvm::PointerType *Int8PtrPtrTy;
62  };
63 
64  /// void* in alloca address space
65  union {
66  llvm::PointerType *AllocaVoidPtrTy;
67  llvm::PointerType *AllocaInt8PtrTy;
68  };
69 
70  /// The size and alignment of the builtin C type 'int'. This comes
71  /// up enough in various ABI lowering tasks to be worth pre-computing.
72  union {
73  unsigned char IntSizeInBytes;
74  unsigned char IntAlignInBytes;
75  };
77  return CharUnits::fromQuantity(IntSizeInBytes);
78  }
80  return CharUnits::fromQuantity(IntAlignInBytes);
81  }
82 
83  /// The width of a pointer into the generic address space.
84  unsigned char PointerWidthInBits;
85 
86  /// The size and alignment of a pointer into the generic address space.
87  union {
88  unsigned char PointerAlignInBytes;
89  unsigned char PointerSizeInBytes;
90  };
91 
92  /// The size and alignment of size_t.
93  union {
94  unsigned char SizeSizeInBytes; // sizeof(size_t)
95  unsigned char SizeAlignInBytes;
96  };
97 
99 
101  return CharUnits::fromQuantity(SizeSizeInBytes);
102  }
104  return CharUnits::fromQuantity(SizeAlignInBytes);
105  }
107  return CharUnits::fromQuantity(PointerSizeInBytes);
108  }
110  return CharUnits::fromQuantity(PointerAlignInBytes);
111  }
112 
114  llvm::CallingConv::ID getRuntimeCC() const { return RuntimeCC; }
116  llvm::CallingConv::ID getBuiltinCC() const { return BuiltinCC; }
117 
118  LangAS getASTAllocaAddressSpace() const { return ASTAllocaAddressSpace; }
119 };
120 
121 } // end namespace CodeGen
122 } // end namespace clang
123 
124 #endif
llvm::IntegerType * IntTy
int
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:26
llvm::CallingConv::ID getBuiltinCC() const
llvm::Type * FloatTy
float, double
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
Definition: AddressSpaces.h:26
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
unsigned char PointerWidthInBits
The width of a pointer into the generic address space.
Provides definitions for the various language-specific address spaces.
llvm::CallingConv::ID getRuntimeCC() const
llvm::PointerType * AllocaInt8PtrTy
The l-value was considered opaque, so the alignment was determined from a type.
Dataflow Directional Tag Classes.
llvm::PointerType * AllocaVoidPtrTy
This structure provides a set of types that are commonly used during IR emission. ...