clang  14.0.0git
CodeGenTypeCache.h
Go to the documentation of this file.
1 //===--- CodeGenTypeCache.h - Commonly used LLVM types and info -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This structure provides a set of common types useful during IR emission.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENTYPECACHE_H
14 #define LLVM_CLANG_LIB_CODEGEN_CODEGENTYPECACHE_H
15 
16 #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
34  llvm::Type *VoidTy;
35 
36  /// i8, i16, i32, and i64
37  llvm::IntegerType *Int8Ty, *Int16Ty, *Int32Ty, *Int64Ty;
38  /// half, bfloat, float, double
39  llvm::Type *HalfTy, *BFloatTy, *FloatTy, *DoubleTy;
40 
41  /// int
42  llvm::IntegerType *IntTy;
43 
44  /// char
45  llvm::IntegerType *CharTy;
46 
47  /// intptr_t, size_t, and ptrdiff_t, which we assume are the same size.
48  union {
49  llvm::IntegerType *IntPtrTy;
50  llvm::IntegerType *SizeTy;
51  llvm::IntegerType *PtrDiffTy;
52  };
53 
54  /// void* in address space 0
55  union {
56  llvm::PointerType *VoidPtrTy;
57  llvm::PointerType *Int8PtrTy;
58  };
59 
60  /// void** in address space 0
61  union {
62  llvm::PointerType *VoidPtrPtrTy;
63  llvm::PointerType *Int8PtrPtrTy;
64  };
65 
66  /// void* in alloca address space
67  union {
68  llvm::PointerType *AllocaVoidPtrTy;
69  llvm::PointerType *AllocaInt8PtrTy;
70  };
71 
72  /// void* in default globals address space
73  union {
74  llvm::PointerType *GlobalsVoidPtrTy;
75  llvm::PointerType *GlobalsInt8PtrTy;
76  };
77 
78  /// The size and alignment of the builtin C type 'int'. This comes
79  /// up enough in various ABI lowering tasks to be worth pre-computing.
80  union {
81  unsigned char IntSizeInBytes;
82  unsigned char IntAlignInBytes;
83  };
86  }
89  }
90 
91  /// The width of a pointer into the generic address space.
92  unsigned char PointerWidthInBits;
93 
94  /// The size and alignment of a pointer into the generic address space.
95  union {
96  unsigned char PointerAlignInBytes;
97  unsigned char PointerSizeInBytes;
98  };
99 
100  /// The size and alignment of size_t.
101  union {
102  unsigned char SizeSizeInBytes; // sizeof(size_t)
103  unsigned char SizeAlignInBytes;
104  };
105 
107 
110  }
113  }
116  }
119  }
120 
123 
125 };
126 
127 } // end namespace CodeGen
128 } // end namespace clang
129 
130 #endif
clang::CodeGen::CodeGenTypeCache::SizeTy
llvm::IntegerType * SizeTy
Definition: CodeGenTypeCache.h:50
clang::CodeGen::CodeGenTypeCache::Int8PtrTy
llvm::PointerType * Int8PtrTy
Definition: CodeGenTypeCache.h:57
llvm
Definition: Dominators.h:30
clang::CodeGen::CodeGenTypeCache::IntTy
llvm::IntegerType * IntTy
int
Definition: CodeGenTypeCache.h:42
clang::CodeGen::CodeGenTypeCache::FloatTy
llvm::Type * FloatTy
Definition: CodeGenTypeCache.h:39
clang::CodeGen::CodeGenTypeCache::CharTy
llvm::IntegerType * CharTy
char
Definition: CodeGenTypeCache.h:45
clang::CodeGen::CodeGenTypeCache::getSizeAlign
CharUnits getSizeAlign() const
Definition: CodeGenTypeCache.h:111
clang::CodeGen::CodeGenTypeCache::SizeAlignInBytes
unsigned char SizeAlignInBytes
Definition: CodeGenTypeCache.h:103
clang::CodeGen::CodeGenTypeCache::getPointerAlign
CharUnits getPointerAlign() const
Definition: CodeGenTypeCache.h:117
clang::CodeGen::CodeGenTypeCache::PointerAlignInBytes
unsigned char PointerAlignInBytes
Definition: CodeGenTypeCache.h:96
clang::CodeGen::CodeGenTypeCache::IntAlignInBytes
unsigned char IntAlignInBytes
Definition: CodeGenTypeCache.h:82
clang::CodeGen::CodeGenTypeCache::RuntimeCC
llvm::CallingConv::ID RuntimeCC
Definition: CodeGenTypeCache.h:121
clang::CodeGen::CodeGenTypeCache::getIntAlign
CharUnits getIntAlign() const
Definition: CodeGenTypeCache.h:87
clang::CodeGen::CodeGenTypeCache::VoidPtrTy
llvm::PointerType * VoidPtrTy
Definition: CodeGenTypeCache.h:56
AddressSpaces.h
clang::CodeGen::CodeGenTypeCache::AllocaInt8PtrTy
llvm::PointerType * AllocaInt8PtrTy
Definition: CodeGenTypeCache.h:69
clang::CodeGen::CodeGenTypeCache::AllocaVoidPtrTy
llvm::PointerType * AllocaVoidPtrTy
Definition: CodeGenTypeCache.h:68
clang::CodeGen::CodeGenTypeCache
This structure provides a set of types that are commonly used during IR emission.
Definition: CodeGenTypeCache.h:32
clang::CodeGen::CodeGenTypeCache::ASTAllocaAddressSpace
LangAS ASTAllocaAddressSpace
Definition: CodeGenTypeCache.h:106
clang::CharUnits::fromQuantity
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition: CharUnits.h:63
clang::CodeGen::CodeGenTypeCache::Int64Ty
llvm::IntegerType * Int64Ty
Definition: CodeGenTypeCache.h:37
clang::CodeGen::CodeGenTypeCache::Int16Ty
llvm::IntegerType * Int16Ty
Definition: CodeGenTypeCache.h:37
clang::CodeGen::CodeGenTypeCache::VoidTy
llvm::Type * VoidTy
void
Definition: CodeGenTypeCache.h:34
clang::CodeGen::CodeGenTypeCache::getIntSize
CharUnits getIntSize() const
Definition: CodeGenTypeCache.h:84
clang::CodeGen::CodeGenTypeCache::PointerWidthInBits
unsigned char PointerWidthInBits
The width of a pointer into the generic address space.
Definition: CodeGenTypeCache.h:92
clang::CodeGen::CodeGenTypeCache::BFloatTy
llvm::Type * BFloatTy
Definition: CodeGenTypeCache.h:39
clang::CodeGen::CodeGenTypeCache::DoubleTy
llvm::Type * DoubleTy
Definition: CodeGenTypeCache.h:39
clang::CodeGen::CodeGenTypeCache::getPointerSize
CharUnits getPointerSize() const
Definition: CodeGenTypeCache.h:114
clang::CodeGen::CodeGenTypeCache::SizeSizeInBytes
unsigned char SizeSizeInBytes
Definition: CodeGenTypeCache.h:102
clang::CodeGen::CodeGenTypeCache::getSizeSize
CharUnits getSizeSize() const
Definition: CodeGenTypeCache.h:108
CharUnits.h
clang::CodeGen::CodeGenTypeCache::Int32Ty
llvm::IntegerType * Int32Ty
Definition: CodeGenTypeCache.h:37
clang::LangAS
LangAS
Defines the address space values used by the address space qualifier of QualType.
Definition: AddressSpaces.h:25
clang::CodeGen::CodeGenTypeCache::PtrDiffTy
llvm::IntegerType * PtrDiffTy
Definition: CodeGenTypeCache.h:51
clang::CodeGen::CodeGenTypeCache::HalfTy
llvm::Type * HalfTy
half, bfloat, float, double
Definition: CodeGenTypeCache.h:39
clang::CodeGen::CodeGenTypeCache::getRuntimeCC
llvm::CallingConv::ID getRuntimeCC() const
Definition: CodeGenTypeCache.h:122
clang::CodeGen::CodeGenTypeCache::GlobalsInt8PtrTy
llvm::PointerType * GlobalsInt8PtrTy
Definition: CodeGenTypeCache.h:75
clang::Builtin::ID
ID
Definition: Builtins.h:48
clang
Definition: CalledOnceCheck.h:17
clang::CodeGen::CodeGenTypeCache::GlobalsVoidPtrTy
llvm::PointerType * GlobalsVoidPtrTy
Definition: CodeGenTypeCache.h:74
clang::CodeGen::CodeGenTypeCache::IntPtrTy
llvm::IntegerType * IntPtrTy
Definition: CodeGenTypeCache.h:49
clang::CharUnits
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
clang::CodeGen::CodeGenTypeCache::Int8Ty
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
Definition: CodeGenTypeCache.h:37
clang::CodeGen::CodeGenTypeCache::VoidPtrPtrTy
llvm::PointerType * VoidPtrPtrTy
Definition: CodeGenTypeCache.h:62
clang::CodeGen::CodeGenTypeCache::Int8PtrPtrTy
llvm::PointerType * Int8PtrPtrTy
Definition: CodeGenTypeCache.h:63
clang::CodeGen::CodeGenTypeCache::getASTAllocaAddressSpace
LangAS getASTAllocaAddressSpace() const
Definition: CodeGenTypeCache.h:124
clang::CodeGen::CodeGenTypeCache::IntSizeInBytes
unsigned char IntSizeInBytes
Definition: CodeGenTypeCache.h:81
clang::CodeGen::CodeGenTypeCache::PointerSizeInBytes
unsigned char PointerSizeInBytes
Definition: CodeGenTypeCache.h:97
Type
MatchType Type
Definition: ASTMatchFinder.cpp:70