Skip to content

Commit 4869052

Browse files
committed
[CIR] Reformat Attr to use common CIR_ prefix and traits style
This mirror incubator changes from llvm/clangir#1746
1 parent 057b1c2 commit 4869052

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

clang/include/clang/CIR/Dialect/IR/CIRAttrs.td

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CIR_TypedAttr<string name, string attrMnemonic, list<Trait> traits = []>
4242
let assemblyFormat = [{}];
4343
}
4444

45-
class CIRUnitAttr<string name, string attrMnemonic, list<Trait> traits = []>
45+
class CIR_UnitAttr<string name, string attrMnemonic, list<Trait> traits = []>
4646
: CIR_Attr<name, attrMnemonic, traits> {
4747
let returnType = "bool";
4848
let defaultValue = "false";
@@ -127,7 +127,7 @@ def CIR_BoolAttr : CIR_Attr<"Bool", "bool", [TypedAttrInterface]> {
127127
// ZeroAttr
128128
//===----------------------------------------------------------------------===//
129129

130-
def ZeroAttr : CIR_TypedAttr<"Zero", "zero"> {
130+
def CIR_ZeroAttr : CIR_TypedAttr<"Zero", "zero"> {
131131
let summary = "Attribute to represent zero initialization";
132132
let description = [{
133133
The ZeroAttr is used to indicate zero initialization on structs.
@@ -138,7 +138,7 @@ def ZeroAttr : CIR_TypedAttr<"Zero", "zero"> {
138138
// UndefAttr
139139
//===----------------------------------------------------------------------===//
140140

141-
def UndefAttr : CIR_TypedAttr<"Undef", "undef"> {
141+
def CIR_UndefAttr : CIR_TypedAttr<"Undef", "undef"> {
142142
let summary = "Represent an undef constant";
143143
let description = [{
144144
The UndefAttr represents an undef constant, corresponding to LLVM's notion
@@ -252,7 +252,9 @@ def CIR_FPAttr : CIR_Attr<"FP", "fp", [TypedAttrInterface]> {
252252
// ConstArrayAttr
253253
//===----------------------------------------------------------------------===//
254254

255-
def ConstArrayAttr : CIR_Attr<"ConstArray", "const_array", [TypedAttrInterface]> {
255+
def CIR_ConstArrayAttr : CIR_Attr<"ConstArray", "const_array", [
256+
TypedAttrInterface
257+
]> {
256258
let summary = "A constant array from ArrayAttr or StringRefAttr";
257259
let description = [{
258260
An CIR array attribute is an array of literals of the specified attr types.
@@ -298,8 +300,9 @@ def ConstArrayAttr : CIR_Attr<"ConstArray", "const_array", [TypedAttrInterface]>
298300
// ConstVectorAttr
299301
//===----------------------------------------------------------------------===//
300302

301-
def ConstVectorAttr : CIR_Attr<"ConstVector", "const_vector",
302-
[TypedAttrInterface]> {
303+
def CIR_ConstVectorAttr : CIR_Attr<"ConstVector", "const_vector", [
304+
TypedAttrInterface
305+
]> {
303306
let summary = "A constant vector from ArrayAttr";
304307
let description = [{
305308
A CIR vector attribute is an array of literals of the specified attribute
@@ -330,7 +333,7 @@ def ConstVectorAttr : CIR_Attr<"ConstVector", "const_vector",
330333
// ConstPtrAttr
331334
//===----------------------------------------------------------------------===//
332335

333-
def ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> {
336+
def CIR_ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> {
334337
let summary = "Holds a constant pointer value";
335338
let parameters = (ins
336339
AttributeSelfTypeParameter<"", "::cir::PointerType">:$type,
@@ -359,8 +362,9 @@ def ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> {
359362
// ConstComplexAttr
360363
//===----------------------------------------------------------------------===//
361364

362-
def ConstComplexAttr : CIR_Attr<"ConstComplex", "const_complex",
363-
[TypedAttrInterface]> {
365+
def CIR_ConstComplexAttr : CIR_Attr<"ConstComplex", "const_complex", [
366+
TypedAttrInterface
367+
]> {
364368
let summary = "An attribute that contains a constant complex value";
365369
let description = [{
366370
The `#cir.const_complex` attribute contains a constant value of complex
@@ -442,7 +446,7 @@ def CIR_VisibilityAttr : CIR_EnumAttr<CIR_VisibilityKind, "visibility"> {
442446
// BitfieldInfoAttr
443447
//===----------------------------------------------------------------------===//
444448

445-
def BitfieldInfoAttr : CIR_Attr<"BitfieldInfo", "bitfield_info"> {
449+
def CIR_BitfieldInfoAttr : CIR_Attr<"BitfieldInfo", "bitfield_info"> {
446450
let summary = "Represents info for a bit-field member";
447451
let description = [{
448452
Holds the following information about bitfields: name, storage type, size
@@ -500,5 +504,4 @@ def BitfieldInfoAttr : CIR_Attr<"BitfieldInfo", "bitfield_info"> {
500504
];
501505
}
502506

503-
504507
#endif // CLANG_CIR_DIALECT_IR_CIRATTRS_TD

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,7 @@ def CIR_SetBitfieldOp : CIR_Op<"set_bitfield"> {
17471747
let arguments = (ins
17481748
Arg<CIR_PointerType, "the address to store the value", [MemWrite]>:$addr,
17491749
CIR_AnyType:$src,
1750-
BitfieldInfoAttr:$bitfield_info,
1750+
CIR_BitfieldInfoAttr:$bitfield_info,
17511751
DefaultValuedOptionalAttr<I64Attr, "0">:$alignment,
17521752
UnitAttr:$is_volatile
17531753
);
@@ -1834,7 +1834,7 @@ def CIR_GetBitfieldOp : CIR_Op<"get_bitfield"> {
18341834

18351835
let arguments = (ins
18361836
Arg<CIR_PointerType, "the address to load from", [MemRead]>:$addr,
1837-
BitfieldInfoAttr:$bitfield_info,
1837+
CIR_BitfieldInfoAttr:$bitfield_info,
18381838
DefaultValuedOptionalAttr<I64Attr, "0">:$alignment,
18391839
UnitAttr:$is_volatile
18401840
);

0 commit comments

Comments
 (0)