@@ -48,6 +48,7 @@ void LLVMDialect::registerAttributes() {
48
48
addAttributes<
49
49
#define GET_ATTRDEF_LIST
50
50
#include " mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
51
+
51
52
>();
52
53
}
53
54
@@ -288,6 +289,16 @@ TargetFeaturesAttr TargetFeaturesAttr::get(MLIRContext *context,
288
289
}));
289
290
}
290
291
292
+ TargetFeaturesAttr
293
+ TargetFeaturesAttr::getChecked (function_ref<InFlightDiagnostic()> emitError,
294
+ MLIRContext *context,
295
+ llvm::ArrayRef<StringRef> features) {
296
+ return Base::getChecked (emitError, context,
297
+ llvm::map_to_vector (features, [&](StringRef feature) {
298
+ return StringAttr::get (context, feature);
299
+ }));
300
+ }
301
+
291
302
TargetFeaturesAttr TargetFeaturesAttr::get (MLIRContext *context,
292
303
StringRef targetFeatures) {
293
304
SmallVector<StringRef> features;
@@ -296,6 +307,16 @@ TargetFeaturesAttr TargetFeaturesAttr::get(MLIRContext *context,
296
307
return get (context, features);
297
308
}
298
309
310
+ TargetFeaturesAttr
311
+ TargetFeaturesAttr::getChecked (function_ref<InFlightDiagnostic()> emitError,
312
+ MLIRContext *context, StringRef targetFeatures) {
313
+ SmallVector<StringRef> features;
314
+ targetFeatures.split (features, ' ,' , /* MaxSplit=*/ -1 ,
315
+ /* KeepEmpty=*/ false );
316
+ ArrayRef featuresRef (features);
317
+ return getChecked (emitError, context, featuresRef);
318
+ }
319
+
299
320
LogicalResult
300
321
TargetFeaturesAttr::verify (function_ref<InFlightDiagnostic()> emitError,
301
322
llvm::ArrayRef<StringAttr> features) {
0 commit comments