UNSUPPORT test on 64-bit AIX too
[llvm-project.git] / polly / lib / CMakeLists.txt
blobc6c1a18e900468b50b6209b69593d2c0f59081bf
1 set(LLVM_NO_RTTI 1)
3 set(ISL_CODEGEN_FILES
4     CodeGen/IslAst.cpp
5     CodeGen/IslExprBuilder.cpp
6     CodeGen/IslNodeBuilder.cpp
7     CodeGen/CodeGeneration.cpp)
9 if (GPU_CODEGEN)
10   set (GPGPU_CODEGEN_FILES
11        CodeGen/PPCGCodeGeneration.cpp
12        CodeGen/ManagedMemoryRewrite.cpp
13        )
14 endif (GPU_CODEGEN)
16 # Compile ISL into a separate library.
17 add_subdirectory(External)
19 set(POLLY_HEADER_FILES)
20 if (MSVC_IDE OR XCODE)
21   file(GLOB_RECURSE POLLY_HEADER_FILES "${POLLY_SOURCE_DIR}/include/polly/*.h")
22 endif ()
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
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 ()
52 # Use an object-library to add the same files to multiple libs without requiring
53 # the sources them to be recompiled for each of them.
54 add_llvm_pass_plugin(Polly
55   NO_MODULE
56   SUBPROJECT Polly
57   Analysis/DependenceInfo.cpp
58   Analysis/PolyhedralInfo.cpp
59   Analysis/ScopDetection.cpp
60   Analysis/ScopDetectionDiagnostic.cpp
61   Analysis/ScopInfo.cpp
62   Analysis/ScopBuilder.cpp
63   Analysis/ScopGraphPrinter.cpp
64   Analysis/ScopPass.cpp
65   Analysis/PruneUnprofitable.cpp
66   CodeGen/BlockGenerators.cpp
67   ${ISL_CODEGEN_FILES}
68   CodeGen/LoopGenerators.cpp
69   CodeGen/LoopGeneratorsGOMP.cpp
70   CodeGen/LoopGeneratorsKMP.cpp
71   CodeGen/IRBuilder.cpp
72   CodeGen/Utils.cpp
73   CodeGen/RuntimeDebugBuilder.cpp
74   CodeGen/CodegenCleanup.cpp
75   CodeGen/PerfMonitor.cpp
76   ${GPGPU_CODEGEN_FILES}
77   Exchange/JSONExporter.cpp
78   Support/GICHelper.cpp
79   Support/SCEVAffinator.cpp
80   Support/SCEVValidator.cpp
81   Support/RegisterPasses.cpp
82   Support/ScopHelper.cpp
83   Support/ScopLocation.cpp
84   Support/ISLTools.cpp
85   Support/DumpModulePass.cpp
86   Support/DumpFunctionPass.cpp
87   Support/VirtualInstruction.cpp
88   Transform/Canonicalization.cpp
89   Transform/CodePreparation.cpp
90   Transform/DeadCodeElimination.cpp
91   Transform/ScheduleOptimizer.cpp
92   Transform/ScheduleTreeTransform.cpp
93   Transform/FlattenSchedule.cpp
94   Transform/FlattenAlgo.cpp
95   Transform/ForwardOpTree.cpp
96   Transform/DeLICM.cpp
97   Transform/ZoneAlgo.cpp
98   Transform/Simplify.cpp
99   Transform/MaximalStaticExpansion.cpp
100   Transform/ScopInliner.cpp
101   Transform/ManualOptimizer.cpp
102   Transform/MatmulOptimizer.cpp
103   ${POLLY_HEADER_FILES}
105   LINK_COMPONENTS
106   ${POLLY_COMPONENTS}
107   )
108 set_target_properties(obj.Polly PROPERTIES FOLDER "Polly")
109 set_target_properties(Polly PROPERTIES FOLDER "Polly")
111 if (MSVC_IDE OR XCODE)
112   # Configure source groups for Polly source files. By default, in the IDE there
113   # will be a source and include folder. In the source folder will be all the
114   # source files in a flat list, and in the include folder will be all the
115   # headers in a flat list. Sets the CMake source_group for each folder such
116   # the organization of the sources and headers in the IDE matches how it is
117   # laid out on disk
118   setup_polly_source_groups(${CMAKE_CURRENT_LIST_DIR}
119     ${CMAKE_CURRENT_LIST_DIR}/../include/polly)
120 endif()
122 # Create the library that can be linked into LLVM's tools and Polly's unittests.
123 # It depends on all library it needs, such that with
124 # LLVM_POLLY_LINK_INTO_TOOLS=ON, its dependencies like PollyISL are linked as
125 # well.
126 target_link_libraries(Polly PUBLIC
127   ${ISL_TARGET}
130 # Additional dependencies for Polly-ACC.
131 if (GPU_CODEGEN)
132   target_link_libraries(Polly PUBLIC PollyPPCG)
133 endif ()
135 if (NOT LLVM_LINK_LLVM_DYLIB AND NOT LLVM_POLLY_LINK_INTO_TOOLS)
136     # Polly-ACC requires the NVPTX target to be present in the executable it is linked to
137     set_property(TARGET bugpoint APPEND PROPERTY LINK_LIBRARIES LLVMTarget)
138 endif ()
140 # Create a loadable module Polly.so that can be loaded using
141 # LLVM's/clang's "-load" option.
142 if (WIN32 OR NOT LLVM_ENABLE_PIC)
143   # Add dummy target, either because loadable modules are not supported
144   # as on Windows or because PIC code has been disabled
145   add_custom_target(LLVMPolly)
146   set_target_properties(LLVMPolly PROPERTIES FOLDER "Polly")
147 else ()
148   add_polly_loadable_module(LLVMPolly
149     Plugin/Polly.cpp
150     $<TARGET_OBJECTS:obj.Polly>
151   )
153   # Only add the dependencies that are not part of LLVM. The latter are assumed
154   # to be already available in the address space the module is loaded into.
155   # Adding them once more would have the effect that both copies try to register
156   # the same command line options, to which LLVM reacts with an error.
157   # If Polly-ACC is enabled, the NVPTX target is also expected to reside in the
158   # hosts. This is not the case for bugpoint. Use LLVM_POLLY_LINK_INTO_TOOLS=ON
159   # instead which will automatically resolve the additional dependencies by
160   # Polly.
161   target_link_libraries(LLVMPolly PUBLIC ${ISL_TARGET})
162   if (GPU_CODEGEN)
163     target_link_libraries(LLVMPolly PUBLIC PollyPPCG)
164   endif ()
166   set_target_properties(LLVMPolly
167     PROPERTIES
168     LINKER_LANGUAGE CXX
169     PREFIX "")
170 endif ()
172 if (TARGET intrinsics_gen)
173   # Check if we are building as part of an LLVM build
174   add_dependencies(obj.Polly intrinsics_gen)
175 endif()