[llvm] r203886 - static link polly into tools

Sebastian Pop spop at codeaurora.org
Thu Mar 13 21:04:15 PDT 2014


Author: spop
Date: Thu Mar 13 23:04:14 2014
New Revision: 203886

URL: http://llvm.org/viewvc/llvm-project?rev=203886&view=rev
Log:
static link polly into tools

Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/include/llvm/Config/config.h.cmake
    llvm/trunk/include/llvm/Config/llvm-config.h.cmake
    llvm/trunk/tools/CMakeLists.txt
    llvm/trunk/tools/bugpoint/CMakeLists.txt
    llvm/trunk/tools/bugpoint/bugpoint.cpp
    llvm/trunk/tools/opt/CMakeLists.txt
    llvm/trunk/tools/opt/opt.cpp

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=203886&r1=203885&r2=203886&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Thu Mar 13 23:04:14 2014
@@ -503,6 +503,8 @@ endif()
 add_subdirectory(projects)
 
 option(WITH_POLLY "Build LLVM with Polly" ON)
+option(LINK_POLLY_INTO_TOOLS "Static link Polly into tools" OFF)
+
 if(WITH_POLLY)
   if(NOT EXISTS ${LLVM_MAIN_SRC_DIR}/tools/polly/CMakeLists.txt)
     set(WITH_POLLY OFF)

Modified: llvm/trunk/include/llvm/Config/config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=203886&r1=203885&r2=203886&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/config.h.cmake Thu Mar 13 23:04:14 2014
@@ -498,6 +498,9 @@
 /* Linker version detected at compile time. */
 #undef HOST_LINK_VERSION
 
+/* Define if we link Polly to the tools */
+#cmakedefine LINK_POLLY_INTO_TOOLS
+
 /* Installation directory for binary executables */
 #cmakedefine LLVM_BINDIR "${LLVM_BINDIR}"
 

Modified: llvm/trunk/include/llvm/Config/llvm-config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/llvm-config.h.cmake?rev=203886&r1=203885&r2=203886&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/llvm-config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/llvm-config.h.cmake Thu Mar 13 23:04:14 2014
@@ -121,4 +121,7 @@
 /* Minor version of the LLVM API */
 #cmakedefine LLVM_VERSION_MINOR ${LLVM_VERSION_MINOR}
 
+/* Define if we link Polly to the tools */
+#cmakedefine LINK_POLLY_INTO_TOOLS
+
 #endif

Modified: llvm/trunk/tools/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/CMakeLists.txt?rev=203886&r1=203885&r2=203886&view=diff
==============================================================================
--- llvm/trunk/tools/CMakeLists.txt (original)
+++ llvm/trunk/tools/CMakeLists.txt Thu Mar 13 23:04:14 2014
@@ -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 "boo
   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()

Modified: llvm/trunk/tools/bugpoint/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CMakeLists.txt?rev=203886&r1=203885&r2=203886&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/CMakeLists.txt (original)
+++ llvm/trunk/tools/bugpoint/CMakeLists.txt Thu Mar 13 23:04:14 2014
@@ -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)

Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=203886&r1=203885&r2=203886&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/bugpoint.cpp (original)
+++ llvm/trunk/tools/bugpoint/bugpoint.cpp Thu Mar 13 23:04:14 2014
@@ -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"

Modified: llvm/trunk/tools/opt/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/CMakeLists.txt?rev=203886&r1=203885&r2=203886&view=diff
==============================================================================
--- llvm/trunk/tools/opt/CMakeLists.txt (original)
+++ llvm/trunk/tools/opt/CMakeLists.txt Thu Mar 13 23:04:14 2014
@@ -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)

Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=203886&r1=203885&r2=203886&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Thu Mar 13 23:04:14 2014
@@ -304,6 +304,12 @@ static TargetMachine* GetTargetMachine(T
                                         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");
 





More information about the llvm-commits mailing list