From: Valentin Clement Date: Tue, 5 Oct 2021 09:00:46 +0000 (+0200) Subject: [fir] Split FIROptimizer lib into several smaller libraries X-Git-Tag: upstream/15.0.7~29639 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c02a8cdda8733aac26481b6819a4eef000ee91c8;p=platform%2Fupstream%2Fllvm.git [fir] Split FIROptimizer lib into several smaller libraries Partition libFIROptimizer into smaller libraries that reflect the structure. Adapt potential problems. This patch is part of the upstreaming effort from fir-dev branch. It's a building stone to upstreaming transformations. Reviewed By: schweitz Differential Revision: https://reviews.llvm.org/D111055 Co-authored-by: Eric Schweitz --- diff --git a/flang/lib/Lower/CMakeLists.txt b/flang/lib/Lower/CMakeLists.txt index 07b87ef..27e54d4 100644 --- a/flang/lib/Lower/CMakeLists.txt +++ b/flang/lib/Lower/CMakeLists.txt @@ -17,11 +17,15 @@ add_flang_library(FortranLower PFTBuilder.cpp DEPENDS - FIROptimizer + FIRDialect + FIRSupport + FIRTransforms ${dialect_libs} LINK_LIBS - FIROptimizer + FIRDialect + FIRSupport + FIRTransforms ${dialect_libs} FortranCommon FortranParser diff --git a/flang/lib/Optimizer/CMakeLists.txt b/flang/lib/Optimizer/CMakeLists.txt index b83d6a0..4b37a18 100644 --- a/flang/lib/Optimizer/CMakeLists.txt +++ b/flang/lib/Optimizer/CMakeLists.txt @@ -1,34 +1,4 @@ -get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) - -add_flang_library(FIROptimizer - Dialect/FIRAttr.cpp - Dialect/FIRDialect.cpp - Dialect/FIROps.cpp - Dialect/FIRType.cpp - - Support/FIRContext.cpp - Support/InternalNames.cpp - Support/KindMapping.cpp - - CodeGen/CGOps.cpp - CodeGen/PreCGRewrite.cpp - - Transforms/Inliner.cpp - - DEPENDS - FIROpsIncGen - FIROptCodeGenPassIncGen - FIROptTransformsPassIncGen - CGOpsIncGen - ${dialect_libs} - - LINK_LIBS - ${dialect_libs} - MLIRLLVMToLLVMIRTranslation - MLIRTargetLLVMIRExport - - LINK_COMPONENTS - AsmParser - AsmPrinter - Remarks -) +add_subdirectory(CodeGen) +add_subdirectory(Dialect) +add_subdirectory(Support) +add_subdirectory(Transforms) diff --git a/flang/lib/Optimizer/CodeGen/CMakeLists.txt b/flang/lib/Optimizer/CodeGen/CMakeLists.txt new file mode 100644 index 0000000..6a8d82c --- /dev/null +++ b/flang/lib/Optimizer/CodeGen/CMakeLists.txt @@ -0,0 +1,22 @@ +add_flang_library(FIRCodeGen + CGOps.cpp + PreCGRewrite.cpp + + DEPENDS + FIRDialect + FIRSupport + FIROptCodeGenPassIncGen + CGOpsIncGen + + LINK_LIBS + FIRDialect + FIRSupport + MLIROpenMPToLLVM + MLIRLLVMToLLVMIRTranslation + MLIRTargetLLVMIRExport + + LINK_COMPONENTS + AsmParser + AsmPrinter + Remarks +) diff --git a/flang/lib/Optimizer/Dialect/CMakeLists.txt b/flang/lib/Optimizer/Dialect/CMakeLists.txt new file mode 100644 index 0000000..7116dab --- /dev/null +++ b/flang/lib/Optimizer/Dialect/CMakeLists.txt @@ -0,0 +1,21 @@ +add_flang_library(FIRDialect + FIRAttr.cpp + FIRDialect.cpp + FIROps.cpp + FIRType.cpp + + DEPENDS + FIRSupport + FIROpsIncGen + + LINK_LIBS + FIRSupport + MLIROpenMPToLLVM + MLIRLLVMToLLVMIRTranslation + MLIRTargetLLVMIRExport + + LINK_COMPONENTS + AsmParser + AsmPrinter + Remarks +) diff --git a/flang/lib/Optimizer/Support/CMakeLists.txt b/flang/lib/Optimizer/Support/CMakeLists.txt new file mode 100644 index 0000000..46fe7aa --- /dev/null +++ b/flang/lib/Optimizer/Support/CMakeLists.txt @@ -0,0 +1,15 @@ +add_flang_library(FIRSupport + FIRContext.cpp + InternalNames.cpp + KindMapping.cpp + + DEPENDS + ${dialect_libs} + MLIRIR + + LINK_LIBS + ${dialect_libs} + MLIROpenMPToLLVMIRTranslation + MLIRLLVMToLLVMIRTranslation + MLIRTargetLLVMIRExport +) diff --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt b/flang/lib/Optimizer/Transforms/CMakeLists.txt new file mode 100644 index 0000000..462ae40 --- /dev/null +++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt @@ -0,0 +1,16 @@ +add_flang_library(FIRTransforms + Inliner.cpp + + DEPENDS + FIRDialect + FIRSupport + FIROptTransformsPassIncGen + + LINK_LIBS + FIRDialect + MLIRAffineToStandard + MLIRLLVMIR + MLIROpenACC + MLIROpenMP + FIRSupport +) diff --git a/flang/tools/fir-opt/CMakeLists.txt b/flang/tools/fir-opt/CMakeLists.txt index efd33f9..566aa78 100644 --- a/flang/tools/fir-opt/CMakeLists.txt +++ b/flang/tools/fir-opt/CMakeLists.txt @@ -3,7 +3,10 @@ llvm_update_compile_flags(fir-opt) get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) target_link_libraries(fir-opt PRIVATE - FIROptimizer + FIRDialect + FIRSupport + FIRTransforms + FIRCodeGen ${dialect_libs} # TODO: these should be transitive dependencies from a target providing diff --git a/flang/tools/tco/CMakeLists.txt b/flang/tools/tco/CMakeLists.txt index 4a22427..1a9c5ac 100644 --- a/flang/tools/tco/CMakeLists.txt +++ b/flang/tools/tco/CMakeLists.txt @@ -1,7 +1,10 @@ get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) set(LIBS - FIROptimizer + FIRCodeGen + FIRDialect + FIRSupport + FIRTransforms ${dialect_libs} MLIRIR MLIRLLVMIR diff --git a/flang/unittests/CMakeLists.txt b/flang/unittests/CMakeLists.txt index 95e3f6d..5acebce 100644 --- a/flang/unittests/CMakeLists.txt +++ b/flang/unittests/CMakeLists.txt @@ -39,6 +39,5 @@ endfunction() add_subdirectory(Optimizer) add_subdirectory(Decimal) add_subdirectory(Evaluate) -add_subdirectory(Lower) add_subdirectory(Runtime) add_subdirectory(Frontend) diff --git a/flang/unittests/Lower/CMakeLists.txt b/flang/unittests/Lower/CMakeLists.txt deleted file mode 100644 index a3f61f0..0000000 --- a/flang/unittests/Lower/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) - -set(LIBS - FIROptimizer - MLIRLLVMIR - ${dialect_libs} -) - -add_flang_unittest(FlangLoweringTests - RTBuilder.cpp -) - -target_link_libraries(FlangLoweringTests - PRIVATE - ${LIBS}) diff --git a/flang/unittests/Optimizer/CMakeLists.txt b/flang/unittests/Optimizer/CMakeLists.txt index 3996c69..8bfb860 100644 --- a/flang/unittests/Optimizer/CMakeLists.txt +++ b/flang/unittests/Optimizer/CMakeLists.txt @@ -1,7 +1,9 @@ get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) set(LIBS - FIROptimizer + FIRCodeGen + FIRDialect + FIRSupport ${dialect_libs} ) @@ -9,6 +11,7 @@ add_flang_unittest(FlangOptimizerTests FIRContextTest.cpp InternalNamesTest.cpp KindMappingTest.cpp + RTBuilder.cpp ) target_link_libraries(FlangOptimizerTests PRIVATE diff --git a/flang/unittests/Lower/RTBuilder.cpp b/flang/unittests/Optimizer/RTBuilder.cpp similarity index 100% rename from flang/unittests/Lower/RTBuilder.cpp rename to flang/unittests/Optimizer/RTBuilder.cpp