@@ -285,13 +285,20 @@ def FPAttr : CIR_Attr<"FP", "fp", [TypedAttrInterface]> {
285
285
let summary = "An attribute containing a floating-point value";
286
286
let description = [{
287
287
An fp attribute is a literal attribute that represents a floating-point
288
- value of the specified floating-point type.
288
+ value of the specified floating-point type. Supporting only CIR FP types.
289
289
}];
290
- let parameters = (ins AttributeSelfTypeParameter<"">:$type, "APFloat":$value);
290
+ let parameters = (ins
291
+ AttributeSelfTypeParameter<"", "::mlir::cir::CIRFPTypeInterface">:$type,
292
+ APFloatParameter<"">:$value
293
+ );
291
294
let builders = [
292
295
AttrBuilderWithInferredContext<(ins "Type":$type,
293
296
"const APFloat &":$value), [{
294
- return $_get(type.getContext(), type, value);
297
+ return $_get(type.getContext(), mlir::cast<CIRFPTypeInterface>(type), value);
298
+ }]>,
299
+ AttrBuilder<(ins "Type":$type,
300
+ "const APFloat &":$value), [{
301
+ return $_get($_ctxt, mlir::cast<CIRFPTypeInterface>(type), value);
295
302
}]>,
296
303
];
297
304
let extraClassDeclaration = [{
@@ -319,7 +326,7 @@ def ComplexAttr : CIR_Attr<"Complex", "complex", [TypedAttrInterface]> {
319
326
contains values of the same CIR type.
320
327
}];
321
328
322
- let parameters = (ins
329
+ let parameters = (ins
323
330
AttributeSelfTypeParameter<"", "mlir::cir::ComplexType">:$type,
324
331
"mlir::TypedAttr":$real, "mlir::TypedAttr":$imag);
325
332
@@ -820,7 +827,7 @@ def AddressSpaceAttr : CIR_Attr<"AddressSpace", "addrspace"> {
820
827
let extraClassDeclaration = [{
821
828
static constexpr char kTargetKeyword[] = "}]#targetASCase.symbol#[{";
822
829
static constexpr int32_t kFirstTargetASValue = }]#targetASCase.value#[{;
823
-
830
+
824
831
bool isLang() const;
825
832
bool isTarget() const;
826
833
unsigned getTargetValue() const;
@@ -980,7 +987,7 @@ def ASTCallExprAttr : AST<"CallExpr", "call.expr",
980
987
// VisibilityAttr
981
988
//===----------------------------------------------------------------------===//
982
989
983
- def VK_Default : I32EnumAttrCase<"Default", 1, "default">;
990
+ def VK_Default : I32EnumAttrCase<"Default", 1, "default">;
984
991
def VK_Hidden : I32EnumAttrCase<"Hidden", 2, "hidden">;
985
992
def VK_Protected : I32EnumAttrCase<"Protected", 3, "protected">;
986
993
@@ -1013,7 +1020,7 @@ def VisibilityAttr : CIR_Attr<"Visibility", "visibility"> {
1013
1020
bool isDefault() const { return getValue() == VisibilityKind::Default; };
1014
1021
bool isHidden() const { return getValue() == VisibilityKind::Hidden; };
1015
1022
bool isProtected() const { return getValue() == VisibilityKind::Protected; };
1016
- }];
1023
+ }];
1017
1024
}
1018
1025
1019
1026
@@ -1160,7 +1167,7 @@ def AnnotationAttr : CIR_Attr<"Annotation", "annotation"> {
1160
1167
let parameters = (ins "StringAttr":$name,
1161
1168
"ArrayAttr":$args);
1162
1169
1163
- let assemblyFormat = "`<` struct($name, $args) `>`";
1170
+ let assemblyFormat = "`<` struct($name, $args) `>`";
1164
1171
1165
1172
let extraClassDeclaration = [{
1166
1173
bool isNoArgs() const { return getArgs().empty(); };
@@ -1187,7 +1194,7 @@ def GlobalAnnotationValuesAttr : CIR_Attr<"GlobalAnnotationValues",
1187
1194
void *c __attribute__((annotate("noargvar")));
1188
1195
void foo(int i) __attribute__((annotate("noargfunc"))) {}
1189
1196
```
1190
- After CIR lowering prepare pass, compiler generates a
1197
+ After CIR lowering prepare pass, compiler generates a
1191
1198
`GlobalAnnotationValuesAttr` like the following:
1192
1199
```
1193
1200
#cir<global_annotations [
0 commit comments