clang 24.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 "mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.h"
17#include "clang/AST/CharUnits.h"
20
21namespace clang::CIRGen {
22
23/// This structure provides a set of types that are commonly used
24/// during IR emission. It's initialized once in CodeGenModule's
25/// constructor and then copied around into new CIRGenFunction's.
28
29 // ClangIR void type
30 cir::VoidType voidTy;
31
32 // ClangIR signed integral types of common sizes
33 cir::IntType sInt8Ty;
34 cir::IntType sInt16Ty;
35 cir::IntType sInt32Ty;
36 cir::IntType sInt64Ty;
37 cir::IntType sInt128Ty;
38
39 // ClangIR unsigned integral type of common sizes
40 cir::IntType uInt8Ty;
41 cir::IntType uInt16Ty;
42 cir::IntType uInt32Ty;
43 cir::IntType uInt64Ty;
44 cir::IntType uInt128Ty;
45
46 // ClangIR floating-point types with fixed formats
47 cir::FP16Type fP16Ty;
48 cir::BF16Type bFloat16Ty;
49 cir::SingleType floatTy;
50 cir::DoubleType doubleTy;
51 cir::FP80Type fP80Ty;
52 cir::FP128Type fP128Ty;
53
54 // ClangIR floating-point types whose format is selected at run time
55 cir::MFloat8Type mFloat8Ty;
56
57 /// ClangIR char
58 mlir::Type uCharTy;
59
60 /// intptr_t, size_t, and ptrdiff_t, which we assume are the same size.
61 union {
62 cir::IntType uIntPtrTy;
63 cir::IntType sizeTy;
64 };
65
66 mlir::Type ptrDiffTy;
67
68 /// void* in address space 0
69 cir::PointerType voidPtrTy;
70 cir::PointerType uInt8PtrTy;
71
72 /// void* in alloca address space
73 cir::PointerType allocaInt8PtrTy;
74
75 /// The size and alignment of a pointer into the generic address space.
76 union {
77 unsigned char PointerAlignInBytes;
78 unsigned char PointerSizeInBytes;
79 };
80
81 /// The size and alignment of size_t.
82 union {
83 unsigned char SizeSizeInBytes; // sizeof(size_t)
84 unsigned char SizeAlignInBytes;
85 };
86
87 mlir::ptr::MemorySpaceAttrInterface cirAllocaAddressSpace;
88
95
99
100 mlir::ptr::MemorySpaceAttrInterface getCIRAllocaAddressSpace() const {
102 }
103};
104
105} // namespace clang::CIRGen
106
107#endif // LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENTYPECACHE_H
Provides definitions for the various language-specific address spaces.
This is an opaque type for sizes expressed in character units.
Definition CharUnits.h:38
static constexpr CharUnits fromQuantity(QuantityType Quantity)
Construct a CharUnits quantity from a raw integer type.
Definition CharUnits.h:58
clang::CharUnits getPointerAlign() const
mlir::Type uCharTy
ClangIR char.
clang::CharUnits getSizeSize() const
cir::PointerType allocaInt8PtrTy
void* in alloca address space
mlir::ptr::MemorySpaceAttrInterface getCIRAllocaAddressSpace() const
mlir::ptr::MemorySpaceAttrInterface cirAllocaAddressSpace
clang::CharUnits getSizeAlign() const
cir::PointerType voidPtrTy
void* in address space 0