clang 23.0.0git
CIRTypes.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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 file declares the types in the CIR dialect.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef CLANG_CIR_DIALECT_IR_CIRTYPES_H
14#define CLANG_CIR_DIALECT_IR_CIRTYPES_H
15
16#include "mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.h"
17#include "mlir/IR/Attributes.h"
18#include "mlir/IR/BuiltinAttributes.h"
19#include "mlir/IR/MLIRContext.h"
20#include "mlir/IR/Types.h"
21#include "mlir/Interfaces/DataLayoutInterfaces.h"
26
27namespace cir {
28
29namespace detail {
31} // namespace detail
32
33bool isValidFundamentalIntWidth(unsigned width);
34
35/// Returns true if the type is a CIR sized type.
36///
37/// Types are sized if they implement SizedTypeInterface and
38/// return true from its method isSized.
39///
40/// Unsized types are those that do not have a size, such as
41/// void, or abstract types.
42bool isSized(mlir::Type ty);
43
44//===----------------------------------------------------------------------===//
45// AddressSpace helpers
46//===----------------------------------------------------------------------===//
47
48cir::LangAddressSpace toCIRLangAddressSpace(clang::LangAS langAS);
49
50// Compare a CIR memory space attribute with a Clang LangAS.
51bool isMatchingAddressSpace(mlir::ptr::MemorySpaceAttrInterface cirAS,
52 clang::LangAS as);
53
54/// Convert an AST LangAS to the appropriate CIR address space attribute
55/// interface.
56mlir::ptr::MemorySpaceAttrInterface
57toCIRAddressSpaceAttr(mlir::MLIRContext &ctx, clang::LangAS langAS);
58
59/// Normalize LangAddressSpace::Default to null (empty attribute).
60mlir::ptr::MemorySpaceAttrInterface
61normalizeDefaultAddressSpace(mlir::ptr::MemorySpaceAttrInterface addrSpace);
62
64 mlir::ptr::MemorySpaceAttrInterface memorySpace);
65
66} // namespace cir
67
68//===----------------------------------------------------------------------===//
69// CIR Dialect Tablegen'd Types
70//===----------------------------------------------------------------------===//
71
72namespace cir {
73
74#include "clang/CIR/Dialect/IR/CIRTypeConstraints.h.inc"
75
76} // namespace cir
77
78#define GET_TYPEDEF_CLASSES
79#include "clang/CIR/Dialect/IR/CIROpsTypes.h.inc"
80
81#endif // CLANG_CIR_DIALECT_IR_CIRTYPES_H
Provides definitions for the various language-specific address spaces.
bool isMatchingAddressSpace(mlir::ptr::MemorySpaceAttrInterface cirAS, clang::LangAS as)
cir::LangAddressSpace toCIRLangAddressSpace(clang::LangAS langAS)
Definition CIRTypes.cpp:953
bool isValidFundamentalIntWidth(unsigned width)
Definition CIRTypes.cpp:534
mlir::ptr::MemorySpaceAttrInterface toCIRAddressSpaceAttr(mlir::MLIRContext &ctx, clang::LangAS langAS)
Convert an AST LangAS to the appropriate CIR address space attribute interface.
mlir::ptr::MemorySpaceAttrInterface normalizeDefaultAddressSpace(mlir::ptr::MemorySpaceAttrInterface addrSpace)
Normalize LangAddressSpace::Default to null (empty attribute).
bool isSized(mlir::Type ty)
Returns true if the type is a CIR sized type.
Definition CIRTypes.cpp:33
bool isSupportedCIRMemorySpaceAttr(mlir::ptr::MemorySpaceAttrInterface memorySpace)
Definition CIRTypes.cpp:947
LangAS
Defines the address space values used by the address space qualifier of QualType.
Type storage for CIR record types.