@@ -270,13 +270,20 @@ def FPAttr : CIR_Attr<"FP", "fp", [TypedAttrInterface]> {
270
270
let summary = "An attribute containing a floating-point value";
271
271
let description = [{
272
272
An fp attribute is a literal attribute that represents a floating-point
273
- value of the specified floating-point type.
273
+ value of the specified floating-point type. Supporting only CIR FP types.
274
274
}];
275
- let parameters = (ins AttributeSelfTypeParameter<"">:$type, "APFloat":$value);
275
+ let parameters = (ins
276
+ AttributeSelfTypeParameter<"", "::mlir::cir::CIRFPTypeInterface">:$type,
277
+ APFloatParameter<"">:$value
278
+ );
276
279
let builders = [
277
280
AttrBuilderWithInferredContext<(ins "Type":$type,
278
281
"const APFloat &":$value), [{
279
- return $_get(type.getContext(), type, value);
282
+ return $_get(type.getContext(), mlir::cast<CIRFPTypeInterface>(type), value);
283
+ }]>,
284
+ AttrBuilder<(ins "Type":$type,
285
+ "const APFloat &":$value), [{
286
+ return $_get($_ctxt, mlir::cast<CIRFPTypeInterface>(type), value);
280
287
}]>,
281
288
];
282
289
let extraClassDeclaration = [{
@@ -304,7 +311,7 @@ def ComplexAttr : CIR_Attr<"Complex", "complex", [TypedAttrInterface]> {
304
311
contains values of the same CIR type.
305
312
}];
306
313
307
- let parameters = (ins
314
+ let parameters = (ins
308
315
AttributeSelfTypeParameter<"", "mlir::cir::ComplexType">:$type,
309
316
"mlir::TypedAttr":$real, "mlir::TypedAttr":$imag);
310
317
@@ -805,7 +812,7 @@ def AddressSpaceAttr : CIR_Attr<"AddressSpace", "addrspace"> {
805
812
let extraClassDeclaration = [{
806
813
static constexpr char kTargetKeyword[] = "}]#targetASCase.symbol#[{";
807
814
static constexpr int32_t kFirstTargetASValue = }]#targetASCase.value#[{;
808
-
815
+
809
816
bool isLang() const;
810
817
bool isTarget() const;
811
818
unsigned getTargetValue() const;
@@ -965,7 +972,7 @@ def ASTCallExprAttr : AST<"CallExpr", "call.expr",
965
972
// VisibilityAttr
966
973
//===----------------------------------------------------------------------===//
967
974
968
- def VK_Default : I32EnumAttrCase<"Default", 1, "default">;
975
+ def VK_Default : I32EnumAttrCase<"Default", 1, "default">;
969
976
def VK_Hidden : I32EnumAttrCase<"Hidden", 2, "hidden">;
970
977
def VK_Protected : I32EnumAttrCase<"Protected", 3, "protected">;
971
978
@@ -998,7 +1005,7 @@ def VisibilityAttr : CIR_Attr<"Visibility", "visibility"> {
998
1005
bool isDefault() const { return getValue() == VisibilityKind::Default; };
999
1006
bool isHidden() const { return getValue() == VisibilityKind::Hidden; };
1000
1007
bool isProtected() const { return getValue() == VisibilityKind::Protected; };
1001
- }];
1008
+ }];
1002
1009
}
1003
1010
1004
1011
@@ -1145,7 +1152,7 @@ def AnnotationAttr : CIR_Attr<"Annotation", "annotation"> {
1145
1152
let parameters = (ins "StringAttr":$name,
1146
1153
"ArrayAttr":$args);
1147
1154
1148
- let assemblyFormat = "`<` struct($name, $args) `>`";
1155
+ let assemblyFormat = "`<` struct($name, $args) `>`";
1149
1156
1150
1157
let extraClassDeclaration = [{
1151
1158
bool isNoArgs() const { return getArgs().empty(); };
@@ -1172,7 +1179,7 @@ def GlobalAnnotationValuesAttr : CIR_Attr<"GlobalAnnotationValues",
1172
1179
void *c __attribute__((annotate("noargvar")));
1173
1180
void foo(int i) __attribute__((annotate("noargfunc"))) {}
1174
1181
```
1175
- After CIR lowering prepare pass, compiler generates a
1182
+ After CIR lowering prepare pass, compiler generates a
1176
1183
`GlobalAnnotationValuesAttr` like the following:
1177
1184
```
1178
1185
#cir<global_annotations [
0 commit comments