1010//
1111//===----------------------------------------------------------------------===//
1212
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
1515
1616include "mlir/IR/BuiltinAttributeInterfaces.td"
1717include "clang/CIR/Dialect/IR/CIREnumAttr.td"
@@ -45,7 +45,7 @@ class CIR_TypedAttr<string name, string attrMnemonic, list<Trait> traits = []>
4545 let assemblyFormat = [{}];
4646}
4747
48- class CIRUnitAttr <string name, string attrMnemonic, list<Trait> traits = []>
48+ class CIR_UnitAttr <string name, string attrMnemonic, list<Trait> traits = []>
4949 : CIR_Attr<name, attrMnemonic, traits> {
5050 let returnType = "bool";
5151 let defaultValue = "false";
@@ -68,7 +68,6 @@ def CIR_SourceLanguage : CIR_I32EnumAttr<"SourceLanguage", "source language", [
6868}
6969
7070def CIR_SourceLanguageAttr : CIR_EnumAttr<CIR_SourceLanguage, "lang"> {
71-
7271 let summary = "Module source language";
7372 let description = [{
7473 Represents the source language used to generate the module.
@@ -252,7 +251,7 @@ def CIR_BoolAttr : CIR_Attr<"Bool", "bool", [TypedAttrInterface]> {
252251// ZeroAttr
253252//===----------------------------------------------------------------------===//
254253
255- def ZeroAttr : CIR_TypedAttr<"Zero", "zero"> {
254+ def CIR_ZeroAttr : CIR_TypedAttr<"Zero", "zero"> {
256255 let summary = "Attribute to represent zero initialization";
257256 let description = [{
258257 The ZeroAttr is used to indicate zero initialization on structs.
@@ -263,7 +262,7 @@ def ZeroAttr : CIR_TypedAttr<"Zero", "zero"> {
263262// UndefAttr
264263//===----------------------------------------------------------------------===//
265264
266- def UndefAttr : CIR_TypedAttr<"Undef", "undef"> {
265+ def CIR_UndefAttr : CIR_TypedAttr<"Undef", "undef"> {
267266 let summary = "Represent an undef constant";
268267 let description = [{
269268 The UndefAttr represents an undef constant, corresponding to LLVM's notion
@@ -275,7 +274,7 @@ def UndefAttr : CIR_TypedAttr<"Undef", "undef"> {
275274// PoisonAttr
276275//===----------------------------------------------------------------------===//
277276
278- def PoisonAttr : CIR_TypedAttr<"Poison", "poison"> {
277+ def CIR_PoisonAttr : CIR_TypedAttr<"Poison", "poison"> {
279278 let summary = "Represent a typed poison constant";
280279 let description = [{
281280 The PoisonAttr represents a typed poison constant, corresponding to LLVM's
@@ -287,7 +286,9 @@ def PoisonAttr : CIR_TypedAttr<"Poison", "poison"> {
287286// ConstArrayAttr
288287//===----------------------------------------------------------------------===//
289288
290- def ConstArrayAttr : CIR_Attr<"ConstArray", "const_array", [TypedAttrInterface]> {
289+ def CIR_ConstArrayAttr : CIR_Attr<"ConstArray", "const_array", [
290+ TypedAttrInterface
291+ ]> {
291292 let summary = "A constant array from ArrayAttr or StringRefAttr";
292293 let description = [{
293294 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]>
333334// ConstVectorAttr
334335//===----------------------------------------------------------------------===//
335336
336- def ConstVectorAttr : CIR_Attr<"ConstVector", "const_vector",
337- [TypedAttrInterface]> {
337+ def CIR_ConstVectorAttr : CIR_Attr<"ConstVector", "const_vector", [
338+ TypedAttrInterface
339+ ]> {
338340 let summary = "A constant vector from ArrayAttr";
339341 let description = [{
340342 A CIR vector attribute is an array of literals of the specified attribute
@@ -364,8 +366,9 @@ def ConstVectorAttr : CIR_Attr<"ConstVector", "const_vector",
364366// ConstRecordAttr
365367//===----------------------------------------------------------------------===//
366368
367- def ConstRecordAttr : CIR_Attr<"ConstRecord", "const_record",
368- [TypedAttrInterface]> {
369+ def CIR_ConstRecordAttr : CIR_Attr<"ConstRecord", "const_record", [
370+ TypedAttrInterface
371+ ]> {
369372 let summary = "Represents a constant record";
370373 let description = [{
371374 Effectively supports "struct-like" constants. It's must be built from
@@ -506,7 +509,7 @@ def CIR_FPAttr : CIR_Attr<"FP", "fp", [TypedAttrInterface]> {
506509// ComplexAttr
507510//===----------------------------------------------------------------------===//
508511
509- def ComplexAttr : CIR_Attr<"Complex", "complex", [TypedAttrInterface]> {
512+ def CIR_ComplexAttr : CIR_Attr<"Complex", "complex", [TypedAttrInterface]> {
510513 let summary = "An attribute that contains a constant complex value";
511514 let description = [{
512515 The `#cir.complex` attribute contains a constant value of complex number
@@ -540,7 +543,7 @@ def ComplexAttr : CIR_Attr<"Complex", "complex", [TypedAttrInterface]> {
540543// ConstPointerAttr
541544//===----------------------------------------------------------------------===//
542545
543- def ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> {
546+ def CIR_ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> {
544547 let summary = "Holds a constant pointer value";
545548 let parameters = (ins
546549 AttributeSelfTypeParameter<"", "::cir::PointerType">:$type,
@@ -575,7 +578,7 @@ def CIR_CmpOrdering : CIR_I32EnumAttr<
575578 let genSpecializedAttr = 0;
576579}
577580
578- def CmpThreeWayInfoAttr : CIR_Attr<"CmpThreeWayInfo", "cmp3way_info"> {
581+ def CIR_CmpThreeWayInfoAttr : CIR_Attr<"CmpThreeWayInfo", "cmp3way_info"> {
579582 let summary = "Holds information about a three-way comparison operation";
580583 let description = [{
581584 The `#cmp3way_info` attribute contains information about a three-way
@@ -629,8 +632,9 @@ def CmpThreeWayInfoAttr : CIR_Attr<"CmpThreeWayInfo", "cmp3way_info"> {
629632// DataMemberAttr
630633//===----------------------------------------------------------------------===//
631634
632- def DataMemberAttr : CIR_Attr<"DataMember", "data_member",
633- [TypedAttrInterface]> {
635+ def CIR_DataMemberAttr : CIR_Attr<"DataMember", "data_member", [
636+ TypedAttrInterface
637+ ]> {
634638 let summary = "Holds a constant data member pointer value";
635639 let parameters = (ins AttributeSelfTypeParameter<
636640 "", "cir::DataMemberType">:$type,
@@ -679,7 +683,7 @@ def DataMemberAttr : CIR_Attr<"DataMember", "data_member",
679683// MethodAttr
680684//===----------------------------------------------------------------------===//
681685
682- def MethodAttr : CIR_Attr<"Method", "method", [TypedAttrInterface]> {
686+ def CIR_MethodAttr : CIR_Attr<"Method", "method", [TypedAttrInterface]> {
683687 let summary = "Holds a constant pointer-to-member-function value";
684688 let description = [{
685689 A method attribute is a literal attribute that represents a constant
@@ -737,7 +741,9 @@ def MethodAttr : CIR_Attr<"Method", "method", [TypedAttrInterface]> {
737741// GlobalViewAttr
738742//===----------------------------------------------------------------------===//
739743
740- def GlobalViewAttr : CIR_Attr<"GlobalView", "global_view", [TypedAttrInterface]> {
744+ def CIR_GlobalViewAttr : CIR_Attr<"GlobalView", "global_view", [
745+ TypedAttrInterface
746+ ]> {
741747 let summary = "Provides constant access to a global address";
742748 let description = [{
743749 Get constant address of global `symbol` and optionally apply offsets to
@@ -820,7 +826,7 @@ def GlobalViewAttr : CIR_Attr<"GlobalView", "global_view", [TypedAttrInterface]>
820826// TypeInfoAttr
821827//===----------------------------------------------------------------------===//
822828
823- def TypeInfoAttr : CIR_Attr<"TypeInfo", "typeinfo", [TypedAttrInterface]> {
829+ def CIR_TypeInfoAttr : CIR_Attr<"TypeInfo", "typeinfo", [TypedAttrInterface]> {
824830 let summary = "Represents a typeinfo used for RTTI";
825831 let description = [{
826832 The typeinfo data for a given class is stored into an ArrayAttr. The
@@ -905,8 +911,7 @@ def VTableAttr : CIR_Attr<"VTable", "vtable", [TypedAttrInterface]> {
905911// DynamicCastInfoAttr
906912//===----------------------------------------------------------------------===//
907913
908- def DynamicCastInfoAttr
909- : CIR_Attr<"DynamicCastInfo", "dyn_cast_info"> {
914+ def CIR_DynamicCastInfoAttr : CIR_Attr<"DynamicCastInfo", "dyn_cast_info"> {
910915 let summary = "ABI specific information about a dynamic cast";
911916 let description = [{
912917 Provide ABI specific information about a dynamic cast operation.
@@ -922,11 +927,13 @@ def DynamicCastInfoAttr
922927 `__dynamic_cast` runtime function.
923928 }];
924929
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+ );
930937
931938 let builders = [
932939 AttrBuilderWithInferredContext<(ins "GlobalViewAttr":$srcRtti,
@@ -1000,8 +1007,8 @@ def CIR_AddressSpaceAttr : CIR_EnumAttr<CIR_AddressSpace, "address_space"> {
10001007// AST Wrappers
10011008//===----------------------------------------------------------------------===//
10021009
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> {
10051012 string clang_name = !strconcat("const clang::", name, " *");
10061013
10071014 let summary = !strconcat("Wraps a '", clang_name, "' AST node.");
@@ -1040,40 +1047,54 @@ class AST<string name, string prefix, list<Trait> traits = []>
10401047 }];
10411048}
10421049
1043- def ASTDeclAttr : AST <"Decl", "decl", [ASTDeclInterface]>;
1050+ def CIR_ASTDeclAttr : CIR_AST <"Decl", "decl", [ASTDeclInterface]>;
10441051
1045- def ASTFunctionDeclAttr : AST<"FunctionDecl", "function.decl",
1046- [ASTFunctionDeclInterface]>;
1052+ def CIR_ASTFunctionDeclAttr : CIR_AST<"FunctionDecl", "function.decl",[
1053+ ASTFunctionDeclInterface
1054+ ]>;
10471055
1048- def ASTCXXMethodDeclAttr : AST<"CXXMethodDecl", "cxxmethod.decl",
1049- [ASTCXXMethodDeclInterface]>;
1056+ def CIR_ASTCXXMethodDeclAttr : CIR_AST<"CXXMethodDecl", "cxxmethod.decl", [
1057+ ASTCXXMethodDeclInterface
1058+ ]>;
10501059
1051- def ASTCXXConstructorDeclAttr : AST<"CXXConstructorDecl",
1052- "cxxconstructor.decl", [ASTCXXConstructorDeclInterface]>;
1060+ def CIR_ASTCXXConstructorDeclAttr
1061+ : CIR_AST<"CXXConstructorDecl","cxxconstructor.decl", [
1062+ ASTCXXConstructorDeclInterface
1063+ ]>;
10531064
1054- def ASTCXXConversionDeclAttr : AST<"CXXConversionDecl",
1055- "cxxconversion.decl", [ASTCXXConversionDeclInterface]>;
1065+ def CIR_ASTCXXConversionDeclAttr
1066+ : CIR_AST<"CXXConversionDecl", "cxxconversion.decl", [
1067+ ASTCXXConversionDeclInterface
1068+ ]>;
10561069
1057- def ASTCXXDestructorDeclAttr : AST<"CXXDestructorDecl",
1058- "cxxdestructor.decl", [ASTCXXDestructorDeclInterface]>;
1070+ def CIR_ASTCXXDestructorDeclAttr
1071+ : CIR_AST<"CXXDestructorDecl", "cxxdestructor.decl", [
1072+ ASTCXXDestructorDeclInterface
1073+ ]>;
10591074
1060- def ASTVarDeclAttr : AST<"VarDecl", "var.decl",
1061- [ASTVarDeclInterface]>;
1075+ def CIR_ASTVarDeclAttr : CIR_AST<"VarDecl", "var.decl", [
1076+ ASTVarDeclInterface
1077+ ]>;
10621078
1063- def ASTTypeDeclAttr: AST<"TypeDecl", "type.decl",
1064- [ASTTypeDeclInterface]>;
1079+ def CIR_ASTTypeDeclAttr : CIR_AST<"TypeDecl", "type.decl", [
1080+ ASTTypeDeclInterface
1081+ ]>;
10651082
1066- def ASTTagDeclAttr : AST<"TagDecl", "tag.decl",
1067- [ASTTagDeclInterface]>;
1083+ def CIR_ASTTagDeclAttr : CIR_AST<"TagDecl", "tag.decl", [
1084+ ASTTagDeclInterface
1085+ ]>;
10681086
1069- def ASTRecordDeclAttr : AST<"RecordDecl", "record.decl",
1070- [ASTRecordDeclInterface]>;
1087+ def CIR_ASTRecordDeclAttr : CIR_AST<"RecordDecl", "record.decl", [
1088+ ASTRecordDeclInterface
1089+ ]>;
10711090
1072- def ASTExprAttr : AST<"Expr", "expr",
1073- [ASTExprInterface]>;
1091+ def CIR_ASTExprAttr : CIR_AST<"Expr", "expr", [
1092+ ASTExprInterface
1093+ ]>;
10741094
1075- def ASTCallExprAttr : AST<"CallExpr", "call.expr",
1076- [ASTCallExprInterface]>;
1095+ def CIR_ASTCallExprAttr : CIR_AST<"CallExpr", "call.expr", [
1096+ ASTCallExprInterface
1097+ ]>;
10771098
10781099
10791100//===----------------------------------------------------------------------===//
@@ -1119,7 +1140,7 @@ def CIR_VisibilityAttr : CIR_EnumAttr<CIR_VisibilityKind, "visibility"> {
11191140// ExtraFuncAttr
11201141//===----------------------------------------------------------------------===//
11211142
1122- def ExtraFuncAttr : CIR_Attr<"ExtraFuncAttributes", "extra"> {
1143+ def CIR_ExtraFuncAttr : CIR_Attr<"ExtraFuncAttributes", "extra"> {
11231144 let summary = "Represents aggregated attributes for a function";
11241145 let description = [{
11251146 This is a wrapper of attribute dictionary that contains extra attributes of
@@ -1135,8 +1156,6 @@ def ExtraFuncAttr : CIR_Attr<"ExtraFuncAttributes", "extra"> {
11351156 ];
11361157
11371158 let assemblyFormat = [{ `(` $elements `)` }];
1138-
1139- // Printing and parsing also available in CIRDialect.cpp
11401159}
11411160
11421161//===----------------------------------------------------------------------===//
@@ -1170,15 +1189,15 @@ def CIR_InlineAttr : CIR_EnumAttr<CIR_InlineKind, "inline"> {
11701189// Unit Function Attributes
11711190//===----------------------------------------------------------------------===//
11721191
1173- def OptNoneAttr : CIRUnitAttr <"OptNone", "optnone"> {
1192+ def CIR_OptNoneAttr : CIR_UnitAttr <"OptNone", "optnone"> {
11741193 let storageType = [{ OptNoneAttr }];
11751194}
11761195
1177- def NoThrowAttr : CIRUnitAttr <"NoThrow", "nothrow"> {
1196+ def CIR_NoThrowAttr : CIR_UnitAttr <"NoThrow", "nothrow"> {
11781197 let storageType = [{ NoThrowAttr }];
11791198}
11801199
1181- def ConvergentAttr : CIRUnitAttr <"Convergent", "convergent"> {
1200+ def CIR_ConvergentAttr : CIR_UnitAttr <"Convergent", "convergent"> {
11821201 let storageType = [{ ConvergentAttr }];
11831202}
11841203
@@ -1236,23 +1255,23 @@ class CIR_GlobalCtorDtor<string name, string attrMnemonic>
12361255 }];
12371256}
12381257
1239- def GlobalCtorAttr : CIR_GlobalCtorDtor<"Ctor", "ctor"> {
1258+ def CIR_GlobalCtorAttr : CIR_GlobalCtorDtor<"Ctor", "ctor"> {
12401259 let summary = "Marks a function as a global constructor";
12411260 let description = [{
12421261 Marks the function as a global constructor in the module's constructor list.
12431262 It will be executed before main() is called.
12441263 }];
12451264}
12461265
1247- def GlobalDtorAttr : CIR_GlobalCtorDtor<"Dtor", "dtor"> {
1266+ def CIR_GlobalDtorAttr : CIR_GlobalCtorDtor<"Dtor", "dtor"> {
12481267 let summary = "Marks a function as a global destructor";
12491268 let description = [{
12501269 Marks a function as a global destructor in the module dtors list.
12511270 The function will be executed before the module unloading.
12521271 }];
12531272}
12541273
1255- def BitfieldInfoAttr : CIR_Attr<"BitfieldInfo", "bitfield_info"> {
1274+ def CIR_BitfieldInfoAttr : CIR_Attr<"BitfieldInfo", "bitfield_info"> {
12561275 let summary = "Represents a bit field info";
12571276 let description = [{
12581277 Holds the next information about bitfields: name, storage type, a bitfield size
@@ -1282,7 +1301,7 @@ def BitfieldInfoAttr : CIR_Attr<"BitfieldInfo", "bitfield_info"> {
12821301// AnnotationAttr
12831302//===----------------------------------------------------------------------===//
12841303
1285- def AnnotationAttr : CIR_Attr<"Annotation", "annotation"> {
1304+ def CIR_AnnotationAttr : CIR_Attr<"Annotation", "annotation"> {
12861305 let summary = "Annotation attribute for global variables and functions";
12871306 let description = [{
12881307 Represent C/C++ attribute of annotate in CIR.
@@ -1321,8 +1340,9 @@ def AnnotationAttr : CIR_Attr<"Annotation", "annotation"> {
13211340// GlobalAnnotationValuesAttr
13221341//===----------------------------------------------------------------------===//
13231342
1324- def GlobalAnnotationValuesAttr : CIR_Attr<"GlobalAnnotationValues",
1325- "global_annotations"> {
1343+ def CIR_GlobalAnnotationValuesAttr : CIR_Attr<"GlobalAnnotationValues",
1344+ "global_annotations"
1345+ > {
13261346 let summary = "Array of annotations, each element consists of name of"
13271347 "a global var or func and one of its annotations";
13281348 let description = [{
@@ -1366,7 +1386,7 @@ def GlobalAnnotationValuesAttr : CIR_Attr<"GlobalAnnotationValues",
13661386// AddressPointAttr
13671387//===----------------------------------------------------------------------===//
13681388
1369- def AddressPointAttr : CIR_Attr<"AddressPoint", "address_point"> {
1389+ def CIR_AddressPointAttr : CIR_Attr<"AddressPoint", "address_point"> {
13701390 let summary = "Address point attribute";
13711391
13721392 let description = [{
@@ -1397,4 +1417,4 @@ include "clang/CIR/Dialect/IR/CIRTBAAAttrs.td"
13971417include "clang/CIR/Dialect/IR/CIROpenCLAttrs.td"
13981418include "clang/CIR/Dialect/IR/CIRCUDAAttrs.td"
13991419
1400- #endif // MLIR_CIR_DIALECT_CIR_ATTRS
1420+ #endif // CLANG_CIR_DIALECT_IR_CIRATTRS_TD
0 commit comments