[Mlir-commits] [flang] [mlir] [MLIR][LLVMIR][DLTI] Add #llvm.target, #llvm.data_layout and TargetAttrInterface (PR #145899)
Rolf Morel
llvmlistbot at llvm.org
Fri Jul 25 11:10:56 PDT 2025
================
@@ -0,0 +1,61 @@
+//===- DataLayoutFromTarget.cpp - extract data layout from TargetMachine --===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Dialect/DLTI/DLTI.h"
+#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+namespace LLVM {
+#define GEN_PASS_DEF_LLVMDATALAYOUTFROMTARGET
+#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
+} // namespace LLVM
+} // namespace mlir
+
+using namespace mlir;
+
+struct DataLayoutFromTargetPass
+ : public LLVM::impl::LLVMDataLayoutFromTargetBase<
+ DataLayoutFromTargetPass> {
+ void runOnOperation() override {
+ ModuleOp mod = getOperation();
+
+ bool passFailed = false;
+
+ mod->walk([&](ModuleOp mod) {
----------------
rolfmorel wrote:
Fair. Should it be `Operation` as that's the only common ancestor between `builtin::ModuleOp` and `gpu::ModuleOp`?
https://github.com/llvm/llvm-project/pull/145899
More information about the Mlir-commits
mailing list