[flang-commits] [flang] [flang][Multi-Image] Moving Mutli-image lowering to PRIF into the MIF dialect (PR #161179)
via flang-commits
flang-commits at lists.llvm.org
Mon Sep 29 07:34:22 PDT 2025
================
@@ -0,0 +1,41 @@
+//===------- Optimizer/Transforms/MIFOpToLLVMConversion.h -------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef FORTRAN_OPTIMIZER_TRANSFORMS_MIFOPCONVERSION_H_
+#define FORTRAN_OPTIMIZER_TRANSFORMS_MIFOPCONVERSION_H_
+
+#include "flang/Optimizer/Support/InternalNames.h"
+#include "mlir/Conversion/LLVMCommon/Pattern.h"
+#include "mlir/Pass/Pass.h"
+#include "mlir/Pass/PassRegistry.h"
+
+namespace fir {
+class LLVMTypeConverter;
+}
+
+namespace mif {
+
+// Default prefix for subroutines of PRIF compiled with LLVM
+#define PRIFNAME_SUB(fmt) \
+ []() { \
+ std::ostringstream oss; \
+ oss << "prif_" << fmt; \
+ return fir::NameUniquer::doProcedure({"prif"}, {}, oss.str()); \
+ }()
+
+#define PRIF_STAT_TYPE builder.getRefType(builder.getI32Type())
+#define PRIF_ERRMSG_TYPE \
----------------
jeanPerier wrote:
nit: I would suggest making builder an argument of these macros, otherwise they look like compile time constants/globals where used. Plus one may want to used them without having the rewriter called builder in their code.
Taking a step back I do not fully see the need of making PRIFNAME_SUB/PRIF_STAT_TYPE/PRIF_ERRMSG_TYPE public macros. They seemed to only be used in one .cpp file and could just be static functions there.
https://github.com/llvm/llvm-project/pull/161179
More information about the flang-commits
mailing list