From beaa95d97f319dc9b93b89850ab2ed9790182166 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Fri, 14 Mar 2014 04:04:14 +0000 Subject: static link polly into tools git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203886 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/CMakeLists.txt | 14 ++++++++------ tools/bugpoint/CMakeLists.txt | 9 +++++++++ tools/bugpoint/bugpoint.cpp | 10 ++++++++++ tools/opt/CMakeLists.txt | 9 +++++++++ tools/opt/opt.cpp | 10 ++++++++++ 5 files changed, 46 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index c3ebe18b8a..13b7f5af85 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,5 +1,13 @@ add_llvm_tool_subdirectory(llvm-config) +# Build polly before the tools: the tools link against polly when +# LINK_POLLY_INTO_TOOLS is set. +if(WITH_POLLY) + add_llvm_external_project(polly) +else(WITH_POLLY) + list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${LLVM_MAIN_SRC_DIR}/tools/polly") +endif(WITH_POLLY) + add_llvm_tool_subdirectory(opt) add_llvm_tool_subdirectory(llvm-as) add_llvm_tool_subdirectory(llvm-dis) @@ -67,12 +75,6 @@ if( NOT LLVM_INCLUDE_TOOLS STREQUAL "bootstrap-only" ) add_llvm_external_project(lld) add_llvm_external_project(lldb) - if(WITH_POLLY) - add_llvm_external_project(polly) - else(WITH_POLLY) - list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${LLVM_MAIN_SRC_DIR}/tools/polly") - endif(WITH_POLLY) - # Automatically add remaining sub-directories containing a 'CMakeLists.txt' # file as external projects. add_llvm_implicit_external_projects() diff --git a/tools/bugpoint/CMakeLists.txt b/tools/bugpoint/CMakeLists.txt index b537a5d237..d71e097918 100644 --- a/tools/bugpoint/CMakeLists.txt +++ b/tools/bugpoint/CMakeLists.txt @@ -32,3 +32,12 @@ add_llvm_tool(bugpoint bugpoint.cpp ) set_target_properties(bugpoint PROPERTIES ENABLE_EXPORTS 1) + +if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS) + target_link_libraries(bugpoint Polly) + if(POLLY_LINK_LIBS) + foreach(lib ${POLLY_LINK_LIBS}) + target_link_libraries(bugpoint ${lib}) + endforeach(lib) + endif(POLLY_LINK_LIBS) +endif(WITH_POLLY AND LINK_POLLY_INTO_TOOLS) diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp index b79434080d..5c03b41abb 100644 --- a/tools/bugpoint/bugpoint.cpp +++ b/tools/bugpoint/bugpoint.cpp @@ -109,6 +109,12 @@ namespace { }; } +#ifdef LINK_POLLY_INTO_TOOLS +namespace polly { +void initializePollyPasses(llvm::PassRegistry &Registry); +} +#endif + int main(int argc, char **argv) { #ifndef DEBUG_BUGPOINT llvm::sys::PrintStackTraceOnErrorSignal(); @@ -130,6 +136,10 @@ int main(int argc, char **argv) { initializeInstrumentation(Registry); initializeTarget(Registry); +#ifdef LINK_POLLY_INTO_TOOLS + polly::initializePollyPasses(Registry); +#endif + cl::ParseCommandLineOptions(argc, argv, "LLVM automatic testcase reducer. See\nhttp://" "llvm.org/cmds/bugpoint.html" diff --git a/tools/opt/CMakeLists.txt b/tools/opt/CMakeLists.txt index 1f76ab5551..1d3f08db7d 100644 --- a/tools/opt/CMakeLists.txt +++ b/tools/opt/CMakeLists.txt @@ -32,3 +32,12 @@ add_llvm_tool(opt opt.cpp ) set_target_properties(opt PROPERTIES ENABLE_EXPORTS 1) + +if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS) + target_link_libraries(opt Polly) + if(POLLY_LINK_LIBS) + foreach(lib ${POLLY_LINK_LIBS}) + target_link_libraries(opt ${lib}) + endforeach(lib) + endif(POLLY_LINK_LIBS) +endif(WITH_POLLY AND LINK_POLLY_INTO_TOOLS) diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 4dd9544fc3..5a198816e6 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -304,6 +304,12 @@ static TargetMachine* GetTargetMachine(Triple TheTriple) { GetCodeGenOptLevel()); } +#ifdef LINK_POLLY_INTO_TOOLS +namespace polly { +void initializePollyPasses(llvm::PassRegistry &Registry); +} +#endif + //===----------------------------------------------------------------------===// // main for opt // @@ -338,6 +344,10 @@ int main(int argc, char **argv) { // supported. For now, just add CodeGenPrepare. initializeCodeGenPreparePass(Registry); +#ifdef LINK_POLLY_INTO_TOOLS + polly::initializePollyPasses(Registry); +#endif + cl::ParseCommandLineOptions(argc, argv, "llvm .bc -> .bc modular optimizer and analysis printer\n"); -- cgit v1.2.3