[flang-commits] [flang] [mlir] [MLIR][LLVMIR][DLTI] Add `LLVM::TargetAttrInterface` and `#llvm.target` attr (PR #145899)
Fabian Mora via flang-commits
flang-commits at lists.llvm.org
Tue Aug 19 09:13:19 PDT 2025
================
@@ -1304,6 +1305,38 @@ def LLVM_TargetFeaturesAttr : LLVM_Attr<"TargetFeatures", "target_features">
let genVerifyDecl = 1;
}
+//===----------------------------------------------------------------------===//
+// LLVM_TargetAttr
+//===----------------------------------------------------------------------===//
+
+def LLVM_TargetAttr : LLVM_Attr<"Target", "target",
+ [LLVM_TargetAttrInterface]> {
+ let summary = "LLVM target info: triple, chip, features";
+ let description = [{
+ An attribute to hold LLVM target information, specifying LLVM's target
+ `triple` string, the target `chip` string (i.e. the `cpu` string), and
+ target `features` string as an attribute. The latter is optional.
+
+ Responds to DLTI-queries on the keys:
+ * A query for `"triple"` returns the `StringAttr` for the `triple`.
+ * A query for `"chip"` returns the `StringAttr` for the `chip`/`cpu`.
+ * A query for `"features"` returns the `StringAttr`, if provided.
+ }];
+ let parameters = (ins "StringAttr":$triple,
+ "StringAttr":$chip,
+ OptionalParameter<"StringAttr", "">:$features);
----------------
fabianmcg wrote:
Optional NIT: use `triple_attr`. `chip_attr`, `features_attr` and remove the redundant getter methods. Or change the getter methods in the interface? Preferably the first option.
https://github.com/llvm/llvm-project/pull/145899
More information about the flang-commits
mailing list