@@ -21,6 +21,34 @@ if (MSVC_IDE OR XCODE)
2121 file (GLOB_RECURSE POLLY_HEADER_FILES "${POLLY_SOURCE_DIR} /include/polly/*.h" )
2222endif ()
2323
24+ set (POLLY_COMPONENTS
25+ Support
26+ Core
27+ ScalarOpts
28+ InstCombine
29+ TransformUtils
30+ Analysis
31+ ipo
32+ MC
33+ Passes
34+ Linker
35+ IRReader
36+ Analysis
37+ # The libraries below are required for darwin: http://PR26392
38+ BitReader
39+ MCParser
40+ Object
41+ ProfileData
42+ Target
43+ Vectorize
44+ )
45+
46+ # Polly-ACC requires the NVPTX backend to work. Ask LLVM about its libraries.
47+ if (GPU_CODEGEN)
48+ # This call emits an error if they NVPTX backend is not enable.
49+ list (APPEND POLLY_COMPONENTS NVPTX)
50+ endif ()
51+
2452# Use an object-library to add the same files to multiple libs without requiring
2553# the sources them to be recompiled for each of them.
2654add_llvm_pass_plugin(Polly
@@ -71,6 +99,9 @@ add_llvm_pass_plugin(Polly
7199 Transform/RewriteByReferenceParameters.cpp
72100 Transform/ScopInliner.cpp
73101 ${POLLY_HEADER_FILES}
102+
103+ LINK_COMPONENTS
104+ ${POLLY_COMPONENTS}
74105 )
75106set_target_properties (obj.Polly PROPERTIES FOLDER "Polly" )
76107set_target_properties (Polly PROPERTIES FOLDER "Polly" )
@@ -99,45 +130,7 @@ if (GPU_CODEGEN)
99130 target_link_libraries (Polly PUBLIC PollyPPCG)
100131endif ()
101132
102-
103- # Polly-ACC requires the NVPTX backend to work. Ask LLVM about its libraries.
104- set (nvptx_libs)
105- if (GPU_CODEGEN)
106- # This call emits an error if they NVPTX backend is not enable.
107- llvm_map_components_to_libnames(nvptx_libs NVPTX)
108- endif ()
109-
110- if (LLVM_LINK_LLVM_DYLIB)
111- # The shlib/dylib contains all the LLVM components
112- # (including NVPTX is enabled) already. Adding them to target_link_libraries
113- # would cause them being twice in the address space
114- # (their LLVM*.a/so and their copies in libLLVM.so)
115- # which results in errors when the two instances try to register the same
116- # command-line switches.
117- target_link_libraries (Polly PUBLIC LLVM)
118- else ()
119- target_link_libraries (Polly PUBLIC
120- LLVMSupport
121- LLVMCore
122- LLVMScalarOpts
123- LLVMInstCombine
124- LLVMTransformUtils
125- LLVMAnalysis
126- LLVMipo
127- LLVMMC
128- LLVMPasses
129- LLVMLinker
130- LLVMIRReader
131- ${nvptx_libs}
132- # The libraries below are required for darwin: http://PR26392
133- LLVMBitReader
134- LLVMMCParser
135- LLVMObject
136- LLVMProfileData
137- LLVMTarget
138- LLVMVectorize
139- )
140-
133+ if (NOT LLVM_LINK_LLVM_DYLIB)
141134 # Polly-ACC requires the NVPTX target to be present in the executable it is linked to
142135 set_property (TARGET bugpoint APPEND PROPERTY LINK_LIBRARIES LLVMTarget)
143136endif ()
0 commit comments