[flang-commits] [flang] [mlir] [MLIR][LLVMIR][DLTI] Add #llvm.target, #llvm.data_layout and TargetAttrInterface (PR #145899)
Renato Golin via flang-commits
flang-commits at lists.llvm.org
Tue Aug 5 05:37:00 PDT 2025
================
@@ -1304,6 +1305,128 @@ def LLVM_TargetFeaturesAttr : LLVM_Attr<"TargetFeatures", "target_features">
let genVerifyDecl = 1;
}
+//===----------------------------------------------------------------------===//
+// LLVM_TargetAttr
+//===----------------------------------------------------------------------===//
+
+def LLVM_TargetAttr : LLVM_Attr<"Target", "target",
+ [DLTIQueryInterface]> {
+ 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 two are optional.
----------------
rengolin wrote:
Yes, seems we all agree the `chip` part needs to be there, non-empty. Without this, it's really hard to build a reasonable target machine, and LLVM usually has "perfect" knowledge of the target features for its supported targets.
Target features are useful for creating non-standard LLVM configurations OR when LLVM doesn't have "perfect" knowledge of the environment (which can be controlled by external flags like environment variables or wrapper scripts).
https://github.com/llvm/llvm-project/pull/145899
More information about the flang-commits
mailing list