clang  3.9.0
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"
18 #include "llvm/IR/CallingConv.h"
19 
20 namespace llvm {
21  class Type;
22  class IntegerType;
23  class PointerType;
24 }
25 
26 namespace clang {
27 namespace CodeGen {
28 
29 /// This structure provides a set of types that are commonly used
30 /// during IR emission. It's initialized once in CodeGenModule's
31 /// constructor and then copied around into new CodeGenFunctions.
33  /// void
35 
36  /// i8, i16, i32, and i64
37  llvm::IntegerType *Int8Ty, *Int16Ty, *Int32Ty, *Int64Ty;
38  /// float, double
40 
41  /// int
42  llvm::IntegerType *IntTy;
43 
44  /// intptr_t, size_t, and ptrdiff_t, which we assume are the same size.
45  union {
46  llvm::IntegerType *IntPtrTy;
47  llvm::IntegerType *SizeTy;
48  llvm::IntegerType *PtrDiffTy;
49  };
50 
51  /// void* in address space 0
52  union {
53  llvm::PointerType *VoidPtrTy;
54  llvm::PointerType *Int8PtrTy;
55  };
56 
57  /// void** in address space 0
58  union {
59  llvm::PointerType *VoidPtrPtrTy;
60  llvm::PointerType *Int8PtrPtrTy;
61  };
62 
63  /// The size and alignment of the builtin C type 'int'. This comes
64  /// up enough in various ABI lowering tasks to be worth pre-computing.
65  union {
66  unsigned char IntSizeInBytes;
67  unsigned char IntAlignInBytes;
68  };
71  }
74  }
75 
76  /// The width of a pointer into the generic address space.
77  unsigned char PointerWidthInBits;
78 
79  /// The size and alignment of a pointer into the generic address space.
80  union {
81  unsigned char PointerAlignInBytes;
82  unsigned char PointerSizeInBytes;
83  unsigned char SizeSizeInBytes; // sizeof(size_t)
84  unsigned char SizeAlignInBytes;
85  };
88  }
91  }
94  }
97  }
98 
103 };
104 
105 } // end namespace CodeGen
106 } // end namespace clang
107 
108 #endif
llvm::IntegerType * IntTy
int
llvm::CallingConv::ID getRuntimeCC() const
llvm::Type * FloatTy
float, double
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
llvm::CallingConv::ID RuntimeCC
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.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition: CharUnits.h:63
The l-value was considered opaque, so the alignment was determined from a type.
llvm::CallingConv::ID getBuiltinCC() const
const std::string ID
This structure provides a set of types that are commonly used during IR emission. ...