@@ -1243,70 +1243,7 @@ def LLVM_VScaleRangeAttr : LLVM_Attr<"VScaleRange", "vscale_range"> {
12431243}
12441244
12451245//===----------------------------------------------------------------------===//
1246- // TargetFeaturesAttr
1247- //===----------------------------------------------------------------------===//
1248-
1249- def LLVM_TargetFeaturesAttr : LLVM_Attr<"TargetFeatures", "target_features">
1250- {
1251- let summary = "LLVM target features attribute";
1252-
1253- let description = [{
1254- Represents the LLVM target features as a list that can be checked within
1255- passes/rewrites.
1256-
1257- Example:
1258- ```mlir
1259- #llvm.target_features<["+sme", "+sve", "+sme-f64f64"]>
1260- ```
1261-
1262- Then within a pass or rewrite the features active at an op can be queried:
1263-
1264- ```c++
1265- auto targetFeatures = LLVM::TargetFeaturesAttr::featuresAt(op);
1266-
1267- if (!targetFeatures.contains("+sme-f64f64"))
1268- return failure();
1269- ```
1270- }];
1271-
1272- let parameters = (ins OptionalArrayRefParameter<"StringAttr">:$features);
1273-
1274- let builders = [
1275- TypeBuilder<(ins "::llvm::StringRef":$features)>,
1276- TypeBuilder<(ins "::llvm::ArrayRef<::llvm::StringRef>":$features)>
1277- ];
1278-
1279- let extraClassDeclaration = [{
1280- /// Checks if a feature is contained within the features list.
1281- /// Note: Using a StringAttr allows doing pointer-comparisons.
1282- bool contains(::mlir::StringAttr feature) const;
1283- bool contains(::llvm::StringRef feature) const;
1284-
1285- bool nullOrEmpty() const {
1286- // Checks if this attribute is null, or the features are empty.
1287- return !bool(*this) || getFeatures().empty();
1288- }
1289-
1290- /// Returns the list of features as an LLVM-compatible string.
1291- std::string getFeaturesString() const;
1292-
1293- /// Finds the target features on the parent FunctionOpInterface.
1294- /// Note: This assumes the attribute name matches the return value of
1295- /// `getAttributeName()`.
1296- static TargetFeaturesAttr featuresAt(Operation* op);
1297-
1298- /// Canonical name for this attribute within MLIR.
1299- static constexpr StringLiteral getAttributeName() {
1300- return StringLiteral("target_features");
1301- }
1302- }];
1303-
1304- let assemblyFormat = "`<` `[` (`]`) : ($features^ `]`)? `>`";
1305- let genVerifyDecl = 1;
1306- }
1307-
1308- //===----------------------------------------------------------------------===//
1309- // LLVM_TargetAttr
1246+ // TargetAttr
13101247//===----------------------------------------------------------------------===//
13111248
13121249def LLVM_TargetAttr : LLVM_Attr<"Target", "target",
@@ -1324,7 +1261,7 @@ def LLVM_TargetAttr : LLVM_Attr<"Target", "target",
13241261 }];
13251262 let parameters = (ins "StringAttr":$triple,
13261263 "StringAttr":$chip,
1327- OptionalParameter<"StringAttr ", "">:$features);
1264+ OptionalParameter<"TargetFeaturesAttr ", "">:$features);
13281265
13291266 let assemblyFormat = [{`<` struct($triple, $chip, $features) `>`}];
13301267
0 commit comments