2011-04-29 14:27:02 +08:00
|
|
|
set(LLVM_NO_RTTI 1)
|
|
|
|
|
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
|
2017-08-09 20:59:23 +08:00
|
|
|
CodeGen/ManagedMemoryRewrite.cpp
|
2016-07-13 23:54:58 +08:00
|
|
|
)
|
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
|
2017-05-04 23:22:57 +08:00
|
|
|
Support/VirtualInstruction.cpp
|
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
|
2017-07-22 22:02:47 +08:00
|
|
|
Transform/ForwardOpTree.cpp
|
2016-11-30 00:41:21 +08:00
|
|
|
Transform/DeLICM.cpp
|
2017-08-05 06:51:23 +08:00
|
|
|
Transform/ZoneAlgo.cpp
|
2017-03-11 00:05:24 +08:00
|
|
|
Transform/Simplify.cpp
|
2017-08-08 04:54:20 +08:00
|
|
|
Transform/MaximalStaticExpansion.cpp
|
Add rewrite by-reference parameter pass
Summary:
This pass detangles induction variables from functions, which take variables by
reference. Most fortran functions compiled with gfortran pass variables by
reference. Unfortunately a common pattern, printf calls of induction variables,
prevent in this situation the promotion of the induction variable to a register,
which again inhibits any kind of loop analysis. To work around this issue
we developed a specialized pass which introduces separate alloca slots for
known-read-only references, which indicate the mem2reg pass that the induction
variables can be promoted to registers and consquently enable SCEV to work.
We currently hardcode the information that a function
_gfortran_transfer_integer_write does not read its second parameter, as
dragonegg does not add the right annotations and we cannot change old dragonegg
releases. Hopefully flang will produce the right annotations.
Reviewers: Meinersbur, bollu, singam-sanjay
Reviewed By: bollu
Subscribers: mgorny, pollydev, llvm-commits
Tags: #polly
Differential Revision: https://reviews.llvm.org/D36800
llvm-svn: 311066
2017-08-17 13:25:08 +08:00
|
|
|
Transform/RewriteByReferenceParameters.cpp
|
2017-08-18 05:57:23 +08:00
|
|
|
Transform/ScopInliner.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>)
|
2018-01-13 00:09:18 +08:00
|
|
|
target_link_libraries(Polly PUBLIC
|
2017-04-28 00:13:03 +08:00
|
|
|
${ISL_TARGET}
|
|
|
|
)
|
|
|
|
|
|
|
|
# Additional dependencies for Polly-ACC.
|
2016-07-13 23:54:47 +08:00
|
|
|
if (GPU_CODEGEN)
|
2018-01-13 00:09:18 +08:00
|
|
|
target_link_libraries(Polly PUBLIC PollyPPCG)
|
2017-04-28 00:13:03 +08:00
|
|
|
endif ()
|
2016-07-13 23:54:47 +08:00
|
|
|
|
2015-06-23 04:31:16 +08:00
|
|
|
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +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 ()
|
2017-04-28 00:13:03 +08:00
|
|
|
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +08:00
|
|
|
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.
|
2018-01-13 00:09:18 +08:00
|
|
|
target_link_libraries(Polly PUBLIC LLVM)
|
2017-04-28 00:13:03 +08:00
|
|
|
else ()
|
2018-01-13 00:09:18 +08:00
|
|
|
target_link_libraries(Polly PUBLIC
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +08:00
|
|
|
LLVMSupport
|
|
|
|
LLVMCore
|
|
|
|
LLVMScalarOpts
|
|
|
|
LLVMInstCombine
|
|
|
|
LLVMTransformUtils
|
|
|
|
LLVMAnalysis
|
|
|
|
LLVMipo
|
|
|
|
LLVMMC
|
|
|
|
LLVMPasses
|
[GPGPU] Add support for NVIDIA libdevice
Summary:
This allows us to map functions such as exp, expf, expl, for which no
LLVM intrinsics exist. Instead, we link to NVIDIA's libdevice which provides
high-performance implementations of a wide range of (math) functions. We
currently link only a small subset, the exp, cos and copysign functions. Other
functions will be enabled as needed.
Reviewers: bollu, singam-sanjay
Reviewed By: bollu
Subscribers: tstellar, tra, nemanjai, pollydev, mgorny, llvm-commits, kbarton
Tags: #polly
Differential Revision: https://reviews.llvm.org/D35703
llvm-svn: 309560
2017-07-31 22:03:16 +08:00
|
|
|
LLVMLinker
|
|
|
|
LLVMIRReader
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +08:00
|
|
|
${nvptx_libs}
|
|
|
|
# The libraries below are required for darwin: http://PR26392
|
|
|
|
LLVMBitReader
|
|
|
|
LLVMMCParser
|
|
|
|
LLVMObject
|
|
|
|
LLVMProfileData
|
|
|
|
LLVMTarget
|
|
|
|
LLVMVectorize
|
|
|
|
)
|
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.
|
2018-08-01 08:15:16 +08:00
|
|
|
target_link_libraries(LLVMPolly PUBLIC ${ISL_TARGET})
|
2017-04-28 00:13:03 +08:00
|
|
|
if (GPU_CODEGEN)
|
2018-01-13 00:09:18 +08:00
|
|
|
target_link_libraries(LLVMPolly PUBLIC PollyPPCG)
|
2017-04-28 00:13:03 +08:00
|
|
|
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()
|
|
|
|
|