clang 22.0.0git
CIRGenTypeCache.h
Go to the documentation of this file.
1//===--- CIRGenTypeCache.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 CIR emission.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_CIR_CIRGENTYPECACHE_H
14#define LLVM_CLANG_LIB_CIR_CIRGENTYPECACHE_H
15
16#include "clang/AST/CharUnits.h"
18
19namespace clang::CIRGen {
20
21/// This structure provides a set of types that are commonly used
22/// during IR emission. It's initialized once in CodeGenModule's
23/// constructor and then copied around into new CIRGenFunction's.
26
27 // ClangIR void type
28 cir::VoidType VoidTy;
29
30 // ClangIR signed integral types of common sizes
31 cir::IntType SInt8Ty;
32 cir::IntType SInt16Ty;
33 cir::IntType SInt32Ty;
34 cir::IntType SInt64Ty;
35 cir::IntType SInt128Ty;
36
37 // ClangIR unsigned integral type of common sizes
38 cir::IntType UInt8Ty;
39 cir::IntType UInt16Ty;
40 cir::IntType UInt32Ty;
41 cir::IntType UInt64Ty;
42 cir::IntType UInt128Ty;
43
44 // ClangIR floating-point types with fixed formats
45 cir::FP16Type FP16Ty;
46 cir::BF16Type BFloat16Ty;
47 cir::SingleType FloatTy;
48 cir::DoubleType DoubleTy;
49 cir::FP80Type FP80Ty;
50 cir::FP128Type FP128Ty;
51
52 /// ClangIR char
53 mlir::Type UCharTy;
54
55 /// intptr_t, size_t, and ptrdiff_t, which we assume are the same size.
56 union {
57 mlir::Type UIntPtrTy;
58 mlir::Type SizeTy;
59 };
60
61 mlir::Type PtrDiffTy;
62
63 /// void* in address space 0
64 cir::PointerType VoidPtrTy;
65 cir::PointerType UInt8PtrTy;
66
67 /// The size and alignment of a pointer into the generic address space.
68 union {
69 unsigned char PointerAlignInBytes;
70 unsigned char PointerSizeInBytes;
71 };
72
73 /// The alignment of size_t.
74 unsigned char SizeAlignInBytes;
75
79
83};
84
85} // namespace clang::CIRGen
86
87#endif // LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENTYPECACHE_H
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
cir::PointerType VoidPtrTy
void* in address space 0
clang::CharUnits getPointerAlign() const
unsigned char SizeAlignInBytes
The alignment of size_t.
clang::CharUnits getSizeAlign() const
mlir::Type UCharTy
ClangIR char.