Vendor import of llvm trunk r126079:
http://llvm.org/svn/llvm-project/llvm/trunk@126079
This commit is contained in:
parent
4ace901e87
commit
cbb70ce070
37
.gitignore
vendored
Normal file
37
.gitignore
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
#==============================================================================#
|
||||
# This file specifies intentionally untracked files that git should ignore.
|
||||
# See: http://www.kernel.org/pub/software/scm/git/docs/gitignore.html
|
||||
#
|
||||
# This file is intentionally different from the output of `git svn show-ignore`,
|
||||
# as most of those are useless.
|
||||
#==============================================================================#
|
||||
|
||||
#==============================================================================#
|
||||
# File extensions to be ignored anywhere in the tree.
|
||||
#==============================================================================#
|
||||
# Temp files created by most text editors.
|
||||
*~
|
||||
# Merge files created by git.
|
||||
*.orig
|
||||
# Byte compiled python modules.
|
||||
*.pyc
|
||||
|
||||
#==============================================================================#
|
||||
# Explicit files to ignore (only matches one).
|
||||
#==============================================================================#
|
||||
.gitusers
|
||||
cscope.files
|
||||
cscope.out
|
||||
autoconf/aclocal.m4
|
||||
autoconf/autom4te.cache
|
||||
|
||||
#==============================================================================#
|
||||
# Directories to ignore (do not add trailing '/'s, they skip symlinks).
|
||||
#==============================================================================#
|
||||
# External projects that are tracked independently.
|
||||
projects/*
|
||||
!projects/sample
|
||||
!projects/CMakeLists.txt
|
||||
!projects/Makefile
|
||||
# Clang, which is tracked independently.
|
||||
tools/clang
|
301
CMakeLists.txt
301
CMakeLists.txt
@ -10,9 +10,16 @@ set(CMAKE_MODULE_PATH
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
|
||||
)
|
||||
|
||||
set(PACKAGE_VERSION "2.8")
|
||||
set(PACKAGE_VERSION "2.9")
|
||||
|
||||
include(VersionFromVCS)
|
||||
add_version_info_from_vcs(PACKAGE_VERSION)
|
||||
|
||||
option(LLVM_APPEND_VC_REV
|
||||
"Append the version control system revision id to LLVM version" OFF)
|
||||
|
||||
if( LLVM_APPEND_VC_REV )
|
||||
add_version_info_from_vcs(PACKAGE_VERSION)
|
||||
endif()
|
||||
|
||||
set(PACKAGE_NAME llvm)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
@ -64,8 +71,8 @@ set(LLVM_ALL_TARGETS
|
||||
Mips
|
||||
MBlaze
|
||||
MSP430
|
||||
PIC16
|
||||
PowerPC
|
||||
PTX
|
||||
Sparc
|
||||
SystemZ
|
||||
X86
|
||||
@ -80,36 +87,25 @@ else( MSVC )
|
||||
CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
|
||||
endif( MSVC )
|
||||
|
||||
set(C_INCLUDE_DIRS "" CACHE STRING
|
||||
"Colon separated list of directories clang will search for headers.")
|
||||
option(LLVM_ENABLE_CBE_PRINTF_A "Set to ON if CBE is enabled for printf %a output" ON)
|
||||
if(LLVM_ENABLE_CBE_PRINTF_A)
|
||||
set(ENABLE_CBE_PRINTF_A 1)
|
||||
endif()
|
||||
|
||||
option(LLVM_ENABLE_TIMESTAMPS "Enable embedding timestamp information in build" ON)
|
||||
if(LLVM_ENABLE_TIMESTAMPS)
|
||||
set(ENABLE_TIMESTAMPS 1)
|
||||
endif()
|
||||
|
||||
option(LLVM_ENABLE_FFI "Use libffi to call external functions from the interpreter" OFF)
|
||||
set(FFI_LIBRARY_DIR "" CACHE PATH "Additional directory, where CMake should search for libffi.so")
|
||||
set(FFI_INCLUDE_DIR "" CACHE PATH "Additional directory, where CMake should search for ffi.h or ffi/ffi.h")
|
||||
|
||||
set(LLVM_TARGET_ARCH "host"
|
||||
CACHE STRING "Set target to use for LLVM JIT or use \"host\" for automatic detection.")
|
||||
|
||||
option(LLVM_ENABLE_THREADS "Use threads if available." ON)
|
||||
|
||||
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
|
||||
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF)
|
||||
else()
|
||||
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
|
||||
endif()
|
||||
|
||||
if( LLVM_ENABLE_ASSERTIONS )
|
||||
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
||||
if( NOT MSVC )
|
||||
add_definitions( -D_DEBUG )
|
||||
endif()
|
||||
# On Release builds cmake automatically defines NDEBUG, so we
|
||||
# explicitly undefine it:
|
||||
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
|
||||
add_definitions( -UNDEBUG )
|
||||
endif()
|
||||
else()
|
||||
if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
|
||||
add_definitions( -DNDEBUG )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( LLVM_TARGETS_TO_BUILD STREQUAL "all" )
|
||||
set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} )
|
||||
endif()
|
||||
@ -135,65 +131,34 @@ set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm)
|
||||
|
||||
include(AddLLVMDefinitions)
|
||||
|
||||
if(WIN32)
|
||||
if(CYGWIN)
|
||||
set(LLVM_ON_WIN32 0)
|
||||
set(LLVM_ON_UNIX 1)
|
||||
else(CYGWIN)
|
||||
set(LLVM_ON_WIN32 1)
|
||||
set(LLVM_ON_UNIX 0)
|
||||
endif(CYGWIN)
|
||||
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)
|
||||
if(APPLE)
|
||||
set(LTDL_SHLIB_EXT ".dylib")
|
||||
else(APPLE)
|
||||
set(LTDL_SHLIB_EXT ".so")
|
||||
endif(APPLE)
|
||||
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)
|
||||
option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
|
||||
|
||||
include(config-ix)
|
||||
|
||||
option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
|
||||
include(HandleLLVMOptions)
|
||||
|
||||
set(ENABLE_PIC 0)
|
||||
if( LLVM_ENABLE_PIC )
|
||||
if( XCODE )
|
||||
# Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
|
||||
# know how to disable this, so just force ENABLE_PIC off for now.
|
||||
message(STATUS "Warning: -fPIC not supported with Xcode.")
|
||||
else( XCODE )
|
||||
if( SUPPORTS_FPIC_FLAG )
|
||||
message(STATUS "Building with -fPIC")
|
||||
add_llvm_definitions(-fPIC)
|
||||
set(ENABLE_PIC 1)
|
||||
else( SUPPORTS_FPIC_FLAG )
|
||||
message(STATUS "Warning: -fPIC not supported.")
|
||||
endif()
|
||||
endif()
|
||||
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
|
||||
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF)
|
||||
else()
|
||||
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake
|
||||
${LLVM_BINARY_DIR}/include/llvm/Config/config.h)
|
||||
|
||||
configure_file(
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/llvm-config.h.cmake
|
||||
${LLVM_BINARY_DIR}/include/llvm/Config/llvm-config.h)
|
||||
|
||||
configure_file(
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake
|
||||
${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h)
|
||||
|
||||
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_llvm_definitions( -D__STDC_LIMIT_MACROS )
|
||||
add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
|
||||
|
||||
# MSVC has a gazillion warnings with this.
|
||||
if( MSVC )
|
||||
option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF)
|
||||
@ -204,65 +169,34 @@ endif()
|
||||
option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
|
||||
option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
||||
|
||||
if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
|
||||
# TODO: support other platforms and toolchains.
|
||||
option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
|
||||
if( LLVM_BUILD_32_BITS )
|
||||
message(STATUS "Building 32 bits executables and libraries.")
|
||||
add_llvm_definitions( -m32 )
|
||||
list(APPEND CMAKE_EXE_LINKER_FLAGS -m32)
|
||||
list(APPEND CMAKE_SHARED_LINKER_FLAGS -m32)
|
||||
endif( LLVM_BUILD_32_BITS )
|
||||
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
|
||||
|
||||
if( MSVC )
|
||||
include(ChooseMSVCCRT)
|
||||
|
||||
add_llvm_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS )
|
||||
add_llvm_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS )
|
||||
add_llvm_definitions( -D_SCL_SECURE_NO_DEPRECATE )
|
||||
add_llvm_definitions( -wd4146 -wd4503 -wd4996 -wd4800 -wd4244 -wd4624 )
|
||||
add_llvm_definitions( -wd4355 -wd4715 -wd4180 -wd4345 -wd4224 )
|
||||
|
||||
# Suppress 'new behavior: elements of array 'array' will be default initialized'
|
||||
add_llvm_definitions( -wd4351 )
|
||||
|
||||
# Enable warnings
|
||||
if (LLVM_ENABLE_WARNINGS)
|
||||
add_llvm_definitions( /W4 /Wall )
|
||||
if (LLVM_ENABLE_PEDANTIC)
|
||||
# No MSVC equivalent available
|
||||
endif (LLVM_ENABLE_PEDANTIC)
|
||||
endif (LLVM_ENABLE_WARNINGS)
|
||||
if (LLVM_ENABLE_WERROR)
|
||||
add_llvm_definitions( /WX )
|
||||
endif (LLVM_ENABLE_WERROR)
|
||||
elseif( CMAKE_COMPILER_IS_GNUCXX )
|
||||
if (LLVM_ENABLE_WARNINGS)
|
||||
add_llvm_definitions( -Wall -W -Wno-unused-parameter -Wwrite-strings )
|
||||
if (LLVM_ENABLE_PEDANTIC)
|
||||
add_llvm_definitions( -pedantic -Wno-long-long )
|
||||
endif (LLVM_ENABLE_PEDANTIC)
|
||||
endif (LLVM_ENABLE_WARNINGS)
|
||||
if (LLVM_ENABLE_WERROR)
|
||||
add_llvm_definitions( -Werror )
|
||||
endif (LLVM_ENABLE_WERROR)
|
||||
endif( MSVC )
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR})
|
||||
|
||||
if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
|
||||
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-include llvm/System/Solaris.h")
|
||||
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-include llvm/Support/Solaris.h")
|
||||
endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
|
||||
|
||||
include(AddLLVM)
|
||||
include(TableGen)
|
||||
|
||||
add_subdirectory(lib/Support)
|
||||
add_subdirectory(lib/System)
|
||||
if( MINGW )
|
||||
get_system_libs(LLVM_SYSTEM_LIBS_LIST)
|
||||
foreach(l ${LLVM_SYSTEM_LIBS_LIST})
|
||||
set(LLVM_SYSTEM_LIBS "${LLVM_SYSTEM_LIBS} -l${l}")
|
||||
endforeach()
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES}${LLVM_SYSTEM_LIBS}")
|
||||
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES}${LLVM_SYSTEM_LIBS}")
|
||||
endif()
|
||||
|
||||
# Everything else depends on Support and System:
|
||||
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} ${LLVM_LIBS} )
|
||||
if( MINGW )
|
||||
# People report that -O3 is unreliable on MinGW. The traditional
|
||||
# build also uses -O2 for that reason:
|
||||
llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
|
||||
endif()
|
||||
|
||||
# Put this before tblgen. Else we have a circular dependence.
|
||||
add_subdirectory(lib/Support)
|
||||
|
||||
set(LLVM_TABLEGEN "tblgen" CACHE
|
||||
STRING "Native TableGen executable. Saves building one when cross-compiling.")
|
||||
@ -278,87 +212,43 @@ endif( CMAKE_CROSSCOMPILING )
|
||||
|
||||
add_subdirectory(include/llvm)
|
||||
|
||||
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/InstCombine)
|
||||
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/MC)
|
||||
add_subdirectory(lib/MC/MCParser)
|
||||
add_subdirectory(lib/MC/MCDisassembler)
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(lib)
|
||||
|
||||
add_subdirectory(utils/FileCheck)
|
||||
add_subdirectory(utils/FileUpdate)
|
||||
add_subdirectory(utils/count)
|
||||
add_subdirectory(utils/not)
|
||||
|
||||
set(LLVM_ENUM_ASM_PRINTERS "")
|
||||
set(LLVM_ENUM_ASM_PARSERS "")
|
||||
set(LLVM_ENUM_DISASSEMBLERS "")
|
||||
foreach(t ${LLVM_TARGETS_TO_BUILD})
|
||||
message(STATUS "Targeting ${t}")
|
||||
add_subdirectory(lib/Target/${t})
|
||||
add_subdirectory(lib/Target/${t}/TargetInfo)
|
||||
if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmPrinter/CMakeLists.txt )
|
||||
add_subdirectory(lib/Target/${t}/AsmPrinter)
|
||||
set(LLVM_ENUM_ASM_PRINTERS
|
||||
"${LLVM_ENUM_ASM_PRINTERS}LLVM_ASM_PRINTER(${t})\n")
|
||||
endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmPrinter/CMakeLists.txt )
|
||||
if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmParser/CMakeLists.txt )
|
||||
add_subdirectory(lib/Target/${t}/AsmParser)
|
||||
set(LLVM_ENUM_ASM_PARSERS
|
||||
"${LLVM_ENUM_ASM_PARSERS}LLVM_ASM_PARSER(${t})\n")
|
||||
endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmParser/CMakeLists.txt )
|
||||
if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/Disassembler/CMakeLists.txt )
|
||||
add_subdirectory(lib/Target/${t}/Disassembler)
|
||||
set(LLVM_ENUM_DISASSEMBLERS
|
||||
"${LLVM_ENUM_DISASSEMBLERS}LLVM_DISASSEMBLER(${t})\n")
|
||||
endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/Disassembler/CMakeLists.txt )
|
||||
set(CURRENT_LLVM_TARGET)
|
||||
endforeach(t)
|
||||
|
||||
# Produce llvm/Config/AsmPrinters.def
|
||||
configure_file(
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmPrinters.def.in
|
||||
${LLVM_BINARY_DIR}/include/llvm/Config/AsmPrinters.def
|
||||
)
|
||||
|
||||
# Produce llvm/Config/AsmParsers.def
|
||||
configure_file(
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmParsers.def.in
|
||||
${LLVM_BINARY_DIR}/include/llvm/Config/AsmParsers.def
|
||||
)
|
||||
|
||||
# Produce llvm/Config/Disassemblers.def
|
||||
configure_file(
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Disassemblers.def.in
|
||||
${LLVM_BINARY_DIR}/include/llvm/Config/Disassemblers.def
|
||||
)
|
||||
|
||||
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/Archive)
|
||||
add_subdirectory(utils/llvm-lit)
|
||||
|
||||
add_subdirectory(projects)
|
||||
|
||||
option(LLVM_BUILD_TOOLS "Build LLVM tool programs." ON)
|
||||
add_subdirectory(tools)
|
||||
option(LLVM_BUILD_TOOLS
|
||||
"Build the LLVM tools. If OFF, just generate build targets." ON)
|
||||
option(LLVM_INCLUDE_TOOLS "Generate build targets for the LLVM tools." ON)
|
||||
if( LLVM_INCLUDE_TOOLS )
|
||||
add_subdirectory(tools)
|
||||
endif()
|
||||
|
||||
option(LLVM_BUILD_EXAMPLES "Build LLVM example programs." OFF)
|
||||
add_subdirectory(examples)
|
||||
option(LLVM_BUILD_EXAMPLES
|
||||
"Build the LLVM example programs. If OFF, just generate build targets." OFF)
|
||||
option(LLVM_INCLUDE_EXAMPLES "Generate build targets for the LLVM examples" ON)
|
||||
if( LLVM_INCLUDE_EXAMPLES )
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
option(LLVM_BUILD_TESTS
|
||||
"Build LLVM unit tests. If OFF, just generate build targes." OFF)
|
||||
option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON)
|
||||
if( LLVM_INCLUDE_TESTS )
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(utils/unittest)
|
||||
add_subdirectory(unittests)
|
||||
if (MSVC)
|
||||
# This utility is used to prevent chrashing tests from calling Dr. Watson on
|
||||
# Windows.
|
||||
add_subdirectory(utils/KillTheDoctor)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(cmake/modules)
|
||||
|
||||
@ -385,3 +275,18 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
|
||||
)
|
||||
|
||||
# TODO: make and install documentation.
|
||||
|
||||
set(CPACK_PACKAGE_VENDOR "LLVM")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR 2)
|
||||
set(CPACK_PACKAGE_VERSION_MINOR 9)
|
||||
add_version_info_from_vcs(CPACK_PACKAGE_VERSION_PATCH)
|
||||
include(CPack)
|
||||
|
||||
# Workaround for MSVS10 to avoid the Dialog Hell
|
||||
# FIXME: This could be removed with future version of CMake.
|
||||
if(MSVC_VERSION EQUAL 1600)
|
||||
set(LLVM_SLN_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/LLVM.sln")
|
||||
if( EXISTS "${LLVM_SLN_FILENAME}" )
|
||||
file(APPEND "${LLVM_SLN_FILENAME}" "\n# This should be regenerated!\n")
|
||||
endif()
|
||||
endif()
|
||||
|
@ -8,6 +8,7 @@ beautification by scripts. The fields are: name (N), email (E), web-address
|
||||
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
|
||||
(S).
|
||||
|
||||
|
||||
N: Vikram Adve
|
||||
E: vadve@cs.uiuc.edu
|
||||
W: http://www.cs.uiuc.edu/~vadve/
|
||||
@ -39,7 +40,7 @@ N: Misha Brukman
|
||||
E: brukman+llvm@uiuc.edu
|
||||
W: http://misha.brukman.net
|
||||
D: Portions of X86 and Sparc JIT compilers, PowerPC backend
|
||||
D: Incremental bytecode loader
|
||||
D: Incremental bitcode loader
|
||||
|
||||
N: Cameron Buschardt
|
||||
E: buschard@uiuc.edu
|
||||
@ -328,6 +329,7 @@ D: The `paths' pass
|
||||
N: Michael J. Spencer
|
||||
E: bigcheesegs@gmail.com
|
||||
D: Shepherding Windows COFF support into MC.
|
||||
D: Lots of Windows stuff.
|
||||
|
||||
N: Reid Spencer
|
||||
E: rspencer@reidspencer.com
|
||||
|
19
Makefile
19
Makefile
@ -10,7 +10,7 @@
|
||||
LEVEL := .
|
||||
|
||||
# Top-Level LLVM Build Stages:
|
||||
# 1. Build lib/System and lib/Support, which are used by utils (tblgen).
|
||||
# 1. Build lib/Support, which is used by utils (tblgen).
|
||||
# 2. Build utils, which is used by VMCore.
|
||||
# 3. Build VMCore, which builds the Intrinsics.inc file used by libs.
|
||||
# 4. Build libs, which are needed by llvm-config.
|
||||
@ -27,10 +27,10 @@ LEVEL := .
|
||||
ifneq ($(findstring llvmCore, $(RC_ProjectName)),llvmCore) # Normal build (not "Apple-style").
|
||||
|
||||
ifeq ($(BUILD_DIRS_ONLY),1)
|
||||
DIRS := lib/System lib/Support utils
|
||||
DIRS := lib/Support utils
|
||||
OPTIONAL_DIRS :=
|
||||
else
|
||||
DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-shlib \
|
||||
DIRS := lib/Support utils lib/VMCore lib tools/llvm-shlib \
|
||||
tools/llvm-config tools runtime docs unittests
|
||||
OPTIONAL_DIRS := projects bindings
|
||||
endif
|
||||
@ -47,6 +47,10 @@ ifneq ($(ENABLE_SHARED),1)
|
||||
DIRS := $(filter-out tools/llvm-shlib, $(DIRS))
|
||||
endif
|
||||
|
||||
ifneq ($(ENABLE_DOCS),1)
|
||||
DIRS := $(filter-out docs, $(DIRS))
|
||||
endif
|
||||
|
||||
ifeq ($(MAKECMDGOALS),libs-only)
|
||||
DIRS := $(filter-out tools runtime docs, $(DIRS))
|
||||
OPTIONAL_DIRS :=
|
||||
@ -95,6 +99,11 @@ ifeq ($(MAKECMDGOALS),install)
|
||||
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
|
||||
endif
|
||||
|
||||
# Don't build unittests when ONLY_TOOLS is set.
|
||||
ifneq ($(ONLY_TOOLS),)
|
||||
DIRS := $(filter-out unittests, $(DIRS))
|
||||
endif
|
||||
|
||||
# If we're cross-compiling, build the build-hosted tools first
|
||||
ifeq ($(LLVM_CROSS_COMPILING),1)
|
||||
all:: cross-compile-build-tools
|
||||
@ -150,7 +159,7 @@ dist-hook::
|
||||
$(Echo) Eliminating files constructed by configure
|
||||
$(Verb) $(RM) -f \
|
||||
$(TopDistDir)/include/llvm/Config/config.h \
|
||||
$(TopDistDir)/include/llvm/System/DataTypes.h
|
||||
$(TopDistDir)/include/llvm/Support/DataTypes.h
|
||||
|
||||
clang-only: all
|
||||
tools-only: all
|
||||
@ -169,7 +178,7 @@ FilesToConfig := \
|
||||
include/llvm/Config/AsmPrinters.def \
|
||||
include/llvm/Config/AsmParsers.def \
|
||||
include/llvm/Config/Disassemblers.def \
|
||||
include/llvm/System/DataTypes.h \
|
||||
include/llvm/Support/DataTypes.h \
|
||||
tools/llvmc/src/Base.td
|
||||
FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
|
||||
|
||||
|
@ -164,7 +164,7 @@ CAT := @CAT@
|
||||
DOT := @DOT@
|
||||
DOXYGEN := @DOXYGEN@
|
||||
GROFF := @GROFF@
|
||||
GZIP := @GZIP@
|
||||
GZIPBIN := @GZIPBIN@
|
||||
OCAMLC := @OCAMLC@
|
||||
OCAMLOPT := @OCAMLOPT@
|
||||
OCAMLDEP := @OCAMLDEP@
|
||||
@ -195,6 +195,7 @@ LLVMGXX := @LLVMGXX@
|
||||
LLVMCC1 := @LLVMCC1@
|
||||
LLVMCC1PLUS := @LLVMCC1PLUS@
|
||||
LLVMGCC_LANGS := @LLVMGCC_LANGS@
|
||||
LLVMGCC_DRAGONEGG := @LLVMGCC_DRAGONEGG@
|
||||
|
||||
# Information on Clang, if configured.
|
||||
CLANGPATH := @CLANGPATH@
|
||||
@ -204,6 +205,10 @@ ENABLE_BUILT_CLANG := @ENABLE_BUILT_CLANG@
|
||||
# The LLVM capable compiler to use.
|
||||
LLVMCC_OPTION := @LLVMCC_OPTION@
|
||||
|
||||
# The flag used to emit LLVM IR.
|
||||
LLVMCC_EMITIR_FLAG = @LLVMCC_EMITIR_FLAG@
|
||||
LLVMCC_DISABLEOPT_FLAGS := @LLVMCC_DISABLEOPT_FLAGS@
|
||||
|
||||
# Path to directory where object files should be stored during a build.
|
||||
# Set OBJ_ROOT to "." if you do not want to use a separate place for
|
||||
# object files.
|
||||
@ -259,6 +264,9 @@ OPTIMIZE_OPTION := @OPTIMIZE_OPTION@
|
||||
# information to allow gprof to be used to get execution frequencies.
|
||||
#ENABLE_PROFILING = 1
|
||||
|
||||
# When ENABLE_DOCS is disabled, docs/ will not be built.
|
||||
ENABLE_DOCS = @ENABLE_DOCS@
|
||||
|
||||
# When ENABLE_DOXYGEN is enabled, the doxygen documentation will be built
|
||||
ENABLE_DOXYGEN = @ENABLE_DOXYGEN@
|
||||
|
||||
@ -271,6 +279,9 @@ ENABLE_PIC := @ENABLE_PIC@
|
||||
# Do we want to build a shared library and link the tools with it?
|
||||
ENABLE_SHARED := @ENABLE_SHARED@
|
||||
|
||||
# Do we want to link the stdc++ into a shared library? (Cygming)
|
||||
ENABLE_EMBED_STDCXX := @ENABLE_EMBED_STDCXX@
|
||||
|
||||
# Use -fvisibility-inlines-hidden?
|
||||
ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
|
||||
|
||||
@ -341,6 +352,8 @@ NO_MISSING_FIELD_INITIALIZERS = @NO_MISSING_FIELD_INITIALIZERS@
|
||||
# -Wno-variadic-macros
|
||||
NO_VARIADIC_MACROS = @NO_VARIADIC_MACROS@
|
||||
|
||||
# Was polly found in tools/polly?
|
||||
LLVM_HAS_POLLY = @LLVM_HAS_POLLY@
|
||||
# Flags supported by the linker.
|
||||
# bfd ld / gold --version-script=file
|
||||
HAVE_LINK_VERSION_SCRIPT = @HAVE_LINK_VERSION_SCRIPT@
|
||||
|
138
Makefile.rules
138
Makefile.rules
@ -129,11 +129,8 @@ reconfigure:
|
||||
$(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
|
||||
$(ConfigStatusScript)
|
||||
|
||||
# FIXME: The {PIC16,MSP430}/AsmPrinter line here is a hack to force a reconfigure to pick
|
||||
# up AsmPrinter changes. Remove it after a reasonable delay from 2009-08-13.
|
||||
|
||||
.PRECIOUS: $(ConfigStatusScript)
|
||||
$(ConfigStatusScript): $(ConfigureScript) $(LLVM_SRC_ROOT)/lib/Target/PIC16/AsmPrinter/Makefile $(LLVM_SRC_ROOT)/lib/Target/MSP430/AsmPrinter/Makefile
|
||||
$(ConfigStatusScript): $(ConfigureScript)
|
||||
$(Echo) Reconfiguring with $<
|
||||
$(Verb) cd $(PROJ_OBJ_ROOT) && \
|
||||
if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \
|
||||
@ -161,9 +158,13 @@ endif
|
||||
# If the Makefile in the source tree has been updated, copy it over into the
|
||||
# build tree. But, only do this if the source and object makefiles differ
|
||||
#------------------------------------------------------------------------
|
||||
ifndef PROJ_MAKEFILE
|
||||
PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile
|
||||
endif
|
||||
|
||||
ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
|
||||
|
||||
Makefile: $(PROJ_SRC_DIR)/Makefile $(ExtraMakefiles)
|
||||
Makefile: $(PROJ_MAKEFILE) $(ExtraMakefiles)
|
||||
$(Echo) "Updating Makefile"
|
||||
$(Verb) $(MKDIR) $(@D)
|
||||
$(Verb) $(CP) -f $< $@
|
||||
@ -171,7 +172,7 @@ Makefile: $(PROJ_SRC_DIR)/Makefile $(ExtraMakefiles)
|
||||
# Copy the Makefile.* files unless we're in the root directory which avoids
|
||||
# the copying of Makefile.config.in or other things that should be explicitly
|
||||
# taken care of.
|
||||
$(PROJ_OBJ_DIR)/Makefile% : $(PROJ_SRC_DIR)/Makefile%
|
||||
$(PROJ_OBJ_DIR)/Makefile% : $(PROJ_MAKEFILE)%
|
||||
@case '$?' in \
|
||||
*Makefile.rules) ;; \
|
||||
*.in) ;; \
|
||||
@ -204,7 +205,7 @@ ifdef LLVMC_BASED_DRIVER
|
||||
TOOLNAME = $(LLVMC_BASED_DRIVER)
|
||||
|
||||
LLVMLIBS = CompilerDriver.a
|
||||
LINK_COMPONENTS = support system
|
||||
LINK_COMPONENTS = support
|
||||
|
||||
endif # LLVMC_BASED_DRIVER
|
||||
|
||||
@ -300,7 +301,7 @@ ifneq ($(REQUIRES_RTTI), 1)
|
||||
CXX.Flags += -fno-rtti
|
||||
endif
|
||||
|
||||
ifdef ENABLE_COVERAGE
|
||||
ifeq ($(ENABLE_COVERAGE),1)
|
||||
BuildMode := $(BuildMode)+Coverage
|
||||
CXX.Flags += -ftest-coverage -fprofile-arcs
|
||||
C.Flags += -ftest-coverage -fprofile-arcs
|
||||
@ -308,17 +309,17 @@ endif
|
||||
|
||||
# If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
|
||||
# then disable assertions by defining the appropriate preprocessor symbols.
|
||||
ifndef DISABLE_ASSERTIONS
|
||||
ifeq ($(DISABLE_ASSERTIONS),1)
|
||||
CPP.Defines += -DNDEBUG
|
||||
else
|
||||
BuildMode := $(BuildMode)+Asserts
|
||||
CPP.Defines += -D_DEBUG
|
||||
else
|
||||
CPP.Defines += -DNDEBUG
|
||||
endif
|
||||
|
||||
# If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
|
||||
# configured), then enable expensive checks by defining the
|
||||
# appropriate preprocessor symbols.
|
||||
ifdef ENABLE_EXPENSIVE_CHECKS
|
||||
ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
|
||||
BuildMode := $(BuildMode)+Checks
|
||||
CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
|
||||
endif
|
||||
@ -387,10 +388,19 @@ ifeq ($(ENABLE_PIC),0)
|
||||
CXX.Flags += -fPIC
|
||||
CPP.BaseFlags += -fPIC
|
||||
endif
|
||||
|
||||
LD.Flags += -Wl,--no-relax
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),Alpha)
|
||||
LD.Flags += -Wl,--no-relax
|
||||
# GNU ld/PECOFF accepts but ignores them below;
|
||||
# --version-script
|
||||
# --export-dynamic
|
||||
# --rpath
|
||||
# FIXME: autoconf should be aware of them.
|
||||
ifneq (,$(filter $(HOST_OS),Cygwin MingW))
|
||||
HAVE_LINK_VERSION_SCRIPT := 0
|
||||
RPATH :=
|
||||
RDYNAMIC := -Wl,--export-all-symbols
|
||||
endif
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
@ -497,8 +507,8 @@ ifeq ($(HOST_OS),Darwin)
|
||||
# Get "4" out of 10.4 for later pieces in the makefile.
|
||||
DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
|
||||
|
||||
SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined,suppress \
|
||||
-dynamiclib
|
||||
LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
|
||||
SharedLinkOptions := -dynamiclib
|
||||
ifneq ($(ARCH),ARM)
|
||||
SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
|
||||
endif
|
||||
@ -516,10 +526,6 @@ ifdef SHARED_LIBRARY
|
||||
ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
||||
ifneq ($(HOST_OS),Darwin)
|
||||
LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
|
||||
else
|
||||
ifneq ($(DARWIN_MAJVERS),4)
|
||||
LD.Flags += $(RPATH) -Wl,$(SharedLibDir)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@ -547,15 +553,21 @@ ifndef KEEP_SYMBOLS
|
||||
Install.StripFlag += -s
|
||||
endif
|
||||
|
||||
ifdef TOOL_NO_EXPORTS
|
||||
DynamicFlags :=
|
||||
else
|
||||
DynamicFlag := $(RDYNAMIC)
|
||||
endif
|
||||
|
||||
# Adjust linker flags for building an executable
|
||||
ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
||||
ifneq ($(HOST_OS), Darwin)
|
||||
ifdef TOOLNAME
|
||||
LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
|
||||
ifdef EXAMPLE_TOOL
|
||||
LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(RDYNAMIC)
|
||||
LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
|
||||
else
|
||||
LD.Flags += $(RPATH) -Wl,$(ToolDir) $(RDYNAMIC)
|
||||
LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
@ -618,11 +630,11 @@ else
|
||||
endif
|
||||
|
||||
ifeq ($(HOST_OS),SunOS)
|
||||
CPP.BaseFlags += -include llvm/System/Solaris.h
|
||||
CPP.BaseFlags += -include llvm/Support/Solaris.h
|
||||
endif
|
||||
|
||||
ifeq ($(HOST_OS),AuroraUX)
|
||||
CPP.BaseFlags += -include llvm/System/Solaris.h
|
||||
CPP.BaseFlags += -include llvm/Support/Solaris.h
|
||||
endif # !HOST_OS - AuroraUX.
|
||||
|
||||
LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
|
||||
@ -828,7 +840,9 @@ $(RecursiveTargets)::
|
||||
else
|
||||
$(RecursiveTargets)::
|
||||
$(Verb) for dir in $(OPTIONAL_DIRS); do \
|
||||
($(MAKE) -C$$dir $@ ) || exit 1; \
|
||||
if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
|
||||
($(MAKE) -C$$dir $@ ) || exit 1; \
|
||||
fi \
|
||||
done
|
||||
endif
|
||||
endif
|
||||
@ -890,10 +904,13 @@ LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
|
||||
LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
|
||||
endif
|
||||
|
||||
# Win32.DLL may refer to other components.
|
||||
ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
||||
# Loadable module for Win32 requires all symbols resolved for linking.
|
||||
# Then all symbols in LLVM.dll will be available.
|
||||
ifeq ($(ENABLE_SHARED),1)
|
||||
ifdef LOADABLE_MODULE
|
||||
LINK_COMPONENTS := all
|
||||
ifneq (,$(filter $(HOST_OS),Cygwin MingW))
|
||||
LINK_COMPONENTS += all
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -941,11 +958,6 @@ ifdef EXPORTED_SYMBOL_FILE
|
||||
# First, set up the native export file, which may differ from the source
|
||||
# export file.
|
||||
|
||||
# The option --version-script is not effective on GNU ld win32.
|
||||
ifneq (,$(filter $(HOST_OS),Cygwin MingW))
|
||||
HAVE_LINK_VERSION_SCRIPT := 0
|
||||
endif
|
||||
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
# Darwin convention prefixes symbols with underscores.
|
||||
NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
|
||||
@ -1073,12 +1085,14 @@ ifdef LIBRARYNAME
|
||||
# Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
|
||||
LIBRARYNAME := $(strip $(LIBRARYNAME))
|
||||
ifdef LOADABLE_MODULE
|
||||
LibName.A := $(LibDir)/$(LIBRARYNAME).a
|
||||
LibName.SO := $(SharedLibDir)/$(LIBRARYNAME)$(SHLIBEXT)
|
||||
BaseLibName.A := $(LIBRARYNAME).a
|
||||
BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
|
||||
else
|
||||
LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
|
||||
LibName.SO := $(SharedLibDir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
|
||||
BaseLibName.A := lib$(LIBRARYNAME).a
|
||||
BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
|
||||
endif
|
||||
LibName.A := $(LibDir)/$(BaseLibName.A)
|
||||
LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
|
||||
LibName.O := $(LibDir)/$(LIBRARYNAME).o
|
||||
LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
|
||||
|
||||
@ -1099,6 +1113,7 @@ endif
|
||||
ifdef LINK_LIBS_IN_SHARED
|
||||
ifdef LOADABLE_MODULE
|
||||
SharedLibKindMessage := "Loadable Module"
|
||||
SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
|
||||
else
|
||||
SharedLibKindMessage := "Shared Library"
|
||||
endif
|
||||
@ -1131,7 +1146,7 @@ DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
|
||||
else
|
||||
DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
|
||||
endif
|
||||
DestSharedLib := $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
|
||||
DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
|
||||
|
||||
install-local:: $(DestSharedLib)
|
||||
|
||||
@ -1323,6 +1338,18 @@ endif
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------
|
||||
# Tool Order File Support
|
||||
#---------------------------------------------------------
|
||||
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
ifdef TOOL_ORDER_FINE
|
||||
|
||||
LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------
|
||||
# Tool Version Info Support
|
||||
#---------------------------------------------------------
|
||||
@ -1441,27 +1468,27 @@ DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
|
||||
DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
|
||||
else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
|
||||
|
||||
$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_SRC_DIR)/Makefile
|
||||
$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
|
||||
$(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
|
||||
$(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
||||
$(DEPEND_MOVEFILE)
|
||||
|
||||
$(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_SRC_DIR)/Makefile
|
||||
$(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
|
||||
$(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
|
||||
$(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
||||
$(DEPEND_MOVEFILE)
|
||||
|
||||
$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_SRC_DIR)/Makefile
|
||||
$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
|
||||
$(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
|
||||
$(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
||||
$(DEPEND_MOVEFILE)
|
||||
|
||||
$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_SRC_DIR)/Makefile
|
||||
$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
|
||||
$(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
|
||||
$(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
||||
$(DEPEND_MOVEFILE)
|
||||
|
||||
$(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_SRC_DIR)/Makefile
|
||||
$(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
|
||||
$(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
|
||||
$(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
||||
$(DEPEND_MOVEFILE)
|
||||
@ -1481,31 +1508,31 @@ BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d";
|
||||
$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
|
||||
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
|
||||
$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
|
||||
$< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
|
||||
$< -o $(ObjDir)/$*.ll -S -$(LLVMCC_EMITIR_FLAG) ; \
|
||||
$(BC_DEPEND_MOVEFILE)
|
||||
|
||||
$(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
|
||||
$(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
|
||||
$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
|
||||
$< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
|
||||
$< -o $(ObjDir)/$*.ll -S -$(LLVMCC_EMITIR_FLAG) ; \
|
||||
$(BC_DEPEND_MOVEFILE)
|
||||
|
||||
$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
|
||||
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
|
||||
$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
|
||||
$< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
|
||||
$< -o $(ObjDir)/$*.ll -S -$(LLVMCC_EMITIR_FLAG) ; \
|
||||
$(BC_DEPEND_MOVEFILE)
|
||||
|
||||
$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
|
||||
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
|
||||
$(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
|
||||
$< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
|
||||
$< -o $(ObjDir)/$*.ll -S -$(LLVMCC_EMITIR_FLAG) ; \
|
||||
$(BC_DEPEND_MOVEFILE)
|
||||
|
||||
$(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
|
||||
$(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
|
||||
$(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
|
||||
$< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
|
||||
$< -o $(ObjDir)/$*.ll -S -$(LLVMCC_EMITIR_FLAG) ; \
|
||||
$(BC_DEPEND_MOVEFILE)
|
||||
|
||||
# Provide alternate rule sets if dependencies are disabled
|
||||
@ -1533,23 +1560,23 @@ $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
|
||||
|
||||
$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
|
||||
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
|
||||
$(BCCompile.CXX) $< -o $@ -S -emit-llvm
|
||||
$(BCCompile.CXX) $< -o $@ -S -$(LLVMCC_EMITIR_FLAG)
|
||||
|
||||
$(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
|
||||
$(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
|
||||
$(BCCompile.CXX) $< -o $@ -S -emit-llvm
|
||||
$(BCCompile.CXX) $< -o $@ -S -$(LLVMCC_EMITIR_FLAG)
|
||||
|
||||
$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
|
||||
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
|
||||
$(BCCompile.CXX) $< -o $@ -S -emit-llvm
|
||||
$(BCCompile.CXX) $< -o $@ -S -$(LLVMCC_EMITIR_FLAG)
|
||||
|
||||
$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
|
||||
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
|
||||
$(BCCompile.C) $< -o $@ -S -emit-llvm
|
||||
$(BCCompile.C) $< -o $@ -S -$(LLVMCC_EMITIR_FLAG)
|
||||
|
||||
$(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
|
||||
$(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
|
||||
$(BCCompile.C) $< -o $@ -S -emit-llvm
|
||||
$(BCCompile.C) $< -o $@ -S -$(LLVMCC_EMITIR_FLAG)
|
||||
|
||||
endif
|
||||
|
||||
@ -1699,6 +1726,11 @@ $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir
|
||||
$(Echo) "Building $(<F) assembly matcher with tblgen"
|
||||
$(Verb) $(TableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
|
||||
|
||||
$(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
|
||||
$(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
|
||||
$(Echo) "Building $(<F) MC code emitter with tblgen"
|
||||
$(Verb) $(TableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
|
||||
|
||||
$(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
|
||||
$(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
|
||||
$(Echo) "Building $(<F) code emitter with tblgen"
|
||||
|
@ -1,4 +1,4 @@
|
||||
DepModule:
|
||||
DepModule:
|
||||
BuildCmd: ./build-for-llvm-top.sh
|
||||
CleanCmd: make clean -C ../build.llvm
|
||||
InstallCmd: make install -C ../build.llvm
|
||||
|
@ -1,4 +1,4 @@
|
||||
\Low Level Virtual Machine (LLVM)
|
||||
Low Level Virtual Machine (LLVM)
|
||||
================================
|
||||
|
||||
This directory and its subdirectories contain source code for the Low Level
|
||||
|
@ -31,7 +31,7 @@ dnl===
|
||||
dnl===-----------------------------------------------------------------------===
|
||||
dnl Initialize autoconf and define the package name, version number and
|
||||
dnl email address for reporting bugs.
|
||||
AC_INIT([[llvm]],[[2.8]],[llvmbugs@cs.uiuc.edu])
|
||||
AC_INIT([[llvm]],[[2.9svn]],[llvmbugs@cs.uiuc.edu])
|
||||
|
||||
dnl Provide a copyright substitution and ensure the copyright notice is included
|
||||
dnl in the output of --version option of the generated configure script.
|
||||
@ -121,6 +121,26 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
dnl Disable the build of polly, even if it is checked out into tools/polly.
|
||||
AC_ARG_ENABLE(polly,
|
||||
AS_HELP_STRING([--enable-polly],
|
||||
[Use polly if available (default is YES)]),,
|
||||
enableval=default)
|
||||
case "$enableval" in
|
||||
yes) AC_SUBST(ENABLE_POLLY,[1]) ;;
|
||||
no) AC_SUBST(ENABLE_POLLY,[0]) ;;
|
||||
default) AC_SUBST(ENABLE_POLLY,[1]) ;;
|
||||
*) AC_MSG_ERROR([Invalid setting for --enable-polly. Use "yes" or "no"]) ;;
|
||||
esac
|
||||
|
||||
|
||||
dnl Check if polly is checked out into tools/polly and configure it if
|
||||
dnl available.
|
||||
if (test -d ${srcdir}/tools/polly) && (test $ENABLE_POLLY -eq 1) ; then
|
||||
AC_SUBST(LLVM_HAS_POLLY,1)
|
||||
AC_CONFIG_SUBDIRS([tools/polly])
|
||||
fi
|
||||
|
||||
dnl===-----------------------------------------------------------------------===
|
||||
dnl===
|
||||
dnl=== SECTION 2: Architecture, target, and host checks
|
||||
@ -299,7 +319,7 @@ AC_SUBST(LINKALL,$llvm_cv_link_all_option)
|
||||
AC_SUBST(NOLINKALL,$llvm_cv_no_link_all_option)
|
||||
|
||||
dnl Set the "LLVM_ON_*" variables based on llvm_cv_platform_type
|
||||
dnl This is used by lib/System to determine the basic kind of implementation
|
||||
dnl This is used by lib/Support to determine the basic kind of implementation
|
||||
dnl to use.
|
||||
case $llvm_cv_platform_type in
|
||||
Unix)
|
||||
@ -326,12 +346,12 @@ AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
|
||||
alpha*-*) llvm_cv_target_arch="Alpha" ;;
|
||||
arm*-*) llvm_cv_target_arch="ARM" ;;
|
||||
mips-*) llvm_cv_target_arch="Mips" ;;
|
||||
pic16-*) llvm_cv_target_arch="PIC16" ;;
|
||||
xcore-*) llvm_cv_target_arch="XCore" ;;
|
||||
msp430-*) llvm_cv_target_arch="MSP430" ;;
|
||||
s390x-*) llvm_cv_target_arch="SystemZ" ;;
|
||||
bfin-*) llvm_cv_target_arch="Blackfin" ;;
|
||||
mblaze-*) llvm_cv_target_arch="MBlaze" ;;
|
||||
ptx-*) llvm_cv_target_arch="PTX" ;;
|
||||
*) llvm_cv_target_arch="Unknown" ;;
|
||||
esac])
|
||||
|
||||
@ -391,7 +411,7 @@ dnl===-----------------------------------------------------------------------===
|
||||
|
||||
dnl --enable-optimized : check whether they want to do an optimized build:
|
||||
AC_ARG_ENABLE(optimized, AS_HELP_STRING(
|
||||
--enable-optimized,[Compile with optimizations enabled (default is YES)]),,enableval="yes")
|
||||
--enable-optimized,[Compile with optimizations enabled (default is NO)]),,enableval=$optimize)
|
||||
if test ${enableval} = "no" ; then
|
||||
AC_SUBST(ENABLE_OPTIMIZED,[[]])
|
||||
else
|
||||
@ -409,7 +429,7 @@ fi
|
||||
|
||||
dnl --enable-assertions : check whether they want to turn on assertions or not:
|
||||
AC_ARG_ENABLE(assertions,AS_HELP_STRING(
|
||||
--enable-assertions,[Compile with assertion checks enabled (default is NO)]),, enableval="no")
|
||||
--enable-assertions,[Compile with assertion checks enabled (default is YES)]),, enableval="yes")
|
||||
if test ${enableval} = "yes" ; then
|
||||
AC_SUBST(DISABLE_ASSERTIONS,[[]])
|
||||
else
|
||||
@ -460,19 +480,31 @@ else
|
||||
Sparc) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
PowerPC) AC_SUBST(TARGET_HAS_JIT,1) ;;
|
||||
x86_64) AC_SUBST(TARGET_HAS_JIT,1) ;;
|
||||
Alpha) AC_SUBST(TARGET_HAS_JIT,1) ;;
|
||||
Alpha) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
ARM) AC_SUBST(TARGET_HAS_JIT,1) ;;
|
||||
Mips) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
PIC16) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
XCore) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
MSP430) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
SystemZ) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
Blackfin) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
MBlaze) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
PTX) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
*) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
dnl Allow enablement of building and installing docs
|
||||
AC_ARG_ENABLE(docs,
|
||||
AS_HELP_STRING([--enable-docs],
|
||||
[Build documents (default is YES)]),,
|
||||
enableval=default)
|
||||
case "$enableval" in
|
||||
yes) AC_SUBST(ENABLE_DOCS,[1]) ;;
|
||||
no) AC_SUBST(ENABLE_DOCS,[0]) ;;
|
||||
default) AC_SUBST(ENABLE_DOCS,[1]) ;;
|
||||
*) AC_MSG_ERROR([Invalid setting for --enable-docs. Use "yes" or "no"]) ;;
|
||||
esac
|
||||
|
||||
dnl Allow enablement of doxygen generated documentation
|
||||
AC_ARG_ENABLE(doxygen,
|
||||
AS_HELP_STRING([--enable-doxygen],
|
||||
@ -498,6 +530,18 @@ case "$enableval" in
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled])
|
||||
|
||||
dnl Allow disablement of pthread.h
|
||||
AC_ARG_ENABLE(pthreads,
|
||||
AS_HELP_STRING([--enable-pthreads],
|
||||
[Use pthreads if available (default is YES)]),,
|
||||
enableval=default)
|
||||
case "$enableval" in
|
||||
yes) AC_SUBST(ENABLE_PTHREADS,[1]) ;;
|
||||
no) AC_SUBST(ENABLE_PTHREADS,[0]) ;;
|
||||
default) AC_SUBST(ENABLE_PTHREADS,[1]) ;;
|
||||
*) AC_MSG_ERROR([Invalid setting for --enable-pthreads. Use "yes" or "no"]) ;;
|
||||
esac
|
||||
|
||||
dnl Allow building without position independent code
|
||||
AC_ARG_ENABLE(pic,
|
||||
AS_HELP_STRING([--enable-pic],
|
||||
@ -524,6 +568,18 @@ case "$enableval" in
|
||||
*) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;;
|
||||
esac
|
||||
|
||||
dnl Allow libstdc++ is embedded in LLVM.dll.
|
||||
AC_ARG_ENABLE(embed-stdcxx,
|
||||
AS_HELP_STRING([--enable-embed-stdcxx],
|
||||
[Build a shared library with embedded libstdc++ for Win32 DLL (default is YES)]),,
|
||||
enableval=default)
|
||||
case "$enableval" in
|
||||
yes) AC_SUBST(ENABLE_EMBED_STDCXX,[1]) ;;
|
||||
no) AC_SUBST(ENABLE_EMBED_STDCXX,[0]) ;;
|
||||
default) AC_SUBST(ENABLE_EMBED_STDCXX,[1]) ;;
|
||||
*) AC_MSG_ERROR([Invalid setting for --enable-embed-stdcxx. Use "yes" or "no"]) ;;
|
||||
esac
|
||||
|
||||
dnl Enable embedding timestamp information into build.
|
||||
AC_ARG_ENABLE(timestamps,
|
||||
AS_HELP_STRING([--enable-timestamps],
|
||||
@ -542,14 +598,14 @@ dnl Allow specific targets to be specified for building (or not)
|
||||
TARGETS_TO_BUILD=""
|
||||
AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
|
||||
[Build specific host targets: all or target1,target2,... Valid targets are:
|
||||
host, x86, x86_64, sparc, powerpc, alpha, arm, mips, spu, pic16,
|
||||
xcore, msp430, systemz, blackfin, cbe, and cpp (default=all)]),,
|
||||
host, x86, x86_64, sparc, powerpc, alpha, arm, mips, spu,
|
||||
xcore, msp430, systemz, blackfin, ptx, cbe, and cpp (default=all)]),,
|
||||
enableval=all)
|
||||
if test "$enableval" = host-only ; then
|
||||
enableval=host
|
||||
fi
|
||||
case "$enableval" in
|
||||
all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend CppBackend MBlaze" ;;
|
||||
all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU XCore MSP430 SystemZ Blackfin CBackend CppBackend MBlaze PTX" ;;
|
||||
*)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
|
||||
case "$a_target" in
|
||||
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
|
||||
@ -560,7 +616,6 @@ case "$enableval" in
|
||||
arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
|
||||
mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
|
||||
spu) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
|
||||
pic16) TARGETS_TO_BUILD="PIC16 $TARGETS_TO_BUILD" ;;
|
||||
xcore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
|
||||
msp430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;;
|
||||
systemz) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;;
|
||||
@ -568,6 +623,7 @@ case "$enableval" in
|
||||
cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;;
|
||||
cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;;
|
||||
mblaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
|
||||
ptx) TARGETS_TO_BUILD="PTX $TARGETS_TO_BUILD" ;;
|
||||
host) case "$llvm_cv_target_arch" in
|
||||
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
|
||||
x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
|
||||
@ -578,11 +634,11 @@ case "$enableval" in
|
||||
Mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
|
||||
MBlaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
|
||||
CellSPU|SPU) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
|
||||
PIC16) TARGETS_TO_BUILD="PIC16 $TARGETS_TO_BUILD" ;;
|
||||
XCore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
|
||||
MSP430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;;
|
||||
s390x) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;;
|
||||
Blackfin) TARGETS_TO_BUILD="Blackfin $TARGETS_TO_BUILD" ;;
|
||||
PTX) TARGETS_TO_BUILD="PTX $TARGETS_TO_BUILD" ;;
|
||||
*) AC_MSG_ERROR([Can not set target to build]) ;;
|
||||
esac ;;
|
||||
*) AC_MSG_ERROR([Unrecognized target $a_target]) ;;
|
||||
@ -618,7 +674,7 @@ LLVM_ENUM_ASM_PARSERS=""
|
||||
LLVM_ENUM_DISASSEMBLERS=""
|
||||
for target_to_build in $TARGETS_TO_BUILD; do
|
||||
LLVM_ENUM_TARGETS="LLVM_TARGET($target_to_build) $LLVM_ENUM_TARGETS"
|
||||
if test -f ${srcdir}/lib/Target/${target_to_build}/AsmPrinter/Makefile ; then
|
||||
if test -f ${srcdir}/lib/Target/${target_to_build}/*AsmPrinter.cpp ; then
|
||||
LLVM_ENUM_ASM_PRINTERS="LLVM_ASM_PRINTER($target_to_build) $LLVM_ENUM_ASM_PRINTERS";
|
||||
fi
|
||||
if test -f ${srcdir}/lib/Target/${target_to_build}/AsmParser/Makefile ; then
|
||||
@ -800,6 +856,13 @@ case "$withval" in
|
||||
*) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH(clang-resource-dir,
|
||||
AS_HELP_STRING([--with-clang-resource-dir],
|
||||
[Relative directory from the Clang binary for resource files]),,
|
||||
withval="")
|
||||
AC_DEFINE_UNQUOTED(CLANG_RESOURCE_DIR,"$withval",
|
||||
[Relative directory for resource files])
|
||||
|
||||
AC_ARG_WITH(c-include-dirs,
|
||||
AS_HELP_STRING([--with-c-include-dirs],
|
||||
[Colon separated list of directories clang will search for headers]),,
|
||||
@ -975,6 +1038,16 @@ if test "$DOTTY" != "echo dotty" ; then
|
||||
AC_DEFINE_UNQUOTED([LLVM_PATH_DOTTY],"$DOTTY${EXEEXT}",
|
||||
[Define to path to dotty program if found or 'echo dotty' otherwise])
|
||||
fi
|
||||
AC_PATH_PROG(XDOT_PY, [xdot.py], [echo xdot.py])
|
||||
if test "$XDOT_PY" != "echo xdot.py" ; then
|
||||
AC_DEFINE([HAVE_XDOT_PY],[1],[Define if the xdot.py program is available])
|
||||
dnl If we're targeting for mingw we should emit windows paths, not msys
|
||||
if test "$llvm_cv_os_type" = "MingW" ; then
|
||||
XDOT_PY=`echo $XDOT_PY | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([LLVM_PATH_XDOT_PY],"$XDOT_PY${EXEEXT}",
|
||||
[Define to path to xdot.py program if found or 'echo xdot.py' otherwise])
|
||||
fi
|
||||
|
||||
dnl Look for a sufficiently recent version of Perl.
|
||||
LLVM_PROG_PERL([5.006])
|
||||
@ -1004,7 +1077,7 @@ AC_PATH_PROG(BZIP2, [bzip2])
|
||||
AC_PATH_PROG(CAT, [cat])
|
||||
AC_PATH_PROG(DOXYGEN, [doxygen])
|
||||
AC_PATH_PROG(GROFF, [groff])
|
||||
AC_PATH_PROG(GZIP, [gzip])
|
||||
AC_PATH_PROG(GZIPBIN, [gzip])
|
||||
AC_PATH_PROG(POD2HTML, [pod2html])
|
||||
AC_PATH_PROG(POD2MAN, [pod2man])
|
||||
AC_PATH_PROG(PDFROFF, [pdfroff])
|
||||
@ -1107,10 +1180,10 @@ then
|
||||
AC_MSG_ERROR([gcc|icc required but not found])
|
||||
fi
|
||||
|
||||
dnl Ensure that compilation tools are GCC; we use GCC specific extensions
|
||||
dnl Ensure that compilation tools are compatible with GCC extensions
|
||||
if test "$GXX" != "yes" && test "$IXX" != "yes"
|
||||
then
|
||||
AC_MSG_ERROR([g++|icc required but not found])
|
||||
AC_MSG_ERROR([g++|clang++|icc required but not found])
|
||||
fi
|
||||
|
||||
dnl Verify that GCC is version 3.0 or higher
|
||||
@ -1167,7 +1240,7 @@ AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],
|
||||
|
||||
dnl pthread locking functions are optional - but llvm will not be thread-safe
|
||||
dnl without locks.
|
||||
if test "$ENABLE_THREADS" -eq 1 ; then
|
||||
if test "$ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then
|
||||
AC_CHECK_LIB(pthread, pthread_mutex_init)
|
||||
AC_SEARCH_LIBS(pthread_mutex_lock,pthread,
|
||||
AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1],
|
||||
@ -1255,10 +1328,11 @@ AC_HEADER_TIME
|
||||
AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
|
||||
AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h termios.h unistd.h])
|
||||
AC_CHECK_HEADERS([utime.h windows.h])
|
||||
AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h])
|
||||
AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/uio.h])
|
||||
AC_CHECK_HEADERS([sys/types.h sys/ioctl.h malloc/malloc.h mach/mach.h])
|
||||
AC_CHECK_HEADERS([valgrind/valgrind.h])
|
||||
if test "$ENABLE_THREADS" -eq 1 ; then
|
||||
AC_CHECK_HEADERS([fenv.h])
|
||||
if test "$ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then
|
||||
AC_CHECK_HEADERS(pthread.h,
|
||||
AC_SUBST(HAVE_PTHREAD, 1),
|
||||
AC_SUBST(HAVE_PTHREAD, 0))
|
||||
@ -1271,9 +1345,25 @@ if test "$llvm_cv_enable_libffi" = "yes" ; then
|
||||
AC_CHECK_HEADERS([ffi.h ffi/ffi.h])
|
||||
fi
|
||||
|
||||
dnl Try to find Darwin specific crash reporting library.
|
||||
dnl Try to find Darwin specific crash reporting libraries.
|
||||
AC_CHECK_HEADERS([CrashReporterClient.h])
|
||||
|
||||
dnl Try to find Darwin specific crash reporting global.
|
||||
AC_MSG_CHECKING([__crashreporter_info__])
|
||||
AC_LINK_IFELSE(
|
||||
AC_LANG_SOURCE(
|
||||
[[extern const char *__crashreporter_info__;
|
||||
int main() {
|
||||
__crashreporter_info__ = "test";
|
||||
return 0;
|
||||
}
|
||||
]]),
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_CRASHREPORTER_INFO, 1, Can use __crashreporter_info__),
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(HAVE_CRASHREPORTER_INFO, 0,
|
||||
Define if __crashreporter_info__ exists.))
|
||||
|
||||
dnl===-----------------------------------------------------------------------===
|
||||
dnl===
|
||||
dnl=== SECTION 7: Check for types and structures
|
||||
@ -1301,12 +1391,37 @@ AC_CHECK_FUNCS([powf fmodf strtof round ])
|
||||
AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ])
|
||||
AC_CHECK_FUNCS([isatty mkdtemp mkstemp ])
|
||||
AC_CHECK_FUNCS([mktemp posix_spawn realpath sbrk setrlimit strdup ])
|
||||
AC_CHECK_FUNCS([strerror strerror_r strerror_s setenv ])
|
||||
AC_CHECK_FUNCS([strerror strerror_r setenv ])
|
||||
AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
|
||||
AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp])
|
||||
AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev])
|
||||
AC_C_PRINTF_A
|
||||
AC_FUNC_RAND48
|
||||
|
||||
dnl Check the declaration "Secure API" on Windows environments.
|
||||
AC_CHECK_DECLS([strerror_s])
|
||||
|
||||
dnl Check symbols in libgcc.a for JIT on Mingw.
|
||||
if test "$llvm_cv_os_type" = "MingW" ; then
|
||||
AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca]))
|
||||
AC_CHECK_LIB(gcc,__alloca,AC_DEFINE([HAVE___ALLOCA],[1],[Have host's __alloca]))
|
||||
AC_CHECK_LIB(gcc,__chkstk,AC_DEFINE([HAVE___CHKSTK],[1],[Have host's __chkstk]))
|
||||
AC_CHECK_LIB(gcc,___chkstk,AC_DEFINE([HAVE____CHKSTK],[1],[Have host's ___chkstk]))
|
||||
|
||||
AC_CHECK_LIB(gcc,__ashldi3,AC_DEFINE([HAVE___ASHLDI3],[1],[Have host's __ashldi3]))
|
||||
AC_CHECK_LIB(gcc,__ashrdi3,AC_DEFINE([HAVE___ASHRDI3],[1],[Have host's __ashrdi3]))
|
||||
AC_CHECK_LIB(gcc,__divdi3,AC_DEFINE([HAVE___DIVDI3],[1],[Have host's __divdi3]))
|
||||
AC_CHECK_LIB(gcc,__fixdfdi,AC_DEFINE([HAVE___FIXDFDI],[1],[Have host's __fixdfdi]))
|
||||
AC_CHECK_LIB(gcc,__fixsfdi,AC_DEFINE([HAVE___FIXSFDI],[1],[Have host's __fixsfdi]))
|
||||
AC_CHECK_LIB(gcc,__floatdidf,AC_DEFINE([HAVE___FLOATDIDF],[1],[Have host's __floatdidf]))
|
||||
AC_CHECK_LIB(gcc,__lshrdi3,AC_DEFINE([HAVE___LSHRDI3],[1],[Have host's __lshrdi3]))
|
||||
AC_CHECK_LIB(gcc,__moddi3,AC_DEFINE([HAVE___MODDI3],[1],[Have host's __moddi3]))
|
||||
AC_CHECK_LIB(gcc,__udivdi3,AC_DEFINE([HAVE___UDIVDI3],[1],[Have host's __udivdi3]))
|
||||
AC_CHECK_LIB(gcc,__umoddi3,AC_DEFINE([HAVE___UMODDI3],[1],[Have host's __umoddi3]))
|
||||
|
||||
AC_CHECK_LIB(gcc,__main,AC_DEFINE([HAVE___MAIN],[1],[Have host's __main]))
|
||||
AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2]))
|
||||
fi
|
||||
|
||||
dnl Check for variations in the Standard C++ library and STL. These macros are
|
||||
dnl provided by LLVM in the autoconf/m4 directory.
|
||||
AC_FUNC_ISNAN
|
||||
@ -1372,12 +1487,36 @@ fi
|
||||
dnl Check, whether __dso_handle is present
|
||||
AC_CHECK_FUNCS([__dso_handle])
|
||||
|
||||
dnl Check wether llvm-gcc is based on dragonegg
|
||||
AC_CACHE_CHECK([whether llvm-gcc is dragonegg],[llvm_cv_llvmgcc_dragonegg],
|
||||
[llvm_cv_llvmgcc_dragonegg="no"
|
||||
if test -n "$LLVMGCC" ; then
|
||||
cp /dev/null conftest.c
|
||||
$LLVMGCC -fplugin-arg-dragonegg-emit-ir -S -o - conftest.c > /dev/null 2>&1
|
||||
if test $? -eq 0 ; then
|
||||
llvm_cv_llvmgcc_dragonegg="yes"
|
||||
fi
|
||||
rm conftest.c
|
||||
fi])
|
||||
|
||||
dnl Set the flags needed to emit LLVM IR and to disable optimizations
|
||||
dnl in llvmgcc
|
||||
if test "$llvm_cv_llvmgcc_dragonegg" = "yes" ; then
|
||||
LLVMCC_EMITIR_FLAG="-fplugin-arg-dragonegg-emit-ir"
|
||||
LLVMCC_DISABLEOPT_FLAGS="-fplugin-arg-dragonegg-disable-llvm-optzns"
|
||||
else
|
||||
LLVMCC_EMITIR_FLAG="-emit-llvm"
|
||||
LLVMCC_DISABLEOPT_FLAGS="-mllvm -disable-llvm-optzns"
|
||||
fi
|
||||
|
||||
AC_SUBST(LLVMCC_EMITIR_FLAG)
|
||||
|
||||
dnl See if the llvm-gcc executable can compile to LLVM assembly
|
||||
AC_CACHE_CHECK([whether llvm-gcc is sane],[llvm_cv_llvmgcc_sanity],
|
||||
[llvm_cv_llvmgcc_sanity="no"
|
||||
if test -x "$LLVMGCC" ; then
|
||||
if test -n "$LLVMGCC" ; then
|
||||
cp /dev/null conftest.c
|
||||
"$LLVMGCC" -emit-llvm -S -o - conftest.c | \
|
||||
$LLVMGCC "$LLVMCC_EMITIR_FLAG" -S -o - conftest.c | \
|
||||
grep 'target datalayout =' > /dev/null 2>&1
|
||||
if test $? -eq 0 ; then
|
||||
llvm_cv_llvmgcc_sanity="yes"
|
||||
@ -1386,16 +1525,19 @@ if test -x "$LLVMGCC" ; then
|
||||
fi])
|
||||
|
||||
dnl Since we have a sane llvm-gcc, identify it and its sub-tools
|
||||
dnl Furthermore, add some information about the tools
|
||||
if test "$llvm_cv_llvmgcc_sanity" = "yes" ; then
|
||||
AC_MSG_CHECKING([llvm-gcc component support])
|
||||
llvmcc1path=`"$LLVMGCC" --print-prog-name=cc1`
|
||||
llvmcc1path=`$LLVMGCC --print-prog-name=cc1`
|
||||
AC_SUBST(LLVMCC1,$llvmcc1path)
|
||||
llvmcc1pluspath=`"$LLVMGCC" --print-prog-name=cc1plus`
|
||||
llvmcc1pluspath=`$LLVMGCC --print-prog-name=cc1plus`
|
||||
AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
|
||||
llvmgccdir=`echo "$llvmcc1path" | sed 's,/libexec/.*,,'`
|
||||
AC_SUBST(LLVMGCCDIR,$llvmgccdir)
|
||||
llvmgcclangs=[`"$LLVMGCC" -v --help 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ ]*\).*/\1/'`]
|
||||
llvmgcclangs=[`$LLVMGCC -v --help 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ ]*\).*/\1/'`]
|
||||
AC_SUBST(LLVMGCC_LANGS,$llvmgcclangs)
|
||||
AC_SUBST(LLVMGCC_DRAGONEGG,$llvm_cv_llvmgcc_dragonegg)
|
||||
AC_SUBST(LLVMCC_DISABLEOPT_FLAGS)
|
||||
AC_MSG_RESULT([ok])
|
||||
fi
|
||||
|
||||
@ -1548,7 +1690,7 @@ AC_CONFIG_FILES([include/llvm/Config/Targets.def])
|
||||
AC_CONFIG_FILES([include/llvm/Config/AsmPrinters.def])
|
||||
AC_CONFIG_FILES([include/llvm/Config/AsmParsers.def])
|
||||
AC_CONFIG_FILES([include/llvm/Config/Disassemblers.def])
|
||||
AC_CONFIG_HEADERS([include/llvm/System/DataTypes.h])
|
||||
AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h])
|
||||
|
||||
dnl Configure the makefile's configuration data
|
||||
AC_CONFIG_FILES([Makefile.config])
|
||||
|
@ -1,32 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
with llvm;
|
||||
with Interfaces.C.Strings;
|
||||
|
||||
|
||||
package LLVM_Analysis.Binding is
|
||||
|
||||
function LLVMVerifyModule
|
||||
(M : in llvm.LLVMModuleRef;
|
||||
Action : in LLVM_Analysis.LLVMVerifierFailureAction;
|
||||
OutMessage : access Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.int;
|
||||
|
||||
function LLVMVerifyFunction
|
||||
(Fn : in llvm.LLVMValueRef;
|
||||
Action : in LLVM_Analysis.LLVMVerifierFailureAction)
|
||||
return Interfaces.C.int;
|
||||
|
||||
procedure LLVMViewFunctionCFG (Fn : in llvm.LLVMValueRef);
|
||||
|
||||
procedure LLVMViewFunctionCFGOnly (Fn : in llvm.LLVMValueRef);
|
||||
|
||||
private
|
||||
|
||||
pragma Import (C, LLVMVerifyModule, "Ada_LLVMVerifyModule");
|
||||
pragma Import (C, LLVMVerifyFunction, "Ada_LLVMVerifyFunction");
|
||||
pragma Import (C, LLVMViewFunctionCFG, "Ada_LLVMViewFunctionCFG");
|
||||
pragma Import (C, LLVMViewFunctionCFGOnly, "Ada_LLVMViewFunctionCFGOnly");
|
||||
|
||||
end LLVM_Analysis.Binding;
|
@ -1,30 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
with Interfaces.C;
|
||||
|
||||
|
||||
package LLVM_Analysis is
|
||||
|
||||
-- LLVMVerifierFailureAction
|
||||
--
|
||||
type LLVMVerifierFailureAction is (
|
||||
LLVMAbortProcessAction,
|
||||
LLVMPrintMessageAction,
|
||||
LLVMReturnStatusAction);
|
||||
|
||||
for LLVMVerifierFailureAction use
|
||||
(LLVMAbortProcessAction => 0,
|
||||
LLVMPrintMessageAction => 1,
|
||||
LLVMReturnStatusAction => 2);
|
||||
|
||||
pragma Convention (C, LLVMVerifierFailureAction);
|
||||
|
||||
type LLVMVerifierFailureAction_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_Analysis.LLVMVerifierFailureAction;
|
||||
|
||||
type LLVMVerifierFailureAction_view is access all
|
||||
LLVM_Analysis.LLVMVerifierFailureAction;
|
||||
|
||||
end LLVM_Analysis;
|
@ -1,369 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.36
|
||||
*
|
||||
* This file is not intended to be easily readable and contains a number of
|
||||
* coding conventions designed to improve portability and efficiency. Do not make
|
||||
* changes to this file unless you know what you are doing--modify the SWIG
|
||||
* interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
template<typename T> class SwigValueWrapper {
|
||||
T *tt;
|
||||
public:
|
||||
SwigValueWrapper() : tt(0) { }
|
||||
SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
|
||||
SwigValueWrapper(const T& t) : tt(new T(t)) { }
|
||||
~SwigValueWrapper() { delete tt; }
|
||||
SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
|
||||
operator T&() const { return *tt; }
|
||||
T *operator&() { return tt; }
|
||||
private:
|
||||
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
|
||||
};
|
||||
|
||||
template <typename T> T SwigValueInit() {
|
||||
return T();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* This section contains generic SWIG labels for method/variable
|
||||
* declarations/attributes, and other compiler dependent labels.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* template workaround for compilers that cannot correctly implement the C++ standard */
|
||||
#ifndef SWIGTEMPLATEDISAMBIGUATOR
|
||||
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# elif defined(__HP_aCC)
|
||||
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
|
||||
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# else
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* inline attribute */
|
||||
#ifndef SWIGINLINE
|
||||
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
|
||||
# define SWIGINLINE inline
|
||||
# else
|
||||
# define SWIGINLINE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* attribute recognised by some compilers to avoid 'unused' warnings */
|
||||
#ifndef SWIGUNUSED
|
||||
# if defined(__GNUC__)
|
||||
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
# elif defined(__ICC)
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGUNUSEDPARM
|
||||
# ifdef __cplusplus
|
||||
# define SWIGUNUSEDPARM(p)
|
||||
# else
|
||||
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* internal SWIG method */
|
||||
#ifndef SWIGINTERN
|
||||
# define SWIGINTERN static SWIGUNUSED
|
||||
#endif
|
||||
|
||||
/* internal inline SWIG method */
|
||||
#ifndef SWIGINTERNINLINE
|
||||
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
|
||||
#endif
|
||||
|
||||
/* exporting methods */
|
||||
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
# ifndef GCC_HASCLASSVISIBILITY
|
||||
# define GCC_HASCLASSVISIBILITY
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGEXPORT
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if defined(STATIC_LINKED)
|
||||
# define SWIGEXPORT
|
||||
# else
|
||||
# define SWIGEXPORT __declspec(dllexport)
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
||||
# define SWIGEXPORT __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define SWIGEXPORT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* calling conventions for Windows */
|
||||
#ifndef SWIGSTDCALL
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# define SWIGSTDCALL __stdcall
|
||||
# else
|
||||
# define SWIGSTDCALL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
||||
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
|
||||
# define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
|
||||
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
|
||||
# define _SCL_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
# define DllExport __declspec( dllexport )
|
||||
# define SWIGSTDCALL __stdcall
|
||||
#else
|
||||
# define DllExport
|
||||
# define SWIGSTDCALL
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <new>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Support for throwing Ada exceptions from C/C++ */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SWIG_AdaException,
|
||||
SWIG_AdaOutOfMemoryException,
|
||||
SWIG_AdaIndexOutOfRangeException,
|
||||
SWIG_AdaDivideByZeroException,
|
||||
SWIG_AdaArgumentOutOfRangeException,
|
||||
SWIG_AdaNullReferenceException
|
||||
} SWIG_AdaExceptionCodes;
|
||||
|
||||
|
||||
typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SWIG_AdaExceptionCodes code;
|
||||
SWIG_AdaExceptionCallback_t callback;
|
||||
}
|
||||
SWIG_AdaExceptions_t;
|
||||
|
||||
|
||||
static
|
||||
SWIG_AdaExceptions_t
|
||||
SWIG_ada_exceptions[] =
|
||||
{
|
||||
{ SWIG_AdaException, NULL },
|
||||
{ SWIG_AdaOutOfMemoryException, NULL },
|
||||
{ SWIG_AdaIndexOutOfRangeException, NULL },
|
||||
{ SWIG_AdaDivideByZeroException, NULL },
|
||||
{ SWIG_AdaArgumentOutOfRangeException, NULL },
|
||||
{ SWIG_AdaNullReferenceException, NULL }
|
||||
};
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg)
|
||||
{
|
||||
SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback;
|
||||
if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) {
|
||||
callback = SWIG_ada_exceptions[code].callback;
|
||||
}
|
||||
callback(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
|
||||
DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_Analysis (SWIG_AdaExceptionCallback_t systemException,
|
||||
SWIG_AdaExceptionCallback_t outOfMemory,
|
||||
SWIG_AdaExceptionCallback_t indexOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t divideByZero,
|
||||
SWIG_AdaExceptionCallback_t argumentOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t nullReference)
|
||||
{
|
||||
SWIG_ada_exceptions [SWIG_AdaException].callback = systemException;
|
||||
SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory;
|
||||
SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero;
|
||||
SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference;
|
||||
}
|
||||
|
||||
|
||||
/* Callback for returning strings to Ada without leaking memory */
|
||||
|
||||
typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *);
|
||||
static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL;
|
||||
|
||||
|
||||
|
||||
/* probably obsolete ...
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_Analysis(SWIG_AdaStringHelperCallback callback) {
|
||||
SWIG_ada_string_callback = callback;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Contract support */
|
||||
|
||||
#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else
|
||||
|
||||
|
||||
#define protected public
|
||||
#define private public
|
||||
|
||||
#include "llvm-c/Analysis.h"
|
||||
//#include "llvm-c/BitReader.h"
|
||||
//#include "llvm-c/BitWriter.h"
|
||||
//#include "llvm-c/Core.h"
|
||||
//#include "llvm-c/ExecutionEngine.h"
|
||||
//#include "llvm-c/LinkTimeOptimizer.h"
|
||||
//#include "llvm-c/lto.h"
|
||||
//#include "llvm-c/Target.h"
|
||||
|
||||
|
||||
|
||||
// struct LLVMCtxt;
|
||||
|
||||
|
||||
#undef protected
|
||||
#undef private
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
DllExport int SWIGSTDCALL Ada_LLVMVerifyModule (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
int jarg2
|
||||
,
|
||||
|
||||
void * jarg3
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMModuleRef arg1 = (LLVMModuleRef) 0 ;
|
||||
LLVMVerifierFailureAction arg2 ;
|
||||
char **arg3 = (char **) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMModuleRef)jarg1;
|
||||
|
||||
arg2 = (LLVMVerifierFailureAction) jarg2;
|
||||
|
||||
arg3 = (char **)jarg3;
|
||||
|
||||
result = (int)LLVMVerifyModule(arg1,arg2,arg3);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMVerifyFunction (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
int jarg2
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMValueRef arg1 = (LLVMValueRef) 0 ;
|
||||
LLVMVerifierFailureAction arg2 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMValueRef)jarg1;
|
||||
|
||||
arg2 = (LLVMVerifierFailureAction) jarg2;
|
||||
|
||||
result = (int)LLVMVerifyFunction(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMViewFunctionCFG (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMValueRef arg1 = (LLVMValueRef) 0 ;
|
||||
|
||||
arg1 = (LLVMValueRef)jarg1;
|
||||
|
||||
LLVMViewFunctionCFG(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMViewFunctionCFGOnly (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMValueRef arg1 = (LLVMValueRef) 0 ;
|
||||
|
||||
arg1 = (LLVMValueRef)jarg1;
|
||||
|
||||
LLVMViewFunctionCFGOnly(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,52 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
with llvm;
|
||||
with Interfaces.C.Strings;
|
||||
|
||||
|
||||
package LLVM_bit_Reader.Binding is
|
||||
|
||||
function LLVMParseBitcode
|
||||
(MemBuf : in llvm.LLVMMemoryBufferRef;
|
||||
OutModule : access llvm.LLVMModuleRef;
|
||||
OutMessage : access Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.int;
|
||||
|
||||
function LLVMParseBitcodeInContext
|
||||
(MemBuf : in llvm.LLVMMemoryBufferRef;
|
||||
ContextRef : in llvm.LLVMContextRef;
|
||||
OutModule : access llvm.LLVMModuleRef;
|
||||
OutMessage : access Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.int;
|
||||
|
||||
function LLVMGetBitcodeModuleProvider
|
||||
(MemBuf : in llvm.LLVMMemoryBufferRef;
|
||||
OutMP : access llvm.LLVMModuleProviderRef;
|
||||
OutMessage : access Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.int;
|
||||
|
||||
function LLVMGetBitcodeModuleProviderInContext
|
||||
(MemBuf : in llvm.LLVMMemoryBufferRef;
|
||||
ContextRef : in llvm.LLVMContextRef;
|
||||
OutMP : access llvm.LLVMModuleProviderRef;
|
||||
OutMessage : access Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.int;
|
||||
|
||||
private
|
||||
|
||||
pragma Import (C, LLVMParseBitcode, "Ada_LLVMParseBitcode");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMParseBitcodeInContext,
|
||||
"Ada_LLVMParseBitcodeInContext");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMGetBitcodeModuleProvider,
|
||||
"Ada_LLVMGetBitcodeModuleProvider");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMGetBitcodeModuleProviderInContext,
|
||||
"Ada_LLVMGetBitcodeModuleProviderInContext");
|
||||
|
||||
end LLVM_bit_Reader.Binding;
|
@ -1,6 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
package LLVM_bit_Reader is
|
||||
|
||||
end LLVM_bit_Reader;
|
@ -1,423 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.36
|
||||
*
|
||||
* This file is not intended to be easily readable and contains a number of
|
||||
* coding conventions designed to improve portability and efficiency. Do not make
|
||||
* changes to this file unless you know what you are doing--modify the SWIG
|
||||
* interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
template<typename T> class SwigValueWrapper {
|
||||
T *tt;
|
||||
public:
|
||||
SwigValueWrapper() : tt(0) { }
|
||||
SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
|
||||
SwigValueWrapper(const T& t) : tt(new T(t)) { }
|
||||
~SwigValueWrapper() { delete tt; }
|
||||
SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
|
||||
operator T&() const { return *tt; }
|
||||
T *operator&() { return tt; }
|
||||
private:
|
||||
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
|
||||
};
|
||||
|
||||
template <typename T> T SwigValueInit() {
|
||||
return T();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* This section contains generic SWIG labels for method/variable
|
||||
* declarations/attributes, and other compiler dependent labels.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* template workaround for compilers that cannot correctly implement the C++ standard */
|
||||
#ifndef SWIGTEMPLATEDISAMBIGUATOR
|
||||
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# elif defined(__HP_aCC)
|
||||
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
|
||||
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# else
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* inline attribute */
|
||||
#ifndef SWIGINLINE
|
||||
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
|
||||
# define SWIGINLINE inline
|
||||
# else
|
||||
# define SWIGINLINE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* attribute recognised by some compilers to avoid 'unused' warnings */
|
||||
#ifndef SWIGUNUSED
|
||||
# if defined(__GNUC__)
|
||||
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
# elif defined(__ICC)
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGUNUSEDPARM
|
||||
# ifdef __cplusplus
|
||||
# define SWIGUNUSEDPARM(p)
|
||||
# else
|
||||
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* internal SWIG method */
|
||||
#ifndef SWIGINTERN
|
||||
# define SWIGINTERN static SWIGUNUSED
|
||||
#endif
|
||||
|
||||
/* internal inline SWIG method */
|
||||
#ifndef SWIGINTERNINLINE
|
||||
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
|
||||
#endif
|
||||
|
||||
/* exporting methods */
|
||||
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
# ifndef GCC_HASCLASSVISIBILITY
|
||||
# define GCC_HASCLASSVISIBILITY
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGEXPORT
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if defined(STATIC_LINKED)
|
||||
# define SWIGEXPORT
|
||||
# else
|
||||
# define SWIGEXPORT __declspec(dllexport)
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
||||
# define SWIGEXPORT __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define SWIGEXPORT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* calling conventions for Windows */
|
||||
#ifndef SWIGSTDCALL
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# define SWIGSTDCALL __stdcall
|
||||
# else
|
||||
# define SWIGSTDCALL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
||||
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
|
||||
# define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
|
||||
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
|
||||
# define _SCL_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
# define DllExport __declspec( dllexport )
|
||||
# define SWIGSTDCALL __stdcall
|
||||
#else
|
||||
# define DllExport
|
||||
# define SWIGSTDCALL
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <new>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Support for throwing Ada exceptions from C/C++ */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SWIG_AdaException,
|
||||
SWIG_AdaOutOfMemoryException,
|
||||
SWIG_AdaIndexOutOfRangeException,
|
||||
SWIG_AdaDivideByZeroException,
|
||||
SWIG_AdaArgumentOutOfRangeException,
|
||||
SWIG_AdaNullReferenceException
|
||||
} SWIG_AdaExceptionCodes;
|
||||
|
||||
|
||||
typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SWIG_AdaExceptionCodes code;
|
||||
SWIG_AdaExceptionCallback_t callback;
|
||||
}
|
||||
SWIG_AdaExceptions_t;
|
||||
|
||||
|
||||
static
|
||||
SWIG_AdaExceptions_t
|
||||
SWIG_ada_exceptions[] =
|
||||
{
|
||||
{ SWIG_AdaException, NULL },
|
||||
{ SWIG_AdaOutOfMemoryException, NULL },
|
||||
{ SWIG_AdaIndexOutOfRangeException, NULL },
|
||||
{ SWIG_AdaDivideByZeroException, NULL },
|
||||
{ SWIG_AdaArgumentOutOfRangeException, NULL },
|
||||
{ SWIG_AdaNullReferenceException, NULL }
|
||||
};
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg)
|
||||
{
|
||||
SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback;
|
||||
if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) {
|
||||
callback = SWIG_ada_exceptions[code].callback;
|
||||
}
|
||||
callback(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
|
||||
DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_bit_Reader (SWIG_AdaExceptionCallback_t systemException,
|
||||
SWIG_AdaExceptionCallback_t outOfMemory,
|
||||
SWIG_AdaExceptionCallback_t indexOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t divideByZero,
|
||||
SWIG_AdaExceptionCallback_t argumentOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t nullReference)
|
||||
{
|
||||
SWIG_ada_exceptions [SWIG_AdaException].callback = systemException;
|
||||
SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory;
|
||||
SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero;
|
||||
SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference;
|
||||
}
|
||||
|
||||
|
||||
/* Callback for returning strings to Ada without leaking memory */
|
||||
|
||||
typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *);
|
||||
static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL;
|
||||
|
||||
|
||||
|
||||
/* probably obsolete ...
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_bit_Reader(SWIG_AdaStringHelperCallback callback) {
|
||||
SWIG_ada_string_callback = callback;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Contract support */
|
||||
|
||||
#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else
|
||||
|
||||
|
||||
#define protected public
|
||||
#define private public
|
||||
|
||||
//#include "llvm-c/Analysis.h"
|
||||
#include "llvm-c/BitReader.h"
|
||||
//#include "llvm-c/BitWriter.h"
|
||||
//#include "llvm-c/Core.h"
|
||||
//#include "llvm-c/ExecutionEngine.h"
|
||||
//#include "llvm-c/LinkTimeOptimizer.h"
|
||||
//#include "llvm-c/lto.h"
|
||||
//#include "llvm-c/Target.h"
|
||||
|
||||
|
||||
|
||||
// struct LLVMCtxt;
|
||||
|
||||
|
||||
#undef protected
|
||||
#undef private
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
DllExport int SWIGSTDCALL Ada_LLVMParseBitcode (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
void * jarg3
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMMemoryBufferRef arg1 = (LLVMMemoryBufferRef) 0 ;
|
||||
LLVMModuleRef *arg2 = (LLVMModuleRef *) 0 ;
|
||||
char **arg3 = (char **) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMMemoryBufferRef)jarg1;
|
||||
|
||||
arg2 = (LLVMModuleRef *)jarg2;
|
||||
|
||||
arg3 = (char **)jarg3;
|
||||
|
||||
result = (int)LLVMParseBitcode(arg1,arg2,arg3);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMParseBitcodeInContext (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
void * jarg3
|
||||
,
|
||||
|
||||
void * jarg4
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMMemoryBufferRef arg1 = (LLVMMemoryBufferRef) 0 ;
|
||||
LLVMContextRef arg2 = (LLVMContextRef) 0 ;
|
||||
LLVMModuleRef *arg3 = (LLVMModuleRef *) 0 ;
|
||||
char **arg4 = (char **) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMMemoryBufferRef)jarg1;
|
||||
|
||||
arg2 = (LLVMContextRef)jarg2;
|
||||
|
||||
arg3 = (LLVMModuleRef *)jarg3;
|
||||
|
||||
arg4 = (char **)jarg4;
|
||||
|
||||
result = (int)LLVMParseBitcodeInContext(arg1,arg2,arg3,arg4);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMGetBitcodeModuleProvider (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
void * jarg3
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMMemoryBufferRef arg1 = (LLVMMemoryBufferRef) 0 ;
|
||||
LLVMModuleProviderRef *arg2 = (LLVMModuleProviderRef *) 0 ;
|
||||
char **arg3 = (char **) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMMemoryBufferRef)jarg1;
|
||||
|
||||
arg2 = (LLVMModuleProviderRef *)jarg2;
|
||||
|
||||
arg3 = (char **)jarg3;
|
||||
|
||||
result = (int)LLVMGetBitcodeModuleProvider(arg1,arg2,arg3);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMGetBitcodeModuleProviderInContext (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
void * jarg3
|
||||
,
|
||||
|
||||
void * jarg4
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMMemoryBufferRef arg1 = (LLVMMemoryBufferRef) 0 ;
|
||||
LLVMContextRef arg2 = (LLVMContextRef) 0 ;
|
||||
LLVMModuleProviderRef *arg3 = (LLVMModuleProviderRef *) 0 ;
|
||||
char **arg4 = (char **) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMMemoryBufferRef)jarg1;
|
||||
|
||||
arg2 = (LLVMContextRef)jarg2;
|
||||
|
||||
arg3 = (LLVMModuleProviderRef *)jarg3;
|
||||
|
||||
arg4 = (char **)jarg4;
|
||||
|
||||
result = (int)LLVMGetBitcodeModuleProviderInContext(arg1,arg2,arg3,arg4);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,28 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
with llvm;
|
||||
with Interfaces.C.Strings;
|
||||
|
||||
|
||||
package LLVM_bit_Writer.Binding is
|
||||
|
||||
function LLVMWriteBitcodeToFileHandle
|
||||
(M : in llvm.LLVMModuleRef;
|
||||
Handle : in Interfaces.C.int)
|
||||
return Interfaces.C.int;
|
||||
|
||||
function LLVMWriteBitcodeToFile
|
||||
(M : in llvm.LLVMModuleRef;
|
||||
Path : in Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.int;
|
||||
|
||||
private
|
||||
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMWriteBitcodeToFileHandle,
|
||||
"Ada_LLVMWriteBitcodeToFileHandle");
|
||||
pragma Import (C, LLVMWriteBitcodeToFile, "Ada_LLVMWriteBitcodeToFile");
|
||||
|
||||
end LLVM_bit_Writer.Binding;
|
@ -1,6 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
package LLVM_bit_Writer is
|
||||
|
||||
end LLVM_bit_Writer;
|
@ -1,335 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.36
|
||||
*
|
||||
* This file is not intended to be easily readable and contains a number of
|
||||
* coding conventions designed to improve portability and efficiency. Do not make
|
||||
* changes to this file unless you know what you are doing--modify the SWIG
|
||||
* interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
template<typename T> class SwigValueWrapper {
|
||||
T *tt;
|
||||
public:
|
||||
SwigValueWrapper() : tt(0) { }
|
||||
SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
|
||||
SwigValueWrapper(const T& t) : tt(new T(t)) { }
|
||||
~SwigValueWrapper() { delete tt; }
|
||||
SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
|
||||
operator T&() const { return *tt; }
|
||||
T *operator&() { return tt; }
|
||||
private:
|
||||
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
|
||||
};
|
||||
|
||||
template <typename T> T SwigValueInit() {
|
||||
return T();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* This section contains generic SWIG labels for method/variable
|
||||
* declarations/attributes, and other compiler dependent labels.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* template workaround for compilers that cannot correctly implement the C++ standard */
|
||||
#ifndef SWIGTEMPLATEDISAMBIGUATOR
|
||||
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# elif defined(__HP_aCC)
|
||||
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
|
||||
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# else
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* inline attribute */
|
||||
#ifndef SWIGINLINE
|
||||
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
|
||||
# define SWIGINLINE inline
|
||||
# else
|
||||
# define SWIGINLINE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* attribute recognised by some compilers to avoid 'unused' warnings */
|
||||
#ifndef SWIGUNUSED
|
||||
# if defined(__GNUC__)
|
||||
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
# elif defined(__ICC)
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGUNUSEDPARM
|
||||
# ifdef __cplusplus
|
||||
# define SWIGUNUSEDPARM(p)
|
||||
# else
|
||||
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* internal SWIG method */
|
||||
#ifndef SWIGINTERN
|
||||
# define SWIGINTERN static SWIGUNUSED
|
||||
#endif
|
||||
|
||||
/* internal inline SWIG method */
|
||||
#ifndef SWIGINTERNINLINE
|
||||
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
|
||||
#endif
|
||||
|
||||
/* exporting methods */
|
||||
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
# ifndef GCC_HASCLASSVISIBILITY
|
||||
# define GCC_HASCLASSVISIBILITY
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGEXPORT
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if defined(STATIC_LINKED)
|
||||
# define SWIGEXPORT
|
||||
# else
|
||||
# define SWIGEXPORT __declspec(dllexport)
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
||||
# define SWIGEXPORT __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define SWIGEXPORT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* calling conventions for Windows */
|
||||
#ifndef SWIGSTDCALL
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# define SWIGSTDCALL __stdcall
|
||||
# else
|
||||
# define SWIGSTDCALL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
||||
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
|
||||
# define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
|
||||
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
|
||||
# define _SCL_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
# define DllExport __declspec( dllexport )
|
||||
# define SWIGSTDCALL __stdcall
|
||||
#else
|
||||
# define DllExport
|
||||
# define SWIGSTDCALL
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <new>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Support for throwing Ada exceptions from C/C++ */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SWIG_AdaException,
|
||||
SWIG_AdaOutOfMemoryException,
|
||||
SWIG_AdaIndexOutOfRangeException,
|
||||
SWIG_AdaDivideByZeroException,
|
||||
SWIG_AdaArgumentOutOfRangeException,
|
||||
SWIG_AdaNullReferenceException
|
||||
} SWIG_AdaExceptionCodes;
|
||||
|
||||
|
||||
typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SWIG_AdaExceptionCodes code;
|
||||
SWIG_AdaExceptionCallback_t callback;
|
||||
}
|
||||
SWIG_AdaExceptions_t;
|
||||
|
||||
|
||||
static
|
||||
SWIG_AdaExceptions_t
|
||||
SWIG_ada_exceptions[] =
|
||||
{
|
||||
{ SWIG_AdaException, NULL },
|
||||
{ SWIG_AdaOutOfMemoryException, NULL },
|
||||
{ SWIG_AdaIndexOutOfRangeException, NULL },
|
||||
{ SWIG_AdaDivideByZeroException, NULL },
|
||||
{ SWIG_AdaArgumentOutOfRangeException, NULL },
|
||||
{ SWIG_AdaNullReferenceException, NULL }
|
||||
};
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg)
|
||||
{
|
||||
SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback;
|
||||
if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) {
|
||||
callback = SWIG_ada_exceptions[code].callback;
|
||||
}
|
||||
callback(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
|
||||
DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_bit_Writer (SWIG_AdaExceptionCallback_t systemException,
|
||||
SWIG_AdaExceptionCallback_t outOfMemory,
|
||||
SWIG_AdaExceptionCallback_t indexOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t divideByZero,
|
||||
SWIG_AdaExceptionCallback_t argumentOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t nullReference)
|
||||
{
|
||||
SWIG_ada_exceptions [SWIG_AdaException].callback = systemException;
|
||||
SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory;
|
||||
SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero;
|
||||
SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference;
|
||||
}
|
||||
|
||||
|
||||
/* Callback for returning strings to Ada without leaking memory */
|
||||
|
||||
typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *);
|
||||
static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL;
|
||||
|
||||
|
||||
|
||||
/* probably obsolete ...
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_bit_Writer(SWIG_AdaStringHelperCallback callback) {
|
||||
SWIG_ada_string_callback = callback;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Contract support */
|
||||
|
||||
#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else
|
||||
|
||||
|
||||
#define protected public
|
||||
#define private public
|
||||
|
||||
#include "llvm-c/Analysis.h"
|
||||
#include "llvm-c/BitReader.h"
|
||||
#include "llvm-c/BitWriter.h"
|
||||
#include "llvm-c/Core.h"
|
||||
#include "llvm-c/ExecutionEngine.h"
|
||||
#include "llvm-c/LinkTimeOptimizer.h"
|
||||
#include "llvm-c/lto.h"
|
||||
#include "llvm-c/Target.h"
|
||||
|
||||
|
||||
|
||||
// struct LLVMCtxt;
|
||||
|
||||
|
||||
#undef protected
|
||||
#undef private
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
DllExport int SWIGSTDCALL Ada_LLVMWriteBitcodeToFileHandle (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
int jarg2
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMModuleRef arg1 = (LLVMModuleRef) 0 ;
|
||||
int arg2 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMModuleRef)jarg1;
|
||||
|
||||
|
||||
arg2 = (int) jarg2;
|
||||
|
||||
|
||||
result = (int)LLVMWriteBitcodeToFileHandle(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMWriteBitcodeToFile (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
char * jarg2
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMModuleRef arg1 = (LLVMModuleRef) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMModuleRef)jarg1;
|
||||
|
||||
arg2 = jarg2;
|
||||
|
||||
result = (int)LLVMWriteBitcodeToFile(arg1,(char const *)arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,192 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
with llvm;
|
||||
with Interfaces.C.Strings;
|
||||
|
||||
|
||||
package LLVM_execution_Engine.Binding is
|
||||
|
||||
procedure LLVMLinkInJIT;
|
||||
|
||||
procedure LLVMLinkInInterpreter;
|
||||
|
||||
function LLVMCreateGenericValueOfInt
|
||||
(Ty : in llvm.LLVMTypeRef;
|
||||
N : in Interfaces.C.Extensions.unsigned_long_long;
|
||||
IsSigned : in Interfaces.C.int)
|
||||
return LLVM_execution_Engine.LLVMGenericValueRef;
|
||||
|
||||
function LLVMCreateGenericValueOfPointer
|
||||
(P : access Interfaces.C.Extensions.void)
|
||||
return LLVM_execution_Engine.LLVMGenericValueRef;
|
||||
|
||||
function LLVMCreateGenericValueOfFloat
|
||||
(Ty : in llvm.LLVMTypeRef;
|
||||
N : in Interfaces.C.double)
|
||||
return LLVM_execution_Engine.LLVMGenericValueRef;
|
||||
|
||||
function LLVMGenericValueIntWidth
|
||||
(GenValRef : in LLVM_execution_Engine.LLVMGenericValueRef)
|
||||
return Interfaces.C.unsigned;
|
||||
|
||||
function LLVMGenericValueToInt
|
||||
(GenVal : in LLVM_execution_Engine.LLVMGenericValueRef;
|
||||
IsSigned : in Interfaces.C.int)
|
||||
return Interfaces.C.Extensions.unsigned_long_long;
|
||||
|
||||
function LLVMGenericValueToPointer
|
||||
(GenVal : in LLVM_execution_Engine.LLVMGenericValueRef)
|
||||
return access Interfaces.C.Extensions.void;
|
||||
|
||||
function LLVMGenericValueToFloat
|
||||
(TyRef : in llvm.LLVMTypeRef;
|
||||
GenVal : in LLVM_execution_Engine.LLVMGenericValueRef)
|
||||
return Interfaces.C.double;
|
||||
|
||||
procedure LLVMDisposeGenericValue
|
||||
(GenVal : in LLVM_execution_Engine.LLVMGenericValueRef);
|
||||
|
||||
function LLVMCreateExecutionEngine
|
||||
(OutEE : access LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
MP : in llvm.LLVMModuleProviderRef;
|
||||
OutError : access Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.int;
|
||||
|
||||
function LLVMCreateInterpreter
|
||||
(OutInterp : access LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
MP : in llvm.LLVMModuleProviderRef;
|
||||
OutError : access Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.int;
|
||||
|
||||
function LLVMCreateJITCompiler
|
||||
(OutJIT : access LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
MP : in llvm.LLVMModuleProviderRef;
|
||||
OptLevel : in Interfaces.C.unsigned;
|
||||
OutError : access Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.int;
|
||||
|
||||
procedure LLVMDisposeExecutionEngine
|
||||
(EE : in LLVM_execution_Engine.LLVMExecutionEngineRef);
|
||||
|
||||
procedure LLVMRunStaticConstructors
|
||||
(EE : in LLVM_execution_Engine.LLVMExecutionEngineRef);
|
||||
|
||||
procedure LLVMRunStaticDestructors
|
||||
(EE : in LLVM_execution_Engine.LLVMExecutionEngineRef);
|
||||
|
||||
function LLVMRunFunctionAsMain
|
||||
(EE : in LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
F : in llvm.LLVMValueRef;
|
||||
ArgC : in Interfaces.C.unsigned;
|
||||
ArgV : access Interfaces.C.Strings.chars_ptr;
|
||||
EnvP : access Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.int;
|
||||
|
||||
function LLVMRunFunction
|
||||
(EE : in LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
F : in llvm.LLVMValueRef;
|
||||
NumArgs : in Interfaces.C.unsigned;
|
||||
Args : access LLVM_execution_Engine.LLVMGenericValueRef)
|
||||
return LLVM_execution_Engine.LLVMGenericValueRef;
|
||||
|
||||
procedure LLVMFreeMachineCodeForFunction
|
||||
(EE : in LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
F : in llvm.LLVMValueRef);
|
||||
|
||||
procedure LLVMAddModuleProvider
|
||||
(EE : in LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
MP : in llvm.LLVMModuleProviderRef);
|
||||
|
||||
function LLVMRemoveModuleProvider
|
||||
(EE : in LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
MP : in llvm.LLVMModuleProviderRef;
|
||||
OutMod : access llvm.LLVMModuleRef;
|
||||
OutError : access Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.int;
|
||||
|
||||
function LLVMFindFunction
|
||||
(EE : in LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
Name : in Interfaces.C.Strings.chars_ptr;
|
||||
OutFn : access llvm.LLVMValueRef)
|
||||
return Interfaces.C.int;
|
||||
|
||||
function LLVMGetExecutionEngineTargetData
|
||||
(EE : in LLVM_execution_Engine.LLVMExecutionEngineRef)
|
||||
return LLVM_execution_Engine.LLVMTargetDataRef;
|
||||
|
||||
procedure LLVMAddGlobalMapping
|
||||
(EE : in LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
Global : in llvm.LLVMValueRef;
|
||||
Addr : access Interfaces.C.Extensions.void);
|
||||
|
||||
function LLVMGetPointerToGlobal
|
||||
(EE : in LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
Global : in llvm.LLVMValueRef)
|
||||
return access Interfaces.C.Extensions.void;
|
||||
|
||||
private
|
||||
|
||||
pragma Import (C, LLVMLinkInJIT, "Ada_LLVMLinkInJIT");
|
||||
pragma Import (C, LLVMLinkInInterpreter, "Ada_LLVMLinkInInterpreter");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMCreateGenericValueOfInt,
|
||||
"Ada_LLVMCreateGenericValueOfInt");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMCreateGenericValueOfPointer,
|
||||
"Ada_LLVMCreateGenericValueOfPointer");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMCreateGenericValueOfFloat,
|
||||
"Ada_LLVMCreateGenericValueOfFloat");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMGenericValueIntWidth,
|
||||
"Ada_LLVMGenericValueIntWidth");
|
||||
pragma Import (C, LLVMGenericValueToInt, "Ada_LLVMGenericValueToInt");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMGenericValueToPointer,
|
||||
"Ada_LLVMGenericValueToPointer");
|
||||
pragma Import (C, LLVMGenericValueToFloat, "Ada_LLVMGenericValueToFloat");
|
||||
pragma Import (C, LLVMDisposeGenericValue, "Ada_LLVMDisposeGenericValue");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMCreateExecutionEngine,
|
||||
"Ada_LLVMCreateExecutionEngine");
|
||||
pragma Import (C, LLVMCreateInterpreter, "Ada_LLVMCreateInterpreter");
|
||||
pragma Import (C, LLVMCreateJITCompiler, "Ada_LLVMCreateJITCompiler");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMDisposeExecutionEngine,
|
||||
"Ada_LLVMDisposeExecutionEngine");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMRunStaticConstructors,
|
||||
"Ada_LLVMRunStaticConstructors");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMRunStaticDestructors,
|
||||
"Ada_LLVMRunStaticDestructors");
|
||||
pragma Import (C, LLVMRunFunctionAsMain, "Ada_LLVMRunFunctionAsMain");
|
||||
pragma Import (C, LLVMRunFunction, "Ada_LLVMRunFunction");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMFreeMachineCodeForFunction,
|
||||
"Ada_LLVMFreeMachineCodeForFunction");
|
||||
pragma Import (C, LLVMAddModuleProvider, "Ada_LLVMAddModuleProvider");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMRemoveModuleProvider,
|
||||
"Ada_LLVMRemoveModuleProvider");
|
||||
pragma Import (C, LLVMFindFunction, "Ada_LLVMFindFunction");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMGetExecutionEngineTargetData,
|
||||
"Ada_LLVMGetExecutionEngineTargetData");
|
||||
pragma Import (C, LLVMAddGlobalMapping, "Ada_LLVMAddGlobalMapping");
|
||||
pragma Import (C, LLVMGetPointerToGlobal, "Ada_LLVMGetPointerToGlobal");
|
||||
|
||||
end LLVM_execution_Engine.Binding;
|
@ -1,90 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
with Interfaces.C.Extensions;
|
||||
|
||||
|
||||
package LLVM_execution_Engine is
|
||||
|
||||
-- LLVMOpaqueGenericValue
|
||||
--
|
||||
type LLVMOpaqueGenericValue is new
|
||||
Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMOpaqueGenericValue_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_execution_Engine.LLVMOpaqueGenericValue;
|
||||
|
||||
type LLVMOpaqueGenericValue_view is access all
|
||||
LLVM_execution_Engine.LLVMOpaqueGenericValue;
|
||||
|
||||
-- LLVMGenericValueRef
|
||||
--
|
||||
type LLVMGenericValueRef is access all
|
||||
LLVM_execution_Engine.LLVMOpaqueGenericValue;
|
||||
|
||||
type LLVMGenericValueRef_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_execution_Engine.LLVMGenericValueRef;
|
||||
|
||||
type LLVMGenericValueRef_view is access all
|
||||
LLVM_execution_Engine.LLVMGenericValueRef;
|
||||
|
||||
-- LLVMOpaqueExecutionEngine
|
||||
--
|
||||
type LLVMOpaqueExecutionEngine is new
|
||||
Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMOpaqueExecutionEngine_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_execution_Engine.LLVMOpaqueExecutionEngine;
|
||||
|
||||
type LLVMOpaqueExecutionEngine_view is access all
|
||||
LLVM_execution_Engine.LLVMOpaqueExecutionEngine;
|
||||
|
||||
-- LLVMExecutionEngineRef
|
||||
--
|
||||
type LLVMExecutionEngineRef is access all
|
||||
LLVM_execution_Engine.LLVMOpaqueExecutionEngine;
|
||||
|
||||
type LLVMExecutionEngineRef_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
|
||||
type LLVMExecutionEngineRef_view is access all
|
||||
LLVM_execution_Engine.LLVMExecutionEngineRef;
|
||||
|
||||
-- LLVMTargetDataRef
|
||||
--
|
||||
type LLVMTargetDataRef is new Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMTargetDataRef_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_execution_Engine.LLVMTargetDataRef;
|
||||
|
||||
type LLVMTargetDataRef_view is access all
|
||||
LLVM_execution_Engine.LLVMTargetDataRef;
|
||||
|
||||
-- GenericValue
|
||||
--
|
||||
type GenericValue is new Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type GenericValue_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_execution_Engine.GenericValue;
|
||||
|
||||
type GenericValue_view is access all LLVM_execution_Engine.GenericValue;
|
||||
|
||||
-- ExecutionEngine
|
||||
--
|
||||
type ExecutionEngine is new Interfaces.C.Extensions.incomplete_class_def;
|
||||
|
||||
type ExecutionEngine_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_execution_Engine.ExecutionEngine;
|
||||
|
||||
type ExecutionEngine_view is access all
|
||||
LLVM_execution_Engine.ExecutionEngine;
|
||||
|
||||
|
||||
end LLVM_execution_Engine;
|
@ -1,924 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.36
|
||||
*
|
||||
* This file is not intended to be easily readable and contains a number of
|
||||
* coding conventions designed to improve portability and efficiency. Do not make
|
||||
* changes to this file unless you know what you are doing--modify the SWIG
|
||||
* interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
template<typename T> class SwigValueWrapper {
|
||||
T *tt;
|
||||
public:
|
||||
SwigValueWrapper() : tt(0) { }
|
||||
SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
|
||||
SwigValueWrapper(const T& t) : tt(new T(t)) { }
|
||||
~SwigValueWrapper() { delete tt; }
|
||||
SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
|
||||
operator T&() const { return *tt; }
|
||||
T *operator&() { return tt; }
|
||||
private:
|
||||
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
|
||||
};
|
||||
|
||||
template <typename T> T SwigValueInit() {
|
||||
return T();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* This section contains generic SWIG labels for method/variable
|
||||
* declarations/attributes, and other compiler dependent labels.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* template workaround for compilers that cannot correctly implement the C++ standard */
|
||||
#ifndef SWIGTEMPLATEDISAMBIGUATOR
|
||||
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# elif defined(__HP_aCC)
|
||||
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
|
||||
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# else
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* inline attribute */
|
||||
#ifndef SWIGINLINE
|
||||
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
|
||||
# define SWIGINLINE inline
|
||||
# else
|
||||
# define SWIGINLINE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* attribute recognised by some compilers to avoid 'unused' warnings */
|
||||
#ifndef SWIGUNUSED
|
||||
# if defined(__GNUC__)
|
||||
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
# elif defined(__ICC)
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGUNUSEDPARM
|
||||
# ifdef __cplusplus
|
||||
# define SWIGUNUSEDPARM(p)
|
||||
# else
|
||||
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* internal SWIG method */
|
||||
#ifndef SWIGINTERN
|
||||
# define SWIGINTERN static SWIGUNUSED
|
||||
#endif
|
||||
|
||||
/* internal inline SWIG method */
|
||||
#ifndef SWIGINTERNINLINE
|
||||
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
|
||||
#endif
|
||||
|
||||
/* exporting methods */
|
||||
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
# ifndef GCC_HASCLASSVISIBILITY
|
||||
# define GCC_HASCLASSVISIBILITY
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGEXPORT
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if defined(STATIC_LINKED)
|
||||
# define SWIGEXPORT
|
||||
# else
|
||||
# define SWIGEXPORT __declspec(dllexport)
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
||||
# define SWIGEXPORT __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define SWIGEXPORT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* calling conventions for Windows */
|
||||
#ifndef SWIGSTDCALL
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# define SWIGSTDCALL __stdcall
|
||||
# else
|
||||
# define SWIGSTDCALL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
||||
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
|
||||
# define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
|
||||
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
|
||||
# define _SCL_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
# define DllExport __declspec( dllexport )
|
||||
# define SWIGSTDCALL __stdcall
|
||||
#else
|
||||
# define DllExport
|
||||
# define SWIGSTDCALL
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <new>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Support for throwing Ada exceptions from C/C++ */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SWIG_AdaException,
|
||||
SWIG_AdaOutOfMemoryException,
|
||||
SWIG_AdaIndexOutOfRangeException,
|
||||
SWIG_AdaDivideByZeroException,
|
||||
SWIG_AdaArgumentOutOfRangeException,
|
||||
SWIG_AdaNullReferenceException
|
||||
} SWIG_AdaExceptionCodes;
|
||||
|
||||
|
||||
typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SWIG_AdaExceptionCodes code;
|
||||
SWIG_AdaExceptionCallback_t callback;
|
||||
}
|
||||
SWIG_AdaExceptions_t;
|
||||
|
||||
|
||||
static
|
||||
SWIG_AdaExceptions_t
|
||||
SWIG_ada_exceptions[] =
|
||||
{
|
||||
{ SWIG_AdaException, NULL },
|
||||
{ SWIG_AdaOutOfMemoryException, NULL },
|
||||
{ SWIG_AdaIndexOutOfRangeException, NULL },
|
||||
{ SWIG_AdaDivideByZeroException, NULL },
|
||||
{ SWIG_AdaArgumentOutOfRangeException, NULL },
|
||||
{ SWIG_AdaNullReferenceException, NULL }
|
||||
};
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg)
|
||||
{
|
||||
SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback;
|
||||
if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) {
|
||||
callback = SWIG_ada_exceptions[code].callback;
|
||||
}
|
||||
callback(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
|
||||
DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_execution_Engine (SWIG_AdaExceptionCallback_t systemException,
|
||||
SWIG_AdaExceptionCallback_t outOfMemory,
|
||||
SWIG_AdaExceptionCallback_t indexOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t divideByZero,
|
||||
SWIG_AdaExceptionCallback_t argumentOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t nullReference)
|
||||
{
|
||||
SWIG_ada_exceptions [SWIG_AdaException].callback = systemException;
|
||||
SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory;
|
||||
SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero;
|
||||
SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference;
|
||||
}
|
||||
|
||||
|
||||
/* Callback for returning strings to Ada without leaking memory */
|
||||
|
||||
typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *);
|
||||
static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL;
|
||||
|
||||
|
||||
|
||||
/* probably obsolete ...
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_execution_Engine(SWIG_AdaStringHelperCallback callback) {
|
||||
SWIG_ada_string_callback = callback;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Contract support */
|
||||
|
||||
#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else
|
||||
|
||||
|
||||
#define protected public
|
||||
#define private public
|
||||
|
||||
#include "llvm-c/ExecutionEngine.h"
|
||||
|
||||
|
||||
|
||||
// struct LLVMCtxt;
|
||||
|
||||
|
||||
#undef protected
|
||||
#undef private
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
DllExport void SWIGSTDCALL Ada_LLVMLinkInJIT (
|
||||
)
|
||||
{
|
||||
LLVMLinkInJIT();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMLinkInInterpreter (
|
||||
)
|
||||
{
|
||||
LLVMLinkInInterpreter();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void * SWIGSTDCALL Ada_LLVMCreateGenericValueOfInt (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
unsigned long long jarg2
|
||||
,
|
||||
|
||||
int jarg3
|
||||
)
|
||||
{
|
||||
void * jresult ;
|
||||
LLVMTypeRef arg1 = (LLVMTypeRef) 0 ;
|
||||
unsigned long long arg2 ;
|
||||
int arg3 ;
|
||||
LLVMGenericValueRef result;
|
||||
|
||||
arg1 = (LLVMTypeRef)jarg1;
|
||||
|
||||
|
||||
arg2 = (unsigned long long) jarg2;
|
||||
|
||||
|
||||
|
||||
arg3 = (int) jarg3;
|
||||
|
||||
|
||||
result = (LLVMGenericValueRef)LLVMCreateGenericValueOfInt(arg1,arg2,arg3);
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void * SWIGSTDCALL Ada_LLVMCreateGenericValueOfPointer (
|
||||
void* jarg1
|
||||
)
|
||||
{
|
||||
void * jresult ;
|
||||
void *arg1 = (void *) 0 ;
|
||||
LLVMGenericValueRef result;
|
||||
|
||||
arg1 = (void *)jarg1;
|
||||
|
||||
result = (LLVMGenericValueRef)LLVMCreateGenericValueOfPointer(arg1);
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void * SWIGSTDCALL Ada_LLVMCreateGenericValueOfFloat (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
double jarg2
|
||||
)
|
||||
{
|
||||
void * jresult ;
|
||||
LLVMTypeRef arg1 = (LLVMTypeRef) 0 ;
|
||||
double arg2 ;
|
||||
LLVMGenericValueRef result;
|
||||
|
||||
arg1 = (LLVMTypeRef)jarg1;
|
||||
|
||||
|
||||
arg2 = (double) jarg2;
|
||||
|
||||
|
||||
result = (LLVMGenericValueRef)LLVMCreateGenericValueOfFloat(arg1,arg2);
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_LLVMGenericValueIntWidth (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
LLVMGenericValueRef arg1 = (LLVMGenericValueRef) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
arg1 = (LLVMGenericValueRef)jarg1;
|
||||
|
||||
result = (unsigned int)LLVMGenericValueIntWidth(arg1);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned long long SWIGSTDCALL Ada_LLVMGenericValueToInt (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
int jarg2
|
||||
)
|
||||
{
|
||||
unsigned long long jresult ;
|
||||
LLVMGenericValueRef arg1 = (LLVMGenericValueRef) 0 ;
|
||||
int arg2 ;
|
||||
unsigned long long result;
|
||||
|
||||
arg1 = (LLVMGenericValueRef)jarg1;
|
||||
|
||||
|
||||
arg2 = (int) jarg2;
|
||||
|
||||
|
||||
result = (unsigned long long)LLVMGenericValueToInt(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void* SWIGSTDCALL Ada_LLVMGenericValueToPointer (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
void* jresult ;
|
||||
LLVMGenericValueRef arg1 = (LLVMGenericValueRef) 0 ;
|
||||
void *result = 0 ;
|
||||
|
||||
arg1 = (LLVMGenericValueRef)jarg1;
|
||||
|
||||
result = (void *)LLVMGenericValueToPointer(arg1);
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport double SWIGSTDCALL Ada_LLVMGenericValueToFloat (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
double jresult ;
|
||||
LLVMTypeRef arg1 = (LLVMTypeRef) 0 ;
|
||||
LLVMGenericValueRef arg2 = (LLVMGenericValueRef) 0 ;
|
||||
double result;
|
||||
|
||||
arg1 = (LLVMTypeRef)jarg1;
|
||||
|
||||
arg2 = (LLVMGenericValueRef)jarg2;
|
||||
|
||||
result = (double)LLVMGenericValueToFloat(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMDisposeGenericValue (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMGenericValueRef arg1 = (LLVMGenericValueRef) 0 ;
|
||||
|
||||
arg1 = (LLVMGenericValueRef)jarg1;
|
||||
|
||||
LLVMDisposeGenericValue(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMCreateExecutionEngine (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
void * jarg3
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMExecutionEngineRef *arg1 = (LLVMExecutionEngineRef *) 0 ;
|
||||
LLVMModuleProviderRef arg2 = (LLVMModuleProviderRef) 0 ;
|
||||
char **arg3 = (char **) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef *)jarg1;
|
||||
|
||||
arg2 = (LLVMModuleProviderRef)jarg2;
|
||||
|
||||
arg3 = (char **)jarg3;
|
||||
|
||||
result = (int)LLVMCreateExecutionEngine(arg1,arg2,arg3);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMCreateInterpreter (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
void * jarg3
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMExecutionEngineRef *arg1 = (LLVMExecutionEngineRef *) 0 ;
|
||||
LLVMModuleProviderRef arg2 = (LLVMModuleProviderRef) 0 ;
|
||||
char **arg3 = (char **) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef *)jarg1;
|
||||
|
||||
arg2 = (LLVMModuleProviderRef)jarg2;
|
||||
|
||||
arg3 = (char **)jarg3;
|
||||
|
||||
result = (int)LLVMCreateInterpreter(arg1,arg2,arg3);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMCreateJITCompiler (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
unsigned int jarg3
|
||||
,
|
||||
|
||||
void * jarg4
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMExecutionEngineRef *arg1 = (LLVMExecutionEngineRef *) 0 ;
|
||||
LLVMModuleProviderRef arg2 = (LLVMModuleProviderRef) 0 ;
|
||||
unsigned int arg3 ;
|
||||
char **arg4 = (char **) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef *)jarg1;
|
||||
|
||||
arg2 = (LLVMModuleProviderRef)jarg2;
|
||||
|
||||
|
||||
arg3 = (unsigned int) jarg3;
|
||||
|
||||
|
||||
arg4 = (char **)jarg4;
|
||||
|
||||
result = (int)LLVMCreateJITCompiler(arg1,arg2,arg3,arg4);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMDisposeExecutionEngine (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef)jarg1;
|
||||
|
||||
LLVMDisposeExecutionEngine(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMRunStaticConstructors (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef)jarg1;
|
||||
|
||||
LLVMRunStaticConstructors(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMRunStaticDestructors (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef)jarg1;
|
||||
|
||||
LLVMRunStaticDestructors(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMRunFunctionAsMain (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
unsigned int jarg3
|
||||
,
|
||||
|
||||
void * jarg4
|
||||
,
|
||||
|
||||
void * jarg5
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
|
||||
LLVMValueRef arg2 = (LLVMValueRef) 0 ;
|
||||
unsigned int arg3 ;
|
||||
char **arg4 = (char **) 0 ;
|
||||
char **arg5 = (char **) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef)jarg1;
|
||||
|
||||
arg2 = (LLVMValueRef)jarg2;
|
||||
|
||||
|
||||
arg3 = (unsigned int) jarg3;
|
||||
|
||||
|
||||
arg4 = (char **)jarg4;
|
||||
|
||||
arg5 = (char **)jarg5;
|
||||
|
||||
result = (int)LLVMRunFunctionAsMain(arg1,arg2,arg3,(char const *const *)arg4,(char const *const *)arg5);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void * SWIGSTDCALL Ada_LLVMRunFunction (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
unsigned int jarg3
|
||||
,
|
||||
|
||||
void * jarg4
|
||||
)
|
||||
{
|
||||
void * jresult ;
|
||||
LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
|
||||
LLVMValueRef arg2 = (LLVMValueRef) 0 ;
|
||||
unsigned int arg3 ;
|
||||
LLVMGenericValueRef *arg4 = (LLVMGenericValueRef *) 0 ;
|
||||
LLVMGenericValueRef result;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef)jarg1;
|
||||
|
||||
arg2 = (LLVMValueRef)jarg2;
|
||||
|
||||
|
||||
arg3 = (unsigned int) jarg3;
|
||||
|
||||
|
||||
arg4 = (LLVMGenericValueRef *)jarg4;
|
||||
|
||||
result = (LLVMGenericValueRef)LLVMRunFunction(arg1,arg2,arg3,arg4);
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMFreeMachineCodeForFunction (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
|
||||
LLVMValueRef arg2 = (LLVMValueRef) 0 ;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef)jarg1;
|
||||
|
||||
arg2 = (LLVMValueRef)jarg2;
|
||||
|
||||
LLVMFreeMachineCodeForFunction(arg1,arg2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddModuleProvider (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
|
||||
LLVMModuleProviderRef arg2 = (LLVMModuleProviderRef) 0 ;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef)jarg1;
|
||||
|
||||
arg2 = (LLVMModuleProviderRef)jarg2;
|
||||
|
||||
LLVMAddModuleProvider(arg1,arg2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMRemoveModuleProvider (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
void * jarg3
|
||||
,
|
||||
|
||||
void * jarg4
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
|
||||
LLVMModuleProviderRef arg2 = (LLVMModuleProviderRef) 0 ;
|
||||
LLVMModuleRef *arg3 = (LLVMModuleRef *) 0 ;
|
||||
char **arg4 = (char **) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef)jarg1;
|
||||
|
||||
arg2 = (LLVMModuleProviderRef)jarg2;
|
||||
|
||||
arg3 = (LLVMModuleRef *)jarg3;
|
||||
|
||||
arg4 = (char **)jarg4;
|
||||
|
||||
result = (int)LLVMRemoveModuleProvider(arg1,arg2,arg3,arg4);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMFindFunction (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
char * jarg2
|
||||
,
|
||||
|
||||
void * jarg3
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
LLVMValueRef *arg3 = (LLVMValueRef *) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef)jarg1;
|
||||
|
||||
arg2 = jarg2;
|
||||
|
||||
arg3 = (LLVMValueRef *)jarg3;
|
||||
|
||||
result = (int)LLVMFindFunction(arg1,(char const *)arg2,arg3);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport LLVMTargetDataRef SWIGSTDCALL Ada_LLVMGetExecutionEngineTargetData (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMTargetDataRef jresult ;
|
||||
LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
|
||||
LLVMTargetDataRef result;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef)jarg1;
|
||||
|
||||
result = LLVMGetExecutionEngineTargetData(arg1);
|
||||
|
||||
jresult = result;
|
||||
//jresult = new LLVMTargetDataRef ((LLVMTargetDataRef &) result);
|
||||
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddGlobalMapping (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
void* jarg3
|
||||
)
|
||||
{
|
||||
LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
|
||||
LLVMValueRef arg2 = (LLVMValueRef) 0 ;
|
||||
void *arg3 = (void *) 0 ;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef)jarg1;
|
||||
|
||||
arg2 = (LLVMValueRef)jarg2;
|
||||
|
||||
arg3 = (void *)jarg3;
|
||||
|
||||
LLVMAddGlobalMapping(arg1,arg2,arg3);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void* SWIGSTDCALL Ada_LLVMGetPointerToGlobal (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
void* jresult ;
|
||||
LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
|
||||
LLVMValueRef arg2 = (LLVMValueRef) 0 ;
|
||||
void *result = 0 ;
|
||||
|
||||
arg1 = (LLVMExecutionEngineRef)jarg1;
|
||||
|
||||
arg2 = (LLVMValueRef)jarg2;
|
||||
|
||||
result = (void *)LLVMGetPointerToGlobal(arg1,arg2);
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,34 +0,0 @@
|
||||
project LLVM is
|
||||
|
||||
for Languages use ("Ada", "C++");
|
||||
for Source_Dirs use (".", "analysis", "bitreader", "bitwriter", "executionengine", "llvm", "target", "transforms");
|
||||
for Object_Dir use "build";
|
||||
for Exec_Dir use ".";
|
||||
for Library_Name use "llvm_ada";
|
||||
for Library_Dir use "lib";
|
||||
for Library_Ali_Dir use "objects";
|
||||
|
||||
package Naming is
|
||||
for Specification_Suffix ("c++") use ".h";
|
||||
for Implementation_Suffix ("c++") use ".cxx";
|
||||
end Naming;
|
||||
|
||||
package Builder is
|
||||
for Default_Switches ("ada") use ("-g");
|
||||
end Builder;
|
||||
|
||||
package Compiler is
|
||||
for Default_Switches ("ada") use ("-gnato", "-fstack-check", "-g", "-gnata", "-gnat05", "-I/usr/local/include");
|
||||
for Default_Switches ("c++") use ("-D__STDC_LIMIT_MACROS", "-D__STDC_CONSTANT_MACROS", "-I../../include", "-g");
|
||||
end Compiler;
|
||||
|
||||
package Binder is
|
||||
for Default_Switches ("ada") use ("-E");
|
||||
end Binder;
|
||||
|
||||
package Linker is
|
||||
for Default_Switches ("c++") use ("-g");
|
||||
end Linker;
|
||||
|
||||
end LLVM;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,497 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
with Interfaces.C.Extensions;
|
||||
|
||||
|
||||
package llvm is
|
||||
|
||||
-- LLVMCtxt
|
||||
--
|
||||
type LLVMCtxt is new Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMCtxt_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMCtxt;
|
||||
|
||||
type LLVMCtxt_view is access all llvm.LLVMCtxt;
|
||||
|
||||
-- LLVMContextRef
|
||||
--
|
||||
type LLVMContextRef is access all llvm.LLVMCtxt;
|
||||
|
||||
type LLVMContextRef_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMContextRef;
|
||||
|
||||
type LLVMContextRef_view is access all llvm.LLVMContextRef;
|
||||
|
||||
-- LLVMOpaqueModule
|
||||
--
|
||||
type LLVMOpaqueModule is new Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMOpaqueModule_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMOpaqueModule;
|
||||
|
||||
type LLVMOpaqueModule_view is access all llvm.LLVMOpaqueModule;
|
||||
|
||||
-- LLVMModuleRef
|
||||
--
|
||||
type LLVMModuleRef is access all llvm.LLVMOpaqueModule;
|
||||
|
||||
type LLVMModuleRef_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMModuleRef;
|
||||
|
||||
type LLVMModuleRef_view is access all llvm.LLVMModuleRef;
|
||||
|
||||
-- LLVMOpaqueType
|
||||
--
|
||||
type LLVMOpaqueType is new Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMOpaqueType_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMOpaqueType;
|
||||
|
||||
type LLVMOpaqueType_view is access all llvm.LLVMOpaqueType;
|
||||
|
||||
-- LLVMTypeRef
|
||||
--
|
||||
type LLVMTypeRef is access all llvm.LLVMOpaqueType;
|
||||
|
||||
type LLVMTypeRef_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMTypeRef;
|
||||
|
||||
type LLVMTypeRef_view is access all llvm.LLVMTypeRef;
|
||||
|
||||
-- LLVMOpaqueTypeHandle
|
||||
--
|
||||
type LLVMOpaqueTypeHandle is new
|
||||
Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMOpaqueTypeHandle_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased llvm.LLVMOpaqueTypeHandle;
|
||||
|
||||
type LLVMOpaqueTypeHandle_view is access all llvm.LLVMOpaqueTypeHandle;
|
||||
|
||||
-- LLVMTypeHandleRef
|
||||
--
|
||||
type LLVMTypeHandleRef is access all llvm.LLVMOpaqueTypeHandle;
|
||||
|
||||
type LLVMTypeHandleRef_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased llvm.LLVMTypeHandleRef;
|
||||
|
||||
type LLVMTypeHandleRef_view is access all llvm.LLVMTypeHandleRef;
|
||||
|
||||
-- LLVMOpaqueValue
|
||||
--
|
||||
type LLVMOpaqueValue is new Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMOpaqueValue_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMOpaqueValue;
|
||||
|
||||
type LLVMOpaqueValue_view is access all llvm.LLVMOpaqueValue;
|
||||
|
||||
-- LLVMValueRef
|
||||
--
|
||||
type LLVMValueRef is access all llvm.LLVMOpaqueValue;
|
||||
|
||||
type LLVMValueRef_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMValueRef;
|
||||
|
||||
type LLVMValueRef_view is access all llvm.LLVMValueRef;
|
||||
|
||||
-- LLVMOpaqueBasicBlock
|
||||
--
|
||||
type LLVMOpaqueBasicBlock is new
|
||||
Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMOpaqueBasicBlock_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased llvm.LLVMOpaqueBasicBlock;
|
||||
|
||||
type LLVMOpaqueBasicBlock_view is access all llvm.LLVMOpaqueBasicBlock;
|
||||
|
||||
-- LLVMBasicBlockRef
|
||||
--
|
||||
type LLVMBasicBlockRef is access all llvm.LLVMOpaqueBasicBlock;
|
||||
|
||||
type LLVMBasicBlockRef_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased llvm.LLVMBasicBlockRef;
|
||||
|
||||
type LLVMBasicBlockRef_view is access all llvm.LLVMBasicBlockRef;
|
||||
|
||||
-- LLVMOpaqueBuilder
|
||||
--
|
||||
type LLVMOpaqueBuilder is new Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMOpaqueBuilder_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased llvm.LLVMOpaqueBuilder;
|
||||
|
||||
type LLVMOpaqueBuilder_view is access all llvm.LLVMOpaqueBuilder;
|
||||
|
||||
-- LLVMBuilderRef
|
||||
--
|
||||
type LLVMBuilderRef is access all llvm.LLVMOpaqueBuilder;
|
||||
|
||||
type LLVMBuilderRef_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMBuilderRef;
|
||||
|
||||
type LLVMBuilderRef_view is access all llvm.LLVMBuilderRef;
|
||||
|
||||
-- LLVMOpaqueModuleProvider
|
||||
--
|
||||
type LLVMOpaqueModuleProvider is new
|
||||
Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMOpaqueModuleProvider_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased llvm.LLVMOpaqueModuleProvider;
|
||||
|
||||
type LLVMOpaqueModuleProvider_view is access all
|
||||
llvm.LLVMOpaqueModuleProvider;
|
||||
|
||||
-- LLVMModuleProviderRef
|
||||
--
|
||||
type LLVMModuleProviderRef is access all llvm.LLVMOpaqueModuleProvider;
|
||||
|
||||
type LLVMModuleProviderRef_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased llvm.LLVMModuleProviderRef;
|
||||
|
||||
type LLVMModuleProviderRef_view is access all llvm.LLVMModuleProviderRef;
|
||||
|
||||
-- LLVMOpaqueMemoryBuffer
|
||||
--
|
||||
type LLVMOpaqueMemoryBuffer is new
|
||||
Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMOpaqueMemoryBuffer_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased llvm.LLVMOpaqueMemoryBuffer;
|
||||
|
||||
type LLVMOpaqueMemoryBuffer_view is access all llvm.LLVMOpaqueMemoryBuffer;
|
||||
|
||||
-- LLVMMemoryBufferRef
|
||||
--
|
||||
type LLVMMemoryBufferRef is access all llvm.LLVMOpaqueMemoryBuffer;
|
||||
|
||||
type LLVMMemoryBufferRef_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased llvm.LLVMMemoryBufferRef;
|
||||
|
||||
type LLVMMemoryBufferRef_view is access all llvm.LLVMMemoryBufferRef;
|
||||
|
||||
-- LLVMOpaquePassManager
|
||||
--
|
||||
type LLVMOpaquePassManager is new
|
||||
Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMOpaquePassManager_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased llvm.LLVMOpaquePassManager;
|
||||
|
||||
type LLVMOpaquePassManager_view is access all llvm.LLVMOpaquePassManager;
|
||||
|
||||
-- LLVMPassManagerRef
|
||||
--
|
||||
type LLVMPassManagerRef is access all llvm.LLVMOpaquePassManager;
|
||||
|
||||
type LLVMPassManagerRef_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased llvm.LLVMPassManagerRef;
|
||||
|
||||
type LLVMPassManagerRef_view is access all llvm.LLVMPassManagerRef;
|
||||
|
||||
-- LLVMAttribute
|
||||
--
|
||||
type LLVMAttribute is (
|
||||
LLVMZExtAttribute,
|
||||
LLVMSExtAttribute,
|
||||
LLVMNoReturnAttribute,
|
||||
LLVMInRegAttribute,
|
||||
LLVMStructRetAttribute,
|
||||
LLVMNoUnwindAttribute,
|
||||
LLVMNoAliasAttribute,
|
||||
LLVMByValAttribute,
|
||||
LLVMNestAttribute,
|
||||
LLVMReadNoneAttribute,
|
||||
LLVMReadOnlyAttribute,
|
||||
LLVMNoInlineAttribute,
|
||||
LLVMAlwaysInlineAttribute,
|
||||
LLVMOptimizeForSizeAttribute,
|
||||
LLVMStackProtectAttribute,
|
||||
LLVMStackProtectReqAttribute,
|
||||
LLVMNoCaptureAttribute,
|
||||
LLVMNoRedZoneAttribute,
|
||||
LLVMNoImplicitFloatAttribute,
|
||||
LLVMNakedAttribute);
|
||||
|
||||
for LLVMAttribute use
|
||||
(LLVMZExtAttribute => 1,
|
||||
LLVMSExtAttribute => 2,
|
||||
LLVMNoReturnAttribute => 4,
|
||||
LLVMInRegAttribute => 8,
|
||||
LLVMStructRetAttribute => 16,
|
||||
LLVMNoUnwindAttribute => 32,
|
||||
LLVMNoAliasAttribute => 64,
|
||||
LLVMByValAttribute => 128,
|
||||
LLVMNestAttribute => 256,
|
||||
LLVMReadNoneAttribute => 512,
|
||||
LLVMReadOnlyAttribute => 1024,
|
||||
LLVMNoInlineAttribute => 2048,
|
||||
LLVMAlwaysInlineAttribute => 4096,
|
||||
LLVMOptimizeForSizeAttribute => 8192,
|
||||
LLVMStackProtectAttribute => 16384,
|
||||
LLVMStackProtectReqAttribute => 32768,
|
||||
LLVMNoCaptureAttribute => 2097152,
|
||||
LLVMNoRedZoneAttribute => 4194304,
|
||||
LLVMNoImplicitFloatAttribute => 8388608,
|
||||
LLVMNakedAttribute => 16777216);
|
||||
|
||||
pragma Convention (C, LLVMAttribute);
|
||||
|
||||
type LLVMAttribute_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMAttribute;
|
||||
|
||||
type LLVMAttribute_view is access all llvm.LLVMAttribute;
|
||||
|
||||
-- LLVMTypeKind
|
||||
--
|
||||
type LLVMTypeKind is (
|
||||
LLVMVoidTypeKind,
|
||||
LLVMFloatTypeKind,
|
||||
LLVMDoubleTypeKind,
|
||||
LLVMX86_FP80TypeKind,
|
||||
LLVMFP128TypeKind,
|
||||
LLVMPPC_FP128TypeKind,
|
||||
LLVMLabelTypeKind,
|
||||
LLVMIntegerTypeKind,
|
||||
LLVMFunctionTypeKind,
|
||||
LLVMStructTypeKind,
|
||||
LLVMArrayTypeKind,
|
||||
LLVMPointerTypeKind,
|
||||
LLVMOpaqueTypeKind,
|
||||
LLVMVectorTypeKind,
|
||||
LLVMMetadataTypeKind);
|
||||
|
||||
for LLVMTypeKind use
|
||||
(LLVMVoidTypeKind => 0,
|
||||
LLVMFloatTypeKind => 1,
|
||||
LLVMDoubleTypeKind => 2,
|
||||
LLVMX86_FP80TypeKind => 3,
|
||||
LLVMFP128TypeKind => 4,
|
||||
LLVMPPC_FP128TypeKind => 5,
|
||||
LLVMLabelTypeKind => 6,
|
||||
LLVMIntegerTypeKind => 7,
|
||||
LLVMFunctionTypeKind => 8,
|
||||
LLVMStructTypeKind => 9,
|
||||
LLVMArrayTypeKind => 10,
|
||||
LLVMPointerTypeKind => 11,
|
||||
LLVMOpaqueTypeKind => 12,
|
||||
LLVMVectorTypeKind => 13,
|
||||
LLVMMetadataTypeKind => 14);
|
||||
|
||||
pragma Convention (C, LLVMTypeKind);
|
||||
|
||||
type LLVMTypeKind_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMTypeKind;
|
||||
|
||||
type LLVMTypeKind_view is access all llvm.LLVMTypeKind;
|
||||
|
||||
-- LLVMLinkage
|
||||
--
|
||||
type LLVMLinkage is (
|
||||
LLVMExternalLinkage,
|
||||
LLVMAvailableExternallyLinkage,
|
||||
LLVMLinkOnceAnyLinkage,
|
||||
LLVMLinkOnceODRLinkage,
|
||||
LLVMWeakAnyLinkage,
|
||||
LLVMWeakODRLinkage,
|
||||
LLVMAppendingLinkage,
|
||||
LLVMInternalLinkage,
|
||||
LLVMPrivateLinkage,
|
||||
LLVMDLLImportLinkage,
|
||||
LLVMDLLExportLinkage,
|
||||
LLVMExternalWeakLinkage,
|
||||
LLVMGhostLinkage,
|
||||
LLVMCommonLinkage,
|
||||
LLVMLinkerPrivateLinkage,
|
||||
LLVMLinkerPrivateWeakLinkage,
|
||||
LinkerPrivateWeakDefAutoLinkage);
|
||||
|
||||
for LLVMLinkage use
|
||||
(LLVMExternalLinkage => 0,
|
||||
LLVMAvailableExternallyLinkage => 1,
|
||||
LLVMLinkOnceAnyLinkage => 2,
|
||||
LLVMLinkOnceODRLinkage => 3,
|
||||
LLVMWeakAnyLinkage => 4,
|
||||
LLVMWeakODRLinkage => 5,
|
||||
LLVMAppendingLinkage => 6,
|
||||
LLVMInternalLinkage => 7,
|
||||
LLVMPrivateLinkage => 8,
|
||||
LLVMDLLImportLinkage => 9,
|
||||
LLVMDLLExportLinkage => 10,
|
||||
LLVMExternalWeakLinkage => 11,
|
||||
LLVMGhostLinkage => 12,
|
||||
LLVMCommonLinkage => 13,
|
||||
LLVMLinkerPrivateLinkage => 14,
|
||||
LLVMLinkerPrivateWeakLinkage => 15,
|
||||
LinkerPrivateWeakDefAutoLinkage => 16);
|
||||
|
||||
pragma Convention (C, LLVMLinkage);
|
||||
|
||||
type LLVMLinkage_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMLinkage;
|
||||
|
||||
type LLVMLinkage_view is access all llvm.LLVMLinkage;
|
||||
|
||||
-- LLVMVisibility
|
||||
--
|
||||
type LLVMVisibility is (
|
||||
LLVMDefaultVisibility,
|
||||
LLVMHiddenVisibility,
|
||||
LLVMProtectedVisibility);
|
||||
|
||||
for LLVMVisibility use
|
||||
(LLVMDefaultVisibility => 0,
|
||||
LLVMHiddenVisibility => 1,
|
||||
LLVMProtectedVisibility => 2);
|
||||
|
||||
pragma Convention (C, LLVMVisibility);
|
||||
|
||||
type LLVMVisibility_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMVisibility;
|
||||
|
||||
type LLVMVisibility_view is access all llvm.LLVMVisibility;
|
||||
|
||||
-- LLVMCallConv
|
||||
--
|
||||
type LLVMCallConv is (
|
||||
LLVMCCallConv,
|
||||
LLVMFastCallConv,
|
||||
LLVMColdCallConv,
|
||||
LLVMX86StdcallCallConv,
|
||||
LLVMX86FastcallCallConv);
|
||||
|
||||
for LLVMCallConv use
|
||||
(LLVMCCallConv => 0,
|
||||
LLVMFastCallConv => 8,
|
||||
LLVMColdCallConv => 9,
|
||||
LLVMX86StdcallCallConv => 64,
|
||||
LLVMX86FastcallCallConv => 65);
|
||||
|
||||
pragma Convention (C, LLVMCallConv);
|
||||
|
||||
type LLVMCallConv_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMCallConv;
|
||||
|
||||
type LLVMCallConv_view is access all llvm.LLVMCallConv;
|
||||
|
||||
-- LLVMIntPredicate
|
||||
--
|
||||
type LLVMIntPredicate is (
|
||||
LLVMIntEQ,
|
||||
LLVMIntNE,
|
||||
LLVMIntUGT,
|
||||
LLVMIntUGE,
|
||||
LLVMIntULT,
|
||||
LLVMIntULE,
|
||||
LLVMIntSGT,
|
||||
LLVMIntSGE,
|
||||
LLVMIntSLT,
|
||||
LLVMIntSLE);
|
||||
|
||||
for LLVMIntPredicate use
|
||||
(LLVMIntEQ => 32,
|
||||
LLVMIntNE => 33,
|
||||
LLVMIntUGT => 34,
|
||||
LLVMIntUGE => 35,
|
||||
LLVMIntULT => 36,
|
||||
LLVMIntULE => 37,
|
||||
LLVMIntSGT => 38,
|
||||
LLVMIntSGE => 39,
|
||||
LLVMIntSLT => 40,
|
||||
LLVMIntSLE => 41);
|
||||
|
||||
pragma Convention (C, LLVMIntPredicate);
|
||||
|
||||
type LLVMIntPredicate_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.LLVMIntPredicate;
|
||||
|
||||
type LLVMIntPredicate_view is access all llvm.LLVMIntPredicate;
|
||||
|
||||
-- LLVMRealPredicate
|
||||
--
|
||||
type LLVMRealPredicate is (
|
||||
LLVMRealPredicateFalse,
|
||||
LLVMRealOEQ,
|
||||
LLVMRealOGT,
|
||||
LLVMRealOGE,
|
||||
LLVMRealOLT,
|
||||
LLVMRealOLE,
|
||||
LLVMRealONE,
|
||||
LLVMRealORD,
|
||||
LLVMRealUNO,
|
||||
LLVMRealUEQ,
|
||||
LLVMRealUGT,
|
||||
LLVMRealUGE,
|
||||
LLVMRealULT,
|
||||
LLVMRealULE,
|
||||
LLVMRealUNE,
|
||||
LLVMRealPredicateTrue);
|
||||
|
||||
for LLVMRealPredicate use
|
||||
(LLVMRealPredicateFalse => 0,
|
||||
LLVMRealOEQ => 1,
|
||||
LLVMRealOGT => 2,
|
||||
LLVMRealOGE => 3,
|
||||
LLVMRealOLT => 4,
|
||||
LLVMRealOLE => 5,
|
||||
LLVMRealONE => 6,
|
||||
LLVMRealORD => 7,
|
||||
LLVMRealUNO => 8,
|
||||
LLVMRealUEQ => 9,
|
||||
LLVMRealUGT => 10,
|
||||
LLVMRealUGE => 11,
|
||||
LLVMRealULT => 12,
|
||||
LLVMRealULE => 13,
|
||||
LLVMRealUNE => 14,
|
||||
LLVMRealPredicateTrue => 15);
|
||||
|
||||
pragma Convention (C, LLVMRealPredicate);
|
||||
|
||||
type LLVMRealPredicate_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased llvm.LLVMRealPredicate;
|
||||
|
||||
type LLVMRealPredicate_view is access all llvm.LLVMRealPredicate;
|
||||
|
||||
-- ModuleProvider
|
||||
--
|
||||
type ModuleProvider is new Interfaces.C.Extensions.incomplete_class_def;
|
||||
|
||||
type ModuleProvider_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.ModuleProvider;
|
||||
|
||||
type ModuleProvider_view is access all llvm.ModuleProvider;
|
||||
|
||||
-- MemoryBuffer
|
||||
--
|
||||
type MemoryBuffer is new Interfaces.C.Extensions.incomplete_class_def;
|
||||
|
||||
type MemoryBuffer_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.MemoryBuffer;
|
||||
|
||||
type MemoryBuffer_view is access all llvm.MemoryBuffer;
|
||||
|
||||
-- PassManagerBase
|
||||
--
|
||||
type PassManagerBase is new Interfaces.C.Extensions.incomplete_class_def;
|
||||
|
||||
type PassManagerBase_array is
|
||||
array (Interfaces.C.size_t range <>) of aliased llvm.PassManagerBase;
|
||||
|
||||
type PassManagerBase_view is access all llvm.PassManagerBase;
|
||||
|
||||
end llvm;
|
@ -1,207 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
with Interfaces.C.Strings;
|
||||
|
||||
|
||||
package LLVM_link_time_Optimizer.Binding is
|
||||
|
||||
LTO_H : constant := 1;
|
||||
LTO_API_VERSION : constant := 3;
|
||||
|
||||
function lto_get_version return Interfaces.C.Strings.chars_ptr;
|
||||
|
||||
function lto_get_error_message return Interfaces.C.Strings.chars_ptr;
|
||||
|
||||
function lto_module_is_object_file
|
||||
(path : in Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.Extensions.bool;
|
||||
|
||||
function lto_module_is_object_file_for_target
|
||||
(path : in Interfaces.C.Strings.chars_ptr;
|
||||
target_triple_prefix : in Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.Extensions.bool;
|
||||
|
||||
function lto_module_is_object_file_in_memory
|
||||
(mem : access Interfaces.C.Extensions.void;
|
||||
length : in Interfaces.C.size_t)
|
||||
return Interfaces.C.Extensions.bool;
|
||||
|
||||
function lto_module_is_object_file_in_memory_for_target
|
||||
(mem : access Interfaces.C.Extensions.void;
|
||||
length : in Interfaces.C.size_t;
|
||||
target_triple_prefix : in Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.Extensions.bool;
|
||||
|
||||
function lto_module_create
|
||||
(path : in Interfaces.C.Strings.chars_ptr)
|
||||
return LLVM_link_time_Optimizer.lto_module_t;
|
||||
|
||||
function lto_module_create_from_memory
|
||||
(mem : access Interfaces.C.Extensions.void;
|
||||
length : in Interfaces.C.size_t)
|
||||
return LLVM_link_time_Optimizer.lto_module_t;
|
||||
|
||||
procedure lto_module_dispose
|
||||
(the_mod : in LLVM_link_time_Optimizer.lto_module_t);
|
||||
|
||||
function lto_module_get_target_triple
|
||||
(the_mod : in LLVM_link_time_Optimizer.lto_module_t)
|
||||
return Interfaces.C.Strings.chars_ptr;
|
||||
|
||||
function lto_module_get_num_symbols
|
||||
(the_mod : in LLVM_link_time_Optimizer.lto_module_t)
|
||||
return Interfaces.C.unsigned;
|
||||
|
||||
function lto_module_get_symbol_name
|
||||
(the_mod : in LLVM_link_time_Optimizer.lto_module_t;
|
||||
index : in Interfaces.C.unsigned)
|
||||
return Interfaces.C.Strings.chars_ptr;
|
||||
|
||||
function lto_module_get_symbol_attribute
|
||||
(the_mod : in LLVM_link_time_Optimizer.lto_module_t;
|
||||
index : in Interfaces.C.unsigned)
|
||||
return LLVM_link_time_Optimizer.lto_symbol_attributes;
|
||||
|
||||
function lto_codegen_create return LLVM_link_time_Optimizer.lto_code_gen_t;
|
||||
|
||||
procedure lto_codegen_dispose
|
||||
(arg_1 : in LLVM_link_time_Optimizer.lto_code_gen_t);
|
||||
|
||||
function lto_codegen_add_module
|
||||
(cg : in LLVM_link_time_Optimizer.lto_code_gen_t;
|
||||
the_mod : in LLVM_link_time_Optimizer.lto_module_t)
|
||||
return Interfaces.C.Extensions.bool;
|
||||
|
||||
function lto_codegen_set_debug_model
|
||||
(cg : in LLVM_link_time_Optimizer.lto_code_gen_t;
|
||||
arg_1 : in LLVM_link_time_Optimizer.lto_debug_model)
|
||||
return Interfaces.C.Extensions.bool;
|
||||
|
||||
function lto_codegen_set_pic_model
|
||||
(cg : in LLVM_link_time_Optimizer.lto_code_gen_t;
|
||||
arg_1 : in LLVM_link_time_Optimizer.lto_codegen_model)
|
||||
return Interfaces.C.Extensions.bool;
|
||||
|
||||
procedure lto_codegen_set_gcc_path
|
||||
(cg : in LLVM_link_time_Optimizer.lto_code_gen_t;
|
||||
path : in Interfaces.C.Strings.chars_ptr);
|
||||
|
||||
procedure lto_codegen_set_assembler_path
|
||||
(cg : in LLVM_link_time_Optimizer.lto_code_gen_t;
|
||||
path : in Interfaces.C.Strings.chars_ptr);
|
||||
|
||||
procedure lto_codegen_add_must_preserve_symbol
|
||||
(cg : in LLVM_link_time_Optimizer.lto_code_gen_t;
|
||||
symbol : in Interfaces.C.Strings.chars_ptr);
|
||||
|
||||
function lto_codegen_write_merged_modules
|
||||
(cg : in LLVM_link_time_Optimizer.lto_code_gen_t;
|
||||
path : in Interfaces.C.Strings.chars_ptr)
|
||||
return Interfaces.C.Extensions.bool;
|
||||
|
||||
function lto_codegen_compile
|
||||
(cg : in LLVM_link_time_Optimizer.lto_code_gen_t;
|
||||
length : access Interfaces.C.size_t)
|
||||
return access Interfaces.C.Extensions.void;
|
||||
|
||||
procedure lto_codegen_debug_options
|
||||
(cg : in LLVM_link_time_Optimizer.lto_code_gen_t;
|
||||
arg_1 : in Interfaces.C.Strings.chars_ptr);
|
||||
|
||||
function llvm_create_optimizer return
|
||||
LLVM_link_time_Optimizer.llvm_lto_t;
|
||||
|
||||
procedure llvm_destroy_optimizer
|
||||
(lto : in LLVM_link_time_Optimizer.llvm_lto_t);
|
||||
|
||||
function llvm_read_object_file
|
||||
(lto : in LLVM_link_time_Optimizer.llvm_lto_t;
|
||||
input_filename : in Interfaces.C.Strings.chars_ptr)
|
||||
return LLVM_link_time_Optimizer.llvm_lto_status_t;
|
||||
|
||||
function llvm_optimize_modules
|
||||
(lto : in LLVM_link_time_Optimizer.llvm_lto_t;
|
||||
output_filename : in Interfaces.C.Strings.chars_ptr)
|
||||
return LLVM_link_time_Optimizer.llvm_lto_status_t;
|
||||
|
||||
private
|
||||
|
||||
pragma Import (C, lto_get_version, "Ada_lto_get_version");
|
||||
pragma Import (C, lto_get_error_message, "Ada_lto_get_error_message");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_module_is_object_file,
|
||||
"Ada_lto_module_is_object_file");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_module_is_object_file_for_target,
|
||||
"Ada_lto_module_is_object_file_for_target");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_module_is_object_file_in_memory,
|
||||
"Ada_lto_module_is_object_file_in_memory");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_module_is_object_file_in_memory_for_target,
|
||||
"Ada_lto_module_is_object_file_in_memory_for_target");
|
||||
pragma Import (C, lto_module_create, "Ada_lto_module_create");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_module_create_from_memory,
|
||||
"Ada_lto_module_create_from_memory");
|
||||
pragma Import (C, lto_module_dispose, "Ada_lto_module_dispose");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_module_get_target_triple,
|
||||
"Ada_lto_module_get_target_triple");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_module_get_num_symbols,
|
||||
"Ada_lto_module_get_num_symbols");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_module_get_symbol_name,
|
||||
"Ada_lto_module_get_symbol_name");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_module_get_symbol_attribute,
|
||||
"Ada_lto_module_get_symbol_attribute");
|
||||
pragma Import (C, lto_codegen_create, "Ada_lto_codegen_create");
|
||||
pragma Import (C, lto_codegen_dispose, "Ada_lto_codegen_dispose");
|
||||
pragma Import (C, lto_codegen_add_module, "Ada_lto_codegen_add_module");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_codegen_set_debug_model,
|
||||
"Ada_lto_codegen_set_debug_model");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_codegen_set_pic_model,
|
||||
"Ada_lto_codegen_set_pic_model");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_codegen_set_gcc_path,
|
||||
"Ada_lto_codegen_set_gcc_path");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_codegen_set_assembler_path,
|
||||
"Ada_lto_codegen_set_assembler_path");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_codegen_add_must_preserve_symbol,
|
||||
"Ada_lto_codegen_add_must_preserve_symbol");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_codegen_write_merged_modules,
|
||||
"Ada_lto_codegen_write_merged_modules");
|
||||
pragma Import (C, lto_codegen_compile, "Ada_lto_codegen_compile");
|
||||
pragma Import
|
||||
(C,
|
||||
lto_codegen_debug_options,
|
||||
"Ada_lto_codegen_debug_options");
|
||||
pragma Import (C, llvm_create_optimizer, "Ada_llvm_create_optimizer");
|
||||
pragma Import (C, llvm_destroy_optimizer, "Ada_llvm_destroy_optimizer");
|
||||
pragma Import (C, llvm_read_object_file, "Ada_llvm_read_object_file");
|
||||
pragma Import (C, llvm_optimize_modules, "Ada_llvm_optimize_modules");
|
||||
|
||||
end LLVM_link_time_Optimizer.Binding;
|
@ -1,184 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
with Interfaces.C.Extensions;
|
||||
|
||||
|
||||
package LLVM_link_time_Optimizer is
|
||||
|
||||
-- lto_symbol_attributes
|
||||
--
|
||||
type lto_symbol_attributes is (
|
||||
LTO_SYMBOL_ALIGNMENT_MASK,
|
||||
LTO_SYMBOL_PERMISSIONS_RODATA,
|
||||
LTO_SYMBOL_PERMISSIONS_CODE,
|
||||
LTO_SYMBOL_PERMISSIONS_DATA,
|
||||
LTO_SYMBOL_PERMISSIONS_MASK,
|
||||
LTO_SYMBOL_DEFINITION_REGULAR,
|
||||
LTO_SYMBOL_DEFINITION_TENTATIVE,
|
||||
LTO_SYMBOL_DEFINITION_WEAK,
|
||||
LTO_SYMBOL_DEFINITION_UNDEFINED,
|
||||
LTO_SYMBOL_DEFINITION_WEAKUNDEF,
|
||||
LTO_SYMBOL_DEFINITION_MASK,
|
||||
LTO_SYMBOL_SCOPE_INTERNAL,
|
||||
LTO_SYMBOL_SCOPE_HIDDEN,
|
||||
LTO_SYMBOL_SCOPE_DEFAULT,
|
||||
LTO_SYMBOL_SCOPE_PROTECTED,
|
||||
LTO_SYMBOL_SCOPE_MASK);
|
||||
|
||||
for lto_symbol_attributes use
|
||||
(LTO_SYMBOL_ALIGNMENT_MASK => 31,
|
||||
LTO_SYMBOL_PERMISSIONS_RODATA => 128,
|
||||
LTO_SYMBOL_PERMISSIONS_CODE => 160,
|
||||
LTO_SYMBOL_PERMISSIONS_DATA => 192,
|
||||
LTO_SYMBOL_PERMISSIONS_MASK => 224,
|
||||
LTO_SYMBOL_DEFINITION_REGULAR => 256,
|
||||
LTO_SYMBOL_DEFINITION_TENTATIVE => 512,
|
||||
LTO_SYMBOL_DEFINITION_WEAK => 768,
|
||||
LTO_SYMBOL_DEFINITION_UNDEFINED => 1024,
|
||||
LTO_SYMBOL_DEFINITION_WEAKUNDEF => 1280,
|
||||
LTO_SYMBOL_DEFINITION_MASK => 1792,
|
||||
LTO_SYMBOL_SCOPE_INTERNAL => 2048,
|
||||
LTO_SYMBOL_SCOPE_HIDDEN => 4096,
|
||||
LTO_SYMBOL_SCOPE_DEFAULT => 6144,
|
||||
LTO_SYMBOL_SCOPE_PROTECTED => 8192,
|
||||
LTO_SYMBOL_SCOPE_MASK => 14336);
|
||||
|
||||
pragma Convention (C, lto_symbol_attributes);
|
||||
|
||||
type lto_symbol_attributes_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_link_time_Optimizer.lto_symbol_attributes;
|
||||
|
||||
type lto_symbol_attributes_view is access all
|
||||
LLVM_link_time_Optimizer.lto_symbol_attributes;
|
||||
|
||||
-- lto_debug_model
|
||||
--
|
||||
type lto_debug_model is (LTO_DEBUG_MODEL_NONE, LTO_DEBUG_MODEL_DWARF);
|
||||
|
||||
for lto_debug_model use
|
||||
(LTO_DEBUG_MODEL_NONE => 0,
|
||||
LTO_DEBUG_MODEL_DWARF => 1);
|
||||
|
||||
pragma Convention (C, lto_debug_model);
|
||||
|
||||
type lto_debug_model_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_link_time_Optimizer.lto_debug_model;
|
||||
|
||||
type lto_debug_model_view is access all
|
||||
LLVM_link_time_Optimizer.lto_debug_model;
|
||||
|
||||
-- lto_codegen_model
|
||||
--
|
||||
type lto_codegen_model is (
|
||||
LTO_CODEGEN_PIC_MODEL_STATIC,
|
||||
LTO_CODEGEN_PIC_MODEL_DYNAMIC,
|
||||
LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC);
|
||||
|
||||
for lto_codegen_model use
|
||||
(LTO_CODEGEN_PIC_MODEL_STATIC => 0,
|
||||
LTO_CODEGEN_PIC_MODEL_DYNAMIC => 1,
|
||||
LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC => 2);
|
||||
|
||||
pragma Convention (C, lto_codegen_model);
|
||||
|
||||
type lto_codegen_model_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_link_time_Optimizer.lto_codegen_model;
|
||||
|
||||
type lto_codegen_model_view is access all
|
||||
LLVM_link_time_Optimizer.lto_codegen_model;
|
||||
|
||||
-- LTOModule
|
||||
--
|
||||
type LTOModule is new Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LTOModule_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_link_time_Optimizer.LTOModule;
|
||||
|
||||
type LTOModule_view is access all LLVM_link_time_Optimizer.LTOModule;
|
||||
|
||||
-- lto_module_t
|
||||
--
|
||||
type lto_module_t is access all LLVM_link_time_Optimizer.LTOModule;
|
||||
|
||||
type lto_module_t_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_link_time_Optimizer.lto_module_t;
|
||||
|
||||
type lto_module_t_view is access all LLVM_link_time_Optimizer.lto_module_t;
|
||||
|
||||
-- LTOCodeGenerator
|
||||
--
|
||||
type LTOCodeGenerator is new Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LTOCodeGenerator_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_link_time_Optimizer.LTOCodeGenerator;
|
||||
|
||||
type LTOCodeGenerator_view is access all
|
||||
LLVM_link_time_Optimizer.LTOCodeGenerator;
|
||||
|
||||
-- lto_code_gen_t
|
||||
--
|
||||
type lto_code_gen_t is access all LLVM_link_time_Optimizer.LTOCodeGenerator;
|
||||
|
||||
type lto_code_gen_t_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_link_time_Optimizer.lto_code_gen_t;
|
||||
|
||||
type lto_code_gen_t_view is access all
|
||||
LLVM_link_time_Optimizer.lto_code_gen_t;
|
||||
|
||||
-- llvm_lto_status_t
|
||||
--
|
||||
type llvm_lto_status_t is (
|
||||
LLVM_LTO_UNKNOWN,
|
||||
LLVM_LTO_OPT_SUCCESS,
|
||||
LLVM_LTO_READ_SUCCESS,
|
||||
LLVM_LTO_READ_FAILURE,
|
||||
LLVM_LTO_WRITE_FAILURE,
|
||||
LLVM_LTO_NO_TARGET,
|
||||
LLVM_LTO_NO_WORK,
|
||||
LLVM_LTO_MODULE_MERGE_FAILURE,
|
||||
LLVM_LTO_ASM_FAILURE,
|
||||
LLVM_LTO_NULL_OBJECT);
|
||||
|
||||
for llvm_lto_status_t use
|
||||
(LLVM_LTO_UNKNOWN => 0,
|
||||
LLVM_LTO_OPT_SUCCESS => 1,
|
||||
LLVM_LTO_READ_SUCCESS => 2,
|
||||
LLVM_LTO_READ_FAILURE => 3,
|
||||
LLVM_LTO_WRITE_FAILURE => 4,
|
||||
LLVM_LTO_NO_TARGET => 5,
|
||||
LLVM_LTO_NO_WORK => 6,
|
||||
LLVM_LTO_MODULE_MERGE_FAILURE => 7,
|
||||
LLVM_LTO_ASM_FAILURE => 8,
|
||||
LLVM_LTO_NULL_OBJECT => 9);
|
||||
|
||||
pragma Convention (C, llvm_lto_status_t);
|
||||
|
||||
type llvm_lto_status_t_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_link_time_Optimizer.llvm_lto_status_t;
|
||||
|
||||
type llvm_lto_status_t_view is access all
|
||||
LLVM_link_time_Optimizer.llvm_lto_status_t;
|
||||
|
||||
|
||||
-- llvm_lto_t
|
||||
--
|
||||
type llvm_lto_t is access all Interfaces.C.Extensions.void;
|
||||
|
||||
type llvm_lto_t_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_link_time_Optimizer.llvm_lto_t;
|
||||
|
||||
type llvm_lto_t_view is access all
|
||||
LLVM_link_time_Optimizer.llvm_lto_t;
|
||||
|
||||
|
||||
end LLVM_link_time_Optimizer;
|
@ -1,923 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.36
|
||||
*
|
||||
* This file is not intended to be easily readable and contains a number of
|
||||
* coding conventions designed to improve portability and efficiency. Do not make
|
||||
* changes to this file unless you know what you are doing--modify the SWIG
|
||||
* interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
template<typename T> class SwigValueWrapper {
|
||||
T *tt;
|
||||
public:
|
||||
SwigValueWrapper() : tt(0) { }
|
||||
SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
|
||||
SwigValueWrapper(const T& t) : tt(new T(t)) { }
|
||||
~SwigValueWrapper() { delete tt; }
|
||||
SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
|
||||
operator T&() const { return *tt; }
|
||||
T *operator&() { return tt; }
|
||||
private:
|
||||
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
|
||||
};
|
||||
|
||||
template <typename T> T SwigValueInit() {
|
||||
return T();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* This section contains generic SWIG labels for method/variable
|
||||
* declarations/attributes, and other compiler dependent labels.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* template workaround for compilers that cannot correctly implement the C++ standard */
|
||||
#ifndef SWIGTEMPLATEDISAMBIGUATOR
|
||||
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# elif defined(__HP_aCC)
|
||||
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
|
||||
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# else
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* inline attribute */
|
||||
#ifndef SWIGINLINE
|
||||
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
|
||||
# define SWIGINLINE inline
|
||||
# else
|
||||
# define SWIGINLINE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* attribute recognised by some compilers to avoid 'unused' warnings */
|
||||
#ifndef SWIGUNUSED
|
||||
# if defined(__GNUC__)
|
||||
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
# elif defined(__ICC)
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGUNUSEDPARM
|
||||
# ifdef __cplusplus
|
||||
# define SWIGUNUSEDPARM(p)
|
||||
# else
|
||||
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* internal SWIG method */
|
||||
#ifndef SWIGINTERN
|
||||
# define SWIGINTERN static SWIGUNUSED
|
||||
#endif
|
||||
|
||||
/* internal inline SWIG method */
|
||||
#ifndef SWIGINTERNINLINE
|
||||
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
|
||||
#endif
|
||||
|
||||
/* exporting methods */
|
||||
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
# ifndef GCC_HASCLASSVISIBILITY
|
||||
# define GCC_HASCLASSVISIBILITY
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGEXPORT
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if defined(STATIC_LINKED)
|
||||
# define SWIGEXPORT
|
||||
# else
|
||||
# define SWIGEXPORT __declspec(dllexport)
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
||||
# define SWIGEXPORT __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define SWIGEXPORT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* calling conventions for Windows */
|
||||
#ifndef SWIGSTDCALL
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# define SWIGSTDCALL __stdcall
|
||||
# else
|
||||
# define SWIGSTDCALL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
||||
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
|
||||
# define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
|
||||
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
|
||||
# define _SCL_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
# define DllExport __declspec( dllexport )
|
||||
# define SWIGSTDCALL __stdcall
|
||||
#else
|
||||
# define DllExport
|
||||
# define SWIGSTDCALL
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <new>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Support for throwing Ada exceptions from C/C++ */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SWIG_AdaException,
|
||||
SWIG_AdaOutOfMemoryException,
|
||||
SWIG_AdaIndexOutOfRangeException,
|
||||
SWIG_AdaDivideByZeroException,
|
||||
SWIG_AdaArgumentOutOfRangeException,
|
||||
SWIG_AdaNullReferenceException
|
||||
} SWIG_AdaExceptionCodes;
|
||||
|
||||
|
||||
typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SWIG_AdaExceptionCodes code;
|
||||
SWIG_AdaExceptionCallback_t callback;
|
||||
}
|
||||
SWIG_AdaExceptions_t;
|
||||
|
||||
|
||||
static
|
||||
SWIG_AdaExceptions_t
|
||||
SWIG_ada_exceptions[] =
|
||||
{
|
||||
{ SWIG_AdaException, NULL },
|
||||
{ SWIG_AdaOutOfMemoryException, NULL },
|
||||
{ SWIG_AdaIndexOutOfRangeException, NULL },
|
||||
{ SWIG_AdaDivideByZeroException, NULL },
|
||||
{ SWIG_AdaArgumentOutOfRangeException, NULL },
|
||||
{ SWIG_AdaNullReferenceException, NULL }
|
||||
};
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg)
|
||||
{
|
||||
SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback;
|
||||
if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) {
|
||||
callback = SWIG_ada_exceptions[code].callback;
|
||||
}
|
||||
callback(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
|
||||
DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_link_time_Optimizer (SWIG_AdaExceptionCallback_t systemException,
|
||||
SWIG_AdaExceptionCallback_t outOfMemory,
|
||||
SWIG_AdaExceptionCallback_t indexOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t divideByZero,
|
||||
SWIG_AdaExceptionCallback_t argumentOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t nullReference)
|
||||
{
|
||||
SWIG_ada_exceptions [SWIG_AdaException].callback = systemException;
|
||||
SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory;
|
||||
SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero;
|
||||
SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference;
|
||||
}
|
||||
|
||||
|
||||
/* Callback for returning strings to Ada without leaking memory */
|
||||
|
||||
typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *);
|
||||
static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL;
|
||||
|
||||
|
||||
|
||||
/* probably obsolete ...
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_link_time_Optimizer(SWIG_AdaStringHelperCallback callback) {
|
||||
SWIG_ada_string_callback = callback;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Contract support */
|
||||
|
||||
#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else
|
||||
|
||||
|
||||
#define protected public
|
||||
#define private public
|
||||
|
||||
#include "llvm-c/lto.h"
|
||||
#include "llvm-c/LinkTimeOptimizer.h"
|
||||
|
||||
|
||||
|
||||
// struct LLVMCtxt;
|
||||
|
||||
|
||||
#undef protected
|
||||
#undef private
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
DllExport char * SWIGSTDCALL Ada_lto_get_version (
|
||||
)
|
||||
{
|
||||
char * jresult ;
|
||||
char *result = 0 ;
|
||||
|
||||
result = (char *)lto_get_version();
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport char * SWIGSTDCALL Ada_lto_get_error_message (
|
||||
)
|
||||
{
|
||||
char * jresult ;
|
||||
char *result = 0 ;
|
||||
|
||||
result = (char *)lto_get_error_message();
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_lto_module_is_object_file (
|
||||
char * jarg1
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
char *arg1 = (char *) 0 ;
|
||||
bool result;
|
||||
|
||||
arg1 = jarg1;
|
||||
|
||||
result = (bool)lto_module_is_object_file((char const *)arg1);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_lto_module_is_object_file_for_target (
|
||||
char * jarg1
|
||||
,
|
||||
|
||||
char * jarg2
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
char *arg1 = (char *) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
bool result;
|
||||
|
||||
arg1 = jarg1;
|
||||
|
||||
arg2 = jarg2;
|
||||
|
||||
result = (bool)lto_module_is_object_file_for_target((char const *)arg1,(char const *)arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_lto_module_is_object_file_in_memory (
|
||||
void* jarg1
|
||||
,
|
||||
|
||||
size_t jarg2
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
void *arg1 = (void *) 0 ;
|
||||
size_t arg2 ;
|
||||
bool result;
|
||||
|
||||
arg1 = (void *)jarg1;
|
||||
|
||||
|
||||
arg2 = (size_t) jarg2;
|
||||
|
||||
|
||||
result = (bool)lto_module_is_object_file_in_memory((void const *)arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_lto_module_is_object_file_in_memory_for_target (
|
||||
void* jarg1
|
||||
,
|
||||
|
||||
size_t jarg2
|
||||
,
|
||||
|
||||
char * jarg3
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
void *arg1 = (void *) 0 ;
|
||||
size_t arg2 ;
|
||||
char *arg3 = (char *) 0 ;
|
||||
bool result;
|
||||
|
||||
arg1 = (void *)jarg1;
|
||||
|
||||
|
||||
arg2 = (size_t) jarg2;
|
||||
|
||||
|
||||
arg3 = jarg3;
|
||||
|
||||
result = (bool)lto_module_is_object_file_in_memory_for_target((void const *)arg1,arg2,(char const *)arg3);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void * SWIGSTDCALL Ada_lto_module_create (
|
||||
char * jarg1
|
||||
)
|
||||
{
|
||||
void * jresult ;
|
||||
char *arg1 = (char *) 0 ;
|
||||
lto_module_t result;
|
||||
|
||||
arg1 = jarg1;
|
||||
|
||||
result = (lto_module_t)lto_module_create((char const *)arg1);
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void * SWIGSTDCALL Ada_lto_module_create_from_memory (
|
||||
void* jarg1
|
||||
,
|
||||
|
||||
size_t jarg2
|
||||
)
|
||||
{
|
||||
void * jresult ;
|
||||
void *arg1 = (void *) 0 ;
|
||||
size_t arg2 ;
|
||||
lto_module_t result;
|
||||
|
||||
arg1 = (void *)jarg1;
|
||||
|
||||
|
||||
arg2 = (size_t) jarg2;
|
||||
|
||||
|
||||
result = (lto_module_t)lto_module_create_from_memory((void const *)arg1,arg2);
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_lto_module_dispose (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
lto_module_t arg1 = (lto_module_t) 0 ;
|
||||
|
||||
arg1 = (lto_module_t)jarg1;
|
||||
|
||||
lto_module_dispose(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport char * SWIGSTDCALL Ada_lto_module_get_target_triple (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
char * jresult ;
|
||||
lto_module_t arg1 = (lto_module_t) 0 ;
|
||||
char *result = 0 ;
|
||||
|
||||
arg1 = (lto_module_t)jarg1;
|
||||
|
||||
result = (char *)lto_module_get_target_triple(arg1);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_lto_module_get_num_symbols (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
lto_module_t arg1 = (lto_module_t) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
arg1 = (lto_module_t)jarg1;
|
||||
|
||||
result = (unsigned int)lto_module_get_num_symbols(arg1);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport char * SWIGSTDCALL Ada_lto_module_get_symbol_name (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
unsigned int jarg2
|
||||
)
|
||||
{
|
||||
char * jresult ;
|
||||
lto_module_t arg1 = (lto_module_t) 0 ;
|
||||
unsigned int arg2 ;
|
||||
char *result = 0 ;
|
||||
|
||||
arg1 = (lto_module_t)jarg1;
|
||||
|
||||
|
||||
arg2 = (unsigned int) jarg2;
|
||||
|
||||
|
||||
result = (char *)lto_module_get_symbol_name(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_lto_module_get_symbol_attribute (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
unsigned int jarg2
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
lto_module_t arg1 = (lto_module_t) 0 ;
|
||||
unsigned int arg2 ;
|
||||
lto_symbol_attributes result;
|
||||
|
||||
arg1 = (lto_module_t)jarg1;
|
||||
|
||||
|
||||
arg2 = (unsigned int) jarg2;
|
||||
|
||||
|
||||
result = (lto_symbol_attributes)lto_module_get_symbol_attribute(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void * SWIGSTDCALL Ada_lto_codegen_create (
|
||||
)
|
||||
{
|
||||
void * jresult ;
|
||||
lto_code_gen_t result;
|
||||
|
||||
result = (lto_code_gen_t)lto_codegen_create();
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_lto_codegen_dispose (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
lto_code_gen_t arg1 = (lto_code_gen_t) 0 ;
|
||||
|
||||
arg1 = (lto_code_gen_t)jarg1;
|
||||
|
||||
lto_codegen_dispose(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_lto_codegen_add_module (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
lto_code_gen_t arg1 = (lto_code_gen_t) 0 ;
|
||||
lto_module_t arg2 = (lto_module_t) 0 ;
|
||||
bool result;
|
||||
|
||||
arg1 = (lto_code_gen_t)jarg1;
|
||||
|
||||
arg2 = (lto_module_t)jarg2;
|
||||
|
||||
result = (bool)lto_codegen_add_module(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_lto_codegen_set_debug_model (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
int jarg2
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
lto_code_gen_t arg1 = (lto_code_gen_t) 0 ;
|
||||
lto_debug_model arg2 ;
|
||||
bool result;
|
||||
|
||||
arg1 = (lto_code_gen_t)jarg1;
|
||||
|
||||
arg2 = (lto_debug_model) jarg2;
|
||||
|
||||
result = (bool)lto_codegen_set_debug_model(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_lto_codegen_set_pic_model (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
int jarg2
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
lto_code_gen_t arg1 = (lto_code_gen_t) 0 ;
|
||||
lto_codegen_model arg2 ;
|
||||
bool result;
|
||||
|
||||
arg1 = (lto_code_gen_t)jarg1;
|
||||
|
||||
arg2 = (lto_codegen_model) jarg2;
|
||||
|
||||
result = (bool)lto_codegen_set_pic_model(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_lto_codegen_set_gcc_path (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
char * jarg2
|
||||
)
|
||||
{
|
||||
lto_code_gen_t arg1 = (lto_code_gen_t) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
|
||||
arg1 = (lto_code_gen_t)jarg1;
|
||||
|
||||
arg2 = jarg2;
|
||||
|
||||
lto_codegen_set_gcc_path(arg1,(char const *)arg2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_lto_codegen_set_assembler_path (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
char * jarg2
|
||||
)
|
||||
{
|
||||
lto_code_gen_t arg1 = (lto_code_gen_t) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
|
||||
arg1 = (lto_code_gen_t)jarg1;
|
||||
|
||||
arg2 = jarg2;
|
||||
|
||||
lto_codegen_set_assembler_path(arg1,(char const *)arg2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_lto_codegen_add_must_preserve_symbol (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
char * jarg2
|
||||
)
|
||||
{
|
||||
lto_code_gen_t arg1 = (lto_code_gen_t) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
|
||||
arg1 = (lto_code_gen_t)jarg1;
|
||||
|
||||
arg2 = jarg2;
|
||||
|
||||
lto_codegen_add_must_preserve_symbol(arg1,(char const *)arg2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_lto_codegen_write_merged_modules (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
char * jarg2
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
lto_code_gen_t arg1 = (lto_code_gen_t) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
bool result;
|
||||
|
||||
arg1 = (lto_code_gen_t)jarg1;
|
||||
|
||||
arg2 = jarg2;
|
||||
|
||||
result = (bool)lto_codegen_write_merged_modules(arg1,(char const *)arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void* SWIGSTDCALL Ada_lto_codegen_compile (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
size_t* jarg2
|
||||
)
|
||||
{
|
||||
void* jresult ;
|
||||
lto_code_gen_t arg1 = (lto_code_gen_t) 0 ;
|
||||
size_t *arg2 = (size_t *) 0 ;
|
||||
void *result = 0 ;
|
||||
|
||||
arg1 = (lto_code_gen_t)jarg1;
|
||||
|
||||
|
||||
arg2 = (size_t *) jarg2;
|
||||
|
||||
|
||||
result = (void *)lto_codegen_compile(arg1,arg2);
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_lto_codegen_debug_options (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
char * jarg2
|
||||
)
|
||||
{
|
||||
lto_code_gen_t arg1 = (lto_code_gen_t) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
|
||||
arg1 = (lto_code_gen_t)jarg1;
|
||||
|
||||
arg2 = jarg2;
|
||||
|
||||
lto_codegen_debug_options(arg1,(char const *)arg2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void* SWIGSTDCALL Ada_llvm_create_optimizer (
|
||||
)
|
||||
{
|
||||
void* jresult ;
|
||||
llvm_lto_t result;
|
||||
|
||||
result = (llvm_lto_t)llvm_create_optimizer();
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_llvm_destroy_optimizer (
|
||||
void* jarg1
|
||||
)
|
||||
{
|
||||
llvm_lto_t arg1 = (llvm_lto_t) 0 ;
|
||||
|
||||
arg1 = (llvm_lto_t)jarg1;
|
||||
|
||||
llvm_destroy_optimizer(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_llvm_read_object_file (
|
||||
void* jarg1
|
||||
,
|
||||
|
||||
char * jarg2
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
llvm_lto_t arg1 = (llvm_lto_t) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
llvm_lto_status_t result;
|
||||
|
||||
arg1 = (llvm_lto_t)jarg1;
|
||||
|
||||
arg2 = jarg2;
|
||||
|
||||
result = (llvm_lto_status_t)llvm_read_object_file(arg1,(char const *)arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_llvm_optimize_modules (
|
||||
void* jarg1
|
||||
,
|
||||
|
||||
char * jarg2
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
llvm_lto_t arg1 = (llvm_lto_t) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
llvm_lto_status_t result;
|
||||
|
||||
arg1 = (llvm_lto_t)jarg1;
|
||||
|
||||
arg2 = jarg2;
|
||||
|
||||
result = (llvm_lto_status_t)llvm_optimize_modules(arg1,(char const *)arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,138 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
with llvm;
|
||||
with Interfaces.C.Strings;
|
||||
|
||||
|
||||
package LLVM_Target.Binding is
|
||||
|
||||
LLVMBigEndian : constant := 0;
|
||||
LLVMLittleEndian : constant := 1;
|
||||
|
||||
procedure LLVMInitializeAllTargets;
|
||||
|
||||
function LLVMInitializeNativeTarget return Interfaces.C.int;
|
||||
|
||||
function LLVMCreateTargetData
|
||||
(StringRep : in Interfaces.C.Strings.chars_ptr)
|
||||
return LLVM_Target.LLVMTargetDataRef;
|
||||
|
||||
procedure LLVMAddTargetData
|
||||
(arg_2_1 : in LLVM_Target.LLVMTargetDataRef;
|
||||
arg_2_2 : in llvm.LLVMPassManagerRef);
|
||||
|
||||
function LLVMCopyStringRepOfTargetData
|
||||
(arg_1 : in LLVM_Target.LLVMTargetDataRef)
|
||||
return Interfaces.C.Strings.chars_ptr;
|
||||
|
||||
function LLVMByteOrder
|
||||
(arg_1 : in LLVM_Target.LLVMTargetDataRef)
|
||||
return LLVM_Target.LLVMByteOrdering;
|
||||
|
||||
function LLVMPointerSize
|
||||
(arg_1 : in LLVM_Target.LLVMTargetDataRef)
|
||||
return Interfaces.C.unsigned;
|
||||
|
||||
function LLVMIntPtrType
|
||||
(arg_1 : in LLVM_Target.LLVMTargetDataRef)
|
||||
return llvm.LLVMTypeRef;
|
||||
|
||||
function LLVMSizeOfTypeInBits
|
||||
(arg_2_1 : in LLVM_Target.LLVMTargetDataRef;
|
||||
arg_2_2 : in llvm.LLVMTypeRef)
|
||||
return Interfaces.C.Extensions.unsigned_long_long;
|
||||
|
||||
function LLVMStoreSizeOfType
|
||||
(arg_2_1 : in LLVM_Target.LLVMTargetDataRef;
|
||||
arg_2_2 : in llvm.LLVMTypeRef)
|
||||
return Interfaces.C.Extensions.unsigned_long_long;
|
||||
|
||||
function LLVMABISizeOfType
|
||||
(arg_2_1 : in LLVM_Target.LLVMTargetDataRef;
|
||||
arg_2_2 : in llvm.LLVMTypeRef)
|
||||
return Interfaces.C.Extensions.unsigned_long_long;
|
||||
|
||||
function LLVMABIAlignmentOfType
|
||||
(arg_2_1 : in LLVM_Target.LLVMTargetDataRef;
|
||||
arg_2_2 : in llvm.LLVMTypeRef)
|
||||
return Interfaces.C.unsigned;
|
||||
|
||||
function LLVMCallFrameAlignmentOfType
|
||||
(arg_2_1 : in LLVM_Target.LLVMTargetDataRef;
|
||||
arg_2_2 : in llvm.LLVMTypeRef)
|
||||
return Interfaces.C.unsigned;
|
||||
|
||||
function LLVMPreferredAlignmentOfType
|
||||
(arg_2_1 : in LLVM_Target.LLVMTargetDataRef;
|
||||
arg_2_2 : in llvm.LLVMTypeRef)
|
||||
return Interfaces.C.unsigned;
|
||||
|
||||
function LLVMPreferredAlignmentOfGlobal
|
||||
(arg_1 : in LLVM_Target.LLVMTargetDataRef;
|
||||
GlobalVar : in llvm.LLVMValueRef)
|
||||
return Interfaces.C.unsigned;
|
||||
|
||||
function LLVMElementAtOffset
|
||||
(arg_1 : in LLVM_Target.LLVMTargetDataRef;
|
||||
StructTy : in llvm.LLVMTypeRef;
|
||||
Offset : in Interfaces.C.Extensions.unsigned_long_long)
|
||||
return Interfaces.C.unsigned;
|
||||
|
||||
function LLVMOffsetOfElement
|
||||
(arg_1 : in LLVM_Target.LLVMTargetDataRef;
|
||||
StructTy : in llvm.LLVMTypeRef;
|
||||
Element : in Interfaces.C.unsigned)
|
||||
return Interfaces.C.Extensions.unsigned_long_long;
|
||||
|
||||
procedure LLVMInvalidateStructLayout
|
||||
(arg_1 : in LLVM_Target.LLVMTargetDataRef;
|
||||
StructTy : in llvm.LLVMTypeRef);
|
||||
|
||||
procedure LLVMDisposeTargetData
|
||||
(arg_1 : in LLVM_Target.LLVMTargetDataRef);
|
||||
|
||||
private
|
||||
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMInitializeAllTargets,
|
||||
"Ada_LLVMInitializeAllTargets");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMInitializeNativeTarget,
|
||||
"Ada_LLVMInitializeNativeTarget");
|
||||
pragma Import (C, LLVMCreateTargetData, "Ada_LLVMCreateTargetData");
|
||||
pragma Import (C, LLVMAddTargetData, "Ada_LLVMAddTargetData");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMCopyStringRepOfTargetData,
|
||||
"Ada_LLVMCopyStringRepOfTargetData");
|
||||
pragma Import (C, LLVMByteOrder, "Ada_LLVMByteOrder");
|
||||
pragma Import (C, LLVMPointerSize, "Ada_LLVMPointerSize");
|
||||
pragma Import (C, LLVMIntPtrType, "Ada_LLVMIntPtrType");
|
||||
pragma Import (C, LLVMSizeOfTypeInBits, "Ada_LLVMSizeOfTypeInBits");
|
||||
pragma Import (C, LLVMStoreSizeOfType, "Ada_LLVMStoreSizeOfType");
|
||||
pragma Import (C, LLVMABISizeOfType, "Ada_LLVMABISizeOfType");
|
||||
pragma Import (C, LLVMABIAlignmentOfType, "Ada_LLVMABIAlignmentOfType");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMCallFrameAlignmentOfType,
|
||||
"Ada_LLVMCallFrameAlignmentOfType");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMPreferredAlignmentOfType,
|
||||
"Ada_LLVMPreferredAlignmentOfType");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMPreferredAlignmentOfGlobal,
|
||||
"Ada_LLVMPreferredAlignmentOfGlobal");
|
||||
pragma Import (C, LLVMElementAtOffset, "Ada_LLVMElementAtOffset");
|
||||
pragma Import (C, LLVMOffsetOfElement, "Ada_LLVMOffsetOfElement");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMInvalidateStructLayout,
|
||||
"Ada_LLVMInvalidateStructLayout");
|
||||
pragma Import (C, LLVMDisposeTargetData, "Ada_LLVMDisposeTargetData");
|
||||
|
||||
end LLVM_Target.Binding;
|
@ -1,72 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
with Interfaces.C.Extensions;
|
||||
|
||||
|
||||
package LLVM_Target is
|
||||
|
||||
-- LLVMOpaqueTargetData
|
||||
--
|
||||
type LLVMOpaqueTargetData is new
|
||||
Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMOpaqueTargetData_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_Target.LLVMOpaqueTargetData;
|
||||
|
||||
type LLVMOpaqueTargetData_view is access all
|
||||
LLVM_Target.LLVMOpaqueTargetData;
|
||||
|
||||
-- LLVMTargetDataRef
|
||||
--
|
||||
type LLVMTargetDataRef is access all LLVM_Target.LLVMOpaqueTargetData;
|
||||
|
||||
type LLVMTargetDataRef_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_Target.LLVMTargetDataRef;
|
||||
|
||||
type LLVMTargetDataRef_view is access all LLVM_Target.LLVMTargetDataRef;
|
||||
|
||||
-- LLVMStructLayout
|
||||
--
|
||||
type LLVMStructLayout is new Interfaces.C.Extensions.opaque_structure_def;
|
||||
|
||||
type LLVMStructLayout_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_Target.LLVMStructLayout;
|
||||
|
||||
type LLVMStructLayout_view is access all LLVM_Target.LLVMStructLayout;
|
||||
|
||||
-- LLVMStructLayoutRef
|
||||
--
|
||||
type LLVMStructLayoutRef is access all LLVM_Target.LLVMStructLayout;
|
||||
|
||||
type LLVMStructLayoutRef_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_Target.LLVMStructLayoutRef;
|
||||
|
||||
type LLVMStructLayoutRef_view is access all LLVM_Target.LLVMStructLayoutRef;
|
||||
|
||||
-- TargetData
|
||||
--
|
||||
type TargetData is new Interfaces.C.Extensions.incomplete_class_def;
|
||||
|
||||
type TargetData_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_Target.TargetData;
|
||||
|
||||
type TargetData_view is access all LLVM_Target.TargetData;
|
||||
|
||||
-- LLVMByteOrdering
|
||||
--
|
||||
type LLVMByteOrdering is new Interfaces.C.int;
|
||||
|
||||
type LLVMByteOrdering_array is
|
||||
array (Interfaces.C.size_t range <>)
|
||||
of aliased LLVM_Target.LLVMByteOrdering;
|
||||
|
||||
type LLVMByteOrdering_view is access all LLVM_Target.LLVMByteOrdering;
|
||||
|
||||
|
||||
end LLVM_Target;
|
@ -1,720 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.36
|
||||
*
|
||||
* This file is not intended to be easily readable and contains a number of
|
||||
* coding conventions designed to improve portability and efficiency. Do not make
|
||||
* changes to this file unless you know what you are doing--modify the SWIG
|
||||
* interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
template<typename T> class SwigValueWrapper {
|
||||
T *tt;
|
||||
public:
|
||||
SwigValueWrapper() : tt(0) { }
|
||||
SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
|
||||
SwigValueWrapper(const T& t) : tt(new T(t)) { }
|
||||
~SwigValueWrapper() { delete tt; }
|
||||
SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
|
||||
operator T&() const { return *tt; }
|
||||
T *operator&() { return tt; }
|
||||
private:
|
||||
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
|
||||
};
|
||||
|
||||
template <typename T> T SwigValueInit() {
|
||||
return T();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* This section contains generic SWIG labels for method/variable
|
||||
* declarations/attributes, and other compiler dependent labels.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* template workaround for compilers that cannot correctly implement the C++ standard */
|
||||
#ifndef SWIGTEMPLATEDISAMBIGUATOR
|
||||
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# elif defined(__HP_aCC)
|
||||
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
|
||||
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# else
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* inline attribute */
|
||||
#ifndef SWIGINLINE
|
||||
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
|
||||
# define SWIGINLINE inline
|
||||
# else
|
||||
# define SWIGINLINE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* attribute recognised by some compilers to avoid 'unused' warnings */
|
||||
#ifndef SWIGUNUSED
|
||||
# if defined(__GNUC__)
|
||||
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
# elif defined(__ICC)
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGUNUSEDPARM
|
||||
# ifdef __cplusplus
|
||||
# define SWIGUNUSEDPARM(p)
|
||||
# else
|
||||
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* internal SWIG method */
|
||||
#ifndef SWIGINTERN
|
||||
# define SWIGINTERN static SWIGUNUSED
|
||||
#endif
|
||||
|
||||
/* internal inline SWIG method */
|
||||
#ifndef SWIGINTERNINLINE
|
||||
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
|
||||
#endif
|
||||
|
||||
/* exporting methods */
|
||||
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
# ifndef GCC_HASCLASSVISIBILITY
|
||||
# define GCC_HASCLASSVISIBILITY
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGEXPORT
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if defined(STATIC_LINKED)
|
||||
# define SWIGEXPORT
|
||||
# else
|
||||
# define SWIGEXPORT __declspec(dllexport)
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
||||
# define SWIGEXPORT __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define SWIGEXPORT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* calling conventions for Windows */
|
||||
#ifndef SWIGSTDCALL
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# define SWIGSTDCALL __stdcall
|
||||
# else
|
||||
# define SWIGSTDCALL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
||||
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
|
||||
# define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
|
||||
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
|
||||
# define _SCL_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
# define DllExport __declspec( dllexport )
|
||||
# define SWIGSTDCALL __stdcall
|
||||
#else
|
||||
# define DllExport
|
||||
# define SWIGSTDCALL
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <new>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Support for throwing Ada exceptions from C/C++ */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SWIG_AdaException,
|
||||
SWIG_AdaOutOfMemoryException,
|
||||
SWIG_AdaIndexOutOfRangeException,
|
||||
SWIG_AdaDivideByZeroException,
|
||||
SWIG_AdaArgumentOutOfRangeException,
|
||||
SWIG_AdaNullReferenceException
|
||||
} SWIG_AdaExceptionCodes;
|
||||
|
||||
|
||||
typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SWIG_AdaExceptionCodes code;
|
||||
SWIG_AdaExceptionCallback_t callback;
|
||||
}
|
||||
SWIG_AdaExceptions_t;
|
||||
|
||||
|
||||
static
|
||||
SWIG_AdaExceptions_t
|
||||
SWIG_ada_exceptions[] =
|
||||
{
|
||||
{ SWIG_AdaException, NULL },
|
||||
{ SWIG_AdaOutOfMemoryException, NULL },
|
||||
{ SWIG_AdaIndexOutOfRangeException, NULL },
|
||||
{ SWIG_AdaDivideByZeroException, NULL },
|
||||
{ SWIG_AdaArgumentOutOfRangeException, NULL },
|
||||
{ SWIG_AdaNullReferenceException, NULL }
|
||||
};
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg)
|
||||
{
|
||||
SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback;
|
||||
if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) {
|
||||
callback = SWIG_ada_exceptions[code].callback;
|
||||
}
|
||||
callback(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
|
||||
DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_Target (SWIG_AdaExceptionCallback_t systemException,
|
||||
SWIG_AdaExceptionCallback_t outOfMemory,
|
||||
SWIG_AdaExceptionCallback_t indexOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t divideByZero,
|
||||
SWIG_AdaExceptionCallback_t argumentOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t nullReference)
|
||||
{
|
||||
SWIG_ada_exceptions [SWIG_AdaException].callback = systemException;
|
||||
SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory;
|
||||
SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero;
|
||||
SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference;
|
||||
}
|
||||
|
||||
|
||||
/* Callback for returning strings to Ada without leaking memory */
|
||||
|
||||
typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *);
|
||||
static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL;
|
||||
|
||||
|
||||
|
||||
/* probably obsolete ...
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_Target(SWIG_AdaStringHelperCallback callback) {
|
||||
SWIG_ada_string_callback = callback;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Contract support */
|
||||
|
||||
#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else
|
||||
|
||||
|
||||
#define protected public
|
||||
#define private public
|
||||
|
||||
#include "llvm-c/Target.h"
|
||||
|
||||
|
||||
|
||||
// struct LLVMCtxt;
|
||||
|
||||
|
||||
#undef protected
|
||||
#undef private
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
DllExport void SWIGSTDCALL Ada_LLVMInitializeAllTargets (
|
||||
)
|
||||
{
|
||||
LLVMInitializeAllTargets();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMInitializeNativeTarget (
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int)LLVMInitializeNativeTarget();
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void * SWIGSTDCALL Ada_LLVMCreateTargetData (
|
||||
char * jarg1
|
||||
)
|
||||
{
|
||||
void * jresult ;
|
||||
char *arg1 = (char *) 0 ;
|
||||
LLVMTargetDataRef result;
|
||||
|
||||
arg1 = jarg1;
|
||||
|
||||
result = (LLVMTargetDataRef)LLVMCreateTargetData((char const *)arg1);
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddTargetData (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMPassManagerRef arg2 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
arg2 = (LLVMPassManagerRef)jarg2;
|
||||
|
||||
LLVMAddTargetData(arg1,arg2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport char * SWIGSTDCALL Ada_LLVMCopyStringRepOfTargetData (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
char * jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
char *result = 0 ;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
result = (char *)LLVMCopyStringRepOfTargetData(arg1);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport int SWIGSTDCALL Ada_LLVMByteOrder (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
int jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMByteOrdering result;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
result = (LLVMByteOrdering)LLVMByteOrder(arg1);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_LLVMPointerSize (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
result = (unsigned int)LLVMPointerSize(arg1);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void * SWIGSTDCALL Ada_LLVMIntPtrType (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
void * jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMTypeRef result;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
result = (LLVMTypeRef)LLVMIntPtrType(arg1);
|
||||
jresult = (void *) result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned long long SWIGSTDCALL Ada_LLVMSizeOfTypeInBits (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
unsigned long long jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMTypeRef arg2 = (LLVMTypeRef) 0 ;
|
||||
unsigned long long result;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
arg2 = (LLVMTypeRef)jarg2;
|
||||
|
||||
result = (unsigned long long)LLVMSizeOfTypeInBits(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned long long SWIGSTDCALL Ada_LLVMStoreSizeOfType (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
unsigned long long jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMTypeRef arg2 = (LLVMTypeRef) 0 ;
|
||||
unsigned long long result;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
arg2 = (LLVMTypeRef)jarg2;
|
||||
|
||||
result = (unsigned long long)LLVMStoreSizeOfType(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned long long SWIGSTDCALL Ada_LLVMABISizeOfType (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
unsigned long long jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMTypeRef arg2 = (LLVMTypeRef) 0 ;
|
||||
unsigned long long result;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
arg2 = (LLVMTypeRef)jarg2;
|
||||
|
||||
result = (unsigned long long)LLVMABISizeOfType(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_LLVMABIAlignmentOfType (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMTypeRef arg2 = (LLVMTypeRef) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
arg2 = (LLVMTypeRef)jarg2;
|
||||
|
||||
result = (unsigned int)LLVMABIAlignmentOfType(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_LLVMCallFrameAlignmentOfType (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMTypeRef arg2 = (LLVMTypeRef) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
arg2 = (LLVMTypeRef)jarg2;
|
||||
|
||||
result = (unsigned int)LLVMCallFrameAlignmentOfType(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_LLVMPreferredAlignmentOfType (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMTypeRef arg2 = (LLVMTypeRef) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
arg2 = (LLVMTypeRef)jarg2;
|
||||
|
||||
result = (unsigned int)LLVMPreferredAlignmentOfType(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_LLVMPreferredAlignmentOfGlobal (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMValueRef arg2 = (LLVMValueRef) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
arg2 = (LLVMValueRef)jarg2;
|
||||
|
||||
result = (unsigned int)LLVMPreferredAlignmentOfGlobal(arg1,arg2);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned int SWIGSTDCALL Ada_LLVMElementAtOffset (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
unsigned long long jarg3
|
||||
)
|
||||
{
|
||||
unsigned int jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMTypeRef arg2 = (LLVMTypeRef) 0 ;
|
||||
unsigned long long arg3 ;
|
||||
unsigned int result;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
arg2 = (LLVMTypeRef)jarg2;
|
||||
|
||||
|
||||
arg3 = (unsigned long long) jarg3;
|
||||
|
||||
|
||||
result = (unsigned int)LLVMElementAtOffset(arg1,arg2,arg3);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport unsigned long long SWIGSTDCALL Ada_LLVMOffsetOfElement (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
,
|
||||
|
||||
unsigned int jarg3
|
||||
)
|
||||
{
|
||||
unsigned long long jresult ;
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMTypeRef arg2 = (LLVMTypeRef) 0 ;
|
||||
unsigned int arg3 ;
|
||||
unsigned long long result;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
arg2 = (LLVMTypeRef)jarg2;
|
||||
|
||||
|
||||
arg3 = (unsigned int) jarg3;
|
||||
|
||||
|
||||
result = (unsigned long long)LLVMOffsetOfElement(arg1,arg2,arg3);
|
||||
jresult = result;
|
||||
|
||||
|
||||
|
||||
return jresult;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMInvalidateStructLayout (
|
||||
void * jarg1
|
||||
,
|
||||
|
||||
void * jarg2
|
||||
)
|
||||
{
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
LLVMTypeRef arg2 = (LLVMTypeRef) 0 ;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
arg2 = (LLVMTypeRef)jarg2;
|
||||
|
||||
LLVMInvalidateStructLayout(arg1,arg2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMDisposeTargetData (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ;
|
||||
|
||||
arg1 = (LLVMTargetDataRef)jarg1;
|
||||
|
||||
LLVMDisposeTargetData(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,206 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
with llvm;
|
||||
|
||||
|
||||
package LLVM_Transforms.Binding is
|
||||
|
||||
procedure LLVMAddArgumentPromotionPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddConstantMergePass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddDeadArgEliminationPass
|
||||
(PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddDeadTypeEliminationPass
|
||||
(PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddFunctionAttrsPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddFunctionInliningPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddGlobalDCEPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddGlobalOptimizerPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddIPConstantPropagationPass
|
||||
(PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddLowerSetJmpPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddPruneEHPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddRaiseAllocationsPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddStripDeadPrototypesPass
|
||||
(PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddStripSymbolsPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddAggressiveDCEPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddCFGSimplificationPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddCondPropagationPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddDeadStoreEliminationPass
|
||||
(PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddGVNPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddIndVarSimplifyPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddInstructionCombiningPass
|
||||
(PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddJumpThreadingPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddLICMPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddLoopDeletionPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddLoopIndexSplitPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddLoopRotatePass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddLoopUnrollPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddLoopUnswitchPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddMemCpyOptPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddPromoteMemoryToRegisterPass
|
||||
(PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddReassociatePass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddSCCPPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddScalarReplAggregatesPass
|
||||
(PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddSimplifyLibCallsPass (PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddTailCallEliminationPass
|
||||
(PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddConstantPropagationPass
|
||||
(PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
procedure LLVMAddDemoteMemoryToRegisterPass
|
||||
(PM : in llvm.LLVMPassManagerRef);
|
||||
|
||||
private
|
||||
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddArgumentPromotionPass,
|
||||
"Ada_LLVMAddArgumentPromotionPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddConstantMergePass,
|
||||
"Ada_LLVMAddConstantMergePass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddDeadArgEliminationPass,
|
||||
"Ada_LLVMAddDeadArgEliminationPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddDeadTypeEliminationPass,
|
||||
"Ada_LLVMAddDeadTypeEliminationPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddFunctionAttrsPass,
|
||||
"Ada_LLVMAddFunctionAttrsPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddFunctionInliningPass,
|
||||
"Ada_LLVMAddFunctionInliningPass");
|
||||
pragma Import (C, LLVMAddGlobalDCEPass, "Ada_LLVMAddGlobalDCEPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddGlobalOptimizerPass,
|
||||
"Ada_LLVMAddGlobalOptimizerPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddIPConstantPropagationPass,
|
||||
"Ada_LLVMAddIPConstantPropagationPass");
|
||||
pragma Import (C, LLVMAddLowerSetJmpPass, "Ada_LLVMAddLowerSetJmpPass");
|
||||
pragma Import (C, LLVMAddPruneEHPass, "Ada_LLVMAddPruneEHPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddRaiseAllocationsPass,
|
||||
"Ada_LLVMAddRaiseAllocationsPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddStripDeadPrototypesPass,
|
||||
"Ada_LLVMAddStripDeadPrototypesPass");
|
||||
pragma Import (C, LLVMAddStripSymbolsPass, "Ada_LLVMAddStripSymbolsPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddAggressiveDCEPass,
|
||||
"Ada_LLVMAddAggressiveDCEPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddCFGSimplificationPass,
|
||||
"Ada_LLVMAddCFGSimplificationPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddCondPropagationPass,
|
||||
"Ada_LLVMAddCondPropagationPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddDeadStoreEliminationPass,
|
||||
"Ada_LLVMAddDeadStoreEliminationPass");
|
||||
pragma Import (C, LLVMAddGVNPass, "Ada_LLVMAddGVNPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddIndVarSimplifyPass,
|
||||
"Ada_LLVMAddIndVarSimplifyPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddInstructionCombiningPass,
|
||||
"Ada_LLVMAddInstructionCombiningPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddJumpThreadingPass,
|
||||
"Ada_LLVMAddJumpThreadingPass");
|
||||
pragma Import (C, LLVMAddLICMPass, "Ada_LLVMAddLICMPass");
|
||||
pragma Import (C, LLVMAddLoopDeletionPass, "Ada_LLVMAddLoopDeletionPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddLoopIndexSplitPass,
|
||||
"Ada_LLVMAddLoopIndexSplitPass");
|
||||
pragma Import (C, LLVMAddLoopRotatePass, "Ada_LLVMAddLoopRotatePass");
|
||||
pragma Import (C, LLVMAddLoopUnrollPass, "Ada_LLVMAddLoopUnrollPass");
|
||||
pragma Import (C, LLVMAddLoopUnswitchPass, "Ada_LLVMAddLoopUnswitchPass");
|
||||
pragma Import (C, LLVMAddMemCpyOptPass, "Ada_LLVMAddMemCpyOptPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddPromoteMemoryToRegisterPass,
|
||||
"Ada_LLVMAddPromoteMemoryToRegisterPass");
|
||||
pragma Import (C, LLVMAddReassociatePass, "Ada_LLVMAddReassociatePass");
|
||||
pragma Import (C, LLVMAddSCCPPass, "Ada_LLVMAddSCCPPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddScalarReplAggregatesPass,
|
||||
"Ada_LLVMAddScalarReplAggregatesPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddSimplifyLibCallsPass,
|
||||
"Ada_LLVMAddSimplifyLibCallsPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddTailCallEliminationPass,
|
||||
"Ada_LLVMAddTailCallEliminationPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddConstantPropagationPass,
|
||||
"Ada_LLVMAddConstantPropagationPass");
|
||||
pragma Import
|
||||
(C,
|
||||
LLVMAddDemoteMemoryToRegisterPass,
|
||||
"Ada_LLVMAddDemoteMemoryToRegisterPass");
|
||||
|
||||
end LLVM_Transforms.Binding;
|
@ -1,6 +0,0 @@
|
||||
-- This file is generated by SWIG. Do *not* modify by hand.
|
||||
--
|
||||
|
||||
package LLVM_Transforms is
|
||||
|
||||
end LLVM_Transforms;
|
@ -1,828 +0,0 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.36
|
||||
*
|
||||
* This file is not intended to be easily readable and contains a number of
|
||||
* coding conventions designed to improve portability and efficiency. Do not make
|
||||
* changes to this file unless you know what you are doing--modify the SWIG
|
||||
* interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
template<typename T> class SwigValueWrapper {
|
||||
T *tt;
|
||||
public:
|
||||
SwigValueWrapper() : tt(0) { }
|
||||
SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
|
||||
SwigValueWrapper(const T& t) : tt(new T(t)) { }
|
||||
~SwigValueWrapper() { delete tt; }
|
||||
SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
|
||||
operator T&() const { return *tt; }
|
||||
T *operator&() { return tt; }
|
||||
private:
|
||||
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
|
||||
};
|
||||
|
||||
template <typename T> T SwigValueInit() {
|
||||
return T();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* This section contains generic SWIG labels for method/variable
|
||||
* declarations/attributes, and other compiler dependent labels.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* template workaround for compilers that cannot correctly implement the C++ standard */
|
||||
#ifndef SWIGTEMPLATEDISAMBIGUATOR
|
||||
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# elif defined(__HP_aCC)
|
||||
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
|
||||
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||
# else
|
||||
# define SWIGTEMPLATEDISAMBIGUATOR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* inline attribute */
|
||||
#ifndef SWIGINLINE
|
||||
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
|
||||
# define SWIGINLINE inline
|
||||
# else
|
||||
# define SWIGINLINE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* attribute recognised by some compilers to avoid 'unused' warnings */
|
||||
#ifndef SWIGUNUSED
|
||||
# if defined(__GNUC__)
|
||||
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
# elif defined(__ICC)
|
||||
# define SWIGUNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGUNUSEDPARM
|
||||
# ifdef __cplusplus
|
||||
# define SWIGUNUSEDPARM(p)
|
||||
# else
|
||||
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* internal SWIG method */
|
||||
#ifndef SWIGINTERN
|
||||
# define SWIGINTERN static SWIGUNUSED
|
||||
#endif
|
||||
|
||||
/* internal inline SWIG method */
|
||||
#ifndef SWIGINTERNINLINE
|
||||
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
|
||||
#endif
|
||||
|
||||
/* exporting methods */
|
||||
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
# ifndef GCC_HASCLASSVISIBILITY
|
||||
# define GCC_HASCLASSVISIBILITY
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGEXPORT
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# if defined(STATIC_LINKED)
|
||||
# define SWIGEXPORT
|
||||
# else
|
||||
# define SWIGEXPORT __declspec(dllexport)
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
||||
# define SWIGEXPORT __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define SWIGEXPORT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* calling conventions for Windows */
|
||||
#ifndef SWIGSTDCALL
|
||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# define SWIGSTDCALL __stdcall
|
||||
# else
|
||||
# define SWIGSTDCALL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
||||
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
|
||||
# define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
|
||||
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
|
||||
# define _SCL_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||
# define DllExport __declspec( dllexport )
|
||||
# define SWIGSTDCALL __stdcall
|
||||
#else
|
||||
# define DllExport
|
||||
# define SWIGSTDCALL
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <new>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Support for throwing Ada exceptions from C/C++ */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SWIG_AdaException,
|
||||
SWIG_AdaOutOfMemoryException,
|
||||
SWIG_AdaIndexOutOfRangeException,
|
||||
SWIG_AdaDivideByZeroException,
|
||||
SWIG_AdaArgumentOutOfRangeException,
|
||||
SWIG_AdaNullReferenceException
|
||||
} SWIG_AdaExceptionCodes;
|
||||
|
||||
|
||||
typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SWIG_AdaExceptionCodes code;
|
||||
SWIG_AdaExceptionCallback_t callback;
|
||||
}
|
||||
SWIG_AdaExceptions_t;
|
||||
|
||||
|
||||
static
|
||||
SWIG_AdaExceptions_t
|
||||
SWIG_ada_exceptions[] =
|
||||
{
|
||||
{ SWIG_AdaException, NULL },
|
||||
{ SWIG_AdaOutOfMemoryException, NULL },
|
||||
{ SWIG_AdaIndexOutOfRangeException, NULL },
|
||||
{ SWIG_AdaDivideByZeroException, NULL },
|
||||
{ SWIG_AdaArgumentOutOfRangeException, NULL },
|
||||
{ SWIG_AdaNullReferenceException, NULL }
|
||||
};
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg)
|
||||
{
|
||||
SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback;
|
||||
if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) {
|
||||
callback = SWIG_ada_exceptions[code].callback;
|
||||
}
|
||||
callback(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
|
||||
DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_Transforms (SWIG_AdaExceptionCallback_t systemException,
|
||||
SWIG_AdaExceptionCallback_t outOfMemory,
|
||||
SWIG_AdaExceptionCallback_t indexOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t divideByZero,
|
||||
SWIG_AdaExceptionCallback_t argumentOutOfRange,
|
||||
SWIG_AdaExceptionCallback_t nullReference)
|
||||
{
|
||||
SWIG_ada_exceptions [SWIG_AdaException].callback = systemException;
|
||||
SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory;
|
||||
SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero;
|
||||
SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange;
|
||||
SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference;
|
||||
}
|
||||
|
||||
|
||||
/* Callback for returning strings to Ada without leaking memory */
|
||||
|
||||
typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *);
|
||||
static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL;
|
||||
|
||||
|
||||
|
||||
/* probably obsolete ...
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_Transforms(SWIG_AdaStringHelperCallback callback) {
|
||||
SWIG_ada_string_callback = callback;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Contract support */
|
||||
|
||||
#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else
|
||||
|
||||
|
||||
#define protected public
|
||||
#define private public
|
||||
|
||||
#include "llvm-c/Transforms/IPO.h"
|
||||
#include "llvm-c/Transforms/Scalar.h"
|
||||
|
||||
|
||||
|
||||
// struct LLVMCtxt;
|
||||
|
||||
|
||||
#undef protected
|
||||
#undef private
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddArgumentPromotionPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddArgumentPromotionPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddConstantMergePass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddConstantMergePass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddDeadArgEliminationPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddDeadArgEliminationPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddDeadTypeEliminationPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddDeadTypeEliminationPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddFunctionAttrsPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddFunctionAttrsPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddFunctionInliningPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddFunctionInliningPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddGlobalDCEPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddGlobalDCEPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddGlobalOptimizerPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddGlobalOptimizerPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddIPConstantPropagationPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddIPConstantPropagationPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddLowerSetJmpPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddLowerSetJmpPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddPruneEHPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddPruneEHPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddRaiseAllocationsPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddRaiseAllocationsPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddStripDeadPrototypesPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddStripDeadPrototypesPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddStripSymbolsPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddStripSymbolsPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddAggressiveDCEPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddAggressiveDCEPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddCFGSimplificationPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddCFGSimplificationPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddCondPropagationPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddCondPropagationPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddDeadStoreEliminationPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddDeadStoreEliminationPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddGVNPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddGVNPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddIndVarSimplifyPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddIndVarSimplifyPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddInstructionCombiningPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddInstructionCombiningPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddJumpThreadingPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddJumpThreadingPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddLICMPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddLICMPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddLoopDeletionPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddLoopDeletionPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddLoopIndexSplitPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddLoopIndexSplitPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddLoopRotatePass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddLoopRotatePass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddLoopUnrollPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddLoopUnrollPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddLoopUnswitchPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddLoopUnswitchPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddMemCpyOptPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddMemCpyOptPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddPromoteMemoryToRegisterPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddPromoteMemoryToRegisterPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddReassociatePass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddReassociatePass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddSCCPPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddSCCPPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddScalarReplAggregatesPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddScalarReplAggregatesPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddSimplifyLibCallsPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddSimplifyLibCallsPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddTailCallEliminationPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddTailCallEliminationPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddConstantPropagationPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddConstantPropagationPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DllExport void SWIGSTDCALL Ada_LLVMAddDemoteMemoryToRegisterPass (
|
||||
void * jarg1
|
||||
)
|
||||
{
|
||||
LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ;
|
||||
|
||||
arg1 = (LLVMPassManagerRef)jarg1;
|
||||
|
||||
LLVMAddDemoteMemoryToRegisterPass(arg1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -73,8 +73,13 @@ Archive.EXE := $(strip $(OCAMLC) -cc $(CXX) $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG:%=%.
|
||||
endif
|
||||
|
||||
# Source files
|
||||
ifndef OcamlSources1
|
||||
OcamlSources1 := $(sort $(wildcard $(PROJ_SRC_DIR)/*.ml))
|
||||
endif
|
||||
|
||||
ifndef OcamlHeaders1
|
||||
OcamlHeaders1 := $(sort $(wildcard $(PROJ_SRC_DIR)/*.mli))
|
||||
endif
|
||||
|
||||
OcamlSources2 := $(filter-out $(ExcludeSources),$(OcamlSources1))
|
||||
OcamlHeaders2 := $(filter-out $(ExcludeHeaders),$(OcamlHeaders1))
|
||||
@ -352,11 +357,11 @@ $(OutputEXE): $(ToolEXE) $(OcamlDir)/.dir
|
||||
ifndef OCAMLOPT
|
||||
$(ToolEXE): $(ObjectsCMO) $(OcamlDir)/.dir
|
||||
$(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
|
||||
$(Verb) $(Archive.EXE) $@ $<
|
||||
$(Verb) $(Archive.EXE) $@ $(ObjectsCMO)
|
||||
else
|
||||
$(ToolEXE): $(ObjectsCMX) $(OcamlDir)/.dir
|
||||
$(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
|
||||
$(Verb) $(Archive.EXE) $@ $<
|
||||
$(Verb) $(Archive.EXE) $@ $(ObjectsCMX)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -18,12 +18,12 @@ exception Error of string
|
||||
memory buffer [mb] in the context [context]. Returns [m] if successful, or
|
||||
raises [Error msg] otherwise, where [msg] is a description of the error
|
||||
encountered. See the function [llvm::getBitcodeModule]. *)
|
||||
external get_module : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
|
||||
= "llvm_get_module"
|
||||
val get_module : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
|
||||
|
||||
|
||||
(** [parse_bitcode context mb] parses the bitcode for a new module [m] from the
|
||||
memory buffer [mb] in the context [context]. Returns [m] if successful, or
|
||||
raises [Error msg] otherwise, where [msg] is a description of the error
|
||||
encountered. See the function [llvm::ParseBitcodeFile]. *)
|
||||
external parse_bitcode : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
|
||||
= "llvm_parse_bitcode"
|
||||
val parse_bitcode : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
|
||||
|
||||
|
@ -25,58 +25,58 @@ module GenericValue: sig
|
||||
(** [of_float fpty n] boxes the float [n] in a float-valued generic value
|
||||
according to the floating point type [fpty]. See the fields
|
||||
[llvm::GenericValue::DoubleVal] and [llvm::GenericValue::FloatVal]. *)
|
||||
external of_float : Llvm.lltype -> float -> t = "llvm_genericvalue_of_float"
|
||||
val of_float : Llvm.lltype -> float -> t
|
||||
|
||||
(** [of_pointer v] boxes the pointer value [v] in a generic value. See the
|
||||
field [llvm::GenericValue::PointerVal]. *)
|
||||
external of_pointer : 'a -> t = "llvm_genericvalue_of_pointer"
|
||||
val of_pointer : 'a -> t
|
||||
|
||||
(** [of_int32 n w] boxes the int32 [i] in a generic value with the bitwidth
|
||||
[w]. See the field [llvm::GenericValue::IntVal]. *)
|
||||
external of_int32 : Llvm.lltype -> int32 -> t = "llvm_genericvalue_of_int32"
|
||||
val of_int32 : Llvm.lltype -> int32 -> t
|
||||
|
||||
(** [of_int n w] boxes the int [i] in a generic value with the bitwidth
|
||||
[w]. See the field [llvm::GenericValue::IntVal]. *)
|
||||
external of_int : Llvm.lltype -> int -> t = "llvm_genericvalue_of_int"
|
||||
val of_int : Llvm.lltype -> int -> t
|
||||
|
||||
(** [of_natint n w] boxes the native int [i] in a generic value with the
|
||||
bitwidth [w]. See the field [llvm::GenericValue::IntVal]. *)
|
||||
external of_nativeint : Llvm.lltype -> nativeint -> t
|
||||
= "llvm_genericvalue_of_nativeint"
|
||||
val of_nativeint : Llvm.lltype -> nativeint -> t
|
||||
|
||||
|
||||
(** [of_int64 n w] boxes the int64 [i] in a generic value with the bitwidth
|
||||
[w]. See the field [llvm::GenericValue::IntVal]. *)
|
||||
external of_int64 : Llvm.lltype -> int64 -> t = "llvm_genericvalue_of_int64"
|
||||
val of_int64 : Llvm.lltype -> int64 -> t
|
||||
|
||||
(** [as_float fpty gv] unboxes the floating point-valued generic value [gv] of
|
||||
floating point type [fpty]. See the fields [llvm::GenericValue::DoubleVal]
|
||||
and [llvm::GenericValue::FloatVal]. *)
|
||||
external as_float : Llvm.lltype -> t -> float = "llvm_genericvalue_as_float"
|
||||
val as_float : Llvm.lltype -> t -> float
|
||||
|
||||
(** [as_pointer gv] unboxes the pointer-valued generic value [gv]. See the
|
||||
field [llvm::GenericValue::PointerVal]. *)
|
||||
external as_pointer : t -> 'a = "llvm_genericvalue_as_pointer"
|
||||
val as_pointer : t -> 'a
|
||||
|
||||
(** [as_int32 gv] unboxes the integer-valued generic value [gv] as an [int32].
|
||||
Is invalid if [gv] has a bitwidth greater than 32 bits. See the field
|
||||
[llvm::GenericValue::IntVal]. *)
|
||||
external as_int32 : t -> int32 = "llvm_genericvalue_as_int32"
|
||||
val as_int32 : t -> int32
|
||||
|
||||
(** [as_int gv] unboxes the integer-valued generic value [gv] as an [int].
|
||||
Is invalid if [gv] has a bitwidth greater than the host bit width (but the
|
||||
most significant bit may be lost). See the field
|
||||
[llvm::GenericValue::IntVal]. *)
|
||||
external as_int : t -> int = "llvm_genericvalue_as_int"
|
||||
val as_int : t -> int
|
||||
|
||||
(** [as_natint gv] unboxes the integer-valued generic value [gv] as a
|
||||
[nativeint]. Is invalid if [gv] has a bitwidth greater than
|
||||
[nativeint]. See the field [llvm::GenericValue::IntVal]. *)
|
||||
external as_nativeint : t -> nativeint = "llvm_genericvalue_as_nativeint"
|
||||
val as_nativeint : t -> nativeint
|
||||
|
||||
(** [as_int64 gv] returns the integer-valued generic value [gv] as an [int64].
|
||||
Is invalid if [gv] has a bitwidth greater than [int64]. See the field
|
||||
[llvm::GenericValue::IntVal]. *)
|
||||
external as_int64 : t -> int64 = "llvm_genericvalue_as_int64"
|
||||
val as_int64 : t -> int64
|
||||
end
|
||||
|
||||
|
||||
@ -91,73 +91,73 @@ module ExecutionEngine: sig
|
||||
interpreter. Raises [Error msg] if an error occurrs. The execution engine
|
||||
is not garbage collected and must be destroyed with [dispose ee].
|
||||
See the function [llvm::EngineBuilder::create]. *)
|
||||
external create : Llvm.llmodule -> t = "llvm_ee_create"
|
||||
val create : Llvm.llmodule -> t
|
||||
|
||||
(** [create_interpreter m] creates a new interpreter, taking ownership of the
|
||||
module [m] if successful. Raises [Error msg] if an error occurrs. The
|
||||
execution engine is not garbage collected and must be destroyed with
|
||||
[dispose ee].
|
||||
See the function [llvm::EngineBuilder::create]. *)
|
||||
external create_interpreter : Llvm.llmodule -> t = "llvm_ee_create_interpreter"
|
||||
val create_interpreter : Llvm.llmodule -> t
|
||||
|
||||
(** [create_jit m optlevel] creates a new JIT (just-in-time compiler), taking
|
||||
ownership of the module [m] if successful with the desired optimization
|
||||
level [optlevel]. Raises [Error msg] if an error occurrs. The execution
|
||||
engine is not garbage collected and must be destroyed with [dispose ee].
|
||||
See the function [llvm::EngineBuilder::create]. *)
|
||||
external create_jit : Llvm.llmodule -> int -> t = "llvm_ee_create_jit"
|
||||
val create_jit : Llvm.llmodule -> int -> t
|
||||
|
||||
(** [dispose ee] releases the memory used by the execution engine and must be
|
||||
invoked to avoid memory leaks. *)
|
||||
external dispose : t -> unit = "llvm_ee_dispose"
|
||||
val dispose : t -> unit
|
||||
|
||||
(** [add_module m ee] adds the module [m] to the execution engine [ee]. *)
|
||||
external add_module : Llvm.llmodule -> t -> unit = "llvm_ee_add_module"
|
||||
val add_module : Llvm.llmodule -> t -> unit
|
||||
|
||||
(** [remove_module m ee] removes the module [m] from the execution engine
|
||||
[ee], disposing of [m] and the module referenced by [mp]. Raises
|
||||
[Error msg] if an error occurs. *)
|
||||
external remove_module : Llvm.llmodule -> t -> Llvm.llmodule
|
||||
= "llvm_ee_remove_module"
|
||||
val remove_module : Llvm.llmodule -> t -> Llvm.llmodule
|
||||
|
||||
|
||||
(** [find_function n ee] finds the function named [n] defined in any of the
|
||||
modules owned by the execution engine [ee]. Returns [None] if the function
|
||||
is not found and [Some f] otherwise. *)
|
||||
external find_function : string -> t -> Llvm.llvalue option
|
||||
= "llvm_ee_find_function"
|
||||
val find_function : string -> t -> Llvm.llvalue option
|
||||
|
||||
|
||||
(** [run_function f args ee] synchronously executes the function [f] with the
|
||||
arguments [args], which must be compatible with the parameter types. *)
|
||||
external run_function : Llvm.llvalue -> GenericValue.t array -> t ->
|
||||
val run_function : Llvm.llvalue -> GenericValue.t array -> t ->
|
||||
GenericValue.t
|
||||
= "llvm_ee_run_function"
|
||||
|
||||
|
||||
(** [run_static_ctors ee] executes the static constructors of each module in
|
||||
the execution engine [ee]. *)
|
||||
external run_static_ctors : t -> unit = "llvm_ee_run_static_ctors"
|
||||
val run_static_ctors : t -> unit
|
||||
|
||||
(** [run_static_dtors ee] executes the static destructors of each module in
|
||||
the execution engine [ee]. *)
|
||||
external run_static_dtors : t -> unit = "llvm_ee_run_static_dtors"
|
||||
val run_static_dtors : t -> unit
|
||||
|
||||
(** [run_function_as_main f args env ee] executes the function [f] as a main
|
||||
function, passing it [argv] and [argc] according to the string array
|
||||
[args], and [envp] as specified by the array [env]. Returns the integer
|
||||
return value of the function. *)
|
||||
external run_function_as_main : Llvm.llvalue -> string array ->
|
||||
val run_function_as_main : Llvm.llvalue -> string array ->
|
||||
(string * string) array -> t -> int
|
||||
= "llvm_ee_run_function_as_main"
|
||||
|
||||
|
||||
(** [free_machine_code f ee] releases the memory in the execution engine [ee]
|
||||
used to store the machine code for the function [f]. *)
|
||||
external free_machine_code : Llvm.llvalue -> t -> unit
|
||||
= "llvm_ee_free_machine_code"
|
||||
val free_machine_code : Llvm.llvalue -> t -> unit
|
||||
|
||||
|
||||
(** [target_data ee] is the target data owned by the execution engine
|
||||
[ee]. *)
|
||||
external target_data : t -> Llvm_target.TargetData.t
|
||||
= "LLVMGetExecutionEngineTargetData"
|
||||
val target_data : t -> Llvm_target.TargetData.t
|
||||
|
||||
end
|
||||
|
||||
external initialize_native_target : unit -> bool
|
||||
= "llvm_initialize_native_target"
|
||||
val initialize_native_target : unit -> bool
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -264,6 +264,11 @@ CAMLprim LLVMTypeRef llvm_ppc_fp128_type(LLVMContextRef Context) {
|
||||
return LLVMPPCFP128TypeInContext(Context);
|
||||
}
|
||||
|
||||
/* llcontext -> lltype */
|
||||
CAMLprim LLVMTypeRef llvm_x86mmx_type(LLVMContextRef Context) {
|
||||
return LLVMX86MMXTypeInContext(Context);
|
||||
}
|
||||
|
||||
/*--... Operations on function types .......................................--*/
|
||||
|
||||
/* lltype -> lltype array -> lltype */
|
||||
|
@ -39,9 +39,6 @@ external add_loop_unroll : [<Llvm.PassManager.any] Llvm.PassManager.t
|
||||
external add_loop_rotation : [<Llvm.PassManager.any] Llvm.PassManager.t
|
||||
-> unit
|
||||
= "llvm_add_loop_rotation"
|
||||
external add_loop_index_split : [<Llvm.PassManager.any] Llvm.PassManager.t
|
||||
-> unit
|
||||
= "llvm_add_loop_index_split"
|
||||
external
|
||||
add_memory_to_register_promotion : [<Llvm.PassManager.any] Llvm.PassManager.t
|
||||
-> unit
|
||||
|
@ -66,11 +66,6 @@ external add_loop_rotation : [<Llvm.PassManager.any] Llvm.PassManager.t
|
||||
-> unit
|
||||
= "llvm_add_loop_rotation"
|
||||
|
||||
(** See the [llvm::createLoopIndexSplitPass] function. *)
|
||||
external add_loop_index_split : [<Llvm.PassManager.any] Llvm.PassManager.t
|
||||
-> unit
|
||||
= "llvm_add_loop_index_split"
|
||||
|
||||
(** See the [llvm::createPromoteMemoryToRegisterPass] function. *)
|
||||
external
|
||||
add_memory_to_register_promotion : [<Llvm.PassManager.any] Llvm.PassManager.t
|
||||
|
@ -85,12 +85,6 @@ CAMLprim value llvm_add_loop_rotation(LLVMPassManagerRef PM) {
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
|
||||
CAMLprim value llvm_add_loop_index_split(LLVMPassManagerRef PM) {
|
||||
LLVMAddLoopIndexSplitPass(PM);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
|
||||
CAMLprim value llvm_add_memory_to_register_promotion(LLVMPassManagerRef PM) {
|
||||
LLVMAddPromoteMemoryToRegisterPass(PM);
|
||||
|
@ -1,8 +1,14 @@
|
||||
if( WIN32 AND NOT CYGWIN )
|
||||
# We consider Cygwin as another Unix
|
||||
set(PURE_WINDOWS 1)
|
||||
endif()
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CheckLibraryExists)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(TestBigEndian)
|
||||
|
||||
if( UNIX AND NOT BEOS )
|
||||
# Used by check_symbol_exists:
|
||||
@ -30,6 +36,7 @@ endfunction()
|
||||
# include checks
|
||||
check_include_file(argz.h HAVE_ARGZ_H)
|
||||
check_include_file(assert.h HAVE_ASSERT_H)
|
||||
check_include_file(ctype.h HAVE_CTYPE_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)
|
||||
@ -44,7 +51,7 @@ 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)
|
||||
if( NOT LLVM_ON_WIN32 )
|
||||
if( NOT PURE_WINDOWS )
|
||||
check_include_file(pthread.h HAVE_PTHREAD_H)
|
||||
endif()
|
||||
check_include_file(setjmp.h HAVE_SETJMP_H)
|
||||
@ -53,6 +60,7 @@ 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(string.h HAVE_STRING_H)
|
||||
check_include_file(strings.h HAVE_STRINGS_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/ioctl.h HAVE_SYS_IOCTL_H)
|
||||
@ -63,15 +71,19 @@ 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(sys/uio.h HAVE_SYS_UIO_H)
|
||||
check_include_file(sys/wait.h HAVE_SYS_WAIT_H)
|
||||
check_include_file(termios.h HAVE_TERMIOS_H)
|
||||
check_include_file(unistd.h HAVE_UNISTD_H)
|
||||
check_include_file(utime.h HAVE_UTIME_H)
|
||||
check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H)
|
||||
check_include_file(windows.h HAVE_WINDOWS_H)
|
||||
check_include_file(fenv.h HAVE_FENV_H)
|
||||
check_include_file(mach/mach.h HAVE_MACH_MACH_H)
|
||||
check_include_file(mach-o/dyld.h HAVE_MACH_O_DYLD_H)
|
||||
|
||||
# library checks
|
||||
if( NOT LLVM_ON_WIN32 )
|
||||
if( NOT PURE_WINDOWS )
|
||||
check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
|
||||
check_library_exists(pthread pthread_getspecific "" HAVE_PTHREAD_GETSPECIFIC)
|
||||
check_library_exists(pthread pthread_rwlock_init "" HAVE_PTHREAD_RWLOCK_INIT)
|
||||
@ -83,6 +95,7 @@ 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_function_exists(isatty HAVE_ISATTY)
|
||||
check_symbol_exists(index strings.h HAVE_INDEX)
|
||||
check_symbol_exists(isinf cmath HAVE_ISINF_IN_CMATH)
|
||||
check_symbol_exists(isinf math.h HAVE_ISINF_IN_MATH_H)
|
||||
check_symbol_exists(finite ieeefp.h HAVE_FINITE_IN_IEEEFP_H)
|
||||
@ -90,6 +103,16 @@ check_symbol_exists(isnan cmath HAVE_ISNAN_IN_CMATH)
|
||||
check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H)
|
||||
check_symbol_exists(ceilf math.h HAVE_CEILF)
|
||||
check_symbol_exists(floorf math.h HAVE_FLOORF)
|
||||
check_symbol_exists(fmodf math.h HAVE_FMODF)
|
||||
if( HAVE_SETJMP_H )
|
||||
check_symbol_exists(longjmp setjmp.h HAVE_LONGJMP)
|
||||
check_symbol_exists(setjmp setjmp.h HAVE_SETJMP)
|
||||
check_symbol_exists(siglongjmp setjmp.h HAVE_SIGLONGJMP)
|
||||
check_symbol_exists(sigsetjmp setjmp.h HAVE_SIGSETJMP)
|
||||
endif()
|
||||
if( HAVE_SYS_UIO_H )
|
||||
check_symbol_exists(writev sys/uio.h HAVE_WRITEV)
|
||||
endif()
|
||||
check_symbol_exists(nearbyintf math.h HAVE_NEARBYINTF)
|
||||
check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
|
||||
check_symbol_exists(malloc_zone_statistics malloc/malloc.h
|
||||
@ -97,15 +120,78 @@ check_symbol_exists(malloc_zone_statistics malloc/malloc.h
|
||||
check_symbol_exists(mkdtemp "stdlib.h;unistd.h" HAVE_MKDTEMP)
|
||||
check_symbol_exists(mkstemp "stdlib.h;unistd.h" HAVE_MKSTEMP)
|
||||
check_symbol_exists(mktemp "stdlib.h;unistd.h" HAVE_MKTEMP)
|
||||
if( NOT LLVM_ON_WIN32 )
|
||||
check_symbol_exists(closedir "sys/types.h;dirent.h" HAVE_CLOSEDIR)
|
||||
check_symbol_exists(opendir "sys/types.h;dirent.h" HAVE_OPENDIR)
|
||||
check_symbol_exists(readdir "sys/types.h;dirent.h" HAVE_READDIR)
|
||||
check_symbol_exists(getcwd unistd.h HAVE_GETCWD)
|
||||
check_symbol_exists(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
|
||||
check_symbol_exists(getrlimit "sys/types.h;sys/time.h;sys/resource.h" HAVE_GETRLIMIT)
|
||||
check_symbol_exists(rindex strings.h HAVE_RINDEX)
|
||||
check_symbol_exists(strchr string.h HAVE_STRCHR)
|
||||
check_symbol_exists(strcmp string.h HAVE_STRCMP)
|
||||
check_symbol_exists(strdup string.h HAVE_STRDUP)
|
||||
check_symbol_exists(strrchr string.h HAVE_STRRCHR)
|
||||
if( NOT PURE_WINDOWS )
|
||||
check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
|
||||
endif()
|
||||
check_symbol_exists(sbrk unistd.h HAVE_SBRK)
|
||||
check_symbol_exists(srand48 stdlib.h HAVE_RAND48_SRAND48)
|
||||
if( HAVE_RAND48_SRAND48 )
|
||||
check_symbol_exists(lrand48 stdlib.h HAVE_RAND48_LRAND48)
|
||||
if( HAVE_RAND48_LRAND48 )
|
||||
check_symbol_exists(drand48 stdlib.h HAVE_RAND48_DRAND48)
|
||||
if( HAVE_RAND48_DRAND48 )
|
||||
set(HAVE_RAND48 1 CACHE INTERNAL "are srand48/lrand48/drand48 available?")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
|
||||
check_symbol_exists(strtoq stdlib.h HAVE_STRTOQ)
|
||||
check_symbol_exists(strerror string.h HAVE_STRERROR)
|
||||
check_symbol_exists(strerror_r string.h HAVE_STRERROR_R)
|
||||
check_symbol_exists(strerror_s string.h HAVE_STRERROR_S)
|
||||
check_symbol_exists(strerror_s string.h HAVE_DECL_STRERROR_S)
|
||||
check_symbol_exists(memcpy string.h HAVE_MEMCPY)
|
||||
check_symbol_exists(memmove string.h HAVE_MEMMOVE)
|
||||
check_symbol_exists(setenv stdlib.h HAVE_SETENV)
|
||||
if( PURE_WINDOWS )
|
||||
check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S)
|
||||
|
||||
check_function_exists(_alloca HAVE__ALLOCA)
|
||||
check_function_exists(__alloca HAVE___ALLOCA)
|
||||
check_function_exists(__chkstk HAVE___CHKSTK)
|
||||
check_function_exists(___chkstk HAVE____CHKSTK)
|
||||
|
||||
check_function_exists(__ashldi3 HAVE___ASHLDI3)
|
||||
check_function_exists(__ashrdi3 HAVE___ASHRDI3)
|
||||
check_function_exists(__divdi3 HAVE___DIVDI3)
|
||||
check_function_exists(__fixdfdi HAVE___FIXDFDI)
|
||||
check_function_exists(__fixsfdi HAVE___FIXSFDI)
|
||||
check_function_exists(__floatdidf HAVE___FLOATDIDF)
|
||||
check_function_exists(__lshrdi3 HAVE___LSHRDI3)
|
||||
check_function_exists(__moddi3 HAVE___MODDI3)
|
||||
check_function_exists(__udivdi3 HAVE___UDIVDI3)
|
||||
check_function_exists(__umoddi3 HAVE___UMODDI3)
|
||||
|
||||
check_function_exists(__main HAVE___MAIN)
|
||||
check_function_exists(__cmpdi2 HAVE___CMPDI2)
|
||||
endif()
|
||||
if( HAVE_ARGZ_H )
|
||||
check_symbol_exists(argz_append argz.h HAVE_ARGZ_APPEND)
|
||||
check_symbol_exists(argz_create_sep argz.h HAVE_ARGZ_CREATE_SEP)
|
||||
check_symbol_exists(argz_insert argz.h HAVE_ARGZ_INSERT)
|
||||
check_symbol_exists(argz_next argz.h HAVE_ARGZ_NEXT)
|
||||
check_symbol_exists(argz_stringify argz.h HAVE_ARGZ_STRINGIFY)
|
||||
endif()
|
||||
if( HAVE_DLFCN_H )
|
||||
if( HAVE_LIBDL )
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES dl)
|
||||
endif()
|
||||
check_symbol_exists(dlerror dlfcn.h HAVE_DLERROR)
|
||||
check_symbol_exists(dlopen dlfcn.h HAVE_DLOPEN)
|
||||
if( HAVE_LIBDL )
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES dl)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC)
|
||||
if( LLVM_USING_GLIBC )
|
||||
@ -130,8 +216,10 @@ if (HAVE_STDINT_H)
|
||||
set(headers ${headers} "stdint.h")
|
||||
endif()
|
||||
|
||||
check_type_exists(int64_t "${headers}" HAVE_INT64_T)
|
||||
check_type_exists(uint64_t "${headers}" HAVE_UINT64_T)
|
||||
check_type_exists(u_int64_t "${headers}" HAVE_U_INT64_T)
|
||||
check_type_exists(error_t errno.h HAVE_ERROR_T)
|
||||
|
||||
# available programs checks
|
||||
function(llvm_find_program name)
|
||||
@ -154,16 +242,48 @@ llvm_find_program(fdp)
|
||||
llvm_find_program(dot)
|
||||
llvm_find_program(dotty)
|
||||
|
||||
if( LLVM_ENABLE_FFI )
|
||||
find_path(FFI_INCLUDE_PATH ffi.h PATHS ${FFI_INCLUDE_DIR})
|
||||
if( FFI_INCLUDE_PATH )
|
||||
set(FFI_HEADER ffi.h CACHE INTERNAL "")
|
||||
set(HAVE_FFI_H 1 CACHE INTERNAL "")
|
||||
else()
|
||||
find_path(FFI_INCLUDE_PATH ffi/ffi.h PATHS ${FFI_INCLUDE_DIR})
|
||||
if( FFI_INCLUDE_PATH )
|
||||
set(FFI_HEADER ffi/ffi.h CACHE INTERNAL "")
|
||||
set(HAVE_FFI_FFI_H 1 CACHE INTERNAL "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( NOT FFI_HEADER )
|
||||
message(FATAL_ERROR "libffi includes are not found.")
|
||||
endif()
|
||||
|
||||
find_library(FFI_LIBRARY_PATH ffi PATHS ${FFI_LIBRARY_DIR})
|
||||
if( NOT FFI_LIBRARY_PATH )
|
||||
message(FATAL_ERROR "libffi is not found.")
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${FFI_LIBRARY_PATH})
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES ${FFI_INCLUDE_PATH})
|
||||
check_symbol_exists(ffi_call ${FFI_HEADER} HAVE_FFI_CALL)
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${FFI_INCLUDE_PATH})
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${FFI_LIBRARY_PATH})
|
||||
endif( LLVM_ENABLE_FFI )
|
||||
|
||||
# Define LLVM_MULTITHREADED if gcc atomic builtins exists.
|
||||
include(CheckAtomic)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
# On windows all code is position-independent and mingw warns if -fPIC
|
||||
# is in the command-line.
|
||||
if( NOT WIN32 )
|
||||
check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG)
|
||||
if( LLVM_ENABLE_PIC )
|
||||
set(ENABLE_PIC 1)
|
||||
else()
|
||||
set(ENABLE_PIC 0)
|
||||
endif()
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
check_cxx_compiler_flag("-Wno-variadic-macros" SUPPORTS_NO_VARIADIC_MACROS_FLAG)
|
||||
|
||||
include(GetTargetTriple)
|
||||
get_target_triple(LLVM_HOSTTRIPLE)
|
||||
|
||||
@ -194,22 +314,20 @@ elseif (LLVM_NATIVE_ARCH MATCHES "arm")
|
||||
set(LLVM_NATIVE_ARCH ARM)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "mips")
|
||||
set(LLVM_NATIVE_ARCH Mips)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "pic16")
|
||||
set(LLVM_NATIVE_ARCH "PIC16")
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "xcore")
|
||||
set(LLVM_NATIVE_ARCH XCore)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "msp430")
|
||||
set(LLVM_NATIVE_ARCH MSP430)
|
||||
else ()
|
||||
message(STATUS
|
||||
message(STATUS
|
||||
"Unknown architecture ${LLVM_NATIVE_ARCH}; lli will not JIT code")
|
||||
set(LLVM_NATIVE_ARCH)
|
||||
endif ()
|
||||
|
||||
|
||||
if (LLVM_NATIVE_ARCH)
|
||||
list(FIND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH} NATIVE_ARCH_IDX)
|
||||
if (NATIVE_ARCH_IDX EQUAL -1)
|
||||
message(STATUS
|
||||
message(STATUS
|
||||
"Native target ${LLVM_NATIVE_ARCH} is not selected; lli will not JIT code")
|
||||
set(LLVM_NATIVE_ARCH)
|
||||
else ()
|
||||
@ -263,19 +381,3 @@ else( ENABLE_THREADS )
|
||||
endif()
|
||||
|
||||
set(LLVM_PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
configure_file(
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake
|
||||
${LLVM_BINARY_DIR}/include/llvm/Config/config.h
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/llvm-config.h.cmake
|
||||
${LLVM_BINARY_DIR}/include/llvm/Config/llvm-config.h
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/System/DataTypes.h.cmake
|
||||
${LLVM_BINARY_DIR}/include/llvm/System/DataTypes.h
|
||||
)
|
||||
|
||||
|
@ -4,11 +4,17 @@ include(LLVMConfig)
|
||||
macro(add_llvm_library name)
|
||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
||||
add_library( ${name} ${ALL_FILES} )
|
||||
set( llvm_libs ${llvm_libs} ${name} PARENT_SCOPE)
|
||||
set( llvm_lib_targets ${llvm_lib_targets} ${name} PARENT_SCOPE )
|
||||
set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
|
||||
set_property( GLOBAL APPEND PROPERTY LLVM_LIB_TARGETS ${name} )
|
||||
if( LLVM_COMMON_DEPENDS )
|
||||
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
|
||||
endif( LLVM_COMMON_DEPENDS )
|
||||
|
||||
if( BUILD_SHARED_LIBS )
|
||||
get_system_libs(sl)
|
||||
target_link_libraries( ${name} ${sl} )
|
||||
endif()
|
||||
|
||||
install(TARGETS ${name}
|
||||
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
||||
@ -23,12 +29,20 @@ endmacro(add_llvm_library name)
|
||||
|
||||
|
||||
macro(add_llvm_loadable_module name)
|
||||
if( NOT LLVM_ON_UNIX )
|
||||
if( NOT LLVM_ON_UNIX OR CYGWIN )
|
||||
message(STATUS "Loadable modules not supported on this platform.
|
||||
${name} ignored.")
|
||||
# Add empty "phony" target
|
||||
add_custom_target(${name})
|
||||
else()
|
||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
||||
add_library( ${name} MODULE ${ALL_FILES} )
|
||||
if (MODULE)
|
||||
set(libkind MODULE)
|
||||
else()
|
||||
set(libkind SHARED)
|
||||
endif()
|
||||
|
||||
add_library( ${name} ${libkind} ${ALL_FILES} )
|
||||
set_target_properties( ${name} PROPERTIES PREFIX "" )
|
||||
|
||||
if (APPLE)
|
||||
@ -60,13 +74,15 @@ macro(add_llvm_executable name)
|
||||
if( LLVM_LINK_COMPONENTS )
|
||||
llvm_config(${name} ${LLVM_LINK_COMPONENTS})
|
||||
endif( LLVM_LINK_COMPONENTS )
|
||||
get_system_libs(llvm_system_libs)
|
||||
if( llvm_system_libs )
|
||||
target_link_libraries(${name} ${llvm_system_libs})
|
||||
endif()
|
||||
if( LLVM_COMMON_DEPENDS )
|
||||
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
|
||||
endif( LLVM_COMMON_DEPENDS )
|
||||
if( NOT MINGW )
|
||||
get_system_libs(llvm_system_libs)
|
||||
if( llvm_system_libs )
|
||||
target_link_libraries(${name} ${llvm_system_libs})
|
||||
endif()
|
||||
endif()
|
||||
endmacro(add_llvm_executable name)
|
||||
|
||||
|
||||
@ -105,5 +121,5 @@ macro(add_llvm_target target_name)
|
||||
if ( TABLEGEN_OUTPUT )
|
||||
add_dependencies(LLVM${target_name} ${target_name}Table_gen)
|
||||
endif (TABLEGEN_OUTPUT)
|
||||
set(CURRENT_LLVM_TARGET LLVM${target_name} PARENT_SCOPE)
|
||||
set( CURRENT_LLVM_TARGET LLVM${target_name} )
|
||||
endmacro(add_llvm_target)
|
||||
|
@ -1,11 +1,13 @@
|
||||
# There is no clear way of keeping track of compiler command-line
|
||||
# options chosen via `add_definitions', so we need our own method for
|
||||
# using it on tools/llvm-config/CMakeLists.txt.
|
||||
|
||||
# Beware that there is no implementation of remove_llvm_definitions.
|
||||
|
||||
macro(add_llvm_definitions)
|
||||
set(LLVM_DEFINITIONS "${LLVM_DEFINITIONS} ${ARGN}")
|
||||
add_definitions( ${ARGN} )
|
||||
endmacro(add_llvm_definitions)
|
||||
|
||||
# There is no clear way of keeping track of compiler command-line
|
||||
# options chosen via `add_definitions', so we need our own method for
|
||||
# using it on tools/llvm-config/CMakeLists.txt.
|
||||
|
||||
# Beware that there is no implementation of remove_llvm_definitions.
|
||||
|
||||
macro(add_llvm_definitions)
|
||||
# We don't want no semicolons on LLVM_DEFINITIONS:
|
||||
foreach(arg ${ARGN})
|
||||
set(LLVM_DEFINITIONS "${LLVM_DEFINITIONS} ${arg}")
|
||||
endforeach(arg)
|
||||
add_definitions( ${ARGN} )
|
||||
endmacro(add_llvm_definitions)
|
||||
|
@ -1,5 +1,8 @@
|
||||
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/share/llvm/cmake")
|
||||
|
||||
get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
|
||||
get_property(llvm_lib_targets GLOBAL PROPERTY LLVM_LIB_TARGETS)
|
||||
|
||||
configure_file(
|
||||
LLVM.cmake
|
||||
${llvm_cmake_builddir}/LLVM.cmake
|
||||
@ -10,3 +13,21 @@ install(FILES
|
||||
LLVMConfig.cmake
|
||||
LLVMLibDeps.cmake
|
||||
DESTINATION share/llvm/cmake)
|
||||
|
||||
install(DIRECTORY .
|
||||
DESTINATION share/llvm/cmake
|
||||
FILES_MATCHING PATTERN *.cmake
|
||||
PATTERN .svn EXCLUDE
|
||||
PATTERN LLVM.cmake EXCLUDE
|
||||
PATTERN LLVMConfig.cmake EXCLUDE
|
||||
PATTERN LLVMLibDeps.cmake EXCLUDE
|
||||
PATTERN FindBison.cmake EXCLUDE
|
||||
PATTERN GetTargetTriple.cmake EXCLUDE
|
||||
PATTERN VersionFromVCS.cmake EXCLUDE
|
||||
PATTERN CheckAtomic.cmake EXCLUDE)
|
||||
|
||||
install(FILES
|
||||
${llvm_cmake_builddir}/LLVM.cmake
|
||||
LLVMConfig.cmake
|
||||
LLVMLibDeps.cmake
|
||||
DESTINATION share/llvm/cmake)
|
||||
|
@ -1,26 +1,26 @@
|
||||
|
||||
if( ${LLVM_TABLEGEN} STREQUAL "tblgen" )
|
||||
set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native")
|
||||
set(LLVM_TABLEGEN_EXE "${CX_NATIVE_TG_DIR}/bin/tblgen")
|
||||
|
||||
add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR}
|
||||
COMMENT "Creating ${CX_NATIVE_TG_DIR}...")
|
||||
|
||||
add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt
|
||||
COMMAND ${CMAKE_COMMAND} -UMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
|
||||
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}
|
||||
DEPENDS ${CX_NATIVE_TG_DIR}
|
||||
COMMENT "Configuring native TableGen...")
|
||||
|
||||
add_custom_command(OUTPUT ${LLVM_TABLEGEN_EXE}
|
||||
COMMAND ${CMAKE_BUILD_TOOL}
|
||||
DEPENDS ${CX_NATIVE_TG_DIR}/CMakeCache.txt
|
||||
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}/utils/TableGen
|
||||
COMMENT "Building native TableGen...")
|
||||
add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN_EXE})
|
||||
|
||||
add_dependencies(tblgen NativeTableGen)
|
||||
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CX_NATIVE_TG_DIR})
|
||||
endif()
|
||||
|
||||
if( ${LLVM_TABLEGEN} STREQUAL "tblgen" )
|
||||
set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native")
|
||||
set(LLVM_TABLEGEN_EXE "${CX_NATIVE_TG_DIR}/bin/tblgen")
|
||||
|
||||
add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR}
|
||||
COMMENT "Creating ${CX_NATIVE_TG_DIR}...")
|
||||
|
||||
add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt
|
||||
COMMAND ${CMAKE_COMMAND} -UMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
|
||||
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}
|
||||
DEPENDS ${CX_NATIVE_TG_DIR}
|
||||
COMMENT "Configuring native TableGen...")
|
||||
|
||||
add_custom_command(OUTPUT ${LLVM_TABLEGEN_EXE}
|
||||
COMMAND ${CMAKE_BUILD_TOOL}
|
||||
DEPENDS ${CX_NATIVE_TG_DIR}/CMakeCache.txt
|
||||
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}/utils/TableGen
|
||||
COMMENT "Building native TableGen...")
|
||||
add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN_EXE})
|
||||
|
||||
add_dependencies(tblgen NativeTableGen)
|
||||
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CX_NATIVE_TG_DIR})
|
||||
endif()
|
||||
|
@ -9,7 +9,11 @@ function( get_target_triple var )
|
||||
set( value "i686-pc-win32" )
|
||||
endif()
|
||||
elseif( MINGW AND NOT MSYS )
|
||||
set( value "i686-pc-mingw32" )
|
||||
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
set( value "x86_64-w64-mingw32" )
|
||||
else()
|
||||
set( value "i686-pc-mingw32" )
|
||||
endif()
|
||||
else( MSVC )
|
||||
set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess)
|
||||
execute_process(COMMAND sh ${config_guess}
|
||||
|
161
cmake/modules/HandleLLVMOptions.cmake
Normal file
161
cmake/modules/HandleLLVMOptions.cmake
Normal file
@ -0,0 +1,161 @@
|
||||
include(AddLLVMDefinitions)
|
||||
|
||||
# Run-time build mode; It is used for unittests.
|
||||
if(MSVC_IDE)
|
||||
# Expect "$(Configuration)", "$(OutDir)", etc.
|
||||
# It is expanded by msbuild or similar.
|
||||
set(RUNTIME_BUILD_MODE "${CMAKE_CFG_INTDIR}")
|
||||
elseif(NOT CMAKE_BUILD_TYPE STREQUAL "")
|
||||
# Expect "Release" "Debug", etc.
|
||||
# Or unittests could not run.
|
||||
set(RUNTIME_BUILD_MODE ${CMAKE_BUILD_TYPE})
|
||||
else()
|
||||
# It might be "."
|
||||
set(RUNTIME_BUILD_MODE "${CMAKE_CFG_INTDIR}")
|
||||
endif()
|
||||
|
||||
set(LIT_ARGS_DEFAULT "-sv")
|
||||
if (MSVC OR XCODE)
|
||||
set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
|
||||
endif()
|
||||
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}"
|
||||
CACHE STRING "Default options for lit")
|
||||
|
||||
if( LLVM_ENABLE_ASSERTIONS )
|
||||
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
||||
if( NOT MSVC )
|
||||
add_definitions( -D_DEBUG )
|
||||
endif()
|
||||
# On Release builds cmake automatically defines NDEBUG, so we
|
||||
# explicitly undefine it:
|
||||
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
|
||||
add_definitions( -UNDEBUG )
|
||||
endif()
|
||||
else()
|
||||
if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
|
||||
if( NOT MSVC_IDE AND NOT XCODE )
|
||||
add_definitions( -DNDEBUG )
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(CYGWIN)
|
||||
set(LLVM_ON_WIN32 0)
|
||||
set(LLVM_ON_UNIX 1)
|
||||
else(CYGWIN)
|
||||
set(LLVM_ON_WIN32 1)
|
||||
set(LLVM_ON_UNIX 0)
|
||||
|
||||
# This is effective only on Win32 hosts to use gnuwin32 tools.
|
||||
set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools")
|
||||
endif(CYGWIN)
|
||||
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)
|
||||
if(APPLE)
|
||||
set(LTDL_SHLIB_EXT ".dylib")
|
||||
else(APPLE)
|
||||
set(LTDL_SHLIB_EXT ".so")
|
||||
endif(APPLE)
|
||||
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( LLVM_ENABLE_PIC )
|
||||
if( XCODE )
|
||||
# Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
|
||||
# know how to disable this, so just force ENABLE_PIC off for now.
|
||||
message(WARNING "-fPIC not supported with Xcode.")
|
||||
elseif( WIN32 )
|
||||
# On Windows all code is PIC. MinGW warns if -fPIC is used.
|
||||
else()
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG)
|
||||
if( SUPPORTS_FPIC_FLAG )
|
||||
message(STATUS "Building with -fPIC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
else( SUPPORTS_FPIC_FLAG )
|
||||
message(WARNING "-fPIC not supported.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
|
||||
# TODO: support other platforms and toolchains.
|
||||
option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
|
||||
if( LLVM_BUILD_32_BITS )
|
||||
message(STATUS "Building 32 bits executables and libraries.")
|
||||
add_llvm_definitions( -m32 )
|
||||
list(APPEND CMAKE_EXE_LINKER_FLAGS -m32)
|
||||
list(APPEND CMAKE_SHARED_LINKER_FLAGS -m32)
|
||||
endif( LLVM_BUILD_32_BITS )
|
||||
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
|
||||
|
||||
if( MSVC )
|
||||
include(ChooseMSVCCRT)
|
||||
|
||||
# Add definitions that make MSVC much less annoying.
|
||||
add_llvm_definitions(
|
||||
# For some reason MS wants to deprecate a bunch of standard functions...
|
||||
-D_CRT_SECURE_NO_DEPRECATE
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
-D_CRT_NONSTDC_NO_DEPRECATE
|
||||
-D_CRT_NONSTDC_NO_WARNINGS
|
||||
-D_SCL_SECURE_NO_DEPRECATE
|
||||
-D_SCL_SECURE_NO_WARNINGS
|
||||
|
||||
-wd4146 # Suppress 'unary minus operator applied to unsigned type, result still unsigned'
|
||||
-wd4180 # Suppress 'qualifier applied to function type has no meaning; ignored'
|
||||
-wd4224 # Suppress 'nonstandard extension used : formal parameter 'identifier' was previously defined as a type'
|
||||
-wd4244 # Suppress ''argument' : conversion from 'type1' to 'type2', possible loss of data'
|
||||
-wd4267 # Suppress ''var' : conversion from 'size_t' to 'type', possible loss of data'
|
||||
-wd4275 # Suppress 'An exported class was derived from a class that was not exported.'
|
||||
-wd4291 # Suppress ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception'
|
||||
-wd4345 # Suppress 'behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized'
|
||||
-wd4351 # Suppress 'new behavior: elements of array 'array' will be default initialized'
|
||||
-wd4355 # Suppress ''this' : used in base member initializer list'
|
||||
-wd4503 # Suppress ''identifier' : decorated name length exceeded, name was truncated'
|
||||
-wd4624 # Suppress ''derived class' : destructor could not be generated because a base class destructor is inaccessible'
|
||||
-wd4715 # Suppress ''function' : not all control paths return a value'
|
||||
-wd4800 # Suppress ''type' : forcing value to bool 'true' or 'false' (performance warning)'
|
||||
-wd4065 # Suppress 'switch statement contains 'default' but no 'case' labels'
|
||||
|
||||
-w14062 # Promote "enumerator in switch of enum is not handled" to level 1 warning.
|
||||
)
|
||||
|
||||
# Enable warnings
|
||||
if (LLVM_ENABLE_WARNINGS)
|
||||
add_llvm_definitions( /W4 /Wall )
|
||||
if (LLVM_ENABLE_PEDANTIC)
|
||||
# No MSVC equivalent available
|
||||
endif (LLVM_ENABLE_PEDANTIC)
|
||||
endif (LLVM_ENABLE_WARNINGS)
|
||||
if (LLVM_ENABLE_WERROR)
|
||||
add_llvm_definitions( /WX )
|
||||
endif (LLVM_ENABLE_WERROR)
|
||||
elseif( CMAKE_COMPILER_IS_GNUCXX )
|
||||
if (LLVM_ENABLE_WARNINGS)
|
||||
add_llvm_definitions( -Wall -W -Wno-unused-parameter -Wwrite-strings )
|
||||
if (LLVM_ENABLE_PEDANTIC)
|
||||
add_llvm_definitions( -pedantic -Wno-long-long )
|
||||
endif (LLVM_ENABLE_PEDANTIC)
|
||||
endif (LLVM_ENABLE_WARNINGS)
|
||||
if (LLVM_ENABLE_WERROR)
|
||||
add_llvm_definitions( -Werror )
|
||||
endif (LLVM_ENABLE_WERROR)
|
||||
endif( MSVC )
|
||||
|
||||
add_llvm_definitions( -D__STDC_LIMIT_MACROS )
|
||||
add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
|
||||
|
@ -1,11 +1,15 @@
|
||||
# This file provides information and services to the final user.
|
||||
|
||||
set(LLVM_PACKAGE_VERSION @PACKAGE_VERSION@)
|
||||
|
||||
set(LLVM_COMMON_DEPENDS @LLVM_COMMON_DEPENDS@)
|
||||
|
||||
set(llvm_libs @llvm_libs@)
|
||||
|
||||
set(llvm_lib_targets @llvm_lib_targets@)
|
||||
|
||||
set(LLVM_ALL_TARGETS @LLVM_ALL_TARGETS@)
|
||||
|
||||
set(LLVM_TARGETS_TO_BUILD @LLVM_TARGETS_TO_BUILD@)
|
||||
|
||||
set(LLVM_TOOLS_BINARY_DIR @LLVM_TOOLS_BINARY_DIR@)
|
||||
@ -14,6 +18,13 @@ set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS@)
|
||||
|
||||
set(LLVM_NATIVE_ARCH @LLVM_NATIVE_ARCH@)
|
||||
|
||||
set(LLVM_ENABLE_PIC @LLVM_ENABLE_PIC@)
|
||||
|
||||
set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS)
|
||||
|
||||
set(HAVE_LIBDL @HAVE_LIBDL@)
|
||||
set(HAVE_LIBPTHREAD @HAVE_LIBPTHREAD)
|
||||
|
||||
# We try to include using the current setting of CMAKE_MODULE_PATH,
|
||||
# which suppossedly was filled by the user with the directory where
|
||||
# this file was installed:
|
||||
|
@ -59,6 +59,9 @@ endfunction(llvm_map_components_to_libraries)
|
||||
|
||||
function(explicit_map_components_to_libraries out_libs)
|
||||
set( link_components ${ARGN} )
|
||||
get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
|
||||
string(TOUPPER "${llvm_libs}" capitalized_libs)
|
||||
# Translate symbolic component names to real libraries:
|
||||
foreach(c ${link_components})
|
||||
# add codegen, asmprinter, asmparser, disassembler
|
||||
list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
|
||||
@ -102,39 +105,48 @@ function(explicit_map_components_to_libraries out_libs)
|
||||
elseif( c STREQUAL "all" )
|
||||
list(APPEND expanded_components ${llvm_libs})
|
||||
else( NOT idx LESS 0 )
|
||||
list(APPEND expanded_components LLVM${c})
|
||||
# Canonize the component name:
|
||||
string(TOUPPER "${c}" capitalized)
|
||||
list(FIND capitalized_libs LLVM${capitalized} lib_idx)
|
||||
if( lib_idx LESS 0 )
|
||||
# The component is unkown. Maybe is an ommitted target?
|
||||
is_llvm_target_library(${c} iltl_result)
|
||||
if( NOT iltl_result )
|
||||
message(FATAL_ERROR "Library `${c}' not found in list of llvm libraries.")
|
||||
endif()
|
||||
else( lib_idx LESS 0 )
|
||||
list(GET llvm_libs ${lib_idx} canonical_lib)
|
||||
list(APPEND expanded_components ${canonical_lib})
|
||||
endif( lib_idx LESS 0 )
|
||||
endif( NOT idx LESS 0 )
|
||||
endforeach(c)
|
||||
# We must match capitalization.
|
||||
string(TOUPPER "${llvm_libs}" capitalized_libs)
|
||||
list(REMOVE_DUPLICATES expanded_components)
|
||||
# Expand dependencies while topologically sorting the list of libraries:
|
||||
list(LENGTH expanded_components lst_size)
|
||||
set(result "")
|
||||
while( 0 LESS ${lst_size} )
|
||||
list(GET expanded_components 0 c)
|
||||
string(TOUPPER "${c}" capitalized)
|
||||
list(FIND capitalized_libs ${capitalized} idx)
|
||||
set(add_it ON)
|
||||
if( idx LESS 0 )
|
||||
# The library is unkown. Maybe is an ommitted target?
|
||||
is_llvm_target_library(${c} iltl_result)
|
||||
if( NOT iltl_result )
|
||||
message(FATAL_ERROR "Library ${c} not found in list of llvm libraries.")
|
||||
endif()
|
||||
set(add_it OFF)
|
||||
endif( idx LESS 0 )
|
||||
list(GET llvm_libs ${idx} canonical_lib)
|
||||
list(REMOVE_ITEM result ${canonical_lib})
|
||||
foreach(c ${MSVC_LIB_DEPS_${canonical_lib}})
|
||||
list(REMOVE_ITEM expanded_components ${c})
|
||||
endforeach()
|
||||
if( add_it )
|
||||
list(APPEND result ${canonical_lib})
|
||||
list(APPEND expanded_components ${MSVC_LIB_DEPS_${canonical_lib}})
|
||||
endif()
|
||||
list(REMOVE_AT expanded_components 0)
|
||||
set(cursor 0)
|
||||
set(processed)
|
||||
while( cursor LESS lst_size )
|
||||
list(GET expanded_components ${cursor} lib)
|
||||
list(APPEND expanded_components ${MSVC_LIB_DEPS_${lib}})
|
||||
# Remove duplicates at the front:
|
||||
list(REVERSE expanded_components)
|
||||
list(REMOVE_DUPLICATES expanded_components)
|
||||
list(REVERSE expanded_components)
|
||||
list(APPEND processed ${lib})
|
||||
# Find the maximum index that doesn't have to be re-processed:
|
||||
while(NOT "${expanded_components}" MATCHES "^${processed}.*" )
|
||||
list(REMOVE_AT processed -1)
|
||||
endwhile()
|
||||
list(LENGTH processed cursor)
|
||||
list(LENGTH expanded_components lst_size)
|
||||
endwhile( 0 LESS ${lst_size} )
|
||||
endwhile( cursor LESS lst_size )
|
||||
# Return just the libraries included in this build:
|
||||
set(result)
|
||||
foreach(c ${expanded_components})
|
||||
list(FIND llvm_libs ${c} lib_idx)
|
||||
if( NOT lib_idx LESS 0 )
|
||||
set(result ${result} ${c})
|
||||
endif()
|
||||
endforeach(c)
|
||||
set(${out_libs} ${result} PARENT_SCOPE)
|
||||
endfunction(explicit_map_components_to_libraries)
|
||||
|
||||
@ -151,13 +163,13 @@ endfunction(explicit_map_components_to_libraries)
|
||||
|
||||
# The format generated by GenLibDeps.pl
|
||||
|
||||
# libLLVMARMAsmPrinter.a: libLLVMMC.a libLLVMSupport.a
|
||||
# LLVMARMAsmPrinter.o: LLVMARMCodeGen.o libLLVMAsmPrinter.a libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMTarget.a
|
||||
|
||||
# is translated to:
|
||||
|
||||
# set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMMC LLVMSupport)
|
||||
# set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget)
|
||||
|
||||
# It is necessary to remove the `lib' prefix and the `.a' suffix.
|
||||
# It is necessary to remove the `lib' prefix and the `.a'.
|
||||
|
||||
# This 'sed' script should do the trick:
|
||||
# sed -e s'#\.a##g' -e 's#libLLVM#LLVM#g' -e 's#: # #' -e 's#\(.*\)#set(MSVC_LIB_DEPS_\1)#' ~/llvm/tools/llvm-config/LibDeps.txt
|
||||
|
@ -1,71 +1,68 @@
|
||||
set(MSVC_LIB_DEPS_LLVMARMAsmParser LLVMARMInfo LLVMMC LLVMMCParser LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMARMAsmParser LLVMARMCodeGen LLVMARMInfo LLVMMC LLVMMCParser LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMARMCodeGen LLVMARMInfo LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMARMInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMAlphaAsmPrinter LLVMAlphaInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMAlphaCodeGen LLVMAlphaInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMArchive LLVMBitReader LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMARMCodeGen LLVMARMAsmPrinter LLVMARMInfo LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMARMDisassembler LLVMARMCodeGen LLVMARMInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMARMInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMAlphaCodeGen LLVMAlphaInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMAnalysis LLVMCore LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMArchive LLVMBitReader LLVMCore LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMAsmParser LLVMCore LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMAsmPrinter LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMMCParser LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMAsmPrinter LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMMCParser LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMBitReader LLVMCore LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMBitWriter LLVMCore LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMBlackfinAsmPrinter LLVMAsmPrinter LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCBackend LLVMAnalysis LLVMCBackendInfo LLVMCodeGen LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils LLVMipa)
|
||||
set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCellSPUAsmPrinter LLVMAsmPrinter LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCodeGen LLVMAnalysis LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMBlackfinCodeGen LLVMAsmPrinter LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCBackend LLVMAnalysis LLVMCBackendInfo LLVMCodeGen LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa)
|
||||
set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCellSPUCodeGen LLVMAsmPrinter LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCodeGen LLVMAnalysis LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMCore LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCppBackend LLVMCore LLVMCppBackendInfo LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCore LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMInstCombine LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMInterpreter LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMJIT LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMMC LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMLinker LLVMArchive LLVMBitReader LLVMCore LLVMSupport LLVMSystem LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeCodeGen LLVMCodeGen LLVMCore LLVMMBlazeInfo LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMC LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMInfo LLVMAlphaAsmPrinter LLVMAlphaCodeGen LLVMAlphaInfo LLVMBlackfinAsmPrinter LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUAsmPrinter LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmPrinter LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430AsmPrinter LLVMMSP430CodeGen LLVMMSP430Info LLVMMipsAsmPrinter LLVMMipsCodeGen LLVMMipsInfo LLVMPIC16AsmPrinter LLVMPIC16CodeGen LLVMPIC16Info LLVMPowerPCAsmPrinter LLVMPowerPCCodeGen LLVMPowerPCInfo LLVMSparcAsmPrinter LLVMSparcCodeGen LLVMSparcInfo LLVMSupport LLVMSystem LLVMSystemZAsmPrinter LLVMSystemZCodeGen LLVMSystemZInfo LLVMX86AsmParser LLVMX86CodeGen LLVMX86Disassembler LLVMX86Info LLVMXCoreAsmPrinter LLVMXCoreCodeGen LLVMXCoreInfo)
|
||||
set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCore LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMInstCombine LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMAnalysis LLVMCore LLVMSupport LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMInterpreter LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMJIT LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMMC LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMLinker LLVMArchive LLVMBitReader LLVMCore LLVMSupport LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeAsmParser LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeAsmPrinter LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMBlazeAsmPrinter LLVMMBlazeInfo LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeDisassembler LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMDisassembler LLVMARMInfo LLVMAlphaCodeGen LLVMAlphaInfo LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmParser LLVMMBlazeCodeGen LLVMMBlazeDisassembler LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430CodeGen LLVMMSP430Info LLVMMipsCodeGen LLVMMipsInfo LLVMPTXCodeGen LLVMPTXInfo LLVMPowerPCCodeGen LLVMPowerPCInfo LLVMSparcCodeGen LLVMSparcInfo LLVMSupport LLVMSystemZCodeGen LLVMSystemZInfo LLVMX86AsmParser LLVMX86CodeGen LLVMX86Disassembler LLVMX86Info LLVMXCoreCodeGen LLVMXCoreInfo)
|
||||
set(MSVC_LIB_DEPS_LLVMMCJIT LLVMExecutionEngine LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMCParser LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMSP430Info LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMCodeGen LLVMCore LLVMMC LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMipsAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMipsCodeGen LLVMMipsInfo LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMipsCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMMipsInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMPIC16AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPIC16CodeGen LLVMPIC16Info LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPIC16CodeGen LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMPIC16Info LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPIC16Info LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCInfo LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMScalarOpts LLVMAnalysis LLVMCore LLVMInstCombine LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMSelectionDAG LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSparcAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSparcInfo LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSparcCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSparcInfo LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMSystem )
|
||||
set(MSVC_LIB_DEPS_LLVMSystemZAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystemZInfo LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSystemZCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystemZInfo LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMSP430AsmPrinter LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMipsCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMipsInfo LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMObject LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMPTXCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPTXInfo LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPTXInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCCodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCAsmPrinter LLVMPowerPCInfo LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMScalarOpts LLVMAnalysis LLVMCore LLVMInstCombine LLVMSupport LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMSelectionDAG LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMSparcCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSparcInfo LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMSupport )
|
||||
set(MSVC_LIB_DEPS_LLVMSystemZCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystemZInfo LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMTarget LLVMCore LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMTransformUtils LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget LLVMipa)
|
||||
set(MSVC_LIB_DEPS_LLVMTransformUtils LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMipa)
|
||||
set(MSVC_LIB_DEPS_LLVMX86AsmParser LLVMMC LLVMMCParser LLVMSupport LLVMTarget LLVMX86Info)
|
||||
set(MSVC_LIB_DEPS_LLVMX86AsmPrinter LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget LLVMX86AsmPrinter LLVMX86Info)
|
||||
set(MSVC_LIB_DEPS_LLVMX86AsmPrinter LLVMMC LLVMSupport LLVMX86Utils)
|
||||
set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMX86AsmPrinter LLVMX86Info LLVMX86Utils)
|
||||
set(MSVC_LIB_DEPS_LLVMX86Disassembler LLVMMC LLVMSupport LLVMX86Info)
|
||||
set(MSVC_LIB_DEPS_LLVMX86Info LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMXCoreAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget LLVMXCoreInfo)
|
||||
set(MSVC_LIB_DEPS_LLVMXCoreCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMXCoreInfo)
|
||||
set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMipo LLVMAnalysis LLVMCore LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils LLVMipa)
|
||||
set(MSVC_LIB_DEPS_LLVMX86Info LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMX86Utils LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMXCoreCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMXCoreInfo)
|
||||
set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMipo LLVMAnalysis LLVMCore LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa)
|
||||
|
80
cmake/modules/LLVMParseArguments.cmake
Normal file
80
cmake/modules/LLVMParseArguments.cmake
Normal file
@ -0,0 +1,80 @@
|
||||
# Copied from http://www.itk.org/Wiki/CMakeMacroParseArguments under
|
||||
# http://creativecommons.org/licenses/by/2.5/.
|
||||
#
|
||||
# The PARSE_ARGUMENTS macro will take the arguments of another macro and define
|
||||
# several variables. The first argument to PARSE_ARGUMENTS is a prefix to put on
|
||||
# all variables it creates. The second argument is a list of names, and the
|
||||
# third argument is a list of options. Both of these lists should be quoted. The
|
||||
# rest of PARSE_ARGUMENTS are arguments from another macro to be parsed.
|
||||
#
|
||||
# PARSE_ARGUMENTS(prefix arg_names options arg1 arg2...)
|
||||
#
|
||||
# For each item in options, PARSE_ARGUMENTS will create a variable with that
|
||||
# name, prefixed with prefix_. So, for example, if prefix is MY_MACRO and
|
||||
# options is OPTION1;OPTION2, then PARSE_ARGUMENTS will create the variables
|
||||
# MY_MACRO_OPTION1 and MY_MACRO_OPTION2. These variables will be set to true if
|
||||
# the option exists in the command line or false otherwise.
|
||||
#
|
||||
#For each item in arg_names, PARSE_ARGUMENTS will create a variable with that
|
||||
#name, prefixed with prefix_. Each variable will be filled with the arguments
|
||||
#that occur after the given arg_name is encountered up to the next arg_name or
|
||||
#the end of the arguments. All options are removed from these
|
||||
#lists. PARSE_ARGUMENTS also creates a prefix_DEFAULT_ARGS variable containing
|
||||
#the list of all arguments up to the first arg_name encountered.
|
||||
#
|
||||
#Here is a simple, albeit impractical, example of using PARSE_ARGUMENTS that
|
||||
#demonstrates its behavior.
|
||||
#
|
||||
# SET(arguments
|
||||
# hello OPTION3 world
|
||||
# LIST3 foo bar
|
||||
# OPTION2
|
||||
# LIST1 fuz baz
|
||||
# )
|
||||
#
|
||||
# PARSE_ARGUMENTS(ARG "LIST1;LIST2;LIST3" "OPTION1;OPTION2;OPTION3" ${arguments})
|
||||
#
|
||||
# PARSE_ARGUMENTS creates 7 variables and sets them as follows:
|
||||
# ARG_DEFAULT_ARGS: hello;world
|
||||
# ARG_LIST1: fuz;baz
|
||||
# ARG_LIST2:
|
||||
# ARG_LIST3: foo;bar
|
||||
# ARG_OPTION1: FALSE
|
||||
# ARG_OPTION2: TRUE
|
||||
# ARG_OPTION3: TRUE
|
||||
#
|
||||
# If you don't have any options, use an empty string in its place.
|
||||
# PARSE_ARGUMENTS(ARG "LIST1;LIST2;LIST3" "" ${arguments})
|
||||
# Likewise if you have no lists.
|
||||
# PARSE_ARGUMENTS(ARG "" "OPTION1;OPTION2;OPTION3" ${arguments})
|
||||
|
||||
MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
|
||||
SET(DEFAULT_ARGS)
|
||||
FOREACH(arg_name ${arg_names})
|
||||
SET(${prefix}_${arg_name})
|
||||
ENDFOREACH(arg_name)
|
||||
FOREACH(option ${option_names})
|
||||
SET(${prefix}_${option} FALSE)
|
||||
ENDFOREACH(option)
|
||||
|
||||
SET(current_arg_name DEFAULT_ARGS)
|
||||
SET(current_arg_list)
|
||||
FOREACH(arg ${ARGN})
|
||||
SET(larg_names ${arg_names})
|
||||
LIST(FIND larg_names "${arg}" is_arg_name)
|
||||
IF (is_arg_name GREATER -1)
|
||||
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
||||
SET(current_arg_name ${arg})
|
||||
SET(current_arg_list)
|
||||
ELSE (is_arg_name GREATER -1)
|
||||
SET(loption_names ${option_names})
|
||||
LIST(FIND loption_names "${arg}" is_option)
|
||||
IF (is_option GREATER -1)
|
||||
SET(${prefix}_${arg} TRUE)
|
||||
ELSE (is_option GREATER -1)
|
||||
SET(current_arg_list ${current_arg_list} ${arg})
|
||||
ENDIF (is_option GREATER -1)
|
||||
ENDIF (is_arg_name GREATER -1)
|
||||
ENDFOREACH(arg)
|
||||
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
||||
ENDMACRO(PARSE_ARGUMENTS)
|
@ -1,5 +1,22 @@
|
||||
include(AddFileDependencies)
|
||||
|
||||
function(llvm_replace_compiler_option var old new)
|
||||
# Replaces a compiler option or switch `old' in `var' by `new'.
|
||||
# If `old' is not in `var', appends `new' to `var'.
|
||||
# Example: llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
|
||||
# If the option already is on the variable, don't add it:
|
||||
if( "${${var}}" MATCHES "(^| )${new}($| )" )
|
||||
set(n "")
|
||||
else()
|
||||
set(n "${new}")
|
||||
endif()
|
||||
if( "${${var}}" MATCHES "(^| )${old}($| )" )
|
||||
string( REGEX REPLACE "(^| )${old}($| )" " ${n} " ${var} "${${var}}" )
|
||||
else()
|
||||
set( ${var} "${${var}} ${n}" )
|
||||
endif()
|
||||
set( ${var} "${${var}}" PARENT_SCOPE )
|
||||
endfunction(llvm_replace_compiler_option)
|
||||
|
||||
macro(add_td_sources srcs)
|
||||
file(GLOB tds *.td)
|
||||
@ -12,7 +29,7 @@ endmacro(add_td_sources)
|
||||
|
||||
|
||||
macro(add_header_files srcs)
|
||||
file(GLOB hds *.h)
|
||||
file(GLOB hds *.h *.def)
|
||||
if( hds )
|
||||
set_source_files_properties(${hds} PROPERTIES HEADER_FILE_ONLY ON)
|
||||
list(APPEND ${srcs} ${hds})
|
||||
@ -36,6 +53,25 @@ function(llvm_process_sources OUT_VAR)
|
||||
add_td_sources(sources)
|
||||
add_header_files(sources)
|
||||
endif()
|
||||
|
||||
# Set common compiler options:
|
||||
if( NOT LLVM_REQUIRES_EH )
|
||||
if( CMAKE_COMPILER_IS_GNUCXX )
|
||||
add_definitions( -fno-exceptions )
|
||||
elseif( MSVC )
|
||||
llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/EHsc" "/EHs-c-")
|
||||
add_definitions( /D_HAS_EXCEPTIONS=0 )
|
||||
endif()
|
||||
endif()
|
||||
if( NOT LLVM_REQUIRES_RTTI )
|
||||
if( CMAKE_COMPILER_IS_GNUCXX )
|
||||
llvm_replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti")
|
||||
elseif( MSVC )
|
||||
llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/GR" "/GR-")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE )
|
||||
set( ${OUT_VAR} ${sources} PARENT_SCOPE )
|
||||
endfunction(llvm_process_sources)
|
||||
|
||||
|
@ -12,14 +12,34 @@ macro(tablegen ofn)
|
||||
set(LLVM_TARGET_DEFINITIONS_ABSOLUTE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS})
|
||||
endif()
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
|
||||
# Generate tablegen output in a temporary file.
|
||||
COMMAND ${LLVM_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-I ${LLVM_MAIN_SRC_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR}
|
||||
${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
||||
DEPENDS tblgen ${local_tds} ${global_tds}
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
|
||||
# The file in LLVM_TARGET_DEFINITIONS may be not in the current
|
||||
# directory and local_tds may not contain it, so we must
|
||||
# explicitly list it here:
|
||||
DEPENDS ${LLVM_TABLEGEN_EXE} ${local_tds} ${global_tds}
|
||||
${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
|
||||
COMMENT "Building ${ofn}..."
|
||||
)
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
||||
# Only update the real output file if there are any differences.
|
||||
# This prevents recompilation of all the files depending on it if there
|
||||
# aren't any.
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
|
||||
COMMENT ""
|
||||
)
|
||||
|
||||
# `make clean' must remove all those generated files:
|
||||
set_property(DIRECTORY APPEND
|
||||
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${ofn}.tmp ${ofn})
|
||||
|
||||
set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
||||
PROPERTIES GENERATED 1)
|
||||
|
@ -4,13 +4,16 @@
|
||||
|
||||
function(add_version_info_from_vcs VERS)
|
||||
set(result ${${VERS}})
|
||||
if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.svn )
|
||||
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn" )
|
||||
set(result "${result}svn")
|
||||
find_package(Subversion)
|
||||
# FindSubversion does not work with symlinks. See PR 8437
|
||||
if( NOT IS_SYMLINK "${CMAKE_CURRENT_SOURCE_DIR}" )
|
||||
find_package(Subversion)
|
||||
endif()
|
||||
if( Subversion_FOUND )
|
||||
subversion_wc_info( ${CMAKE_CURRENT_SOURCE_DIR} Project )
|
||||
if( Project_WC_REVISION )
|
||||
set(result "${result}-r${Project_WC_REVISION}")
|
||||
set(result "${result}-r${Project_WC_REVISION}")
|
||||
endif()
|
||||
endif()
|
||||
elseif( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git )
|
||||
@ -19,13 +22,23 @@ function(add_version_info_from_vcs VERS)
|
||||
find_program(git_executable NAMES git git.exe git.cmd)
|
||||
if( git_executable )
|
||||
execute_process(COMMAND ${git_executable} show-ref HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
TIMEOUT 5
|
||||
RESULT_VARIABLE git_result
|
||||
OUTPUT_VARIABLE git_output)
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
TIMEOUT 5
|
||||
RESULT_VARIABLE git_result
|
||||
OUTPUT_VARIABLE git_output)
|
||||
if( git_result EQUAL 0 )
|
||||
string(SUBSTRING ${git_output} 0 7 git_ref_id)
|
||||
set(result "${result}-${git_ref_id}")
|
||||
string(SUBSTRING ${git_output} 0 7 git_ref_id)
|
||||
set(result "${result}-${git_ref_id}")
|
||||
else()
|
||||
execute_process(COMMAND ${git_executable} svn log --limit=1 --oneline
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
TIMEOUT 5
|
||||
RESULT_VARIABLE git_result
|
||||
OUTPUT_VARIABLE git_output)
|
||||
if( git_result EQUAL 0 )
|
||||
string(REGEX MATCH r[0-9]+ git_svn_rev ${git_output})
|
||||
set(result "${result}-svn-${git_svn_rev}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -31,7 +31,7 @@
|
||||
<li><a href="#chaining"><tt>AliasAnalysis</tt> chaining behavior</a></li>
|
||||
<li><a href="#updating">Updating analysis results for transformations</a></li>
|
||||
<li><a href="#implefficiency">Efficiency Issues</a></li>
|
||||
<li><a href="#passmanager">Pass Manager Issues</a></li>
|
||||
<li><a href="#limitations">Limitations</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@ -188,7 +188,8 @@ that the accesses alias.</p>
|
||||
<div class="doc_text">
|
||||
<p>The <tt>alias</tt> method is the primary interface used to determine whether
|
||||
or not two memory objects alias each other. It takes two memory objects as
|
||||
input and returns MustAlias, MayAlias, or NoAlias as appropriate.</p>
|
||||
input and returns MustAlias, PartialAlias, MayAlias, or NoAlias as
|
||||
appropriate.</p>
|
||||
|
||||
<p>Like all <tt>AliasAnalysis</tt> interfaces, the <tt>alias</tt> method requires
|
||||
that either the two pointer values be defined within the same function, or at
|
||||
@ -215,8 +216,10 @@ and reallocation.</p>
|
||||
dependencies are ignored.</p>
|
||||
|
||||
<p>The MayAlias response is used whenever the two pointers might refer to the
|
||||
same object. If the two memory objects overlap, but do not start at the same
|
||||
location, return MayAlias.</p>
|
||||
same object.</p>
|
||||
|
||||
<p>The PartialAlias response is used when the two memory objects are known
|
||||
to be overlapping in some way, but do not start at the same address.</p>
|
||||
|
||||
<p>The MustAlias response may only be returned if the two memory objects are
|
||||
guaranteed to always start at exactly the same location. A MustAlias response
|
||||
@ -461,7 +464,7 @@ analysis results updated to reflect the changes made by these transformations.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <tt>AliasAnalysis</tt> interface exposes two methods which are used to
|
||||
The <tt>AliasAnalysis</tt> interface exposes four methods which are used to
|
||||
communicate program changes from the clients to the analysis implementations.
|
||||
Various alias analysis implementations should use these methods to ensure that
|
||||
their internal data structures are kept up-to-date as the program changes (for
|
||||
@ -502,6 +505,28 @@ value, then deleting the old value. This method cannot be overridden by alias
|
||||
analysis implementations.
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">The <tt>addEscapingUse</tt> method</div>
|
||||
|
||||
<div class="doc_text">
|
||||
<p>The <tt>addEscapingUse</tt> method is used when the uses of a pointer
|
||||
value have changed in ways that may invalidate precomputed analysis information.
|
||||
Implementations may either use this callback to provide conservative responses
|
||||
for points whose uses have change since analysis time, or may recompute some
|
||||
or all of their internal state to continue providing accurate responses.</p>
|
||||
|
||||
<p>In general, any new use of a pointer value is considered an escaping use,
|
||||
and must be reported through this callback, <em>except</em> for the
|
||||
uses below:</p>
|
||||
|
||||
<ul>
|
||||
<li>A <tt>bitcast</tt> or <tt>getelementptr</tt> of the pointer</li>
|
||||
<li>A <tt>store</tt> through the pointer (but not a <tt>store</tt>
|
||||
<em>of</em> the pointer)</li>
|
||||
<li>A <tt>load</tt> through the pointer</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="implefficiency">Efficiency Issues</a>
|
||||
@ -520,13 +545,13 @@ method as possible (within reason).</p>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="passmanager">Pass Manager Issues</a>
|
||||
<a name="limitations">Limitations</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>PassManager support for alternative AliasAnalysis implementation
|
||||
has some issues.</p>
|
||||
<p>The AliasAnalysis infrastructure has several limitations which make
|
||||
writing a new <tt>AliasAnalysis</tt> implementation difficult.</p>
|
||||
|
||||
<p>There is no way to override the default alias analysis. It would
|
||||
be very useful to be able to do something like "opt -my-aa -O2" and
|
||||
@ -555,6 +580,40 @@ silently route alias analysis queries directly to
|
||||
passes between each pass, which prevents the use of <tt>FunctionPass</tt>
|
||||
alias analysis passes.</p>
|
||||
|
||||
<p>The <tt>AliasAnalysis</tt> API does have functions for notifying
|
||||
implementations when values are deleted or copied, however these
|
||||
aren't sufficient. There are many other ways that LLVM IR can be
|
||||
modified which could be relevant to <tt>AliasAnalysis</tt>
|
||||
implementations which can not be expressed.</p>
|
||||
|
||||
<p>The <tt>AliasAnalysisDebugger</tt> utility seems to suggest that
|
||||
<tt>AliasAnalysis</tt> implementations can expect that they will be
|
||||
informed of any relevant <tt>Value</tt> before it appears in an
|
||||
alias query. However, popular clients such as <tt>GVN</tt> don't
|
||||
support this, and are known to trigger errors when run with the
|
||||
<tt>AliasAnalysisDebugger</tt>.</p>
|
||||
|
||||
<p>Due to several of the above limitations, the most obvious use for
|
||||
the <tt>AliasAnalysisCounter</tt> utility, collecting stats on all
|
||||
alias queries in a compilation, doesn't work, even if the
|
||||
<tt>AliasAnalysis</tt> implementations don't use <tt>FunctionPass</tt>.
|
||||
There's no way to set a default, much less a default sequence,
|
||||
and there's no way to preserve it.</p>
|
||||
|
||||
<p>The <tt>AliasSetTracker</tt> class (which is used by <tt>LICM</tt>
|
||||
makes a non-deterministic number of alias queries. This can cause stats
|
||||
collected by <tt>AliasAnalysisCounter</tt> to have fluctuations among
|
||||
identical runs, for example. Another consequence is that debugging
|
||||
techniques involving pausing execution after a predetermined number
|
||||
of queries can be unreliable.</p>
|
||||
|
||||
<p>Many alias queries can be reformulated in terms of other alias
|
||||
queries. When multiple <tt>AliasAnalysis</tt> queries are chained together,
|
||||
it would make sense to start those queries from the beginning of the chain,
|
||||
with care taken to avoid infinite looping, however currently an
|
||||
implementation which wants to do this can only start such queries
|
||||
from itself.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
@ -713,8 +772,8 @@ problem.</p>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The <tt>-basicaa</tt> pass is the default LLVM alias analysis. It is an
|
||||
aggressive local analysis that "knows" many important facts:</p>
|
||||
<p>The <tt>-basicaa</tt> pass is an aggressive local analysis that "knows"
|
||||
many important facts:</p>
|
||||
|
||||
<ul>
|
||||
<li>Distinct globals, stack allocations, and heap allocations can never
|
||||
@ -998,7 +1057,7 @@ analysis directly.</p>
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-08-31 01:47:24 +0200 (Tue, 31 Aug 2010) $
|
||||
Last modified: $Date: 2011-01-03 22:38:41 +0100 (Mon, 03 Jan 2011) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -922,6 +922,9 @@ encoding of the visibility of this variable:
|
||||
<li><i>threadlocal</i>: If present and non-zero, indicates that the variable
|
||||
is <tt>thread_local</tt></li>
|
||||
|
||||
<li><i>unnamed_addr</i>: If present and non-zero, indicates that the variable
|
||||
has <tt>unnamed_addr<tt></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -975,6 +978,10 @@ entries.</li>
|
||||
<li><i>gc</i>: If present and nonzero, the 1-based garbage collector
|
||||
index in the table of
|
||||
<a href="#MODULE_CODE_GCNAME">MODULE_CODE_GCNAME</a> entries.</li>
|
||||
|
||||
<li><i>unnamed_addr</i>: If present and non-zero, indicates that the function
|
||||
has <tt>unnamed_addr<tt></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -1474,7 +1481,7 @@ name. Each entry corresponds to a single named type.
|
||||
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-08-28 06:09:24 +0200 (Sat, 28 Aug 2010) $
|
||||
Last modified: $Date: 2011-01-08 17:42:36 +0100 (Sat, 08 Jan 2011) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -68,7 +68,7 @@
|
||||
<ol>
|
||||
|
||||
<li><p><a href="http://www.cmake.org/cmake/resources/software.html">Download</a>
|
||||
and install CMake. Version 2.6.2 is the minimum required.</p>
|
||||
and install CMake. Version 2.8 is the minimum required.</p>
|
||||
|
||||
<li><p>Open a shell. Your development tools must be reachable from this
|
||||
shell through the PATH environment variable.</p>
|
||||
@ -257,11 +257,41 @@
|
||||
with a makefile-based system executing <i>make llvm-as</i> on the
|
||||
root of your build directory.</dd>
|
||||
|
||||
<dt><b>LLVM_INCLUDE_TOOLS</b>:BOOL</dt>
|
||||
<dd>Generate build targets for the LLVM tools. Defaults to
|
||||
ON. You can use that option for disabling the generation of build
|
||||
targets for the LLVM tools.</dd>
|
||||
|
||||
<dt><b>LLVM_BUILD_EXAMPLES</b>:BOOL</dt>
|
||||
<dd>Build LLVM examples. Defaults to OFF. Targets for building each
|
||||
example are generated in any case. See documentation
|
||||
for <i>LLVM_BUILD_TOOLS</i> above for more details.</dd>
|
||||
|
||||
<dt><b>LLVM_INCLUDE_EXAMPLES</b>:BOOL</dt>
|
||||
<dd>Generate build targets for the LLVM examples. Defaults to
|
||||
ON. You can use that option for disabling the generation of build
|
||||
targets for the LLVM examples.</dd>
|
||||
|
||||
<dt><b>LLVM_BUILD_TESTS</b>:BOOL</dt>
|
||||
<dd>Build LLVM unit tests. Defaults to OFF. Targets for building
|
||||
each unit test are generated in any case. You can build a specific
|
||||
unit test with the target <i>UnitTestNameTests</i> (where at this
|
||||
time <i>UnitTestName</i> can be ADT, Analysis, ExecutionEngine,
|
||||
JIT, Support, Transform, VMCore; see the subdirectories
|
||||
of <i>unittests</i> for an updated list.) It is possible to build
|
||||
all unit tests with the target <i>UnitTests</i>.</dd>
|
||||
|
||||
<dt><b>LLVM_INCLUDE_TESTS</b>:BOOL</dt>
|
||||
<dd>Generate build targets for the LLVM unit tests. Defaults to
|
||||
ON. You can use that option for disabling the generation of build
|
||||
targets for the LLVM unit tests.</dd>
|
||||
|
||||
<dt><b>LLVM_APPEND_VC_REV</b>:BOOL</dt>
|
||||
<dd>Append version control revision info (svn revision number or git
|
||||
revision id) to LLVM version string (stored in the PACKAGE_VERSION
|
||||
macro). For this to work cmake must be invoked before the
|
||||
build. Defaults to OFF.</dd>
|
||||
|
||||
<dt><b>LLVM_ENABLE_THREADS</b>:BOOL</dt>
|
||||
<dd>Build with threads support, if available. Defaults to ON.</dd>
|
||||
|
||||
@ -301,6 +331,25 @@
|
||||
<dd>Full path to a native TableGen executable (usually
|
||||
named <i>tblgen</i>). This is intented for cross-compiling: if the
|
||||
user sets this variable, no native TableGen will be created.</dd>
|
||||
|
||||
<dt><b>LLVM_LIT_ARGS</b>:STRING</dt>
|
||||
<dd>Arguments given to lit.
|
||||
<tt>make check</tt> and <tt>make clang-test</tt> are affected.
|
||||
By default, <tt>"-sv --no-progress-bar"</tt>
|
||||
on Visual C++ and Xcode,
|
||||
<tt>"-sv"</tt> on others.</dd>
|
||||
|
||||
<dt><b>LLVM_LIT_TOOLS_DIR</b>:STRING</dt>
|
||||
<dd>The path to GnuWin32 tools for tests. Valid on Windows host.
|
||||
Defaults to "", then Lit seeks tools according to %PATH%.
|
||||
Lit can find tools(eg. grep, sort, &c) on LLVM_LIT_TOOLS_DIR at first,
|
||||
without specifying GnuWin32 to %PATH%.</dd>
|
||||
|
||||
<dt><b>LLVM_ENABLE_FFI</b>:BOOL</dt>
|
||||
<dd>Indicates whether LLVM Interpreter will be linked with Foreign
|
||||
Function Interface library. If the library or its headers are
|
||||
installed on a custom location, you can set the variables
|
||||
FFI_INCLUDE_DIR and FFI_LIBRARY_DIR. Defaults to OFF.</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
@ -321,7 +370,7 @@
|
||||
<p><tt>make check</tt></p>
|
||||
</div>
|
||||
|
||||
<p>Testing is not supported on Visual Studio.</p>
|
||||
<p>On Visual Studio, you may run tests to build the project "check".</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -5,6 +5,17 @@
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>The LLVM Target-Independent Code Generator</title>
|
||||
<link rel="stylesheet" href="llvm.css" type="text/css">
|
||||
|
||||
<style type="text/css">
|
||||
.unknown { background-color: #C0C0C0; text-align: center; }
|
||||
.unknown:before { content: "?" }
|
||||
.no { background-color: #C11B17 }
|
||||
.no:before { content: "N" }
|
||||
.partial { background-color: #F88017 }
|
||||
.yes { background-color: #0F0; }
|
||||
.yes:before { content: "Y" }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@ -33,7 +44,7 @@
|
||||
<li><a href="#targetjitinfo">The <tt>TargetJITInfo</tt> class</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#codegendesc">Machine code description classes</a>
|
||||
<li><a href="#codegendesc">The "Machine" Code Generator classes</a>
|
||||
<ul>
|
||||
<li><a href="#machineinstr">The <tt>MachineInstr</tt> class</a></li>
|
||||
<li><a href="#machinebasicblock">The <tt>MachineBasicBlock</tt>
|
||||
@ -41,6 +52,15 @@
|
||||
<li><a href="#machinefunction">The <tt>MachineFunction</tt> class</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#mc">The "MC" Layer</a>
|
||||
<ul>
|
||||
<li><a href="#mcstreamer">The <tt>MCStreamer</tt> API</a></li>
|
||||
<li><a href="#mccontext">The <tt>MCContext</tt> class</a>
|
||||
<li><a href="#mcsymbol">The <tt>MCSymbol</tt> class</a></li>
|
||||
<li><a href="#mcsection">The <tt>MCSection</tt> class</a></li>
|
||||
<li><a href="#mcinst">The <tt>MCInst</tt> class</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#codegenalgs">Target-independent code generation algorithms</a>
|
||||
<ul>
|
||||
<li><a href="#instselect">Instruction Selection</a>
|
||||
@ -76,15 +96,14 @@
|
||||
<li><a href="#regAlloc_fold">Instruction folding</a></li>
|
||||
<li><a href="#regAlloc_builtIn">Built in register allocators</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#codeemit">Code Emission</a>
|
||||
<ul>
|
||||
<li><a href="#codeemit_asm">Generating Assembly Code</a></li>
|
||||
<li><a href="#codeemit_bin">Generating Binary Machine Code</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#codeemit">Code Emission</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#nativeassembler">Implementing a Native Assembler</a></li>
|
||||
|
||||
<li><a href="#targetimpls">Target-specific Implementation Notes</a>
|
||||
<ul>
|
||||
<li><a href="#targetfeatures">Target Feature Matrix</a></li>
|
||||
<li><a href="#tailcallopt">Tail call optimization</a></li>
|
||||
<li><a href="#sibcallopt">Sibling call optimization</a></li>
|
||||
<li><a href="#x86">The X86 backend</a></li>
|
||||
@ -100,11 +119,7 @@
|
||||
</ol>
|
||||
|
||||
<div class="doc_author">
|
||||
<p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>,
|
||||
<a href="mailto:isanbard@gmail.com">Bill Wendling</a>,
|
||||
<a href="mailto:pronesto@gmail.com">Fernando Magno Quintao
|
||||
Pereira</a> and
|
||||
<a href="mailto:jlaskey@mac.com">Jim Laskey</a></p>
|
||||
<p>Written by the LLVM Team.</p>
|
||||
</div>
|
||||
|
||||
<div class="doc_warning">
|
||||
@ -123,7 +138,7 @@
|
||||
suite of reusable components for translating the LLVM internal representation
|
||||
to the machine code for a specified target—either in assembly form
|
||||
(suitable for a static compiler) or in binary machine code format (usable for
|
||||
a JIT compiler). The LLVM target-independent code generator consists of five
|
||||
a JIT compiler). The LLVM target-independent code generator consists of six
|
||||
main components:</p>
|
||||
|
||||
<ol>
|
||||
@ -132,10 +147,17 @@
|
||||
independently of how they will be used. These interfaces are defined in
|
||||
<tt>include/llvm/Target/</tt>.</li>
|
||||
|
||||
<li>Classes used to represent the <a href="#codegendesc">machine code</a>
|
||||
being generated for a target. These classes are intended to be abstract
|
||||
<li>Classes used to represent the <a href="#codegendesc">code being
|
||||
generated</a> for a target. These classes are intended to be abstract
|
||||
enough to represent the machine code for <i>any</i> target machine. These
|
||||
classes are defined in <tt>include/llvm/CodeGen/</tt>.</li>
|
||||
classes are defined in <tt>include/llvm/CodeGen/</tt>. At this level,
|
||||
concepts like "constant pool entries" and "jump tables" are explicitly
|
||||
exposed.</li>
|
||||
|
||||
<li>Classes and algorithms used to represent code as the object file level,
|
||||
the <a href="#mc">MC Layer</a>. These classes represent assembly level
|
||||
constructs like labels, sections, and instructions. At this level,
|
||||
concepts like "constant pool entries" and "jump tables" don't exist.</li>
|
||||
|
||||
<li><a href="#codegenalgs">Target-independent algorithms</a> used to implement
|
||||
various phases of native code generation (register allocation, scheduling,
|
||||
@ -732,6 +754,157 @@ ret
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
<a name="mc">The "MC" Layer</a>
|
||||
</div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
The MC Layer is used to represent and process code at the raw machine code
|
||||
level, devoid of "high level" information like "constant pools", "jump tables",
|
||||
"global variables" or anything like that. At this level, LLVM handles things
|
||||
like label names, machine instructions, and sections in the object file. The
|
||||
code in this layer is used for a number of important purposes: the tail end of
|
||||
the code generator uses it to write a .s or .o file, and it is also used by the
|
||||
llvm-mc tool to implement standalone machine codeassemblers and disassemblers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This section describes some of the important classes. There are also a number
|
||||
of important subsystems that interact at this layer, they are described later
|
||||
in this manual.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="mcstreamer">The <tt>MCStreamer</tt> API</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
MCStreamer is best thought of as an assembler API. It is an abstract API which
|
||||
is <em>implemented</em> in different ways (e.g. to output a .s file, output an
|
||||
ELF .o file, etc) but whose API correspond directly to what you see in a .s
|
||||
file. MCStreamer has one method per directive, such as EmitLabel,
|
||||
EmitSymbolAttribute, SwitchSection, EmitValue (for .byte, .word), etc, which
|
||||
directly correspond to assembly level directives. It also has an
|
||||
EmitInstruction method, which is used to output an MCInst to the streamer.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This API is most important for two clients: the llvm-mc stand-alone assembler is
|
||||
effectively a parser that parses a line, then invokes a method on MCStreamer. In
|
||||
the code generator, the <a href="#codeemit">Code Emission</a> phase of the code
|
||||
generator lowers higher level LLVM IR and Machine* constructs down to the MC
|
||||
layer, emitting directives through MCStreamer.</p>
|
||||
|
||||
<p>
|
||||
On the implementation side of MCStreamer, there are two major implementations:
|
||||
one for writing out a .s file (MCAsmStreamer), and one for writing out a .o
|
||||
file (MCObjectStreamer). MCAsmStreamer is a straight-forward implementation
|
||||
that prints out a directive for each method (e.g. EmitValue -> .byte), but
|
||||
MCObjectStreamer implements a full assembler.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="mccontext">The <tt>MCContext</tt> class</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
The MCContext class is the owner of a variety of uniqued data structures at the
|
||||
MC layer, including symbols, sections, etc. As such, this is the class that you
|
||||
interact with to create symbols and sections. This class can not be subclassed.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="mcsymbol">The <tt>MCSymbol</tt> class</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
The MCSymbol class represents a symbol (aka label) in the assembly file. There
|
||||
are two interesting kinds of symbols: assembler temporary symbols, and normal
|
||||
symbols. Assembler temporary symbols are used and processed by the assembler
|
||||
but are discarded when the object file is produced. The distinction is usually
|
||||
represented by adding a prefix to the label, for example "L" labels are
|
||||
assembler temporary labels in MachO.
|
||||
</p>
|
||||
|
||||
<p>MCSymbols are created by MCContext and uniqued there. This means that
|
||||
MCSymbols can be compared for pointer equivalence to find out if they are the
|
||||
same symbol. Note that pointer inequality does not guarantee the labels will
|
||||
end up at different addresses though. It's perfectly legal to output something
|
||||
like this to the .s file:<p>
|
||||
|
||||
<pre>
|
||||
foo:
|
||||
bar:
|
||||
.byte 4
|
||||
</pre>
|
||||
|
||||
<p>In this case, both the foo and bar symbols will have the same address.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="mcsection">The <tt>MCSection</tt> class</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
The MCSection class represents an object-file specific section. It is subclassed
|
||||
by object file specific implementations (e.g. <tt>MCSectionMachO</tt>,
|
||||
<tt>MCSectionCOFF</tt>, <tt>MCSectionELF</tt>) and these are created and uniqued
|
||||
by MCContext. The MCStreamer has a notion of the current section, which can be
|
||||
changed with the SwitchToSection method (which corresponds to a ".section"
|
||||
directive in a .s file).
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="mcinst">The <tt>MCInst</tt> class</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
The MCInst class is a target-independent representation of an instruction. It
|
||||
is a simple class (much more so than <a href="#machineinstr">MachineInstr</a>)
|
||||
that holds a target-specific opcode and a vector of MCOperands. MCOperand, in
|
||||
turn, is a simple discriminated union of three cases: 1) a simple immediate,
|
||||
2) a target register ID, 3) a symbolic expression (e.g. "Lfoo-Lbar+42") as an
|
||||
MCExpr.
|
||||
</p>
|
||||
|
||||
<p>MCInst is the common currency used to represent machine instructions at the
|
||||
MC layer. It is the type used by the instruction encoder, the instruction
|
||||
printer, and the type generated by the assembly parser and disassembler.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
<a name="codegenalgs">Target-independent code generation algorithms</a>
|
||||
@ -857,9 +1030,9 @@ ret
|
||||
SelectionDAG optimizer is run to clean up redundancies exposed by type
|
||||
legalization.</li>
|
||||
|
||||
<li><a href="#selectiondag_legalize">Legalize SelectionDAG Types</a> —
|
||||
This stage transforms SelectionDAG nodes to eliminate any types that are
|
||||
unsupported on the target.</li>
|
||||
<li><a href="#selectiondag_legalize">Legalize SelectionDAG Ops</a> —
|
||||
This stage transforms SelectionDAG nodes to eliminate any operations
|
||||
that are unsupported on the target.</li>
|
||||
|
||||
<li><a href="#selectiondag_optimize">Optimize SelectionDAG</a> — The
|
||||
SelectionDAG optimizer is run to eliminate inefficiencies introduced by
|
||||
@ -1386,18 +1559,25 @@ bool RegMapping_Fer::compatible_class(MachineFunction &mf,
|
||||
</p>
|
||||
|
||||
<p>Virtual registers are also denoted by integer numbers. Contrary to physical
|
||||
registers, different virtual registers never share the same number. The
|
||||
smallest virtual register is normally assigned the number 1024. This may
|
||||
change, so, in order to know which is the first virtual register, you should
|
||||
access <tt>TargetRegisterInfo::FirstVirtualRegister</tt>. Any register whose
|
||||
number is greater than or equal
|
||||
to <tt>TargetRegisterInfo::FirstVirtualRegister</tt> is considered a virtual
|
||||
register. Whereas physical registers are statically defined in
|
||||
a <tt>TargetRegisterInfo.td</tt> file and cannot be created by the
|
||||
application developer, that is not the case with virtual registers. In order
|
||||
to create new virtual registers, use the
|
||||
registers, different virtual registers never share the same number. Whereas
|
||||
physical registers are statically defined in a <tt>TargetRegisterInfo.td</tt>
|
||||
file and cannot be created by the application developer, that is not the case
|
||||
with virtual registers. In order to create new virtual registers, use the
|
||||
method <tt>MachineRegisterInfo::createVirtualRegister()</tt>. This method
|
||||
will return a virtual register with the highest code.</p>
|
||||
will return a new virtual register. Use an <tt>IndexedMap<Foo,
|
||||
VirtReg2IndexFunctor></tt> to hold information per virtual register. If you
|
||||
need to enumerate all virtual registers, use the function
|
||||
<tt>TargetRegisterInfo::index2VirtReg()</tt> to find the virtual register
|
||||
numbers:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
for (unsigned i = 0, e = MRI->getNumVirtRegs(); i != e; ++i) {
|
||||
unsigned VirtReg = TargetRegisterInfo::index2VirtReg(i);
|
||||
stuff(VirtReg);
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>Before register allocation, the operands of an instruction are mostly virtual
|
||||
registers, although physical registers may also be used. In order to check if
|
||||
@ -1635,25 +1815,228 @@ $ llc -regalloc=pbqp file.bc -o pbqp.s;
|
||||
<a name="latemco">Late Machine Code Optimizations</a>
|
||||
</div>
|
||||
<div class="doc_text"><p>To Be Written</p></div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="codeemit">Code Emission</a>
|
||||
</div>
|
||||
<div class="doc_text"><p>To Be Written</p></div>
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="codeemit_asm">Generating Assembly Code</a>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The code emission step of code generation is responsible for lowering from
|
||||
the code generator abstractions (like <a
|
||||
href="#machinefunction">MachineFunction</a>, <a
|
||||
href="#machineinstr">MachineInstr</a>, etc) down
|
||||
to the abstractions used by the MC layer (<a href="#mcinst">MCInst</a>,
|
||||
<a href="#mcstreamer">MCStreamer</a>, etc). This is
|
||||
done with a combination of several different classes: the (misnamed)
|
||||
target-independent AsmPrinter class, target-specific subclasses of AsmPrinter
|
||||
(such as SparcAsmPrinter), and the TargetLoweringObjectFile class.</p>
|
||||
|
||||
<p>Since the MC layer works at the level of abstraction of object files, it
|
||||
doesn't have a notion of functions, global variables etc. Instead, it thinks
|
||||
about labels, directives, and instructions. A key class used at this time is
|
||||
the MCStreamer class. This is an abstract API that is implemented in different
|
||||
ways (e.g. to output a .s file, output an ELF .o file, etc) that is effectively
|
||||
an "assembler API". MCStreamer has one method per directive, such as EmitLabel,
|
||||
EmitSymbolAttribute, SwitchSection, etc, which directly correspond to assembly
|
||||
level directives.
|
||||
</p>
|
||||
|
||||
<p>If you are interested in implementing a code generator for a target, there
|
||||
are three important things that you have to implement for your target:</p>
|
||||
|
||||
<ol>
|
||||
<li>First, you need a subclass of AsmPrinter for your target. This class
|
||||
implements the general lowering process converting MachineFunction's into MC
|
||||
label constructs. The AsmPrinter base class provides a number of useful methods
|
||||
and routines, and also allows you to override the lowering process in some
|
||||
important ways. You should get much of the lowering for free if you are
|
||||
implementing an ELF, COFF, or MachO target, because the TargetLoweringObjectFile
|
||||
class implements much of the common logic.</li>
|
||||
|
||||
<li>Second, you need to implement an instruction printer for your target. The
|
||||
instruction printer takes an <a href="#mcinst">MCInst</a> and renders it to a
|
||||
raw_ostream as text. Most of this is automatically generated from the .td file
|
||||
(when you specify something like "<tt>add $dst, $src1, $src2</tt>" in the
|
||||
instructions), but you need to implement routines to print operands.</li>
|
||||
|
||||
<li>Third, you need to implement code that lowers a <a
|
||||
href="#machineinstr">MachineInstr</a> to an MCInst, usually implemented in
|
||||
"<target>MCInstLower.cpp". This lowering process is often target
|
||||
specific, and is responsible for turning jump table entries, constant pool
|
||||
indices, global variable addresses, etc into MCLabels as appropriate. This
|
||||
translation layer is also responsible for expanding pseudo ops used by the code
|
||||
generator into the actual machine instructions they correspond to. The MCInsts
|
||||
that are generated by this are fed into the instruction printer or the encoder.
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
|
||||
<p>Finally, at your choosing, you can also implement an subclass of
|
||||
MCCodeEmitter which lowers MCInst's into machine code bytes and relocations.
|
||||
This is important if you want to support direct .o file emission, or would like
|
||||
to implement an assembler for your target.</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
<a name="nativeassembler">Implementing a Native Assembler</a>
|
||||
</div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Though you're probably reading this because you want to write or maintain a
|
||||
compiler backend, LLVM also fully supports building a native assemblers too.
|
||||
We've tried hard to automate the generation of the assembler from the .td files
|
||||
(in particular the instruction syntax and encodings), which means that a large
|
||||
part of the manual and repetitive data entry can be factored and shared with the
|
||||
compiler.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection" id="na_instparsing">Instruction Parsing</div>
|
||||
|
||||
<div class="doc_text"><p>To Be Written</p></div>
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="codeemit_bin">Generating Binary Machine Code</a>
|
||||
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection" id="na_instaliases">
|
||||
Instruction Alias Processing
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
<p>For the JIT or <tt>.o</tt> file writer</p>
|
||||
<p>Once the instruction is parsed, it enters the MatchInstructionImpl function.
|
||||
The MatchInstructionImpl function performs alias processing and then does
|
||||
actual matching.</p>
|
||||
|
||||
<p>Alias processing is the phase that canonicalizes different lexical forms of
|
||||
the same instructions down to one representation. There are several different
|
||||
kinds of alias that are possible to implement and they are listed below in the
|
||||
order that they are processed (which is in order from simplest/weakest to most
|
||||
complex/powerful). Generally you want to use the first alias mechanism that
|
||||
meets the needs of your instruction, because it will allow a more concise
|
||||
description.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">Mnemonic Aliases</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The first phase of alias processing is simple instruction mnemonic
|
||||
remapping for classes of instructions which are allowed with two different
|
||||
mnemonics. This phase is a simple and unconditionally remapping from one input
|
||||
mnemonic to one output mnemonic. It isn't possible for this form of alias to
|
||||
look at the operands at all, so the remapping must apply for all forms of a
|
||||
given mnemonic. Mnemonic aliases are defined simply, for example X86 has:
|
||||
</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
def : MnemonicAlias<"cbw", "cbtw">;
|
||||
def : MnemonicAlias<"smovq", "movsq">;
|
||||
def : MnemonicAlias<"fldcww", "fldcw">;
|
||||
def : MnemonicAlias<"fucompi", "fucomip">;
|
||||
def : MnemonicAlias<"ud2a", "ud2">;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>... and many others. With a MnemonicAlias definition, the mnemonic is
|
||||
remapped simply and directly. Though MnemonicAlias's can't look at any aspect
|
||||
of the instruction (such as the operands) they can depend on global modes (the
|
||||
same ones supported by the matcher), through a Requires clause:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
def : MnemonicAlias<"pushf", "pushfq">, Requires<[In64BitMode]>;
|
||||
def : MnemonicAlias<"pushf", "pushfl">, Requires<[In32BitMode]>;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>In this example, the mnemonic gets mapped into different a new one depending
|
||||
on the current instruction set.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">Instruction Aliases</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The most general phase of alias processing occurs while matching is
|
||||
happening: it provides new forms for the matcher to match along with a specific
|
||||
instruction to generate. An instruction alias has two parts: the string to
|
||||
match and the instruction to generate. For example:
|
||||
</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
def : InstAlias<"movsx $src, $dst", (MOVSX16rr8W GR16:$dst, GR8 :$src)>;
|
||||
def : InstAlias<"movsx $src, $dst", (MOVSX16rm8W GR16:$dst, i8mem:$src)>;
|
||||
def : InstAlias<"movsx $src, $dst", (MOVSX32rr8 GR32:$dst, GR8 :$src)>;
|
||||
def : InstAlias<"movsx $src, $dst", (MOVSX32rr16 GR32:$dst, GR16 :$src)>;
|
||||
def : InstAlias<"movsx $src, $dst", (MOVSX64rr8 GR64:$dst, GR8 :$src)>;
|
||||
def : InstAlias<"movsx $src, $dst", (MOVSX64rr16 GR64:$dst, GR16 :$src)>;
|
||||
def : InstAlias<"movsx $src, $dst", (MOVSX64rr32 GR64:$dst, GR32 :$src)>;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>This shows a powerful example of the instruction aliases, matching the
|
||||
same mnemonic in multiple different ways depending on what operands are present
|
||||
in the assembly. The result of instruction aliases can include operands in a
|
||||
different order than the destination instruction, and can use an input
|
||||
multiple times, for example:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
def : InstAlias<"clrb $reg", (XOR8rr GR8 :$reg, GR8 :$reg)>;
|
||||
def : InstAlias<"clrw $reg", (XOR16rr GR16:$reg, GR16:$reg)>;
|
||||
def : InstAlias<"clrl $reg", (XOR32rr GR32:$reg, GR32:$reg)>;
|
||||
def : InstAlias<"clrq $reg", (XOR64rr GR64:$reg, GR64:$reg)>;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>This example also shows that tied operands are only listed once. In the X86
|
||||
backend, XOR8rr has two input GR8's and one output GR8 (where an input is tied
|
||||
to the output). InstAliases take a flattened operand list without duplicates
|
||||
for tied operands. The result of an instruction alias can also use immediates
|
||||
and fixed physical registers which are added as simple immediate operands in the
|
||||
result, for example:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
// Fixed Immediate operand.
|
||||
def : InstAlias<"aad", (AAD8i8 10)>;
|
||||
|
||||
// Fixed register operand.
|
||||
def : InstAlias<"fcomi", (COM_FIr ST1)>;
|
||||
|
||||
// Simple alias.
|
||||
def : InstAlias<"fcomi $reg", (COM_FIr RST:$reg)>;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<p>Instruction aliases can also have a Requires clause to make them
|
||||
subtarget specific.</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection" id="na_matching">Instruction Matching</div>
|
||||
|
||||
<div class="doc_text"><p>To Be Written</p></div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
@ -1664,10 +2047,275 @@ $ llc -regalloc=pbqp file.bc -o pbqp.s;
|
||||
<div class="doc_text">
|
||||
|
||||
<p>This section of the document explains features or design decisions that are
|
||||
specific to the code generator for a particular target.</p>
|
||||
specific to the code generator for a particular target. First we start
|
||||
with a table that summarizes what features are supported by each target.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="targetfeatures">Target Feature Matrix</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Note that this table does not include the C backend or Cpp backends, since
|
||||
they do not use the target independent code generator infrastructure. It also
|
||||
doesn't list features that are not supported fully by any target yet. It
|
||||
considers a feature to be supported if at least one subtarget supports it. A
|
||||
feature being supported means that it is useful and works for most cases, it
|
||||
does not indicate that there are zero known bugs in the implementation. Here
|
||||
is the key:</p>
|
||||
|
||||
|
||||
<table border="1" cellspacing="0">
|
||||
<tr>
|
||||
<th>Unknown</th>
|
||||
<th>No support</th>
|
||||
<th>Partial Support</th>
|
||||
<th>Complete Support</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="unknown"></td>
|
||||
<td class="no"></td>
|
||||
<td class="partial"></td>
|
||||
<td class="yes"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>Here is the table:</p>
|
||||
|
||||
<table width="689" border="1" cellspacing="0">
|
||||
<tr><td></td>
|
||||
<td colspan="13" align="center" style="background-color:#ffc">Target</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Feature</th>
|
||||
<th>ARM</th>
|
||||
<th>Alpha</th>
|
||||
<th>Blackfin</th>
|
||||
<th>CellSPU</th>
|
||||
<th>MBlaze</th>
|
||||
<th>MSP430</th>
|
||||
<th>Mips</th>
|
||||
<th>PTX</th>
|
||||
<th>PowerPC</th>
|
||||
<th>Sparc</th>
|
||||
<th>SystemZ</th>
|
||||
<th>X86</th>
|
||||
<th>XCore</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="#feat_reliable">is generally reliable</a></td>
|
||||
<td class="yes"></td> <!-- ARM -->
|
||||
<td class="unknown"></td> <!-- Alpha -->
|
||||
<td class="no"></td> <!-- Blackfin -->
|
||||
<td class="no"></td> <!-- CellSPU -->
|
||||
<td class="no"></td> <!-- MBlaze -->
|
||||
<td class="unknown"></td> <!-- MSP430 -->
|
||||
<td class="no"></td> <!-- Mips -->
|
||||
<td class="no"></td> <!-- PTX -->
|
||||
<td class="yes"></td> <!-- PowerPC -->
|
||||
<td class="yes"></td> <!-- Sparc -->
|
||||
<td class="unknown"></td> <!-- SystemZ -->
|
||||
<td class="yes"></td> <!-- X86 -->
|
||||
<td class="unknown"></td> <!-- XCore -->
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="#feat_asmparser">assembly parser</a></td>
|
||||
<td class="no"></td> <!-- ARM -->
|
||||
<td class="no"></td> <!-- Alpha -->
|
||||
<td class="no"></td> <!-- Blackfin -->
|
||||
<td class="no"></td> <!-- CellSPU -->
|
||||
<td class="yes"></td> <!-- MBlaze -->
|
||||
<td class="no"></td> <!-- MSP430 -->
|
||||
<td class="no"></td> <!-- Mips -->
|
||||
<td class="no"></td> <!-- PTX -->
|
||||
<td class="no"></td> <!-- PowerPC -->
|
||||
<td class="no"></td> <!-- Sparc -->
|
||||
<td class="no"></td> <!-- SystemZ -->
|
||||
<td class="yes"></td> <!-- X86 -->
|
||||
<td class="no"></td> <!-- XCore -->
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="#feat_disassembler">disassembler</a></td>
|
||||
<td class="yes"></td> <!-- ARM -->
|
||||
<td class="no"></td> <!-- Alpha -->
|
||||
<td class="no"></td> <!-- Blackfin -->
|
||||
<td class="no"></td> <!-- CellSPU -->
|
||||
<td class="yes"></td> <!-- MBlaze -->
|
||||
<td class="no"></td> <!-- MSP430 -->
|
||||
<td class="no"></td> <!-- Mips -->
|
||||
<td class="no"></td> <!-- PTX -->
|
||||
<td class="no"></td> <!-- PowerPC -->
|
||||
<td class="no"></td> <!-- Sparc -->
|
||||
<td class="no"></td> <!-- SystemZ -->
|
||||
<td class="yes"></td> <!-- X86 -->
|
||||
<td class="no"></td> <!-- XCore -->
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="#feat_inlineasm">inline asm</a></td>
|
||||
<td class="yes"></td> <!-- ARM -->
|
||||
<td class="unknown"></td> <!-- Alpha -->
|
||||
<td class="yes"></td> <!-- Blackfin -->
|
||||
<td class="no"></td> <!-- CellSPU -->
|
||||
<td class="yes"></td> <!-- MBlaze -->
|
||||
<td class="unknown"></td> <!-- MSP430 -->
|
||||
<td class="no"></td> <!-- Mips -->
|
||||
<td class="unknown"></td> <!-- PTX -->
|
||||
<td class="yes"></td> <!-- PowerPC -->
|
||||
<td class="unknown"></td> <!-- Sparc -->
|
||||
<td class="unknown"></td> <!-- SystemZ -->
|
||||
<td class="yes"><a href="#feat_inlineasm_x86">*</a></td> <!-- X86 -->
|
||||
<td class="unknown"></td> <!-- XCore -->
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="#feat_jit">jit</a></td>
|
||||
<td class="partial"><a href="#feat_jit_arm">*</a></td> <!-- ARM -->
|
||||
<td class="no"></td> <!-- Alpha -->
|
||||
<td class="no"></td> <!-- Blackfin -->
|
||||
<td class="no"></td> <!-- CellSPU -->
|
||||
<td class="no"></td> <!-- MBlaze -->
|
||||
<td class="unknown"></td> <!-- MSP430 -->
|
||||
<td class="no"></td> <!-- Mips -->
|
||||
<td class="unknown"></td> <!-- PTX -->
|
||||
<td class="yes"></td> <!-- PowerPC -->
|
||||
<td class="unknown"></td> <!-- Sparc -->
|
||||
<td class="unknown"></td> <!-- SystemZ -->
|
||||
<td class="yes"></td> <!-- X86 -->
|
||||
<td class="unknown"></td> <!-- XCore -->
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="#feat_objectwrite">.o file writing</a></td>
|
||||
<td class="no"></td> <!-- ARM -->
|
||||
<td class="no"></td> <!-- Alpha -->
|
||||
<td class="no"></td> <!-- Blackfin -->
|
||||
<td class="no"></td> <!-- CellSPU -->
|
||||
<td class="yes"></td> <!-- MBlaze -->
|
||||
<td class="no"></td> <!-- MSP430 -->
|
||||
<td class="no"></td> <!-- Mips -->
|
||||
<td class="no"></td> <!-- PTX -->
|
||||
<td class="no"></td> <!-- PowerPC -->
|
||||
<td class="no"></td> <!-- Sparc -->
|
||||
<td class="no"></td> <!-- SystemZ -->
|
||||
<td class="yes"></td> <!-- X86 -->
|
||||
<td class="no"></td> <!-- XCore -->
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="#feat_tailcall">tail calls</a></td>
|
||||
<td class="yes"></td> <!-- ARM -->
|
||||
<td class="unknown"></td> <!-- Alpha -->
|
||||
<td class="no"></td> <!-- Blackfin -->
|
||||
<td class="no"></td> <!-- CellSPU -->
|
||||
<td class="no"></td> <!-- MBlaze -->
|
||||
<td class="unknown"></td> <!-- MSP430 -->
|
||||
<td class="no"></td> <!-- Mips -->
|
||||
<td class="unknown"></td> <!-- PTX -->
|
||||
<td class="yes"></td> <!-- PowerPC -->
|
||||
<td class="unknown"></td> <!-- Sparc -->
|
||||
<td class="unknown"></td> <!-- SystemZ -->
|
||||
<td class="yes"></td> <!-- X86 -->
|
||||
<td class="unknown"></td> <!-- XCore -->
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection" id="feat_reliable">Is Generally Reliable</div>
|
||||
|
||||
<div class="doc_text">
|
||||
<p>This box indicates whether the target is considered to be production quality.
|
||||
This indicates that the target has been used as a static compiler to
|
||||
compile large amounts of code by a variety of different people and is in
|
||||
continuous use.</p>
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection" id="feat_asmparser">Assembly Parser</div>
|
||||
|
||||
<div class="doc_text">
|
||||
<p>This box indicates whether the target supports parsing target specific .s
|
||||
files by implementing the MCAsmParser interface. This is required for llvm-mc
|
||||
to be able to act as a native assembler and is required for inline assembly
|
||||
support in the native .o file writer.</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection" id="feat_disassembler">Disassembler</div>
|
||||
|
||||
<div class="doc_text">
|
||||
<p>This box indicates whether the target supports the MCDisassembler API for
|
||||
disassembling machine opcode bytes into MCInst's.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection" id="feat_inlineasm">Inline Asm</div>
|
||||
|
||||
<div class="doc_text">
|
||||
<p>This box indicates whether the target supports most popular inline assembly
|
||||
constraints and modifiers.</p>
|
||||
|
||||
<p id="feat_inlineasm_x86">X86 lacks reliable support for inline assembly
|
||||
constraints relating to the X86 floating point stack.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection" id="feat_jit">JIT Support</div>
|
||||
|
||||
<div class="doc_text">
|
||||
<p>This box indicates whether the target supports the JIT compiler through
|
||||
the ExecutionEngine interface.</p>
|
||||
|
||||
<p id="feat_jit_arm">The ARM backend has basic support for integer code
|
||||
in ARM codegen mode, but lacks NEON and full Thumb support.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection" id="feat_objectwrite">.o File Writing</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>This box indicates whether the target supports writing .o files (e.g. MachO,
|
||||
ELF, and/or COFF) files directly from the target. Note that the target also
|
||||
must include an assembly parser and general inline assembly support for full
|
||||
inline assembly support in the .o writer.</p>
|
||||
|
||||
<p>Targets that don't support this feature can obviously still write out .o
|
||||
files, they just rely on having an external assembler to translate from a .s
|
||||
file to a .o file (as is the case for many C compilers).</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection" id="feat_tailcall">Tail Calls</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>This box indicates whether the target supports guaranteed tail calls. These
|
||||
are calls marked "<a href="LangRef.html#i_call">tail</a>" and use the fastcc
|
||||
calling convention. Please see the <a href="#tailcallopt">tail call section
|
||||
more more details</a>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="tailcallopt">Tail call optimization</a>
|
||||
@ -2162,7 +2810,7 @@ MOVSX32rm16 -> movsx, 32-bit register, 16-bit memory
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-09-01 00:01:07 +0200 (Wed, 01 Sep 2010) $
|
||||
Last modified: $Date: 2011-01-09 00:10:59 +0100 (Sun, 09 Jan 2011) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -29,37 +29,39 @@
|
||||
<li><a href="#ci_warningerrors">Treat Compiler Warnings Like
|
||||
Errors</a></li>
|
||||
<li><a href="#ci_portable_code">Write Portable Code</a></li>
|
||||
<li><a href="#ci_class_struct">Use of class/struct Keywords</a></li>
|
||||
<li><a href="#ci_rtti_exceptions">Do not use RTTI or Exceptions</a></li>
|
||||
<li><a href="#ci_class_struct">Use of <tt>class</tt>/<tt>struct</tt> Keywords</a></li>
|
||||
</ol></li>
|
||||
</ol></li>
|
||||
<li><a href="#styleissues">Style Issues</a>
|
||||
<ol>
|
||||
<li><a href="#macro">The High Level Issues</a>
|
||||
<li><a href="#macro">The High-Level Issues</a>
|
||||
<ol>
|
||||
<li><a href="#hl_module">A Public Header File <b>is</b> a
|
||||
Module</a></li>
|
||||
<li><a href="#hl_dontinclude">#include as Little as Possible</a></li>
|
||||
<li><a href="#hl_dontinclude"><tt>#include</tt> as Little as Possible</a></li>
|
||||
<li><a href="#hl_privateheaders">Keep "internal" Headers
|
||||
Private</a></li>
|
||||
<li><a href="#hl_earlyexit">Use Early Exits and 'continue' to Simplify
|
||||
<li><a href="#hl_earlyexit">Use Early Exits and <tt>continue</tt> to Simplify
|
||||
Code</a></li>
|
||||
<li><a href="#hl_else_after_return">Don't use "else" after a
|
||||
return</a></li>
|
||||
<li><a href="#hl_else_after_return">Don't use <tt>else</tt> after a
|
||||
<tt>return</tt></a></li>
|
||||
<li><a href="#hl_predicateloops">Turn Predicate Loops into Predicate
|
||||
Functions</a></li>
|
||||
</ol></li>
|
||||
<li><a href="#micro">The Low Level Issues</a>
|
||||
<li><a href="#micro">The Low-Level Issues</a>
|
||||
<ol>
|
||||
<li><a href="#ll_naming">Name Types, Functions, Variables, and Enumerators Properly</a></li>
|
||||
<li><a href="#ll_assert">Assert Liberally</a></li>
|
||||
<li><a href="#ll_ns_std">Do not use 'using namespace std'</a></li>
|
||||
<li><a href="#ll_ns_std">Do not use '<tt>using namespace std</tt>'</a></li>
|
||||
<li><a href="#ll_virtual_anch">Provide a virtual method anchor for
|
||||
classes in headers</a></li>
|
||||
<li><a href="#ll_end">Don't evaluate end() every time through a
|
||||
<li><a href="#ll_end">Don't evaluate <tt>end()</tt> every time through a
|
||||
loop</a></li>
|
||||
<li><a href="#ll_iostream"><tt>#include <iostream></tt> is
|
||||
<em>forbidden</em></a></li>
|
||||
<li><a href="#ll_raw_ostream">Use <tt>raw_ostream</tt></a></li>
|
||||
<li><a href="#ll_avoidendl">Avoid <tt>std::endl</tt></a></li>
|
||||
<li><a href="#ll_raw_ostream">Use <tt>raw_ostream</tt></a</li>
|
||||
</ol></li>
|
||||
|
||||
<li><a href="#nano">Microscopic Details</a>
|
||||
@ -167,8 +169,8 @@ this:</p>
|
||||
|
||||
<p>A few things to note about this particular format: The "<tt>-*- C++
|
||||
-*-</tt>" string on the first line is there to tell Emacs that the source file
|
||||
is a C++ file, not a C file (Emacs assumes .h files are C files by default).
|
||||
Note that this tag is not necessary in .cpp files. The name of the file is also
|
||||
is a C++ file, not a C file (Emacs assumes <tt>.h</tt> files are C files by default).
|
||||
Note that this tag is not necessary in <tt>.cpp</tt> files. The name of the file is also
|
||||
on the first line, along with a very short description of the purpose of the
|
||||
file. This is important when printing out code and flipping though lots of
|
||||
pages.</p>
|
||||
@ -217,7 +219,7 @@ require less typing, don't have nesting problems, etc. There are a few cases
|
||||
when it is useful to use C style (<tt>/* */</tt>) comments however:</p>
|
||||
|
||||
<ol>
|
||||
<li>When writing a C code: Obviously if you are writing C code, use C style
|
||||
<li>When writing C code: Obviously if you are writing C code, use C style
|
||||
comments.</li>
|
||||
<li>When writing a header file that may be <tt>#include</tt>d by a C source
|
||||
file.</li>
|
||||
@ -244,12 +246,12 @@ file should be listed. We prefer these <tt>#include</tt>s to be listed in this
|
||||
order:</p>
|
||||
|
||||
<ol>
|
||||
<li><a href="#mmheader">Main Module header</a></li>
|
||||
<li><a href="#mmheader">Main Module Header</a></li>
|
||||
<li><a href="#hl_privateheaders">Local/Private Headers</a></li>
|
||||
<li><tt>llvm/*</tt></li>
|
||||
<li><tt>llvm/Analysis/*</tt></li>
|
||||
<li><tt>llvm/Assembly/*</tt></li>
|
||||
<li><tt>llvm/Bytecode/*</tt></li>
|
||||
<li><tt>llvm/Bitcode/*</tt></li>
|
||||
<li><tt>llvm/CodeGen/*</tt></li>
|
||||
<li>...</li>
|
||||
<li><tt>Support/*</tt></li>
|
||||
@ -257,15 +259,15 @@ order:</p>
|
||||
<li>System <tt>#includes</tt></li>
|
||||
</ol>
|
||||
|
||||
<p>... and each category should be sorted by name.</p>
|
||||
<p>and each category should be sorted by name.</p>
|
||||
|
||||
<p><a name="mmheader">The "Main Module Header"</a> file applies to .cpp file
|
||||
which implement an interface defined by a .h file. This <tt>#include</tt>
|
||||
<p><a name="mmheader">The "Main Module Header"</a> file applies to <tt>.cpp</tt> files
|
||||
which implement an interface defined by a <tt>.h</tt> file. This <tt>#include</tt>
|
||||
should always be included <b>first</b> regardless of where it lives on the file
|
||||
system. By including a header file first in the .cpp files that implement the
|
||||
system. By including a header file first in the <tt>.cpp</tt> files that implement the
|
||||
interfaces, we ensure that the header does not have any hidden dependencies
|
||||
which are not explicitly #included in the header, but should be. It is also a
|
||||
form of documentation in the .cpp file to indicate where the interfaces it
|
||||
form of documentation in the <tt>.cpp</tt> file to indicate where the interfaces it
|
||||
implements are defined.</p>
|
||||
|
||||
</div>
|
||||
@ -290,7 +292,7 @@ value and would be detrimental to printing out code. Also many other projects
|
||||
have standardized on 80 columns, so some people have already configured their
|
||||
editors for it (vs something else, like 90 columns).</p>
|
||||
|
||||
<p>This is one of many contentious issues in coding standards, but is not up
|
||||
<p>This is one of many contentious issues in coding standards, but it is not up
|
||||
for debate.</p>
|
||||
|
||||
</div>
|
||||
@ -304,12 +306,12 @@ for debate.</p>
|
||||
|
||||
<p>In all cases, prefer spaces to tabs in source files. People have different
|
||||
preferred indentation levels, and different styles of indentation that they
|
||||
like... this is fine. What isn't is that different editors/viewers expand tabs
|
||||
out to different tab stops. This can cause your code to look completely
|
||||
like; this is fine. What isn't fine is that different editors/viewers expand
|
||||
tabs out to different tab stops. This can cause your code to look completely
|
||||
unreadable, and it is not worth dealing with.</p>
|
||||
|
||||
<p>As always, follow the <a href="#goldenrule">Golden Rule</a> above: follow the
|
||||
style of existing code if your are modifying and extending it. If you like four
|
||||
style of existing code if you are modifying and extending it. If you like four
|
||||
spaces of indentation, <b>DO NOT</b> do that in the middle of a chunk of code
|
||||
with two spaces of indentation. Also, do not reindent a whole source file: it
|
||||
makes for incredible diffs that are absolutely worthless.</p>
|
||||
@ -323,7 +325,7 @@ makes for incredible diffs that are absolutely worthless.</p>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Okay, your first year of programming you were told that indentation is
|
||||
<p>Okay, in your first year of programming you were told that indentation is
|
||||
important. If you didn't believe and internalize this then, now is the time.
|
||||
Just do it.</p>
|
||||
|
||||
@ -343,17 +345,17 @@ Just do it.</p>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>If your code has compiler warnings in it, something is wrong: you aren't
|
||||
casting values correctly, your have "questionable" constructs in your code, or
|
||||
you are doing something legitimately wrong. Compiler warnings can cover up
|
||||
legitimate errors in output and make dealing with a translation unit
|
||||
<p>If your code has compiler warnings in it, something is wrong — you
|
||||
aren't casting values correctly, your have "questionable" constructs in your
|
||||
code, or you are doing something legitimately wrong. Compiler warnings can
|
||||
cover up legitimate errors in output and make dealing with a translation unit
|
||||
difficult.</p>
|
||||
|
||||
<p>It is not possible to prevent all warnings from all compilers, nor is it
|
||||
desirable. Instead, pick a standard compiler (like <tt>gcc</tt>) that provides
|
||||
a good thorough set of warnings, and stick to them. At least in the case of
|
||||
a good thorough set of warnings, and stick to it. At least in the case of
|
||||
<tt>gcc</tt>, it is possible to work around any spurious errors by changing the
|
||||
syntax of the code slightly. For example, an warning that annoys me occurs when
|
||||
syntax of the code slightly. For example, a warning that annoys me occurs when
|
||||
I write code like this:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
@ -377,11 +379,16 @@ if ((V = getValue())) {
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>...which shuts <tt>gcc</tt> up. Any <tt>gcc</tt> warning that annoys you can
|
||||
<p>which shuts <tt>gcc</tt> up. Any <tt>gcc</tt> warning that annoys you can
|
||||
be fixed by massaging the code appropriately.</p>
|
||||
|
||||
<p>These are the <tt>gcc</tt> warnings that I prefer to enable: <tt>-Wall
|
||||
-Winline -W -Wwrite-strings -Wno-unused</tt></p>
|
||||
<p>These are the <tt>gcc</tt> warnings that I prefer to enable:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
-Wall -Winline -W -Wwrite-strings -Wno-unused
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -397,9 +404,31 @@ portable code. If there are cases where it isn't possible to write portable
|
||||
code, isolate it behind a well defined (and well documented) interface.</p>
|
||||
|
||||
<p>In practice, this means that you shouldn't assume much about the host
|
||||
compiler, including its support for "high tech" features like partial
|
||||
specialization of templates. If these features are used, they should only be
|
||||
an implementation detail of a library which has a simple exposed API.</p>
|
||||
compiler, and Visual Studio tends to be the lowest common denominator.
|
||||
If advanced features are used, they should only be an implementation detail of
|
||||
a library which has a simple exposed API, and preferably be buried in
|
||||
libSystem.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="ci_rtti_exceptions">Do not use RTTI or Exceptions</a>
|
||||
</div>
|
||||
<div class="doc_text">
|
||||
|
||||
<p>In an effort to reduce code and executable size, LLVM does not use RTTI
|
||||
(e.g. <tt>dynamic_cast<></tt>) or exceptions. These two language features
|
||||
violate the general C++ principle of <i>"you only pay for what you use"</i>,
|
||||
causing executable bloat even if exceptions are never used in the code base, or
|
||||
if RTTI is never used for a class. Because of this, we turn them off globally
|
||||
in the code.</p>
|
||||
|
||||
<p>That said, LLVM does make extensive use of a hand-rolled form of RTTI that
|
||||
use templates like <a href="ProgrammersManual.html#isa"><tt>isa<></tt>,
|
||||
<tt>cast<></tt>, and <tt>dyn_cast<></tt></a>. This form of RTTI is
|
||||
opt-in and can be added to any class. It is also substantially more efficient
|
||||
than <tt>dynamic_cast<></tt>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
@ -419,8 +448,9 @@ different symbols based on whether <tt>class</tt> or <tt>struct</tt> was used to
|
||||
declare the symbol. This can lead to problems at link time.</p>
|
||||
|
||||
<p>So, the rule for LLVM is to always use the <tt>class</tt> keyword, unless
|
||||
<b>all</b> members are public and the type is a C++ "POD" type, in which case
|
||||
<tt>struct</tt> is allowed.</p>
|
||||
<b>all</b> members are public and the type is a C++
|
||||
<a href="http://en.wikipedia.org/wiki/Plain_old_data_structure">POD</a> type, in
|
||||
which case <tt>struct</tt> is allowed.</p>
|
||||
|
||||
</div>
|
||||
|
||||
@ -433,7 +463,7 @@ declare the symbol. This can lead to problems at link time.</p>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="macro">The High Level Issues</a>
|
||||
<a name="macro">The High-Level Issues</a>
|
||||
</div>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
@ -448,20 +478,20 @@ declare the symbol. This can lead to problems at link time.</p>
|
||||
<p>C++ doesn't do too well in the modularity department. There is no real
|
||||
encapsulation or data hiding (unless you use expensive protocol classes), but it
|
||||
is what we have to work with. When you write a public header file (in the LLVM
|
||||
source tree, they live in the top level "include" directory), you are defining a
|
||||
module of functionality.</p>
|
||||
source tree, they live in the top level "<tt>include</tt>" directory), you are
|
||||
defining a module of functionality.</p>
|
||||
|
||||
<p>Ideally, modules should be completely independent of each other, and their
|
||||
header files should only include the absolute minimum number of headers
|
||||
possible. A module is not just a class, a function, or a namespace: <a
|
||||
href="http://www.cuj.com/articles/2000/0002/0002c/0002c.htm">it's a collection
|
||||
of these</a> that defines an interface. This interface may be several
|
||||
functions, classes or data structures, but the important issue is how they work
|
||||
together.</p>
|
||||
header files should only <tt>#include</tt> the absolute minimum number of
|
||||
headers possible. A module is not just a class, a function, or a
|
||||
namespace: <a href="http://www.cuj.com/articles/2000/0002/0002c/0002c.htm">it's
|
||||
a collection of these</a> that defines an interface. This interface may be
|
||||
several functions, classes, or data structures, but the important issue is how
|
||||
they work together.</p>
|
||||
|
||||
<p>In general, a module should be implemented with one or more <tt>.cpp</tt>
|
||||
<p>In general, a module should be implemented by one or more <tt>.cpp</tt>
|
||||
files. Each of these <tt>.cpp</tt> files should include the header that defines
|
||||
their interface first. This ensure that all of the dependences of the module
|
||||
their interface first. This ensures that all of the dependences of the module
|
||||
header have been properly added to the module header itself, and are not
|
||||
implicit. System headers should be included after user headers for a
|
||||
translation unit.</p>
|
||||
@ -478,29 +508,28 @@ translation unit.</p>
|
||||
<p><tt>#include</tt> hurts compile time performance. Don't do it unless you
|
||||
have to, especially in header files.</p>
|
||||
|
||||
<p>But wait, sometimes you need to have the definition of a class to use it, or
|
||||
<p>But wait! Sometimes you need to have the definition of a class to use it, or
|
||||
to inherit from it. In these cases go ahead and <tt>#include</tt> that header
|
||||
file. Be aware however that there are many cases where you don't need to have
|
||||
the full definition of a class. If you are using a pointer or reference to a
|
||||
class, you don't need the header file. If you are simply returning a class
|
||||
instance from a prototyped function or method, you don't need it. In fact, for
|
||||
most cases, you simply don't need the definition of a class... and not
|
||||
most cases, you simply don't need the definition of a class. And not
|
||||
<tt>#include</tt>'ing speeds up compilation.</p>
|
||||
|
||||
<p>It is easy to try to go too overboard on this recommendation, however. You
|
||||
<b>must</b> include all of the header files that you are using -- you can
|
||||
include them either directly
|
||||
or indirectly (through another header file). To make sure that you don't
|
||||
accidentally forget to include a header file in your module header, make sure to
|
||||
include your module header <b>first</b> in the implementation file (as mentioned
|
||||
above). This way there won't be any hidden dependencies that you'll find out
|
||||
about later...</p>
|
||||
<b>must</b> include all of the header files that you are using — you can
|
||||
include them either directly or indirectly (through another header file). To
|
||||
make sure that you don't accidentally forget to include a header file in your
|
||||
module header, make sure to include your module header <b>first</b> in the
|
||||
implementation file (as mentioned above). This way there won't be any hidden
|
||||
dependencies that you'll find out about later.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="hl_privateheaders">Keep "internal" Headers Private</a>
|
||||
<a name="hl_privateheaders">Keep "Internal" Headers Private</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
@ -508,20 +537,20 @@ about later...</p>
|
||||
<p>Many modules have a complex implementation that causes them to use more than
|
||||
one implementation (<tt>.cpp</tt>) file. It is often tempting to put the
|
||||
internal communication interface (helper classes, extra functions, etc) in the
|
||||
public module header file. Don't do this.</p>
|
||||
public module header file. Don't do this!</p>
|
||||
|
||||
<p>If you really need to do something like this, put a private header file in
|
||||
the same directory as the source files, and include it locally. This ensures
|
||||
that your private interface remains private and undisturbed by outsiders.</p>
|
||||
|
||||
<p>Note however, that it's okay to put extra implementation methods a public
|
||||
class itself... just make them private (or protected), and all is well.</p>
|
||||
<p>Note however, that it's okay to put extra implementation methods in a public
|
||||
class itself. Just make them private (or protected) and all is well.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="hl_earlyexit">Use Early Exits and 'continue' to Simplify Code</a>
|
||||
<a name="hl_earlyexit">Use Early Exits and <tt>continue</tt> to Simplify Code</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
@ -530,8 +559,8 @@ class itself... just make them private (or protected), and all is well.</p>
|
||||
decisions have to be remembered by the reader to understand a block of code.
|
||||
Aim to reduce indentation where possible when it doesn't make it more difficult
|
||||
to understand the code. One great way to do this is by making use of early
|
||||
exits and the 'continue' keyword in long loops. As an example of using an early
|
||||
exit from a function, consider this "bad" code:</p>
|
||||
exits and the <tt>continue</tt> keyword in long loops. As an example of using
|
||||
an early exit from a function, consider this "bad" code:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
@ -546,23 +575,23 @@ Value *DoSomething(Instruction *I) {
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>This code has several problems if the body of the 'if' is large. When you're
|
||||
looking at the top of the function, it isn't immediately clear that this
|
||||
<em>only</em> does interesting things with non-terminator instructions, and only
|
||||
applies to things with the other predicates. Second, it is relatively difficult
|
||||
to describe (in comments) why these predicates are important because the if
|
||||
statement makes it difficult to lay out the comments. Third, when you're deep
|
||||
within the body of the code, it is indented an extra level. Finally, when
|
||||
reading the top of the function, it isn't clear what the result is if the
|
||||
predicate isn't true, you have to read to the end of the function to know that
|
||||
it returns null.</p>
|
||||
<p>This code has several problems if the body of the '<tt>if</tt>' is large.
|
||||
When you're looking at the top of the function, it isn't immediately clear that
|
||||
this <em>only</em> does interesting things with non-terminator instructions, and
|
||||
only applies to things with the other predicates. Second, it is relatively
|
||||
difficult to describe (in comments) why these predicates are important because
|
||||
the <tt>if</tt> statement makes it difficult to lay out the comments. Third,
|
||||
when you're deep within the body of the code, it is indented an extra level.
|
||||
Finally, when reading the top of the function, it isn't clear what the result is
|
||||
if the predicate isn't true; you have to read to the end of the function to know
|
||||
that it returns null.</p>
|
||||
|
||||
<p>It is much preferred to format the code like this:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
Value *DoSomething(Instruction *I) {
|
||||
// Terminators never need 'something' done to them because, ...
|
||||
// Terminators never need 'something' done to them because ...
|
||||
if (isa<TerminatorInst>(I))
|
||||
return 0;
|
||||
|
||||
@ -580,7 +609,7 @@ Value *DoSomething(Instruction *I) {
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>This fixes these problems. A similar problem frequently happens in for
|
||||
<p>This fixes these problems. A similar problem frequently happens in <tt>for</tt>
|
||||
loops. A silly example is something like this:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
@ -597,14 +626,13 @@ loops. A silly example is something like this:</p>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>When you have very very small loops, this sort of structure is fine, but if
|
||||
<p>When you have very, very small loops, this sort of structure is fine. But if
|
||||
it exceeds more than 10-15 lines, it becomes difficult for people to read and
|
||||
understand at a glance.
|
||||
The problem with this sort of code is that it gets very nested very quickly,
|
||||
meaning that the reader of the code has to keep a lot of context in their brain
|
||||
to remember what is going immediately on in the loop, because they don't know
|
||||
if/when the if conditions will have elses etc. It is strongly preferred to
|
||||
structure the loop like this:</p>
|
||||
understand at a glance. The problem with this sort of code is that it gets very
|
||||
nested very quickly. Meaning that the reader of the code has to keep a lot of
|
||||
context in their brain to remember what is going immediately on in the loop,
|
||||
because they don't know if/when the <tt>if</tt> conditions will have elses etc.
|
||||
It is strongly preferred to structure the loop like this:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
@ -615,30 +643,32 @@ structure the loop like this:</p>
|
||||
Value *LHS = BO->getOperand(0);
|
||||
Value *RHS = BO->getOperand(1);
|
||||
if (LHS == RHS) continue;
|
||||
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>This has all the benefits of using early exits from functions: it reduces
|
||||
<p>This has all the benefits of using early exits for functions: it reduces
|
||||
nesting of the loop, it makes it easier to describe why the conditions are true,
|
||||
and it makes it obvious to the reader that there is no "else" coming up that
|
||||
they have to push context into their brain for. If a loop is large, this can
|
||||
be a big understandability win.</p>
|
||||
and it makes it obvious to the reader that there is no <tt>else</tt> coming up
|
||||
that they have to push context into their brain for. If a loop is large, this
|
||||
can be a big understandability win.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="hl_else_after_return">Don't use "else" after a return</a>
|
||||
<a name="hl_else_after_return">Don't use <tt>else</tt> after a <tt>return</tt></a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>For similar reasons above (reduction of indentation and easier reading),
|
||||
please do not use "else" or "else if" after something that interrupts
|
||||
control flow like return, break, continue, goto, etc. For example, this is
|
||||
"bad":</p>
|
||||
|
||||
please do not use '<tt>else</tt>' or '<tt>else if</tt>' after something that
|
||||
interrupts control flow — like <tt>return</tt>, <tt>break</tt>,
|
||||
<tt>continue</tt>, <tt>goto</tt>, etc. For example, this is <em>bad</em>:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
case 'J': {
|
||||
@ -647,24 +677,24 @@ be a big understandability win.</p>
|
||||
if (Type.isNull()) {
|
||||
Error = ASTContext::GE_Missing_sigjmp_buf;
|
||||
return QualType();
|
||||
} else {
|
||||
<b>} else {
|
||||
break;
|
||||
}
|
||||
}</b>
|
||||
} else {
|
||||
Type = Context.getjmp_bufType();
|
||||
if (Type.isNull()) {
|
||||
Error = ASTContext::GE_Missing_jmp_buf;
|
||||
return QualType();
|
||||
} else {
|
||||
<b>} else {
|
||||
break;
|
||||
}
|
||||
}</b>
|
||||
}
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>It is better to write this something like:</p>
|
||||
<p>It is better to write it like this:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
@ -682,11 +712,11 @@ be a big understandability win.</p>
|
||||
return QualType();
|
||||
}
|
||||
}
|
||||
break;
|
||||
<b>break;</b>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>Or better yet (in this case), as:</p>
|
||||
<p>Or better yet (in this case) as:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
@ -701,12 +731,12 @@ be a big understandability win.</p>
|
||||
ASTContext::GE_Missing_jmp_buf;
|
||||
return QualType();
|
||||
}
|
||||
break;
|
||||
<b>break;</b>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>The idea is to reduce indentation and the amount of code you have to keep
|
||||
track of when reading the code.</p>
|
||||
track of when reading the code.</p>
|
||||
|
||||
</div>
|
||||
|
||||
@ -717,9 +747,9 @@ be a big understandability win.</p>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>It is very common to write small loops that just compute a boolean
|
||||
value. There are a number of ways that people commonly write these, but an
|
||||
example of this sort of thing is:</p>
|
||||
<p>It is very common to write small loops that just compute a boolean value.
|
||||
There are a number of ways that people commonly write these, but an example of
|
||||
this sort of thing is:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
@ -740,9 +770,7 @@ be a big understandability win.</p>
|
||||
Instead of this sort of loop, we strongly prefer to use a predicate function
|
||||
(which may be <a href="#micro_anonns">static</a>) that uses
|
||||
<a href="#hl_earlyexit">early exits</a> to compute the predicate. We prefer
|
||||
the code to be structured like this:
|
||||
</p>
|
||||
|
||||
the code to be structured like this:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
@ -777,11 +805,94 @@ locality.</p>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="micro">The Low Level Issues</a>
|
||||
<a name="micro">The Low-Level Issues</a>
|
||||
</div>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="ll_naming">Name Types, Functions, Variables, and Enumerators Properly</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Poorly-chosen names can mislead the reader and cause bugs. We cannot stress
|
||||
enough how important it is to use <em>descriptive</em> names. Pick names that
|
||||
match the semantics and role of the underlying entities, within reason. Avoid
|
||||
abbreviations unless they are well known. After picking a good name, make sure
|
||||
to use consistent capitalization for the name, as inconsistency requires clients
|
||||
to either memorize the APIs or to look it up to find the exact spelling.</p>
|
||||
|
||||
<p>In general, names should be in camel case (e.g. <tt>TextFileReader</tt>
|
||||
and <tt>isLValue()</tt>). Different kinds of declarations have different
|
||||
rules:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><b>Type names</b> (including classes, structs, enums, typedefs, etc)
|
||||
should be nouns and start with an upper-case letter (e.g.
|
||||
<tt>TextFileReader</tt>).</p></li>
|
||||
|
||||
<li><p><b>Function names</b> should be verb phrases (as they represent
|
||||
actions), and command-like function should be imperative. The name should
|
||||
be camel case, and start with a lower case letter (e.g. <tt>openFile()</tt>
|
||||
or <tt>isFoo()</tt>).</p></li>
|
||||
|
||||
<li><p><b>Enum declarations</b> (e.g. <tt>enum Foo {...}</tt>) are types, so
|
||||
they should follow the naming conventions for types. A common use for enums
|
||||
is as a discriminator for a union, or an indicator of a subclass. When an
|
||||
enum is used for something like this, it should have a <tt>Kind</tt> suffix
|
||||
(e.g. <tt>ValueKind</tt>).</p></li>
|
||||
|
||||
<li><p><b>Enumerators</b> (e.g. <tt>enum { Foo, Bar }</tt>) and <b>public member
|
||||
variables</b> should start with an upper-case letter, just like types.
|
||||
Unless the enumerators are defined in their own small namespace or inside a
|
||||
class, enumerators should have a prefix corresponding to the enum
|
||||
declaration name. For example, <tt>enum ValueKind { ... };</tt> may contain
|
||||
enumerators like <tt>VK_Argument</tt>, <tt>VK_BasicBlock</tt>, etc.
|
||||
Enumerators that are just convenience constants are exempt from the
|
||||
requirement for a prefix. For instance:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
enum {
|
||||
MaxSize = 42,
|
||||
Density = 12
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>As an exception, classes that mimic STL classes can have member names in
|
||||
STL's style of lower-case words separated by underscores (e.g. <tt>begin()</tt>,
|
||||
<tt>push_back()</tt>, and <tt>empty()</tt>).</p>
|
||||
|
||||
<p>Here are some examples of good and bad names:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
class VehicleMaker {
|
||||
...
|
||||
Factory<Tire> F; // Bad -- abbreviation and non-descriptive.
|
||||
Factory<Tire> Factory; // Better.
|
||||
Factory<Tire> TireFactory; // Even better -- if VehicleMaker has more than one
|
||||
// kind of factories.
|
||||
};
|
||||
|
||||
Vehicle MakeVehicle(VehicleType Type) {
|
||||
VehicleMaker M; // Might be OK if having a short life-span.
|
||||
Tire tmp1 = M.makeTire(); // Bad -- 'tmp1' provides no information.
|
||||
Light headlight = M.makeLight("head"); // Good -- descriptive.
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="ll_assert">Assert Liberally</a>
|
||||
@ -789,7 +900,7 @@ locality.</p>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Use the "<tt>assert</tt>" function to its fullest. Check all of your
|
||||
<p>Use the "<tt>assert</tt>" macro to its fullest. Check all of your
|
||||
preconditions and assumptions, you never know when a bug (not necessarily even
|
||||
yours) might be caught early by an assertion, which reduces debugging time
|
||||
dramatically. The "<tt><cassert></tt>" header file is probably already
|
||||
@ -797,8 +908,8 @@ included by the header files you are using, so it doesn't cost anything to use
|
||||
it.</p>
|
||||
|
||||
<p>To further assist with debugging, make sure to put some kind of error message
|
||||
in the assertion statement (which is printed if the assertion is tripped). This
|
||||
helps the poor debugging make sense of why an assertion is being made and
|
||||
in the assertion statement, which is printed if the assertion is tripped. This
|
||||
helps the poor debugger make sense of why an assertion is being made and
|
||||
enforced, and hopefully what to do about it. Here is one complete example:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
@ -810,7 +921,7 @@ inline Value *getOperand(unsigned i) {
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>Here are some examples:</p>
|
||||
<p>Here are more examples:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
@ -826,9 +937,9 @@ assert(isa<PHINode>(Succ->front()) && "Only works on PHId BBs!"
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>You get the idea...</p>
|
||||
<p>You get the idea.</p>
|
||||
|
||||
<p>Please be aware when adding assert statements that not all compilers are aware of
|
||||
<p>Please be aware that, when adding assert statements, not all compilers are aware of
|
||||
the semantics of the assert. In some places, asserts are used to indicate a piece of
|
||||
code that should not be reached. These are typically of the form:</p>
|
||||
|
||||
@ -851,14 +962,47 @@ return 0;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>Another issue is that values used only by assertions will produce an "unused
|
||||
value" warning when assertions are disabled. For example, this code will
|
||||
warn:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
unsigned Size = V.size();
|
||||
assert(Size > 42 && "Vector smaller than it should be");
|
||||
|
||||
bool NewToSet = Myset.insert(Value);
|
||||
assert(NewToSet && "The value shouldn't be in the set yet");
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>These are two interesting different cases. In the first case, the call to
|
||||
V.size() is only useful for the assert, and we don't want it executed when
|
||||
assertions are disabled. Code like this should move the call into the assert
|
||||
itself. In the second case, the side effects of the call must happen whether
|
||||
the assert is enabled or not. In this case, the value should be cast to void to
|
||||
disable the warning. To be specific, it is preferred to write the code like
|
||||
this:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
assert(V.size() > 42 && "Vector smaller than it should be");
|
||||
|
||||
bool NewToSet = Myset.insert(Value); (void)NewToSet;
|
||||
assert(NewToSet && "The value shouldn't be in the set yet");
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="ll_ns_std">Do not use '<tt>using namespace std</tt>'</a>
|
||||
<a name="ll_ns_std">Do Not Use '<tt>using namespace std</tt>'</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>In LLVM, we prefer to explicitly prefix all identifiers from the standard
|
||||
namespace with an "<tt>std::</tt>" prefix, rather than rely on
|
||||
"<tt>using namespace std;</tt>".</p>
|
||||
@ -867,10 +1011,10 @@ namespace with an "<tt>std::</tt>" prefix, rather than rely on
|
||||
the namespace of any source file that <tt>#include</tt>s the header. This is
|
||||
clearly a bad thing.</p>
|
||||
|
||||
<p>In implementation files (e.g. .cpp files), the rule is more of a stylistic
|
||||
<p>In implementation files (e.g. <tt>.cpp</tt> files), the rule is more of a stylistic
|
||||
rule, but is still important. Basically, using explicit namespace prefixes
|
||||
makes the code <b>clearer</b>, because it is immediately obvious what facilities
|
||||
are being used and where they are coming from, and <b>more portable</b>, because
|
||||
are being used and where they are coming from. And <b>more portable</b>, because
|
||||
namespace clashes cannot occur between LLVM code and other namespaces. The
|
||||
portability rule is important because different standard library implementations
|
||||
expose different symbols (potentially ones they shouldn't), and future revisions
|
||||
@ -880,18 +1024,20 @@ such, we never use '<tt>using namespace std;</tt>' in LLVM.</p>
|
||||
<p>The exception to the general rule (i.e. it's not an exception for
|
||||
the <tt>std</tt> namespace) is for implementation files. For example, all of
|
||||
the code in the LLVM project implements code that lives in the 'llvm' namespace.
|
||||
As such, it is ok, and actually clearer, for the .cpp files to have a '<tt>using
|
||||
namespace llvm</tt>' directive at their top, after the <tt>#include</tt>s. The
|
||||
general form of this rule is that any .cpp file that implements code in any
|
||||
namespace may use that namespace (and its parents'), but should not use any
|
||||
others.</p>
|
||||
As such, it is ok, and actually clearer, for the <tt>.cpp</tt> files to have a
|
||||
'<tt>using namespace llvm;</tt>' directive at the top, after the
|
||||
<tt>#include</tt>s. This reduces indentation in the body of the file for source
|
||||
editors that indent based on braces, and keeps the conceptual context cleaner.
|
||||
The general form of this rule is that any <tt>.cpp</tt> file that implements
|
||||
code in any namespace may use that namespace (and its parents'), but should not
|
||||
use any others.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="ll_virtual_anch">Provide a virtual method anchor for classes
|
||||
in headers</a>
|
||||
<a name="ll_virtual_anch">Provide a Virtual Method Anchor for Classes
|
||||
in Headers</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
@ -907,15 +1053,16 @@ increasing link times.</p>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="ll_end">Don't evaluate end() every time through a loop</a>
|
||||
<a name="ll_end">Don't evaluate <tt>end()</tt> every time through a loop</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Because C++ doesn't have a standard "foreach" loop (though it can be emulated
|
||||
with macros and may be coming in C++'0x) we end up writing a lot of loops that
|
||||
manually iterate from begin to end on a variety of containers or through other
|
||||
data structures. One common mistake is to write a loop in this style:</p>
|
||||
<p>Because C++ doesn't have a standard "<tt>foreach</tt>" loop (though it can be
|
||||
emulated with macros and may be coming in C++'0x) we end up writing a lot of
|
||||
loops that manually iterate from begin to end on a variety of containers or
|
||||
through other data structures. One common mistake is to write a loop in this
|
||||
style:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
@ -946,10 +1093,10 @@ behavior, please write the loop in the first form and add a comment indicating
|
||||
that you did it intentionally.</p>
|
||||
|
||||
<p>Why do we prefer the second form (when correct)? Writing the loop in the
|
||||
first form has two problems: First it may be less efficient than evaluating it
|
||||
at the start of the loop. In this case, the cost is probably minor: a few extra
|
||||
loads every time through the loop. However, if the base expression is more
|
||||
complex, then the cost can rise quickly. I've seen loops where the end
|
||||
first form has two problems. First it may be less efficient than evaluating it
|
||||
at the start of the loop. In this case, the cost is probably minor — a
|
||||
few extra loads every time through the loop. However, if the base expression is
|
||||
more complex, then the cost can rise quickly. I've seen loops where the end
|
||||
expression was actually something like: "<tt>SomeMap[x]->end()</tt>" and map
|
||||
lookups really aren't cheap. By writing it in the second form consistently, you
|
||||
eliminate the issue entirely and don't even have to think about it.</p>
|
||||
@ -968,7 +1115,7 @@ prefer it.</p>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="ll_iostream"><tt>#include <iostream></tt> is forbidden</a>
|
||||
<a name="ll_iostream"><tt>#include <iostream></tt> is Forbidden</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
@ -977,12 +1124,13 @@ prefer it.</p>
|
||||
hereby <b><em>forbidden</em></b>. The primary reason for doing this is to
|
||||
support clients using LLVM libraries as part of larger systems. In particular,
|
||||
we statically link LLVM into some dynamic libraries. Even if LLVM isn't used,
|
||||
the static c'tors are run whenever an application start up that uses the dynamic
|
||||
library. There are two problems with this:</p>
|
||||
the static constructors are run whenever an application starts up that uses the
|
||||
dynamic library. There are two problems with this:</p>
|
||||
|
||||
<ol>
|
||||
<li>The time to run the static c'tors impacts startup time of
|
||||
applications—a critical time for GUI apps.</li>
|
||||
<li>The time to run the static c'tors impacts startup time of applications
|
||||
— a critical time for GUI apps.</li>
|
||||
|
||||
<li>The static c'tors cause the app to pull many extra pages of memory off the
|
||||
disk: both the code for the static c'tors in each <tt>.o</tt> file and the
|
||||
small amount of data that gets touched. In addition, touched/dirty pages
|
||||
@ -990,42 +1138,16 @@ library. There are two problems with this:</p>
|
||||
</ol>
|
||||
|
||||
<p>Note that using the other stream headers (<tt><sstream></tt> for
|
||||
example) is not problematic in this regard (just <tt><iostream></tt>).
|
||||
However, raw_ostream provides various APIs that are better performing for almost
|
||||
every use than std::ostream style APIs, so you should just use it for new
|
||||
code.</p>
|
||||
|
||||
<p><b>New code should always
|
||||
example) is not problematic in this regard —
|
||||
just <tt><iostream></tt>. However, <tt>raw_ostream</tt> provides various
|
||||
APIs that are better performing for almost every use than <tt>std::ostream</tt>
|
||||
style APIs. <b>Therefore new code should always
|
||||
use <a href="#ll_raw_ostream"><tt>raw_ostream</tt></a> for writing, or
|
||||
the <tt>llvm::MemoryBuffer</tt> API for reading files.</b></p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="ll_avoidendl">Avoid <tt>std::endl</tt></a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The <tt>std::endl</tt> modifier, when used with iostreams outputs a newline
|
||||
to the output stream specified. In addition to doing this, however, it also
|
||||
flushes the output stream. In other words, these are equivalent:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
std::cout << std::endl;
|
||||
std::cout << '\n' << std::flush;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>Most of the time, you probably have no reason to flush the output stream, so
|
||||
it's better to use a literal <tt>'\n'</tt>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="ll_raw_ostream">Use <tt>raw_ostream</tt></a>
|
||||
@ -1034,9 +1156,9 @@ it's better to use a literal <tt>'\n'</tt>.</p>
|
||||
<div class="doc_text">
|
||||
|
||||
<p>LLVM includes a lightweight, simple, and efficient stream implementation
|
||||
in <tt>llvm/Support/raw_ostream.h</tt> which provides all of the common features
|
||||
of <tt>std::ostream</tt>. All new code should use <tt>raw_ostream</tt> instead
|
||||
of <tt>ostream</tt>.</p>
|
||||
in <tt>llvm/Support/raw_ostream.h</tt>, which provides all of the common
|
||||
features of <tt>std::ostream</tt>. All new code should use <tt>raw_ostream</tt>
|
||||
instead of <tt>ostream</tt>.</p>
|
||||
|
||||
<p>Unlike <tt>std::ostream</tt>, <tt>raw_ostream</tt> is not a template and can
|
||||
be forward declared as <tt>class raw_ostream</tt>. Public headers should
|
||||
@ -1046,6 +1168,30 @@ declarations and constant references to <tt>raw_ostream</tt> instances.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="ll_avoidendl">Avoid <tt>std::endl</tt></a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The <tt>std::endl</tt> modifier, when used with <tt>iostreams</tt> outputs a
|
||||
newline to the output stream specified. In addition to doing this, however, it
|
||||
also flushes the output stream. In other words, these are equivalent:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
std::cout << std::endl;
|
||||
std::cout << '\n' << std::flush;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>Most of the time, you probably have no reason to flush the output stream, so
|
||||
it's better to use a literal <tt>'\n'</tt>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="nano">Microscopic Details</a>
|
||||
@ -1062,54 +1208,54 @@ reasoning on why we prefer them.</p>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>We prefer to put a space before a parentheses only in control flow
|
||||
<p>We prefer to put a space before an open parenthesis only in control flow
|
||||
statements, but not in normal function call expressions and function-like
|
||||
macros. For example, this is good:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
<b>if (</b>x) ...
|
||||
<b>for (</b>i = 0; i != 100; ++i) ...
|
||||
<b>while (</b>llvm_rocks) ...
|
||||
<b>if (</b>x) ...
|
||||
<b>for (</b>i = 0; i != 100; ++i) ...
|
||||
<b>while (</b>llvm_rocks) ...
|
||||
|
||||
<b>somefunc(</b>42);
|
||||
<b><a href="#ll_assert">assert</a>(</b>3 != 4 && "laws of math are failing me");
|
||||
<b>somefunc(</b>42);
|
||||
<b><a href="#ll_assert">assert</a>(</b>3 != 4 && "laws of math are failing me");
|
||||
|
||||
a = <b>foo(</b>42, 92) + <b>bar(</b>x);
|
||||
</pre>
|
||||
a = <b>foo(</b>42, 92) + <b>bar(</b>x);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>... and this is bad:</p>
|
||||
<p>and this is bad:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
<b>if(</b>x) ...
|
||||
<b>for(</b>i = 0; i != 100; ++i) ...
|
||||
<b>while(</b>llvm_rocks) ...
|
||||
<b>if(</b>x) ...
|
||||
<b>for(</b>i = 0; i != 100; ++i) ...
|
||||
<b>while(</b>llvm_rocks) ...
|
||||
|
||||
<b>somefunc (</b>42);
|
||||
<b><a href="#ll_assert">assert</a> (</b>3 != 4 && "laws of math are failing me");
|
||||
<b>somefunc (</b>42);
|
||||
<b><a href="#ll_assert">assert</a> (</b>3 != 4 && "laws of math are failing me");
|
||||
|
||||
a = <b>foo (</b>42, 92) + <b>bar (</b>x);
|
||||
a = <b>foo (</b>42, 92) + <b>bar (</b>x);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>The reason for doing this is not completely arbitrary. This style makes
|
||||
control flow operators stand out more, and makes expressions flow better. The
|
||||
function call operator binds very tightly as a postfix operator. Putting
|
||||
a space after a function name (as in the last example) makes it appear that
|
||||
the code might bind the arguments of the left-hand-side of a binary operator
|
||||
with the argument list of a function and the name of the right side. More
|
||||
specifically, it is easy to misread the "a" example as:</p>
|
||||
control flow operators stand out more, and makes expressions flow better. The
|
||||
function call operator binds very tightly as a postfix operator. Putting a
|
||||
space after a function name (as in the last example) makes it appear that the
|
||||
code might bind the arguments of the left-hand-side of a binary operator with
|
||||
the argument list of a function and the name of the right side. More
|
||||
specifically, it is easy to misread the "a" example as:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
a = foo <b>(</b>(42, 92) + bar<b>)</b> (x);
|
||||
a = foo <b>(</b>(42, 92) + bar<b>)</b> (x);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>... when skimming through the code. By avoiding a space in a function, we
|
||||
avoid this misinterpretation.</p>
|
||||
<p>when skimming through the code. By avoiding a space in a function, we avoid
|
||||
this misinterpretation.</p>
|
||||
|
||||
</div>
|
||||
|
||||
@ -1141,7 +1287,7 @@ get in the habit of always using preincrement, and you won't have a problem.</p>
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
In general, we strive to reduce indentation where ever possible. This is useful
|
||||
In general, we strive to reduce indentation wherever possible. This is useful
|
||||
because we want code to <a href="#scf_codewidth">fit into 80 columns</a> without
|
||||
wrapping horribly, but also because it makes it easier to understand the code.
|
||||
Namespaces are a funny thing: they are often large, and we often desire to put
|
||||
@ -1186,7 +1332,7 @@ namespace llvm {
|
||||
<p>Since the body is small, indenting adds value because it makes it very clear
|
||||
where the namespace starts and ends, and it is easy to take the whole thing in
|
||||
in one "gulp" when reading the code. If the blob of code in the namespace is
|
||||
larger (as it typically is in a header in the llvm or clang namespaces), do not
|
||||
larger (as it typically is in a header in the <tt>llvm</tt> or <tt>clang</tt> namespaces), do not
|
||||
indent the code, and add a comment indicating what namespace is being closed.
|
||||
For example:</p>
|
||||
|
||||
@ -1346,7 +1492,7 @@ something.</p>
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
|
||||
Last modified: $Date: 2011-02-20 03:03:04 +0100 (Sun, 20 Feb 2011) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -133,7 +133,7 @@ both 32-bit and 64-bit code generation.
|
||||
=head2 The "CHECK-NEXT:" directive
|
||||
|
||||
Sometimes you want to match lines and would like to verify that matches
|
||||
happen on exactly consequtive lines with no other lines in between them. In
|
||||
happen on exactly consecutive lines with no other lines in between them. In
|
||||
this case, you can use CHECK: and CHECK-NEXT: directives to specify this. If
|
||||
you specified a custom check prefix, just use "<PREFIX>-NEXT:". For
|
||||
example, something like this works as you'd expect:
|
||||
@ -165,7 +165,7 @@ directive in a file.
|
||||
=head2 The "CHECK-NOT:" directive
|
||||
|
||||
The CHECK-NOT: directive is used to verify that a string doesn't occur
|
||||
between two matches (or the first match and the beginning of the file). For
|
||||
between two matches (or before the first match, or after the last match). For
|
||||
example, to verify that a load is removed by a transformation, a test like this
|
||||
can be used:
|
||||
|
||||
|
@ -151,7 +151,7 @@ options) arguments to the tool you are interested in.</p>
|
||||
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
|
||||
|
||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-09-08 01:32:02 +0200 (Wed, 08 Sep 2010) $
|
||||
Last modified: $Date: 2010-09-08 01:10:21 +0200 (Wed, 08 Sep 2010) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -84,6 +84,14 @@ Disable optimizations that may produce excess precision for floating point.
|
||||
Note that this option can dramatically slow down code on some systems
|
||||
(e.g. X86).
|
||||
|
||||
=item B<--enable-no-infs-fp-math>
|
||||
|
||||
Enable optimizations that assume no Inf values.
|
||||
|
||||
=item B<--enable-no-nans-fp-math>
|
||||
|
||||
Enable optimizations that assume no NAN values.
|
||||
|
||||
=item B<--enable-unsafe-fp-math>
|
||||
|
||||
Enable optimizations that make unsafe assumptions about IEEE math (e.g. that
|
||||
|
@ -102,10 +102,13 @@ B<llvm-as E<lt> /dev/null | llc -march=xyz -mattr=help>
|
||||
|
||||
Disable optimizations that may increase floating point precision.
|
||||
|
||||
=item B<-enable-finite-only-fp-math>
|
||||
=item B<-enable-no-infs-fp-math>
|
||||
|
||||
Enable optimizations that assumes only finite floating point math. That is,
|
||||
there is no NAN or Inf values.
|
||||
Enable optimizations that assume no Inf values.
|
||||
|
||||
=item B<-enable-no-nans-fp-math>
|
||||
|
||||
Enable optimizations that assume no NAN values.
|
||||
|
||||
=item B<-enable-unsafe-fp-math>
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
<li><a href="#copyright">Copyright</a></li>
|
||||
<li><a href="#license">License</a></li>
|
||||
<li><a href="#patents">Patents</a></li>
|
||||
<li><a href="#devagree">Developer Agreements</a></li>
|
||||
</ol></li>
|
||||
</ol>
|
||||
<div class="doc_author">Written by the LLVM Oversight Team</div>
|
||||
@ -196,7 +195,11 @@
|
||||
<ol>
|
||||
<li><b>Evan Cheng</b>: Code generator and all targets.</li>
|
||||
|
||||
<li><b>Doug Gregor</b>: Clang Basic, Lex, Parse, and Sema Libraries.</li>
|
||||
<li><b>Greg Clayton</b>: LLDB.</li>
|
||||
|
||||
<li><b>Doug Gregor</b>: Clang Frontend Libraries.</li>
|
||||
|
||||
<li><b>Howard Hinnant</b>: libc++.</li>
|
||||
|
||||
<li><b>Anton Korobeynikov</b>: Exception handling, debug information, and
|
||||
Windows codegen.</li>
|
||||
@ -506,40 +509,40 @@ Changes</a></div>
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsection"><a name="copyright">Copyright</a></div>
|
||||
<div class="doc_text">
|
||||
<p>For consistency and ease of management, the project requires the copyright
|
||||
for all LLVM software to be held by a single copyright holder: the University
|
||||
of Illinois (UIUC).</p>
|
||||
|
||||
<p>Although UIUC may eventually reassign the copyright of the software to
|
||||
another entity (e.g. a dedicated non-profit "LLVM Organization") the intent
|
||||
for the project is to always have a single entity hold the copyrights to LLVM
|
||||
at any given time.</p>
|
||||
|
||||
<p>We believe that having a single copyright holder is in the best interests of
|
||||
all developers and users as it greatly reduces the managerial burden for any
|
||||
kind of administrative or technical decisions about LLVM. The goal of the
|
||||
LLVM project is to always keep the code open and <a href="#license">licensed
|
||||
under a very liberal license</a>.</p>
|
||||
<p>The LLVM project does not require copyright assignments, which means that the
|
||||
copyright for the code in the project is held by its respective contributors
|
||||
who have each agreed to release their contributed code under the terms of the
|
||||
<a href="#license">LLVM License</a>.</p>
|
||||
|
||||
<p>An implication of this is that the LLVM license is unlikely to ever change:
|
||||
changing it would require tracking down all the contributors to LLVM and
|
||||
getting them to agree that a license change is acceptable for their
|
||||
contribution. Since there are no plans to change the license, this is not a
|
||||
cause for concern.</p>
|
||||
|
||||
<p>As a contributor to the project, this means that you (or your company) retain
|
||||
ownership of the code you contribute, that it cannot be used in a way that
|
||||
contradicts the license (which is a liberal BSD-style license), and that the
|
||||
license for your contributions won't change without your approval in the
|
||||
future.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsection"><a name="license">License</a></div>
|
||||
<div class="doc_text">
|
||||
<p>We intend to keep LLVM perpetually open source and to use a liberal open
|
||||
source license. The current license is the
|
||||
source license. All of the code in LLVM is available under the
|
||||
<a href="http://www.opensource.org/licenses/UoI-NCSA.php">University of
|
||||
Illinois/NCSA Open Source License</a>, which boils down to this:</p>
|
||||
|
||||
<ul>
|
||||
<li>You can freely distribute LLVM.</li>
|
||||
|
||||
<li>You must retain the copyright notice if you redistribute LLVM.</li>
|
||||
|
||||
<li>Binaries derived from LLVM must reproduce the copyright notice (e.g. in
|
||||
an included readme file).</li>
|
||||
|
||||
<li>Binaries derived from LLVM must reproduce the copyright notice (e.g. in an
|
||||
included readme file).</li>
|
||||
<li>You can't use our names to promote your LLVM derived products.</li>
|
||||
|
||||
<li>There's no warranty on LLVM at all.</li>
|
||||
</ul>
|
||||
|
||||
@ -549,7 +552,22 @@ Changes</a></div>
|
||||
LLVM's license is not a "copyleft" license like the GPL). We suggest that you
|
||||
read the <a href="http://www.opensource.org/licenses/UoI-NCSA.php">License</a>
|
||||
if further clarification is needed.</p>
|
||||
|
||||
|
||||
<p>In addition to the UIUC license, the runtime library components of LLVM
|
||||
(<b>compiler_rt and libc++</b>) are also licensed under the <a
|
||||
href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>,
|
||||
which does not contain the binary redistribution clause. As a user of these
|
||||
runtime libraries, it means that you can choose to use the code under either
|
||||
license (and thus don't need the binary redistribution clause), and as a
|
||||
contributor to the code that you agree that any contributions to these
|
||||
libraries be licensed under both licenses. We feel that this is important
|
||||
for runtime libraries, because they are implicitly linked into applications
|
||||
and therefore should not subject those applications to the binary
|
||||
redistribution clause. This also means that it is ok to move code from (e.g.)
|
||||
libc++ to the LLVM core without concern, but that code cannot be moved from
|
||||
the LLVM core to libc++ without the copyright owner's permission.
|
||||
</p>
|
||||
|
||||
<p>Note that the LLVM Project does distribute llvm-gcc, <b>which is GPL.</b>
|
||||
This means that anything "linked" into llvm-gcc must itself be compatible
|
||||
with the GPL, and must be releasable under the terms of the GPL. This
|
||||
@ -563,7 +581,7 @@ Changes</a></div>
|
||||
|
||||
<p>We have no plans to change the license of LLVM. If you have questions or
|
||||
comments about the license, please contact the
|
||||
<a href="mailto:llvm-oversight@cs.uiuc.edu">LLVM Oversight Group</a>.</p>
|
||||
<a href="mailto:llvmdev@cs.uiuc.edu">LLVM Developer's Mailing List</a>.</p>
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
@ -584,21 +602,6 @@ Changes</a></div>
|
||||
details.</p>
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsection"><a name="devagree">Developer Agreements</a></div>
|
||||
<div class="doc_text">
|
||||
<p>With regards to the LLVM copyright and licensing, developers agree to assign
|
||||
their copyrights to UIUC for any contribution made so that the entire
|
||||
software base can be managed by a single copyright holder. This implies that
|
||||
any contributions can be licensed under the license that the project
|
||||
uses.</p>
|
||||
|
||||
<p>When contributing code, you also affirm that you are legally entitled to
|
||||
grant this copyright, personally or on behalf of your employer. If the code
|
||||
belongs to some other entity, please raise this issue with the oversight
|
||||
group before the code is committed.</p>
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<hr>
|
||||
<address>
|
||||
@ -609,7 +612,7 @@ Changes</a></div>
|
||||
Written by the
|
||||
<a href="mailto:llvm-oversight@cs.uiuc.edu">LLVM Oversight Group</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-09-02 02:09:17 +0200 (Thu, 02 Sep 2010) $
|
||||
Last modified: $Date: 2010-11-16 22:32:53 +0100 (Tue, 16 Nov 2010) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -40,6 +40,7 @@
|
||||
<li><a href="#llvm_eh_sjlj_longjmp"><tt>llvm.eh.sjlj.longjmp</tt></a></li>
|
||||
<li><a href="#llvm_eh_sjlj_lsda"><tt>llvm.eh.sjlj.lsda</tt></a></li>
|
||||
<li><a href="#llvm_eh_sjlj_callsite"><tt>llvm.eh.sjlj.callsite</tt></a></li>
|
||||
<li><a href="#llvm_eh_sjlj_dispatchsetup"><tt>llvm.eh.sjlj.dispatchsetup</tt></a></li>
|
||||
</ol></li>
|
||||
<li><a href="#asm">Asm Table Formats</a>
|
||||
<ol>
|
||||
@ -419,7 +420,7 @@
|
||||
<div class="doc_text">
|
||||
|
||||
<pre>
|
||||
i32 %<a href="#llvm_eh_selector">llvm.eh.selector</a>(i8*, i8*, i8*, ...)
|
||||
i32 %<a href="#llvm_eh_selector">llvm.eh.selector</a>(i8*, i8*, ...)
|
||||
</pre>
|
||||
|
||||
<p>This intrinsic is used to compare the exception with the given type infos,
|
||||
@ -547,6 +548,23 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="llvm_eh_sjlj_dispatchsetup">llvm.eh.sjlj.dispatchsetup</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<pre>
|
||||
void %<a href="#llvm_eh_sjlj_dispatchsetup">llvm.eh.sjlj.dispatchsetup</a>(i32)
|
||||
</pre>
|
||||
|
||||
<p>For SJLJ based exception handling, the <a href="#llvm_eh_sjlj_dispatchsetup">
|
||||
<tt>llvm.eh.sjlj.dispatchsetup</tt></a> intrinsic is used by targets to do
|
||||
any unwind-edge setup they need. By default, no action is taken. </p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_section">
|
||||
<a name="asm">Asm Table Formats</a>
|
||||
@ -619,7 +637,7 @@
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-05-28 19:07:41 +0200 (Fri, 28 May 2010) $
|
||||
Last modified: $Date: 2010-12-10 00:05:48 +0100 (Fri, 10 Dec 2010) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -598,13 +598,27 @@ idx3 = (char*) &MyVar + 8
|
||||
<a name="overflow"><b>What happens if a GEP computation overflows?</b></a>
|
||||
</div>
|
||||
<div class="doc_text">
|
||||
<p>If the GEP has the <tt>inbounds</tt> keyword, the result value is
|
||||
undefined.</p>
|
||||
<p>If the GEP lacks the <tt>inbounds</tt> keyword, the value is the result
|
||||
from evaluating the implied two's complement integer computation. However,
|
||||
since there's no guarantee of where an object will be allocated in the
|
||||
address space, such values have limited meaning.</p>
|
||||
|
||||
<p>Otherwise, the result value is the result from evaluating the implied
|
||||
two's complement integer computation. However, since there's no
|
||||
guarantee of where an object will be allocated in the address space,
|
||||
such values have limited meaning.</p>
|
||||
<p>If the GEP has the <tt>inbounds</tt> keyword, the result value is
|
||||
undefined (a "<a href="LangRef.html#trapvalues">trap value</a>") if the GEP
|
||||
overflows (i.e. wraps around the end of the address space).</p>
|
||||
|
||||
<p>As such, there are some ramifications of this for inbounds GEPs: scales
|
||||
implied by array/vector/pointer indices are always known to be "nsw" since
|
||||
they are signed values that are scaled by the element size. These values
|
||||
are also allowed to be negative (e.g. "gep i32 *%P, i32 -1") but the
|
||||
pointer itself is logically treated as an unsigned value. This means that
|
||||
GEPs have an asymmetric relation between the pointer base (which is treated
|
||||
as unsigned) and the offset applied to it (which is treated as signed). The
|
||||
result of the additions within the offset calculation cannot have signed
|
||||
overflow, but when applied to the base pointer, there can be signed
|
||||
overflow.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@ -719,7 +733,7 @@ idx3 = (char*) &MyVar + 8
|
||||
<a href="http://validator.w3.org/check/referer"><img
|
||||
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br/>
|
||||
Last modified: $Date: 2010-08-28 06:09:24 +0200 (Sat, 28 Aug 2010) $
|
||||
Last modified: $Date: 2011-02-11 22:50:52 +0100 (Fri, 11 Feb 2011) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -28,6 +28,7 @@
|
||||
<li><a href="#environment">Setting Up Your Environment</a></li>
|
||||
<li><a href="#unpack">Unpacking the LLVM Archives</a></li>
|
||||
<li><a href="#checkout">Checkout LLVM from Subversion</a></li>
|
||||
<li><a href="#git_mirror">LLVM GIT mirror</a></li>
|
||||
<li><a href="#installcf">Install the GCC Front End</a></li>
|
||||
<li><a href="#config">Local LLVM Configuration</a></li>
|
||||
<li><a href="#compile">Compiling the LLVM Suite Source Code</a></li>
|
||||
@ -44,10 +45,9 @@
|
||||
<li><a href="#projects"><tt>llvm/projects</tt></a></li>
|
||||
<li><a href="#runtime"><tt>llvm/runtime</tt></a></li>
|
||||
<li><a href="#test"><tt>llvm/test</tt></a></li>
|
||||
<li><a href="#llvmtest"><tt>llvm-test</tt></a></li>
|
||||
<li><a href="#test-suite"><tt>test-suite</tt></a></li>
|
||||
<li><a href="#tools"><tt>llvm/tools</tt></a></li>
|
||||
<li><a href="#utils"><tt>llvm/utils</tt></a></li>
|
||||
<li><a href="#win32"><tt>llvm/win32</tt></a></li>
|
||||
</ol></li>
|
||||
|
||||
<li><a href="#tutorial">An Example Using the LLVM Tool Chain</a>
|
||||
@ -80,11 +80,12 @@
|
||||
<p>Welcome to LLVM! In order to get started, you first need to know some
|
||||
basic information.</p>
|
||||
|
||||
<p>First, LLVM comes in two pieces. The first piece is the LLVM suite. This
|
||||
contains all of the tools, libraries, and header files needed to use the low
|
||||
level virtual machine. It contains an assembler, disassembler, bitcode
|
||||
analyzer and bitcode optimizer. It also contains a test suite that can be
|
||||
used to test the LLVM tools and the GCC front end.</p>
|
||||
<p>First, LLVM comes in three pieces. The first piece is the LLVM
|
||||
suite. This contains all of the tools, libraries, and header files
|
||||
needed to use the low level virtual machine. It contains an
|
||||
assembler, disassembler, bitcode analyzer and bitcode optimizer. It
|
||||
also contains basic regression tests that can be used to test the LLVM
|
||||
tools and the GCC front end.</p>
|
||||
|
||||
<p>The second piece is the GCC front end. This component provides a version of
|
||||
GCC that compiles C and C++ code into LLVM bitcode. Currently, the GCC front
|
||||
@ -93,7 +94,7 @@ compiled into LLVM bitcode, a program can be manipulated with the LLVM tools
|
||||
from the LLVM suite.</p>
|
||||
|
||||
<p>
|
||||
There is a third, optional piece called llvm-test. It is a suite of programs
|
||||
There is a third, optional piece called Test Suite. It is a suite of programs
|
||||
with a testing harness that can be used to further test LLVM's functionality
|
||||
and performance.
|
||||
</p>
|
||||
@ -142,6 +143,7 @@ and performance.
|
||||
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
|
||||
<li><tt>cd llvm/projects</tt>
|
||||
<li><tt>gunzip --stdout llvm-test-<i>version</i>.tar.gz | tar -xvf -</tt>
|
||||
<li><tt>mv llvm-test-<i>version</i> test-suite</tt>
|
||||
</ol></li>
|
||||
|
||||
</ul></li>
|
||||
@ -162,7 +164,7 @@ and performance.
|
||||
<p>Optionally, specify for <i>directory</i> the full pathname of the
|
||||
C/C++ front end installation to use with this LLVM configuration. If
|
||||
not specified, the PATH will be searched. This is only needed if you
|
||||
want to run the testsuite or do some special kinds of LLVM builds.</p></li>
|
||||
want to run test-suite or do some special kinds of LLVM builds.</p></li>
|
||||
<li><tt>--enable-spec2000=<i>directory</i></tt>
|
||||
<p>Enable the SPEC2000 benchmarks for testing. The SPEC2000
|
||||
benchmarks should be available in
|
||||
@ -242,6 +244,11 @@ software you will need.</p>
|
||||
<td>x86<sup><a href="#pf_1">1</a></sup></td>
|
||||
<td>GCC</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FreeBSD</td>
|
||||
<td>amd64</td>
|
||||
<td>GCC</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MacOS X<sup><a href="#pf_2">2</a></sup></td>
|
||||
<td>PowerPC</td>
|
||||
@ -564,6 +571,9 @@ as the previous one. It appears to work with ENABLE_OPTIMIZED=0 (the default).</
|
||||
<p><b>GCC 4.3.3 (Debian 4.3.3-10) on ARM</b>: Miscompiles parts of LLVM 2.6
|
||||
when optimizations are turned on. The symptom is an infinite loop in
|
||||
FoldingSetImpl::RemoveNode while running the code generator.</p>
|
||||
<p><b>GCC 4.3.5 and GCC 4.4.5 on ARM</b>: These can miscompile <tt>value >>
|
||||
1</tt> even at -O0. A test failure in <tt>test/Assembler/alignstack.ll</tt> is
|
||||
one symptom of the problem.
|
||||
<p><b>GNU ld 2.16.X</b>. Some 2.16.X versions of the ld linker will produce very
|
||||
long warning messages complaining that some ".gnu.linkonce.t.*" symbol was
|
||||
defined in a discarded section. You can safely ignore these messages as they are
|
||||
@ -684,7 +694,7 @@ compressed with the gzip program.
|
||||
<dd>Source release for the LLVM libraries and tools.<br></dd>
|
||||
|
||||
<dt><tt>llvm-test-x.y.tar.gz</tt></dt>
|
||||
<dd>Source release for the LLVM test suite.</dd>
|
||||
<dd>Source release for the LLVM test-suite.</dd>
|
||||
|
||||
<dt><tt>llvm-gcc-4.2-x.y.source.tar.gz</tt></dt>
|
||||
<dd>Source release of the llvm-gcc-4.2 front end. See README.LLVM in the root
|
||||
@ -726,6 +736,8 @@ revision), you can checkout it from the '<tt>tags</tt>' directory (instead of
|
||||
subdirectories of the '<tt>tags</tt>' directory:</p>
|
||||
|
||||
<ul>
|
||||
<li>Release 2.8: <b>RELEASE_28</b></li>
|
||||
<li>Release 2.7: <b>RELEASE_27</b></li>
|
||||
<li>Release 2.6: <b>RELEASE_26</b></li>
|
||||
<li>Release 2.5: <b>RELEASE_25</b></li>
|
||||
<li>Release 2.4: <b>RELEASE_24</b></li>
|
||||
@ -751,7 +763,7 @@ you get it from the Subversion repository:</p>
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
% cd llvm/projects
|
||||
% svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
|
||||
% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@ -765,6 +777,25 @@ instructions</a> to successfully get and build the LLVM GCC front-end.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="git_mirror">GIT mirror</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>GIT mirrors are available for a number of LLVM subprojects. These mirrors
|
||||
sync automatically with each Subversion commit and contain all necessary
|
||||
git-svn marks (so, you can recreate git-svn metadata locally). Note that right
|
||||
now mirrors reflect only <tt>trunk</tt> for each project. You can do the
|
||||
read-only GIT clone of LLVM via:
|
||||
<pre>
|
||||
% git clone http://llvm.org/git/llvm.git
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="installcf">Install the GCC Front End</a>
|
||||
@ -774,7 +805,7 @@ instructions</a> to successfully get and build the LLVM GCC front-end.</p>
|
||||
|
||||
<p>Before configuring and compiling the LLVM suite (or if you want to use just the LLVM
|
||||
GCC front end) you can optionally extract the front end from the binary distribution.
|
||||
It is used for running the llvm-test testsuite and for compiling C/C++ programs. Note that
|
||||
It is used for running the LLVM test-suite and for compiling C/C++ programs. Note that
|
||||
you can optionally <a href="GCCFEBuildInstrs.html">build llvm-gcc yourself</a> after building the
|
||||
main LLVM repository.</p>
|
||||
|
||||
@ -795,9 +826,9 @@ to your <tt>PATH</tt> environment variable. For example, if you uncompressed th
|
||||
|
||||
<p>If you now want to build LLVM from source, when you configure LLVM, it will
|
||||
automatically detect <tt>llvm-gcc</tt>'s presence (if it is in your path) enabling its
|
||||
use in llvm-test. Note that you can always build or install <tt>llvm-gcc</tt> at any
|
||||
use in test-suite. Note that you can always build or install <tt>llvm-gcc</tt> at any
|
||||
point after building the main LLVM repository: just reconfigure llvm and
|
||||
llvm-test will pick it up.
|
||||
test-suite will pick it up.
|
||||
</p>
|
||||
|
||||
<p>As a convenience for Windows users, the front end binaries for MinGW/x86 include
|
||||
@ -1348,7 +1379,7 @@ end to compile.</p>
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection"><a name="llvmtest"><tt>test-suite</tt></a></div>
|
||||
<div class="doc_subsection"><a name="test-suite"><tt>test-suite</tt></a></div>
|
||||
<div class="doc_text">
|
||||
<p>This is not a directory in the normal llvm module; it is a separate
|
||||
Subversion
|
||||
@ -1408,7 +1439,7 @@ information is in the <a href="CommandGuide/index.html">Command Guide</a>.</p>
|
||||
|
||||
<dt><tt><b>llvm-ld</b></tt></dt>
|
||||
<dd><tt>llvm-ld</tt> is a general purpose and extensible linker for LLVM.
|
||||
This is the linker invoked by <tt>llvmc</tt>. It performsn standard link time
|
||||
This is the linker invoked by <tt>llvmc</tt>. It performs standard link time
|
||||
optimizations and allows optimization modules to be loaded and run so that
|
||||
language specific optimizations can be applied at link time.</dd>
|
||||
|
||||
@ -1511,15 +1542,6 @@ are code generators for parts of LLVM infrastructure.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection"><a name="win32"><tt>llvm/win32</tt></a></div>
|
||||
<div class="doc_text">
|
||||
<p>This directory contains build scripts and project files for use with
|
||||
Visual C++. This allows developers on Windows to build LLVM without the need
|
||||
for Cygwin. The contents of this directory should be considered experimental
|
||||
at this time.
|
||||
</p>
|
||||
</div>
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
<a name="tutorial">An Example Using the LLVM Tool Chain</a>
|
||||
@ -1673,7 +1695,7 @@ out:</p>
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.x10sys.com/rspencer/">Reid Spencer</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-07-08 10:27:18 +0200 (Thu, 08 Jul 2010) $
|
||||
Last modified: $Date: 2011-02-01 21:08:28 +0100 (Tue, 01 Feb 2011) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -14,26 +14,19 @@
|
||||
|
||||
<ul>
|
||||
<li><a href="#overview">Overview</a>
|
||||
<li><a href="#quickstart">Getting Started Quickly (A Summary)</a>
|
||||
<li><a href="#requirements">Requirements</a>
|
||||
<ol>
|
||||
<li><a href="#hardware">Hardware</a>
|
||||
<li><a href="#software">Software</a>
|
||||
</ol></li>
|
||||
|
||||
<li><a href="#starting">Getting Started with LLVM</a>
|
||||
<ol>
|
||||
<li><a href="#terminology">Terminology and Notation</a>
|
||||
<li><a href="#objfiles">The Location of LLVM Object Files</a>
|
||||
</ol></li>
|
||||
|
||||
<li><a href="#quickstart">Getting Started</a>
|
||||
<li><a href="#tutorial">An Example Using the LLVM Tool Chain</a>
|
||||
<li><a href="#problems">Common Problems</a>
|
||||
<li><a href="#links">Links</a>
|
||||
</ul>
|
||||
|
||||
<div class="doc_author">
|
||||
<p>Written by:
|
||||
<p>Written by:
|
||||
<a href="mailto:jeffc@jolt-lang.org">Jeff Cohen</a>
|
||||
</p>
|
||||
</div>
|
||||
@ -47,26 +40,30 @@
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The Visual Studio port at this time is experimental. It is suitable for
|
||||
use only if you are writing your own compiler front end or otherwise have a
|
||||
need to dynamically generate machine code. The JIT and interpreter are
|
||||
functional, but it is currently not possible to generate assembly code which
|
||||
is then assembled into an executable. You can indirectly create executables
|
||||
by using the C back end.</p>
|
||||
<p>Welcome to LLVM on Windows! This document only covers LLVM on Windows using
|
||||
Visual Studio, not mingw or cygwin. In order to get started, you first need to
|
||||
know some basic information.</p>
|
||||
|
||||
<p>To emphasize, there is no C/C++ front end currently available.
|
||||
<tt>llvm-gcc</tt> is based on GCC, which cannot be bootstrapped using VC++.
|
||||
Eventually there should be a <tt>llvm-gcc</tt> based on Cygwin or MinGW that
|
||||
is usable. There is also the option of generating bitcode files on Unix and
|
||||
copying them over to Windows. But be aware the odds of linking C++ code
|
||||
compiled with <tt>llvm-gcc</tt> with code compiled with VC++ is essentially
|
||||
zero.</p>
|
||||
<p>There are many different projects that compose LLVM. The first is the LLVM
|
||||
suite. This contains all of the tools, libraries, and header files needed to
|
||||
use the low level virtual machine. It contains an assembler, disassembler,
|
||||
bitcode analyzer and bitcode optimizer. It also contains a test suite that can
|
||||
be used to test the LLVM tools.</p>
|
||||
|
||||
<p>The LLVM test suite cannot be run on the Visual Studio port at this
|
||||
<p>Another useful project on Windows is
|
||||
<a href="http://clang.llvm.org/">clang</a>. Clang is a C family
|
||||
([Objective]C/C++) compiler. Clang mostly works on Windows, but does not
|
||||
currently understand all of the Microsoft extensions to C and C++. Because of
|
||||
this, clang cannot parse the C++ standard library included with Visual Studio,
|
||||
nor parts of the Windows Platform SDK. However, most standard C programs do
|
||||
compile. Clang can be used to emit bitcode, directly emit object files or
|
||||
even linked executables using Visual Studio's <tt>link.exe</tt></p>
|
||||
|
||||
<p>The large LLVM test suite cannot be run on the Visual Studio port at this
|
||||
time.</p>
|
||||
|
||||
<p>Most of the tools build and work. <tt>bugpoint</tt> does build, but does
|
||||
not work. The other tools 'should' work, but have not been fully tested.</p>
|
||||
not work.</p>
|
||||
|
||||
<p>Additional information about the LLVM directory structure and tool chain
|
||||
can be found on the main <a href="GettingStarted.html">Getting Started</a>
|
||||
@ -76,7 +73,56 @@
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
<a name="quickstart"><b>Getting Started Quickly (A Summary)</b></a>
|
||||
<a name="requirements"><b>Requirements</b></a>
|
||||
</div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Before you begin to use the LLVM system, review the requirements given
|
||||
below. This may save you some trouble by knowing ahead of time what hardware
|
||||
and software you will need.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="hardware"><b>Hardware</b></a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Any system that can adequately run Visual Studio .NET 2005 SP1 is fine.
|
||||
The LLVM source tree and object files, libraries and executables will consume
|
||||
approximately 3GB.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection"><a name="software"><b>Software</b></a></div>
|
||||
<div class="doc_text">
|
||||
|
||||
<p>You will need Visual Studio .NET 2005 SP1 or higher. The VS2005 SP1
|
||||
beta and the normal VS2005 still have bugs that are not completely
|
||||
compatible. Earlier versions of Visual Studio do not support the C++ standard
|
||||
well enough and will not work.</p>
|
||||
|
||||
<p>You will also need the <a href="http://www.cmake.org/">CMake</a> build
|
||||
system since it generates the project files you will use to build with.</p>
|
||||
|
||||
<p>If you would like to run the LLVM tests you will need
|
||||
<a href="http://www.python.org/">Python</a>. Versions 2.4-2.7 are known to
|
||||
work. You will need <a href="http://gnuwin32.sourceforge.net/">"GnuWin32"</a>
|
||||
tools, too.</p>
|
||||
|
||||
<p>Do not install the LLVM directory tree into a path containing spaces (e.g.
|
||||
C:\Documents and Settings\...) as the configure step will fail.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
<a name="quickstart"><b>Getting Started</b></a>
|
||||
</div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
@ -102,164 +148,83 @@
|
||||
<li>With anonymous Subversion access:
|
||||
<ol>
|
||||
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt></li>
|
||||
<li><tt>svn co http://llvm.org/svn/llvm-project/llvm-top/trunk llvm-top
|
||||
</tt></li>
|
||||
<li><tt>make checkout MODULE=llvm</tt>
|
||||
<li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
|
||||
<li><tt>cd llvm</tt></li>
|
||||
</ol></li>
|
||||
</ul></li>
|
||||
|
||||
|
||||
<li> Use <a href="http://www.cmake.org/">CMake</a> to generate up-to-date
|
||||
project files:
|
||||
<ul><li>This step is currently optional as LLVM does still come with a
|
||||
normal Visual Studio solution file, but it is not always kept up-to-date
|
||||
and will soon be deprecated in favor of the multi-platform generator
|
||||
CMake.</li>
|
||||
<li>If CMake is installed then the most simple way is to just start the
|
||||
CMake GUI, select the directory where you have LLVM extracted to, and
|
||||
the default options should all be fine. The one option you may really
|
||||
want to change, regardless of anything else, might be the
|
||||
CMAKE_INSTALL_PREFIX setting to select a directory to INSTALL to once
|
||||
compiling is complete.</li>
|
||||
<li>If you use CMake to generate the Visual Studio solution and project
|
||||
files, then the Solution will have a few extra options compared to the
|
||||
current included one. The projects may still be built individually, but
|
||||
<ul>
|
||||
<li>Once CMake is installed then the simplest way is to just start the
|
||||
CMake GUI, select the directory where you have LLVM extracted to, and the
|
||||
default options should all be fine. One option you may really want to
|
||||
change, regardless of anything else, might be the CMAKE_INSTALL_PREFIX
|
||||
setting to select a directory to INSTALL to once compiling is complete,
|
||||
although installation is not mandatory for using LLVM. Another important
|
||||
option is LLVM_TARGETS_TO_BUILD, which controls the LLVM target
|
||||
architectures that are included on the build.
|
||||
<li>See the <a href="CMake.html">LLVM CMake guide</a> for
|
||||
detailed information about how to configure the LLVM
|
||||
build.</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>Start Visual Studio
|
||||
<ul>
|
||||
<li>In the directory you created the project files will have
|
||||
an <tt>llvm.sln</tt> file, just double-click on that to open
|
||||
Visual Studio.</li>
|
||||
</ul></li>
|
||||
|
||||
<li>Build the LLVM Suite:
|
||||
<ul>
|
||||
<li>The projects may still be built individually, but
|
||||
to build them all do not just select all of them in batch build (as some
|
||||
are meant as configuration projects), but rather select and build just
|
||||
the ALL_BUILD project to build everything, or the INSTALL project, which
|
||||
first builds the ALL_BUILD project, then installs the LLVM headers, libs,
|
||||
and other useful things to the directory set by the CMAKE_INSTALL_PREFIX
|
||||
setting when you first configured CMake.</li>
|
||||
</ul>
|
||||
<li>The Fibonacci project is a sample program that uses the JIT.
|
||||
Modify the project's debugging properties to provide a numeric
|
||||
command line argument or run it from the command line. The
|
||||
program will print the corresponding fibonacci value.</li>
|
||||
</ul></li>
|
||||
|
||||
<li>Test LLVM on Visual Studio:
|
||||
<ul>
|
||||
<li>If %PATH% does not contain GnuWin32, you may specify LLVM_LIT_TOOLS_DIR
|
||||
on CMake for the path to GnuWin32.</li>
|
||||
<li>You can run LLVM tests to build the project "check".</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>Start Visual Studio
|
||||
<!-- FIXME: Is it up-to-date? -->
|
||||
<li>Test LLVM:
|
||||
<ul>
|
||||
<li>If you did not use CMake, then simply double click on the solution
|
||||
file <tt>llvm/win32/llvm.sln</tt>.</li>
|
||||
<li>If you used CMake, then the directory you created the project files,
|
||||
the root directory will have an <tt>llvm.sln</tt> file, just
|
||||
double-click on that to open Visual Studio.</li>
|
||||
</ul></li>
|
||||
<li>The LLVM tests can be run by <tt>cd</tt>ing to the llvm source directory
|
||||
and running:
|
||||
|
||||
<li>Build the LLVM Suite:
|
||||
<ul>
|
||||
<li>Simply build the solution.</li>
|
||||
<li>The Fibonacci project is a sample program that uses the JIT. Modify
|
||||
the project's debugging properties to provide a numeric command line
|
||||
argument. The program will print the corresponding fibonacci value.</li>
|
||||
</ul></li>
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
% llvm-lit test
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>Note that quite a few of these test will fail.</p>
|
||||
</li>
|
||||
|
||||
<li>A specific test or test directory can be run with:</li>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
% llvm-lit test/path/to/test
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</ol>
|
||||
|
||||
<p>It is strongly encouraged that you get the latest version from Subversion as
|
||||
changes are continually making the VS support better.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
<a name="requirements"><b>Requirements</b></a>
|
||||
</div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Before you begin to use the LLVM system, review the requirements given
|
||||
below. This may save you some trouble by knowing ahead of time what hardware
|
||||
and software you will need.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="hardware"><b>Hardware</b></a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Any system that can adequately run Visual Studio .NET 2005 SP1 is fine.
|
||||
The LLVM source tree and object files, libraries and executables will consume
|
||||
approximately 3GB.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection"><a name="software"><b>Software</b></a></div>
|
||||
<div class="doc_text">
|
||||
|
||||
<p>You will need Visual Studio .NET 2005 SP1 or higher. The VS2005 SP1
|
||||
beta and the normal VS2005 still have bugs that are not completely
|
||||
compatible. VS2003 would work except (at last check) it has a bug with
|
||||
friend classes that you can work-around with some minor code rewriting
|
||||
(and please submit a patch if you do). Earlier versions of Visual Studio
|
||||
do not support the C++ standard well enough and will not work.</p>
|
||||
|
||||
<p>You will also need the <a href="http://www.cmake.org/">CMake</a> build
|
||||
system since it generates the project files you will use to build with.</p>
|
||||
|
||||
<p>
|
||||
Do not install the LLVM directory tree into a path containing spaces (e.g.
|
||||
C:\Documents and Settings\...) as the configure step will fail.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
<a name="starting"><b>Getting Started with LLVM</b></a>
|
||||
</div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The remainder of this guide is meant to get you up and running with
|
||||
LLVM using Visual Studio and to give you some basic information about the LLVM
|
||||
environment.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="terminology">Terminology and Notation</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Throughout this manual, the following names are used to denote paths
|
||||
specific to the local system and working environment. <i>These are not
|
||||
environment variables you need to set but just strings used in the rest
|
||||
of this document below</i>. In any of the examples below, simply replace
|
||||
each of these names with the appropriate pathname on your local system.
|
||||
All these paths are absolute:</p>
|
||||
|
||||
<dl>
|
||||
<dt>SRC_ROOT</dt>
|
||||
<dd><p>This is the top level directory of the LLVM source tree.</p></dd>
|
||||
|
||||
<dt>OBJ_ROOT</dt>
|
||||
<dd><p>This is the top level directory of the LLVM object tree (i.e. the
|
||||
tree where object files and compiled programs will be placed. It is
|
||||
fixed at SRC_ROOT/win32).</p></dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="objfiles">The Location of LLVM Object Files</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The object files are placed under <tt>OBJ_ROOT/Debug</tt> for debug builds
|
||||
and <tt>OBJ_ROOT/Release</tt> for release (optimized) builds. These include
|
||||
both executables and libararies that your application can link against.</p>
|
||||
|
||||
<p>The files that <tt>configure</tt> would create when building on Unix are
|
||||
created by the <tt>Configure</tt> project and placed in
|
||||
<tt>OBJ_ROOT/llvm</tt>. You application must have OBJ_ROOT in its include
|
||||
search path just before <tt>SRC_ROOT/include</tt>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
@ -286,7 +251,7 @@ int main() {
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
% llvm-gcc -c hello.c -emit-llvm -o hello.bc
|
||||
% clang -c hello.c -emit-llvm -o hello.bc
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@ -295,23 +260,27 @@ int main() {
|
||||
facilities that it required. You can execute this file directly using
|
||||
<tt>lli</tt> tool, compile it to native assembly with the <tt>llc</tt>,
|
||||
optimize or analyze it further with the <tt>opt</tt> tool, etc.</p>
|
||||
|
||||
<p><b>Note: while you cannot do this step on Windows, you can do it on a
|
||||
Unix system and transfer <tt>hello.bc</tt> to Windows. Important:
|
||||
transfer as a binary file!</b></p></li>
|
||||
|
||||
<p>Alternatively you can directly output an executable with clang with:
|
||||
</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
% clang hello.c -o hello.exe
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>The <tt>-o hello.exe</tt> is required because clang currently outputs
|
||||
<tt>a.out</tt> when neither <tt>-o</tt> nor <tt>-c</tt> are given.</p>
|
||||
|
||||
<li><p>Run the program using the just-in-time compiler:</p>
|
||||
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
% lli hello.bc
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>Note: this will only work for trivial C programs. Non-trivial programs
|
||||
(and any C++ program) will have dependencies on the GCC runtime that
|
||||
won't be satisfied by the Microsoft runtime libraries.</p></li>
|
||||
|
||||
<li><p>Use the <tt>llvm-dis</tt> utility to take a look at the LLVM assembly
|
||||
code:</p>
|
||||
|
||||
@ -321,31 +290,27 @@ int main() {
|
||||
</pre>
|
||||
</div></li>
|
||||
|
||||
<li><p>Compile the program to C using the LLC code generator:</p>
|
||||
<li><p>Compile the program to object code using the LLC code generator:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
% llc -march=c hello.bc
|
||||
% llc -filetype=obj hello.bc
|
||||
</pre>
|
||||
</div></li>
|
||||
|
||||
<li><p>Compile to binary using Microsoft C:</p>
|
||||
<li><p>Link to binary using Microsoft link:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
% cl hello.cbe.c
|
||||
% link hello.obj -defaultlib:libcmt
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>Note: this will only work for trivial C programs. Non-trivial programs
|
||||
(and any C++ program) will have dependencies on the GCC runtime that won't
|
||||
be satisfied by the Microsoft runtime libraries.</p></li>
|
||||
|
||||
<li><p>Execute the native code program:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
% hello.cbe.exe
|
||||
% hello.exe
|
||||
</pre>
|
||||
</div></li>
|
||||
</ol>
|
||||
@ -360,17 +325,6 @@ int main() {
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<ul>
|
||||
<li>In Visual C++, if you are linking with the x86 target statically, the
|
||||
linker will remove the x86 target library from your generated executable or
|
||||
shared library because there are no references to it. You can force the
|
||||
linker to include these references by using
|
||||
<tt>"/INCLUDE:_X86TargetMachineModule"</tt> when linking. In the Visual
|
||||
Studio IDE, this can be added in
|
||||
<tt>Project Properties->Linker->Input->Force Symbol References</tt>.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>If you are having problems building or using LLVM, or if you have any other
|
||||
general questions about LLVM, please consult the <a href="FAQ.html">Frequently
|
||||
Asked Questions</a> page.</p>
|
||||
@ -411,7 +365,7 @@ out:</p>
|
||||
|
||||
<a href="mailto:jeffc@jolt-lang.org">Jeff Cohen</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
|
||||
Last modified: $Date: 2011-02-09 05:19:28 +0100 (Wed, 09 Feb 2011) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -55,7 +55,7 @@ mkdir binutils
|
||||
cd binutils
|
||||
cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src login
|
||||
<em>{enter "anoncvs" as the password}</em>
|
||||
cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src co src
|
||||
cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src co binutils
|
||||
mkdir build
|
||||
cd build
|
||||
../src/configure --enable-gold --enable-plugins
|
||||
|
@ -62,6 +62,7 @@
|
||||
<ol>
|
||||
<li><a href="#t_integer">Integer Type</a></li>
|
||||
<li><a href="#t_floating">Floating Point Types</a></li>
|
||||
<li><a href="#t_x86mmx">X86mmx Type</a></li>
|
||||
<li><a href="#t_void">Void Type</a></li>
|
||||
<li><a href="#t_label">Label Type</a></li>
|
||||
<li><a href="#t_metadata">Metadata Type</a></li>
|
||||
@ -492,7 +493,7 @@
|
||||
|
||||
<pre class="doc_code">
|
||||
<i>; Declare the string constant as a global constant.</i>
|
||||
<a href="#identifiers">@.LC0</a> = <a href="#linkage_internal">internal</a> <a href="#globalvars">constant</a> <a href="#t_array">[13 x i8]</a> c"hello world\0A\00" <i>; [13 x i8]*</i>
|
||||
<a href="#identifiers">@.LC0</a> = <a href="#linkage_internal">internal</a> <a href="#globalvars">constant</a> <a href="#t_array">[13 x i8]</a> c"hello world\0A\00" <i>; [13 x i8]*</i>
|
||||
|
||||
<i>; External declaration of the puts function</i>
|
||||
<a href="#functionstructure">declare</a> i32 @puts(i8*) <i>; i32 (i8*)* </i>
|
||||
@ -845,6 +846,13 @@ define i32 @main() { <i>; i32()* </i>
|
||||
region of memory, and all memory objects in LLVM are accessed through
|
||||
pointers.</p>
|
||||
|
||||
<p>Global variables can be marked with <tt>unnamed_addr</tt> which indicates
|
||||
that the address is not significant, only the content. Constants marked
|
||||
like this can be merged with other constants if they have the same
|
||||
initializer. Note that a constant with significant address <em>can</em>
|
||||
be merged with a <tt>unnamed_addr</tt> constant, the result being a
|
||||
constant whose address is significant.</p>
|
||||
|
||||
<p>A global variable may be declared to reside in a target-specific numbered
|
||||
address space. For targets that support them, address spaces may affect how
|
||||
optimizations are performed and/or what target instructions are used to
|
||||
@ -884,7 +892,8 @@ define i32 @main() { <i>; i32()* </i>
|
||||
<p>LLVM function definitions consist of the "<tt>define</tt>" keyword, an
|
||||
optional <a href="#linkage">linkage type</a>, an optional
|
||||
<a href="#visibility">visibility style</a>, an optional
|
||||
<a href="#callingconv">calling convention</a>, a return type, an optional
|
||||
<a href="#callingconv">calling convention</a>,
|
||||
an optional <tt>unnamed_addr</tt> attribute, a return type, an optional
|
||||
<a href="#paramattrs">parameter attribute</a> for the return type, a function
|
||||
name, a (possibly empty) argument list (each with optional
|
||||
<a href="#paramattrs">parameter attributes</a>), optional
|
||||
@ -895,7 +904,8 @@ define i32 @main() { <i>; i32()* </i>
|
||||
<p>LLVM function declarations consist of the "<tt>declare</tt>" keyword, an
|
||||
optional <a href="#linkage">linkage type</a>, an optional
|
||||
<a href="#visibility">visibility style</a>, an optional
|
||||
<a href="#callingconv">calling convention</a>, a return type, an optional
|
||||
<a href="#callingconv">calling convention</a>,
|
||||
an optional <tt>unnamed_addr</tt> attribute, a return type, an optional
|
||||
<a href="#paramattrs">parameter attribute</a> for the return type, a function
|
||||
name, a possibly empty list of arguments, an optional alignment, and an
|
||||
optional <a href="#gc">garbage collector name</a>.</p>
|
||||
@ -921,6 +931,9 @@ define i32 @main() { <i>; i32()* </i>
|
||||
specified, the function is forced to have at least that much alignment. All
|
||||
alignments must be a power of 2.</p>
|
||||
|
||||
<p>If the <tt>unnamed_addr</tt> attribute is given, the address is know to not
|
||||
be significant and two identical functions can be merged</p>.
|
||||
|
||||
<h5>Syntax:</h5>
|
||||
<pre class="doc_code">
|
||||
define [<a href="#linkage">linkage</a>] [<a href="#visibility">visibility</a>]
|
||||
@ -1020,8 +1033,9 @@ declare signext i8 @returns_signed_char()
|
||||
registers). Use of this attribute is target-specific.</dd>
|
||||
|
||||
<dt><tt><b><a name="byval">byval</a></b></tt></dt>
|
||||
<dd>This indicates that the pointer parameter should really be passed by value
|
||||
to the function. The attribute implies that a hidden copy of the pointee
|
||||
<dd><p>This indicates that the pointer parameter should really be passed by
|
||||
value to the function. The attribute implies that a hidden copy of the
|
||||
pointee
|
||||
is made between the caller and the callee, so the callee is unable to
|
||||
modify the value in the callee. This attribute is only valid on LLVM
|
||||
pointer arguments. It is generally used to pass structs and arrays by
|
||||
@ -1029,10 +1043,13 @@ declare signext i8 @returns_signed_char()
|
||||
to belong to the caller not the callee (for example,
|
||||
<tt><a href="#readonly">readonly</a></tt> functions should not write to
|
||||
<tt>byval</tt> parameters). This is not a valid attribute for return
|
||||
values. The byval attribute also supports specifying an alignment with
|
||||
the align attribute. This has a target-specific effect on the code
|
||||
generator that usually indicates a desired alignment for the synthesized
|
||||
stack slot.</dd>
|
||||
values.</p>
|
||||
|
||||
<p>The byval attribute also supports specifying an alignment with
|
||||
the align attribute. It indicates the alignment of the stack slot to
|
||||
form and the known alignment of the pointer specified to the call site. If
|
||||
the alignment is not specified, then the code generator makes a
|
||||
target-specific assumption.</p></dd>
|
||||
|
||||
<dt><tt><b><a name="sret">sret</a></b></tt></dt>
|
||||
<dd>This indicates that the pointer parameter specifies the address of a
|
||||
@ -1130,6 +1147,14 @@ define void @f() optsize { ... }
|
||||
function into callers whenever possible, ignoring any active inlining size
|
||||
threshold for this caller.</dd>
|
||||
|
||||
<dt><tt><b>hotpatch</b></tt></dt>
|
||||
<dd>This attribute indicates that the function should be 'hotpatchable',
|
||||
meaning the function can be patched and/or hooked even while it is
|
||||
loaded into memory. On x86, the function prologue will be preceded
|
||||
by six bytes of padding and will begin with a two-byte instruction.
|
||||
Most of the functions in the Windows system DLLs in Windows XP SP2 or
|
||||
higher were compiled in this fashion.</dd>
|
||||
|
||||
<dt><tt><b>inlinehint</b></tt></dt>
|
||||
<dd>This attribute indicates that the source code contained a hint that inlining
|
||||
this function is desirable (such as the "inline" keyword in C/C++). It
|
||||
@ -1483,7 +1508,9 @@ Classifications</a> </div>
|
||||
<td><a href="#t_primitive">primitive</a></td>
|
||||
<td><a href="#t_label">label</a>,
|
||||
<a href="#t_void">void</a>,
|
||||
<a href="#t_integer">integer</a>,
|
||||
<a href="#t_floating">floating point</a>,
|
||||
<a href="#t_x86mmx">x86mmx</a>,
|
||||
<a href="#t_metadata">metadata</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -1570,6 +1597,21 @@ Classifications</a> </div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"> <a name="t_x86mmx">X86mmx Type</a> </div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<h5>Overview:</h5>
|
||||
<p>The x86mmx type represents a value held in an MMX register on an x86 machine. The operations allowed on it are quite limited: parameters and return values, load and store, and bitcast. User-specified MMX instructions are represented as intrinsic or asm calls with arguments and/or results of this type. There are no arrays, vectors or constants of this type.</p>
|
||||
|
||||
<h5>Syntax:</h5>
|
||||
<pre>
|
||||
x86mmx
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"> <a name="t_void">Void Type</a> </div>
|
||||
|
||||
@ -1893,8 +1935,9 @@ Classifications</a> </div>
|
||||
< <# elements> x <elementtype> >
|
||||
</pre>
|
||||
|
||||
<p>The number of elements is a constant integer value; elementtype may be any
|
||||
integer or floating point type.</p>
|
||||
<p>The number of elements is a constant integer value larger than 0; elementtype
|
||||
may be any integer or floating point type. Vectors of size zero are not
|
||||
allowed, and pointers are not allowed as the element type.</p>
|
||||
|
||||
<h5>Examples:</h5>
|
||||
<table class="layout">
|
||||
@ -2050,6 +2093,7 @@ Classifications</a> </div>
|
||||
they match the long double format on your target. All hexadecimal formats
|
||||
are big-endian (sign bit at the left).</p>
|
||||
|
||||
<p>There are no constants of type x86mmx.</p>
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
@ -2135,8 +2179,8 @@ Classifications</a> </div>
|
||||
|
||||
<p>The string '<tt>undef</tt>' can be used anywhere a constant is expected, and
|
||||
indicates that the user of the value may receive an unspecified bit-pattern.
|
||||
Undefined values may be of any type (other than label or void) and be used
|
||||
anywhere a constant is permitted.</p>
|
||||
Undefined values may be of any type (other than '<tt>label</tt>'
|
||||
or '<tt>void</tt>') and be used anywhere a constant is permitted.</p>
|
||||
|
||||
<p>Undefined values are useful because they indicate to the compiler that the
|
||||
program is well defined no matter what value is used. This gives the
|
||||
@ -2155,7 +2199,7 @@ Safe:
|
||||
</pre>
|
||||
|
||||
<p>This is safe because all of the output bits are affected by the undef bits.
|
||||
Any output bit can have a zero or one depending on the input bits.</p>
|
||||
Any output bit can have a zero or one depending on the input bits.</p>
|
||||
|
||||
<pre class="doc_code">
|
||||
%A = or %X, undef
|
||||
@ -2169,13 +2213,14 @@ Unsafe:
|
||||
</pre>
|
||||
|
||||
<p>These logical operations have bits that are not always affected by the input.
|
||||
For example, if "%X" has a zero bit, then the output of the 'and' operation will
|
||||
always be a zero, no matter what the corresponding bit from the undef is. As
|
||||
such, it is unsafe to optimize or assume that the result of the and is undef.
|
||||
However, it is safe to assume that all bits of the undef could be 0, and
|
||||
optimize the and to 0. Likewise, it is safe to assume that all the bits of
|
||||
the undef operand to the or could be set, allowing the or to be folded to
|
||||
-1.</p>
|
||||
For example, if <tt>%X</tt> has a zero bit, then the output of the
|
||||
'<tt>and</tt>' operation will always be a zero for that bit, no matter what
|
||||
the corresponding bit from the '<tt>undef</tt>' is. As such, it is unsafe to
|
||||
optimize or assume that the result of the '<tt>and</tt>' is '<tt>undef</tt>'.
|
||||
However, it is safe to assume that all bits of the '<tt>undef</tt>' could be
|
||||
0, and optimize the '<tt>and</tt>' to 0. Likewise, it is safe to assume that
|
||||
all the bits of the '<tt>undef</tt>' operand to the '<tt>or</tt>' could be
|
||||
set, allowing the '<tt>or</tt>' to be folded to -1.</p>
|
||||
|
||||
<pre class="doc_code">
|
||||
%A = select undef, %X, %Y
|
||||
@ -2191,13 +2236,14 @@ Unsafe:
|
||||
%C = undef
|
||||
</pre>
|
||||
|
||||
<p>This set of examples show that undefined select (and conditional branch)
|
||||
conditions can go "either way" but they have to come from one of the two
|
||||
operands. In the %A example, if %X and %Y were both known to have a clear low
|
||||
bit, then %A would have to have a cleared low bit. However, in the %C example,
|
||||
the optimizer is allowed to assume that the undef operand could be the same as
|
||||
%Y, allowing the whole select to be eliminated.</p>
|
||||
|
||||
<p>This set of examples shows that undefined '<tt>select</tt>' (and conditional
|
||||
branch) conditions can go <em>either way</em>, but they have to come from one
|
||||
of the two operands. In the <tt>%A</tt> example, if <tt>%X</tt> and
|
||||
<tt>%Y</tt> were both known to have a clear low bit, then <tt>%A</tt> would
|
||||
have to have a cleared low bit. However, in the <tt>%C</tt> example, the
|
||||
optimizer is allowed to assume that the '<tt>undef</tt>' operand could be the
|
||||
same as <tt>%Y</tt>, allowing the whole '<tt>select</tt>' to be
|
||||
eliminated.</p>
|
||||
|
||||
<pre class="doc_code">
|
||||
%A = xor undef, undef
|
||||
@ -2218,16 +2264,17 @@ Safe:
|
||||
%F = undef
|
||||
</pre>
|
||||
|
||||
<p>This example points out that two undef operands are not necessarily the same.
|
||||
This can be surprising to people (and also matches C semantics) where they
|
||||
assume that "X^X" is always zero, even if X is undef. This isn't true for a
|
||||
number of reasons, but the short answer is that an undef "variable" can
|
||||
arbitrarily change its value over its "live range". This is true because the
|
||||
"variable" doesn't actually <em>have a live range</em>. Instead, the value is
|
||||
logically read from arbitrary registers that happen to be around when needed,
|
||||
so the value is not necessarily consistent over time. In fact, %A and %C need
|
||||
to have the same semantics or the core LLVM "replace all uses with" concept
|
||||
would not hold.</p>
|
||||
<p>This example points out that two '<tt>undef</tt>' operands are not
|
||||
necessarily the same. This can be surprising to people (and also matches C
|
||||
semantics) where they assume that "<tt>X^X</tt>" is always zero, even
|
||||
if <tt>X</tt> is undefined. This isn't true for a number of reasons, but the
|
||||
short answer is that an '<tt>undef</tt>' "variable" can arbitrarily change
|
||||
its value over its "live range". This is true because the variable doesn't
|
||||
actually <em>have a live range</em>. Instead, the value is logically read
|
||||
from arbitrary registers that happen to be around when needed, so the value
|
||||
is not necessarily consistent over time. In fact, <tt>%A</tt> and <tt>%C</tt>
|
||||
need to have the same semantics or the core LLVM "replace all uses with"
|
||||
concept would not hold.</p>
|
||||
|
||||
<pre class="doc_code">
|
||||
%A = fdiv undef, %X
|
||||
@ -2238,17 +2285,17 @@ b: unreachable
|
||||
</pre>
|
||||
|
||||
<p>These examples show the crucial difference between an <em>undefined
|
||||
value</em> and <em>undefined behavior</em>. An undefined value (like undef) is
|
||||
allowed to have an arbitrary bit-pattern. This means that the %A operation
|
||||
can be constant folded to undef because the undef could be an SNaN, and fdiv is
|
||||
not (currently) defined on SNaN's. However, in the second example, we can make
|
||||
a more aggressive assumption: because the undef is allowed to be an arbitrary
|
||||
value, we are allowed to assume that it could be zero. Since a divide by zero
|
||||
has <em>undefined behavior</em>, we are allowed to assume that the operation
|
||||
does not execute at all. This allows us to delete the divide and all code after
|
||||
it: since the undefined operation "can't happen", the optimizer can assume that
|
||||
it occurs in dead code.
|
||||
</p>
|
||||
value</em> and <em>undefined behavior</em>. An undefined value (like
|
||||
'<tt>undef</tt>') is allowed to have an arbitrary bit-pattern. This means that
|
||||
the <tt>%A</tt> operation can be constant folded to '<tt>undef</tt>', because
|
||||
the '<tt>undef</tt>' could be an SNaN, and <tt>fdiv</tt> is not (currently)
|
||||
defined on SNaN's. However, in the second example, we can make a more
|
||||
aggressive assumption: because the <tt>undef</tt> is allowed to be an
|
||||
arbitrary value, we are allowed to assume that it could be zero. Since a
|
||||
divide by zero has <em>undefined behavior</em>, we are allowed to assume that
|
||||
the operation does not execute at all. This allows us to delete the divide and
|
||||
all code after it. Because the undefined operation "can't happen", the
|
||||
optimizer can assume that it occurs in dead code.</p>
|
||||
|
||||
<pre class="doc_code">
|
||||
a: store undef -> %X
|
||||
@ -2258,11 +2305,11 @@ a: <deleted>
|
||||
b: unreachable
|
||||
</pre>
|
||||
|
||||
<p>These examples reiterate the fdiv example: a store "of" an undefined value
|
||||
can be assumed to not have any effect: we can assume that the value is
|
||||
overwritten with bits that happen to match what was already there. However, a
|
||||
store "to" an undefined location could clobber arbitrary memory, therefore, it
|
||||
has undefined behavior.</p>
|
||||
<p>These examples reiterate the <tt>fdiv</tt> example: a store <em>of</em> an
|
||||
undefined value can be assumed to not have any effect; we can assume that the
|
||||
value is overwritten with bits that happen to match what was already there.
|
||||
However, a store <em>to</em> an undefined location could clobber arbitrary
|
||||
memory, therefore, it has undefined behavior.</p>
|
||||
|
||||
</div>
|
||||
|
||||
@ -2383,18 +2430,17 @@ end:
|
||||
the address of the entry block is illegal.</p>
|
||||
|
||||
<p>This value only has defined behavior when used as an operand to the
|
||||
'<a href="#i_indirectbr"><tt>indirectbr</tt></a>' instruction or for comparisons
|
||||
against null. Pointer equality tests between labels addresses is undefined
|
||||
behavior - though, again, comparison against null is ok, and no label is
|
||||
equal to the null pointer. This may also be passed around as an opaque
|
||||
pointer sized value as long as the bits are not inspected. This allows
|
||||
<tt>ptrtoint</tt> and arithmetic to be performed on these values so long as
|
||||
the original value is reconstituted before the <tt>indirectbr</tt>.</p>
|
||||
'<a href="#i_indirectbr"><tt>indirectbr</tt></a>' instruction, or for
|
||||
comparisons against null. Pointer equality tests between labels addresses
|
||||
results in undefined behavior — though, again, comparison against null
|
||||
is ok, and no label is equal to the null pointer. This may be passed around
|
||||
as an opaque pointer sized value as long as the bits are not inspected. This
|
||||
allows <tt>ptrtoint</tt> and arithmetic to be performed on these values so
|
||||
long as the original value is reconstituted before the <tt>indirectbr</tt>
|
||||
instruction.</p>
|
||||
|
||||
<p>Finally, some targets may provide defined semantics when
|
||||
using the value as the operand to an inline assembly, but that is target
|
||||
specific.
|
||||
</p>
|
||||
<p>Finally, some targets may provide defined semantics when using the value as
|
||||
the operand to an inline assembly, but that is target specific.</p>
|
||||
|
||||
</div>
|
||||
|
||||
@ -2409,7 +2455,7 @@ end:
|
||||
to be used as constants. Constant expressions may be of
|
||||
any <a href="#t_firstclass">first class</a> type and may involve any LLVM
|
||||
operation that does not have side effects (e.g. load and call are not
|
||||
supported). The following is the syntax for constant expressions:</p>
|
||||
supported). The following is the syntax for constant expressions:</p>
|
||||
|
||||
<dl>
|
||||
<dt><b><tt>trunc (CST to TYPE)</tt></b></dt>
|
||||
@ -2596,8 +2642,8 @@ call void asm alignstack "eieio", ""()
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The call instructions that wrap inline asm nodes may have a "!srcloc" MDNode
|
||||
attached to it that contains a constant integer. If present, the code
|
||||
generator will use the integer as the location cookie value when report
|
||||
attached to it that contains a list of constant integers. If present, the
|
||||
code generator will use the integer as the location cookie value when report
|
||||
errors through the LLVMContext error reporting mechanisms. This allows a
|
||||
front-end to correlate backend errors that occur with inline asm back to the
|
||||
source code that produced it. For example:</p>
|
||||
@ -2609,7 +2655,8 @@ call void asm sideeffect "something bad", ""()<b>, !srcloc !42</b>
|
||||
</pre>
|
||||
|
||||
<p>It is up to the front-end to make sense of the magic numbers it places in the
|
||||
IR.</p>
|
||||
IR. If the MDNode contains multiple constants, the code generator will use
|
||||
the one that corresponds to the line of the asm that the error occurs on.</p>
|
||||
|
||||
</div>
|
||||
|
||||
@ -3394,7 +3441,8 @@ Instruction</a> </div>
|
||||
|
||||
<h5>Syntax:</h5>
|
||||
<pre>
|
||||
<result> = udiv <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
<result> = udiv <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
<result> = udiv exact <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
</pre>
|
||||
|
||||
<h5>Overview:</h5>
|
||||
@ -3413,6 +3461,11 @@ Instruction</a> </div>
|
||||
|
||||
<p>Division by zero leads to undefined behavior.</p>
|
||||
|
||||
<p>If the <tt>exact</tt> keyword is present, the result value of the
|
||||
<tt>udiv</tt> is a <a href="#trapvalues">trap value</a> if %op1 is not a
|
||||
multiple of %op2 (as such, "((a udiv exact b) mul b) == a").</p>
|
||||
|
||||
|
||||
<h5>Example:</h5>
|
||||
<pre>
|
||||
<result> = udiv i32 4, %var <i>; yields {i32}:result = 4 / %var</i>
|
||||
@ -3631,7 +3684,10 @@ Instruction</a> </div>
|
||||
|
||||
<h5>Syntax:</h5>
|
||||
<pre>
|
||||
<result> = shl <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
<result> = shl <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
<result> = shl nuw <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
<result> = shl nsw <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
<result> = shl nuw nsw <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
</pre>
|
||||
|
||||
<h5>Overview:</h5>
|
||||
@ -3651,6 +3707,14 @@ Instruction</a> </div>
|
||||
vectors, each vector element of <tt>op1</tt> is shifted by the corresponding
|
||||
shift amount in <tt>op2</tt>.</p>
|
||||
|
||||
<p>If the <tt>nuw</tt> keyword is present, then the shift produces a
|
||||
<a href="#trapvalues">trap value</a> if it shifts out any non-zero bits. If
|
||||
the <tt>nsw</tt> keyword is present, then the shift produces a
|
||||
<a href="#trapvalues">trap value</a> if it shifts out any bits that disagree
|
||||
with the resultant sign bit. As such, NUW/NSW have the same semantics as
|
||||
they would if the shift were expressed as a mul instruction with the same
|
||||
nsw/nuw bits in (mul %op1, (shl 1, %op2)).</p>
|
||||
|
||||
<h5>Example:</h5>
|
||||
<pre>
|
||||
<result> = shl i32 4, %var <i>; yields {i32}: 4 << %var</i>
|
||||
@ -3670,7 +3734,8 @@ Instruction</a> </div>
|
||||
|
||||
<h5>Syntax:</h5>
|
||||
<pre>
|
||||
<result> = lshr <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
<result> = lshr <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
<result> = lshr exact <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
</pre>
|
||||
|
||||
<h5>Overview:</h5>
|
||||
@ -3690,6 +3755,11 @@ Instruction</a> </div>
|
||||
vectors, each vector element of <tt>op1</tt> is shifted by the corresponding
|
||||
shift amount in <tt>op2</tt>.</p>
|
||||
|
||||
<p>If the <tt>exact</tt> keyword is present, the result value of the
|
||||
<tt>lshr</tt> is a <a href="#trapvalues">trap value</a> if any of the bits
|
||||
shifted out are non-zero.</p>
|
||||
|
||||
|
||||
<h5>Example:</h5>
|
||||
<pre>
|
||||
<result> = lshr i32 4, 1 <i>; yields {i32}:result = 2</i>
|
||||
@ -3709,7 +3779,8 @@ Instruction</a> </div>
|
||||
|
||||
<h5>Syntax:</h5>
|
||||
<pre>
|
||||
<result> = ashr <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
<result> = ashr <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
<result> = ashr exact <ty> <op1>, <op2> <i>; yields {ty}:result</i>
|
||||
</pre>
|
||||
|
||||
<h5>Overview:</h5>
|
||||
@ -3730,6 +3801,10 @@ Instruction</a> </div>
|
||||
the arguments are vectors, each vector element of <tt>op1</tt> is shifted by
|
||||
the corresponding shift amount in <tt>op2</tt>.</p>
|
||||
|
||||
<p>If the <tt>exact</tt> keyword is present, the result value of the
|
||||
<tt>ashr</tt> is a <a href="#trapvalues">trap value</a> if any of the bits
|
||||
shifted out are non-zero.</p>
|
||||
|
||||
<h5>Example:</h5>
|
||||
<pre>
|
||||
<result> = ashr i32 4, 1 <i>; yields {i32}:result = 2</i>
|
||||
@ -4097,6 +4172,14 @@ Instruction</a> </div>
|
||||
<a href="#t_array">array</a> type. The operands are constant indices to
|
||||
specify which value to extract in a similar manner as indices in a
|
||||
'<tt><a href="#i_getelementptr">getelementptr</a></tt>' instruction.</p>
|
||||
<p>The major differences to <tt>getelementptr</tt> indexing are:</p>
|
||||
<ul>
|
||||
<li>Since the value being indexed is not a pointer, the first index is
|
||||
omitted and assumed to be zero.</li>
|
||||
<li>At least one index must be specified.</li>
|
||||
<li>Not only struct indices but also array indices must be in
|
||||
bounds.</li>
|
||||
</ul>
|
||||
|
||||
<h5>Semantics:</h5>
|
||||
<p>The result is the value at the position in the aggregate specified by the
|
||||
@ -4131,7 +4214,7 @@ Instruction</a> </div>
|
||||
<a href="#t_array">array</a> type. The second operand is a first-class
|
||||
value to insert. The following operands are constant indices indicating
|
||||
the position at which to insert the value in a similar manner as indices in a
|
||||
'<tt><a href="#i_getelementptr">getelementptr</a></tt>' instruction. The
|
||||
'<tt><a href="#i_extractvalue">extractvalue</a></tt>' instruction. The
|
||||
value to insert must have the same type as the value identified by the
|
||||
indices.</p>
|
||||
|
||||
@ -7472,7 +7555,7 @@ LLVM</a>.</p>
|
||||
|
||||
<h5>Syntax:</h5>
|
||||
<pre>
|
||||
declare {}* @llvm.invariant.start(i64 <size>, i8* nocapture <ptr>) readonly
|
||||
declare {}* @llvm.invariant.start(i64 <size>, i8* nocapture <ptr>)
|
||||
</pre>
|
||||
|
||||
<h5>Overview:</h5>
|
||||
@ -7647,7 +7730,7 @@ LLVM</a>.</p>
|
||||
the <tt>AllocaInst</tt> stack slot to be before local variables on the
|
||||
stack. This is to ensure that if a local variable on the stack is
|
||||
overwritten, it will destroy the value of the guard. When the function exits,
|
||||
the guard on the stack is checked against the original guard. If they're
|
||||
the guard on the stack is checked against the original guard. If they are
|
||||
different, then the program aborts by calling the <tt>__stack_chk_fail()</tt>
|
||||
function.</p>
|
||||
|
||||
@ -7667,25 +7750,24 @@ LLVM</a>.</p>
|
||||
</pre>
|
||||
|
||||
<h5>Overview:</h5>
|
||||
<p>The <tt>llvm.objectsize</tt> intrinsic is designed to provide information
|
||||
to the optimizers to discover at compile time either a) when an
|
||||
operation like memcpy will either overflow a buffer that corresponds to
|
||||
an object, or b) to determine that a runtime check for overflow isn't
|
||||
necessary. An object in this context means an allocation of a
|
||||
specific class, structure, array, or other object.</p>
|
||||
<p>The <tt>llvm.objectsize</tt> intrinsic is designed to provide information to
|
||||
the optimizers to determine at compile time whether a) an operation (like
|
||||
memcpy) will overflow a buffer that corresponds to an object, or b) that a
|
||||
runtime check for overflow isn't necessary. An object in this context means
|
||||
an allocation of a specific class, structure, array, or other object.</p>
|
||||
|
||||
<h5>Arguments:</h5>
|
||||
<p>The <tt>llvm.objectsize</tt> intrinsic takes two arguments. The first
|
||||
<p>The <tt>llvm.objectsize</tt> intrinsic takes two arguments. The first
|
||||
argument is a pointer to or into the <tt>object</tt>. The second argument
|
||||
is a boolean 0 or 1. This argument determines whether you want the
|
||||
maximum (0) or minimum (1) bytes remaining. This needs to be a literal 0 or
|
||||
is a boolean 0 or 1. This argument determines whether you want the
|
||||
maximum (0) or minimum (1) bytes remaining. This needs to be a literal 0 or
|
||||
1, variables are not allowed.</p>
|
||||
|
||||
<h5>Semantics:</h5>
|
||||
<p>The <tt>llvm.objectsize</tt> intrinsic is lowered to either a constant
|
||||
representing the size of the object concerned or <tt>i32/i64 -1 or 0</tt>
|
||||
(depending on the <tt>type</tt> argument if the size cannot be determined
|
||||
at compile time.</p>
|
||||
representing the size of the object concerned, or <tt>i32/i64 -1 or 0</tt>,
|
||||
depending on the <tt>type</tt> argument, if the size cannot be determined at
|
||||
compile time.</p>
|
||||
|
||||
</div>
|
||||
|
||||
@ -7699,7 +7781,7 @@ LLVM</a>.</p>
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-08-28 06:09:24 +0200 (Sat, 28 Aug 2010) $
|
||||
Last modified: $Date: 2011-02-09 17:44:44 +0100 (Wed, 09 Feb 2011) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -19,7 +19,7 @@
|
||||
</ul></li>
|
||||
<li><a href="#multiphase">Multi-phase communication between LLVM and linker</a>
|
||||
<ul>
|
||||
<li><a href="#phase1">Phase 1 : Read LLVM Bytecode Files</a></li>
|
||||
<li><a href="#phase1">Phase 1 : Read LLVM Bitcode Files</a></li>
|
||||
<li><a href="#phase2">Phase 2 : Symbol Resolution</a></li>
|
||||
<li><a href="#phase3">Phase 3 : Optimize Bitcode Files</a></li>
|
||||
<li><a href="#phase4">Phase 4 : Symbol Resolution after optimization</a></li>
|
||||
@ -382,7 +382,7 @@ of the native object files.</p>
|
||||
|
||||
Devang Patel and Nick Kledzik<br>
|
||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
|
||||
Last modified: $Date: 2010-09-29 22:09:55 +0200 (Wed, 29 Sep 2010) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -37,14 +37,21 @@ install_targets := install-html
|
||||
ifeq ($(ENABLE_DOXYGEN),1)
|
||||
install_targets += install-doxygen
|
||||
endif
|
||||
ifdef OCAMLDOC
|
||||
ifneq (,$(filter ocaml,$(BINDINGS_TO_BUILD)))
|
||||
install_targets += install-ocamldoc
|
||||
endif
|
||||
endif
|
||||
install-local:: $(install_targets)
|
||||
|
||||
generated_targets := doxygen
|
||||
ifdef OCAMLDOC
|
||||
generated_targets += ocamldoc
|
||||
endif
|
||||
|
||||
# Live documentation is generated for the web site using this target:
|
||||
# 'make generated BUILD_FOR_WEBSITE=1'
|
||||
generated:: doxygen ocamldoc
|
||||
generated:: $(generated_targets)
|
||||
|
||||
install-html: $(PROJ_OBJ_DIR)/html.tar.gz
|
||||
$(Echo) Installing HTML documentation
|
||||
@ -59,7 +66,7 @@ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
|
||||
$(Verb) $(RM) -rf $@ $(PROJ_OBJ_DIR)/html.tar
|
||||
$(Verb) cd $(PROJ_SRC_DIR) && \
|
||||
$(TAR) cf $(PROJ_OBJ_DIR)/html.tar *.html
|
||||
$(Verb) $(GZIP) $(PROJ_OBJ_DIR)/html.tar
|
||||
$(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/html.tar
|
||||
|
||||
install-doxygen: doxygen
|
||||
$(Echo) Installing doxygen documentation
|
||||
@ -82,7 +89,7 @@ $(PROJ_OBJ_DIR)/doxygen.tar.gz: $(DOXYFILES) $(PROJ_OBJ_DIR)/doxygen.cfg
|
||||
$(Echo) Packaging doxygen documentation
|
||||
$(Verb) $(RM) -rf $@ $(PROJ_OBJ_DIR)/doxygen.tar
|
||||
$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/doxygen.tar doxygen
|
||||
$(Verb) $(GZIP) $(PROJ_OBJ_DIR)/doxygen.tar
|
||||
$(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/doxygen.tar
|
||||
$(Verb) $(CP) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(PROJ_OBJ_DIR)/doxygen/html/
|
||||
|
||||
userloc: $(LLVM_SRC_ROOT)/docs/userloc.html
|
||||
@ -104,7 +111,7 @@ ocamldoc: regen-ocamldoc
|
||||
$(Echo) Packaging ocamldoc documentation
|
||||
$(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
|
||||
$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
|
||||
$(Verb) $(GZIP) $(PROJ_OBJ_DIR)/ocamldoc.tar
|
||||
$(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/ocamldoc.tar
|
||||
$(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/
|
||||
|
||||
regen-ocamldoc:
|
||||
|
@ -640,18 +640,18 @@
|
||||
generate dependencies when running the compiler. Use of this feature is
|
||||
discouraged and it may be removed at a later date.</dd>
|
||||
<dt><a name="ENABLE_OPTIMIZED"><tt>ENABLE_OPTIMIZED</tt></a></dt>
|
||||
<dd>If set to any value, causes the build to generate optimized objects,
|
||||
<dd>If set to 1, causes the build to generate optimized objects,
|
||||
libraries and executables. This alters the flags specified to the compilers
|
||||
and linkers. Generally debugging won't be a fun experience with an optimized
|
||||
build.</dd>
|
||||
<dt><a name="ENABLE_PROFILING"><tt>ENABLE_PROFILING</tt></a></dt>
|
||||
<dd>If set to any value, causes the build to generate both optimized and
|
||||
<dd>If set to 1, causes the build to generate both optimized and
|
||||
profiled objects, libraries and executables. This alters the flags specified
|
||||
to the compilers and linkers to ensure that profile data can be collected
|
||||
from the tools built. Use the <tt>gprof</tt> tool to analyze the output from
|
||||
the profiled tools (<tt>gmon.out</tt>).</dd>
|
||||
<dt><a name="DISABLE_ASSERTIONS"><tt>DISABLE_ASSERTIONS</tt></a></dt>
|
||||
<dd>If set to any value, causes the build to disable assertions, even if
|
||||
<dd>If set to 1, causes the build to disable assertions, even if
|
||||
building a debug or profile build. This will exclude all assertion check
|
||||
code from the build. LLVM will execute faster, but with little help when
|
||||
things go wrong.</dd>
|
||||
@ -1028,7 +1028,7 @@
|
||||
|
||||
<a href="mailto:rspencer@x10sys.com">Reid Spencer</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-07-24 19:54:00 +0200 (Sat, 24 Jul 2010) $
|
||||
Last modified: $Date: 2010-10-22 14:54:34 +0200 (Fri, 22 Oct 2010) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -166,7 +166,7 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print " <p>\n" if !
|
||||
<tr><td><a href="#loop-rotate">-loop-rotate</a></td><td>Rotate Loops</td></tr>
|
||||
<tr><td><a href="#loop-unroll">-loop-unroll</a></td><td>Unroll loops</td></tr>
|
||||
<tr><td><a href="#loop-unswitch">-loop-unswitch</a></td><td>Unswitch loops</td></tr>
|
||||
<tr><td><a href="#loopsimplify">-loopsimplify</a></td><td>Canonicalize natural loops</td></tr>
|
||||
<tr><td><a href="#loop-simplify">-loop-simplify</a></td><td>Canonicalize natural loops</td></tr>
|
||||
<tr><td><a href="#loweratomic">-loweratomic</a></td><td>Lower atomic intrinsics</td></tr>
|
||||
<tr><td><a href="#lowerinvoke">-lowerinvoke</a></td><td>Lower invoke and unwind, for unwindless code generators</td></tr>
|
||||
<tr><td><a href="#lowersetjmp">-lowersetjmp</a></td><td>Lower Set Jump</td></tr>
|
||||
@ -382,7 +382,7 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print " <p>\n" if !
|
||||
|
||||
<!-------------------------------------------------------------------------- -->
|
||||
<div class="doc_subsection">
|
||||
<a name="dot-postdom">dot-postdom: Print post dominator tree of function to 'dot' file</a>
|
||||
<a name="dot-postdom">-dot-postdom: Print post dominator tree of function to 'dot' file</a>
|
||||
</div>
|
||||
<div class="doc_text">
|
||||
<p>
|
||||
@ -394,7 +394,7 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print " <p>\n" if !
|
||||
|
||||
<!-------------------------------------------------------------------------- -->
|
||||
<div class="doc_subsection">
|
||||
<a name="dot-postdom-only">dot-postdom-only: Print post dominator tree of function to 'dot' file
|
||||
<a name="dot-postdom-only">-dot-postdom-only: Print post dominator tree of function to 'dot' file
|
||||
(with no function bodies)</a>
|
||||
</div>
|
||||
<div class="doc_text">
|
||||
@ -1491,7 +1491,7 @@ if (X < 3) {</pre>
|
||||
|
||||
<!-------------------------------------------------------------------------- -->
|
||||
<div class="doc_subsection">
|
||||
<a name="loopsimplify">-loopsimplify: Canonicalize natural loops</a>
|
||||
<a name="loop-simplify">-loop-simplify: Canonicalize natural loops</a>
|
||||
</div>
|
||||
<div class="doc_text">
|
||||
<p>
|
||||
@ -2242,7 +2242,7 @@ if (X < 3) {</pre>
|
||||
|
||||
<a href="mailto:rspencer@x10sys.com">Reid Spencer</a><br>
|
||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-08-20 03:03:44 +0200 (Fri, 20 Aug 2010) $
|
||||
Last modified: $Date: 2011-02-13 21:57:25 +0100 (Sun, 13 Feb 2011) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -84,6 +84,7 @@ option</a></li>
|
||||
<li><a href="#dss_indexedmap">"llvm/ADT/IndexedMap.h"</a></li>
|
||||
<li><a href="#dss_densemap">"llvm/ADT/DenseMap.h"</a></li>
|
||||
<li><a href="#dss_valuemap">"llvm/ADT/ValueMap.h"</a></li>
|
||||
<li><a href="#dss_intervalmap">"llvm/ADT/IntervalMap.h"</a></li>
|
||||
<li><a href="#dss_map"><map></a></li>
|
||||
<li><a href="#dss_othermap">Other Map-Like Container Options</a></li>
|
||||
</ul></li>
|
||||
@ -269,9 +270,9 @@ can get, so it will not be discussed in this document.</p>
|
||||
|
||||
<ol>
|
||||
|
||||
<li><a href="http://www.dinkumware.com/refxcpp.html">Dinkumware C++ Library
|
||||
reference</a> - an excellent reference for the STL and other parts of the
|
||||
standard C++ library.</li>
|
||||
<li><a href="http://www.dinkumware.com/manuals/#Standard C++ Library">Dinkumware
|
||||
C++ Library reference</a> - an excellent reference for the STL and other parts
|
||||
of the standard C++ library.</li>
|
||||
|
||||
<li><a href="http://www.tempest-sw.com/cpp/">C++ In a Nutshell</a> - This is an
|
||||
O'Reilly book in the making. It has a decent Standard Library
|
||||
@ -1507,6 +1508,23 @@ a <code>Config</code> parameter to the ValueMap template.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="dss_intervalmap">"llvm/ADT/IntervalMap.h"</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p> IntervalMap is a compact map for small keys and values. It maps key
|
||||
intervals instead of single keys, and it will automatically coalesce adjacent
|
||||
intervals. When then map only contains a few intervals, they are stored in the
|
||||
map object itself to avoid allocations.</p>
|
||||
|
||||
<p> The IntervalMap iterators are quite big, so they should not be passed around
|
||||
as STL iterators. The heavyweight iterators allow a smaller data structure.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="dss_map"><map></a>
|
||||
@ -3838,7 +3856,7 @@ doxygen info: <a href="/doxygen/classllvm_1_1BasicBlock.html">BasicBlock
|
||||
Class</a><br>
|
||||
Superclass: <a href="#Value"><tt>Value</tt></a></p>
|
||||
|
||||
<p>This class represents a single entry multiple exit section of the code,
|
||||
<p>This class represents a single entry single exit section of the code,
|
||||
commonly known as a basic block by the compiler community. The
|
||||
<tt>BasicBlock</tt> class maintains a list of <a
|
||||
href="#Instruction"><tt>Instruction</tt></a>s, which form the body of the block.
|
||||
@ -3940,7 +3958,7 @@ arguments. An argument has a pointer to the parent Function.</p>
|
||||
<a href="mailto:dhurjati@cs.uiuc.edu">Dinakar Dhurjati</a> and
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-08-04 17:59:16 +0200 (Wed, 04 Aug 2010) $
|
||||
Last modified: $Date: 2011-02-17 03:19:22 +0100 (Thu, 17 Feb 2011) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -126,7 +126,7 @@ production-quality compiler for C, Objective-C, C++ and Objective-C++ on x86
|
||||
<li>Introduced many new warnings, including <code>-Wmissing-field-initializers</code>, <code>-Wshadow</code>, <code>-Wno-protocol</code>, <code>-Wtautological-compare</code>, <code>-Wstrict-selector-match</code>, <code>-Wcast-align</code>, <code>-Wunused</code> improvements, and greatly improved format-string checking.</li>
|
||||
<li>Introduced the "libclang" library, a C interface to Clang intended to support IDE clients.</li>
|
||||
<li>Added support for <code>#pragma GCC visibility</code>, <code>#pragma align</code>, and others.</li>
|
||||
<li>Added support for SSE, ARM NEON, and Altivec.</li>
|
||||
<li>Added support for SSE, AVX, ARM NEON, and AltiVec.</li>
|
||||
<li>Improved support for many Microsoft extensions.</li>
|
||||
<li>Implemented support for blocks in C++.</li>
|
||||
<li>Implemented precompiled headers for C++.</li>
|
||||
@ -269,7 +269,7 @@ support new platforms, new languages, new architectures, and new features.
|
||||
|
||||
<div class="doc_text">
|
||||
<p>
|
||||
<a href="http://libc++.llvm.org/">libc++</a> is another new member of the LLVM
|
||||
<a href="http://libcxx.llvm.org/">libc++</a> is another new member of the LLVM
|
||||
family. It is an implementation of the C++ standard library, written from the
|
||||
ground up to specifically target the forthcoming C++'0X standard and focus on
|
||||
delivering great performance.</p>
|
||||
@ -673,7 +673,7 @@ release includes a few major enhancements and additions to the optimizers:</p>
|
||||
be 13 in one of the predecessors of a block. It does this in conjunction
|
||||
with the new LazyValueInfo analysis pass.</li>
|
||||
<li>The new RegionInfo analysis pass identifies single-entry single-exit regions
|
||||
in the CFG. You can play with it with the "opt -regions analyze" or
|
||||
in the CFG. You can play with it with the "opt -regions -analyze" or
|
||||
"opt -view-regions" commands.</li>
|
||||
<li>The loop optimizer has significantly improved strength reduction and analysis
|
||||
capabilities. Notably it is able to build on the trap value and signed
|
||||
@ -879,8 +879,9 @@ it run faster:</p>
|
||||
variables can be accessed via same base address) and potentially reducing
|
||||
register pressure.</li>
|
||||
|
||||
<li>The ARM has received many minor improvements and tweaks which lead to
|
||||
substantially better performance in a wide range of different scenarios.</li>
|
||||
<li>The ARM backend has received many minor improvements and tweaks which lead
|
||||
to substantially better performance in a wide range of different scenarios.
|
||||
</li>
|
||||
|
||||
<li>The ARM NEON intrinsics have been substantially reworked to reduce
|
||||
redundancy and improve code generation. Some of the major changes are:
|
||||
@ -1010,6 +1011,17 @@ API changes are:</p>
|
||||
LLVM. The Triple::normalize utility method has been added to help front-ends
|
||||
deal with funky triples.
|
||||
</li>
|
||||
<li>
|
||||
The signature of the <tt>GCMetadataPrinter::finishAssembly</tt> virtual
|
||||
function changed: the <tt>raw_ostream</tt> and <tt>MCAsmInfo</tt> arguments
|
||||
were dropped. GC plugins which compute stack maps must be updated to avoid
|
||||
having the old definition overload the new signature.
|
||||
</li>
|
||||
<li>
|
||||
The signature of <tt>MemoryBuffer::getMemBuffer</tt> changed. Unfortunately
|
||||
calls intended for the old version still compile, but will not work correctly,
|
||||
leading to a confusing error about an invalid header in the bitcode.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Some APIs were renamed:
|
||||
@ -1102,7 +1114,7 @@ components, please contact us on the <a
|
||||
href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVMdev list</a>.</p>
|
||||
|
||||
<ul>
|
||||
<li>The Alpha, Blackfin, CellSPU, MicroBlaze, MSP430, MIPS, PIC16, SystemZ
|
||||
<li>The Alpha, Blackfin, CellSPU, MicroBlaze, MSP430, MIPS, SystemZ
|
||||
and XCore backends are experimental.</li>
|
||||
<li><tt>llc</tt> "<tt>-filetype=obj</tt>" is experimental on all targets
|
||||
other than darwin-i386 and darwin-x86_64.</li>
|
||||
@ -1287,7 +1299,7 @@ lists</a>.</p>
|
||||
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
|
||||
|
||||
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-10-04 22:41:06 +0200 (Mon, 04 Oct 2010) $
|
||||
Last modified: $Date: 2010-10-26 14:43:36 +0200 (Tue, 26 Oct 2010) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -78,7 +78,7 @@ height="369">
|
||||
that the LLVM debug information</a> takes, which is useful for those
|
||||
interested in creating front-ends or dealing directly with the information.
|
||||
Further, this document provides specific examples of what debug information
|
||||
for C/C++.</p>
|
||||
for C/C++ looks like.</p>
|
||||
|
||||
</div>
|
||||
|
||||
@ -460,15 +460,17 @@ provide details such as name, type and where the variable is defined.</p>
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
!3 = metadata !{
|
||||
i32, ;; Tag = 13 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_lexical_block)
|
||||
metadata ;; Reference to context descriptor
|
||||
i32, ;; Tag = 11 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_lexical_block)
|
||||
metadata,;; Reference to context descriptor
|
||||
i32, ;; Line number
|
||||
i32 ;; Column number
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>These descriptors provide debug information about nested blocks within a
|
||||
subprogram. The array of member descriptors is used to define local
|
||||
variables and deeper nested blocks.</p>
|
||||
subprogram. The line number and column numbers are used to dinstinguish
|
||||
two lexical blocks at same depth. </p>
|
||||
|
||||
</div>
|
||||
|
||||
@ -539,9 +541,9 @@ DW_ATE_unsigned_char = 8
|
||||
metadata, ;; Name (may be "" for anonymous types)
|
||||
metadata, ;; Reference to file where defined (may be NULL)
|
||||
i32, ;; Line number where defined (may be 0)
|
||||
i32, ;; Size in bits
|
||||
i32, ;; Alignment in bits
|
||||
i32, ;; Offset in bits
|
||||
i64, ;; Size in bits
|
||||
i64, ;; Alignment in bits
|
||||
i64, ;; Offset in bits
|
||||
metadata ;; Reference to type derived from
|
||||
}
|
||||
</pre>
|
||||
@ -586,9 +588,8 @@ DW_TAG_restrict_type = 55
|
||||
the bit offset if embedded in a <a href="#format_composite_type">composite
|
||||
type</a>.</p>
|
||||
|
||||
<p>Note that the <tt>void *</tt> type is expressed as a
|
||||
<tt>llvm.dbg.derivedtype.type</tt> with tag of <tt>DW_TAG_pointer_type</tt>
|
||||
and <tt>NULL</tt> derived type.</p>
|
||||
<p>Note that the <tt>void *</tt> type is expressed as a type derived from NULL.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
@ -687,7 +688,7 @@ DW_TAG_inheritance = 28
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
%<a href="#format_subrange">llvm.dbg.subrange.type</a> = type {
|
||||
!42 = metadata !{
|
||||
i32, ;; Tag = 33 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_subrange_type)
|
||||
i64, ;; Low value
|
||||
i64 ;; High value
|
||||
@ -789,15 +790,12 @@ DW_TAG_return_variable = 258
|
||||
|
||||
<div class="doc_text">
|
||||
<pre>
|
||||
void %<a href="#format_common_declare">llvm.dbg.declare</a>({}*, metadata)
|
||||
void %<a href="#format_common_declare">llvm.dbg.declare</a>(metadata, metadata)
|
||||
</pre>
|
||||
|
||||
<p>This intrinsic provides information about a local element (ex. variable.) The
|
||||
first argument is the alloca for the variable, cast to a <tt>{}*</tt>. The
|
||||
second argument is
|
||||
the <tt>%<a href="#format_variables">llvm.dbg.variable</a></tt> containing
|
||||
the description of the variable. </p>
|
||||
|
||||
first argument is metadata holding alloca for the variable.</tt>. The
|
||||
second argument is metadata containing description of the variable. </p>
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
@ -813,10 +811,8 @@ DW_TAG_return_variable = 258
|
||||
<p>This intrinsic provides information when a user source variable is set to a
|
||||
new value. The first argument is the new value (wrapped as metadata). The
|
||||
second argument is the offset in the user source variable where the new value
|
||||
is written. The third argument is
|
||||
the <tt>%<a href="#format_variables">llvm.dbg.variable</a></tt> containing
|
||||
the description of the user source variable. </p>
|
||||
|
||||
is written. The third argument is metadata containing description of the
|
||||
user source variable. </p>
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
@ -862,13 +858,13 @@ entry:
|
||||
%Y = alloca i32, align 4 ; <i32*> [#uses=4]
|
||||
%Z = alloca i32, align 4 ; <i32*> [#uses=3]
|
||||
%0 = bitcast i32* %X to {}* ; <{}*> [#uses=1]
|
||||
call void @llvm.dbg.declare({}* %0, metadata !0), !dbg !7
|
||||
call void @llvm.dbg.declare(metadata !{i32 * %X}, metadata !0), !dbg !7
|
||||
store i32 21, i32* %X, !dbg !8
|
||||
%1 = bitcast i32* %Y to {}* ; <{}*> [#uses=1]
|
||||
call void @llvm.dbg.declare({}* %1, metadata !9), !dbg !10
|
||||
call void @llvm.dbg.declare(metadata !{i32 * %Y}, metadata !9), !dbg !10
|
||||
store i32 22, i32* %Y, !dbg !11
|
||||
%2 = bitcast i32* %Z to {}* ; <{}*> [#uses=1]
|
||||
call void @llvm.dbg.declare({}* %2, metadata !12), !dbg !14
|
||||
call void @llvm.dbg.declare(metadata !{i32 * %Z}, metadata !12), !dbg !14
|
||||
store i32 23, i32* %Z, !dbg !15
|
||||
%tmp = load i32* %X, !dbg !16 ; <i32> [#uses=1]
|
||||
%tmp1 = load i32* %Y, !dbg !16 ; <i32> [#uses=1]
|
||||
@ -879,7 +875,7 @@ entry:
|
||||
ret void, !dbg !18
|
||||
}
|
||||
|
||||
declare void @llvm.dbg.declare({}*, metadata) nounwind readnone
|
||||
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
|
||||
|
||||
!0 = metadata !{i32 459008, metadata !1, metadata !"X",
|
||||
metadata !3, i32 2, metadata !6}; [ DW_TAG_auto_variable ]
|
||||
@ -921,7 +917,7 @@ declare void @llvm.dbg.declare({}*, metadata) nounwind readnone
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
call void @llvm.dbg.declare({}* %0, metadata !0), !dbg !7
|
||||
call void @llvm.dbg.declare(metadata, metadata !0), !dbg !7
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@ -956,7 +952,7 @@ call void @llvm.dbg.declare({}* %0, metadata !0), !dbg !7
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
call void @llvm.dbg.declare({}* %2, metadata !12), !dbg !14
|
||||
call void @llvm.dbg.declare(metadata, metadata !12), !dbg !14
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@ -1780,7 +1776,7 @@ enum Trees {
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-07-13 18:53:20 +0200 (Tue, 13 Jul 2010) $
|
||||
Last modified: $Date: 2011-02-03 01:22:17 +0100 (Thu, 03 Feb 2011) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -405,8 +405,6 @@ which case the user must specify it explicitly.</dd>
|
||||
the symbol table. If the type of 'a' does not match <em>type</em>, TableGen
|
||||
aborts with an error. !cast<string> is a special case in that the argument must
|
||||
be an object defined by a 'def' construct.</dd>
|
||||
<dt><tt>!nameconcat<type>(a, b)</tt></dt>
|
||||
<dd>Shorthand for !cast<type>(!strconcat(a, b))</dd>
|
||||
<dt><tt>!subst(a, b, c)</tt></dt>
|
||||
<dd>If 'a' and 'b' are of string type or are symbol references, substitute
|
||||
'b' for 'a' in 'c.' This operation is analogous to $(subst) in GNU make.</dd>
|
||||
@ -414,18 +412,18 @@ be an object defined by a 'def' construct.</dd>
|
||||
<dd>For each member 'b' of dag or list 'a' apply operator 'c.' 'b' is a
|
||||
dummy variable that should be declared as a member variable of an instantiated
|
||||
class. This operation is analogous to $(foreach) in GNU make.</dd>
|
||||
<dt><tt>!car(a)</tt></dt>
|
||||
<dt><tt>!head(a)</tt></dt>
|
||||
<dd>The first element of list 'a.'</dd>
|
||||
<dt><tt>!cdr(a)</tt></dt>
|
||||
<dt><tt>!tail(a)</tt></dt>
|
||||
<dd>The 2nd-N elements of list 'a.'</dd>
|
||||
<dt><tt>!null(a)</tt></dt>
|
||||
<dt><tt>!empty(a)</tt></dt>
|
||||
<dd>An integer {0,1} indicating whether list 'a' is empty.</dd>
|
||||
<dt><tt>!if(a,b,c)</tt></dt>
|
||||
<dd>'b' if the result of 'int' or 'bit' operator 'a' is nonzero,
|
||||
'c' otherwise.</dd>
|
||||
<dt><tt>!eq(a,b)</tt></dt>
|
||||
<dd>Integer one if string a is equal to string b, zero otherwise. This
|
||||
only operates on string, int and bit objects. Use !cast<string> to
|
||||
<dd>'bit 1' if string a is equal to string b, 0 otherwise. This
|
||||
only operates on string, int and bit objects. Use !cast<string> to
|
||||
compare other types of objects.</dd>
|
||||
</dl>
|
||||
|
||||
@ -844,8 +842,7 @@ more ways to factor out commonality from the records, specially if using
|
||||
several levels of multiclass instanciations. This also avoids the need of using
|
||||
"let" expressions within subsequent records inside a multiclass.</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
<pre class="doc_code">
|
||||
<b>multiclass </b>basic_r<bits<4> opc> {
|
||||
<b>let </b>Predicates = [HasSSE2] in {
|
||||
<b>def </b>rr : Instruction<opc, "rr">;
|
||||
@ -871,16 +868,17 @@ several levels of multiclass instanciations. This also avoids the need of using
|
||||
<div class="doc_section"><a name="codegen">Code Generator backend info</a></div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Expressions used by code generator to describe instructions and isel
|
||||
patterns:</p>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<dl>
|
||||
<dt><tt>(implicit a)</tt></dt>
|
||||
<dd>an implicitly defined physical register. This tells the dag instruction
|
||||
selection emitter the input pattern's extra definitions matches implicit
|
||||
physical register definitions.</dd>
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
@ -906,7 +904,7 @@ This should highlight the APIs in <tt>TableGen/Record.h</tt>.</p>
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-06-21 22:35:09 +0200 (Mon, 21 Jun 2010) $
|
||||
Last modified: $Date: 2011-01-07 18:05:37 +0100 (Fri, 07 Jan 2011) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -18,12 +18,14 @@
|
||||
<ul>
|
||||
<li><a href="#regressiontests">Regression tests</a></li>
|
||||
<li><a href="#testsuite">Test suite</a></li>
|
||||
<li><a href="#debuginfotests">Debugging Information tests</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#quick">Quick start</a>
|
||||
<ul>
|
||||
<li><a href="#quickregressiontests">Regression tests</a></li>
|
||||
<li><a href="#quicktestsuite">Test suite</a></li>
|
||||
<li><a href="#quickdebuginfotests">Debugging Information tests</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#rtstructure">Regression test structure</a>
|
||||
@ -40,7 +42,7 @@
|
||||
<li><a href="#testsuiteexternal">Configuring External Tests</a></li>
|
||||
<li><a href="#testsuitetests">Running different tests</a></li>
|
||||
<li><a href="#testsuiteoutput">Generating test output</a></li>
|
||||
<li><a href="#testsuitecustom">Writing custom tests for llvm-test</a></li>
|
||||
<li><a href="#testsuitecustom">Writing custom tests for test-suite</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
@ -141,6 +143,23 @@ generates code.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsection"><a name="debuginfotests">Debugging Information
|
||||
tests</a></div>
|
||||
<!-- _______________________________________________________________________ -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The test suite contains tests to check quality of debugging information.
|
||||
The test are written in C based languages or in LLVM assembly language. </p>
|
||||
|
||||
<p>These tests are compiled and run under a debugger. The debugger output
|
||||
is checked to validate of debugging information. See README.txt in the
|
||||
test suite for more information . This test suite is located in the
|
||||
<tt>debuginfo-tests</tt> Subversion module. </p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--=========================================================================-->
|
||||
<div class="doc_section"><a name="quick">Quick start</a></div>
|
||||
<!--=========================================================================-->
|
||||
@ -153,7 +172,7 @@ generates code.</p>
|
||||
The more comprehensive test suite that includes whole
|
||||
programs in C and C++ is in the <tt>test-suite</tt> module. This module should
|
||||
be checked out to the <tt>llvm/projects</tt> directory (don't use another name
|
||||
then the default "test-suite", for then the test suite will be run every time
|
||||
than the default "test-suite", for then the test suite will be run every time
|
||||
you run <tt>make</tt> in the main <tt>llvm</tt> directory).
|
||||
When you <tt>configure</tt> the <tt>llvm</tt> module,
|
||||
the <tt>test-suite</tt> directory will be automatically configured.
|
||||
@ -237,7 +256,7 @@ programs), first checkout and setup the <tt>test-suite</tt> module:</p>
|
||||
</div>
|
||||
|
||||
<p>where <tt>$LLVM_GCC_DIR</tt> is the directory where
|
||||
you <em>installed</em> llvm-gcc, not it's src or obj
|
||||
you <em>installed</em> llvm-gcc, not its src or obj
|
||||
dir. The <tt>--with-llvmgccdir</tt> option assumes that
|
||||
the <tt>llvm-gcc-4.2</tt> module was configured with
|
||||
<tt>--program-prefix=llvm-</tt>, and therefore that the C and C++
|
||||
@ -272,6 +291,25 @@ that subdirectory.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsection"><a name="quickdebuginfotests">Debugging Information
|
||||
tests</a></div>
|
||||
<!-- _______________________________________________________________________ -->
|
||||
|
||||
<p> To run debugging information tests simply checkout the tests inside
|
||||
clang/test directory. </p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
%cd clang/test
|
||||
% svn co http://llvm.org/svn/llvm-project/debuginfo-tests/trunk debuginfo-tests
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p> These tests are already set up to run as part of clang regression tests.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--=========================================================================-->
|
||||
<div class="doc_section"><a name="rtstructure">Regression test structure</a></div>
|
||||
<!--=========================================================================-->
|
||||
@ -338,6 +376,11 @@ that subdirectory.</p>
|
||||
shell. Consequently the syntax differs from normal shell script syntax in a
|
||||
few ways. You can specify as many RUN lines as needed.</p>
|
||||
|
||||
<p>lit performs substitution on each RUN line to replace LLVM tool
|
||||
names with the full paths to the executable built for each tool (in
|
||||
$(LLVM_OBJ_ROOT)/$(BuildMode)/bin). This ensures that lit does not
|
||||
invoke any stray LLVM tools in the user's path during testing.</p>
|
||||
|
||||
<p>Each RUN line is executed on its own, distinct from other lines unless
|
||||
its last character is <tt>\</tt>. This continuation character causes the RUN
|
||||
line to be concatenated with the next one. In this way you can build up long
|
||||
@ -561,7 +604,7 @@ name="FileCheck-CHECK-NEXT">The "CHECK-NEXT:" directive</a></div>
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Sometimes you want to match lines and would like to verify that matches
|
||||
happen on exactly consequtive lines with no other lines in between them. In
|
||||
happen on exactly consecutive lines with no other lines in between them. In
|
||||
this case, you can use CHECK: and CHECK-NEXT: directives to specify this. If
|
||||
you specified a custom check prefix, just use "<PREFIX>-NEXT:". For
|
||||
example, something like this works as you'd expect:</p>
|
||||
@ -870,34 +913,34 @@ want tested and run <tt>gmake</tt> there. Alternatively, you can run a different
|
||||
test using the <tt>TEST</tt> variable to change what tests or run on the
|
||||
selected programs (see below for more info).</p>
|
||||
|
||||
<p>In addition for testing correctness, the <tt>llvm-test</tt> directory also
|
||||
<p>In addition for testing correctness, the <tt>test-suite</tt> directory also
|
||||
performs timing tests of various LLVM optimizations. It also records
|
||||
compilation times for the compilers and the JIT. This information can be
|
||||
used to compare the effectiveness of LLVM's optimizations and code
|
||||
generation.</p>
|
||||
|
||||
<p><tt>llvm-test</tt> tests are divided into three types of tests: MultiSource,
|
||||
<p><tt>test-suite</tt> tests are divided into three types of tests: MultiSource,
|
||||
SingleSource, and External.</p>
|
||||
|
||||
<ul>
|
||||
<li><tt>llvm-test/SingleSource</tt>
|
||||
<li><tt>test-suite/SingleSource</tt>
|
||||
<p>The SingleSource directory contains test programs that are only a single
|
||||
source file in size. These are usually small benchmark programs or small
|
||||
programs that calculate a particular value. Several such programs are grouped
|
||||
together in each directory.</p></li>
|
||||
|
||||
<li><tt>llvm-test/MultiSource</tt>
|
||||
<li><tt>test-suite/MultiSource</tt>
|
||||
<p>The MultiSource directory contains subdirectories which contain entire
|
||||
programs with multiple source files. Large benchmarks and whole applications
|
||||
go here.</p></li>
|
||||
|
||||
<li><tt>llvm-test/External</tt>
|
||||
<li><tt>test-suite/External</tt>
|
||||
<p>The External directory contains Makefiles for building code that is external
|
||||
to (i.e., not distributed with) LLVM. The most prominent members of this
|
||||
directory are the SPEC 95 and SPEC 2000 benchmark suites. The <tt>External</tt>
|
||||
directory does not contain these actual tests, but only the Makefiles that know
|
||||
how to properly compile these programs from somewhere else. The presence and
|
||||
location of these external programs is configured by the llvm-test
|
||||
location of these external programs is configured by the test-suite
|
||||
<tt>configure</tt> script.</p></li>
|
||||
</ul>
|
||||
|
||||
@ -1084,9 +1127,9 @@ many times it triggers. First thing you should do is add an LLVM
|
||||
will tally counts of things you care about.</p>
|
||||
|
||||
<p>Following this, you can set up a test and a report that collects these and
|
||||
formats them for easy viewing. This consists of two files, an
|
||||
formats them for easy viewing. This consists of two files, a
|
||||
"<tt>test-suite/TEST.XXX.Makefile</tt>" fragment (where XXX is the name of your
|
||||
test) and an "<tt>llvm-test/TEST.XXX.report</tt>" file that indicates how to
|
||||
test) and a "<tt>test-suite/TEST.XXX.report</tt>" file that indicates how to
|
||||
format the output into a table. There are many example reports of various
|
||||
levels of sophistication included with the test suite, and the framework is very
|
||||
general.</p>
|
||||
@ -1147,7 +1190,7 @@ example reports that can do fancy stuff.</p>
|
||||
|
||||
John T. Criswell, Daniel Dunbar, Reid Spencer, and Tanya Lattner<br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-08-02 03:20:23 +0200 (Mon, 02 Aug 2010) $
|
||||
Last modified: $Date: 2011-02-15 10:23:02 +0100 (Tue, 15 Feb 2011) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -23,7 +23,11 @@
|
||||
<p>Written by <a href="mailto:rspencer@x10sys.com">Reid Spencer</a></p>
|
||||
</div>
|
||||
|
||||
<p class="doc_warning">Warning: This document is out of date, please see <a href="CommandGuide/html/llvm-config.html">llvm-config</a> for more information.</p>
|
||||
<p class="doc_warning">Warning: This document is out of date, for more
|
||||
information please
|
||||
see <a href="CommandGuide/html/llvm-config.html">llvm-config</a> or,
|
||||
if you use CMake, <a href=CMake.html#embedding>the CMake LLVM
|
||||
guide</a>.</p>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_section"><a name="abstract">Abstract</a></div>
|
||||
@ -432,7 +436,7 @@
|
||||
<a href="mailto:rspencer@x10sys.com">Reid Spencer</a>
|
||||
</address>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a>
|
||||
<br>Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $ </div>
|
||||
<br>Last modified: $Date: 2010-09-17 02:30:52 +0200 (Fri, 17 Sep 2010) $ </div>
|
||||
</body>
|
||||
</html>
|
||||
<!-- vim: sw=2 ts=2 ai
|
||||
|
@ -1825,7 +1825,7 @@ register to convert the floating-point value to an integer.
|
||||
static SDValue LowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG) {
|
||||
assert(Op.getValueType() == MVT::i32);
|
||||
Op = DAG.getNode(SPISD::FTOI, MVT::f32, Op.getOperand(0));
|
||||
return DAG.getNode(ISD::BIT_CONVERT, MVT::i32, Op);
|
||||
return DAG.getNode(ISD::BITCAST, MVT::i32, Op);
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
@ -2549,7 +2549,7 @@ with assembler.
|
||||
<a href="http://www.woo.com">Mason Woo</a> and <a href="http://misha.brukman.net">Misha Brukman</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a>
|
||||
<br>
|
||||
Last modified: $Date: 2010-07-17 00:35:46 +0200 (Sat, 17 Jul 2010) $
|
||||
Last modified: $Date: 2010-11-23 04:31:01 +0100 (Tue, 23 Nov 2010) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -51,6 +51,14 @@
|
||||
<li><a href="#doFinalization_loop">The <tt>doFinalization()
|
||||
</tt> method</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#RegionPass">The <tt>RegionPass</tt> class</a>
|
||||
<ul>
|
||||
<li><a href="#doInitialization_region">The <tt>doInitialization(Region *,
|
||||
RGPassManager &)</tt> method</a></li>
|
||||
<li><a href="#runOnRegion">The <tt>runOnRegion</tt> method</a></li>
|
||||
<li><a href="#doFinalization_region">The <tt>doFinalization()
|
||||
</tt> method</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#BasicBlockPass">The <tt>BasicBlockPass</tt> class</a>
|
||||
<ul>
|
||||
<li><a href="#doInitialization_fn">The <tt>doInitialization(Function
|
||||
@ -134,6 +142,7 @@ the <tt><a href="#ModulePass">ModulePass</a></tt>, <tt><a
|
||||
href="#CallGraphSCCPass">CallGraphSCCPass</a></tt>, <tt><a
|
||||
href="#FunctionPass">FunctionPass</a></tt>, or <tt><a
|
||||
href="#LoopPass">LoopPass</a></tt>, or <tt><a
|
||||
href="#RegionPass">RegionPass</a></tt>, or <tt><a
|
||||
href="#BasicBlockPass">BasicBlockPass</a></tt> classes, which gives the system
|
||||
more information about what your pass does, and how it can be combined with
|
||||
other passes. One of the main features of the LLVM Pass Framework is that it
|
||||
@ -169,9 +178,11 @@ source tree in the <tt>lib/Transforms/Hello</tt> directory.</p>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>First, you need to create a new directory somewhere in the LLVM source
|
||||
<p>First, configure and build LLVM. This needs to be done directly inside the
|
||||
LLVM source tree rather than in a separate objects directory.
|
||||
Next, you need to create a new directory somewhere in the LLVM source
|
||||
base. For this example, we'll assume that you made
|
||||
<tt>lib/Transforms/Hello</tt>. Next, you must set up a build script
|
||||
<tt>lib/Transforms/Hello</tt>. Finally, you must set up a build script
|
||||
(Makefile) that will compile the source code for the new pass. To do this,
|
||||
copy the following into <tt>Makefile</tt>:</p>
|
||||
<hr/>
|
||||
@ -194,8 +205,8 @@ include $(LEVEL)/Makefile.common
|
||||
</pre></div>
|
||||
|
||||
<p>This makefile specifies that all of the <tt>.cpp</tt> files in the current
|
||||
directory are to be compiled and linked together into a
|
||||
<tt>Debug+Asserts/lib/Hello.so</tt> shared object that can be dynamically loaded by
|
||||
directory are to be compiled and linked together into a shared object
|
||||
<tt>$(LEVEL)/Debug+Asserts/lib/Hello.so</tt> that can be dynamically loaded by
|
||||
the <tt>opt</tt> or <tt>bugpoint</tt> tools via their <tt>-load</tt> options.
|
||||
If your operating system uses a suffix other than .so (such as windows or
|
||||
Mac OS/X), the appropriate extension will be used.</p>
|
||||
@ -262,7 +273,7 @@ time.</p>
|
||||
|
||||
<div class="doc_code"><pre>
|
||||
static char ID;
|
||||
Hello() : FunctionPass(&ID) {}
|
||||
Hello() : FunctionPass(ID) {}
|
||||
</pre></div><p>
|
||||
|
||||
<p> This declares pass identifier used by LLVM to identify pass. This allows LLVM to
|
||||
@ -290,7 +301,7 @@ function.</p>
|
||||
initialization value is not important.</p>
|
||||
|
||||
<div class="doc_code"><pre>
|
||||
INITIALIZE_PASS(Hello, "<i>hello</i>", "<i>Hello World Pass</i>",
|
||||
static RegisterPass<Hello> X("<i>hello</i>", "<i>Hello World Pass</i>",
|
||||
false /* Only looks at CFG */,
|
||||
false /* Analysis Pass */);
|
||||
} <i>// end of anonymous namespace</i>
|
||||
@ -317,7 +328,7 @@ is supplied as fourth argument. </p>
|
||||
<b>struct Hello</b> : <b>public</b> <a href="#FunctionPass">FunctionPass</a> {
|
||||
|
||||
static char ID;
|
||||
Hello() : FunctionPass(&ID) {}
|
||||
Hello() : FunctionPass(ID) {}
|
||||
|
||||
<b>virtual bool</b> <a href="#runOnFunction">runOnFunction</a>(Function &F) {
|
||||
errs() << "<i>Hello: </i>" << F.getName() << "\n";
|
||||
@ -326,14 +337,15 @@ is supplied as fourth argument. </p>
|
||||
};
|
||||
|
||||
char Hello::ID = 0;
|
||||
INITIALIZE_PASS(Hello, "<i>Hello</i>", "<i>Hello World Pass</i>", false, false);
|
||||
static RegisterPass<Hello> X("hello", "Hello World Pass", false, false);
|
||||
}
|
||||
|
||||
</pre></div>
|
||||
|
||||
<p>Now that it's all together, compile the file with a simple "<tt>gmake</tt>"
|
||||
command in the local directory and you should get a new
|
||||
"<tt>Debug+Asserts/lib/Hello.so</tt> file. Note that everything in this file is
|
||||
command in the local directory and you should get a new file
|
||||
"<tt>Debug+Asserts/lib/Hello.so</tt>" under the top level directory of the LLVM
|
||||
source tree (not in the local directory). Note that everything in this file is
|
||||
contained in an anonymous namespace: this reflects the fact that passes are self
|
||||
contained units that do not need external interfaces (although they can have
|
||||
them) to be useful.</p>
|
||||
@ -349,7 +361,7 @@ them) to be useful.</p>
|
||||
|
||||
<p>Now that you have a brand new shiny shared object file, we can use the
|
||||
<tt>opt</tt> command to run an LLVM program through your pass. Because you
|
||||
registered your pass with the <tt>INITIALIZE_PASS</tt> macro, you will be able to
|
||||
registered your pass with <tt>RegisterPass</tt>, you will be able to
|
||||
use the <tt>opt</tt> tool to access it, once loaded.</p>
|
||||
|
||||
<p>To test it, follow the example at the end of the <a
|
||||
@ -547,11 +559,9 @@ href="#BasicBlockPass">BasicBlockPass</a></tt>, you should derive from
|
||||
|
||||
<ol>
|
||||
|
||||
<li>... <em>not allowed</em> to modify any <tt>Function</tt>s that are not in
|
||||
the current SCC.</li>
|
||||
|
||||
<li>... <em>not allowed</em> to inspect any Function's other than those in the
|
||||
current SCC and the direct callees of the SCC.</li>
|
||||
<li>... <em>not allowed</em> to inspect or modify any <tt>Function</tt>s other
|
||||
than those in the current SCC and the direct callers and direct callees of the
|
||||
SCC.</li>
|
||||
|
||||
<li>... <em>required</em> to preserve the current CallGraph object, updating it
|
||||
to reflect any changes made to the program.</li>
|
||||
@ -805,6 +815,84 @@ program being compiled. </p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="RegionPass">The <tt>RegionPass</tt> class </a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p> <tt>RegionPass</tt> is similar to <a href="#LoopPass"><tt>LoopPass</tt></a>,
|
||||
but executes on each single entry single exit region in the function.
|
||||
<tt>RegionPass</tt> processes regions in nested order such that the outer most
|
||||
region is processed last. </p>
|
||||
|
||||
<p> <tt>RegionPass</tt> subclasses are allowed to update the region tree by using
|
||||
the <tt>RGPassManager</tt> interface. You may overload three virtual methods of
|
||||
<tt>RegionPass</tt> to implementing your own region pass is usually. All these
|
||||
methods should return true if they modified the program, or false if they didn not.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="doInitialization_region">The <tt>doInitialization(Region *,
|
||||
RGPassManager &)</tt>
|
||||
method</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<div class="doc_code"><pre>
|
||||
<b>virtual bool</b> doInitialization(Region *, RGPassManager &RGM);
|
||||
</pre></div>
|
||||
|
||||
<p>The <tt>doInitialization</tt> method is designed to do simple initialization
|
||||
type of stuff that does not depend on the functions being processed. The
|
||||
<tt>doInitialization</tt> method call is not scheduled to overlap with any
|
||||
other pass executions (thus it should be very fast). RPPassManager
|
||||
interface should be used to access Function or Module level analysis
|
||||
information.</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="runOnRegion">The <tt>runOnRegion</tt> method</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<div class="doc_code"><pre>
|
||||
<b>virtual bool</b> runOnRegion(Region *, RGPassManager &RGM) = 0;
|
||||
</pre></div><p>
|
||||
|
||||
<p>The <tt>runOnRegion</tt> method must be implemented by your subclass to do
|
||||
the transformation or analysis work of your pass. As usual, a true value should
|
||||
be returned if the region is modified. <tt>RGPassManager</tt> interface
|
||||
should be used to update region tree.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection">
|
||||
<a name="doFinalization_region">The <tt>doFinalization()</tt> method</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<div class="doc_code"><pre>
|
||||
<b>virtual bool</b> doFinalization();
|
||||
</pre></div>
|
||||
|
||||
<p>The <tt>doFinalization</tt> method is an infrequently used method that is
|
||||
called when the pass framework has finished calling <a
|
||||
href="#runOnRegion"><tt>runOnRegion</tt></a> for every region in the
|
||||
program being compiled. </p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
@ -967,10 +1055,10 @@ remember, you may not modify the LLVM <tt>Function</tt> or its contents from a
|
||||
pass registration works, and discussed some of the reasons that it is used and
|
||||
what it does. Here we discuss how and why passes are registered.</p>
|
||||
|
||||
<p>As we saw above, passes are registered with the <b><tt>INITIALIZE_PASS</tt></b>
|
||||
macro. The first parameter is the name of the pass that is to be used on
|
||||
<p>As we saw above, passes are registered with the <b><tt>RegisterPass</tt></b>
|
||||
template. The template parameter is the name of the pass that is to be used on
|
||||
the command line to specify that the pass should be added to a program (for
|
||||
example, with <tt>opt</tt> or <tt>bugpoint</tt>). The second argument is the
|
||||
example, with <tt>opt</tt> or <tt>bugpoint</tt>). The first argument is the
|
||||
name of the pass, which is to be used for the <tt>-help</tt> output of
|
||||
programs, as
|
||||
well as for debug output generated by the <tt>--debug-pass</tt> option.</p>
|
||||
@ -1386,7 +1474,7 @@ results as soon as they are no longer needed.</li>
|
||||
<li><b>Pipeline the execution of passes on the program</b> - The
|
||||
<tt>PassManager</tt> attempts to get better cache and memory usage behavior out
|
||||
of a series of passes by pipelining the passes together. This means that, given
|
||||
a series of consequtive <a href="#FunctionPass"><tt>FunctionPass</tt></a>'s, it
|
||||
a series of consecutive <a href="#FunctionPass"><tt>FunctionPass</tt></a>'s, it
|
||||
will execute all of the <a href="#FunctionPass"><tt>FunctionPass</tt></a>'s on
|
||||
the first function, then all of the <a
|
||||
href="#FunctionPass"><tt>FunctionPass</tt></a>es on the second function,
|
||||
@ -1833,7 +1921,7 @@ Despite that, we have kept the LLVM passes SMP ready, and you should too.</p>
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-07-22 01:07:00 +0200 (Thu, 22 Jul 2010) $
|
||||
Last modified: $Date: 2011-02-15 10:23:02 +0100 (Tue, 15 Feb 2011) $
|
||||
</address>
|
||||
|
||||
</body>
|
||||
|
@ -353,8 +353,8 @@ above.</p>
|
||||
</div>
|
||||
|
||||
<p>The Module symbol table works just like the Function symbol table when it
|
||||
comes to name conflicts: if a new function is created with a name was previously
|
||||
added to the symbol table, it will get implicitly renamed when added to the
|
||||
comes to name conflicts: if a new function is created with a name that was previously
|
||||
added to the symbol table, the new function will get implicitly renamed when added to the
|
||||
Module. The code above exploits this fact to determine if there was a previous
|
||||
definition of this function.</p>
|
||||
|
||||
@ -1263,7 +1263,7 @@ int main() {
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-09-01 22:09:20 +0200 (Wed, 01 Sep 2010) $
|
||||
Last modified: $Date: 2011-02-15 01:24:32 +0100 (Tue, 15 Feb 2011) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -176,6 +176,8 @@ add a set of optimizations to run. The code looks like this:</p>
|
||||
// Set up the optimizer pipeline. Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
||||
// Provide basic AliasAnalysis support for GVN.
|
||||
OurFPM.add(createBasicAliasAnalysisPass());
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
OurFPM.add(createInstructionCombiningPass());
|
||||
// Reassociate expressions.
|
||||
@ -507,6 +509,7 @@ at runtime.</p>
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetSelect.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
@ -1086,6 +1089,8 @@ int main() {
|
||||
// Set up the optimizer pipeline. Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
||||
// Provide basic AliasAnalysis support for GVN.
|
||||
OurFPM.add(createBasicAliasAnalysisPass());
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
OurFPM.add(createInstructionCombiningPass());
|
||||
// Reassociate expressions.
|
||||
@ -1126,7 +1131,7 @@ int main() {
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-06-14 08:09:39 +0200 (Mon, 14 Jun 2010) $
|
||||
Last modified: $Date: 2010-11-16 18:28:22 +0100 (Tue, 16 Nov 2010) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -907,6 +907,7 @@ if/then/else and for expressions.. To build this example, use:
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetSelect.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
@ -1731,6 +1732,8 @@ int main() {
|
||||
// Set up the optimizer pipeline. Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
||||
// Provide basic AliasAnalysis support for GVN.
|
||||
OurFPM.add(createBasicAliasAnalysisPass());
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
OurFPM.add(createInstructionCombiningPass());
|
||||
// Reassociate expressions.
|
||||
@ -1771,7 +1774,7 @@ int main() {
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-09-01 22:09:20 +0200 (Wed, 01 Sep 2010) $
|
||||
Last modified: $Date: 2010-11-16 18:28:22 +0100 (Tue, 16 Nov 2010) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -826,6 +826,7 @@ if/then/else and for expressions.. To build this example, use:
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetSelect.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
@ -1768,6 +1769,8 @@ int main() {
|
||||
// Set up the optimizer pipeline. Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
||||
// Provide basic AliasAnalysis support for GVN.
|
||||
OurFPM.add(createBasicAliasAnalysisPass());
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
OurFPM.add(createInstructionCombiningPass());
|
||||
// Reassociate expressions.
|
||||
@ -1808,7 +1811,7 @@ int main() {
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-09-01 22:09:20 +0200 (Wed, 01 Sep 2010) $
|
||||
Last modified: $Date: 2010-11-16 18:28:22 +0100 (Tue, 16 Nov 2010) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1009,6 +1009,7 @@ variables and var/in support. To build this example, use:
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetSelect.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
@ -2116,6 +2117,8 @@ int main() {
|
||||
// Set up the optimizer pipeline. Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
||||
// Provide basic AliasAnalysis support for GVN.
|
||||
OurFPM.add(createBasicAliasAnalysisPass());
|
||||
// Promote allocas to registers.
|
||||
OurFPM.add(createPromoteMemoryToRegisterPass());
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
@ -2158,7 +2161,7 @@ int main() {
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2010-09-01 22:09:20 +0200 (Wed, 01 Sep 2010) $
|
||||
Last modified: $Date: 2010-11-16 18:28:22 +0100 (Tue, 16 Nov 2010) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -30,7 +30,7 @@
|
||||
<li><a href="#code">Full Code Listing</a></li>
|
||||
</ol>
|
||||
</li>
|
||||
<li><a href="LangImpl8.html">Chapter 8</a>: Conclusion and other useful LLVM
|
||||
<li><a href="OCamlLangImpl8.html">Chapter 8</a>: Conclusion and other useful LLVM
|
||||
tidbits</li>
|
||||
</ul>
|
||||
|
||||
@ -1901,7 +1901,7 @@ extern double printd(double X) {
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
<a href="mailto:idadesub@users.sourceforge.net">Erick Tryzelaar</a><br>
|
||||
Last modified: $Date: 2010-05-28 19:07:41 +0200 (Fri, 28 May 2010) $
|
||||
Last modified: $Date: 2011-01-01 04:27:43 +0100 (Sat, 01 Jan 2011) $
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
|
365
docs/tutorial/OCamlLangImpl8.html
Normal file
365
docs/tutorial/OCamlLangImpl8.html
Normal file
@ -0,0 +1,365 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Kaleidoscope: Conclusion and other useful LLVM tidbits</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Chris Lattner">
|
||||
<link rel="stylesheet" href="../llvm.css" type="text/css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="doc_title">Kaleidoscope: Conclusion and other useful LLVM
|
||||
tidbits</div>
|
||||
|
||||
<ul>
|
||||
<li><a href="index.html">Up to Tutorial Index</a></li>
|
||||
<li>Chapter 8
|
||||
<ol>
|
||||
<li><a href="#conclusion">Tutorial Conclusion</a></li>
|
||||
<li><a href="#llvmirproperties">Properties of LLVM IR</a>
|
||||
<ul>
|
||||
<li><a href="#targetindep">Target Independence</a></li>
|
||||
<li><a href="#safety">Safety Guarantees</a></li>
|
||||
<li><a href="#langspecific">Language-Specific Optimizations</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#tipsandtricks">Tips and Tricks</a>
|
||||
<ul>
|
||||
<li><a href="#offsetofsizeof">Implementing portable
|
||||
offsetof/sizeof</a></li>
|
||||
<li><a href="#gcstack">Garbage Collected Stack Frames</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<div class="doc_author">
|
||||
<p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a></p>
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section"><a name="conclusion">Tutorial Conclusion</a></div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Welcome to the the final chapter of the "<a href="index.html">Implementing a
|
||||
language with LLVM</a>" tutorial. In the course of this tutorial, we have grown
|
||||
our little Kaleidoscope language from being a useless toy, to being a
|
||||
semi-interesting (but probably still useless) toy. :)</p>
|
||||
|
||||
<p>It is interesting to see how far we've come, and how little code it has
|
||||
taken. We built the entire lexer, parser, AST, code generator, and an
|
||||
interactive run-loop (with a JIT!) by-hand in under 700 lines of
|
||||
(non-comment/non-blank) code.</p>
|
||||
|
||||
<p>Our little language supports a couple of interesting features: it supports
|
||||
user defined binary and unary operators, it uses JIT compilation for immediate
|
||||
evaluation, and it supports a few control flow constructs with SSA construction.
|
||||
</p>
|
||||
|
||||
<p>Part of the idea of this tutorial was to show you how easy and fun it can be
|
||||
to define, build, and play with languages. Building a compiler need not be a
|
||||
scary or mystical process! Now that you've seen some of the basics, I strongly
|
||||
encourage you to take the code and hack on it. For example, try adding:</p>
|
||||
|
||||
<ul>
|
||||
<li><b>global variables</b> - While global variables have questional value in
|
||||
modern software engineering, they are often useful when putting together quick
|
||||
little hacks like the Kaleidoscope compiler itself. Fortunately, our current
|
||||
setup makes it very easy to add global variables: just have value lookup check
|
||||
to see if an unresolved variable is in the global variable symbol table before
|
||||
rejecting it. To create a new global variable, make an instance of the LLVM
|
||||
<tt>GlobalVariable</tt> class.</li>
|
||||
|
||||
<li><b>typed variables</b> - Kaleidoscope currently only supports variables of
|
||||
type double. This gives the language a very nice elegance, because only
|
||||
supporting one type means that you never have to specify types. Different
|
||||
languages have different ways of handling this. The easiest way is to require
|
||||
the user to specify types for every variable definition, and record the type
|
||||
of the variable in the symbol table along with its Value*.</li>
|
||||
|
||||
<li><b>arrays, structs, vectors, etc</b> - Once you add types, you can start
|
||||
extending the type system in all sorts of interesting ways. Simple arrays are
|
||||
very easy and are quite useful for many different applications. Adding them is
|
||||
mostly an exercise in learning how the LLVM <a
|
||||
href="../LangRef.html#i_getelementptr">getelementptr</a> instruction works: it
|
||||
is so nifty/unconventional, it <a
|
||||
href="../GetElementPtr.html">has its own FAQ</a>! If you add support
|
||||
for recursive types (e.g. linked lists), make sure to read the <a
|
||||
href="../ProgrammersManual.html#TypeResolve">section in the LLVM
|
||||
Programmer's Manual</a> that describes how to construct them.</li>
|
||||
|
||||
<li><b>standard runtime</b> - Our current language allows the user to access
|
||||
arbitrary external functions, and we use it for things like "printd" and
|
||||
"putchard". As you extend the language to add higher-level constructs, often
|
||||
these constructs make the most sense if they are lowered to calls into a
|
||||
language-supplied runtime. For example, if you add hash tables to the language,
|
||||
it would probably make sense to add the routines to a runtime, instead of
|
||||
inlining them all the way.</li>
|
||||
|
||||
<li><b>memory management</b> - Currently we can only access the stack in
|
||||
Kaleidoscope. It would also be useful to be able to allocate heap memory,
|
||||
either with calls to the standard libc malloc/free interface or with a garbage
|
||||
collector. If you would like to use garbage collection, note that LLVM fully
|
||||
supports <a href="../GarbageCollection.html">Accurate Garbage Collection</a>
|
||||
including algorithms that move objects and need to scan/update the stack.</li>
|
||||
|
||||
<li><b>debugger support</b> - LLVM supports generation of <a
|
||||
href="../SourceLevelDebugging.html">DWARF Debug info</a> which is understood by
|
||||
common debuggers like GDB. Adding support for debug info is fairly
|
||||
straightforward. The best way to understand it is to compile some C/C++ code
|
||||
with "<tt>llvm-gcc -g -O0</tt>" and taking a look at what it produces.</li>
|
||||
|
||||
<li><b>exception handling support</b> - LLVM supports generation of <a
|
||||
href="../ExceptionHandling.html">zero cost exceptions</a> which interoperate
|
||||
with code compiled in other languages. You could also generate code by
|
||||
implicitly making every function return an error value and checking it. You
|
||||
could also make explicit use of setjmp/longjmp. There are many different ways
|
||||
to go here.</li>
|
||||
|
||||
<li><b>object orientation, generics, database access, complex numbers,
|
||||
geometric programming, ...</b> - Really, there is
|
||||
no end of crazy features that you can add to the language.</li>
|
||||
|
||||
<li><b>unusual domains</b> - We've been talking about applying LLVM to a domain
|
||||
that many people are interested in: building a compiler for a specific language.
|
||||
However, there are many other domains that can use compiler technology that are
|
||||
not typically considered. For example, LLVM has been used to implement OpenGL
|
||||
graphics acceleration, translate C++ code to ActionScript, and many other
|
||||
cute and clever things. Maybe you will be the first to JIT compile a regular
|
||||
expression interpreter into native code with LLVM?</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Have fun - try doing something crazy and unusual. Building a language like
|
||||
everyone else always has, is much less fun than trying something a little crazy
|
||||
or off the wall and seeing how it turns out. If you get stuck or want to talk
|
||||
about it, feel free to email the <a
|
||||
href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">llvmdev mailing
|
||||
list</a>: it has lots of people who are interested in languages and are often
|
||||
willing to help out.
|
||||
</p>
|
||||
|
||||
<p>Before we end this tutorial, I want to talk about some "tips and tricks" for generating
|
||||
LLVM IR. These are some of the more subtle things that may not be obvious, but
|
||||
are very useful if you want to take advantage of LLVM's capabilities.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section"><a name="llvmirproperties">Properties of the LLVM
|
||||
IR</a></div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>We have a couple common questions about code in the LLVM IR form - lets just
|
||||
get these out of the way right now, shall we?</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsubsection"><a name="targetindep">Target
|
||||
Independence</a></div>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Kaleidoscope is an example of a "portable language": any program written in
|
||||
Kaleidoscope will work the same way on any target that it runs on. Many other
|
||||
languages have this property, e.g. lisp, java, haskell, javascript, python, etc
|
||||
(note that while these languages are portable, not all their libraries are).</p>
|
||||
|
||||
<p>One nice aspect of LLVM is that it is often capable of preserving target
|
||||
independence in the IR: you can take the LLVM IR for a Kaleidoscope-compiled
|
||||
program and run it on any target that LLVM supports, even emitting C code and
|
||||
compiling that on targets that LLVM doesn't support natively. You can trivially
|
||||
tell that the Kaleidoscope compiler generates target-independent code because it
|
||||
never queries for any target-specific information when generating code.</p>
|
||||
|
||||
<p>The fact that LLVM provides a compact, target-independent, representation for
|
||||
code gets a lot of people excited. Unfortunately, these people are usually
|
||||
thinking about C or a language from the C family when they are asking questions
|
||||
about language portability. I say "unfortunately", because there is really no
|
||||
way to make (fully general) C code portable, other than shipping the source code
|
||||
around (and of course, C source code is not actually portable in general
|
||||
either - ever port a really old application from 32- to 64-bits?).</p>
|
||||
|
||||
<p>The problem with C (again, in its full generality) is that it is heavily
|
||||
laden with target specific assumptions. As one simple example, the preprocessor
|
||||
often destructively removes target-independence from the code when it processes
|
||||
the input text:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
#ifdef __i386__
|
||||
int X = 1;
|
||||
#else
|
||||
int X = 42;
|
||||
#endif
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>While it is possible to engineer more and more complex solutions to problems
|
||||
like this, it cannot be solved in full generality in a way that is better than shipping
|
||||
the actual source code.</p>
|
||||
|
||||
<p>That said, there are interesting subsets of C that can be made portable. If
|
||||
you are willing to fix primitive types to a fixed size (say int = 32-bits,
|
||||
and long = 64-bits), don't care about ABI compatibility with existing binaries,
|
||||
and are willing to give up some other minor features, you can have portable
|
||||
code. This can make sense for specialized domains such as an
|
||||
in-kernel language.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsubsection"><a name="safety">Safety Guarantees</a></div>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Many of the languages above are also "safe" languages: it is impossible for
|
||||
a program written in Java to corrupt its address space and crash the process
|
||||
(assuming the JVM has no bugs).
|
||||
Safety is an interesting property that requires a combination of language
|
||||
design, runtime support, and often operating system support.</p>
|
||||
|
||||
<p>It is certainly possible to implement a safe language in LLVM, but LLVM IR
|
||||
does not itself guarantee safety. The LLVM IR allows unsafe pointer casts,
|
||||
use after free bugs, buffer over-runs, and a variety of other problems. Safety
|
||||
needs to be implemented as a layer on top of LLVM and, conveniently, several
|
||||
groups have investigated this. Ask on the <a
|
||||
href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">llvmdev mailing
|
||||
list</a> if you are interested in more details.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsubsection"><a name="langspecific">Language-Specific
|
||||
Optimizations</a></div>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>One thing about LLVM that turns off many people is that it does not solve all
|
||||
the world's problems in one system (sorry 'world hunger', someone else will have
|
||||
to solve you some other day). One specific complaint is that people perceive
|
||||
LLVM as being incapable of performing high-level language-specific optimization:
|
||||
LLVM "loses too much information".</p>
|
||||
|
||||
<p>Unfortunately, this is really not the place to give you a full and unified
|
||||
version of "Chris Lattner's theory of compiler design". Instead, I'll make a
|
||||
few observations:</p>
|
||||
|
||||
<p>First, you're right that LLVM does lose information. For example, as of this
|
||||
writing, there is no way to distinguish in the LLVM IR whether an SSA-value came
|
||||
from a C "int" or a C "long" on an ILP32 machine (other than debug info). Both
|
||||
get compiled down to an 'i32' value and the information about what it came from
|
||||
is lost. The more general issue here, is that the LLVM type system uses
|
||||
"structural equivalence" instead of "name equivalence". Another place this
|
||||
surprises people is if you have two types in a high-level language that have the
|
||||
same structure (e.g. two different structs that have a single int field): these
|
||||
types will compile down into a single LLVM type and it will be impossible to
|
||||
tell what it came from.</p>
|
||||
|
||||
<p>Second, while LLVM does lose information, LLVM is not a fixed target: we
|
||||
continue to enhance and improve it in many different ways. In addition to
|
||||
adding new features (LLVM did not always support exceptions or debug info), we
|
||||
also extend the IR to capture important information for optimization (e.g.
|
||||
whether an argument is sign or zero extended, information about pointers
|
||||
aliasing, etc). Many of the enhancements are user-driven: people want LLVM to
|
||||
include some specific feature, so they go ahead and extend it.</p>
|
||||
|
||||
<p>Third, it is <em>possible and easy</em> to add language-specific
|
||||
optimizations, and you have a number of choices in how to do it. As one trivial
|
||||
example, it is easy to add language-specific optimization passes that
|
||||
"know" things about code compiled for a language. In the case of the C family,
|
||||
there is an optimization pass that "knows" about the standard C library
|
||||
functions. If you call "exit(0)" in main(), it knows that it is safe to
|
||||
optimize that into "return 0;" because C specifies what the 'exit'
|
||||
function does.</p>
|
||||
|
||||
<p>In addition to simple library knowledge, it is possible to embed a variety of
|
||||
other language-specific information into the LLVM IR. If you have a specific
|
||||
need and run into a wall, please bring the topic up on the llvmdev list. At the
|
||||
very worst, you can always treat LLVM as if it were a "dumb code generator" and
|
||||
implement the high-level optimizations you desire in your front-end, on the
|
||||
language-specific AST.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section"><a name="tipsandtricks">Tips and Tricks</a></div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>There is a variety of useful tips and tricks that you come to know after
|
||||
working on/with LLVM that aren't obvious at first glance. Instead of letting
|
||||
everyone rediscover them, this section talks about some of these issues.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsubsection"><a name="offsetofsizeof">Implementing portable
|
||||
offsetof/sizeof</a></div>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>One interesting thing that comes up, if you are trying to keep the code
|
||||
generated by your compiler "target independent", is that you often need to know
|
||||
the size of some LLVM type or the offset of some field in an llvm structure.
|
||||
For example, you might need to pass the size of a type into a function that
|
||||
allocates memory.</p>
|
||||
|
||||
<p>Unfortunately, this can vary widely across targets: for example the width of
|
||||
a pointer is trivially target-specific. However, there is a <a
|
||||
href="http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt">clever
|
||||
way to use the getelementptr instruction</a> that allows you to compute this
|
||||
in a portable way.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsubsection"><a name="gcstack">Garbage Collected
|
||||
Stack Frames</a></div>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Some languages want to explicitly manage their stack frames, often so that
|
||||
they are garbage collected or to allow easy implementation of closures. There
|
||||
are often better ways to implement these features than explicit stack frames,
|
||||
but <a
|
||||
href="http://nondot.org/sabre/LLVMNotes/ExplicitlyManagedStackFrames.txt">LLVM
|
||||
does support them,</a> if you want. It requires your front-end to convert the
|
||||
code into <a
|
||||
href="http://en.wikipedia.org/wiki/Continuation-passing_style">Continuation
|
||||
Passing Style</a> and the use of tail calls (which LLVM also supports).</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<hr>
|
||||
<address>
|
||||
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
||||
src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
|
||||
<a href="http://validator.w3.org/check/referer"><img
|
||||
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date$
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
@ -35,7 +35,7 @@
|
||||
<li><a href="OCamlLangImpl5.html">Extending the language: control flow</a></li>
|
||||
<li><a href="OCamlLangImpl6.html">Extending the language: user-defined operators</a></li>
|
||||
<li><a href="OCamlLangImpl7.html">Extending the language: mutable variables / SSA construction</a></li>
|
||||
<li><a href="LangImpl8.html">Conclusion and other useful LLVM tidbits</a></li>
|
||||
<li><a href="OCamlLangImpl8.html">Conclusion and other useful LLVM tidbits</a></li>
|
||||
</ol></li>
|
||||
<li>Advanced Topics
|
||||
<ol>
|
||||
|
@ -8,9 +8,6 @@ if( NOT WIN32 )
|
||||
add_subdirectory(ExceptionDemo)
|
||||
endif()
|
||||
|
||||
include(CheckIncludeFile)
|
||||
check_include_file(pthread.h HAVE_PTHREAD_H)
|
||||
|
||||
if( HAVE_PTHREAD_H )
|
||||
add_subdirectory(ParallelJIT)
|
||||
endif( HAVE_PTHREAD_H )
|
||||
|
@ -1,4 +1,5 @@
|
||||
set(LLVM_LINK_COMPONENTS jit nativecodegen)
|
||||
set(LLVM_REQUIRES_EH 1)
|
||||
|
||||
add_llvm_example(ExceptionDemo
|
||||
ExceptionDemo.cpp
|
||||
|
@ -1974,6 +1974,9 @@ int main(int argc, char* argv[]) {
|
||||
// Optimizations turned on
|
||||
#ifdef ADD_OPT_PASSES
|
||||
|
||||
// Basic AliasAnslysis support for GVN.
|
||||
fpm.add(llvm::createBasicAliasAnalysisPass());
|
||||
|
||||
// Promote allocas to registers.
|
||||
fpm.add(llvm::createPromoteMemoryToRegisterPass());
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetSelect.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
@ -584,6 +585,8 @@ int main() {
|
||||
// Set up the optimizer pipeline. Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
||||
// Provide basic AliasAnalysis support for GVN.
|
||||
OurFPM.add(createBasicAliasAnalysisPass());
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
OurFPM.add(createInstructionCombiningPass());
|
||||
// Reassociate expressions.
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetSelect.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
@ -829,6 +830,8 @@ int main() {
|
||||
// Set up the optimizer pipeline. Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
||||
// Provide basic AliasAnalysis support for GVN.
|
||||
OurFPM.add(createBasicAliasAnalysisPass());
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
OurFPM.add(createInstructionCombiningPass());
|
||||
// Reassociate expressions.
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetSelect.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
@ -947,6 +948,8 @@ int main() {
|
||||
// Set up the optimizer pipeline. Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
||||
// Provide basic AliasAnalysis support for GVN.
|
||||
OurFPM.add(createBasicAliasAnalysisPass());
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
OurFPM.add(createInstructionCombiningPass());
|
||||
// Reassociate expressions.
|
||||
|
@ -1,4 +1,5 @@
|
||||
set(LLVM_LINK_COMPONENTS core jit interpreter native)
|
||||
set(LLVM_REQUIRES_RTTI 1)
|
||||
|
||||
add_llvm_example(Kaleidoscope-Ch7
|
||||
toy.cpp
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user