From 23f16b1ceb332849e0817a07c328cc59abd01132 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Mon, 3 Mar 2014 19:30:19 +0000 Subject: [PATCH] cmake: build monolithic libLLVMPollyLib.dylib The module LLVMPolly.so links to that. There is really no reason to build a large number of mini-libraries here, especially as we do have dependences between the libraries that are not properly handled and that make linking fail on darwin. Submitted-by: David Fang llvm-svn: 202743 --- polly/cmake/polly_macros.cmake | 11 +++++ polly/lib/Analysis/CMakeLists.txt | 8 ---- polly/lib/CMakeLists.txt | 90 ++++++++++++++++++++++++++++----------- polly/lib/CodeGen/CMakeLists.txt | 23 ---------- polly/lib/Exchange/CMakeLists.txt | 20 --------- polly/lib/JSON/CMakeLists.txt | 6 --- polly/lib/Support/CMakeLists.txt | 5 --- 7 files changed, 76 insertions(+), 87 deletions(-) delete mode 100644 polly/lib/Analysis/CMakeLists.txt delete mode 100644 polly/lib/CodeGen/CMakeLists.txt delete mode 100644 polly/lib/Exchange/CMakeLists.txt delete mode 100644 polly/lib/JSON/CMakeLists.txt delete mode 100644 polly/lib/Support/CMakeLists.txt diff --git a/polly/cmake/polly_macros.cmake b/polly/cmake/polly_macros.cmake index 4171697..36a16a2 100644 --- a/polly/cmake/polly_macros.cmake +++ b/polly/cmake/polly_macros.cmake @@ -58,7 +58,18 @@ endmacro(add_polly_library) macro(add_polly_loadable_module name) set(srcs ${ARGN}) + # klduge: pass different values for MODULE with multiple targets in same dir + # this allows building shared-lib and module in same dir + # there must be a cleaner way to achieve this.... + if (MODULE) + else() + set(GLOBAL_NOT_MODULE TRUE) + endif() + set(MODULE TRUE) add_polly_library(${name} ${srcs}) + if (GLOBAL_NOT_MODULE) + unset (MODULE) + endif() if (APPLE) # Darwin-specific linker flags for loadable modules. set_target_properties(${name} PROPERTIES diff --git a/polly/lib/Analysis/CMakeLists.txt b/polly/lib/Analysis/CMakeLists.txt deleted file mode 100644 index f7a27d1..0000000 --- a/polly/lib/Analysis/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -add_polly_library(LLVMPollyAnalysis - Dependences.cpp - ScopDetection.cpp - ScopInfo.cpp - ScopGraphPrinter.cpp - ScopPass.cpp - TempScopInfo.cpp -) diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt index dba1b85..3f7acee 100644 --- a/polly/lib/CMakeLists.txt +++ b/polly/lib/CMakeLists.txt @@ -1,29 +1,66 @@ -add_subdirectory(Analysis) -add_subdirectory(CodeGen) -add_subdirectory(Exchange) -add_subdirectory(Support) -add_subdirectory(JSON) +# build a monolithic libLLVMPollyLib.$shlibext +# and a thin module LLVMPolly.moduleext that links to that shared library -set(MODULE TRUE) set(LLVM_NO_RTTI 1) -if (SCOPLIB_FOUND) - set(POLLY_SCOPLIB_FILES Pocc.cpp) -endif (SCOPLIB_FOUND) - if (PLUTO_FOUND) set(POLLY_PLUTO_FILES Pluto.cpp) endif (PLUTO_FOUND) -set(LLVM_USED_LIBS - LLVMPollyAnalysis - LLVMPollyCodeGen - LLVMPollyExchange - LLVMPollySupport - LLVMPollyJSON - ) +set(POLLY_JSON_FILES + JSON/json_reader.cpp + JSON/json_value.cpp + JSON/json_writer.cpp +) + +if (CLOOG_FOUND) + set(CLOOG_FILES + CodeGen/Cloog.cpp + CodeGen/CodeGeneration.cpp) +endif (CLOOG_FOUND) + +set(ISL_CODEGEN_FILES + CodeGen/IslAst.cpp + CodeGen/IslCodeGeneration.cpp) + +if (GPU_CODEGEN) + set (GPGPU_CODEGEN_FILES + CodeGen/PTXGenerator.cpp) +endif (GPU_CODEGEN) -add_polly_loadable_module(LLVMPolly +if (OPENSCOP_FOUND) + set(POLLY_OPENSCOP_FILES + Exchange/OpenScopImporter.cpp + Exchange/OpenScopExporter.cpp) +endif (OPENSCOP_FOUND) + +if (SCOPLIB_FOUND) + set(POLLY_SCOPLIB_FILES + Pocc.cpp + Exchange/ScopLib.cpp + Exchange/ScopLibExporter.cpp + Exchange/ScopLibImporter.cpp) +endif (SCOPLIB_FOUND) + +add_polly_library(LLVMPollyLib + Analysis/Dependences.cpp + Analysis/ScopDetection.cpp + Analysis/ScopInfo.cpp + Analysis/ScopGraphPrinter.cpp + Analysis/ScopPass.cpp + Analysis/TempScopInfo.cpp + CodeGen/BlockGenerators.cpp + ${CLOOG_FILES} + ${ISL_CODEGEN_FILES} + CodeGen/LoopGenerators.cpp + CodeGen/Utils.cpp + ${GPGPU_CODEGEN_FILES} + Support/GICHelper.cpp + Support/SCEVValidator.cpp + Support/ScopHelper.cpp + Exchange/JSONExporter.cpp + ${POLLY_JSON_FILES} + ${POLLY_OPENSCOP_FILES} Canonicalization.cpp CodePreparation.cpp DeadCodeElimination.cpp @@ -36,18 +73,21 @@ add_polly_loadable_module(LLVMPolly ${POLLY_PLUTO_FILES} ) +target_link_libraries(LLVMPollyLib + LLVMSupport + LLVMScalarOpts + LLVMTransformUtils + LLVMipo +) + +add_polly_loadable_module(LLVMPolly) + if (TARGET intrinsics_gen) # Check if we are building as part of an LLVM build add_dependencies(LLVMPolly intrinsics_gen) endif() -add_dependencies(LLVMPolly - LLVMPollyAnalysis - LLVMPollyCodeGen - LLVMPollyExchange - LLVMPollySupport - LLVMPollyJSON - ) +target_link_libraries(LLVMPolly LLVMPollyLib) set_target_properties(LLVMPolly PROPERTIES diff --git a/polly/lib/CodeGen/CMakeLists.txt b/polly/lib/CodeGen/CMakeLists.txt deleted file mode 100644 index 4cb8e7f..0000000 --- a/polly/lib/CodeGen/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -if (CLOOG_FOUND) - set(CLOOG_FILES - Cloog.cpp - CodeGeneration.cpp) -endif (CLOOG_FOUND) - -set(ISL_CODEGEN_FILES - IslAst.cpp - IslCodeGeneration.cpp) - -if (GPU_CODEGEN) - set (GPGPU_CODEGEN_FILES - PTXGenerator.cpp) -endif (GPU_CODEGEN) - -add_polly_library(LLVMPollyCodeGen - BlockGenerators.cpp - ${CLOOG_FILES} - ${ISL_CODEGEN_FILES} - LoopGenerators.cpp - Utils.cpp - ${GPGPU_CODEGEN_FILES} -) diff --git a/polly/lib/Exchange/CMakeLists.txt b/polly/lib/Exchange/CMakeLists.txt deleted file mode 100644 index 5b8feab..0000000 --- a/polly/lib/Exchange/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -if (OPENSCOP_FOUND) - set(POLLY_OPENSCOP_FILES - OpenScopImporter.cpp - OpenScopExporter.cpp) -endif (OPENSCOP_FOUND) - -if (SCOPLIB_FOUND) - set(POLLY_SCOPLIB_FILES - ScopLib.cpp - ScopLibExporter.cpp - ScopLibImporter.cpp) -endif (SCOPLIB_FOUND) - -add_polly_library(LLVMPollyExchange - JSONExporter.cpp - ${POLLY_OPENSCOP_FILES} - ${POLLY_SCOPLIB_FILES} -) - -target_link_libraries(LLVMPollyExchange LLVMPollyJSON) diff --git a/polly/lib/JSON/CMakeLists.txt b/polly/lib/JSON/CMakeLists.txt deleted file mode 100644 index 1ea75c6..0000000 --- a/polly/lib/JSON/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_polly_library(LLVMPollyJSON - json_reader.cpp - json_value.cpp - json_writer.cpp -) - diff --git a/polly/lib/Support/CMakeLists.txt b/polly/lib/Support/CMakeLists.txt deleted file mode 100644 index b170044..0000000 --- a/polly/lib/Support/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_polly_library(LLVMPollySupport - GICHelper.cpp - SCEVValidator.cpp - ScopHelper.cpp - ) -- 2.7.4