[flang-commits] [flang] [flang][NFCI]Use config structure for MLIR to LLVM pass creation (PR #67792)

Andrzej Warzyński via flang-commits flang-commits at lists.llvm.org
Fri Sep 29 06:55:46 PDT 2023


================
@@ -18,6 +18,21 @@
 
 #include "mlir/Dialect/OpenMP/OpenMPDialect.h"
 #include "mlir/IR/BuiltinOps.h"
+#include "llvm/Frontend/Debug/Options.h"
+#include "llvm/Passes/OptimizationLevel.h"
+
+/// Configuriation for the MLIR to LLVM pass pipeline.
+struct MLIRToLLVMPassPipelineConfig {
+  explicit MLIRToLLVMPassPipelineConfig(llvm::OptimizationLevel level) {
+    OptLevel = level;
+  }
+  llvm::OptimizationLevel OptLevel; ///< optimisation level
+  bool StackArrays = false; ///< convert memory allocations to alloca.
+  bool Underscoring = true; ///< add underscores to function names.
+  bool LoopVersioning = false; ///< Run the version loop pass.
+  llvm::codegenoptions::DebugInfoKind DebugInfo =
+      llvm::codegenoptions::NoDebugInfo; ///< Debug info generation.
+};
 
----------------
banach-space wrote:

Ideally you'd re-use https://github.com/llvm/llvm-project/blob/c4e2fcff788025415b523486efdbdac4f2b08c1e/flang/include/flang/Frontend/CodeGenOptions.def for this. But perhaps that would be too much refactoring 🤔 .

https://github.com/llvm/llvm-project/pull/67792


More information about the flang-commits mailing list