clang 23.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 char
55 mlir::Type uCharTy;
56
57 /// intptr_t, size_t, and ptrdiff_t, which we assume are the same size.
58 union {
59 mlir::Type uIntPtrTy;
60 mlir::Type sizeTy;
61 };
62
63 mlir::Type ptrDiffTy;
64
65 /// void* in address space 0
66 cir::PointerType voidPtrTy;
67 cir::PointerType uInt8PtrTy;
68
69 /// void* in alloca address space
70 cir::PointerType allocaInt8PtrTy;
71
72 /// The size and alignment of a pointer into the generic address space.
73 union {
74 unsigned char PointerAlignInBytes;
75 unsigned char PointerSizeInBytes;
76 };
77
78 /// The size and alignment of size_t.
79 union {
80 unsigned char SizeSizeInBytes; // sizeof(size_t)
81 unsigned char SizeAlignInBytes;
82 };
83
84 mlir::ptr::MemorySpaceAttrInterface cirAllocaAddressSpace;
85
92
96
97 mlir::ptr::MemorySpaceAttrInterface getCIRAllocaAddressSpace() const {
99 }
100};
101
102} // namespace clang::CIRGen
103
104#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
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