llvm.org GIT mirror llvm / 3d01fc7
Initial support for the CMake build system. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56419 91177308-0d34-0410-b5e6-96231b3b80d8 Oscar Fuentes 10 years ago
61 changed file(s) with 2276 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 cmake_minimum_required(VERSION 2.6.1)
1
2 set(PACKAGE_NAME llvm)
3 set(PACKAGE_VERSION svn)
4 set(PACKAGE_BUGREPORT "ofv@wanadoo.es")
5 #set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
6
7 include(FindPerl)
8
9 set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
10 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include/llvm)
11 set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
12 set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin)
13 set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples)
14
15 # TODO: Support user-specified targets:
16 set(LLVM_TARGETS_TO_BUILD X86)
17
18 if( NOT MSVC )
19 set(CMAKE_CXX_LINK_EXECUTABLE "sh -c \"${CMAKE_CXX_LINK_EXECUTABLE}\"")
20 endif( NOT MSVC )
21
22 # TODO: Eliminate?
23 get_filename_component(llvm_include_path ${LLVM_MAIN_SRC_DIR}/include ABSOLUTE)
24
25 #get_filename_component(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm ABSOLUTE)
26 set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm)
27
28 # Add path for custom modules
29 set(CMAKE_MODULE_PATH
30 ${CMAKE_MODULE_PATH}
31 "${LLVM_MAIN_SRC_DIR}/cmake"
32 "${LLVM_MAIN_SRC_DIR}/cmake/modules"
33 )
34
35 if(WIN32)
36 set(LLVM_ON_WIN32 1)
37 set(LLVM_ON_UNIX 0)
38 set(LTDL_SHLIB_EXT ".dll")
39 set(EXEEXT ".exe")
40 # Maximum path length is 160 for non-unicode paths
41 set(MAXPATHLEN 160)
42 else(WIN32)
43 if(UNIX)
44 set(LLVM_ON_WIN32 0)
45 set(LLVM_ON_UNIX 1)
46 set(LTDL_SHLIB_EXT ".so")
47 set(EXEEXT "")
48 # FIXME: Maximum path length is currently set to 'safe' fixed value
49 set(MAXPATHLEN 2024)
50 else(UNIX)
51 MESSAGE(SEND_ERROR "Unable to determine platform")
52 endif(UNIX)
53 endif(WIN32)
54
55 if( EXISTS ${LLVM_TOOLS_BINARY_DIR}/llvm-config )
56 set(HAVE_LLVM_CONFIG 1)
57 endif( EXISTS ${LLVM_TOOLS_BINARY_DIR}/llvm-config )
58 # find_file(HAVE_LLVM_CONFIG llvm-config ${LLVM_TOOLS_BINARY_DIR})
59 # message(STATUS ${HAVE_LLVM_CONFIG})
60
61 if( MSVC )
62 message(STATUS "Configuring using MSVC hack.")
63 include(config-w32)
64 else( MSVC )
65 message(STATUS "Configuring traditional style.")
66 include(config-ix)
67 endif( MSVC )
68
69 set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} )
70 set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
71 set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
72
73 # set(CMAKE_VERBOSE_MAKEFILE true)
74
75 add_definitions( -D__STDC_LIMIT_MACROS )
76
77 if( LLVM_ON_UNIX )
78 add_definitions( -DLLVM_ON_UNIX )
79 else( LLVM_ON_UNIX )
80 add_definitions( -DLLVM_ON_WIN32 )
81 endif( LLVM_ON_UNIX )
82
83 if( MSVC )
84 add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS )
85 add_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS )
86 add_definitions( -D_SCL_SECURE_NO_DEPRECATE )
87 endif( MSVC )
88
89 include_directories( ${LLVM_BINARY_DIR}/include ${llvm_include_path})
90 #link_directories( d:/dev/lib )
91
92 #add_subdirectory(lib)
93
94 include(AddLLVM)
95 include(AddPartiallyLinkedObject)
96
97 add_subdirectory(lib/Support)
98 add_subdirectory(lib/System)
99 add_subdirectory(utils/TableGen)
100
101 add_custom_command(OUTPUT ${llvm_builded_incs_dir}/Intrinsics.gen
102 COMMAND tblgen -gen-intrinsic -I ${llvm_include_path} ${llvm_include_path}/llvm/Intrinsics.td -o ${llvm_builded_incs_dir}/Intrinsics.gen
103 DEPENDS tblgen
104 COMMENT "Building intrinsics.gen...")
105
106 add_custom_target(intrinsics_gen ALL
107 DEPENDS ${llvm_builded_incs_dir}/Intrinsics.gen)
108
109 add_subdirectory(lib/VMCore)
110 add_subdirectory(lib/CodeGen)
111 add_subdirectory(lib/CodeGen/SelectionDAG)
112 add_subdirectory(lib/CodeGen/AsmPrinter)
113 add_subdirectory(lib/Bitcode/Reader)
114 add_subdirectory(lib/Bitcode/Writer)
115 add_subdirectory(lib/Transforms/Utils)
116 add_subdirectory(lib/Transforms/Instrumentation)
117 add_subdirectory(lib/Transforms/Scalar)
118 add_subdirectory(lib/Transforms/IPO)
119 add_subdirectory(lib/Transforms/Hello)
120 add_subdirectory(lib/Linker)
121 add_subdirectory(lib/Analysis)
122 add_subdirectory(lib/Analysis/IPA)
123 add_subdirectory(lib/Target/X86)
124 add_subdirectory(lib/Target/X86/AsmPrinter)
125 add_subdirectory(lib/ExecutionEngine)
126 add_subdirectory(lib/ExecutionEngine/Interpreter)
127 add_subdirectory(lib/ExecutionEngine/JIT)
128 add_subdirectory(lib/Target)
129 add_subdirectory(lib/AsmParser)
130 add_subdirectory(lib/Debugger)
131 # TODO: lib/Target/CBackEnd
132 add_subdirectory(lib/Archive)
133
134 add_subdirectory(tools)
135
136 add_subdirectory(examples)
0
1 # include checks
2 include(CheckIncludeFile)
3 check_include_file(argz.h HAVE_ARGZ_H)
4 check_include_file(assert.h HAVE_ASSERT_H)
5 check_include_file(dirent.h HAVE_DIRENT_H)
6 check_include_file(dl.h HAVE_DL_H)
7 check_include_file(dld.h HAVE_DLD_H)
8 check_include_file(dlfcn.h HAVE_DLFCN_H)
9 check_include_file(errno.h HAVE_ERRNO_H)
10 check_include_file(execinfo.h HAVE_EXECINFO_H)
11 check_include_file(fcntl.h HAVE_FCNTL_H)
12 check_include_file(inttypes.h HAVE_INTTYPES_H)
13 check_include_file(limits.h HAVE_LIMITS_H)
14 check_include_file(link.h HAVE_LINK_H)
15 check_include_file(malloc.h HAVE_MALLOC_H)
16 check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
17 check_include_file(memory.h HAVE_MEMORY_H)
18 check_include_file(ndir.h HAVE_NDIR_H)
19 check_include_file(pthread.h HAVE_PTHREAD_H)
20 check_include_file(setjmp.h HAVE_SETJMP_H)
21 check_include_file(signal.h HAVE_SIGNAL_H)
22 check_include_file(stdint.h HAVE_STDINT_H)
23 check_include_file(stdio.h HAVE_STDIO_H)
24 check_include_file(stdlib.h HAVE_STDLIB_H)
25 check_include_file(sys/dir.h HAVE_SYS_DIR_H)
26 check_include_file(sys/dl.h HAVE_SYS_DL_H)
27 check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
28 check_include_file(sys/ndir.h HAVE_SYS_NDIR_H)
29 check_include_file(sys/param.h HAVE_SYS_PARAM_H)
30 check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
31 check_include_file(sys/stat.h HAVE_SYS_STAT_H)
32 check_include_file(sys/time.h HAVE_SYS_TIME_H)
33 check_include_file(sys/types.h HAVE_SYS_TYPES_H)
34 check_include_file(unistd.h HAVE_UNISTD_H)
35 check_include_file(utime.h HAVE_UTIME_H)
36
37 # function checks
38 include(CheckSymbolExists)
39 check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE)
40 check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)
41 check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT)
42 check_symbol_exists(isinf cmath HAVE_ISINF_IN_CMATH)
43 check_symbol_exists(isinf math.h HAVE_ISINF_IN_MATH_H)
44 check_symbol_exists(isnan cmath HAVE_ISNAN_IN_CMATH)
45 check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H)
46 check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
47 check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
48
49 if( MINGW )
50 # tbi: Comprobar que existen las librerias:
51 set(HAVE_LIBIMAGEHLP 1)
52 set(HAVE_LIBPSAPI 1)
53 # include(CheckLibraryExists)
54 # CHECK_LIBRARY_EXISTS(imagehlp ??? . HAVE_LIBIMAGEHLP)
55 endif( MINGW )
56
57 # Classes
58 include(CheckCxxHashmap)
59 include(CheckCxxHashset)
60 check_hashmap()
61 check_hashset()
62
63 # FIXME: Signal handler return type, currently hardcoded to 'void'
64 set(RETSIGTYPE void)
65
66 # Disable multithreading for now
67 set(ENABLE_THREADS 0)
68
69 configure_file(
70 ${LLVM_MAIN_INCLUDE_DIR}/Config/config.h.cmake
71 ${LLVM_BINARY_DIR}/include/llvm/Config/config.h
72 )
73
74 configure_file(
75 ${LLVM_MAIN_INCLUDE_DIR}/ADT/iterator.cmake
76 ${LLVM_BINARY_DIR}/include/llvm/ADT/iterator.h
77 )
78
79 configure_file(
80 ${LLVM_MAIN_INCLUDE_DIR}/Support/DataTypes.h.cmake
81 ${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h
82 )
83
84 configure_file(
85 ${LLVM_MAIN_INCLUDE_DIR}/ADT/hash_map.cmake
86 ${LLVM_BINARY_DIR}/include/llvm/ADT/hash_map.h
87 )
88
89 configure_file(
90 ${LLVM_MAIN_INCLUDE_DIR}/ADT/hash_set.cmake
91 ${LLVM_BINARY_DIR}/include/llvm/ADT/hash_set.h
92 )
0 # tbi: Configurar ficheros.
1 configure_file(${llvm_include_path}/llvm/ADT/hash_map.h.in ${llvm_builded_incs_dir}/ADT/hash_map.h)
2 configure_file(${llvm_include_path}/llvm/ADT/hash_set.h.in ${llvm_builded_incs_dir}/ADT/hash_set.h)
3 configure_file(${llvm_include_path}/llvm/ADT/iterator.h.in ${llvm_builded_incs_dir}/ADT/iterator.h)
4 configure_file(${llvm_include_path}/llvm/Support/DataTypes.h.in ${llvm_builded_incs_dir}/Support/DataTypes.h)
5 configure_file(${llvm_include_path}/llvm/Config/config.h.in ${llvm_builded_incs_dir}/Config/config.h)
6
7 file(READ ${llvm_include_path}/../win32/config.h vc_config_text)
8 file(APPEND ${llvm_builded_incs_dir}/Config/config.h ${vc_config_text})
0 include(LLVMConfig)
1
2 macro(add_llvm_library name)
3 add_library( ${name} ${ARGN} )
4 set( llvm_libs ${llvm_libs} ${name} PARENT_SCOPE)
5 endmacro(add_llvm_library name)
6
7
8 macro(add_llvm_executable name)
9 add_executable(${name} ${ARGN})
10 if( LLVM_LINK_COMPONENTS )
11 llvm_config(${name} ${LLVM_LINK_COMPONENTS})
12 endif( LLVM_LINK_COMPONENTS )
13 if( MSVC )
14 target_link_libraries(${name} ${llvm_libs})
15 else( MSVC )
16 add_dependencies(${name} llvm-config.target)
17 set_target_properties(${name}
18 PROPERTIES
19 LINK_FLAGS "-L ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
20 if( MINGW )
21 target_link_libraries(${name} DbgHelp psapi)
22 elseif( CMAKE_HOST_UNIX )
23 target_link_libraries(${name} dl)
24 endif( MINGW )
25 endif( MSVC )
26 endmacro(add_llvm_executable name)
27
28
29 macro(add_llvm_tool name)
30 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})
31 add_llvm_executable(${name} ${ARGN})
32 endmacro(add_llvm_tool name)
33
34
35 macro(add_llvm_example name)
36 # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_EXAMPLES_BINARY_DIR})
37 add_llvm_executable(${name} ${ARGN})
38 endmacro(add_llvm_example name)
0
1 macro(add_partially_linked_object lib)
2 if( MSVC )
3 add_llvm_library( ${lib} ${ARGN})
4 else( MSVC )
5 set(pll ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${lib}.o)
6 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
7 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
8 add_library( ${lib} STATIC ${ARGN})
9 add_custom_command(OUTPUT ${pll}
10 MESSAGE "Building ${lib}.o..."
11 DEPENDS ${lib}
12 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib
13 COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}
14 COMMAND ld -r *${CMAKE_CXX_OUTPUT_EXTENSION} -o ${pll}
15 COMMAND rm -f *${CMAKE_CXX_OUTPUT_EXTENSION}
16 )
17 add_custom_target(${lib}_pll ALL DEPENDS ${pll})
18 set( llvm_libs ${llvm_libs} ${pll} PARENT_SCOPE)
19 endif( MSVC )
20 endmacro(add_partially_linked_object lib)
0 # - Check if for hash_map.
1 # CHECK_HASHMAP ()
2 #
3
4 include(CheckCXXSourceCompiles)
5
6 macro(CHECK_HASHMAP)
7 message(STATUS "Checking for C++ hash_map implementation...")
8 check_cxx_source_compiles("
9 #include
10 int main() {
11 __gnu_cxx::hash_map t;
12 }
13 "
14 HAVE_GNU_EXT_HASH_MAP
15 )
16 if(HAVE_GNU_EXT_HASH_MAP)
17 message(STATUS "C++ hash_map found in 'ext' dir in namespace __gnu_cxx::")
18 endif(HAVE_GNU_EXT_HASH_MAP)
19
20 check_cxx_source_compiles("
21 #include
22 int main() {
23 std::hash_map t;
24 }
25 "
26 HAVE_STD_EXT_HASH_MAP
27 )
28 if(HAVE_STD_EXT_HASH_MAP)
29 message(STATUS "C++ hash_map found in 'ext' dir in namespace std::")
30 endif(HAVE_STD_EXT_HASH_MAP)
31
32 check_cxx_source_compiles("
33 #include
34 int main() {
35 hash_map t;
36 }
37 "
38 HAVE_GLOBAL_HASH_MAP
39 )
40 if(HAVE_GLOBAL_HASH_MAP)
41 message(STATUS "C++ hash_map found in global namespace")
42 endif(HAVE_GLOBAL_HASH_MAP)
43
44 if(NOT HAVE_GNU_EXT_HASH_MAP)
45 if(NOT HAVE_STD_EXT_HASH_MAP)
46 if(NOT HAVE_GLOBAL_HASH_MAP)
47 message(STATUS "C++ hash_map not found")
48 endif(NOT HAVE_GLOBAL_HASH_MAP)
49 endif(NOT HAVE_STD_EXT_HASH_MAP)
50 endif(NOT HAVE_GNU_EXT_HASH_MAP)
51
52 endmacro(CHECK_HASHMAP)
0 # - Check if for hash_set.
1 # CHECK_HASHSET ()
2 #
3
4 include(CheckCXXSourceCompiles)
5
6 macro(CHECK_HASHSET)
7 message(STATUS "Checking for C++ hash_set implementation...")
8 check_cxx_source_compiles("
9 #include
10 int main() {
11 __gnu_cxx::hash_set t;
12 }
13 "
14 HAVE_GNU_EXT_HASH_SET
15 )
16 if(HAVE_GNU_EXT_HASH_SET)
17 message(STATUS "C++ hash_set found in 'ext' dir in namespace __gnu_cxx::")
18 endif(HAVE_GNU_EXT_HASH_SET)
19
20 check_cxx_source_compiles("
21 #include
22 int main() {
23 std::hash_set t;
24 }
25 "
26 HAVE_STD_EXT_HASH_SET
27 )
28 if(HAVE_STD_EXT_HASH_SET)
29 message(STATUS "C++ hash_set found in 'ext' dir in namespace std::")
30 endif(HAVE_STD_EXT_HASH_SET)
31
32 check_cxx_source_compiles("
33 #include
34 int main() {
35 hash_set t;
36 }
37 "
38 HAVE_GLOBAL_HASH_SET
39 )
40 if(HAVE_GLOBAL_HASH_SET)
41 message(STATUS "C++ hash_set found in global namespace")
42 endif(HAVE_GLOBAL_HASH_SET)
43
44 if(NOT HAVE_GNU_EXT_HASH_SET)
45 if(NOT HAVE_STD_EXT_HASH_SET)
46 if(NOT HAVE_GLOBAL_HASH_SET)
47 message(STATUS "C++ hash_set not found")
48 endif(NOT HAVE_GLOBAL_HASH_SET)
49 endif(NOT HAVE_STD_EXT_HASH_SET)
50 endif(NOT HAVE_GNU_EXT_HASH_SET)
51 endmacro(CHECK_HASHSET)
0 # - Try to find Bison
1 # Once done this will define
2 #
3 # BISON_FOUND - system has Bison
4 # BISON_EXECUTABLE - path of the bison executable
5 # BISON_VERSION - the version string, like "2.5.31"
6 #
7
8 MACRO(FIND_BISON)
9 FIND_PROGRAM(BISON_EXECUTABLE NAMES bison)
10
11 IF(BISON_EXECUTABLE)
12 SET(BISON_FOUND TRUE)
13
14 EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version
15 OUTPUT_VARIABLE _BISON_VERSION
16 )
17 string (REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" BISON_VERSION "${_bison_VERSION}")
18 ENDIF(BISON_EXECUTABLE)
19
20 IF(BISON_FOUND)
21 IF(NOT Bison_FIND_QUIETLY)
22 MESSAGE(STATUS "Found Bison: ${BISON_EXECUTABLE}")
23 ENDIF(NOT Bison_FIND_QUIETLY)
24 ELSE(BISON_FOUND)
25 IF(Bison_FIND_REQUIRED)
26 MESSAGE(FATAL_ERROR "Could not find Bison")
27 ENDIF(Bison_FIND_REQUIRED)
28 ENDIF(BISON_FOUND)
29 ENDMACRO(FIND_BISON)
30
31 MACRO(BISON_GENERATOR _PREFIX _Y_INPUT _H_OUTPUT _CPP_OUTPUT)
32 IF(BISON_EXECUTABLE)
33 GET_FILENAME_COMPONENT(_Y_DIR ${_Y_INPUT} PATH)
34 ADD_CUSTOM_COMMAND(
35 OUTPUT ${_CPP_OUTPUT}
36 OUTPUT ${_H_OUTPUT}
37 DEPENDS ${_Y_INPUT}
38 COMMAND ${BISON_EXECUTABLE}
39 ARGS
40 -p ${_PREFIX} -o"${_CPP_OUTPUT}"
41 --defines="${_H_OUTPUT}" ${_Y_INPUT}
42 WORKING_DIRECTORY ${_Y_DIR}
43 )
44 SET_SOURCE_FILES_PROPERTIES(
45 ${_CPP_OUTPUT} ${_H_OUTPUT}
46 GENERATED
47 )
48 ELSE(BISON_EXECUTABLE)
49 MESSAGE(SEND_ERROR "Can't find bison program, and it's required")
50 ENDIF(BISON_EXECUTABLE)
51 ENDMACRO(BISON_GENERATOR)
0 macro(llvm_config executable link_components)
1 if( MSVC )
2 msvc_llvm_config(${executable} ${link_components})
3 else( MSVC )
4 nix_llvm_config(${executable} ${link_components})
5 endif( MSVC )
6 endmacro(llvm_config executable link_components)
7
8
9 macro(msvc_llvm_config executable link_components)
10 foreach(c ${link_components})
11 message(STATUS ${c})
12 if( c STREQUAL "jit" )
13 message(STATUS "linking jit")
14 set_target_properties(${executable}
15 PROPERTIES
16 LINK_FLAGS "/INCLUDE:_X86TargetMachineModule")
17 endif( c STREQUAL "jit" )
18 endforeach(c)
19 target_link_libraries(${executable} ${llvm_libs})
20 endmacro(msvc_llvm_config executable link_components)
21
22
23 macro(nix_llvm_config executable link_components)
24 set(lc "")
25 foreach(c ${LLVM_LINK_COMPONENTS})
26 set(lc "${lc} ${c}")
27 endforeach(c)
28 if( NOT HAVE_LLVM_CONFIG )
29 target_link_libraries(${executable}
30 "`${LLVM_TOOLS_BINARY_DIR}/llvm-config --libs ${lc}`")
31 else( NOT HAVE_LLVM_CONFIG )
32 # tbi: Error handling.
33 if( NOT PERL_FOUND )
34 message(FATAL_ERROR "Perl required but not found!")
35 endif( NOT PERL_FOUND )
36 execute_process(
37 COMMAND sh -c "${PERL_EXECUTABLE} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/llvm-config --libs ${lc}"
38 RESULT_VARIABLE rv
39 OUTPUT_VARIABLE libs
40 OUTPUT_STRIP_TRAILING_WHITESPACE)
41 if(NOT rv EQUAL 0)
42 message(FATAL_ERROR "llvm-config failed for executable ${executable}")
43 endif(NOT rv EQUAL 0)
44 string(REPLACE " " ";" libs ${libs})
45 foreach(c ${libs})
46 if(c MATCHES ".*\\.o")
47 get_filename_component(fn ${c} NAME)
48 target_link_libraries(${executable}
49 ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${fn})
50 else(c MATCHES ".*\\.o")
51 string(REPLACE "-l" "" fn ${c})
52 target_link_libraries(${executable} ${fn})
53 endif(c MATCHES ".*\\.o")
54 endforeach(c)
55 endif( NOT HAVE_LLVM_CONFIG )
56 endmacro(nix_llvm_config executable link_components)
0 add_subdirectory(Fibonacci)
0 set(LLVM_LINK_COMPONENTS jit interpreter nativecodegen)
1
2 add_llvm_example(Fibonacci
3 fibonacci.cpp
4 )
0 //===-- llvm/ADT/hash_map - "Portable" wrapper around hash_map --*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file was developed by the LLVM research group and is distributed under
5 // the University of Illinois Open Source License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file provides a wrapper around the mysterious header file
10 // that seems to move around between GCC releases into and out of namespaces at
11 // will. #including this header will cause hash_map to be available in the
12 // global namespace.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_ADT_HASH_MAP
17 #define LLVM_ADT_HASH_MAP
18
19 // Compiler Support Matrix
20 //
21 // Version Namespace Header File
22 // 2.95.x :: hash_map
23 // 3.0.4 std ext/hash_map
24 // 3.1 __gnu_cxx ext/hash_map
25 // HP aCC6 std stdex/rw/hashm*ap.h
26 // MS VC++ stdext hash_map
27
28 #cmakedefine HAVE_GNU_EXT_HASH_MAP
29 #cmakedefine HAVE_STD_EXT_HASH_MAP
30 #cmakedefine HAVE_GLOBAL_HASH_MAP
31 #cmakedefine HAVE_RW_STDEX_HASH_MAP_H
32
33 #if defined(HAVE_GNU_EXT_HASH_MAP)
34 // This is for GCC-3.1+ which puts hash in ext/hash_map
35 # include
36 # ifndef HASH_NAMESPACE
37 # define HASH_NAMESPACE __gnu_cxx
38 # endif
39
40 // GCC 3.0.x puts hash_map in and in the std namespace.
41 #elif defined(HAVE_STD_EXT_HASH_MAP)
42 # include
43 # ifndef HASH_NAMESPACE
44 # define HASH_NAMESPACE std
45 # endif
46
47 // Older compilers such as GCC before version 3.0 do not keep
48 // extensions in the `ext' directory, and ignore the `std' namespace.
49 #elif defined(HAVE_GLOBAL_HASH_MAP)
50 # include
51 # ifndef HASH_NAMESPACE
52 # define HASH_NAMESPACE std
53 # endif
54
55 // HP aCC doesn't include an SGI-like hash_map. For this platform (or
56 // any others using Rogue Wave Software's Tools.h++ library), we wrap
57 // around them in std::
58 #elif defined(HAVE_RW_STDEX_HASH_MAP_H)
59 # include
60 # include
61 # ifndef HASH_NAMESPACE
62 # define HASH_NAMESPACE std
63 # endif
64
65 // Support Microsoft VC++.
66 #elif defined(_MSC_VER)
67 # include
68 # ifndef HASH_NAMESPACE
69 # define HASH_NAMESPACE stdext
70 using std::_Distance;
71 # endif
72
73 // Give a warning if we couldn't find it, instead of (or in addition to)
74 // randomly doing something dumb.
75 #else
76 # warning "Autoconfiguration failed to find the hash_map header file."
77 #endif
78
79 // we wrap Rogue Wave Tools.h++ rw_hashmap into something SGI-looking, here:
80 #ifdef HAVE_RW_STDEX_HASH_MAP_H
81 namespace HASH_NAMESPACE {
82
83 template struct hash {
84 unsigned int operator()(const unsigned int& x) const {
85 return x;
86 }
87 };
88
89 template
90 typename ValueType,
91 class _HashFcn = hash,
92 class _EqualKey = equal_to,
93 class _A = allocator >
94 class hash_map : public rw_hashmap
95 class _EqualKey, class _A> {
96 };
97
98 template
99 typename ValueType,
100 class _HashFcn = hash,
101 class _EqualKey = equal_to,
102 class _A = allocator >
103 class hash_multimap : public rw_hashmultimap
104 class _EqualKey, class _A> {
105 };
106
107 } // end HASH_NAMESPACE;
108 #endif
109
110 // Include vector because ext/hash_map includes stl_vector.h and leaves
111 // out specializations like stl_bvector.h, causing link conflicts.
112 #include
113
114 #ifdef _MSC_VER
115
116 // GCC and VC++ have differing ways of implementing hash_maps. As it's not
117 // standardized, that's to be expected. This adapter class allows VC++
118 // hash_map to use GCC's hash classes.
119 namespace stdext {
120 template struct hash;
121
122 // Provide a hash function for unsigned ints...
123 template<> struct hash {
124 inline size_t operator()(unsigned int Val) const {
125 return Val;
126 }
127 };
128
129 template class hash_compare > {
130 std::less comp;
131 public:
132 enum { bucket_size = 4 };
133 enum { min_buckets = 8 };
134 hash_compare() {}
135 hash_compare(std::less pred) : comp(pred) {}
136 size_t operator()(const Key& key) const { return hash()(key); }
137 bool operator()(const Key& k1, const Key& k2) const { return comp(k1, k2); }
138 };
139 }
140
141 #endif
142
143 using HASH_NAMESPACE::hash_map;
144 using HASH_NAMESPACE::hash_multimap;
145 using HASH_NAMESPACE::hash;
146
147 #include "llvm/ADT/HashExtras.h"
148
149 #endif
0 //===-- llvm/ADT/hash_set - "Portable" wrapper around hash_set --*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file was developed by the LLVM research group and is distributed under
5 // the University of Illinois Open Source License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 // vim:ft=cpp
9 //
10 // This file provides a wrapper around the mysterious header file
11 // that seems to move around between GCC releases into and out of namespaces at
12 // will. #including this header will cause hash_set to be available in the
13 // global namespace.
14 //
15 //===----------------------------------------------------------------------===//
16
17 #ifndef LLVM_ADT_HASH_SET
18 #define LLVM_ADT_HASH_SET
19
20 // Compiler Support Matrix
21 //
22 // Version Namespace Header File
23 // 2.95.x :: hash_set
24 // 3.0.4 std ext/hash_set
25 // 3.1 __gnu_cxx ext/hash_set
26 // HP aCC6 std stdex/rw/hashset.h
27 // MS VC++ stdext hash_set
28
29 #cmakedefine HAVE_GNU_EXT_HASH_SET
30 #cmakedefine HAVE_STD_EXT_HASH_SET
31 #cmakedefine HAVE_GLOBAL_HASH_SET
32 #cmakedefine HAVE_RW_STDEX_HASH_SET_H
33
34 // GCC versions 3.1 and later put hash_set in and in
35 // the __gnu_cxx namespace.
36 #if defined(HAVE_GNU_EXT_HASH_SET)
37 # include
38 # ifndef HASH_NAMESPACE
39 # define HASH_NAMESPACE __gnu_cxx
40 # endif
41
42 // GCC 3.0.x puts hash_set in and in the std namespace.
43 #elif defined(HAVE_STD_EXT_HASH_SET)
44 # include
45 # ifndef HASH_NAMESPACE
46 # define HASH_NAMESPACE std
47 # endif
48
49 // Older compilers such as GCC before version 3.0 do not keep
50 // extensions in the `ext' directory, and ignore the `std' namespace.
51 #elif defined(HAVE_GLOBAL_HASH_SET)
52 # include
53 # ifndef HASH_NAMESPACE
54 # define HASH_NAMESPACE std
55 # endif
56
57 // HP aCC doesn't include an SGI-like hash_set. For this platform (or
58 // any others using Rogue Wave Software's Tools.h++ library), we wrap
59 // around them in std::
60 #elif defined(HAVE_RW_STDEX_HASH_SET_H)
61 # include
62 # ifndef HASH_NAMESPACE
63 # define HASH_NAMESPACE std
64 # endif
65
66 // Support Microsoft VC++.
67 #elif defined(_MSC_VER)
68 # include
69 # ifndef HASH_NAMESPACE
70 # define HASH_NAMESPACE stdext
71 # endif
72
73 // Give a warning if we couldn't find it, instead of (or in addition to)
74 // randomly doing something dumb.
75 #else
76 # warning "Autoconfiguration failed to find the hash_set header file."
77 #endif
78
79 // we wrap Rogue Wave Tools.h++ rw_hashset into something SGI-looking, here:
80 #ifdef HAVE_RW_STDEX_HASH_SET_H
81 namespace HASH_NAMESPACE {
82
83 /*
84 template struct hash {
85 unsigned int operator()(const unsigned int& x) const {
86 return x;
87 }
88 };
89 */
90
91 template
92 class _HashFcn = hash,
93 class _EqualKey = equal_to,
94 class _A = allocator >
95 class hash_set :
96 public rw_hashset {
97 };
98
99 } // end HASH_NAMESPACE;
100 #endif
101
102 using HASH_NAMESPACE::hash_set;
103
104 // Include vector because ext/hash_set includes stl_vector.h and leaves
105 // out specializations like stl_bvector.h, causing link conflicts.
106 #include
107
108 #include "llvm/ADT/HashExtras.h"
109
110 #endif
0 //===-- llvm/ADT/iterator - Portable wrapper around --*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file was developed by the LLVM research group and is distributed under
5 // the University of Illinois Open Source License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file provides a wrapper around the mysterious header file.
10 // In GCC 2.95.3, the file defines a bidirectional_iterator class (and other
11 // friends), instead of the standard iterator class. In GCC 3.1, the
12 // bidirectional_iterator class got moved out and the new, standards compliant,
13 // iterator<> class was added. Because there is nothing that we can do to get
14 // correct behavior on both compilers, we have this header with #ifdef's. Gross
15 // huh?
16 //
17 // By #includ'ing this file, you get the contents of plus the
18 // following classes in the global namespace:
19 //
20 // 1. bidirectional_iterator
21 // 2. forward_iterator
22 //
23 // The #if directives' expressions are filled in by Autoconf.
24 //
25 //===----------------------------------------------------------------------===//
26
27 #ifndef LLVM_ADT_ITERATOR
28 #define LLVM_ADT_ITERATOR
29
30 #include
31
32 #undef HAVE_BI_ITERATOR
33 #undef HAVE_STD_ITERATOR
34 #undef HAVE_FWD_ITERATOR
35
36 // defined by Kevin
37 #define HAVE_STD_ITERATOR 1
38
39 #ifdef _MSC_VER
40 # define HAVE_BI_ITERATOR 0
41 # define HAVE_STD_ITERATOR 1
42 # define HAVE_FWD_ITERATOR 0
43 #endif
44
45 #if !HAVE_BI_ITERATOR
46 # if HAVE_STD_ITERATOR
47 /// If the bidirectional iterator is not defined, we attempt to define it in
48 /// terms of the C++ standard iterator. Otherwise, we import it with a "using"
49 /// statement.
50 ///
51 template
52 struct bidirectional_iterator
53 : public std::iterator {
54 };
55 # else
56 # error "Need to have standard iterator to define bidirectional iterator!"
57 # endif
58 #else
59 using std::bidirectional_iterator;
60 #endif
61
62 #if !HAVE_FWD_ITERATOR
63 # if HAVE_STD_ITERATOR
64 /// If the forward iterator is not defined, attempt to define it in terms of
65 /// the C++ standard iterator. Otherwise, we import it with a "using" statement.
66 ///
67 template
68 struct forward_iterator
69 : public std::iterator {
70 };
71 # else
72 # error "Need to have standard iterator to define forward iterator!"
73 # endif
74 #else
75 using std::forward_iterator;
76 #endif
77
78 #endif
0
1 /**************************************
2 ** Created by Kevin from config.h.in **
3 ***************************************/
4
5 /* Define if dlopen(0) will open the symbols of the program */
6 #undef CAN_DLOPEN_SELF
7
8 /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
9 systems. This function is required for `alloca.c' support on those systems.
10 */
11 #undef CRAY_STACKSEG_END
12
13 /* Define to 1 if using `alloca.c'. */
14 #undef C_ALLOCA
15
16 /* Define if CBE is enabled for printf %a output */
17 #undef ENABLE_CBE_PRINTF_A
18
19 /* Define if position independent code is enabled */
20 #undef ENABLE_PIC
21
22 /* Define if threads enabled */
23 #cmakedefine ENABLE_THREADS ${ENABLE_THREADS}
24
25 /* Define to 1 if you have `alloca', as a function or macro. */
26 #undef HAVE_ALLOCA
27
28 /* Define to 1 if you have and it should be used (not on Ultrix).
29 */
30 #undef HAVE_ALLOCA_H
31
32 /* Define to 1 if you have the `argz_append' function. */
33 #undef HAVE_ARGZ_APPEND
34
35 /* Define to 1 if you have the `argz_create_sep' function. */
36 #undef HAVE_ARGZ_CREATE_SEP
37
38 /* Define to 1 if you have the header file. */
39 #cmakedefine HAVE_ARGZ_H ${HAVE_ARGZ_H}
40
41 /* Define to 1 if you have the `argz_insert' function. */
42 #undef HAVE_ARGZ_INSERT
43
44 /* Define to 1 if you have the `argz_next' function. */
45 #undef HAVE_ARGZ_NEXT
46
47 /* Define to 1 if you have the `argz_stringify' function. */
48 #undef HAVE_ARGZ_STRINGIFY
49
50 /* Define to 1 if you have the header file. */
51 #cmakedefine HAVE_ASSERT_H ${HAVE_ASSERT_H}
52
53 /* Define to 1 if you have the `backtrace' function. */
54 #undef HAVE_BACKTRACE
55
56 /* Define to 1 if you have the `bcopy' function. */
57 #undef HAVE_BCOPY
58
59 /* Does not have bi-directional iterator */
60 #undef HAVE_BI_ITERATOR
61
62 /* Define to 1 if you have the `ceilf' function. */
63 #undef HAVE_CEILF
64
65 /* Define to 1 if you have the `closedir' function. */
66 #undef HAVE_CLOSEDIR
67
68 /* Define to 1 if you have the header file. */
69 #undef HAVE_CTYPE_H
70
71 /* Define to 1 if you have the header file, and it defines `DIR'.
72 */
73 #cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H}
74
75 /* Define if you have the GNU dld library. */
76 #undef HAVE_DLD
77
78 /* Define to 1 if you have the header file. */
79 #cmakedefine HAVE_DLD_H ${HAVE_DLD_H}
80
81 /* Define to 1 if you have the `dlerror' function. */
82 #undef HAVE_DLERROR
83
84 /* Define to 1 if you have the header file. */
85 #cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H}
86
87 /* Define if dlopen() is available on this platform. */
88 #undef HAVE_DLOPEN
89
90 /* Define to 1 if you have the header file. */
91 #cmakedefine HAVE_DL_H ${HAVE_DL_H}
92
93 /* Define if the dot program is available */
94 #undef HAVE_DOT
95
96 /* Define if the dotty program is available */
97 #undef HAVE_DOTTY
98
99 /* Define if you have the _dyld_func_lookup function. */
100 #undef HAVE_DYLD
101
102 /* Define to 1 if you have the header file. */
103 #cmakedefine HAVE_ERRNO_H ${HAVE_ERRNO_H}
104
105 /* Define to 1 if the system has the type `error_t'. */
106 #undef HAVE_ERROR_T
107
108 /* Define to 1 if you have the header file. */
109 #cmakedefine HAVE_EXECINFO_H ${HAVE_EXECINFO_H}
110
111 /* Define to 1 if you have the header file. */
112 #cmakedefine HAVE_FCNTL_H ${HAVE_FCNTL_H}
113
114 /* Set to 1 if the finite function is found in */
115 #undef HAVE_FINITE_IN_IEEEFP_H
116
117 /* Define to 1 if you have the `floorf' function. */
118 #undef HAVE_FLOORF
119
120 /* Does not have forward iterator */
121 #undef HAVE_FWD_ITERATOR
122
123 /* Define to 1 if you have the `getcwd' function. */
124 #undef HAVE_GETCWD
125
126 /* Define to 1 if you have the `getpagesize' function. */
127 #cmakedefine HAVE_GETPAGESIZE ${HAVE_GETPAGESIZE}
128
129 /* Define to 1 if you have the `getrlimit' function. */
130 #undef HAVE_GETRLIMIT
131
132 /* Define to 1 if you have the `getrusage' function. */
133 #cmakedefine HAVE_GETRUSAGE ${HAVE_GETRUSAGE}
134
135 /* Define to 1 if you have the `gettimeofday' function. */
136 #undef HAVE_GETTIMEOFDAY
137
138 /* Does not have */
139 #undef HAVE_GLOBAL_HASH_MAP
140
141 /* Does not have hash_set in global namespace */
142 #undef HAVE_GLOBAL_HASH_SET
143
144 /* Does not have ext/hash_map */
145 #undef HAVE_GNU_EXT_HASH_MAP
146
147 /* Does not have hash_set in gnu namespace */
148 #undef HAVE_GNU_EXT_HASH_SET
149
150 /* Define if the Graphviz program is available */
151 #undef HAVE_GRAPHVIZ
152
153 /* Define if the gv program is available */
154 #undef HAVE_GV
155
156 /* Define to 1 if you have the `index' function. */
157 #undef HAVE_INDEX
158
159 /* Define to 1 if the system has the type `int64_t'. */
160 #undef HAVE_INT64_T
161
162 /* Define to 1 if you have the header file. */
163 #cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H}
164
165 /* Define to 1 if you have the `isatty' function. */
166 #undef HAVE_ISATTY
167
168 /* Set to 1 if the isinf function is found in */
169 #cmakedefine HAVE_ISINF_IN_CMATH ${HAVE_ISINF_IN_CMATH}
170
171 /* Set to 1 if the isinf function is found in */
172 #cmakedefine HAVE_ISINF_IN_MATH_H ${HAVE_ISINF_IN_MATH_H}
173
174 /* Set to 1 if the isnan function is found in */
175 #cmakedefine HAVE_ISNAN_IN_CMATH ${HAVE_ISNAN_IN_CMATH}
176
177 /* Set to 1 if the isnan function is found in */
178 #cmakedefine HAVE_ISNAN_IN_MATH_H ${HAVE_ISNAN_IN_MATH_H}
179
180 /* Define if you have the libdl library or equivalent. */
181 #undef HAVE_LIBDL
182
183 /* Define to 1 if you have the `elf' library (-lelf). */
184 #undef HAVE_LIBELF
185
186 /* Define to 1 if you have the `imagehlp' library (-limagehlp). */
187 #cmakedefine HAVE_LIBIMAGEHLP ${HAVE_LIBIMAGEHLP}
188
189 /* Define to 1 if you have the `m' library (-lm). */
190 #undef HAVE_LIBM
191
192 /* Define to 1 if you have the `psapi' library (-lpsapi). */
193 #cmakedefine HAVE_LIBPSAPI ${HAVE_LIBPSAPI}
194
195 /* Define to 1 if you have the `pthread' library (-lpthread). */
196 #undef HAVE_LIBPTHREAD
197
198 /* Define to 1 if you have the `udis86' library (-ludis86). */
199 #undef HAVE_LIBUDIS86
200
201 /* Define to 1 if you have the header file. */
202 #cmakedefine HAVE_LIMITS_H ${HAVE_LIMITS_H}
203
204 /* Define to 1 if you have the header file. */
205 #cmakedefine HAVE_LINK_H ${HAVE_LINK_H}
206
207 /* Define if you can use -Wl,-R. to pass -R. to the linker, in order to add
208 the current directory to the dynamic linker search path. */
209 #undef HAVE_LINK_R
210
211 /* Define to 1 if you have the `longjmp' function. */
212 #undef HAVE_LONGJMP
213
214 /* Define if lt_dlopen() is available on this platform */
215 #undef HAVE_LT_DLOPEN
216
217 /* Define to 1 if you have the header file. */
218 #undef HAVE_MACH_MACH_H
219
220 /* Define to 1 if you have the header file. */
221 #undef HAVE_MACH_O_DYLD_H
222
223 /* Define if mallinfo() is available on this platform. */
224 #cmakedefine HAVE_MALLINFO ${HAVE_MALLINFO}
225
226 /* Define to 1 if you have the header file. */
227 #cmakedefine HAVE_MALLOC_H ${HAVE_MALLOC_H}
228
229 /* Define to 1 if you have the header file. */
230 #cmakedefine HAVE_MALLOC_MALLOC_H ${HAVE_MALLOC_MALLOC_H}
231
232 /* Define to 1 if you have the `malloc_zone_statistics' function. */
233 #undef HAVE_MALLOC_ZONE_STATISTICS
234
235 /* Define to 1 if you have the `memcpy' function. */
236 #undef HAVE_MEMCPY
237
238 /* Define to 1 if you have the `memmove' function. */
239 #undef HAVE_MEMMOVE
240
241 /* Define to 1 if you have the header file. */
242 #cmakedefine HAVE_MEMORY_H ${HAVE_MEMORY_H}
243
244 /* Define to 1 if you have the `mkdtemp' function. */
245 #undef HAVE_MKDTEMP
246
247 /* Define to 1 if you have the `mkstemp' function. */
248 #undef HAVE_MKSTEMP
249
250 /* Define to 1 if you have the `mktemp' function. */
251 #undef HAVE_MKTEMP
252
253 /* Define to 1 if you have a working `mmap' system call. */
254 #undef HAVE_MMAP
255
256 /* Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if
257 it uses MAP_ANON */
258 #undef HAVE_MMAP_ANONYMOUS
259
260 /* Define if mmap() can map files into memory */
261 #undef HAVE_MMAP_FILE
262
263 /* define if the compiler implements namespaces */
264 #undef HAVE_NAMESPACES
265
266 /* Define to 1 if you have the header file, and it defines `DIR'. */
267 #cmakedefine HAVE_NDIR_H ${HAVE_NDIR_H}
268
269 /* Define to 1 if you have the `nearbyintf' function. */
270 #undef HAVE_NEARBYINTF
271
272 /* Define to 1 if you have the `opendir' function. */
273 #undef HAVE_OPENDIR
274
275 /* Define if libtool can extract symbol lists from object files. */
276 #undef HAVE_PRELOADED_SYMBOLS
277
278 /* Define to have the %a format string */
279 #undef HAVE_PRINTF_A
280
281 /* Have pthread_mutex_lock */
282 #cmakedefine HAVE_PTHREAD_MUTEX_LOCK ${HAVE_PTHREAD_MUTEX_LOCK}
283
284 /* Define to 1 if srand48/lrand48/drand48 exist in */
285 #undef HAVE_RAND48
286
287 /* Define to 1 if you have the `readdir' function. */
288 #undef HAVE_READDIR
289
290 /* Define to 1 if you have the `realpath' function. */
291 #undef HAVE_REALPATH
292
293 /* Define to 1 if you have the `rindex' function. */
294 #undef HAVE_RINDEX
295
296 /* Define to 1 if you have the `rintf' function. */
297 #undef HAVE_RINTF
298
299 /* Define to 1 if you have the `roundf' function. */
300 #undef HAVE_ROUNDF
301
302 /* Define to 1 if you have the `sbrk' function. */
303 #undef HAVE_SBRK
304
305 /* Define to 1 if you have the `setjmp' function. */
306 #undef HAVE_SETJMP
307
308 /* Define to 1 if you have the header file. */
309 #cmakedefine HAVE_SETJMP_H ${HAVE_SETJMP_H}
310
311 /* Define to 1 if you have the `setrlimit' function. */
312 #cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT}
313
314 /* Define if you have the shl_load function. */
315 #undef HAVE_SHL_LOAD
316
317 /* Define to 1 if you have the `siglongjmp' function. */
318 #undef HAVE_SIGLONGJMP
319
320 /* Define to 1 if you have the header file. */
321 #cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H}
322
323 /* Define to 1 if you have the `sigsetjmp' function. */
324 #undef HAVE_SIGSETJMP
325
326 /* Define to 1 if you have the header file. */
327 #cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H}
328
329 /* Define to 1 if you have the header file. */
330 #cmakedefine HAVE_STDIO_H ${HAVE_STDIO_H}
331
332 /* Define to 1 if you have the header file. */
333 #cmakedefine HAVE_STDLIB_H ${HAVE_STDLIB_H}
334
335 /* Does not have ext/hash_map> */
336 #undef HAVE_STD_EXT_HASH_MAP
337
338 /* Does not have hash_set in std namespace */
339 #undef HAVE_STD_EXT_HASH_SET
340
341 /* Set to 1 if the std::isinf function is found in */
342 #undef HAVE_STD_ISINF_IN_CMATH
343
344 /* Set to 1 if the std::isnan function is found in */
345 #undef HAVE_STD_ISNAN_IN_CMATH
346
347 /* Does not have std namespace iterator */
348 #undef HAVE_STD_ITERATOR
349
350 /* Define to 1 if you have the `strchr' function. */
351 #undef HAVE_STRCHR
352
353 /* Define to 1 if you have the `strcmp' function. */
354 #undef HAVE_STRCMP
355
356 /* Define to 1 if you have the `strdup' function. */
357 #undef HAVE_STRDUP
358
359 /* Define to 1 if you have the `strerror' function. */
360 #undef HAVE_STRERROR
361
362 /* Define to 1 if you have the `strerror_r' function. */
363 #undef HAVE_STRERROR_R
364
365 /* Define to 1 if you have the header file. */
366 #undef HAVE_STRINGS_H
367
368 /* Define to 1 if you have the header file. */
369 #undef HAVE_STRING_H
370
371 /* Define to 1 if you have the `strrchr' function. */
372 #undef HAVE_STRRCHR
373
374 /* Define to 1 if you have the `strtoll' function. */
375 #undef HAVE_STRTOLL
376
377 /* Define to 1 if you have the `strtoq' function. */
378 #undef HAVE_STRTOQ
379
380 /* Define to 1 if you have the `sysconf' function. */
381 #undef HAVE_SYSCONF
382
383 /* Define to 1 if you have the header file, and it defines `DIR'.
384 */
385 #cmakedefine HAVE_SYS_DIR_H ${HAVE_SYS_DIR_H}
386
387 /* Define to 1 if you have the header file. */
388 #cmakedefine HAVE_SYS_DL_H ${HAVE_SYS_DL_H}
389
390 /* Define to 1 if you have the header file. */
391 #cmakedefine HAVE_SYS_MMAN_H ${}
392
393 /* Define to 1 if you have the header file, and it defines `DIR'.
394 */
395 #cmakedefine HAVE_SYS_NDIR_H ${HAVE_SYS_NDIR_H}
396
397 /* Define to 1 if you have the header file. */
398 #cmakedefine HAVE_SYS_PARAM_H ${HAVE_SYS_PARAM_H}
399
400 /* Define to 1 if you have the header file. */
401 #cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H}
402
403 /* Define to 1 if you have the header file. */
404 #cmakedefine HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H}
405
406 /* Define to 1 if you have the header file. */
407 #cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H}
408
409 /* Define to 1 if you have the header file. */
410 #cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
411
412 /* Define to 1 if you have that is POSIX.1 compatible. */
413 #undef HAVE_SYS_WAIT_H
414
415 /* Define to 1 if the system has the type `uint64_t'. */
416 #undef HAVE_UINT64_T
417
418 /* Define to 1 if you have the header file. */
419 #cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H}
420
421 /* Define to 1 if you have the header file. */
422 #cmakedefine HAVE_UTIME_H ${HAVE_UTIME_H}
423
424 /* Define to 1 if the system has the type `u_int64_t'. */
425 #undef HAVE_U_INT64_T
426
427 /* Define to 1 if you have the header file. */
428 #undef HAVE_WINDOWS_H
429
430 /* Installation directory for binary executables */
431 #undef LLVM_BINDIR
432
433 /* Time at which LLVM was configured */
434 #undef LLVM_CONFIGTIME
435
436 /* Installation directory for documentation */
437 #undef LLVM_DATADIR
438
439 /* Installation directory for config files */
440 #undef LLVM_ETCDIR
441
442 /* Installation directory for include files */
443 #undef LLVM_INCLUDEDIR
444
445 /* Installation directory for .info files */
446 #undef LLVM_INFODIR
447
448 /* Installation directory for libraries */
449 #undef LLVM_LIBDIR
450
451 /* Installation directory for man pages */
452 #undef LLVM_MANDIR
453
454 /* Define if this is Unixish platform */
455 #cmakedefine LLVM_ON_UNIX ${LLVM_ON_UNIX}
456
457 /* Define if this is Win32ish platform */
458 #cmakedefine LLVM_ON_WIN32 ${LLVM_ON_WIN32}
459
460 /* Added by Kevin -- Maximum path length */
461 #cmakedefine MAXPATHLEN ${MAXPATHLEN}
462
463 /* Define to path to dot program if found or 'echo dot' otherwise */
464 #undef LLVM_PATH_DOT
465
466 /* Define to path to dotty program if found or 'echo dotty' otherwise */
467 #undef LLVM_PATH_DOTTY
468
469 /* Define to path to Graphviz program if found or 'echo Graphviz' otherwise */
470 #undef LLVM_PATH_GRAPHVIZ
471
472 /* Define to path to gv program if found or 'echo gv' otherwise */
473 #undef LLVM_PATH_GV
474
475 /* Installation prefix directory */
476 #undef LLVM_PREFIX
477
478 /* Define if the OS needs help to load dependent libraries for dlopen(). */
479 #undef LTDL_DLOPEN_DEPLIBS
480
481 /* Define to the sub-directory in which libtool stores uninstalled libraries.
482 */
483 #undef LTDL_OBJDIR
484
485 /* Define to the name of the environment variable that determines the dynamic
486 library search path. */
487 #undef LTDL_SHLIBPATH_VAR
488
489 /* Define to the extension used for shared libraries, say, ".so". */
490 #cmakedefine LTDL_SHLIB_EXT "${LTDL_SHLIB_EXT}"
491
492 /* Define to the system default library search path. */
493 #undef LTDL_SYSSEARCHPATH
494
495 /* Define if /dev/zero should be used when mapping RWX memory, or undefine if
496 its not necessary */
497 #undef NEED_DEV_ZERO_FOR_MMAP
498
499 /* Define if dlsym() requires a leading underscore in symbol names. */
500 #undef NEED_USCORE
501
502 /* Define to the address where bug reports for this package should be sent. */
503 #cmakedefine PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}"
504
505 /* Define to the full name of this package. */
506 #cmakedefine PACKAGE_NAME "${PACKAGE_NAME}"
507
508 /* Define to the full name and version of this package. */
509 #undef PACKAGE_STRING
510
511 /* Define to the one symbol short name of this package. */
512 #undef PACKAGE_TARNAME
513
514 /* Define to the version of this package. */
515 #cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}"
516
517 /* Define as the return type of signal handlers (`int' or `void'). */
518 #cmakedefine RETSIGTYPE ${RETSIGTYPE}
519
520 /* If using the C implementation of alloca, define if you know the
521 direction of stack growth for your system; otherwise it will be
522 automatically deduced at runtime.
523 STACK_DIRECTION > 0 => grows toward higher addresses
524 STACK_DIRECTION < 0 => grows toward lower addresses
525 STACK_DIRECTION = 0 => direction of growth unknown */
526 #undef STACK_DIRECTION
527
528 /* Define to 1 if the `S_IS*' macros in do not work properly. */
529 #undef STAT_MACROS_BROKEN
530
531 /* Define to 1 if you have the ANSI C header files. */
532 #undef STDC_HEADERS
533
534 /* Define to 1 if you can safely include both and . */
535 #undef TIME_WITH_SYS_TIME
536
537 /* Define to 1 if your declares `struct tm'. */
538 #undef TM_IN_SYS_TIME
539
540 /* Define if use udis86 library */
541 #undef USE_UDIS86
542
543 /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
544 `char[]'. */
545 #undef YYTEXT_POINTER
546
547 /* Define to empty if `const' does not conform to ANSI C. */
548 #undef const
549
550 /* Define to a type to use for `error_t' if it is not otherwise available. */
551 #undef error_t
552
553 /* Define to `int' if does not define. */
554 #undef pid_t
555
556 /* Define to `unsigned int' if does not define. */
557 #undef size_t
0 //===-- include/Support/DataTypes.h - Define fixed size types ---*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file was developed by the LLVM research group and is distributed under
5 // the University of Illinois Open Source License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains definitions to figure out the size of _HOST_ data types.
10 // This file is important because different host OS's define different macros,
11 // which makes portability tough. This file exports the following definitions:
12 //
13 // [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types
14 // [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values.
15 //
16 // No library is required when using these functinons.
17 //
18 //===----------------------------------------------------------------------===//
19
20 #ifndef SUPPORT_DATATYPES_H
21 #define SUPPORT_DATATYPES_H
22
23 #cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
24 #cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H}
25 #cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H}
26 #undef HAVE_UINT64_T
27 #undef HAVE_U_INT64_T
28
29 // FIXME: UGLY HACK (Added by Kevin)
30 #define HAVE_UINT64_T 1
31
32 #ifndef _MSC_VER
33
34 // Note that this header's correct operation depends on __STDC_LIMIT_MACROS
35 // being defined. We would define it here, but in order to prevent Bad Things
36 // happening when system headers or C++ STL headers include stdint.h before
37 // we define it here, we define it on the g++ command line (in Makefile.rules).
38 #if !defined(__STDC_LIMIT_MACROS)
39 # error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
40 #endif
41
42 // Note that includes , if this is a C99 system.
43 #ifdef HAVE_SYS_TYPES_H
44 #include
45 #endif
46
47 #ifdef HAVE_INTTYPES_H
48 #include
49 #endif
50
51 #ifdef HAVE_STDINT_H
52 #include
53 #endif
54
55 #ifdef __cplusplus
56 #include
57 #else
58 #include
59 #endif
60
61 #ifdef _AIX
62 #include "llvm/Support/AIXDataTypesFix.h"
63 #endif
64
65 // Handle incorrect definition of uint64_t as u_int64_t
66 #ifndef HAVE_UINT64_T
67 #ifdef HAVE_U_INT64_T
68 typedef u_int64_t uint64_t;
69 #else
70 # error "Don't have a definition for uint64_t on this platform"
71 #endif
72 #endif
73
74 #ifdef _OpenBSD_
75 #define INT8_MAX 127
76 #define INT8_MIN -128
77 #define UINT8_MAX 255
78 #define INT16_MAX 32767
79 #define INT16_MIN -32768
80 #define UINT16_MAX 65535
81 #define INT32_MAX 2147483647
82 #define INT32_MIN -2147483648
83 #define UINT32_MAX 4294967295U
84 #endif
85
86 #else /* _MSC_VER */
87 // Visual C++ doesn't provide standard integer headers, but it does provide
88 // built-in data types.
89 #include
90 #include
91 #include
92 typedef __int64 int64_t;
93 typedef unsigned __int64 uint64_t;
94 typedef signed int int32_t;
95 typedef unsigned int uint32_t;
96 typedef short int16_t;
97 typedef unsigned short uint16_t;
98 typedef signed char int8_t;
99 typedef unsigned char uint8_t;
100 typedef signed int ssize_t;
101 #define INT8_MAX 127
102 #define INT8_MIN -128
103 #define UINT8_MAX 255
104 #define INT16_MAX 32767
105 #define INT16_MIN -32768
106 #define UINT16_MAX 65535
107 #define INT32_MAX 2147483647
108 #define INT32_MIN -2147483648
109 #define UINT32_MAX 4294967295U
110 #endif /* _MSC_VER */
111
112 /* Set defaults for constants which we cannot find. */
113 #if !defined(INT64_MAX)
114 # define INT64_MAX 9223372036854775807LL
115 #endif
116 #if !defined(INT64_MIN)
117 # define INT64_MIN ((-INT64_MAX)-1)
118 #endif
119 #if !defined(UINT64_MAX)
120 # define UINT64_MAX 0xffffffffffffffffULL
121 #endif
122
123 #if __GNUC__ > 3
124 #define END_WITH_NULL __attribute__((sentinel))
125 #else
126 #define END_WITH_NULL
127 #endif
128
129 #ifndef HUGE_VALF
130 #define HUGE_VALF (float)HUGE_VAL
131 #endif
132
133 #endif /* SUPPORT_DATATYPES_H */
0 add_llvm_library(LLVMAnalysis
1 AliasAnalysis.cpp
2 AliasAnalysisCounter.cpp
3 AliasAnalysisEvaluator.cpp
4 AliasDebugger.cpp
5 AliasSetTracker.cpp
6 Analysis.cpp
7 BasicAliasAnalysis.cpp
8 CFGPrinter.cpp
9 ConstantFolding.cpp
10 InstCount.cpp
11 Interval.cpp
12 IntervalPartition.cpp
13 LibCallAliasAnalysis.cpp
14 LibCallSemantics.cpp
15 LoopInfo.cpp
16 LoopPass.cpp
17 LoopVR.cpp
18 MemoryDependenceAnalysis.cpp
19 PostDominators.cpp
20 ProfileInfo.cpp
21 ProfileInfoLoader.cpp
22 ProfileInfoLoaderPass.cpp
23 ScalarEvolution.cpp
24 ScalarEvolutionExpander.cpp
25 SparsePropagation.cpp
26 Trace.cpp
27 ValueTracking.cpp
28 )
0 add_llvm_library(LLVMipa
1 Andersens.cpp
2 CallGraph.cpp
3 CallGraphSCCPass.cpp
4 FindUsedTypes.cpp
5 GlobalsModRef.cpp
6 )
0 add_llvm_library(LLVMArchive
1 Archive.cpp
2 ArchiveReader.cpp
3 ArchiveWriter.cpp
4 )
0 # AsmParser, with a Bison generated parser:
1 include(FindBison)
2 find_bison()
3 bison_generator(
4 "llvmAsm"
5 "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.y"
6 "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.h"
7 "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.cpp"
8 )
9
10 add_llvm_library(LLVMAsmParser
11 llvmAsmParser.cpp # Generated from llvmAsmParser.y
12 LLLexer.cpp
13 Parser.cpp
14 )
0 add_llvm_library(LLVMBitReader
1 BitReader.cpp
2 BitcodeReader.cpp
3 Deserialize.cpp
4 DeserializeAPFloat.cpp
5 DeserializeAPInt.cpp
6 )
0 add_llvm_library(LLVMBitWriter
1 BitWriter.cpp
2 BitcodeWriter.cpp
3 BitcodeWriterPass.cpp
4 Serialize.cpp
5 SerializeAPFloat.cpp
6 SerializeAPInt.cpp
7 ValueEnumerator.cpp
8 )
0 add_llvm_library(LLVMAsmPrinter
1 AsmPrinter.cpp
2 DwarfWriter.cpp
3 OcamlGCPrinter.cpp
4 )
0 add_llvm_library(LLVMCodeGen
1 BranchFolding.cpp
2 DeadMachineInstructionElim.cpp
3 ELFWriter.cpp
4 GCMetadata.cpp
5 GCMetadataPrinter.cpp
6 GCStrategy.cpp
7 IfConversion.cpp
8 IntrinsicLowering.cpp
9 LLVMTargetMachine.cpp
10 LiveInterval.cpp
11 LiveIntervalAnalysis.cpp
12 LiveStackAnalysis.cpp
13 LiveVariables.cpp
14 LoopAligner.cpp
15 LowerSubregs.cpp
16 MachOWriter.cpp
17 MachineBasicBlock.cpp
18 MachineDominators.cpp
19 MachineFunction.cpp
20 MachineInstr.cpp
21 MachineLICM.cpp
22 MachineLoopInfo.cpp
23 MachineModuleInfo.cpp
24 MachinePassRegistry.cpp
25 MachineRegisterInfo.cpp
26 MachineSink.cpp
27 OcamlGC.cpp
28 PHIElimination.cpp
29 Passes.cpp
30 PostRASchedulerList.cpp
31 PrologEpilogInserter.cpp
32 PseudoSourceValue.cpp
33 RegAllocBigBlock.cpp
34 RegAllocLinearScan.cpp
35 RegAllocLocal.cpp
36 RegAllocSimple.cpp
37 RegisterCoalescer.cpp
38 RegisterScavenging.cpp
39 ShadowStackGC.cpp
40 SimpleRegisterCoalescing.cpp
41 StackSlotColoring.cpp
42 StrongPHIElimination.cpp
43 TargetInstrInfoImpl.cpp
44 TwoAddressInstructionPass.cpp
45 UnreachableBlockElim.cpp
46 VirtRegMap.cpp
47 )
0 add_llvm_library(LLVMSelectionDAG
1 CallingConvLower.cpp
2 DAGCombiner.cpp
3 FastISel.cpp
4 LegalizeDAG.cpp
5 LegalizeFloatTypes.cpp
6 LegalizeIntegerTypes.cpp
7 LegalizeTypes.cpp
8 LegalizeTypesGeneric.cpp
9 LegalizeVectorTypes.cpp
10 ScheduleDAG.cpp
11 ScheduleDAGEmit.cpp
12 ScheduleDAGFast.cpp
13 ScheduleDAGList.cpp
14 ScheduleDAGRRList.cpp
15 SelectionDAGBuild.cpp
16 SelectionDAG.cpp
17 SelectionDAGISel.cpp
18 SelectionDAGPrinter.cpp
19 TargetLowering.cpp
20 )
0 add_llvm_library(LLVMDebugger
1 Debugger.cpp
2 ProgramInfo.cpp
3 RuntimeInfo.cpp
4 SourceFile.cpp
5 SourceLanguage-CFamily.cpp
6 SourceLanguage-CPlusPlus.cpp
7 SourceLanguage-Unknown.cpp
8 SourceLanguage.cpp
9 )
0 add_llvm_library(LLVMExecutionEngine
1 ExecutionEngine.cpp
2 ExecutionEngineBindings.cpp
3 )
0 add_partially_linked_object(LLVMInterpreter
1 Execution.cpp
2 ExternalFunctions.cpp
3 Interpreter.cpp
4 )
0 # TODO: Support other architectures. See Makefile.
1 add_definitions(-DENABLE_X86_JIT)
2
3 add_partially_linked_object(LLVMJIT
4 Intercept.cpp
5 JIT.cpp
6 JITDwarfEmitter.cpp
7 JITEmitter.cpp
8 JITMemoryManager.cpp
9 TargetSelect.cpp
10 )
0 add_llvm_library(LLVMLinker
1 LinkArchives.cpp
2 LinkItems.cpp
3 LinkModules.cpp
4 Linker.cpp
5 )
0 add_llvm_library(LLVMSupport
1 APFloat.cpp
2 APInt.cpp
3 APSInt.cpp
4 Allocator.cpp
5 Annotation.cpp
6 CommandLine.cpp
7 ConstantRange.cpp
8 Debug.cpp
9 Dwarf.cpp
10 FileUtilities.cpp
11 FoldingSet.cpp
12 GraphWriter.cpp
13 IsInf.cpp
14 IsNAN.cpp
15 ManagedStatic.cpp
16 MemoryBuffer.cpp
17 PluginLoader.cpp
18 SlowOperationInformer.cpp
19 SmallPtrSet.cpp
20 Statistic.cpp
21 Streams.cpp
22 StringExtras.cpp
23 StringMap.cpp
24 StringPool.cpp
25 SystemUtils.cpp
26 Timer.cpp
27 raw_ostream.cpp
28 )
0 add_llvm_library(LLVMSystem
1 Alarm.cpp
2 Disassembler.cpp
3 DynamicLibrary.cpp
4 IncludeFile.cpp
5 Memory.cpp
6 Mutex.cpp
7 Path.cpp
8 Process.cpp
9 Program.cpp
10 Signals.cpp
11 TimeValue.cpp
12 )
0 add_llvm_library(LLVMTarget
1 DarwinTargetAsmInfo.cpp
2 ELFTargetAsmInfo.cpp
3 SubtargetFeature.cpp
4 Target.cpp
5 TargetAsmInfo.cpp
6 TargetData.cpp
7 TargetFrameInfo.cpp
8 TargetInstrInfo.cpp
9 TargetMachOWriterInfo.cpp
10 TargetMachine.cpp
11 TargetMachineRegistry.cpp
12 TargetRegisterInfo.cpp
13 TargetSubtarget.cpp
14 )
15
16 # TODO: Support other targets besides X86. See Makefile.
0 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
1
2 add_llvm_library(LLVMX86AsmPrinter
3 X86ATTAsmPrinter.cpp
4 X86AsmPrinter.cpp
5 X86IntelAsmPrinter.cpp
6 )
0 macro(x86tgen ofn)
1 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
2 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}
3 DEPENDS tblgen ${CMAKE_CURRENT_SOURCE_DIR}/X86.td
4 COMMENT "Building ${ofn}..."
5 )
6 endmacro(x86tgen)
7
8 x86tgen(X86GenRegisterInfo.h.inc -gen-register-desc-header)
9 x86tgen(X86GenRegisterNames.inc -gen-register-enums)
10 x86tgen(X86GenRegisterInfo.inc -gen-register-desc)
11 x86tgen(X86GenInstrNames.inc -gen-instr-enums)
12 x86tgen(X86GenInstrInfo.inc -gen-instr-desc)
13 x86tgen(X86GenAsmWriter.inc -gen-asm-writer)
14 x86tgen(X86GenAsmWriter1.inc -gen-asm-writer -asmwriternum=1)
15 x86tgen(X86GenDAGISel.inc -gen-dag-isel)
16 x86tgen(X86GenFastISel.inc -gen-fast-isel)
17 x86tgen(X86GenCallingConv.inc -gen-callingconv)
18 x86tgen(X86GenSubtarget.inc -gen-subtarget)
19
20 add_custom_target(X86Table_gen echo Tablegenning
21 DEPENDS
22 ${llvm_builded_incs_dir}/Intrinsics.gen
23 ${CMAKE_CURRENT_BINARY_DIR}/X86GenRegisterInfo.h.inc
24 ${CMAKE_CURRENT_BINARY_DIR}/X86GenRegisterNames.inc
25 ${CMAKE_CURRENT_BINARY_DIR}/X86GenRegisterInfo.inc
26 ${CMAKE_CURRENT_BINARY_DIR}/X86GenInstrNames.inc
27 ${CMAKE_CURRENT_BINARY_DIR}/X86GenInstrInfo.inc
28 ${CMAKE_CURRENT_BINARY_DIR}/X86GenAsmWriter.inc
29 ${CMAKE_CURRENT_BINARY_DIR}/X86GenAsmWriter1.inc
30 ${CMAKE_CURRENT_BINARY_DIR}/X86GenDAGISel.inc
31 ${CMAKE_CURRENT_BINARY_DIR}/X86GenFastISel.inc
32 ${CMAKE_CURRENT_BINARY_DIR}/X86GenCallingConv.inc
33 ${CMAKE_CURRENT_BINARY_DIR}/X86GenSubtarget.inc
34 )
35
36 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
37
38 add_partially_linked_object(LLVMX86CodeGen
39 X86CodeEmitter.cpp
40 X86ELFWriterInfo.cpp
41 X86FloatingPoint.cpp
42 X86ISelDAGToDAG.cpp
43 X86ISelLowering.cpp
44 X86InstrInfo.cpp
45 X86JITInfo.cpp
46 X86RegisterInfo.cpp
47 X86Subtarget.cpp
48 X86TargetAsmInfo.cpp
49 X86TargetMachine.cpp
50 X86FastISel.cpp
51 )
52
53 add_dependencies(LLVMX86CodeGen
54 X86Table_gen
55 )
0 add_llvm_library( LLVMHello
1 Hello.cpp
2 )
0 add_llvm_library(LLVMipo
1 AddReadAttrs.cpp
2 ArgumentPromotion.cpp
3 ConstantMerge.cpp
4 DeadArgumentElimination.cpp
5 DeadTypeElimination.cpp
6 ExtractGV.cpp
7 GlobalDCE.cpp
8 GlobalOpt.cpp
9 IndMemRemoval.cpp
10 InlineAlways.cpp
11 Inliner.cpp
12 InlineSimple.cpp
13 Internalize.cpp
14 IPConstantPropagation.cpp
15 LoopExtractor.cpp
16 LowerSetJmp.cpp
17 PartialSpecialization.cpp
18 PruneEH.cpp
19 RaiseAllocations.cpp
20 StripDeadPrototypes.cpp
21 StripSymbols.cpp
22 StructRetPromotion.cpp
23 )
0 add_llvm_library(LLVMInstrumentation
1 BlockProfiling.cpp
2 EdgeProfiling.cpp
3 ProfilingUtils.cpp
4 RSProfiling.cpp
5 )
0 add_llvm_library(LLVMScalarOpts
1 ADCE.cpp
2 BasicBlockPlacement.cpp
3 CodeGenPrepare.cpp
4 CondPropagate.cpp
5 ConstantProp.cpp
6 DCE.cpp
7 DeadStoreElimination.cpp
8 GVN.cpp
9 GVNPRE.cpp
10 IndVarSimplify.cpp
11 InstructionCombining.cpp
12 JumpThreading.cpp
13 LICM.cpp
14 LoopDeletion.cpp
15 LoopIndexSplit.cpp
16 LoopRotation.cpp
17 LoopStrengthReduce.cpp
18 LoopUnroll.cpp
19 LoopUnswitch.cpp
20 MemCpyOptimizer.cpp
21 PredicateSimplifier.cpp
22 Reassociate.cpp
23 Reg2Mem.cpp
24 SCCP.cpp
25 Scalar.cpp
26 ScalarReplAggregates.cpp
27 SimplifyCFGPass.cpp
28 SimplifyLibCalls.cpp
29 TailDuplication.cpp
30 TailRecursionElimination.cpp
31 )
0 add_llvm_library(LLVMTransformUtils
1 BasicBlockUtils.cpp
2 BasicInliner.cpp
3 BreakCriticalEdges.cpp
4 CloneFunction.cpp
5 CloneLoop.cpp
6 CloneModule.cpp
7 CloneTrace.cpp
8 CodeExtractor.cpp
9 DemoteRegToStack.cpp
10 InlineCost.cpp
11 InlineFunction.cpp
12 LCSSA.cpp
13 Local.cpp
14 LoopSimplify.cpp
15 LowerAllocations.cpp
16 LowerInvoke.cpp
17 LowerSwitch.cpp
18 Mem2Reg.cpp
19 PromoteMemoryToRegister.cpp
20 SimplifyCFG.cpp
21 UnifyFunctionExitNodes.cpp
22 UnrollLoop.cpp
23 ValueMapper.cpp
24 InstructionNamer.cpp
25 )
0 add_llvm_library(LLVMVMCore
1 AsmWriter.cpp
2 AutoUpgrade.cpp
3 BasicBlock.cpp
4 ConstantFold.cpp
5 Constants.cpp
6 Core.cpp
7 DebugInfoBuilder.cpp
8 Dominators.cpp
9 Function.cpp
10 Globals.cpp
11 InlineAsm.cpp
12 Instruction.cpp
13 Instructions.cpp
14 IntrinsicInst.cpp
15 LeakDetector.cpp
16 Mangler.cpp
17 Module.cpp
18 ModuleProvider.cpp
19 ParameterAttributes.cpp
20 Pass.cpp
21 PassManager.cpp
22 Type.cpp
23 TypeSymbolTable.cpp
24 Use.cpp
25 Value.cpp
26 ValueSymbolTable.cpp
27 ValueTypes.cpp
28 Verifier.cpp
29 )
30
31 add_dependencies( LLVMVMCore ${llvm_builded_incs_dir}/Intrinsics.gen )
0 # NOTE: The tools are organized into five groups of four consisting of one
1 # large and three small executables. This is done to minimize memory load
2 # in parallel builds. Please retain this ordering.
3
4 if( NOT MSVC )
5 add_subdirectory(llvm-config)
6 endif( NOT MSVC )
7
8 add_subdirectory(opt)
9 add_subdirectory(llvm-as)
10 add_subdirectory(llvm-dis)
11
12 add_subdirectory(llc)
13 add_subdirectory(llvm-ranlib)
14 add_subdirectory(llvm-ar)
15 add_subdirectory(llvm-nm)
16
17 add_subdirectory(llvm-ld)
18 add_subdirectory(llvm-prof)
19 add_subdirectory(llvm-link)
20 add_subdirectory(lli)
21
22 # gccas and gccld are deprecated:
23 # add_subdirectory(gccas)
24 # add_subdirectory(gccld)
25 add_subdirectory(llvm-extract)
26 add_subdirectory(llvm-db)
27
28 add_subdirectory(bugpoint)
29 add_subdirectory(llvm-bcanalyzer)
30 add_subdirectory(llvm-stub)
31 add_subdirectory(llvmc2)
0 set(LLVM_LINK_COMPONENTS asmparser instrumentation scalaropts ipo
1 linker bitreader bitwriter)
2 set(LLVM_REQUIRES_EH 1)
3
4 add_llvm_tool(bugpoint
5 BugDriver.cpp
6 CrashDebugger.cpp
7 ExecutionDriver.cpp
8 ExtractFunction.cpp
9 FindBugs.cpp
10 Miscompilation.cpp
11 OptimizerDriver.cpp
12 TestPasses.cpp
13 ToolRunner.cpp
14 bugpoint.cpp
15 )
0 set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} bitreader asmprinter)
1
2 add_llvm_tool(llc
3 llc.cpp
4 )
0 set(LLVM_LINK_COMPONENTS jit interpreter nativecodegen bitreader selectiondag)
1
2 add_llvm_tool(lli
3 lli.cpp
4 )
0 set(LLVM_LINK_COMPONENTS archive)
1 set(LLVM_REQUIRES_EH 1)
2
3 add_llvm_tool(llvm-ar
4 llvm-ar.cpp
5 )
6
7 # TODO: Support check-local.
0 set(LLVM_LINK_COMPONENTS asmparser bitwriter)
1 set(LLVM_REQUIRES_EH 1)
2
3 add_llvm_tool(llvm-as
4 llvm-as.cpp
5 )
0 set(LLVM_LINK_COMPONENTS bitreader)
1 set(LLVM_REQUIRES_EH 1)
2
3 add_llvm_tool(llvm-bcanalyzer
4 llvm-bcanalyzer.cpp
5 )
0 include(TestBigEndian)
1
2 if( NOT PERL_FOUND )
3 message(FATAL_ERROR "Perl required but not found!")
4 endif( NOT PERL_FOUND )
5
6 set(PERL ${PERL_EXECUTABLE})
7 set(VERSION PACKAGE_VERSION)
8 set(PREFIX ${LLVM_BINARY_DIR}) # TODO: Root for `make install'.
9 execute_process(COMMAND date
10 OUTPUT_VARIABLE LLVM_CONFIGTIME
11 OUTPUT_STRIP_TRAILING_WHITESPACE)
12 set(abs_top_srcdir ${LLVM_MAIN_SRC_DIR})
13 set(abs_top_builddir ${LLVM_BINARY_DIR})
14 # LLVM_ON_UNIX and LLVM_ON_WIN32 already set.
15 # those are set to blank by `autoconf' on MinGW, so it seems they are not required:
16 #set(LLVMGCCDIR "")
17 #set(LLVMGCC "")
18 #set(LLVMGXX "")
19 #set(LLVMGCC_VERSION "")
20 #set(LLVMGCC_MAJVERS "")
21 test_big_endian(IS_BIG_ENDIAN)
22 if( IS_BIG_ENDIAN )
23 set(ENDIAN "big")
24 else( IS_BIG_ENDIAN )
25 set(ENDIAN "little")
26 endif( IS_BIG_ENDIAN )
27 set(SHLIBEXT ${LTDL_SHLIB_EXT})
28 #EXEEXT already set.
29 set(OS "${CMAKE_SYSTEM}")
30 set(ARCH "X86") # TODO: This gives "i686" in Linux: "${CMAKE_SYSTEM_PROCESSOR}")
31 # TODO: avoid using autoconf:
32 set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess)
33 execute_process(COMMAND sh ${config_guess}
34 RESULT_VARIABLE TT_RV
35 OUTPUT_VARIABLE LLVM_TARGET_TRIPLET
36 OUTPUT_STRIP_TRAILING_WHITESPACE)
37 message(STATUS "Target triplet: ${LLVM_TARGET_TRIPLET}")
38 if( NOT TT_RV EQUAL 0 )
39 message(FATAL_ERROR "Failed to execute ${config_guess}")
40 endif( NOT TT_RV EQUAL 0 )
41 set(target ${LLVM_TARGET_TRIPLET})
42 set(TARGETS_TO_BUILD "X86") # TODO
43 set(TARGET_HAS_JIT "1") # TODO
44
45 # Avoids replacement at config-time:
46 set(LLVM_CPPFLAGS "@LLVM_CPPFLAGS@")
47 set(LLVM_CFLAGS "@LLVM_CFLAGS@")
48 set(LLVM_CXXFLAGS "@LLVM_CXXFLAGS@")
49 set(LLVM_LDFLAGS "@LLVM_LDFLAGS@")
50 set(LIBS "@LIBS@")
51 set(LLVM_BUILDMODE "@LLVM_BUILDMODE@")
52
53 configure_file(
54 ${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.in.in
55 ${CMAKE_CURRENT_BINARY_DIR}/llvm-config.in
56 @ONLY
57 )
58
59 set(LIBDEPS ${CMAKE_CURRENT_BINARY_DIR}/LibDeps.txt)
60 set(LIBDEPS_TMP ${CMAKE_CURRENT_BINARY_DIR}/LibDeps.txt.tmp)
61 set(FINAL_LIBDEPS ${CMAKE_CURRENT_BINARY_DIR}/FinalLibDeps.txt)
62 set(LLVM_CONFIG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/llvm-config)
63 set(LLVM_CONFIG_IN ${CMAKE_CURRENT_BINARY_DIR}/llvm-config.in)
64
65 # set(LIBDEPS LibDeps.txt)
66 # set(LIBDEPS_TMP LibDeps.txt.tmp)
67 # set(FINAL_LIBDEPS FinalLibDeps.txt)
68
69 add_custom_command(OUTPUT ${LIBDEPS_TMP}
70 COMMAND ${PERL_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/GenLibDeps.pl -flat ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} > ${LIBDEPS_TMP}
71 DEPENDS ${llvm_libs}
72 COMMENT "Regenerating ${LIBDEPS_TMP}")
73
74 add_custom_command(OUTPUT ${LIBDEPS}
75 COMMAND cmp -s ${LIBDEPS_TMP} ${LIBDEPS} || \( cp ${LIBDEPS_TMP} ${LIBDEPS} && echo "Updated ${LIBDEPS} because dependencies changed" \)
76 DEPENDS ${LIBDEPS_TMP})
77
78 add_custom_command(OUTPUT ${FINAL_LIBDEPS}
79 COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/find-cycles.pl < ${LIBDEPS} > ${FINAL_LIBDEPS} || rm -f ${FINAL_LIBDEPS}
80 DEPENDS ${LIBDEPS}
81 COMMENT "Checking for cyclic dependencies between LLVM libraries.")
82
83 add_custom_command(OUTPUT ${LLVM_CONFIG}
84 COMMAND echo 's,@LLVM_CPPFLAGS@,${CMAKE_CPP_FLAGS},' > temp.sed
85 COMMAND echo 's,@LLVM_CFLAGS@,${CMAKE_C_FLAGS},' >> temp.sed
86 COMMAND echo 's,@LLVM_CXXFLAGS@,${CMAKE_CXX_FLAGS},' >> temp.sed
87 # TODO: Use general flags for linking, not just for shared libs:
88 COMMAND echo 's,@LLVM_LDFLAGS@,${CMAKE_SHARED_LINKER_FLAGS},' >> temp.sed
89 COMMAND echo 's,@LIBS@,,' >> temp.sed # TODO: System libs
90 COMMAND echo 's,@LLVM_BUILDMODE@,${CMAKE_BUILD_TYPE},' >> temp.sed
91 COMMAND sed -f temp.sed < ${LLVM_CONFIG_IN} > ${LLVM_CONFIG}
92 COMMAND rm temp.sed
93 COMMAND cat ${FINAL_LIBDEPS} >> ${LLVM_CONFIG}
94 COMMAND chmod +x ${LLVM_CONFIG}
95 COMMAND cd ${LLVM_BINARY_DIR} && ${CMAKE_COMMAND} -U HAVE_LLVM_CONFIG ${LLVM_MAIN_SRC_DIR}
96 DEPENDS ${FINAL_LIBDEPS} ${LLVM_CONFIG_IN}
97 COMMENT "Building llvm-config script."
98 )
99
100 add_custom_target(llvm-config.target ALL
101 DEPENDS ${LLVM_CONFIG})
0 set(LLVM_LINK_COMPONENTS debugger)
1 set(LLVM_REQUIRES_EH 1)
2
3 add_llvm_tool(llvm-db
4 CLIDebugger.cpp
5 Commands.cpp
6 llvm-db.cpp
7 )
0 set(LLVM_LINK_COMPONENTS bitreader)
1 set(LLVM_REQUIRES_EH 1)
2
3 add_llvm_tool(llvm-dis
4 llvm-dis.cpp
5 )
0 set(LLVM_LINK_COMPONENTS ipo bitreader bitwriter)
1
2 add_llvm_tool(llvm-extract
3 llvm-extract.cpp
4 )
0 set(LLVM_LINK_COMPONENTS ipo scalaropts linker archive bitwriter)
1 set(LLVM_REQUIRES_EH 1)
2
3 add_llvm_tool(llvm-ld
4 Optimize.cpp
5 llvm-ld.cpp
6 )
0 set(LLVM_LINK_COMPONENTS linker bitreader bitwriter)
1
2 add_llvm_tool(llvm-link
3 llvm-link.cpp
4 )
0 set(LLVM_LINK_COMPONENTS archive bitreader)
1
2 add_llvm_tool(llvm-nm
3 llvm-nm.cpp
4 )
0 set(LLVM_LINK_COMPONENTS bitreader analysis)
1 set(LLVM_REQUIRES_EH 1)
2
3 add_llvm_tool(llvm-prof
4 llvm-prof.cpp
5 )
0 set(LLVM_LINK_COMPONENTS archive)
1 set(LLVM_REQUIRES_EH 1)
2
3 add_llvm_tool(llvm-ranlib
4 llvm-ranlib.cpp
5 )
0 add_llvm_tool(llvm-stub
1 llvm-stub.c
2 )
0 set(LLVM_LINK_COMPONENTS support system)
1 set(LLVM_REQUIRES_EH 1)
2
3 macro(tgen ofn)
4 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
5 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}
6 DEPENDS
7 tblgen
8 ${CMAKE_CURRENT_SOURCE_DIR}/Common.td
9 ${CMAKE_CURRENT_SOURCE_DIR}/Graph.td
10 ${CMAKE_CURRENT_SOURCE_DIR}/Tools.td
11 COMMENT "Building ${ofn}..."
12 )
13 endmacro(tgen ofn)
14
15 tgen(AutoGenerated.inc -gen-llvmc)
16
17 add_custom_target(AutoGenerated_ct echo Tablegenning
18 DEPENDS
19 ${CMAKE_CURRENT_BINARY_DIR}/AutoGenerated.inc
20 )
21
22 include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
23
24 add_llvm_tool(llvmc2
25 Action.cpp
26 AutoGenerated.cpp
27 CompilationGraph.cpp
28 llvmc.cpp
29 )
30
31 add_dependencies(llvmc2 AutoGenerated_ct)
0 set(LLVM_REQUIRES_EH 1)
1 set(LLVM_LINK_COMPONENTS bitreader bitwriter instrumentation scalaropts ipo)
2
3 add_llvm_tool(opt
4 AnalysisWrappers.cpp
5 GraphPrinters.cpp
6 PrintSCC.cpp
7 opt.cpp
8 )
0 add_executable(tblgen
1 AsmWriterEmitter.cpp
2 CallingConvEmitter.cpp
3 CodeEmitterGen.cpp
4 CodeGenDAGPatterns.cpp
5 CodeGenInstruction.cpp
6 CodeGenTarget.cpp
7 DAGISelEmitter.cpp
8 InstrEnumEmitter.cpp
9 InstrInfoEmitter.cpp
10 IntrinsicEmitter.cpp
11 LLVMCConfigurationEmitter.cpp
12 Record.cpp
13 RegisterInfoEmitter.cpp
14 SubtargetEmitter.cpp
15 TGLexer.cpp
16 TGParser.cpp
17 TableGen.cpp
18 TableGenBackend.cpp
19 FastISelEmitter.cpp
20 )
21
22 target_link_libraries(tblgen LLVMSupport LLVMSystem)
23 if( MINGW )
24 target_link_libraries(tblgen imagehlp psapi)
25 endif( MINGW )