xref: /llvm-project/clang/lib/CIR/CodeGen/CIRGenTypeCache.h (revision 8ae8a905855ca1b07a72059d8225ab1f9cae65dc)
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/CIR/Dialect/IR/CIRTypes.h"
17 
18 namespace clang::CIRGen {
19 
20 /// This structure provides a set of types that are commonly used
21 /// during IR emission. It's initialized once in CodeGenModule's
22 /// constructor and then copied around into new CIRGenFunction's.
23 struct CIRGenTypeCache {
24   CIRGenTypeCache() = default;
25 
26   // ClangIR void type
27   cir::VoidType VoidTy;
28 
29   // ClangIR signed integral types of common sizes
30   cir::IntType SInt8Ty;
31   cir::IntType SInt16Ty;
32   cir::IntType SInt32Ty;
33   cir::IntType SInt64Ty;
34   cir::IntType SInt128Ty;
35 
36   // ClangIR unsigned integral type of common sizes
37   cir::IntType UInt8Ty;
38   cir::IntType UInt16Ty;
39   cir::IntType UInt32Ty;
40   cir::IntType UInt64Ty;
41   cir::IntType UInt128Ty;
42 
43   // ClangIR floating-point types with fixed formats
44   cir::FP16Type FP16Ty;
45   cir::BF16Type BFloat16Ty;
46   cir::SingleType FloatTy;
47   cir::DoubleType DoubleTy;
48   cir::FP80Type FP80Ty;
49   cir::FP128Type FP128Ty;
50 };
51 
52 } // namespace clang::CIRGen
53 
54 #endif // LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENTYPECACHE_H
55