clang  19.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*, void** in the target's default address space (often 0)
55  union {
56  llvm::PointerType *UnqualPtrTy;
57  llvm::PointerType *VoidPtrTy;
58  llvm::PointerType *Int8PtrTy;
59  llvm::PointerType *VoidPtrPtrTy;
60  llvm::PointerType *Int8PtrPtrTy;
61  };
62 
63  /// void* in alloca address space
64  union {
65  llvm::PointerType *AllocaVoidPtrTy;
66  llvm::PointerType *AllocaInt8PtrTy;
67  };
68 
69  /// void* in target address space
70  llvm::PointerType *DefaultInt8PtrTy;
71 
72  /// void* used for virtual table globals.
73  llvm::PointerType *RuntimeGlobalsInt8PtrTy;
74 
75  /// void* in default globals address space
76  union {
77  llvm::PointerType *GlobalsVoidPtrTy;
78  llvm::PointerType *GlobalsInt8PtrTy;
79  };
80 
81  /// void* in the address space for constant globals
82  llvm::PointerType *ConstGlobalsPtrTy;
83 
84  /// The size and alignment of the builtin C type 'int'. This comes
85  /// up enough in various ABI lowering tasks to be worth pre-computing.
86  union {
87  unsigned char IntSizeInBytes;
88  unsigned char IntAlignInBytes;
89  };
92  }
95  }
96 
97  /// The width of a pointer into the generic address space.
98  unsigned char PointerWidthInBits;
99 
100  /// The size and alignment of a pointer into the generic address space.
101  union {
102  unsigned char PointerAlignInBytes;
103  unsigned char PointerSizeInBytes;
104  };
105 
106  /// The size and alignment of size_t.
107  union {
108  unsigned char SizeSizeInBytes; // sizeof(size_t)
109  unsigned char SizeAlignInBytes;
110  };
111 
113 
116  }
119  }
122  }
125  }
126 
129 
131 };
132 
133 } // end namespace CodeGen
134 } // end namespace clang
135 
136 #endif
MatchType Type
Provides definitions for the various language-specific address spaces.
static char ID
Definition: Arena.cpp:183
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition: CharUnits.h:63
The JSON file list parser is used to communicate input to InstallAPI.
LangAS
Defines the address space values used by the address space qualifier of QualType.
Definition: AddressSpaces.h:25
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30
This structure provides a set of types that are commonly used during IR emission.
llvm::PointerType * ConstGlobalsPtrTy
void* in the address space for constant globals
llvm::PointerType * GlobalsVoidPtrTy
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
llvm::IntegerType * CharTy
char
unsigned char PointerWidthInBits
The width of a pointer into the generic address space.
llvm::Type * HalfTy
half, bfloat, float, double
llvm::PointerType * RuntimeGlobalsInt8PtrTy
void* used for virtual table globals.
llvm::CallingConv::ID getRuntimeCC() const
llvm::PointerType * GlobalsInt8PtrTy
llvm::PointerType * AllocaVoidPtrTy
llvm::IntegerType * IntTy
int
llvm::PointerType * DefaultInt8PtrTy
void* in target address space
llvm::PointerType * AllocaInt8PtrTy