diff options
author | serge-sans-paille <sguelton@redhat.com> | 2020-04-18 08:14:52 +0200 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2020-06-17 16:57:30 -0700 |
commit | 576559ed5d0805120d3729db24b33d00489be5f8 (patch) | |
tree | dc3128f65d516daf1e27a215085c7987db0e3b16 | |
parent | 2f6b23d4d00ce08e71f1046158efe209aa01fcd1 (diff) | |
download | bcm5719-llvm-576559ed5d0805120d3729db24b33d00489be5f8.tar.gz bcm5719-llvm-576559ed5d0805120d3729db24b33d00489be5f8.zip |
Use components instead of libraries in Polly linkage step
As a side effect, this tests (and fix a bug) in the compiler extension handling
of components.
Differential Revision: https://reviews.llvm.org/D78358
(cherry picked from commit e849e7a700907441ee82ace9d0a9555ae7eb9811)
-rw-r--r-- | llvm/cmake/modules/AddLLVM.cmake | 6 | ||||
-rw-r--r-- | polly/lib/CMakeLists.txt | 71 |
2 files changed, 38 insertions, 39 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index bf9f3fc834d..bd22353b6cf 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -868,6 +868,12 @@ function(add_llvm_pass_plugin name) endif() option(LLVM_${name_upper}_LINK_INTO_TOOLS "Statically link ${name} into tools (if available)" ${link_into_tools_default}) + # If we statically link the plugin, don't use llvm dylib because we're going + # to be part of it. + if(LLVM_${name_upper}_LINK_INTO_TOOLS) + list(APPEND ARG_UNPARSED_ARGUMENTS DISABLE_LLVM_LINK_LLVM_DYLIB) + endif() + if(LLVM_${name_upper}_LINK_INTO_TOOLS) list(REMOVE_ITEM ARG_UNPARSED_ARGUMENTS BUILDTREE_ONLY) # process_llvm_pass_plugins takes care of the actual linking, just create an diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt index 35614973a5d..55e60e25f33 100644 --- a/polly/lib/CMakeLists.txt +++ b/polly/lib/CMakeLists.txt @@ -21,6 +21,34 @@ if (MSVC_IDE OR XCODE) file(GLOB_RECURSE POLLY_HEADER_FILES "${POLLY_SOURCE_DIR}/include/polly/*.h") endif () +set(POLLY_COMPONENTS + Support + Core + ScalarOpts + InstCombine + TransformUtils + Analysis + ipo + MC + Passes + Linker + IRReader + Analysis + # The libraries below are required for darwin: http://PR26392 + BitReader + MCParser + Object + ProfileData + Target + Vectorize +) + +# Polly-ACC requires the NVPTX backend to work. Ask LLVM about its libraries. +if (GPU_CODEGEN) + # This call emits an error if they NVPTX backend is not enable. + list(APPEND POLLY_COMPONENTS NVPTX) +endif () + # Use an object-library to add the same files to multiple libs without requiring # the sources them to be recompiled for each of them. add_llvm_pass_plugin(Polly @@ -71,6 +99,9 @@ add_llvm_pass_plugin(Polly Transform/RewriteByReferenceParameters.cpp Transform/ScopInliner.cpp ${POLLY_HEADER_FILES} + + LINK_COMPONENTS + ${POLLY_COMPONENTS} ) set_target_properties(obj.Polly PROPERTIES FOLDER "Polly") set_target_properties(Polly PROPERTIES FOLDER "Polly") @@ -99,45 +130,7 @@ if (GPU_CODEGEN) target_link_libraries(Polly PUBLIC PollyPPCG) endif () - -# Polly-ACC requires the NVPTX backend to work. Ask LLVM about its libraries. -set(nvptx_libs) -if (GPU_CODEGEN) - # This call emits an error if they NVPTX backend is not enable. - llvm_map_components_to_libnames(nvptx_libs NVPTX) -endif () - -if (LLVM_LINK_LLVM_DYLIB) - # The shlib/dylib contains all the LLVM components - # (including NVPTX is enabled) already. Adding them to target_link_libraries - # would cause them being twice in the address space - # (their LLVM*.a/so and their copies in libLLVM.so) - # which results in errors when the two instances try to register the same - # command-line switches. - target_link_libraries(Polly PUBLIC LLVM) -else () - target_link_libraries(Polly PUBLIC - LLVMSupport - LLVMCore - LLVMScalarOpts - LLVMInstCombine - LLVMTransformUtils - LLVMAnalysis - LLVMipo - LLVMMC - LLVMPasses - LLVMLinker - LLVMIRReader - ${nvptx_libs} - # The libraries below are required for darwin: http://PR26392 - LLVMBitReader - LLVMMCParser - LLVMObject - LLVMProfileData - LLVMTarget - LLVMVectorize - ) - +if (NOT LLVM_LINK_LLVM_DYLIB) # Polly-ACC requires the NVPTX target to be present in the executable it is linked to set_property(TARGET bugpoint APPEND PROPERTY LINK_LIBRARIES LLVMTarget) endif () |