From 3d01fc7de86c75926e4e5ac7cc49f0116018893d Mon Sep 17 00:00:00 2001 From: Oscar Fuentes Date: Mon, 22 Sep 2008 01:08:49 +0000 Subject: Initial support for the CMake build system. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56419 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 137 ++++++ cmake/config-ix.cmake | 93 +++++ cmake/config-w32.cmake | 9 + cmake/modules/AddLLVM.cmake | 39 ++ cmake/modules/AddPartiallyLinkedObject.cmake | 21 + cmake/modules/CheckCxxHashmap.cmake | 53 +++ cmake/modules/CheckCxxHashset.cmake | 52 +++ cmake/modules/FindBison.cmake | 52 +++ cmake/modules/LLVMConfig.cmake | 57 +++ examples/CMakeLists.txt | 1 + examples/Fibonacci/CMakeLists.txt | 5 + include/llvm/ADT/hash_map.cmake | 150 +++++++ include/llvm/ADT/hash_set.cmake | 111 +++++ include/llvm/ADT/iterator.cmake | 79 ++++ include/llvm/Config/config.h.cmake | 558 +++++++++++++++++++++++++ include/llvm/Support/DataTypes.h.cmake | 134 ++++++ lib/Analysis/CMakeLists.txt | 29 ++ lib/Analysis/IPA/CMakeLists.txt | 7 + lib/Archive/CMakeLists.txt | 5 + lib/AsmParser/CMakeLists.txt | 15 + lib/Bitcode/Reader/CMakeLists.txt | 7 + lib/Bitcode/Writer/CMakeLists.txt | 9 + lib/CodeGen/AsmPrinter/CMakeLists.txt | 5 + lib/CodeGen/CMakeLists.txt | 48 +++ lib/CodeGen/SelectionDAG/CMakeLists.txt | 21 + lib/Debugger/CMakeLists.txt | 10 + lib/ExecutionEngine/CMakeLists.txt | 4 + lib/ExecutionEngine/Interpreter/CMakeLists.txt | 5 + lib/ExecutionEngine/JIT/CMakeLists.txt | 11 + lib/Linker/CMakeLists.txt | 6 + lib/Support/CMakeLists.txt | 29 ++ lib/System/CMakeLists.txt | 13 + lib/Target/CMakeLists.txt | 17 + lib/Target/X86/AsmPrinter/CMakeLists.txt | 7 + lib/Target/X86/CMakeLists.txt | 56 +++ lib/Transforms/Hello/CMakeLists.txt | 3 + lib/Transforms/IPO/CMakeLists.txt | 24 ++ lib/Transforms/Instrumentation/CMakeLists.txt | 6 + lib/Transforms/Scalar/CMakeLists.txt | 32 ++ lib/Transforms/Utils/CMakeLists.txt | 26 ++ lib/VMCore/CMakeLists.txt | 32 ++ tools/CMakeLists.txt | 32 ++ tools/bugpoint/CMakeLists.txt | 16 + tools/llc/CMakeLists.txt | 5 + tools/lli/CMakeLists.txt | 5 + tools/llvm-ar/CMakeLists.txt | 8 + tools/llvm-as/CMakeLists.txt | 6 + tools/llvm-bcanalyzer/CMakeLists.txt | 6 + tools/llvm-config/CMakeLists.txt | 102 +++++ tools/llvm-db/CMakeLists.txt | 8 + tools/llvm-dis/CMakeLists.txt | 6 + tools/llvm-extract/CMakeLists.txt | 5 + tools/llvm-ld/CMakeLists.txt | 7 + tools/llvm-link/CMakeLists.txt | 5 + tools/llvm-nm/CMakeLists.txt | 5 + tools/llvm-prof/CMakeLists.txt | 6 + tools/llvm-ranlib/CMakeLists.txt | 6 + tools/llvm-stub/CMakeLists.txt | 3 + tools/llvmc2/CMakeLists.txt | 32 ++ tools/opt/CMakeLists.txt | 9 + utils/TableGen/CMakeLists.txt | 26 ++ 61 files changed, 2276 insertions(+) create mode 100644 CMakeLists.txt create mode 100755 cmake/config-ix.cmake create mode 100755 cmake/config-w32.cmake create mode 100755 cmake/modules/AddLLVM.cmake create mode 100755 cmake/modules/AddPartiallyLinkedObject.cmake create mode 100755 cmake/modules/CheckCxxHashmap.cmake create mode 100755 cmake/modules/CheckCxxHashset.cmake create mode 100755 cmake/modules/FindBison.cmake create mode 100755 cmake/modules/LLVMConfig.cmake create mode 100644 examples/CMakeLists.txt create mode 100644 examples/Fibonacci/CMakeLists.txt create mode 100644 include/llvm/ADT/hash_map.cmake create mode 100644 include/llvm/ADT/hash_set.cmake create mode 100644 include/llvm/ADT/iterator.cmake create mode 100644 include/llvm/Config/config.h.cmake create mode 100644 include/llvm/Support/DataTypes.h.cmake create mode 100644 lib/Analysis/CMakeLists.txt create mode 100644 lib/Analysis/IPA/CMakeLists.txt create mode 100644 lib/Archive/CMakeLists.txt create mode 100644 lib/AsmParser/CMakeLists.txt create mode 100644 lib/Bitcode/Reader/CMakeLists.txt create mode 100644 lib/Bitcode/Writer/CMakeLists.txt create mode 100644 lib/CodeGen/AsmPrinter/CMakeLists.txt create mode 100644 lib/CodeGen/CMakeLists.txt create mode 100644 lib/CodeGen/SelectionDAG/CMakeLists.txt create mode 100644 lib/Debugger/CMakeLists.txt create mode 100644 lib/ExecutionEngine/CMakeLists.txt create mode 100644 lib/ExecutionEngine/Interpreter/CMakeLists.txt create mode 100644 lib/ExecutionEngine/JIT/CMakeLists.txt create mode 100644 lib/Linker/CMakeLists.txt create mode 100644 lib/Support/CMakeLists.txt create mode 100644 lib/System/CMakeLists.txt create mode 100644 lib/Target/CMakeLists.txt create mode 100644 lib/Target/X86/AsmPrinter/CMakeLists.txt create mode 100644 lib/Target/X86/CMakeLists.txt create mode 100644 lib/Transforms/Hello/CMakeLists.txt create mode 100644 lib/Transforms/IPO/CMakeLists.txt create mode 100644 lib/Transforms/Instrumentation/CMakeLists.txt create mode 100644 lib/Transforms/Scalar/CMakeLists.txt create mode 100644 lib/Transforms/Utils/CMakeLists.txt create mode 100644 lib/VMCore/CMakeLists.txt create mode 100644 tools/CMakeLists.txt create mode 100644 tools/bugpoint/CMakeLists.txt create mode 100644 tools/llc/CMakeLists.txt create mode 100644 tools/lli/CMakeLists.txt create mode 100644 tools/llvm-ar/CMakeLists.txt create mode 100644 tools/llvm-as/CMakeLists.txt create mode 100644 tools/llvm-bcanalyzer/CMakeLists.txt create mode 100644 tools/llvm-config/CMakeLists.txt create mode 100644 tools/llvm-db/CMakeLists.txt create mode 100644 tools/llvm-dis/CMakeLists.txt create mode 100644 tools/llvm-extract/CMakeLists.txt create mode 100644 tools/llvm-ld/CMakeLists.txt create mode 100644 tools/llvm-link/CMakeLists.txt create mode 100644 tools/llvm-nm/CMakeLists.txt create mode 100644 tools/llvm-prof/CMakeLists.txt create mode 100644 tools/llvm-ranlib/CMakeLists.txt create mode 100644 tools/llvm-stub/CMakeLists.txt create mode 100644 tools/llvmc2/CMakeLists.txt create mode 100644 tools/opt/CMakeLists.txt create mode 100644 utils/TableGen/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..f6803d989b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,137 @@ +cmake_minimum_required(VERSION 2.6.1) + +set(PACKAGE_NAME llvm) +set(PACKAGE_VERSION svn) +set(PACKAGE_BUGREPORT "ofv@wanadoo.es") +#set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu") + +include(FindPerl) + +set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include/llvm) +set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin) +set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples) + +# TODO: Support user-specified targets: +set(LLVM_TARGETS_TO_BUILD X86) + +if( NOT MSVC ) + set(CMAKE_CXX_LINK_EXECUTABLE "sh -c \"${CMAKE_CXX_LINK_EXECUTABLE}\"") +endif( NOT MSVC ) + +# TODO: Eliminate? +get_filename_component(llvm_include_path ${LLVM_MAIN_SRC_DIR}/include ABSOLUTE) + +#get_filename_component(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm ABSOLUTE) +set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm) + +# Add path for custom modules +set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} + "${LLVM_MAIN_SRC_DIR}/cmake" + "${LLVM_MAIN_SRC_DIR}/cmake/modules" + ) + +if(WIN32) + set(LLVM_ON_WIN32 1) + set(LLVM_ON_UNIX 0) + set(LTDL_SHLIB_EXT ".dll") + set(EXEEXT ".exe") + # Maximum path length is 160 for non-unicode paths + set(MAXPATHLEN 160) +else(WIN32) + if(UNIX) + set(LLVM_ON_WIN32 0) + set(LLVM_ON_UNIX 1) + set(LTDL_SHLIB_EXT ".so") + set(EXEEXT "") + # FIXME: Maximum path length is currently set to 'safe' fixed value + set(MAXPATHLEN 2024) + else(UNIX) + MESSAGE(SEND_ERROR "Unable to determine platform") + endif(UNIX) +endif(WIN32) + +if( EXISTS ${LLVM_TOOLS_BINARY_DIR}/llvm-config ) + set(HAVE_LLVM_CONFIG 1) +endif( EXISTS ${LLVM_TOOLS_BINARY_DIR}/llvm-config ) +# find_file(HAVE_LLVM_CONFIG llvm-config ${LLVM_TOOLS_BINARY_DIR}) +# message(STATUS ${HAVE_LLVM_CONFIG}) + +if( MSVC ) + message(STATUS "Configuring using MSVC hack.") + include(config-w32) +else( MSVC ) + message(STATUS "Configuring traditional style.") + include(config-ix) +endif( MSVC ) + +set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} ) +set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) +set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) + +# set(CMAKE_VERBOSE_MAKEFILE true) + +add_definitions( -D__STDC_LIMIT_MACROS ) + +if( LLVM_ON_UNIX ) + add_definitions( -DLLVM_ON_UNIX ) +else( LLVM_ON_UNIX ) + add_definitions( -DLLVM_ON_WIN32 ) +endif( LLVM_ON_UNIX ) + +if( MSVC ) + add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS ) + add_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS ) + add_definitions( -D_SCL_SECURE_NO_DEPRECATE ) +endif( MSVC ) + +include_directories( ${LLVM_BINARY_DIR}/include ${llvm_include_path}) +#link_directories( d:/dev/lib ) + +#add_subdirectory(lib) + +include(AddLLVM) +include(AddPartiallyLinkedObject) + +add_subdirectory(lib/Support) +add_subdirectory(lib/System) +add_subdirectory(utils/TableGen) + +add_custom_command(OUTPUT ${llvm_builded_incs_dir}/Intrinsics.gen + COMMAND tblgen -gen-intrinsic -I ${llvm_include_path} ${llvm_include_path}/llvm/Intrinsics.td -o ${llvm_builded_incs_dir}/Intrinsics.gen + DEPENDS tblgen + COMMENT "Building intrinsics.gen...") + +add_custom_target(intrinsics_gen ALL + DEPENDS ${llvm_builded_incs_dir}/Intrinsics.gen) + +add_subdirectory(lib/VMCore) +add_subdirectory(lib/CodeGen) +add_subdirectory(lib/CodeGen/SelectionDAG) +add_subdirectory(lib/CodeGen/AsmPrinter) +add_subdirectory(lib/Bitcode/Reader) +add_subdirectory(lib/Bitcode/Writer) +add_subdirectory(lib/Transforms/Utils) +add_subdirectory(lib/Transforms/Instrumentation) +add_subdirectory(lib/Transforms/Scalar) +add_subdirectory(lib/Transforms/IPO) +add_subdirectory(lib/Transforms/Hello) +add_subdirectory(lib/Linker) +add_subdirectory(lib/Analysis) +add_subdirectory(lib/Analysis/IPA) +add_subdirectory(lib/Target/X86) +add_subdirectory(lib/Target/X86/AsmPrinter) +add_subdirectory(lib/ExecutionEngine) +add_subdirectory(lib/ExecutionEngine/Interpreter) +add_subdirectory(lib/ExecutionEngine/JIT) +add_subdirectory(lib/Target) +add_subdirectory(lib/AsmParser) +add_subdirectory(lib/Debugger) +# TODO: lib/Target/CBackEnd +add_subdirectory(lib/Archive) + +add_subdirectory(tools) + +add_subdirectory(examples) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake new file mode 100755 index 0000000000..6cd88da0bc --- /dev/null +++ b/cmake/config-ix.cmake @@ -0,0 +1,93 @@ + +# include checks +include(CheckIncludeFile) +check_include_file(argz.h HAVE_ARGZ_H) +check_include_file(assert.h HAVE_ASSERT_H) +check_include_file(dirent.h HAVE_DIRENT_H) +check_include_file(dl.h HAVE_DL_H) +check_include_file(dld.h HAVE_DLD_H) +check_include_file(dlfcn.h HAVE_DLFCN_H) +check_include_file(errno.h HAVE_ERRNO_H) +check_include_file(execinfo.h HAVE_EXECINFO_H) +check_include_file(fcntl.h HAVE_FCNTL_H) +check_include_file(inttypes.h HAVE_INTTYPES_H) +check_include_file(limits.h HAVE_LIMITS_H) +check_include_file(link.h HAVE_LINK_H) +check_include_file(malloc.h HAVE_MALLOC_H) +check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H) +check_include_file(memory.h HAVE_MEMORY_H) +check_include_file(ndir.h HAVE_NDIR_H) +check_include_file(pthread.h HAVE_PTHREAD_H) +check_include_file(setjmp.h HAVE_SETJMP_H) +check_include_file(signal.h HAVE_SIGNAL_H) +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(stdio.h HAVE_STDIO_H) +check_include_file(stdlib.h HAVE_STDLIB_H) +check_include_file(sys/dir.h HAVE_SYS_DIR_H) +check_include_file(sys/dl.h HAVE_SYS_DL_H) +check_include_file(sys/mman.h HAVE_SYS_MMAN_H) +check_include_file(sys/ndir.h HAVE_SYS_NDIR_H) +check_include_file(sys/param.h HAVE_SYS_PARAM_H) +check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H) +check_include_file(sys/stat.h HAVE_SYS_STAT_H) +check_include_file(sys/time.h HAVE_SYS_TIME_H) +check_include_file(sys/types.h HAVE_SYS_TYPES_H) +check_include_file(unistd.h HAVE_UNISTD_H) +check_include_file(utime.h HAVE_UTIME_H) + +# function checks +include(CheckSymbolExists) +check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE) +check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE) +check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT) +check_symbol_exists(isinf cmath HAVE_ISINF_IN_CMATH) +check_symbol_exists(isinf math.h HAVE_ISINF_IN_MATH_H) +check_symbol_exists(isnan cmath HAVE_ISNAN_IN_CMATH) +check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H) +check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) +check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK) + +if( MINGW ) + # tbi: Comprobar que existen las librerias: + set(HAVE_LIBIMAGEHLP 1) + set(HAVE_LIBPSAPI 1) + # include(CheckLibraryExists) + # CHECK_LIBRARY_EXISTS(imagehlp ??? . HAVE_LIBIMAGEHLP) +endif( MINGW ) + +# Classes +include(CheckCxxHashmap) +include(CheckCxxHashset) +check_hashmap() +check_hashset() + +# FIXME: Signal handler return type, currently hardcoded to 'void' +set(RETSIGTYPE void) + +# Disable multithreading for now +set(ENABLE_THREADS 0) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/Config/config.h.cmake + ${LLVM_BINARY_DIR}/include/llvm/Config/config.h + ) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/ADT/iterator.cmake + ${LLVM_BINARY_DIR}/include/llvm/ADT/iterator.h + ) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/Support/DataTypes.h.cmake + ${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h + ) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/ADT/hash_map.cmake + ${LLVM_BINARY_DIR}/include/llvm/ADT/hash_map.h + ) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/ADT/hash_set.cmake + ${LLVM_BINARY_DIR}/include/llvm/ADT/hash_set.h + ) diff --git a/cmake/config-w32.cmake b/cmake/config-w32.cmake new file mode 100755 index 0000000000..208e77628c --- /dev/null +++ b/cmake/config-w32.cmake @@ -0,0 +1,9 @@ +# tbi: Configurar ficheros. +configure_file(${llvm_include_path}/llvm/ADT/hash_map.h.in ${llvm_builded_incs_dir}/ADT/hash_map.h) +configure_file(${llvm_include_path}/llvm/ADT/hash_set.h.in ${llvm_builded_incs_dir}/ADT/hash_set.h) +configure_file(${llvm_include_path}/llvm/ADT/iterator.h.in ${llvm_builded_incs_dir}/ADT/iterator.h) +configure_file(${llvm_include_path}/llvm/Support/DataTypes.h.in ${llvm_builded_incs_dir}/Support/DataTypes.h) +configure_file(${llvm_include_path}/llvm/Config/config.h.in ${llvm_builded_incs_dir}/Config/config.h) + +file(READ ${llvm_include_path}/../win32/config.h vc_config_text) +file(APPEND ${llvm_builded_incs_dir}/Config/config.h ${vc_config_text}) diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake new file mode 100755 index 0000000000..c3641eacd2 --- /dev/null +++ b/cmake/modules/AddLLVM.cmake @@ -0,0 +1,39 @@ +include(LLVMConfig) + +macro(add_llvm_library name) + add_library( ${name} ${ARGN} ) + set( llvm_libs ${llvm_libs} ${name} PARENT_SCOPE) +endmacro(add_llvm_library name) + + +macro(add_llvm_executable name) + add_executable(${name} ${ARGN}) + if( LLVM_LINK_COMPONENTS ) + llvm_config(${name} ${LLVM_LINK_COMPONENTS}) + endif( LLVM_LINK_COMPONENTS ) + if( MSVC ) + target_link_libraries(${name} ${llvm_libs}) + else( MSVC ) + add_dependencies(${name} llvm-config.target) + set_target_properties(${name} + PROPERTIES + LINK_FLAGS "-L ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}") + if( MINGW ) + target_link_libraries(${name} DbgHelp psapi) + elseif( CMAKE_HOST_UNIX ) + target_link_libraries(${name} dl) + endif( MINGW ) + endif( MSVC ) +endmacro(add_llvm_executable name) + + +macro(add_llvm_tool name) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR}) + add_llvm_executable(${name} ${ARGN}) +endmacro(add_llvm_tool name) + + +macro(add_llvm_example name) +# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_EXAMPLES_BINARY_DIR}) + add_llvm_executable(${name} ${ARGN}) +endmacro(add_llvm_example name) diff --git a/cmake/modules/AddPartiallyLinkedObject.cmake b/cmake/modules/AddPartiallyLinkedObject.cmake new file mode 100755 index 0000000000..b985b3eb28 --- /dev/null +++ b/cmake/modules/AddPartiallyLinkedObject.cmake @@ -0,0 +1,21 @@ + +macro(add_partially_linked_object lib) + if( MSVC ) + add_llvm_library( ${lib} ${ARGN}) + else( MSVC ) + set(pll ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${lib}.o) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib) + add_library( ${lib} STATIC ${ARGN}) + add_custom_command(OUTPUT ${pll} + MESSAGE "Building ${lib}.o..." + DEPENDS ${lib} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib + COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX} + COMMAND ld -r *${CMAKE_CXX_OUTPUT_EXTENSION} -o ${pll} + COMMAND rm -f *${CMAKE_CXX_OUTPUT_EXTENSION} + ) + add_custom_target(${lib}_pll ALL DEPENDS ${pll}) + set( llvm_libs ${llvm_libs} ${pll} PARENT_SCOPE) + endif( MSVC ) +endmacro(add_partially_linked_object lib) diff --git a/cmake/modules/CheckCxxHashmap.cmake b/cmake/modules/CheckCxxHashmap.cmake new file mode 100755 index 0000000000..5f16c0ac44 --- /dev/null +++ b/cmake/modules/CheckCxxHashmap.cmake @@ -0,0 +1,53 @@ +# - Check if for hash_map. +# CHECK_HASHMAP () +# + +include(CheckCXXSourceCompiles) + +macro(CHECK_HASHMAP) + message(STATUS "Checking for C++ hash_map implementation...") + check_cxx_source_compiles(" + #include + int main() { + __gnu_cxx::hash_map t; + } +" + HAVE_GNU_EXT_HASH_MAP + ) + if(HAVE_GNU_EXT_HASH_MAP) + message(STATUS "C++ hash_map found in 'ext' dir in namespace __gnu_cxx::") + endif(HAVE_GNU_EXT_HASH_MAP) + + check_cxx_source_compiles(" + #include + int main() { + std::hash_map t; + } +" + HAVE_STD_EXT_HASH_MAP + ) + if(HAVE_STD_EXT_HASH_MAP) + message(STATUS "C++ hash_map found in 'ext' dir in namespace std::") + endif(HAVE_STD_EXT_HASH_MAP) + + check_cxx_source_compiles(" + #include + int main() { + hash_map t; + } +" + HAVE_GLOBAL_HASH_MAP + ) + if(HAVE_GLOBAL_HASH_MAP) + message(STATUS "C++ hash_map found in global namespace") + endif(HAVE_GLOBAL_HASH_MAP) + + if(NOT HAVE_GNU_EXT_HASH_MAP) + if(NOT HAVE_STD_EXT_HASH_MAP) + if(NOT HAVE_GLOBAL_HASH_MAP) + message(STATUS "C++ hash_map not found") + endif(NOT HAVE_GLOBAL_HASH_MAP) + endif(NOT HAVE_STD_EXT_HASH_MAP) + endif(NOT HAVE_GNU_EXT_HASH_MAP) + +endmacro(CHECK_HASHMAP) diff --git a/cmake/modules/CheckCxxHashset.cmake b/cmake/modules/CheckCxxHashset.cmake new file mode 100755 index 0000000000..940c388127 --- /dev/null +++ b/cmake/modules/CheckCxxHashset.cmake @@ -0,0 +1,52 @@ +# - Check if for hash_set. +# CHECK_HASHSET () +# + +include(CheckCXXSourceCompiles) + +macro(CHECK_HASHSET) + message(STATUS "Checking for C++ hash_set implementation...") + check_cxx_source_compiles(" + #include + int main() { + __gnu_cxx::hash_set t; + } +" + HAVE_GNU_EXT_HASH_SET + ) + if(HAVE_GNU_EXT_HASH_SET) + message(STATUS "C++ hash_set found in 'ext' dir in namespace __gnu_cxx::") + endif(HAVE_GNU_EXT_HASH_SET) + + check_cxx_source_compiles(" + #include + int main() { + std::hash_set t; + } +" + HAVE_STD_EXT_HASH_SET + ) + if(HAVE_STD_EXT_HASH_SET) + message(STATUS "C++ hash_set found in 'ext' dir in namespace std::") + endif(HAVE_STD_EXT_HASH_SET) + + check_cxx_source_compiles(" + #include + int main() { + hash_set t; + } +" + HAVE_GLOBAL_HASH_SET + ) + if(HAVE_GLOBAL_HASH_SET) + message(STATUS "C++ hash_set found in global namespace") + endif(HAVE_GLOBAL_HASH_SET) + + if(NOT HAVE_GNU_EXT_HASH_SET) + if(NOT HAVE_STD_EXT_HASH_SET) + if(NOT HAVE_GLOBAL_HASH_SET) + message(STATUS "C++ hash_set not found") + endif(NOT HAVE_GLOBAL_HASH_SET) + endif(NOT HAVE_STD_EXT_HASH_SET) + endif(NOT HAVE_GNU_EXT_HASH_SET) +endmacro(CHECK_HASHSET) diff --git a/cmake/modules/FindBison.cmake b/cmake/modules/FindBison.cmake new file mode 100755 index 0000000000..0320ae3ce1 --- /dev/null +++ b/cmake/modules/FindBison.cmake @@ -0,0 +1,52 @@ +# - Try to find Bison +# Once done this will define +# +# BISON_FOUND - system has Bison +# BISON_EXECUTABLE - path of the bison executable +# BISON_VERSION - the version string, like "2.5.31" +# + +MACRO(FIND_BISON) + FIND_PROGRAM(BISON_EXECUTABLE NAMES bison) + + IF(BISON_EXECUTABLE) + SET(BISON_FOUND TRUE) + + EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version + OUTPUT_VARIABLE _BISON_VERSION + ) + string (REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" BISON_VERSION "${_bison_VERSION}") + ENDIF(BISON_EXECUTABLE) + + IF(BISON_FOUND) + IF(NOT Bison_FIND_QUIETLY) + MESSAGE(STATUS "Found Bison: ${BISON_EXECUTABLE}") + ENDIF(NOT Bison_FIND_QUIETLY) + ELSE(BISON_FOUND) + IF(Bison_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find Bison") + ENDIF(Bison_FIND_REQUIRED) + ENDIF(BISON_FOUND) +ENDMACRO(FIND_BISON) + +MACRO(BISON_GENERATOR _PREFIX _Y_INPUT _H_OUTPUT _CPP_OUTPUT) + IF(BISON_EXECUTABLE) + GET_FILENAME_COMPONENT(_Y_DIR ${_Y_INPUT} PATH) + ADD_CUSTOM_COMMAND( + OUTPUT ${_CPP_OUTPUT} + OUTPUT ${_H_OUTPUT} + DEPENDS ${_Y_INPUT} + COMMAND ${BISON_EXECUTABLE} + ARGS + -p ${_PREFIX} -o"${_CPP_OUTPUT}" + --defines="${_H_OUTPUT}" ${_Y_INPUT} + WORKING_DIRECTORY ${_Y_DIR} + ) + SET_SOURCE_FILES_PROPERTIES( + ${_CPP_OUTPUT} ${_H_OUTPUT} + GENERATED + ) + ELSE(BISON_EXECUTABLE) + MESSAGE(SEND_ERROR "Can't find bison program, and it's required") + ENDIF(BISON_EXECUTABLE) +ENDMACRO(BISON_GENERATOR) diff --git a/cmake/modules/LLVMConfig.cmake b/cmake/modules/LLVMConfig.cmake new file mode 100755 index 0000000000..f87d16cd1f --- /dev/null +++ b/cmake/modules/LLVMConfig.cmake @@ -0,0 +1,57 @@ +macro(llvm_config executable link_components) + if( MSVC ) + msvc_llvm_config(${executable} ${link_components}) + else( MSVC ) + nix_llvm_config(${executable} ${link_components}) + endif( MSVC ) +endmacro(llvm_config executable link_components) + + +macro(msvc_llvm_config executable link_components) + foreach(c ${link_components}) + message(STATUS ${c}) + if( c STREQUAL "jit" ) + message(STATUS "linking jit") + set_target_properties(${executable} + PROPERTIES + LINK_FLAGS "/INCLUDE:_X86TargetMachineModule") + endif( c STREQUAL "jit" ) + endforeach(c) + target_link_libraries(${executable} ${llvm_libs}) +endmacro(msvc_llvm_config executable link_components) + + +macro(nix_llvm_config executable link_components) + set(lc "") + foreach(c ${LLVM_LINK_COMPONENTS}) + set(lc "${lc} ${c}") + endforeach(c) + if( NOT HAVE_LLVM_CONFIG ) + target_link_libraries(${executable} + "`${LLVM_TOOLS_BINARY_DIR}/llvm-config --libs ${lc}`") + else( NOT HAVE_LLVM_CONFIG ) + # tbi: Error handling. + if( NOT PERL_FOUND ) + message(FATAL_ERROR "Perl required but not found!") + endif( NOT PERL_FOUND ) + execute_process( + COMMAND sh -c "${PERL_EXECUTABLE} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/llvm-config --libs ${lc}" + RESULT_VARIABLE rv + OUTPUT_VARIABLE libs + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT rv EQUAL 0) + message(FATAL_ERROR "llvm-config failed for executable ${executable}") + endif(NOT rv EQUAL 0) + string(REPLACE " " ";" libs ${libs}) + foreach(c ${libs}) + if(c MATCHES ".*\\.o") + get_filename_component(fn ${c} NAME) + target_link_libraries(${executable} + ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${fn}) + else(c MATCHES ".*\\.o") + string(REPLACE "-l" "" fn ${c}) + target_link_libraries(${executable} ${fn}) + endif(c MATCHES ".*\\.o") + endforeach(c) + endif( NOT HAVE_LLVM_CONFIG ) +endmacro(nix_llvm_config executable link_components) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000000..392e59d989 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(Fibonacci) \ No newline at end of file diff --git a/examples/Fibonacci/CMakeLists.txt b/examples/Fibonacci/CMakeLists.txt new file mode 100644 index 0000000000..693761241f --- /dev/null +++ b/examples/Fibonacci/CMakeLists.txt @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS jit interpreter nativecodegen) + +add_llvm_example(Fibonacci + fibonacci.cpp + ) diff --git a/include/llvm/ADT/hash_map.cmake b/include/llvm/ADT/hash_map.cmake new file mode 100644 index 0000000000..b5d2aa8e00 --- /dev/null +++ b/include/llvm/ADT/hash_map.cmake @@ -0,0 +1,150 @@ +//===-- llvm/ADT/hash_map - "Portable" wrapper around hash_map --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file provides a wrapper around the mysterious header file +// that seems to move around between GCC releases into and out of namespaces at +// will. #including this header will cause hash_map to be available in the +// global namespace. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_HASH_MAP +#define LLVM_ADT_HASH_MAP + +// Compiler Support Matrix +// +// Version Namespace Header File +// 2.95.x :: hash_map +// 3.0.4 std ext/hash_map +// 3.1 __gnu_cxx ext/hash_map +// HP aCC6 std stdex/rw/hashm*ap.h +// MS VC++ stdext hash_map + +#cmakedefine HAVE_GNU_EXT_HASH_MAP +#cmakedefine HAVE_STD_EXT_HASH_MAP +#cmakedefine HAVE_GLOBAL_HASH_MAP +#cmakedefine HAVE_RW_STDEX_HASH_MAP_H + +#if defined(HAVE_GNU_EXT_HASH_MAP) +// This is for GCC-3.1+ which puts hash in ext/hash_map +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE __gnu_cxx +# endif + +// GCC 3.0.x puts hash_map in and in the std namespace. +#elif defined(HAVE_STD_EXT_HASH_MAP) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE std +# endif + +// Older compilers such as GCC before version 3.0 do not keep +// extensions in the `ext' directory, and ignore the `std' namespace. +#elif defined(HAVE_GLOBAL_HASH_MAP) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE std +# endif + +// HP aCC doesn't include an SGI-like hash_map. For this platform (or +// any others using Rogue Wave Software's Tools.h++ library), we wrap +// around them in std:: +#elif defined(HAVE_RW_STDEX_HASH_MAP_H) +# include +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE std +# endif + +// Support Microsoft VC++. +#elif defined(_MSC_VER) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE stdext + using std::_Distance; +# endif + +// Give a warning if we couldn't find it, instead of (or in addition to) +// randomly doing something dumb. +#else +# warning "Autoconfiguration failed to find the hash_map header file." +#endif + +// we wrap Rogue Wave Tools.h++ rw_hashmap into something SGI-looking, here: +#ifdef HAVE_RW_STDEX_HASH_MAP_H +namespace HASH_NAMESPACE { + +template struct hash { + unsigned int operator()(const unsigned int& x) const { + return x; + } +}; + +template , + class _EqualKey = equal_to, + class _A = allocator > +class hash_map : public rw_hashmap { +}; + +template , + class _EqualKey = equal_to, + class _A = allocator > +class hash_multimap : public rw_hashmultimap { +}; + +} // end HASH_NAMESPACE; +#endif + +// Include vector because ext/hash_map includes stl_vector.h and leaves +// out specializations like stl_bvector.h, causing link conflicts. +#include + +#ifdef _MSC_VER + +// GCC and VC++ have differing ways of implementing hash_maps. As it's not +// standardized, that's to be expected. This adapter class allows VC++ +// hash_map to use GCC's hash classes. +namespace stdext { + template struct hash; + + // Provide a hash function for unsigned ints... + template<> struct hash { + inline size_t operator()(unsigned int Val) const { + return Val; + } + }; + + template class hash_compare > { + std::less comp; + public: + enum { bucket_size = 4 }; + enum { min_buckets = 8 }; + hash_compare() {} + hash_compare(std::less pred) : comp(pred) {} + size_t operator()(const Key& key) const { return hash()(key); } + bool operator()(const Key& k1, const Key& k2) const { return comp(k1, k2); } + }; +} + +#endif + +using HASH_NAMESPACE::hash_map; +using HASH_NAMESPACE::hash_multimap; +using HASH_NAMESPACE::hash; + +#include "llvm/ADT/HashExtras.h" + +#endif diff --git a/include/llvm/ADT/hash_set.cmake b/include/llvm/ADT/hash_set.cmake new file mode 100644 index 0000000000..5a2ffae68e --- /dev/null +++ b/include/llvm/ADT/hash_set.cmake @@ -0,0 +1,111 @@ +//===-- llvm/ADT/hash_set - "Portable" wrapper around hash_set --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// vim:ft=cpp +// +// This file provides a wrapper around the mysterious header file +// that seems to move around between GCC releases into and out of namespaces at +// will. #including this header will cause hash_set to be available in the +// global namespace. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_HASH_SET +#define LLVM_ADT_HASH_SET + +// Compiler Support Matrix +// +// Version Namespace Header File +// 2.95.x :: hash_set +// 3.0.4 std ext/hash_set +// 3.1 __gnu_cxx ext/hash_set +// HP aCC6 std stdex/rw/hashset.h +// MS VC++ stdext hash_set + +#cmakedefine HAVE_GNU_EXT_HASH_SET +#cmakedefine HAVE_STD_EXT_HASH_SET +#cmakedefine HAVE_GLOBAL_HASH_SET +#cmakedefine HAVE_RW_STDEX_HASH_SET_H + +// GCC versions 3.1 and later put hash_set in and in +// the __gnu_cxx namespace. +#if defined(HAVE_GNU_EXT_HASH_SET) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE __gnu_cxx +# endif + +// GCC 3.0.x puts hash_set in and in the std namespace. +#elif defined(HAVE_STD_EXT_HASH_SET) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE std +# endif + +// Older compilers such as GCC before version 3.0 do not keep +// extensions in the `ext' directory, and ignore the `std' namespace. +#elif defined(HAVE_GLOBAL_HASH_SET) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE std +# endif + +// HP aCC doesn't include an SGI-like hash_set. For this platform (or +// any others using Rogue Wave Software's Tools.h++ library), we wrap +// around them in std:: +#elif defined(HAVE_RW_STDEX_HASH_SET_H) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE std +# endif + +// Support Microsoft VC++. +#elif defined(_MSC_VER) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE stdext +# endif + +// Give a warning if we couldn't find it, instead of (or in addition to) +// randomly doing something dumb. +#else +# warning "Autoconfiguration failed to find the hash_set header file." +#endif + +// we wrap Rogue Wave Tools.h++ rw_hashset into something SGI-looking, here: +#ifdef HAVE_RW_STDEX_HASH_SET_H +namespace HASH_NAMESPACE { + +/* +template struct hash { + unsigned int operator()(const unsigned int& x) const { + return x; + } +}; +*/ + +template , + class _EqualKey = equal_to, + class _A = allocator > +class hash_set : + public rw_hashset { +}; + +} // end HASH_NAMESPACE; +#endif + +using HASH_NAMESPACE::hash_set; + +// Include vector because ext/hash_set includes stl_vector.h and leaves +// out specializations like stl_bvector.h, causing link conflicts. +#include + +#include "llvm/ADT/HashExtras.h" + +#endif diff --git a/include/llvm/ADT/iterator.cmake b/include/llvm/ADT/iterator.cmake new file mode 100644 index 0000000000..55df8ce264 --- /dev/null +++ b/include/llvm/ADT/iterator.cmake @@ -0,0 +1,79 @@ +//===-- llvm/ADT/iterator - Portable wrapper around --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file provides a wrapper around the mysterious header file. +// In GCC 2.95.3, the file defines a bidirectional_iterator class (and other +// friends), instead of the standard iterator class. In GCC 3.1, the +// bidirectional_iterator class got moved out and the new, standards compliant, +// iterator<> class was added. Because there is nothing that we can do to get +// correct behavior on both compilers, we have this header with #ifdef's. Gross +// huh? +// +// By #includ'ing this file, you get the contents of plus the +// following classes in the global namespace: +// +// 1. bidirectional_iterator +// 2. forward_iterator +// +// The #if directives' expressions are filled in by Autoconf. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_ITERATOR +#define LLVM_ADT_ITERATOR + +#include + +#undef HAVE_BI_ITERATOR +#undef HAVE_STD_ITERATOR +#undef HAVE_FWD_ITERATOR + +// defined by Kevin +#define HAVE_STD_ITERATOR 1 + +#ifdef _MSC_VER +# define HAVE_BI_ITERATOR 0 +# define HAVE_STD_ITERATOR 1 +# define HAVE_FWD_ITERATOR 0 +#endif + +#if !HAVE_BI_ITERATOR +# if HAVE_STD_ITERATOR +/// If the bidirectional iterator is not defined, we attempt to define it in +/// terms of the C++ standard iterator. Otherwise, we import it with a "using" +/// statement. +/// +template +struct bidirectional_iterator + : public std::iterator { +}; +# else +# error "Need to have standard iterator to define bidirectional iterator!" +# endif +#else +using std::bidirectional_iterator; +#endif + +#if !HAVE_FWD_ITERATOR +# if HAVE_STD_ITERATOR +/// If the forward iterator is not defined, attempt to define it in terms of +/// the C++ standard iterator. Otherwise, we import it with a "using" statement. +/// +template +struct forward_iterator + : public std::iterator { +}; +# else +# error "Need to have standard iterator to define forward iterator!" +# endif +#else +using std::forward_iterator; +#endif + +#endif diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake new file mode 100644 index 0000000000..028e6076e7 --- /dev/null +++ b/include/llvm/Config/config.h.cmake @@ -0,0 +1,558 @@ + +/************************************** +** Created by Kevin from config.h.in ** +***************************************/ + +/* Define if dlopen(0) will open the symbols of the program */ +#undef CAN_DLOPEN_SELF + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define if CBE is enabled for printf %a output */ +#undef ENABLE_CBE_PRINTF_A + +/* Define if position independent code is enabled */ +#undef ENABLE_PIC + +/* Define if threads enabled */ +#cmakedefine ENABLE_THREADS ${ENABLE_THREADS} + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the `argz_append' function. */ +#undef HAVE_ARGZ_APPEND + +/* Define to 1 if you have the `argz_create_sep' function. */ +#undef HAVE_ARGZ_CREATE_SEP + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ARGZ_H ${HAVE_ARGZ_H} + +/* Define to 1 if you have the `argz_insert' function. */ +#undef HAVE_ARGZ_INSERT + +/* Define to 1 if you have the `argz_next' function. */ +#undef HAVE_ARGZ_NEXT + +/* Define to 1 if you have the `argz_stringify' function. */ +#undef HAVE_ARGZ_STRINGIFY + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ASSERT_H ${HAVE_ASSERT_H} + +/* Define to 1 if you have the `backtrace' function. */ +#undef HAVE_BACKTRACE + +/* Define to 1 if you have the `bcopy' function. */ +#undef HAVE_BCOPY + +/* Does not have bi-directional iterator */ +#undef HAVE_BI_ITERATOR + +/* Define to 1 if you have the `ceilf' function. */ +#undef HAVE_CEILF + +/* Define to 1 if you have the `closedir' function. */ +#undef HAVE_CLOSEDIR + +/* Define to 1 if you have the header file. */ +#undef HAVE_CTYPE_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H} + +/* Define if you have the GNU dld library. */ +#undef HAVE_DLD + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLD_H ${HAVE_DLD_H} + +/* Define to 1 if you have the `dlerror' function. */ +#undef HAVE_DLERROR + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H} + +/* Define if dlopen() is available on this platform. */ +#undef HAVE_DLOPEN + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DL_H ${HAVE_DL_H} + +/* Define if the dot program is available */ +#undef HAVE_DOT + +/* Define if the dotty program is available */ +#undef HAVE_DOTTY + +/* Define if you have the _dyld_func_lookup function. */ +#undef HAVE_DYLD + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ERRNO_H ${HAVE_ERRNO_H} + +/* Define to 1 if the system has the type `error_t'. */ +#undef HAVE_ERROR_T + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_EXECINFO_H ${HAVE_EXECINFO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FCNTL_H ${HAVE_FCNTL_H} + +/* Set to 1 if the finite function is found in */ +#undef HAVE_FINITE_IN_IEEEFP_H + +/* Define to 1 if you have the `floorf' function. */ +#undef HAVE_FLOORF + +/* Does not have forward iterator */ +#undef HAVE_FWD_ITERATOR + +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define to 1 if you have the `getpagesize' function. */ +#cmakedefine HAVE_GETPAGESIZE ${HAVE_GETPAGESIZE} + +/* Define to 1 if you have the `getrlimit' function. */ +#undef HAVE_GETRLIMIT + +/* Define to 1 if you have the `getrusage' function. */ +#cmakedefine HAVE_GETRUSAGE ${HAVE_GETRUSAGE} + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Does not have */ +#undef HAVE_GLOBAL_HASH_MAP + +/* Does not have hash_set in global namespace */ +#undef HAVE_GLOBAL_HASH_SET + +/* Does not have ext/hash_map */ +#undef HAVE_GNU_EXT_HASH_MAP + +/* Does not have hash_set in gnu namespace */ +#undef HAVE_GNU_EXT_HASH_SET + +/* Define if the Graphviz program is available */ +#undef HAVE_GRAPHVIZ + +/* Define if the gv program is available */ +#undef HAVE_GV + +/* Define to 1 if you have the `index' function. */ +#undef HAVE_INDEX + +/* Define to 1 if the system has the type `int64_t'. */ +#undef HAVE_INT64_T + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H} + +/* Define to 1 if you have the `isatty' function. */ +#undef HAVE_ISATTY + +/* Set to 1 if the isinf function is found in */ +#cmakedefine HAVE_ISINF_IN_CMATH ${HAVE_ISINF_IN_CMATH} + +/* Set to 1 if the isinf function is found in */ +#cmakedefine HAVE_ISINF_IN_MATH_H ${HAVE_ISINF_IN_MATH_H} + +/* Set to 1 if the isnan function is found in */ +#cmakedefine HAVE_ISNAN_IN_CMATH ${HAVE_ISNAN_IN_CMATH} + +/* Set to 1 if the isnan function is found in */ +#cmakedefine HAVE_ISNAN_IN_MATH_H ${HAVE_ISNAN_IN_MATH_H} + +/* Define if you have the libdl library or equivalent. */ +#undef HAVE_LIBDL + +/* Define to 1 if you have the `elf' library (-lelf). */ +#undef HAVE_LIBELF + +/* Define to 1 if you have the `imagehlp' library (-limagehlp). */ +#cmakedefine HAVE_LIBIMAGEHLP ${HAVE_LIBIMAGEHLP} + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `psapi' library (-lpsapi). */ +#cmakedefine HAVE_LIBPSAPI ${HAVE_LIBPSAPI} + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD + +/* Define to 1 if you have the `udis86' library (-ludis86). */ +#undef HAVE_LIBUDIS86 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIMITS_H ${HAVE_LIMITS_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LINK_H ${HAVE_LINK_H} + +/* Define if you can use -Wl,-R. to pass -R. to the linker, in order to add + the current directory to the dynamic linker search path. */ +#undef HAVE_LINK_R + +/* Define to 1 if you have the `longjmp' function. */ +#undef HAVE_LONGJMP + +/* Define if lt_dlopen() is available on this platform */ +#undef HAVE_LT_DLOPEN + +/* Define to 1 if you have the header file. */ +#undef HAVE_MACH_MACH_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MACH_O_DYLD_H + +/* Define if mallinfo() is available on this platform. */ +#cmakedefine HAVE_MALLINFO ${HAVE_MALLINFO} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MALLOC_H ${HAVE_MALLOC_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MALLOC_MALLOC_H ${HAVE_MALLOC_MALLOC_H} + +/* Define to 1 if you have the `malloc_zone_statistics' function. */ +#undef HAVE_MALLOC_ZONE_STATISTICS + +/* Define to 1 if you have the `memcpy' function. */ +#undef HAVE_MEMCPY + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MEMORY_H ${HAVE_MEMORY_H} + +/* Define to 1 if you have the `mkdtemp' function. */ +#undef HAVE_MKDTEMP + +/* Define to 1 if you have the `mkstemp' function. */ +#undef HAVE_MKSTEMP + +/* Define to 1 if you have the `mktemp' function. */ +#undef HAVE_MKTEMP + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if + it uses MAP_ANON */ +#undef HAVE_MMAP_ANONYMOUS + +/* Define if mmap() can map files into memory */ +#undef HAVE_MMAP_FILE + +/* define if the compiler implements namespaces */ +#undef HAVE_NAMESPACES + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#cmakedefine HAVE_NDIR_H ${HAVE_NDIR_H} + +/* Define to 1 if you have the `nearbyintf' function. */ +#undef HAVE_NEARBYINTF + +/* Define to 1 if you have the `opendir' function. */ +#undef HAVE_OPENDIR + +/* Define if libtool can extract symbol lists from object files. */ +#undef HAVE_PRELOADED_SYMBOLS + +/* Define to have the %a format string */ +#undef HAVE_PRINTF_A + +/* Have pthread_mutex_lock */ +#cmakedefine HAVE_PTHREAD_MUTEX_LOCK ${HAVE_PTHREAD_MUTEX_LOCK} + +/* Define to 1 if srand48/lrand48/drand48 exist in */ +#undef HAVE_RAND48 + +/* Define to 1 if you have the `readdir' function. */ +#undef HAVE_READDIR + +/* Define to 1 if you have the `realpath' function. */ +#undef HAVE_REALPATH + +/* Define to 1 if you have the `rindex' function. */ +#undef HAVE_RINDEX + +/* Define to 1 if you have the `rintf' function. */ +#undef HAVE_RINTF + +/* Define to 1 if you have the `roundf' function. */ +#undef HAVE_ROUNDF + +/* Define to 1 if you have the `sbrk' function. */ +#undef HAVE_SBRK + +/* Define to 1 if you have the `setjmp' function. */ +#undef HAVE_SETJMP + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SETJMP_H ${HAVE_SETJMP_H} + +/* Define to 1 if you have the `setrlimit' function. */ +#cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT} + +/* Define if you have the shl_load function. */ +#undef HAVE_SHL_LOAD + +/* Define to 1 if you have the `siglongjmp' function. */ +#undef HAVE_SIGLONGJMP + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H} + +/* Define to 1 if you have the `sigsetjmp' function. */ +#undef HAVE_SIGSETJMP + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDIO_H ${HAVE_STDIO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDLIB_H ${HAVE_STDLIB_H} + +/* Does not have ext/hash_map> */ +#undef HAVE_STD_EXT_HASH_MAP + +/* Does not have hash_set in std namespace */ +#undef HAVE_STD_EXT_HASH_SET + +/* Set to 1 if the std::isinf function is found in */ +#undef HAVE_STD_ISINF_IN_CMATH + +/* Set to 1 if the std::isnan function is found in */ +#undef HAVE_STD_ISNAN_IN_CMATH + +/* Does not have std namespace iterator */ +#undef HAVE_STD_ITERATOR + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strcmp' function. */ +#undef HAVE_STRCMP + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the `strerror_r' function. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strrchr' function. */ +#undef HAVE_STRRCHR + +/* Define to 1 if you have the `strtoll' function. */ +#undef HAVE_STRTOLL + +/* Define to 1 if you have the `strtoq' function. */ +#undef HAVE_STRTOQ + +/* Define to 1 if you have the `sysconf' function. */ +#undef HAVE_SYSCONF + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#cmakedefine HAVE_SYS_DIR_H ${HAVE_SYS_DIR_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_DL_H ${HAVE_SYS_DL_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_MMAN_H ${} + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#cmakedefine HAVE_SYS_NDIR_H ${HAVE_SYS_NDIR_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_PARAM_H ${HAVE_SYS_PARAM_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H} + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if the system has the type `uint64_t'. */ +#undef HAVE_UINT64_T + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UTIME_H ${HAVE_UTIME_H} + +/* Define to 1 if the system has the type `u_int64_t'. */ +#undef HAVE_U_INT64_T + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINDOWS_H + +/* Installation directory for binary executables */ +#undef LLVM_BINDIR + +/* Time at which LLVM was configured */ +#undef LLVM_CONFIGTIME + +/* Installation directory for documentation */ +#undef LLVM_DATADIR + +/* Installation directory for config files */ +#undef LLVM_ETCDIR + +/* Installation directory for include files */ +#undef LLVM_INCLUDEDIR + +/* Installation directory for .info files */ +#undef LLVM_INFODIR + +/* Installation directory for libraries */ +#undef LLVM_LIBDIR + +/* Installation directory for man pages */ +#undef LLVM_MANDIR + +/* Define if this is Unixish platform */ +#cmakedefine LLVM_ON_UNIX ${LLVM_ON_UNIX} + +/* Define if this is Win32ish platform */ +#cmakedefine LLVM_ON_WIN32 ${LLVM_ON_WIN32} + +/* Added by Kevin -- Maximum path length */ +#cmakedefine MAXPATHLEN ${MAXPATHLEN} + +/* Define to path to dot program if found or 'echo dot' otherwise */ +#undef LLVM_PATH_DOT + +/* Define to path to dotty program if found or 'echo dotty' otherwise */ +#undef LLVM_PATH_DOTTY + +/* Define to path to Graphviz program if found or 'echo Graphviz' otherwise */ +#undef LLVM_PATH_GRAPHVIZ + +/* Define to path to gv program if found or 'echo gv' otherwise */ +#undef LLVM_PATH_GV + +/* Installation prefix directory */ +#undef LLVM_PREFIX + +/* Define if the OS needs help to load dependent libraries for dlopen(). */ +#undef LTDL_DLOPEN_DEPLIBS + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LTDL_OBJDIR + +/* Define to the name of the environment variable that determines the dynamic + library search path. */ +#undef LTDL_SHLIBPATH_VAR + +/* Define to the extension used for shared libraries, say, ".so". */ +#cmakedefine LTDL_SHLIB_EXT "${LTDL_SHLIB_EXT}" + +/* Define to the system default library search path. */ +#undef LTDL_SYSSEARCHPATH + +/* Define if /dev/zero should be used when mapping RWX memory, or undefine if + its not necessary */ +#undef NEED_DEV_ZERO_FOR_MMAP + +/* Define if dlsym() requires a leading underscore in symbol names. */ +#undef NEED_USCORE + +/* Define to the address where bug reports for this package should be sent. */ +#cmakedefine PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}" + +/* Define to the full name of this package. */ +#cmakedefine PACKAGE_NAME "${PACKAGE_NAME}" + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}" + +/* Define as the return type of signal handlers (`int' or `void'). */ +#cmakedefine RETSIGTYPE ${RETSIGTYPE} + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if the `S_IS*' macros in do not work properly. */ +#undef STAT_MACROS_BROKEN + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define to 1 if your declares `struct tm'. */ +#undef TM_IN_SYS_TIME + +/* Define if use udis86 library */ +#undef USE_UDIS86 + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to a type to use for `error_t' if it is not otherwise available. */ +#undef error_t + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t diff --git a/include/llvm/Support/DataTypes.h.cmake b/include/llvm/Support/DataTypes.h.cmake new file mode 100644 index 0000000000..ad4b1836ad --- /dev/null +++ b/include/llvm/Support/DataTypes.h.cmake @@ -0,0 +1,134 @@ +//===-- include/Support/DataTypes.h - Define fixed size types ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains definitions to figure out the size of _HOST_ data types. +// This file is important because different host OS's define different macros, +// which makes portability tough. This file exports the following definitions: +// +// [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types +// [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. +// +// No library is required when using these functinons. +// +//===----------------------------------------------------------------------===// + +#ifndef SUPPORT_DATATYPES_H +#define SUPPORT_DATATYPES_H + +#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H} +#cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H} +#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H} +#undef HAVE_UINT64_T +#undef HAVE_U_INT64_T + +// FIXME: UGLY HACK (Added by Kevin) +#define HAVE_UINT64_T 1 + +#ifndef _MSC_VER + +// Note that this header's correct operation depends on __STDC_LIMIT_MACROS +// being defined. We would define it here, but in order to prevent Bad Things +// happening when system headers or C++ STL headers include stdint.h before +// we define it here, we define it on the g++ command line (in Makefile.rules). +#if !defined(__STDC_LIMIT_MACROS) +# error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h" +#endif + +// Note that includes , if this is a C99 system. +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_INTTYPES_H +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef __cplusplus +#include +#else +#include +#endif + +#ifdef _AIX +#include "llvm/Support/AIXDataTypesFix.h" +#endif + +// Handle incorrect definition of uint64_t as u_int64_t +#ifndef HAVE_UINT64_T +#ifdef HAVE_U_INT64_T +typedef u_int64_t uint64_t; +#else +# error "Don't have a definition for uint64_t on this platform" +#endif +#endif + +#ifdef _OpenBSD_ +#define INT8_MAX 127 +#define INT8_MIN -128 +#define UINT8_MAX 255 +#define INT16_MAX 32767 +#define INT16_MIN -32768 +#define UINT16_MAX 65535 +#define INT32_MAX 2147483647 +#define INT32_MIN -2147483648 +#define UINT32_MAX 4294967295U +#endif + +#else /* _MSC_VER */ +// Visual C++ doesn't provide standard integer headers, but it does provide +// built-in data types. +#include +#include +#include +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed int ssize_t; +#define INT8_MAX 127 +#define INT8_MIN -128 +#define UINT8_MAX 255 +#define INT16_MAX 32767 +#define INT16_MIN -32768 +#define UINT16_MAX 65535 +#define INT32_MAX 2147483647 +#define INT32_MIN -2147483648 +#define UINT32_MAX 4294967295U +#endif /* _MSC_VER */ + +/* Set defaults for constants which we cannot find. */ +#if !defined(INT64_MAX) +# define INT64_MAX 9223372036854775807LL +#endif +#if !defined(INT64_MIN) +# define INT64_MIN ((-INT64_MAX)-1) +#endif +#if !defined(UINT64_MAX) +# define UINT64_MAX 0xffffffffffffffffULL +#endif + +#if __GNUC__ > 3 +#define END_WITH_NULL __attribute__((sentinel)) +#else +#define END_WITH_NULL +#endif + +#ifndef HUGE_VALF +#define HUGE_VALF (float)HUGE_VAL +#endif + +#endif /* SUPPORT_DATATYPES_H */ diff --git a/lib/Analysis/CMakeLists.txt b/lib/Analysis/CMakeLists.txt new file mode 100644 index 0000000000..6dabaf99d0 --- /dev/null +++ b/lib/Analysis/CMakeLists.txt @@ -0,0 +1,29 @@ +add_llvm_library(LLVMAnalysis + AliasAnalysis.cpp + AliasAnalysisCounter.cpp + AliasAnalysisEvaluator.cpp + AliasDebugger.cpp + AliasSetTracker.cpp + Analysis.cpp + BasicAliasAnalysis.cpp + CFGPrinter.cpp + ConstantFolding.cpp + InstCount.cpp + Interval.cpp + IntervalPartition.cpp + LibCallAliasAnalysis.cpp + LibCallSemantics.cpp + LoopInfo.cpp + LoopPass.cpp + LoopVR.cpp + MemoryDependenceAnalysis.cpp + PostDominators.cpp + ProfileInfo.cpp + ProfileInfoLoader.cpp + ProfileInfoLoaderPass.cpp + ScalarEvolution.cpp + ScalarEvolutionExpander.cpp + SparsePropagation.cpp + Trace.cpp + ValueTracking.cpp + ) diff --git a/lib/Analysis/IPA/CMakeLists.txt b/lib/Analysis/IPA/CMakeLists.txt new file mode 100644 index 0000000000..1ebb0bea36 --- /dev/null +++ b/lib/Analysis/IPA/CMakeLists.txt @@ -0,0 +1,7 @@ +add_llvm_library(LLVMipa + Andersens.cpp + CallGraph.cpp + CallGraphSCCPass.cpp + FindUsedTypes.cpp + GlobalsModRef.cpp + ) diff --git a/lib/Archive/CMakeLists.txt b/lib/Archive/CMakeLists.txt new file mode 100644 index 0000000000..27698cb171 --- /dev/null +++ b/lib/Archive/CMakeLists.txt @@ -0,0 +1,5 @@ +add_llvm_library(LLVMArchive + Archive.cpp + ArchiveReader.cpp + ArchiveWriter.cpp + ) \ No newline at end of file diff --git a/lib/AsmParser/CMakeLists.txt b/lib/AsmParser/CMakeLists.txt new file mode 100644 index 0000000000..c12f414d8e --- /dev/null +++ b/lib/AsmParser/CMakeLists.txt @@ -0,0 +1,15 @@ +# AsmParser, with a Bison generated parser: +include(FindBison) +find_bison() +bison_generator( + "llvmAsm" + "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.y" + "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.h" + "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.cpp" + ) + +add_llvm_library(LLVMAsmParser + llvmAsmParser.cpp # Generated from llvmAsmParser.y + LLLexer.cpp + Parser.cpp + ) diff --git a/lib/Bitcode/Reader/CMakeLists.txt b/lib/Bitcode/Reader/CMakeLists.txt new file mode 100644 index 0000000000..a19c79aacf --- /dev/null +++ b/lib/Bitcode/Reader/CMakeLists.txt @@ -0,0 +1,7 @@ +add_llvm_library(LLVMBitReader + BitReader.cpp + BitcodeReader.cpp + Deserialize.cpp + DeserializeAPFloat.cpp + DeserializeAPInt.cpp + ) \ No newline at end of file diff --git a/lib/Bitcode/Writer/CMakeLists.txt b/lib/Bitcode/Writer/CMakeLists.txt new file mode 100644 index 0000000000..ac5bb991af --- /dev/null +++ b/lib/Bitcode/Writer/CMakeLists.txt @@ -0,0 +1,9 @@ +add_llvm_library(LLVMBitWriter + BitWriter.cpp + BitcodeWriter.cpp + BitcodeWriterPass.cpp + Serialize.cpp + SerializeAPFloat.cpp + SerializeAPInt.cpp + ValueEnumerator.cpp + ) diff --git a/lib/CodeGen/AsmPrinter/CMakeLists.txt b/lib/CodeGen/AsmPrinter/CMakeLists.txt new file mode 100644 index 0000000000..7ed5f97dbd --- /dev/null +++ b/lib/CodeGen/AsmPrinter/CMakeLists.txt @@ -0,0 +1,5 @@ +add_llvm_library(LLVMAsmPrinter + AsmPrinter.cpp + DwarfWriter.cpp + OcamlGCPrinter.cpp + ) diff --git a/lib/CodeGen/CMakeLists.txt b/lib/CodeGen/CMakeLists.txt new file mode 100644 index 0000000000..5d15746c0f --- /dev/null +++ b/lib/CodeGen/CMakeLists.txt @@ -0,0 +1,48 @@ +add_llvm_library(LLVMCodeGen + BranchFolding.cpp + DeadMachineInstructionElim.cpp + ELFWriter.cpp + GCMetadata.cpp + GCMetadataPrinter.cpp + GCStrategy.cpp + IfConversion.cpp + IntrinsicLowering.cpp + LLVMTargetMachine.cpp + LiveInterval.cpp + LiveIntervalAnalysis.cpp + LiveStackAnalysis.cpp + LiveVariables.cpp + LoopAligner.cpp + LowerSubregs.cpp + MachOWriter.cpp + MachineBasicBlock.cpp + MachineDominators.cpp + MachineFunction.cpp + MachineInstr.cpp + MachineLICM.cpp + MachineLoopInfo.cpp + MachineModuleInfo.cpp + MachinePassRegistry.cpp + MachineRegisterInfo.cpp + MachineSink.cpp + OcamlGC.cpp + PHIElimination.cpp + Passes.cpp + PostRASchedulerList.cpp + PrologEpilogInserter.cpp + PseudoSourceValue.cpp + RegAllocBigBlock.cpp + RegAllocLinearScan.cpp + RegAllocLocal.cpp + RegAllocSimple.cpp + RegisterCoalescer.cpp + RegisterScavenging.cpp + ShadowStackGC.cpp + SimpleRegisterCoalescing.cpp + StackSlotColoring.cpp + StrongPHIElimination.cpp + TargetInstrInfoImpl.cpp + TwoAddressInstructionPass.cpp + UnreachableBlockElim.cpp + VirtRegMap.cpp + ) diff --git a/lib/CodeGen/SelectionDAG/CMakeLists.txt b/lib/CodeGen/SelectionDAG/CMakeLists.txt new file mode 100644 index 0000000000..dad932bf37 --- /dev/null +++ b/lib/CodeGen/SelectionDAG/CMakeLists.txt @@ -0,0 +1,21 @@ +add_llvm_library(LLVMSelectionDAG + CallingConvLower.cpp + DAGCombiner.cpp + FastISel.cpp + LegalizeDAG.cpp + LegalizeFloatTypes.cpp + LegalizeIntegerTypes.cpp + LegalizeTypes.cpp + LegalizeTypesGeneric.cpp + LegalizeVectorTypes.cpp + ScheduleDAG.cpp + ScheduleDAGEmit.cpp + ScheduleDAGFast.cpp + ScheduleDAGList.cpp + ScheduleDAGRRList.cpp + SelectionDAGBuild.cpp + SelectionDAG.cpp + SelectionDAGISel.cpp + SelectionDAGPrinter.cpp + TargetLowering.cpp + ) diff --git a/lib/Debugger/CMakeLists.txt b/lib/Debugger/CMakeLists.txt new file mode 100644 index 0000000000..d2508cf4c2 --- /dev/null +++ b/lib/Debugger/CMakeLists.txt @@ -0,0 +1,10 @@ +add_llvm_library(LLVMDebugger + Debugger.cpp + ProgramInfo.cpp + RuntimeInfo.cpp + SourceFile.cpp + SourceLanguage-CFamily.cpp + SourceLanguage-CPlusPlus.cpp + SourceLanguage-Unknown.cpp + SourceLanguage.cpp + ) diff --git a/lib/ExecutionEngine/CMakeLists.txt b/lib/ExecutionEngine/CMakeLists.txt new file mode 100644 index 0000000000..0e118ccd90 --- /dev/null +++ b/lib/ExecutionEngine/CMakeLists.txt @@ -0,0 +1,4 @@ +add_llvm_library(LLVMExecutionEngine + ExecutionEngine.cpp + ExecutionEngineBindings.cpp + ) diff --git a/lib/ExecutionEngine/Interpreter/CMakeLists.txt b/lib/ExecutionEngine/Interpreter/CMakeLists.txt new file mode 100644 index 0000000000..626e804e78 --- /dev/null +++ b/lib/ExecutionEngine/Interpreter/CMakeLists.txt @@ -0,0 +1,5 @@ +add_partially_linked_object(LLVMInterpreter + Execution.cpp + ExternalFunctions.cpp + Interpreter.cpp + ) diff --git a/lib/ExecutionEngine/JIT/CMakeLists.txt b/lib/ExecutionEngine/JIT/CMakeLists.txt new file mode 100644 index 0000000000..d7980d0772 --- /dev/null +++ b/lib/ExecutionEngine/JIT/CMakeLists.txt @@ -0,0 +1,11 @@ +# TODO: Support other architectures. See Makefile. +add_definitions(-DENABLE_X86_JIT) + +add_partially_linked_object(LLVMJIT + Intercept.cpp + JIT.cpp + JITDwarfEmitter.cpp + JITEmitter.cpp + JITMemoryManager.cpp + TargetSelect.cpp + ) diff --git a/lib/Linker/CMakeLists.txt b/lib/Linker/CMakeLists.txt new file mode 100644 index 0000000000..0b6d2f4218 --- /dev/null +++ b/lib/Linker/CMakeLists.txt @@ -0,0 +1,6 @@ +add_llvm_library(LLVMLinker + LinkArchives.cpp + LinkItems.cpp + LinkModules.cpp + Linker.cpp + ) diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt new file mode 100644 index 0000000000..e27a651269 --- /dev/null +++ b/lib/Support/CMakeLists.txt @@ -0,0 +1,29 @@ +add_llvm_library(LLVMSupport + APFloat.cpp + APInt.cpp + APSInt.cpp + Allocator.cpp + Annotation.cpp + CommandLine.cpp + ConstantRange.cpp + Debug.cpp + Dwarf.cpp + FileUtilities.cpp + FoldingSet.cpp + GraphWriter.cpp + IsInf.cpp + IsNAN.cpp + ManagedStatic.cpp + MemoryBuffer.cpp + PluginLoader.cpp + SlowOperationInformer.cpp + SmallPtrSet.cpp + Statistic.cpp + Streams.cpp + StringExtras.cpp + StringMap.cpp + StringPool.cpp + SystemUtils.cpp + Timer.cpp + raw_ostream.cpp + ) diff --git a/lib/System/CMakeLists.txt b/lib/System/CMakeLists.txt new file mode 100644 index 0000000000..9ac663e84f --- /dev/null +++ b/lib/System/CMakeLists.txt @@ -0,0 +1,13 @@ +add_llvm_library(LLVMSystem + Alarm.cpp + Disassembler.cpp + DynamicLibrary.cpp + IncludeFile.cpp + Memory.cpp + Mutex.cpp + Path.cpp + Process.cpp + Program.cpp + Signals.cpp + TimeValue.cpp + ) diff --git a/lib/Target/CMakeLists.txt b/lib/Target/CMakeLists.txt new file mode 100644 index 0000000000..1cf0a91078 --- /dev/null +++ b/lib/Target/CMakeLists.txt @@ -0,0 +1,17 @@ +add_llvm_library(LLVMTarget + DarwinTargetAsmInfo.cpp + ELFTargetAsmInfo.cpp + SubtargetFeature.cpp + Target.cpp + TargetAsmInfo.cpp + TargetData.cpp + TargetFrameInfo.cpp + TargetInstrInfo.cpp + TargetMachOWriterInfo.cpp + TargetMachine.cpp + TargetMachineRegistry.cpp + TargetRegisterInfo.cpp + TargetSubtarget.cpp + ) + +# TODO: Support other targets besides X86. See Makefile. \ No newline at end of file diff --git a/lib/Target/X86/AsmPrinter/CMakeLists.txt b/lib/Target/X86/AsmPrinter/CMakeLists.txt new file mode 100644 index 0000000000..ca4acb23c6 --- /dev/null +++ b/lib/Target/X86/AsmPrinter/CMakeLists.txt @@ -0,0 +1,7 @@ +include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. ) + +add_llvm_library(LLVMX86AsmPrinter + X86ATTAsmPrinter.cpp + X86AsmPrinter.cpp + X86IntelAsmPrinter.cpp + ) diff --git a/lib/Target/X86/CMakeLists.txt b/lib/Target/X86/CMakeLists.txt new file mode 100644 index 0000000000..de8ff2cd5d --- /dev/null +++ b/lib/Target/X86/CMakeLists.txt @@ -0,0 +1,56 @@ +macro(x86tgen ofn) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} + COMMAND tblgen ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${llvm_include_path} ${CMAKE_CURRENT_SOURCE_DIR}/X86.td -o ${ofn} + DEPENDS tblgen ${CMAKE_CURRENT_SOURCE_DIR}/X86.td + COMMENT "Building ${ofn}..." + ) +endmacro(x86tgen) + +x86tgen(X86GenRegisterInfo.h.inc -gen-register-desc-header) +x86tgen(X86GenRegisterNames.inc -gen-register-enums) +x86tgen(X86GenRegisterInfo.inc -gen-register-desc) +x86tgen(X86GenInstrNames.inc -gen-instr-enums) +x86tgen(X86GenInstrInfo.inc -gen-instr-desc) +x86tgen(X86GenAsmWriter.inc -gen-asm-writer) +x86tgen(X86GenAsmWriter1.inc -gen-asm-writer -asmwriternum=1) +x86tgen(X86GenDAGISel.inc -gen-dag-isel) +x86tgen(X86GenFastISel.inc -gen-fast-isel) +x86tgen(X86GenCallingConv.inc -gen-callingconv) +x86tgen(X86GenSubtarget.inc -gen-subtarget) + +add_custom_target(X86Table_gen echo Tablegenning + DEPENDS + ${llvm_builded_incs_dir}/Intrinsics.gen + ${CMAKE_CURRENT_BINARY_DIR}/X86GenRegisterInfo.h.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenRegisterNames.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenRegisterInfo.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenInstrNames.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenInstrInfo.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenAsmWriter.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenAsmWriter1.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenDAGISel.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenFastISel.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenCallingConv.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenSubtarget.inc + ) + +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) + +add_partially_linked_object(LLVMX86CodeGen + X86CodeEmitter.cpp + X86ELFWriterInfo.cpp + X86FloatingPoint.cpp + X86ISelDAGToDAG.cpp + X86ISelLowering.cpp + X86InstrInfo.cpp + X86JITInfo.cpp + X86RegisterInfo.cpp + X86Subtarget.cpp + X86TargetAsmInfo.cpp + X86TargetMachine.cpp + X86FastISel.cpp + ) + +add_dependencies(LLVMX86CodeGen + X86Table_gen +) diff --git a/lib/Transforms/Hello/CMakeLists.txt b/lib/Transforms/Hello/CMakeLists.txt new file mode 100644 index 0000000000..b80d15ba76 --- /dev/null +++ b/lib/Transforms/Hello/CMakeLists.txt @@ -0,0 +1,3 @@ +add_llvm_library( LLVMHello + Hello.cpp + ) diff --git a/lib/Transforms/IPO/CMakeLists.txt b/lib/Transforms/IPO/CMakeLists.txt new file mode 100644 index 0000000000..c8d4ec6700 --- /dev/null +++ b/lib/Transforms/IPO/CMakeLists.txt @@ -0,0 +1,24 @@ +add_llvm_library(LLVMipo + AddReadAttrs.cpp + ArgumentPromotion.cpp + ConstantMerge.cpp + DeadArgumentElimination.cpp + DeadTypeElimination.cpp + ExtractGV.cpp + GlobalDCE.cpp + GlobalOpt.cpp + IndMemRemoval.cpp + InlineAlways.cpp + Inliner.cpp + InlineSimple.cpp + Internalize.cpp + IPConstantPropagation.cpp + LoopExtractor.cpp + LowerSetJmp.cpp + PartialSpecialization.cpp + PruneEH.cpp + RaiseAllocations.cpp + StripDeadPrototypes.cpp + StripSymbols.cpp + StructRetPromotion.cpp + ) diff --git a/lib/Transforms/Instrumentation/CMakeLists.txt b/lib/Transforms/Instrumentation/CMakeLists.txt new file mode 100644 index 0000000000..d7c518d282 --- /dev/null +++ b/lib/Transforms/Instrumentation/CMakeLists.txt @@ -0,0 +1,6 @@ +add_llvm_library(LLVMInstrumentation + BlockProfiling.cpp + EdgeProfiling.cpp + ProfilingUtils.cpp + RSProfiling.cpp + ) diff --git a/lib/Transforms/Scalar/CMakeLists.txt b/lib/Transforms/Scalar/CMakeLists.txt new file mode 100644 index 0000000000..ff9193ac66 --- /dev/null +++ b/lib/Transforms/Scalar/CMakeLists.txt @@ -0,0 +1,32 @@ +add_llvm_library(LLVMScalarOpts + ADCE.cpp + BasicBlockPlacement.cpp + CodeGenPrepare.cpp + CondPropagate.cpp + ConstantProp.cpp + DCE.cpp + DeadStoreElimination.cpp + GVN.cpp + GVNPRE.cpp + IndVarSimplify.cpp + InstructionCombining.cpp + JumpThreading.cpp + LICM.cpp + LoopDeletion.cpp + LoopIndexSplit.cpp + LoopRotation.cpp + LoopStrengthReduce.cpp + LoopUnroll.cpp + LoopUnswitch.cpp + MemCpyOptimizer.cpp + PredicateSimplifier.cpp + Reassociate.cpp + Reg2Mem.cpp + SCCP.cpp + Scalar.cpp + ScalarReplAggregates.cpp + SimplifyCFGPass.cpp + SimplifyLibCalls.cpp + TailDuplication.cpp + TailRecursionElimination.cpp + ) diff --git a/lib/Transforms/Utils/CMakeLists.txt b/lib/Transforms/Utils/CMakeLists.txt new file mode 100644 index 0000000000..b678b2e377 --- /dev/null +++ b/lib/Transforms/Utils/CMakeLists.txt @@ -0,0 +1,26 @@ +add_llvm_library(LLVMTransformUtils + BasicBlockUtils.cpp + BasicInliner.cpp + BreakCriticalEdges.cpp + CloneFunction.cpp + CloneLoop.cpp + CloneModule.cpp + CloneTrace.cpp + CodeExtractor.cpp + DemoteRegToStack.cpp + InlineCost.cpp + InlineFunction.cpp + LCSSA.cpp + Local.cpp + LoopSimplify.cpp + LowerAllocations.cpp + LowerInvoke.cpp + LowerSwitch.cpp + Mem2Reg.cpp + PromoteMemoryToRegister.cpp + SimplifyCFG.cpp + UnifyFunctionExitNodes.cpp + UnrollLoop.cpp + ValueMapper.cpp + InstructionNamer.cpp + ) diff --git a/lib/VMCore/CMakeLists.txt b/lib/VMCore/CMakeLists.txt new file mode 100644 index 0000000000..a7243c3284 --- /dev/null +++ b/lib/VMCore/CMakeLists.txt @@ -0,0 +1,32 @@ +add_llvm_library(LLVMVMCore + AsmWriter.cpp + AutoUpgrade.cpp + BasicBlock.cpp + ConstantFold.cpp + Constants.cpp + Core.cpp + DebugInfoBuilder.cpp + Dominators.cpp + Function.cpp + Globals.cpp + InlineAsm.cpp + Instruction.cpp + Instructions.cpp + IntrinsicInst.cpp + LeakDetector.cpp + Mangler.cpp + Module.cpp + ModuleProvider.cpp + ParameterAttributes.cpp + Pass.cpp + PassManager.cpp + Type.cpp + TypeSymbolTable.cpp + Use.cpp + Value.cpp + ValueSymbolTable.cpp + ValueTypes.cpp + Verifier.cpp + ) + +add_dependencies( LLVMVMCore ${llvm_builded_incs_dir}/Intrinsics.gen ) \ No newline at end of file diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000000..8909cbd266 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,32 @@ +# NOTE: The tools are organized into five groups of four consisting of one +# large and three small executables. This is done to minimize memory load +# in parallel builds. Please retain this ordering. + +if( NOT MSVC ) + add_subdirectory(llvm-config) +endif( NOT MSVC ) + +add_subdirectory(opt) +add_subdirectory(llvm-as) +add_subdirectory(llvm-dis) + +add_subdirectory(llc) +add_subdirectory(llvm-ranlib) +add_subdirectory(llvm-ar) +add_subdirectory(llvm-nm) + +add_subdirectory(llvm-ld) +add_subdirectory(llvm-prof) +add_subdirectory(llvm-link) +add_subdirectory(lli) + +# gccas and gccld are deprecated: +# add_subdirectory(gccas) +# add_subdirectory(gccld) +add_subdirectory(llvm-extract) +add_subdirectory(llvm-db) + +add_subdirectory(bugpoint) +add_subdirectory(llvm-bcanalyzer) +add_subdirectory(llvm-stub) +add_subdirectory(llvmc2) diff --git a/tools/bugpoint/CMakeLists.txt b/tools/bugpoint/CMakeLists.txt new file mode 100644 index 0000000000..90f24bac58 --- /dev/null +++ b/tools/bugpoint/CMakeLists.txt @@ -0,0 +1,16 @@ +set(LLVM_LINK_COMPONENTS asmparser instrumentation scalaropts ipo + linker bitreader bitwriter) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(bugpoint + BugDriver.cpp + CrashDebugger.cpp + ExecutionDriver.cpp + ExtractFunction.cpp + FindBugs.cpp + Miscompilation.cpp + OptimizerDriver.cpp + TestPasses.cpp + ToolRunner.cpp + bugpoint.cpp + ) diff --git a/tools/llc/CMakeLists.txt b/tools/llc/CMakeLists.txt new file mode 100644 index 0000000000..43f30be208 --- /dev/null +++ b/tools/llc/CMakeLists.txt @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} bitreader asmprinter) + +add_llvm_tool(llc + llc.cpp + ) diff --git a/tools/lli/CMakeLists.txt b/tools/lli/CMakeLists.txt new file mode 100644 index 0000000000..ce70d46e4a --- /dev/null +++ b/tools/lli/CMakeLists.txt @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS jit interpreter nativecodegen bitreader selectiondag) + +add_llvm_tool(lli + lli.cpp + ) diff --git a/tools/llvm-ar/CMakeLists.txt b/tools/llvm-ar/CMakeLists.txt new file mode 100644 index 0000000000..c8b0b725d8 --- /dev/null +++ b/tools/llvm-ar/CMakeLists.txt @@ -0,0 +1,8 @@ +set(LLVM_LINK_COMPONENTS archive) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-ar + llvm-ar.cpp + ) + +# TODO: Support check-local. diff --git a/tools/llvm-as/CMakeLists.txt b/tools/llvm-as/CMakeLists.txt new file mode 100644 index 0000000000..eef4a13e29 --- /dev/null +++ b/tools/llvm-as/CMakeLists.txt @@ -0,0 +1,6 @@ +set(LLVM_LINK_COMPONENTS asmparser bitwriter) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-as + llvm-as.cpp + ) diff --git a/tools/llvm-bcanalyzer/CMakeLists.txt b/tools/llvm-bcanalyzer/CMakeLists.txt new file mode 100644 index 0000000000..732bc3296f --- /dev/null +++ b/tools/llvm-bcanalyzer/CMakeLists.txt @@ -0,0 +1,6 @@ +set(LLVM_LINK_COMPONENTS bitreader) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-bcanalyzer + llvm-bcanalyzer.cpp + ) diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt new file mode 100644 index 0000000000..2d6898c2db --- /dev/null +++ b/tools/llvm-config/CMakeLists.txt @@ -0,0 +1,102 @@ +include(TestBigEndian) + +if( NOT PERL_FOUND ) + message(FATAL_ERROR "Perl required but not found!") +endif( NOT PERL_FOUND ) + +set(PERL ${PERL_EXECUTABLE}) +set(VERSION PACKAGE_VERSION) +set(PREFIX ${LLVM_BINARY_DIR}) # TODO: Root for `make install'. +execute_process(COMMAND date + OUTPUT_VARIABLE LLVM_CONFIGTIME + OUTPUT_STRIP_TRAILING_WHITESPACE) +set(abs_top_srcdir ${LLVM_MAIN_SRC_DIR}) +set(abs_top_builddir ${LLVM_BINARY_DIR}) +# LLVM_ON_UNIX and LLVM_ON_WIN32 already set. +# those are set to blank by `autoconf' on MinGW, so it seems they are not required: +#set(LLVMGCCDIR "") +#set(LLVMGCC "") +#set(LLVMGXX "") +#set(LLVMGCC_VERSION "") +#set(LLVMGCC_MAJVERS "") +test_big_endian(IS_BIG_ENDIAN) +if( IS_BIG_ENDIAN ) + set(ENDIAN "big") +else( IS_BIG_ENDIAN ) + set(ENDIAN "little") +endif( IS_BIG_ENDIAN ) +set(SHLIBEXT ${LTDL_SHLIB_EXT}) +#EXEEXT already set. +set(OS "${CMAKE_SYSTEM}") +set(ARCH "X86") # TODO: This gives "i686" in Linux: "${CMAKE_SYSTEM_PROCESSOR}") +# TODO: avoid using autoconf: +set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess) +execute_process(COMMAND sh ${config_guess} + RESULT_VARIABLE TT_RV + OUTPUT_VARIABLE LLVM_TARGET_TRIPLET + OUTPUT_STRIP_TRAILING_WHITESPACE) +message(STATUS "Target triplet: ${LLVM_TARGET_TRIPLET}") +if( NOT TT_RV EQUAL 0 ) + message(FATAL_ERROR "Failed to execute ${config_guess}") +endif( NOT TT_RV EQUAL 0 ) +set(target ${LLVM_TARGET_TRIPLET}) +set(TARGETS_TO_BUILD "X86") # TODO +set(TARGET_HAS_JIT "1") # TODO + +# Avoids replacement at config-time: +set(LLVM_CPPFLAGS "@LLVM_CPPFLAGS@") +set(LLVM_CFLAGS "@LLVM_CFLAGS@") +set(LLVM_CXXFLAGS "@LLVM_CXXFLAGS@") +set(LLVM_LDFLAGS "@LLVM_LDFLAGS@") +set(LIBS "@LIBS@") +set(LLVM_BUILDMODE "@LLVM_BUILDMODE@") + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.in.in + ${CMAKE_CURRENT_BINARY_DIR}/llvm-config.in + @ONLY +) + +set(LIBDEPS ${CMAKE_CURRENT_BINARY_DIR}/LibDeps.txt) +set(LIBDEPS_TMP ${CMAKE_CURRENT_BINARY_DIR}/LibDeps.txt.tmp) +set(FINAL_LIBDEPS ${CMAKE_CURRENT_BINARY_DIR}/FinalLibDeps.txt) +set(LLVM_CONFIG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/llvm-config) +set(LLVM_CONFIG_IN ${CMAKE_CURRENT_BINARY_DIR}/llvm-config.in) + +# set(LIBDEPS LibDeps.txt) +# set(LIBDEPS_TMP LibDeps.txt.tmp) +# set(FINAL_LIBDEPS FinalLibDeps.txt) + +add_custom_command(OUTPUT ${LIBDEPS_TMP} + COMMAND ${PERL_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/GenLibDeps.pl -flat ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} > ${LIBDEPS_TMP} + DEPENDS ${llvm_libs} + COMMENT "Regenerating ${LIBDEPS_TMP}") + +add_custom_command(OUTPUT ${LIBDEPS} + COMMAND cmp -s ${LIBDEPS_TMP} ${LIBDEPS} || \( cp ${LIBDEPS_TMP} ${LIBDEPS} && echo "Updated ${LIBDEPS} because dependencies changed" \) + DEPENDS ${LIBDEPS_TMP}) + +add_custom_command(OUTPUT ${FINAL_LIBDEPS} + COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/find-cycles.pl < ${LIBDEPS} > ${FINAL_LIBDEPS} || rm -f ${FINAL_LIBDEPS} + DEPENDS ${LIBDEPS} + COMMENT "Checking for cyclic dependencies between LLVM libraries.") + +add_custom_command(OUTPUT ${LLVM_CONFIG} + COMMAND echo 's,@LLVM_CPPFLAGS@,${CMAKE_CPP_FLAGS},' > temp.sed + COMMAND echo 's,@LLVM_CFLAGS@,${CMAKE_C_FLAGS},' >> temp.sed + COMMAND echo 's,@LLVM_CXXFLAGS@,${CMAKE_CXX_FLAGS},' >> temp.sed + # TODO: Use general flags for linking, not just for shared libs: + COMMAND echo 's,@LLVM_LDFLAGS@,${CMAKE_SHARED_LINKER_FLAGS},' >> temp.sed + COMMAND echo 's,@LIBS@,,' >> temp.sed # TODO: System libs + COMMAND echo 's,@LLVM_BUILDMODE@,${CMAKE_BUILD_TYPE},' >> temp.sed + COMMAND sed -f temp.sed < ${LLVM_CONFIG_IN} > ${LLVM_CONFIG} + COMMAND rm temp.sed + COMMAND cat ${FINAL_LIBDEPS} >> ${LLVM_CONFIG} + COMMAND chmod +x ${LLVM_CONFIG} + COMMAND cd ${LLVM_BINARY_DIR} && ${CMAKE_COMMAND} -U HAVE_LLVM_CONFIG ${LLVM_MAIN_SRC_DIR} + DEPENDS ${FINAL_LIBDEPS} ${LLVM_CONFIG_IN} + COMMENT "Building llvm-config script." + ) + +add_custom_target(llvm-config.target ALL + DEPENDS ${LLVM_CONFIG}) \ No newline at end of file diff --git a/tools/llvm-db/CMakeLists.txt b/tools/llvm-db/CMakeLists.txt new file mode 100644 index 0000000000..af64908171 --- /dev/null +++ b/tools/llvm-db/CMakeLists.txt @@ -0,0 +1,8 @@ +set(LLVM_LINK_COMPONENTS debugger) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-db + CLIDebugger.cpp + Commands.cpp + llvm-db.cpp + ) diff --git a/tools/llvm-dis/CMakeLists.txt b/tools/llvm-dis/CMakeLists.txt new file mode 100644 index 0000000000..d62a6b5ec8 --- /dev/null +++ b/tools/llvm-dis/CMakeLists.txt @@ -0,0 +1,6 @@ +set(LLVM_LINK_COMPONENTS bitreader) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-dis + llvm-dis.cpp + ) diff --git a/tools/llvm-extract/CMakeLists.txt b/tools/llvm-extract/CMakeLists.txt new file mode 100644 index 0000000000..88e9343ffa --- /dev/null +++ b/tools/llvm-extract/CMakeLists.txt @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS ipo bitreader bitwriter) + +add_llvm_tool(llvm-extract + llvm-extract.cpp + ) diff --git a/tools/llvm-ld/CMakeLists.txt b/tools/llvm-ld/CMakeLists.txt new file mode 100644 index 0000000000..51f0dc1304 --- /dev/null +++ b/tools/llvm-ld/CMakeLists.txt @@ -0,0 +1,7 @@ +set(LLVM_LINK_COMPONENTS ipo scalaropts linker archive bitwriter) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-ld + Optimize.cpp + llvm-ld.cpp + ) diff --git a/tools/llvm-link/CMakeLists.txt b/tools/llvm-link/CMakeLists.txt new file mode 100644 index 0000000000..69a435e530 --- /dev/null +++ b/tools/llvm-link/CMakeLists.txt @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS linker bitreader bitwriter) + +add_llvm_tool(llvm-link + llvm-link.cpp + ) diff --git a/tools/llvm-nm/CMakeLists.txt b/tools/llvm-nm/CMakeLists.txt new file mode 100644 index 0000000000..45cf1b67f9 --- /dev/null +++ b/tools/llvm-nm/CMakeLists.txt @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS archive bitreader) + +add_llvm_tool(llvm-nm + llvm-nm.cpp + ) diff --git a/tools/llvm-prof/CMakeLists.txt b/tools/llvm-prof/CMakeLists.txt new file mode 100644 index 0000000000..9a5115085d --- /dev/null +++ b/tools/llvm-prof/CMakeLists.txt @@ -0,0 +1,6 @@ +set(LLVM_LINK_COMPONENTS bitreader analysis) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-prof + llvm-prof.cpp + ) diff --git a/tools/llvm-ranlib/CMakeLists.txt b/tools/llvm-ranlib/CMakeLists.txt new file mode 100644 index 0000000000..3116d2e4ff --- /dev/null +++ b/tools/llvm-ranlib/CMakeLists.txt @@ -0,0 +1,6 @@ +set(LLVM_LINK_COMPONENTS archive) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-ranlib + llvm-ranlib.cpp + ) diff --git a/tools/llvm-stub/CMakeLists.txt b/tools/llvm-stub/CMakeLists.txt new file mode 100644 index 0000000000..a98dc9ed49 --- /dev/null +++ b/tools/llvm-stub/CMakeLists.txt @@ -0,0 +1,3 @@ +add_llvm_tool(llvm-stub + llvm-stub.c + ) diff --git a/tools/llvmc2/CMakeLists.txt b/tools/llvmc2/CMakeLists.txt new file mode 100644 index 0000000000..6f4872b2d0 --- /dev/null +++ b/tools/llvmc2/CMakeLists.txt @@ -0,0 +1,32 @@ +set(LLVM_LINK_COMPONENTS support system) +set(LLVM_REQUIRES_EH 1) + +macro(tgen ofn) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} + COMMAND tblgen ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${llvm_include_path} ${CMAKE_CURRENT_SOURCE_DIR}/Graph.td -o ${ofn} + DEPENDS + tblgen + ${CMAKE_CURRENT_SOURCE_DIR}/Common.td + ${CMAKE_CURRENT_SOURCE_DIR}/Graph.td + ${CMAKE_CURRENT_SOURCE_DIR}/Tools.td + COMMENT "Building ${ofn}..." + ) +endmacro(tgen ofn) + +tgen(AutoGenerated.inc -gen-llvmc) + +add_custom_target(AutoGenerated_ct echo Tablegenning + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/AutoGenerated.inc + ) + +include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) + +add_llvm_tool(llvmc2 + Action.cpp + AutoGenerated.cpp + CompilationGraph.cpp + llvmc.cpp + ) + +add_dependencies(llvmc2 AutoGenerated_ct) diff --git a/tools/opt/CMakeLists.txt b/tools/opt/CMakeLists.txt new file mode 100644 index 0000000000..efcca80ddf --- /dev/null +++ b/tools/opt/CMakeLists.txt @@ -0,0 +1,9 @@ +set(LLVM_REQUIRES_EH 1) +set(LLVM_LINK_COMPONENTS bitreader bitwriter instrumentation scalaropts ipo) + +add_llvm_tool(opt + AnalysisWrappers.cpp + GraphPrinters.cpp + PrintSCC.cpp + opt.cpp + ) diff --git a/utils/TableGen/CMakeLists.txt b/utils/TableGen/CMakeLists.txt new file mode 100644 index 0000000000..8141d76189 --- /dev/null +++ b/utils/TableGen/CMakeLists.txt @@ -0,0 +1,26 @@ +add_executable(tblgen + AsmWriterEmitter.cpp + CallingConvEmitter.cpp + CodeEmitterGen.cpp + CodeGenDAGPatterns.cpp + CodeGenInstruction.cpp + CodeGenTarget.cpp + DAGISelEmitter.cpp + InstrEnumEmitter.cpp + InstrInfoEmitter.cpp + IntrinsicEmitter.cpp + LLVMCConfigurationEmitter.cpp + Record.cpp + RegisterInfoEmitter.cpp + SubtargetEmitter.cpp + TGLexer.cpp + TGParser.cpp + TableGen.cpp + TableGenBackend.cpp + FastISelEmitter.cpp + ) + +target_link_libraries(tblgen LLVMSupport LLVMSystem) +if( MINGW ) + target_link_libraries(tblgen imagehlp psapi) +endif( MINGW ) -- cgit v1.2.3