13
13
#ifndef CLANG_CIR_DIALECT_IR_CIRENUMATTR_TD
14
14
#define CLANG_CIR_DIALECT_IR_CIRENUMATTR_TD
15
15
16
+ include "clang/CIR/Dialect/IR/CIRDialect.td"
16
17
include "mlir/IR/EnumAttr.td"
17
18
18
19
class CIR_I32EnumAttr<string name, string summary, list<I32EnumAttrCase> cases>
@@ -35,4 +36,28 @@ class CIR_DefaultValuedEnumParameter<EnumAttrInfo info, string value = "">
35
36
let defaultValue = value;
36
37
}
37
38
39
+ def CIR_AddressSpace : CIR_I32EnumAttr<
40
+ "AddressSpace", "address space kind", [
41
+ I32EnumAttrCase<"Default", 0, "default">,
42
+ I32EnumAttrCase<"OffloadPrivate", 1, "offload_private">,
43
+ I32EnumAttrCase<"OffloadLocal", 2, "offload_local">,
44
+ I32EnumAttrCase<"OffloadGlobal", 3, "offload_global">,
45
+ I32EnumAttrCase<"OffloadConstant", 4, "offload_constant">,
46
+ I32EnumAttrCase<"OffloadGeneric", 5, "offload_generic">,
47
+ I32EnumAttrCase<"Target", 6, "target">
48
+ ]> {
49
+ let description = [{
50
+ The `address_space` attribute is used to represent address spaces for
51
+ pointer types in CIR. It provides a unified model on top of `clang::LangAS`
52
+ and simplifies the representation of address spaces.
53
+
54
+ The `value` parameter is an extensible enum, which encodes target address
55
+ space as an offset to the last language address space. For that reason, the
56
+ attribute is implemented as custom AddressSpaceAttr, which provides custom
57
+ printer and parser for the `value` parameter.
58
+ }];
59
+
60
+ let genSpecializedAttr = 0;
61
+ }
62
+
38
63
#endif // CLANG_CIR_DIALECT_IR_CIRENUMATTR_TD
0 commit comments