1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

Initial support for the CMake build system.

llvm-svn: 56419
This commit is contained in:
Oscar Fuentes 2008-09-22 01:08:49 +00:00
parent 3ee08ff81e
commit 0f25988689
61 changed files with 2276 additions and 0 deletions

137
CMakeLists.txt Normal file
View File

@ -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)

93
cmake/config-ix.cmake Executable file
View File

@ -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
)

9
cmake/config-w32.cmake Executable file
View File

@ -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})

39
cmake/modules/AddLLVM.cmake Executable file
View File

@ -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)

View File

@ -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)

View File

@ -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 <ext/hash_map>
int main() {
__gnu_cxx::hash_map<int, int> 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 <ext/hash_map>
int main() {
std::hash_map<int, int> 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 <hash_map>
int main() {
hash_map<int, int> 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)

View File

@ -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 <ext/hash_set>
int main() {
__gnu_cxx::hash_set<int> 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 <ext/hash_set>
int main() {
std::hash_set<int> 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 <hash_set>
int main() {
hash_set<int> 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)

52
cmake/modules/FindBison.cmake Executable file
View File

@ -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)

57
cmake/modules/LLVMConfig.cmake Executable file
View File

@ -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)

1
examples/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
add_subdirectory(Fibonacci)

View File

@ -0,0 +1,5 @@
set(LLVM_LINK_COMPONENTS jit interpreter nativecodegen)
add_llvm_example(Fibonacci
fibonacci.cpp
)

View File

@ -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 <hash_map> 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 <ext/hash_map>
# ifndef HASH_NAMESPACE
# define HASH_NAMESPACE __gnu_cxx
# endif
// GCC 3.0.x puts hash_map in <ext/hash_map> and in the std namespace.
#elif defined(HAVE_STD_EXT_HASH_MAP)
# include <ext/hash_map>
# 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 <hash_map>
# 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 <rw/stdex/hashmap.h>
# include <rw/stdex/hashmmap.h>
# ifndef HASH_NAMESPACE
# define HASH_NAMESPACE std
# endif
// Support Microsoft VC++.
#elif defined(_MSC_VER)
# include <hash_map>
# 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 <class DataType> struct hash {
unsigned int operator()(const unsigned int& x) const {
return x;
}
};
template <typename KeyType,
typename ValueType,
class _HashFcn = hash<KeyType>,
class _EqualKey = equal_to<KeyType>,
class _A = allocator <ValueType> >
class hash_map : public rw_hashmap<KeyType, ValueType, class _HashFcn,
class _EqualKey, class _A> {
};
template <typename KeyType,
typename ValueType,
class _HashFcn = hash<KeyType>,
class _EqualKey = equal_to<KeyType>,
class _A = allocator <ValueType> >
class hash_multimap : public rw_hashmultimap<KeyType, ValueType, class _HashFcn,
class _EqualKey, class _A> {
};
} // 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 <vector>
#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<class Key> struct hash;
// Provide a hash function for unsigned ints...
template<> struct hash<unsigned int> {
inline size_t operator()(unsigned int Val) const {
return Val;
}
};
template<class Key> class hash_compare<Key, std::less<Key> > {
std::less<Key> comp;
public:
enum { bucket_size = 4 };
enum { min_buckets = 8 };
hash_compare() {}
hash_compare(std::less<Key> pred) : comp(pred) {}
size_t operator()(const Key& key) const { return hash<Key>()(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

View File

@ -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 <hash_set> 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 <ext/hash_set> and in
// the __gnu_cxx namespace.
#if defined(HAVE_GNU_EXT_HASH_SET)
# include <ext/hash_set>
# ifndef HASH_NAMESPACE
# define HASH_NAMESPACE __gnu_cxx
# endif
// GCC 3.0.x puts hash_set in <ext/hash_set> and in the std namespace.
#elif defined(HAVE_STD_EXT_HASH_SET)
# include <ext/hash_set>
# 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 <hash_set>
# 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 <rw/stdex/hashset.h>
# ifndef HASH_NAMESPACE
# define HASH_NAMESPACE std
# endif
// Support Microsoft VC++.
#elif defined(_MSC_VER)
# include <hash_set>
# 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 <class DataType> struct hash {
unsigned int operator()(const unsigned int& x) const {
return x;
}
};
*/
template <typename ValueType,
class _HashFcn = hash<ValueType>,
class _EqualKey = equal_to<ValueType>,
class _A = allocator <ValueType> >
class hash_set :
public rw_hashset<ValueType, class _HashFcn, class _EqualKey, class _A> {
};
} // 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 <vector>
#include "llvm/ADT/HashExtras.h"
#endif

View File

@ -0,0 +1,79 @@
//===-- llvm/ADT/iterator - Portable wrapper around <iterator> --*- 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 <iterator> 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 <iterator> 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 <iterator>
#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<class Ty, class PtrDiffTy>
struct bidirectional_iterator
: public std::iterator<std::bidirectional_iterator_tag, Ty, PtrDiffTy> {
};
# 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<class Ty, class PtrDiffTy>
struct forward_iterator
: public std::iterator<std::forward_iterator_tag, Ty, PtrDiffTy> {
};
# else
# error "Need to have standard iterator to define forward iterator!"
# endif
#else
using std::forward_iterator;
#endif
#endif

View File

@ -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 <alloca.h> 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 <argz.h> 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 <assert.h> 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 <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define to 1 if you have the <dirent.h> 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 <dld.h> 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 <dlfcn.h> 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 <dl.h> 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 <errno.h> 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 <execinfo.h> header file. */
#cmakedefine HAVE_EXECINFO_H ${HAVE_EXECINFO_H}
/* Define to 1 if you have the <fcntl.h> header file. */
#cmakedefine HAVE_FCNTL_H ${HAVE_FCNTL_H}
/* Set to 1 if the finite function is found in <ieeefp.h> */
#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 <hash_map> */
#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 <inttypes.h> 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 <cmath> */
#cmakedefine HAVE_ISINF_IN_CMATH ${HAVE_ISINF_IN_CMATH}
/* Set to 1 if the isinf function is found in <math.h> */
#cmakedefine HAVE_ISINF_IN_MATH_H ${HAVE_ISINF_IN_MATH_H}
/* Set to 1 if the isnan function is found in <cmath> */
#cmakedefine HAVE_ISNAN_IN_CMATH ${HAVE_ISNAN_IN_CMATH}
/* Set to 1 if the isnan function is found in <math.h> */
#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 <limits.h> header file. */
#cmakedefine HAVE_LIMITS_H ${HAVE_LIMITS_H}
/* Define to 1 if you have the <link.h> 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 <mach/mach.h> header file. */
#undef HAVE_MACH_MACH_H
/* Define to 1 if you have the <mach-o/dyld.h> 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 <malloc.h> header file. */
#cmakedefine HAVE_MALLOC_H ${HAVE_MALLOC_H}
/* Define to 1 if you have the <malloc/malloc.h> 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 <memory.h> 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 <ndir.h> 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 <stdlib.h> */
#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 <setjmp.h> 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 <signal.h> 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 <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H}
/* Define to 1 if you have the <stdio.h> header file. */
#cmakedefine HAVE_STDIO_H ${HAVE_STDIO_H}
/* Define to 1 if you have the <stdlib.h> 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 <cmath> */
#undef HAVE_STD_ISINF_IN_CMATH
/* Set to 1 if the std::isnan function is found in <cmath> */
#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 <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> 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 <sys/dir.h> header file, and it defines `DIR'.
*/
#cmakedefine HAVE_SYS_DIR_H ${HAVE_SYS_DIR_H}
/* Define to 1 if you have the <sys/dl.h> header file. */
#cmakedefine HAVE_SYS_DL_H ${HAVE_SYS_DL_H}
/* Define to 1 if you have the <sys/mman.h> header file. */
#cmakedefine HAVE_SYS_MMAN_H ${}
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#cmakedefine HAVE_SYS_NDIR_H ${HAVE_SYS_NDIR_H}
/* Define to 1 if you have the <sys/param.h> header file. */
#cmakedefine HAVE_SYS_PARAM_H ${HAVE_SYS_PARAM_H}
/* Define to 1 if you have the <sys/resource.h> header file. */
#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H}
/* Define to 1 if you have the <sys/stat.h> header file. */
#cmakedefine HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H}
/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H}
/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
/* Define to 1 if you have <sys/wait.h> 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 <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H}
/* Define to 1 if you have the <utime.h> 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 <windows.h> 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 <sys/stat.h> 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 <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define to 1 if your <sys/time.h> 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 <sys/types.h> does not define. */
#undef pid_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

View File

@ -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 <inttypes.h> includes <stdint.h>, if this is a C99 system.
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef __cplusplus
#include <cmath>
#else
#include <math.h>
#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 <stdlib.h>
#include <stddef.h>
#include <sys/types.h>
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 */

View File

@ -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
)

View File

@ -0,0 +1,7 @@
add_llvm_library(LLVMipa
Andersens.cpp
CallGraph.cpp
CallGraphSCCPass.cpp
FindUsedTypes.cpp
GlobalsModRef.cpp
)

View File

@ -0,0 +1,5 @@
add_llvm_library(LLVMArchive
Archive.cpp
ArchiveReader.cpp
ArchiveWriter.cpp
)

View File

@ -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
)

View File

@ -0,0 +1,7 @@
add_llvm_library(LLVMBitReader
BitReader.cpp
BitcodeReader.cpp
Deserialize.cpp
DeserializeAPFloat.cpp
DeserializeAPInt.cpp
)

View File

@ -0,0 +1,9 @@
add_llvm_library(LLVMBitWriter
BitWriter.cpp
BitcodeWriter.cpp
BitcodeWriterPass.cpp
Serialize.cpp
SerializeAPFloat.cpp
SerializeAPInt.cpp
ValueEnumerator.cpp
)

View File

@ -0,0 +1,5 @@
add_llvm_library(LLVMAsmPrinter
AsmPrinter.cpp
DwarfWriter.cpp
OcamlGCPrinter.cpp
)

View File

@ -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
)

View File

@ -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
)

View File

@ -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
)

View File

@ -0,0 +1,4 @@
add_llvm_library(LLVMExecutionEngine
ExecutionEngine.cpp
ExecutionEngineBindings.cpp
)

View File

@ -0,0 +1,5 @@
add_partially_linked_object(LLVMInterpreter
Execution.cpp
ExternalFunctions.cpp
Interpreter.cpp
)

View File

@ -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
)

View File

@ -0,0 +1,6 @@
add_llvm_library(LLVMLinker
LinkArchives.cpp
LinkItems.cpp
LinkModules.cpp
Linker.cpp
)

View File

@ -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
)

13
lib/System/CMakeLists.txt Normal file
View File

@ -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
)

17
lib/Target/CMakeLists.txt Normal file
View File

@ -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.

View File

@ -0,0 +1,7 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
add_llvm_library(LLVMX86AsmPrinter
X86ATTAsmPrinter.cpp
X86AsmPrinter.cpp
X86IntelAsmPrinter.cpp
)

View File

@ -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
)

View File

@ -0,0 +1,3 @@
add_llvm_library( LLVMHello
Hello.cpp
)

View File

@ -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
)

View File

@ -0,0 +1,6 @@
add_llvm_library(LLVMInstrumentation
BlockProfiling.cpp
EdgeProfiling.cpp
ProfilingUtils.cpp
RSProfiling.cpp
)

View File

@ -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
)

View File

@ -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
)

32
lib/VMCore/CMakeLists.txt Normal file
View File

@ -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 )

32
tools/CMakeLists.txt Normal file
View File

@ -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)

View File

@ -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
)

5
tools/llc/CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} bitreader asmprinter)
add_llvm_tool(llc
llc.cpp
)

5
tools/lli/CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
set(LLVM_LINK_COMPONENTS jit interpreter nativecodegen bitreader selectiondag)
add_llvm_tool(lli
lli.cpp
)

View File

@ -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.

View File

@ -0,0 +1,6 @@
set(LLVM_LINK_COMPONENTS asmparser bitwriter)
set(LLVM_REQUIRES_EH 1)
add_llvm_tool(llvm-as
llvm-as.cpp
)

View File

@ -0,0 +1,6 @@
set(LLVM_LINK_COMPONENTS bitreader)
set(LLVM_REQUIRES_EH 1)
add_llvm_tool(llvm-bcanalyzer
llvm-bcanalyzer.cpp
)

View File

@ -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})

View File

@ -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
)

View File

@ -0,0 +1,6 @@
set(LLVM_LINK_COMPONENTS bitreader)
set(LLVM_REQUIRES_EH 1)
add_llvm_tool(llvm-dis
llvm-dis.cpp
)

View File

@ -0,0 +1,5 @@
set(LLVM_LINK_COMPONENTS ipo bitreader bitwriter)
add_llvm_tool(llvm-extract
llvm-extract.cpp
)

View File

@ -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
)

View File

@ -0,0 +1,5 @@
set(LLVM_LINK_COMPONENTS linker bitreader bitwriter)
add_llvm_tool(llvm-link
llvm-link.cpp
)

View File

@ -0,0 +1,5 @@
set(LLVM_LINK_COMPONENTS archive bitreader)
add_llvm_tool(llvm-nm
llvm-nm.cpp
)

View File

@ -0,0 +1,6 @@
set(LLVM_LINK_COMPONENTS bitreader analysis)
set(LLVM_REQUIRES_EH 1)
add_llvm_tool(llvm-prof
llvm-prof.cpp
)

View File

@ -0,0 +1,6 @@
set(LLVM_LINK_COMPONENTS archive)
set(LLVM_REQUIRES_EH 1)
add_llvm_tool(llvm-ranlib
llvm-ranlib.cpp
)

View File

@ -0,0 +1,3 @@
add_llvm_tool(llvm-stub
llvm-stub.c
)

View File

@ -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)

9
tools/opt/CMakeLists.txt Normal file
View File

@ -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
)

View File

@ -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 )