[flang-commits] [flang] 31a2ccc - [fir] Clean up InitFIR.h

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Mon Oct 11 06:42:09 PDT 2021


Author: Eric Schweitz
Date: 2021-10-11T15:41:50+02:00
New Revision: 31a2ccc0b54c9f1209d1d6cead792a32715a759c

URL: https://github.com/llvm/llvm-project/commit/31a2ccc0b54c9f1209d1d6cead792a32715a759c
DIFF: https://github.com/llvm/llvm-project/commit/31a2ccc0b54c9f1209d1d6cead792a32715a759c.diff

LOG: [fir] Clean up InitFIR.h

Clean up InitFIR.h file.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D111539

Co-authored-by: Valentin Clement <clementval at gmail.com>

Added: 
    

Modified: 
    flang/include/flang/Optimizer/Support/InitFIR.h
    flang/tools/fir-opt/fir-opt.cpp

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Optimizer/Support/InitFIR.h b/flang/include/flang/Optimizer/Support/InitFIR.h
index a69575a3fd976..534645de5616a 100644
--- a/flang/include/flang/Optimizer/Support/InitFIR.h
+++ b/flang/include/flang/Optimizer/Support/InitFIR.h
@@ -21,17 +21,18 @@
 #include "mlir/Pass/PassRegistry.h"
 #include "mlir/Transforms/LocationSnapshot.h"
 #include "mlir/Transforms/Passes.h"
-#include "flang/Optimizer/CodeGen/CodeGen.h"
 
 namespace fir::support {
 
-// The definitive list of dialects used by flang.
-#define FLANG_DIALECT_LIST                                                     \
-  mlir::AffineDialect, FIROpsDialect, FIRCodeGenDialect,                       \
-      mlir::LLVM::LLVMDialect, mlir::acc::OpenACCDialect,                      \
+#define FLANG_NONCODEGEN_DIALECT_LIST                                          \
+  mlir::AffineDialect, FIROpsDialect, mlir::acc::OpenACCDialect,               \
       mlir::omp::OpenMPDialect, mlir::scf::SCFDialect,                         \
       mlir::StandardOpsDialect, mlir::vector::VectorDialect
 
+// The definitive list of dialects used by flang.
+#define FLANG_DIALECT_LIST                                                     \
+  FLANG_NONCODEGEN_DIALECT_LIST, FIRCodeGenDialect, mlir::LLVM::LLVMDialect
+
 /// Register all the dialects used by flang.
 inline void registerDialects(mlir::DialectRegistry &registry) {
   registry.insert<FLANG_DIALECT_LIST>();
@@ -70,9 +71,6 @@ inline void registerMLIRPassesForFortranTools() {
   mlir::registerAffineDataCopyGenerationPass();
 
   mlir::registerConvertAffineToStandardPass();
-
-  // Flang passes
-  fir::registerOptCodeGenPasses();
 }
 
 } // namespace fir::support

diff  --git a/flang/tools/fir-opt/fir-opt.cpp b/flang/tools/fir-opt/fir-opt.cpp
index 246d5843e9f9c..2a0fb7d99b005 100644
--- a/flang/tools/fir-opt/fir-opt.cpp
+++ b/flang/tools/fir-opt/fir-opt.cpp
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Support/MlirOptMain.h"
+#include "flang/Optimizer/CodeGen/CodeGen.h"
 #include "flang/Optimizer/Support/InitFIR.h"
 #include "flang/Optimizer/Transforms/Passes.h"
 
@@ -19,6 +20,7 @@ using namespace mlir;
 
 int main(int argc, char **argv) {
   fir::support::registerMLIRPassesForFortranTools();
+  fir::registerOptCodeGenPasses();
   fir::registerOptTransformPasses();
   DialectRegistry registry;
   fir::support::registerDialects(registry);


        


More information about the flang-commits mailing list