[Mlir-commits] [mlir] [MLIR][LLVMIR][DLTI] Add #llvm.target, #llvm.data_layout and TargetAttrInterface (PR #145899)
Rolf Morel
llvmlistbot at llvm.org
Thu Jun 26 08:50:36 PDT 2025
================
@@ -13,13 +13,118 @@ include "mlir/Dialect/LLVMIR/LLVMDialect.td"
include "mlir/Dialect/LLVMIR/LLVMInterfaces.td"
include "mlir/IR/AttrTypeBase.td"
include "mlir/IR/CommonAttrConstraints.td"
+include "mlir/Interfaces/DataLayoutInterfaces.td"
-// All of the attributes will extend this class.
-class LLVM_Attr<string name, string attrMnemonic,
- list<Trait> traits = [],
- string baseCppClass = "::mlir::Attribute">
- : AttrDef<LLVM_Dialect, name, traits, baseCppClass> {
- let mnemonic = attrMnemonic;
+//===----------------------------------------------------------------------===//
+// LLVM_TargetAttr
+//===----------------------------------------------------------------------===//
+
+def LLVM_TargetAttr : LLVM_Attr<"Target", "target", [LLVM_TargetAttrInterface]> {
----------------
rolfmorel wrote:
@rengolin, I am not sure what we want to do for verification here. Do we want to insist on the specified `triple`, `cpu`, and `target_features` being valid together. And do we verify that through constructing the relevant `TargetMachine`?
How would that work for dealing with IR which is annotated with a `#llvm.target` specifying a target that your current `llvm-project` isn't built with. It is right that verification fails in that case? (Maybe it is, but it feels wrong as now verification succeeding or failing becomes a function of whether you built with the right flags.)
https://github.com/llvm/llvm-project/pull/145899
More information about the Mlir-commits
mailing list