10
10
//
11
11
//===----------------------------------------------------------------------===//
12
12
13
- #ifndef MLIR_CIR_DIALECT_CIR_ATTRS
14
- #define MLIR_CIR_DIALECT_CIR_ATTRS
13
+ #ifndef CLANG_CIR_DIALECT_IR_CIRATTRS_TD
14
+ #define CLANG_CIR_DIALECT_IR_CIRATTRS_TD
15
15
16
16
include "mlir/IR/BuiltinAttributeInterfaces.td"
17
17
include "clang/CIR/Dialect/IR/CIREnumAttr.td"
@@ -45,7 +45,7 @@ class CIR_TypedAttr<string name, string attrMnemonic, list<Trait> traits = []>
45
45
let assemblyFormat = [{}];
46
46
}
47
47
48
- class CIRUnitAttr <string name, string attrMnemonic, list<Trait> traits = []>
48
+ class CIR_UnitAttr <string name, string attrMnemonic, list<Trait> traits = []>
49
49
: CIR_Attr<name, attrMnemonic, traits> {
50
50
let returnType = "bool";
51
51
let defaultValue = "false";
@@ -68,7 +68,6 @@ def CIR_SourceLanguage : CIR_I32EnumAttr<"SourceLanguage", "source language", [
68
68
}
69
69
70
70
def CIR_SourceLanguageAttr : CIR_EnumAttr<CIR_SourceLanguage, "lang"> {
71
-
72
71
let summary = "Module source language";
73
72
let description = [{
74
73
Represents the source language used to generate the module.
@@ -252,7 +251,7 @@ def CIR_BoolAttr : CIR_Attr<"Bool", "bool", [TypedAttrInterface]> {
252
251
// ZeroAttr
253
252
//===----------------------------------------------------------------------===//
254
253
255
- def ZeroAttr : CIR_TypedAttr<"Zero", "zero"> {
254
+ def CIR_ZeroAttr : CIR_TypedAttr<"Zero", "zero"> {
256
255
let summary = "Attribute to represent zero initialization";
257
256
let description = [{
258
257
The ZeroAttr is used to indicate zero initialization on structs.
@@ -263,7 +262,7 @@ def ZeroAttr : CIR_TypedAttr<"Zero", "zero"> {
263
262
// UndefAttr
264
263
//===----------------------------------------------------------------------===//
265
264
266
- def UndefAttr : CIR_TypedAttr<"Undef", "undef"> {
265
+ def CIR_UndefAttr : CIR_TypedAttr<"Undef", "undef"> {
267
266
let summary = "Represent an undef constant";
268
267
let description = [{
269
268
The UndefAttr represents an undef constant, corresponding to LLVM's notion
@@ -275,7 +274,7 @@ def UndefAttr : CIR_TypedAttr<"Undef", "undef"> {
275
274
// PoisonAttr
276
275
//===----------------------------------------------------------------------===//
277
276
278
- def PoisonAttr : CIR_TypedAttr<"Poison", "poison"> {
277
+ def CIR_PoisonAttr : CIR_TypedAttr<"Poison", "poison"> {
279
278
let summary = "Represent a typed poison constant";
280
279
let description = [{
281
280
The PoisonAttr represents a typed poison constant, corresponding to LLVM's
@@ -287,7 +286,9 @@ def PoisonAttr : CIR_TypedAttr<"Poison", "poison"> {
287
286
// ConstArrayAttr
288
287
//===----------------------------------------------------------------------===//
289
288
290
- def ConstArrayAttr : CIR_Attr<"ConstArray", "const_array", [TypedAttrInterface]> {
289
+ def CIR_ConstArrayAttr : CIR_Attr<"ConstArray", "const_array", [
290
+ TypedAttrInterface
291
+ ]> {
291
292
let summary = "A constant array from ArrayAttr or StringRefAttr";
292
293
let description = [{
293
294
An CIR array attribute is an array of literals of the specified attr types.
@@ -333,8 +334,9 @@ def ConstArrayAttr : CIR_Attr<"ConstArray", "const_array", [TypedAttrInterface]>
333
334
// ConstVectorAttr
334
335
//===----------------------------------------------------------------------===//
335
336
336
- def ConstVectorAttr : CIR_Attr<"ConstVector", "const_vector",
337
- [TypedAttrInterface]> {
337
+ def CIR_ConstVectorAttr : CIR_Attr<"ConstVector", "const_vector", [
338
+ TypedAttrInterface
339
+ ]> {
338
340
let summary = "A constant vector from ArrayAttr";
339
341
let description = [{
340
342
A CIR vector attribute is an array of literals of the specified attribute
@@ -364,8 +366,9 @@ def ConstVectorAttr : CIR_Attr<"ConstVector", "const_vector",
364
366
// ConstRecordAttr
365
367
//===----------------------------------------------------------------------===//
366
368
367
- def ConstRecordAttr : CIR_Attr<"ConstRecord", "const_record",
368
- [TypedAttrInterface]> {
369
+ def CIR_ConstRecordAttr : CIR_Attr<"ConstRecord", "const_record", [
370
+ TypedAttrInterface
371
+ ]> {
369
372
let summary = "Represents a constant record";
370
373
let description = [{
371
374
Effectively supports "struct-like" constants. It's must be built from
@@ -506,7 +509,7 @@ def CIR_FPAttr : CIR_Attr<"FP", "fp", [TypedAttrInterface]> {
506
509
// ComplexAttr
507
510
//===----------------------------------------------------------------------===//
508
511
509
- def ComplexAttr : CIR_Attr<"Complex", "complex", [TypedAttrInterface]> {
512
+ def CIR_ComplexAttr : CIR_Attr<"Complex", "complex", [TypedAttrInterface]> {
510
513
let summary = "An attribute that contains a constant complex value";
511
514
let description = [{
512
515
The `#cir.complex` attribute contains a constant value of complex number
@@ -540,7 +543,7 @@ def ComplexAttr : CIR_Attr<"Complex", "complex", [TypedAttrInterface]> {
540
543
// ConstPointerAttr
541
544
//===----------------------------------------------------------------------===//
542
545
543
- def ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> {
546
+ def CIR_ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> {
544
547
let summary = "Holds a constant pointer value";
545
548
let parameters = (ins
546
549
AttributeSelfTypeParameter<"", "::cir::PointerType">:$type,
@@ -575,7 +578,7 @@ def CIR_CmpOrdering : CIR_I32EnumAttr<
575
578
let genSpecializedAttr = 0;
576
579
}
577
580
578
- def CmpThreeWayInfoAttr : CIR_Attr<"CmpThreeWayInfo", "cmp3way_info"> {
581
+ def CIR_CmpThreeWayInfoAttr : CIR_Attr<"CmpThreeWayInfo", "cmp3way_info"> {
579
582
let summary = "Holds information about a three-way comparison operation";
580
583
let description = [{
581
584
The `#cmp3way_info` attribute contains information about a three-way
@@ -629,8 +632,9 @@ def CmpThreeWayInfoAttr : CIR_Attr<"CmpThreeWayInfo", "cmp3way_info"> {
629
632
// DataMemberAttr
630
633
//===----------------------------------------------------------------------===//
631
634
632
- def DataMemberAttr : CIR_Attr<"DataMember", "data_member",
633
- [TypedAttrInterface]> {
635
+ def CIR_DataMemberAttr : CIR_Attr<"DataMember", "data_member", [
636
+ TypedAttrInterface
637
+ ]> {
634
638
let summary = "Holds a constant data member pointer value";
635
639
let parameters = (ins AttributeSelfTypeParameter<
636
640
"", "cir::DataMemberType">:$type,
@@ -679,7 +683,7 @@ def DataMemberAttr : CIR_Attr<"DataMember", "data_member",
679
683
// MethodAttr
680
684
//===----------------------------------------------------------------------===//
681
685
682
- def MethodAttr : CIR_Attr<"Method", "method", [TypedAttrInterface]> {
686
+ def CIR_MethodAttr : CIR_Attr<"Method", "method", [TypedAttrInterface]> {
683
687
let summary = "Holds a constant pointer-to-member-function value";
684
688
let description = [{
685
689
A method attribute is a literal attribute that represents a constant
@@ -737,7 +741,9 @@ def MethodAttr : CIR_Attr<"Method", "method", [TypedAttrInterface]> {
737
741
// GlobalViewAttr
738
742
//===----------------------------------------------------------------------===//
739
743
740
- def GlobalViewAttr : CIR_Attr<"GlobalView", "global_view", [TypedAttrInterface]> {
744
+ def CIR_GlobalViewAttr : CIR_Attr<"GlobalView", "global_view", [
745
+ TypedAttrInterface
746
+ ]> {
741
747
let summary = "Provides constant access to a global address";
742
748
let description = [{
743
749
Get constant address of global `symbol` and optionally apply offsets to
@@ -820,7 +826,7 @@ def GlobalViewAttr : CIR_Attr<"GlobalView", "global_view", [TypedAttrInterface]>
820
826
// TypeInfoAttr
821
827
//===----------------------------------------------------------------------===//
822
828
823
- def TypeInfoAttr : CIR_Attr<"TypeInfo", "typeinfo", [TypedAttrInterface]> {
829
+ def CIR_TypeInfoAttr : CIR_Attr<"TypeInfo", "typeinfo", [TypedAttrInterface]> {
824
830
let summary = "Represents a typeinfo used for RTTI";
825
831
let description = [{
826
832
The typeinfo data for a given class is stored into an ArrayAttr. The
@@ -905,8 +911,7 @@ def VTableAttr : CIR_Attr<"VTable", "vtable", [TypedAttrInterface]> {
905
911
// DynamicCastInfoAttr
906
912
//===----------------------------------------------------------------------===//
907
913
908
- def DynamicCastInfoAttr
909
- : CIR_Attr<"DynamicCastInfo", "dyn_cast_info"> {
914
+ def CIR_DynamicCastInfoAttr : CIR_Attr<"DynamicCastInfo", "dyn_cast_info"> {
910
915
let summary = "ABI specific information about a dynamic cast";
911
916
let description = [{
912
917
Provide ABI specific information about a dynamic cast operation.
@@ -922,11 +927,13 @@ def DynamicCastInfoAttr
922
927
`__dynamic_cast` runtime function.
923
928
}];
924
929
925
- let parameters = (ins GlobalViewAttr:$srcRtti,
926
- GlobalViewAttr:$destRtti,
927
- "mlir::FlatSymbolRefAttr":$runtimeFunc,
928
- "mlir::FlatSymbolRefAttr":$badCastFunc,
929
- CIR_IntAttr:$offsetHint);
930
+ let parameters = (ins
931
+ CIR_GlobalViewAttr:$srcRtti,
932
+ CIR_GlobalViewAttr:$destRtti,
933
+ "mlir::FlatSymbolRefAttr":$runtimeFunc,
934
+ "mlir::FlatSymbolRefAttr":$badCastFunc,
935
+ CIR_IntAttr:$offsetHint
936
+ );
930
937
931
938
let builders = [
932
939
AttrBuilderWithInferredContext<(ins "GlobalViewAttr":$srcRtti,
@@ -1000,8 +1007,8 @@ def CIR_AddressSpaceAttr : CIR_EnumAttr<CIR_AddressSpace, "address_space"> {
1000
1007
// AST Wrappers
1001
1008
//===----------------------------------------------------------------------===//
1002
1009
1003
- class AST <string name, string prefix, list<Trait> traits = []>
1004
- : CIR_Attr<!strconcat("AST", name), !strconcat(prefix, ".ast"), traits> {
1010
+ class CIR_AST <string name, string prefix, list<Trait> traits = []>
1011
+ : CIR_Attr<!strconcat("AST", name), !strconcat(prefix, ".ast"), traits> {
1005
1012
string clang_name = !strconcat("const clang::", name, " *");
1006
1013
1007
1014
let summary = !strconcat("Wraps a '", clang_name, "' AST node.");
@@ -1040,40 +1047,54 @@ class AST<string name, string prefix, list<Trait> traits = []>
1040
1047
}];
1041
1048
}
1042
1049
1043
- def ASTDeclAttr : AST <"Decl", "decl", [ASTDeclInterface]>;
1050
+ def CIR_ASTDeclAttr : CIR_AST <"Decl", "decl", [ASTDeclInterface]>;
1044
1051
1045
- def ASTFunctionDeclAttr : AST<"FunctionDecl", "function.decl",
1046
- [ASTFunctionDeclInterface]>;
1052
+ def CIR_ASTFunctionDeclAttr : CIR_AST<"FunctionDecl", "function.decl",[
1053
+ ASTFunctionDeclInterface
1054
+ ]>;
1047
1055
1048
- def ASTCXXMethodDeclAttr : AST<"CXXMethodDecl", "cxxmethod.decl",
1049
- [ASTCXXMethodDeclInterface]>;
1056
+ def CIR_ASTCXXMethodDeclAttr : CIR_AST<"CXXMethodDecl", "cxxmethod.decl", [
1057
+ ASTCXXMethodDeclInterface
1058
+ ]>;
1050
1059
1051
- def ASTCXXConstructorDeclAttr : AST<"CXXConstructorDecl",
1052
- "cxxconstructor.decl", [ASTCXXConstructorDeclInterface]>;
1060
+ def CIR_ASTCXXConstructorDeclAttr
1061
+ : CIR_AST<"CXXConstructorDecl","cxxconstructor.decl", [
1062
+ ASTCXXConstructorDeclInterface
1063
+ ]>;
1053
1064
1054
- def ASTCXXConversionDeclAttr : AST<"CXXConversionDecl",
1055
- "cxxconversion.decl", [ASTCXXConversionDeclInterface]>;
1065
+ def CIR_ASTCXXConversionDeclAttr
1066
+ : CIR_AST<"CXXConversionDecl", "cxxconversion.decl", [
1067
+ ASTCXXConversionDeclInterface
1068
+ ]>;
1056
1069
1057
- def ASTCXXDestructorDeclAttr : AST<"CXXDestructorDecl",
1058
- "cxxdestructor.decl", [ASTCXXDestructorDeclInterface]>;
1070
+ def CIR_ASTCXXDestructorDeclAttr
1071
+ : CIR_AST<"CXXDestructorDecl", "cxxdestructor.decl", [
1072
+ ASTCXXDestructorDeclInterface
1073
+ ]>;
1059
1074
1060
- def ASTVarDeclAttr : AST<"VarDecl", "var.decl",
1061
- [ASTVarDeclInterface]>;
1075
+ def CIR_ASTVarDeclAttr : CIR_AST<"VarDecl", "var.decl", [
1076
+ ASTVarDeclInterface
1077
+ ]>;
1062
1078
1063
- def ASTTypeDeclAttr: AST<"TypeDecl", "type.decl",
1064
- [ASTTypeDeclInterface]>;
1079
+ def CIR_ASTTypeDeclAttr : CIR_AST<"TypeDecl", "type.decl", [
1080
+ ASTTypeDeclInterface
1081
+ ]>;
1065
1082
1066
- def ASTTagDeclAttr : AST<"TagDecl", "tag.decl",
1067
- [ASTTagDeclInterface]>;
1083
+ def CIR_ASTTagDeclAttr : CIR_AST<"TagDecl", "tag.decl", [
1084
+ ASTTagDeclInterface
1085
+ ]>;
1068
1086
1069
- def ASTRecordDeclAttr : AST<"RecordDecl", "record.decl",
1070
- [ASTRecordDeclInterface]>;
1087
+ def CIR_ASTRecordDeclAttr : CIR_AST<"RecordDecl", "record.decl", [
1088
+ ASTRecordDeclInterface
1089
+ ]>;
1071
1090
1072
- def ASTExprAttr : AST<"Expr", "expr",
1073
- [ASTExprInterface]>;
1091
+ def CIR_ASTExprAttr : CIR_AST<"Expr", "expr", [
1092
+ ASTExprInterface
1093
+ ]>;
1074
1094
1075
- def ASTCallExprAttr : AST<"CallExpr", "call.expr",
1076
- [ASTCallExprInterface]>;
1095
+ def CIR_ASTCallExprAttr : CIR_AST<"CallExpr", "call.expr", [
1096
+ ASTCallExprInterface
1097
+ ]>;
1077
1098
1078
1099
1079
1100
//===----------------------------------------------------------------------===//
@@ -1119,7 +1140,7 @@ def CIR_VisibilityAttr : CIR_EnumAttr<CIR_VisibilityKind, "visibility"> {
1119
1140
// ExtraFuncAttr
1120
1141
//===----------------------------------------------------------------------===//
1121
1142
1122
- def ExtraFuncAttr : CIR_Attr<"ExtraFuncAttributes", "extra"> {
1143
+ def CIR_ExtraFuncAttr : CIR_Attr<"ExtraFuncAttributes", "extra"> {
1123
1144
let summary = "Represents aggregated attributes for a function";
1124
1145
let description = [{
1125
1146
This is a wrapper of attribute dictionary that contains extra attributes of
@@ -1135,8 +1156,6 @@ def ExtraFuncAttr : CIR_Attr<"ExtraFuncAttributes", "extra"> {
1135
1156
];
1136
1157
1137
1158
let assemblyFormat = [{ `(` $elements `)` }];
1138
-
1139
- // Printing and parsing also available in CIRDialect.cpp
1140
1159
}
1141
1160
1142
1161
//===----------------------------------------------------------------------===//
@@ -1170,15 +1189,15 @@ def CIR_InlineAttr : CIR_EnumAttr<CIR_InlineKind, "inline"> {
1170
1189
// Unit Function Attributes
1171
1190
//===----------------------------------------------------------------------===//
1172
1191
1173
- def OptNoneAttr : CIRUnitAttr <"OptNone", "optnone"> {
1192
+ def CIR_OptNoneAttr : CIR_UnitAttr <"OptNone", "optnone"> {
1174
1193
let storageType = [{ OptNoneAttr }];
1175
1194
}
1176
1195
1177
- def NoThrowAttr : CIRUnitAttr <"NoThrow", "nothrow"> {
1196
+ def CIR_NoThrowAttr : CIR_UnitAttr <"NoThrow", "nothrow"> {
1178
1197
let storageType = [{ NoThrowAttr }];
1179
1198
}
1180
1199
1181
- def ConvergentAttr : CIRUnitAttr <"Convergent", "convergent"> {
1200
+ def CIR_ConvergentAttr : CIR_UnitAttr <"Convergent", "convergent"> {
1182
1201
let storageType = [{ ConvergentAttr }];
1183
1202
}
1184
1203
@@ -1236,23 +1255,23 @@ class CIR_GlobalCtorDtor<string name, string attrMnemonic>
1236
1255
}];
1237
1256
}
1238
1257
1239
- def GlobalCtorAttr : CIR_GlobalCtorDtor<"Ctor", "ctor"> {
1258
+ def CIR_GlobalCtorAttr : CIR_GlobalCtorDtor<"Ctor", "ctor"> {
1240
1259
let summary = "Marks a function as a global constructor";
1241
1260
let description = [{
1242
1261
Marks the function as a global constructor in the module's constructor list.
1243
1262
It will be executed before main() is called.
1244
1263
}];
1245
1264
}
1246
1265
1247
- def GlobalDtorAttr : CIR_GlobalCtorDtor<"Dtor", "dtor"> {
1266
+ def CIR_GlobalDtorAttr : CIR_GlobalCtorDtor<"Dtor", "dtor"> {
1248
1267
let summary = "Marks a function as a global destructor";
1249
1268
let description = [{
1250
1269
Marks a function as a global destructor in the module dtors list.
1251
1270
The function will be executed before the module unloading.
1252
1271
}];
1253
1272
}
1254
1273
1255
- def BitfieldInfoAttr : CIR_Attr<"BitfieldInfo", "bitfield_info"> {
1274
+ def CIR_BitfieldInfoAttr : CIR_Attr<"BitfieldInfo", "bitfield_info"> {
1256
1275
let summary = "Represents a bit field info";
1257
1276
let description = [{
1258
1277
Holds the next information about bitfields: name, storage type, a bitfield size
@@ -1282,7 +1301,7 @@ def BitfieldInfoAttr : CIR_Attr<"BitfieldInfo", "bitfield_info"> {
1282
1301
// AnnotationAttr
1283
1302
//===----------------------------------------------------------------------===//
1284
1303
1285
- def AnnotationAttr : CIR_Attr<"Annotation", "annotation"> {
1304
+ def CIR_AnnotationAttr : CIR_Attr<"Annotation", "annotation"> {
1286
1305
let summary = "Annotation attribute for global variables and functions";
1287
1306
let description = [{
1288
1307
Represent C/C++ attribute of annotate in CIR.
@@ -1321,8 +1340,9 @@ def AnnotationAttr : CIR_Attr<"Annotation", "annotation"> {
1321
1340
// GlobalAnnotationValuesAttr
1322
1341
//===----------------------------------------------------------------------===//
1323
1342
1324
- def GlobalAnnotationValuesAttr : CIR_Attr<"GlobalAnnotationValues",
1325
- "global_annotations"> {
1343
+ def CIR_GlobalAnnotationValuesAttr : CIR_Attr<"GlobalAnnotationValues",
1344
+ "global_annotations"
1345
+ > {
1326
1346
let summary = "Array of annotations, each element consists of name of"
1327
1347
"a global var or func and one of its annotations";
1328
1348
let description = [{
@@ -1366,7 +1386,7 @@ def GlobalAnnotationValuesAttr : CIR_Attr<"GlobalAnnotationValues",
1366
1386
// AddressPointAttr
1367
1387
//===----------------------------------------------------------------------===//
1368
1388
1369
- def AddressPointAttr : CIR_Attr<"AddressPoint", "address_point"> {
1389
+ def CIR_AddressPointAttr : CIR_Attr<"AddressPoint", "address_point"> {
1370
1390
let summary = "Address point attribute";
1371
1391
1372
1392
let description = [{
@@ -1397,4 +1417,4 @@ include "clang/CIR/Dialect/IR/CIRTBAAAttrs.td"
1397
1417
include "clang/CIR/Dialect/IR/CIROpenCLAttrs.td"
1398
1418
include "clang/CIR/Dialect/IR/CIRCUDAAttrs.td"
1399
1419
1400
- #endif // MLIR_CIR_DIALECT_CIR_ATTRS
1420
+ #endif // CLANG_CIR_DIALECT_IR_CIRATTRS_TD
0 commit comments