1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* AttrDef Declarations *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* *|
7\*===----------------------------------------------------------------------===*/
8
9#ifdef GET_ATTRDEF_CLASSES
10#undef GET_ATTRDEF_CLASSES
11
12#include "mlir/IR/Attributes.h"
13#include "mlir/IR/BuiltinAttributeInterfaces.h"
14
15
16namespace mlir {
17class AsmParser;
18class AsmPrinter;
19} // namespace mlir
20namespace mlir::ptr {
21
22/// Address attribute
23/// The `address` attribute represents a raw memory address, expressed in bytes.
24///
25/// Example:
26///
27/// ```mlir
28/// #ptr.address<0x1000> : !ptr.ptr<#ptr.generic_space>
29/// ```
30class AddressAttr;
31/// Generic memory space
32/// The `generic_space` attribute defines a memory space attribute with the
33/// following properties:
34/// - Load and store operations are always valid, regardless of the type.
35/// - Atomic operations are always valid, regardless of the type.
36/// - Cast operations to `generic_space` are always valid.
37///
38/// Example:
39///
40/// ```mlir
41/// #ptr.generic_space : !ptr.ptr<#ptr.generic_space>
42/// ```
43class GenericSpaceAttr;
44/// Null pointer attribute
45/// The `null` attribute represents a null pointer.
46///
47/// Example:
48///
49/// ```mlir
50/// #ptr.null
51/// ```
52class NullAttr;
53/// ptr data layout spec
54/// Defines the data layout spec for a pointer type. This attribute has 4
55/// fields:
56/// - [Required] size: size of the pointer in bits.
57/// - [Required] abi: ABI-required alignment for the pointer in bits.
58/// - [Required] preferred: preferred alignment for the pointer in bits.
59/// - [Optional] index: bitwidth that should be used when performing index
60/// computations for the type. Setting the field to `kOptionalSpecValue`, means
61/// the field is optional.
62///
63/// Furthermore, the attribute will verify that all present values are divisible
64/// by 8 (number of bits in a byte), and that `preferred` > `abi`.
65///
66/// Example:
67/// ```mlir
68/// // Spec for a 64 bit ptr, with a required alignment of 64 bits, but with
69/// // a preferred alignment of 128 bits and an index bitwidth of 64 bits.
70/// #ptr.spec<size = 64, abi = 64, preferred = 128, index = 64>
71/// ```
72class SpecAttr;
73namespace detail {
74
75struct AddressAttrStorage;
76
77} // namespace detail
78class AddressAttr : public ::mlir::Attribute::AttrBase<AddressAttr, ::mlir::Attribute, detail::AddressAttrStorage, ::mlir::TypedAttr::Trait> {
79public:
80 using Base::Base;
81 static constexpr ::llvm::StringLiteral name = "ptr.address";
82 static constexpr ::llvm::StringLiteral dialectName = "ptr";
83 static AddressAttr get(::mlir::MLIRContext *context, PtrType type, ::llvm::APInt value);
84 static AddressAttr get(PtrType type, const llvm::APInt &value);
85 static constexpr ::llvm::StringLiteral getMnemonic() {
86 return {"address"};
87 }
88
89 static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType);
90 void print(::mlir::AsmPrinter &odsPrinter) const;
91 PtrType getType() const;
92 const ::llvm::APInt &getValue() const;
93};
94class GenericSpaceAttr : public ::mlir::Attribute::AttrBase<GenericSpaceAttr, ::mlir::Attribute, ::mlir::AttributeStorage, ::mlir::ptr::MemorySpaceAttrInterface::Trait> {
95public:
96 using Base::Base;
97 static constexpr ::llvm::StringLiteral name = "ptr.generic_space";
98 static constexpr ::llvm::StringLiteral dialectName = "ptr";
99 static constexpr ::llvm::StringLiteral getMnemonic() {
100 return {"generic_space"};
101 }
102
103 static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType);
104 void print(::mlir::AsmPrinter &odsPrinter) const;
105 bool isValidLoad(::mlir::Type type, ::mlir::ptr::AtomicOrdering ordering, std::optional<int64_t> alignment, const ::mlir::DataLayout *dataLayout, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) const;
106 bool isValidStore(::mlir::Type type, ::mlir::ptr::AtomicOrdering ordering, std::optional<int64_t> alignment, const ::mlir::DataLayout *dataLayout, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) const;
107 bool isValidAtomicOp(::mlir::ptr::AtomicBinOp op, ::mlir::Type type, ::mlir::ptr::AtomicOrdering ordering, std::optional<int64_t> alignment, const ::mlir::DataLayout *dataLayout, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) const;
108 bool isValidAtomicXchg(::mlir::Type type, ::mlir::ptr::AtomicOrdering successOrdering, ::mlir::ptr::AtomicOrdering failureOrdering, std::optional<int64_t> alignment, const ::mlir::DataLayout *dataLayout, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) const;
109 bool isValidAddrSpaceCast(::mlir::Type tgt, ::mlir::Type src, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) const;
110 bool isValidPtrIntCast(::mlir::Type intLikeTy, ::mlir::Type ptrLikeTy, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) const;
111};
112namespace detail {
113
114struct NullAttrStorage;
115
116} // namespace detail
117class NullAttr : public ::mlir::Attribute::AttrBase<NullAttr, ::mlir::Attribute, detail::NullAttrStorage, ::mlir::TypedAttr::Trait> {
118public:
119 using Base::Base;
120 static constexpr ::llvm::StringLiteral name = "ptr.null";
121 static constexpr ::llvm::StringLiteral dialectName = "ptr";
122 static NullAttr get(::mlir::MLIRContext *context, PtrType type);
123 static NullAttr get(PtrType type);
124 static constexpr ::llvm::StringLiteral getMnemonic() {
125 return {"null"};
126 }
127
128 static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType);
129 void print(::mlir::AsmPrinter &odsPrinter) const;
130 PtrType getType() const;
131};
132namespace detail {
133
134struct SpecAttrStorage;
135
136} // namespace detail
137class SpecAttr : public ::mlir::Attribute::AttrBase<SpecAttr, ::mlir::Attribute, detail::SpecAttrStorage> {
138public:
139 using Base::Base;
140 /// Constant for specifying a spec entry is optional.
141 static constexpr uint32_t kOptionalSpecValue = std::numeric_limits<uint32_t>::max();
142 static constexpr ::llvm::StringLiteral name = "ptr.spec";
143 static constexpr ::llvm::StringLiteral dialectName = "ptr";
144 using Base::getChecked;
145 static SpecAttr get(::mlir::MLIRContext *context, uint32_t size, uint32_t abi, uint32_t preferred, uint32_t index = kOptionalSpecValue);
146 static SpecAttr getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, uint32_t size, uint32_t abi, uint32_t preferred, uint32_t index = kOptionalSpecValue);
147 static ::llvm::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, uint32_t size, uint32_t abi, uint32_t preferred, uint32_t index);
148 static ::llvm::LogicalResult verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, uint32_t size, uint32_t abi, uint32_t preferred, uint32_t index);
149 static constexpr ::llvm::StringLiteral getMnemonic() {
150 return {"spec"};
151 }
152
153 static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType);
154 void print(::mlir::AsmPrinter &odsPrinter) const;
155 uint32_t getSize() const;
156 uint32_t getAbi() const;
157 uint32_t getPreferred() const;
158 uint32_t getIndex() const;
159};
160
161} // namespace mlir::ptr
162MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ptr::AddressAttr)
163MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ptr::GenericSpaceAttr)
164MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ptr::NullAttr)
165MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ptr::SpecAttr)
166
167#endif // GET_ATTRDEF_CLASSES
168
169