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"
19
20namespace clang::CIRGen {
21
22/// This structure provides a set of types that are commonly used
23/// during IR emission. It's initialized once in CodeGenModule's
24/// constructor and then copied around into new CIRGenFunction's.
27
28 // ClangIR void type
29 cir::VoidType VoidTy;
30
31 // ClangIR signed integral types of common sizes
32 cir::IntType SInt8Ty;
33 cir::IntType SInt16Ty;
34 cir::IntType SInt32Ty;
35 cir::IntType SInt64Ty;
36 cir::IntType SInt128Ty;
37
38 // ClangIR unsigned integral type of common sizes
39 cir::IntType UInt8Ty;
40 cir::IntType UInt16Ty;
41 cir::IntType UInt32Ty;
42 cir::IntType UInt64Ty;
43 cir::IntType UInt128Ty;
44
45 // ClangIR floating-point types with fixed formats
46 cir::FP16Type FP16Ty;
47 cir::BF16Type BFloat16Ty;
48 cir::SingleType FloatTy;
49 cir::DoubleType DoubleTy;
50 cir::FP80Type FP80Ty;
51 cir::FP128Type FP128Ty;
52
53 /// ClangIR char
54 mlir::Type UCharTy;
55
56 /// intptr_t, size_t, and ptrdiff_t, which we assume are the same size.
57 union {
58 mlir::Type UIntPtrTy;
59 mlir::Type SizeTy;
60 };
61
62 mlir::Type PtrDiffTy;
63
64 /// void* in address space 0
65 cir::PointerType VoidPtrTy;
66 cir::PointerType UInt8PtrTy;
67
68 /// The size and alignment of a pointer into the generic address space.
69 union {
70 unsigned char PointerAlignInBytes;
71 unsigned char PointerSizeInBytes;
72 };
73
74 /// The alignment of size_t.
75 unsigned char SizeAlignInBytes;
76
77 cir::TargetAddressSpaceAttr cirAllocaAddressSpace;
78
82
86
87 cir::TargetAddressSpaceAttr getCIRAllocaAddressSpace() const {
89 }
90};
91
92} // namespace clang::CIRGen
93
94#endif // LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENTYPECACHE_H
Provides definitions for the various language-specific address spaces.
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
cir::TargetAddressSpaceAttr cirAllocaAddressSpace
unsigned char SizeAlignInBytes
The alignment of size_t.
cir::TargetAddressSpaceAttr getCIRAllocaAddressSpace() const
clang::CharUnits getSizeAlign() const
mlir::Type UCharTy
ClangIR char.