2011-04-29 14:27:02 +08:00
|
|
|
set(LLVM_NO_RTTI 1)
|
|
|
|
|
2014-03-04 03:30:19 +08:00
|
|
|
set(POLLY_JSON_FILES
|
2017-02-05 23:26:56 +08:00
|
|
|
External/JSON/json_reader.cpp
|
|
|
|
External/JSON/json_value.cpp
|
|
|
|
External/JSON/json_writer.cpp
|
2014-03-04 03:30:19 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
set(ISL_CODEGEN_FILES
|
|
|
|
CodeGen/IslAst.cpp
|
2014-07-30 04:50:09 +08:00
|
|
|
CodeGen/IslExprBuilder.cpp
|
2015-04-27 20:32:24 +08:00
|
|
|
CodeGen/IslNodeBuilder.cpp
|
2015-05-12 15:45:52 +08:00
|
|
|
CodeGen/CodeGeneration.cpp)
|
2014-03-04 03:30:19 +08:00
|
|
|
|
|
|
|
if (GPU_CODEGEN)
|
2016-07-13 23:54:58 +08:00
|
|
|
set (GPGPU_CODEGEN_FILES
|
|
|
|
CodeGen/PPCGCodeGeneration.cpp
|
|
|
|
)
|
2014-03-04 03:30:19 +08:00
|
|
|
endif (GPU_CODEGEN)
|
2011-04-29 14:27:02 +08:00
|
|
|
|
2015-09-24 19:30:22 +08:00
|
|
|
# Compile ISL into a separate library.
|
|
|
|
add_subdirectory(External)
|
2015-02-05 04:55:43 +08:00
|
|
|
|
2015-09-11 17:01:55 +08:00
|
|
|
set(POLLY_HEADER_FILES)
|
|
|
|
if (MSVC_IDE OR XCODE)
|
|
|
|
file(GLOB_RECURSE POLLY_HEADER_FILES "${POLLY_SOURCE_DIR}/include/polly/*.h")
|
|
|
|
endif ()
|
2015-02-05 04:55:43 +08:00
|
|
|
|
2017-04-28 00:13:03 +08:00
|
|
|
# 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_library(PollyCore OBJECT
|
2015-03-05 06:43:40 +08:00
|
|
|
Analysis/DependenceInfo.cpp
|
2016-07-25 20:48:45 +08:00
|
|
|
Analysis/PolyhedralInfo.cpp
|
2014-03-04 03:30:19 +08:00
|
|
|
Analysis/ScopDetection.cpp
|
2014-05-24 17:24:53 +08:00
|
|
|
Analysis/ScopDetectionDiagnostic.cpp
|
2014-03-04 03:30:19 +08:00
|
|
|
Analysis/ScopInfo.cpp
|
2016-06-28 09:37:20 +08:00
|
|
|
Analysis/ScopBuilder.cpp
|
2014-03-04 03:30:19 +08:00
|
|
|
Analysis/ScopGraphPrinter.cpp
|
|
|
|
Analysis/ScopPass.cpp
|
2017-03-17 21:09:52 +08:00
|
|
|
Analysis/PruneUnprofitable.cpp
|
2014-03-04 03:30:19 +08:00
|
|
|
CodeGen/BlockGenerators.cpp
|
|
|
|
${ISL_CODEGEN_FILES}
|
|
|
|
CodeGen/LoopGenerators.cpp
|
2014-03-04 22:59:00 +08:00
|
|
|
CodeGen/IRBuilder.cpp
|
2014-03-04 03:30:19 +08:00
|
|
|
CodeGen/Utils.cpp
|
2014-07-26 01:49:55 +08:00
|
|
|
CodeGen/RuntimeDebugBuilder.cpp
|
2015-11-26 20:36:25 +08:00
|
|
|
CodeGen/CodegenCleanup.cpp
|
2017-04-03 22:55:37 +08:00
|
|
|
CodeGen/PerfMonitor.cpp
|
2014-03-04 03:30:19 +08:00
|
|
|
${GPGPU_CODEGEN_FILES}
|
2014-03-12 05:25:59 +08:00
|
|
|
Exchange/JSONExporter.cpp
|
2014-03-04 03:30:19 +08:00
|
|
|
Support/GICHelper.cpp
|
2015-08-12 18:19:50 +08:00
|
|
|
Support/SCEVAffinator.cpp
|
2014-03-04 03:30:19 +08:00
|
|
|
Support/SCEVValidator.cpp
|
2014-03-12 05:26:06 +08:00
|
|
|
Support/RegisterPasses.cpp
|
2014-03-04 03:30:19 +08:00
|
|
|
Support/ScopHelper.cpp
|
2015-05-03 13:21:36 +08:00
|
|
|
Support/ScopLocation.cpp
|
2017-01-28 06:51:36 +08:00
|
|
|
Support/ISLTools.cpp
|
2017-03-10 06:29:58 +08:00
|
|
|
Support/DumpModulePass.cpp
|
2014-03-04 03:30:19 +08:00
|
|
|
${POLLY_JSON_FILES}
|
2014-03-12 05:25:59 +08:00
|
|
|
Transform/Canonicalization.cpp
|
|
|
|
Transform/CodePreparation.cpp
|
|
|
|
Transform/DeadCodeElimination.cpp
|
|
|
|
Transform/ScheduleOptimizer.cpp
|
Add -polly-flatten-schedule pass.
The -polly-flatten-schedule pass reduces the number of scattering
dimensions in its isl_union_map form to make them easier to understand.
It is not meant to be used in production, only for debugging and
regression tests.
To illustrate, how it can make sets simpler, here is a lifetime set
used computed by the porposed DeLICM pass without flattening:
{ Stmt_reduction_for[0, 4] -> [0, 2, o2, o3] : o2 < 0;
Stmt_reduction_for[0, 4] -> [0, 1, o2, o3] : o2 >= 5;
Stmt_reduction_for[0, 4] -> [0, 1, 4, o3] : o3 > 0;
Stmt_reduction_for[0, i1] -> [0, 1, i1, 1] : 0 <= i1 <= 3;
Stmt_reduction_for[0, 4] -> [0, 2, 0, o3] : o3 <= 0 }
And here the same lifetime for a semantically identical one-dimensional
schedule:
{ Stmt_reduction_for[0, i1] -> [2 + 3i1] : 0 <= i1 <= 4 }
Differential Revision: https://reviews.llvm.org/D24310
llvm-svn: 280948
2016-09-08 23:02:36 +08:00
|
|
|
Transform/FlattenSchedule.cpp
|
|
|
|
Transform/FlattenAlgo.cpp
|
2016-11-30 00:41:21 +08:00
|
|
|
Transform/DeLICM.cpp
|
2017-03-11 00:05:24 +08:00
|
|
|
Transform/Simplify.cpp
|
2015-09-11 17:01:55 +08:00
|
|
|
${POLLY_HEADER_FILES}
|
2011-04-29 14:27:02 +08:00
|
|
|
)
|
2017-05-01 05:07:05 +08:00
|
|
|
set_target_properties(PollyCore PROPERTIES FOLDER "Polly")
|
2011-04-29 14:27:02 +08:00
|
|
|
|
2017-04-28 00:13:03 +08:00
|
|
|
# Create the library that can be linked into LLVM's tools and Polly's unittests.
|
|
|
|
# It depends on all library it needs, such that with
|
|
|
|
# LLVM_POLLY_LINK_INTO_TOOLS=ON, its dependencies like PollyISL are linked as
|
|
|
|
# well.
|
|
|
|
add_polly_library(Polly $<TARGET_OBJECTS:PollyCore>)
|
|
|
|
target_link_libraries(Polly
|
|
|
|
${ISL_TARGET}
|
|
|
|
)
|
|
|
|
|
|
|
|
# Additional dependencies for Polly-ACC.
|
2016-07-13 23:54:47 +08:00
|
|
|
if (GPU_CODEGEN)
|
|
|
|
target_link_libraries(Polly PollyPPCG)
|
2017-04-28 00:13:03 +08:00
|
|
|
endif ()
|
2016-07-13 23:54:47 +08:00
|
|
|
|
2017-04-28 00:13:03 +08:00
|
|
|
# Add Polly's LLVM dependencies.
|
|
|
|
# When built inside the LLVM source tree, these are CMake targets that will
|
|
|
|
# depend on their dependencies and CMake ensures they are added in the right
|
|
|
|
# order.
|
|
|
|
# If Polly is built independently, just add all LLVM libraries. LLVM_ROOT_DIR
|
|
|
|
# might have been configured to compile to individual libraries or a single
|
|
|
|
# libLLVM.so (called dylib), reported by llvm-config, so there is no fixed list
|
|
|
|
# of required libraries.
|
|
|
|
if (DEFINED LLVM_MAIN_SRC_DIR)
|
2015-06-23 04:31:16 +08:00
|
|
|
|
2017-04-28 00:13:03 +08:00
|
|
|
# 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 LLVM)
|
|
|
|
else ()
|
|
|
|
target_link_libraries(Polly
|
|
|
|
LLVMSupport
|
|
|
|
LLVMCore
|
|
|
|
LLVMScalarOpts
|
|
|
|
LLVMInstCombine
|
|
|
|
LLVMTransformUtils
|
|
|
|
LLVMAnalysis
|
|
|
|
LLVMipo
|
|
|
|
LLVMMC
|
|
|
|
${nvptx_libs}
|
2016-02-01 04:25:46 +08:00
|
|
|
# The libraries below are required for darwin: http://PR26392
|
2017-04-28 00:13:03 +08:00
|
|
|
LLVMBitReader
|
|
|
|
LLVMMCParser
|
|
|
|
LLVMObject
|
|
|
|
LLVMProfileData
|
|
|
|
LLVMTarget
|
|
|
|
LLVMVectorize
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
else ()
|
|
|
|
# When Polly-ACC is enabled, we assume that the host LLVM was also built with
|
|
|
|
# the NVPTX target enabled.
|
2016-02-04 00:29:04 +08:00
|
|
|
target_link_libraries(Polly
|
2017-04-28 00:13:03 +08:00
|
|
|
${LLVM_LIBS}
|
|
|
|
${LLVM_SYSTEM_LIBS}
|
2016-02-04 00:29:04 +08:00
|
|
|
)
|
2017-04-28 00:13:03 +08:00
|
|
|
endif ()
|
2015-02-12 16:27:19 +08:00
|
|
|
|
2017-04-28 00:13:03 +08:00
|
|
|
# Create a loadable module Polly.so that can be loaded using
|
|
|
|
# LLVM's/clang's "-load" option.
|
2015-07-21 20:29:02 +08:00
|
|
|
if (MSVC)
|
|
|
|
# Add dummy target, because loadable modules are not supported on Windows
|
|
|
|
add_custom_target(LLVMPolly)
|
2015-07-21 20:40:01 +08:00
|
|
|
set_target_properties(LLVMPolly PROPERTIES FOLDER "Polly")
|
2015-07-21 20:29:02 +08:00
|
|
|
else ()
|
|
|
|
add_polly_loadable_module(LLVMPolly
|
|
|
|
Polly.cpp
|
2017-04-28 00:13:03 +08:00
|
|
|
$<TARGET_OBJECTS:PollyCore>
|
2015-07-21 20:29:02 +08:00
|
|
|
)
|
|
|
|
|
2017-04-28 00:13:03 +08:00
|
|
|
# Only add the dependencies that are not part of LLVM. The latter are assumed
|
|
|
|
# to be already available in the address space the module is loaded into.
|
|
|
|
# Adding them once more would have the effect that both copies try to register
|
|
|
|
# the same command line options, to which LLVM reacts with an error.
|
|
|
|
# If Polly-ACC is enabled, the NVPTX target is also expected to reside in the
|
|
|
|
# hosts. This is not the case for bugpoint. Use LLVM_POLLY_LINK_INTO_TOOLS=ON
|
|
|
|
# instead which will automatically resolve the additional dependencies by
|
|
|
|
# Polly.
|
|
|
|
target_link_libraries(LLVMPolly ${ISL_TARGET})
|
|
|
|
if (GPU_CODEGEN)
|
|
|
|
target_link_libraries(LLVMPolly PollyPPCG)
|
|
|
|
endif ()
|
2015-07-21 20:29:02 +08:00
|
|
|
|
|
|
|
set_target_properties(LLVMPolly
|
|
|
|
PROPERTIES
|
|
|
|
LINKER_LANGUAGE CXX
|
|
|
|
PREFIX "")
|
|
|
|
endif ()
|
2014-03-04 03:30:19 +08:00
|
|
|
|
2012-09-04 16:19:12 +08:00
|
|
|
if (TARGET intrinsics_gen)
|
|
|
|
# Check if we are building as part of an LLVM build
|
2017-04-29 11:12:17 +08:00
|
|
|
add_dependencies(PollyCore intrinsics_gen)
|
2012-09-04 16:19:12 +08:00
|
|
|
endif()
|
|
|
|
|