Vendor import of llvm trunk r154661:

http://llvm.org/svn/llvm-project/llvm/trunk@r154661
This commit is contained in:
Dimitry Andric 2012-04-14 13:54:10 +00:00
parent d4c8b5d2e8
commit 63faed5b8e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/llvm/dist/; revision=234285
svn path=/vendor/llvm/llvm-trunk-r154661/; revision=234286; tag=vendor/llvm/llvm-trunk-r154661
3836 changed files with 235312 additions and 101609 deletions

2
.gitignore vendored
View File

@ -38,3 +38,5 @@ projects/*
!projects/Makefile
# Clang, which is tracked independently.
tools/clang
# LLDB, which is tracked independently.
tools/lldb

View File

@ -10,7 +10,10 @@ set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
)
set(PACKAGE_VERSION "3.0")
set(LLVM_VERSION_MAJOR 3)
set(LLVM_VERSION_MINOR 1)
set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}svn")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
@ -23,10 +26,15 @@ if( LLVM_APPEND_VC_REV )
add_version_info_from_vcs(PACKAGE_VERSION)
endif()
set(PACKAGE_NAME llvm)
set(PACKAGE_NAME LLVM)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
set(PACKAGE_BUGREPORT "http://llvm.org/bugs/")
# Sanity check our source directory to make sure that we are not trying to
# generate an in-tree build (unless on MSVC_IDE, where it is ok), and to make
# sure that we don't have any stray generated files lying around in the tree
# (which would end up getting picked up by header search, instead of the correct
# versions).
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
message(FATAL_ERROR "In-source builds are not allowed.
CMake would overwrite the makefiles distributed with LLVM.
@ -35,6 +43,23 @@ to this source directory as the last argument.
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
Please delete them.")
endif()
if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
file(GLOB_RECURSE
tablegenned_files_on_include_dir
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvm/*.gen")
file(GLOB_RECURSE
tablegenned_files_on_lib_dir
"${CMAKE_CURRENT_SOURCE_DIR}/lib/Target/*.inc")
if( tablegenned_files_on_include_dir OR tablegenned_files_on_lib_dir)
message(FATAL_ERROR "Apparently there is a previous in-source build,
probably as the result of running `configure' and `make' on
${CMAKE_CURRENT_SOURCE_DIR}.
This may cause problems. The suspicious files are:
${tablegenned_files_on_lib_dir}
${tablegenned_files_on_include_dir}
Please clean the source directory.")
endif()
endif()
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
@ -45,38 +70,17 @@ set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin)
set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples)
set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
file(GLOB_RECURSE
tablegenned_files_on_include_dir
"${LLVM_MAIN_SRC_DIR}/include/llvm/*.gen")
file(GLOB_RECURSE
tablegenned_files_on_lib_dir
"${LLVM_MAIN_SRC_DIR}/lib/Target/*.inc")
if( tablegenned_files_on_include_dir OR tablegenned_files_on_lib_dir)
message(FATAL_ERROR "Apparently there is a previous in-source build,
probably as the result of running `configure' and `make' on
${LLVM_MAIN_SRC_DIR}.
This may cause problems. The suspicious files are:
${tablegenned_files_on_lib_dir}
${tablegenned_files_on_include_dir}
Please clean the source directory.")
endif()
endif()
set(LLVM_ALL_TARGETS
Alpha
ARM
Blackfin
CBackend
CellSPU
CppBackend
Hexagon
Mips
MBlaze
MSP430
PowerPC
PTX
Sparc
SystemZ
X86
XCore
)
@ -88,10 +92,13 @@ if( MSVC )
set(LLVM_TARGETS_TO_BUILD X86
CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
else( MSVC )
set(LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS}
set(LLVM_TARGETS_TO_BUILD "all"
CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
endif( MSVC )
option(BUILD_SHARED_LIBS
"Build all libraries as shared libraries instead of static" OFF)
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)
@ -126,12 +133,6 @@ foreach(c ${LLVM_TARGETS_TO_BUILD})
endif()
endforeach(c)
# Produce llvm/Config/Targets.def
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Targets.def.in
${LLVM_BINARY_DIR}/include/llvm/Config/Targets.def
)
set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm)
include(AddLLVMDefinitions)
@ -154,20 +155,207 @@ else()
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
endif()
option(LLVM_USE_INTEL_JITEVENTS
"Use Intel JIT API to inform Intel(R) VTune(TM) Amplifier XE 2011 about JIT code"
OFF)
if( LLVM_USE_INTEL_JITEVENTS )
# Verify we are on a supported platform
if( CMAKE_SYSTEM_NAME MATCHES "Windows" OR CMAKE_SYSTEM_NAME MATCHES "Linux" )
# Directory where Intel Parallel Amplifier XE 2011 is installed.
if ( WIN32 )
set(LLVM_INTEL_JITEVENTS_DIR $ENV{VTUNE_AMPLIFIER_XE_2011_DIR})
else ( WIN32 )
set(LLVM_INTEL_JITEVENTS_DIR "/opt/intel/vtune_amplifier_xe_2011")
endif ( WIN32 )
# Set include and library search paths for Intel JIT Events API
set(LLVM_INTEL_JITEVENTS_INCDIR "${LLVM_INTEL_JITEVENTS_DIR}/include")
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(LLVM_INTEL_JITEVENTS_LIBDIR "${LLVM_INTEL_JITEVENTS_DIR}/lib64")
else ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(LLVM_INTEL_JITEVENTS_LIBDIR "${LLVM_INTEL_JITEVENTS_DIR}/lib32")
endif ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
else()
message(FATAL_ERROR
"Intel JIT API support is available on Linux and Windows only.")
endif()
endif( LLVM_USE_INTEL_JITEVENTS )
option(LLVM_USE_OPROFILE
"Use opagent JIT interface to inform OProfile about JIT code" OFF)
# If enabled, ierify we are on a platform that supports oprofile.
if( LLVM_USE_OPROFILE )
if( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" )
message(FATAL_ERROR "OProfile support is available on Linux only.")
endif( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" )
endif( LLVM_USE_OPROFILE )
# Define an option controlling whether we should build for 32-bit on 64-bit
# platforms, where supported.
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)
endif()
# Define the default arguments to use with 'lit', and an option for the user to
# override.
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")
# On Win32 hosts, provide an option to specify the path to the GnuWin32 tools.
if( WIN32 AND NOT CYGWIN )
set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools")
endif()
# On Win32 using MS tools, provide an option to set the number of parallel jobs
# to use.
if( MSVC_IDE AND ( MSVC90 OR MSVC10 ) )
# Only Visual Studio 2008 and 2010 officially supports /MP. Visual Studio
# 2005 supports it but it is experimental.
set(LLVM_COMPILER_JOBS "0" CACHE STRING
"Number of parallel compiler jobs. 0 means use all processors. Default is 0.")
endif()
# Define options to control the inclusion and default build behavior for
# components which may not strictly be necessary (tools, runtime, examples, and
# tests).
#
# This is primarily to support building smaller or faster project files.
option(LLVM_INCLUDE_TOOLS "Generate build targets for the LLVM tools." ON)
option(LLVM_BUILD_TOOLS
"Build the LLVM tools. If OFF, just generate build targets." ON)
option(LLVM_INCLUDE_RUNTIME "Generate build targets for the LLVM runtimes" ON)
option(LLVM_BUILD_RUNTIME
"Build the LLVM runtime libraries. If OFF, just generate build targets." ON)
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)
option(LLVM_BUILD_TESTS
"Build LLVM unit tests. If OFF, just generate build targets." OFF)
option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON)
# All options referred to from HandleLLVMOptions have to be specified
# BEFORE this include, otherwise options will not be correctly set on
# first cmake run
include(config-ix)
include(HandleLLVMOptions)
# Verify that we can find a Python interpreter,
include(FindPythonInterp)
if( NOT PYTHONINTERP_FOUND )
message(FATAL_ERROR
"Unable to find Python interpreter, required for builds and testing.
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
endif()
######
# LLVMBuild Integration
#
# We use llvm-build to generate all the data required by the CMake based
# build system in one swoop:
#
# - We generate a file (a CMake fragment) in the object root which contains
# all the definitions that are required by CMake.
#
# - We generate the library table used by llvm-config.
#
# - We generate the dependencies for the CMake fragment, so that we will
# automatically reconfigure outselves.
set(LLVMBUILDTOOL "${LLVM_MAIN_SRC_DIR}/utils/llvm-build/llvm-build")
set(LLVMCONFIGLIBRARYDEPENDENCIESINC
"${LLVM_BINARY_DIR}/tools/llvm-config/LibraryDependencies.inc")
set(LLVMBUILDCMAKEFRAG
"${LLVM_BINARY_DIR}/LLVMBuild.cmake")
message(STATUS "Constructing LLVMBuild project information")
execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${LLVMBUILDTOOL}
--native-target "${LLVM_NATIVE_ARCH}"
--enable-targets "${LLVM_TARGETS_TO_BUILD}"
--write-library-table ${LLVMCONFIGLIBRARYDEPENDENCIESINC}
--write-cmake-fragment ${LLVMBUILDCMAKEFRAG}
ERROR_VARIABLE LLVMBUILDOUTPUT
ERROR_VARIABLE LLVMBUILDERRORS
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE LLVMBUILDRESULT)
# On Win32, CMake doesn't properly handle piping the default output/error
# streams into the GUI console. So, we explicitly catch and report them.
if( NOT "${LLVMBUILDOUTPUT}" STREQUAL "")
message(STATUS "llvm-build output: ${LLVMBUILDOUTPUT}")
endif()
if( NOT "${LLVMBUILDRESULT}" STREQUAL "0" )
message(FATAL_ERROR
"Unexpected failure executing llvm-build: ${LLVMBUILDERRORS}")
endif()
# Include the generated CMake fragment. This will define properties from the
# LLVMBuild files in a format which is easy to consume from CMake, and will add
# the dependencies so that CMake will reconfigure properly when the LLVMBuild
# files change.
include(${LLVMBUILDCMAKEFRAG})
######
# Configure all of the various header file fragments LLVM uses which depend on
# configuration variables.
set(LLVM_ENUM_ASM_PRINTERS "")
set(LLVM_ENUM_ASM_PARSERS "")
set(LLVM_ENUM_DISASSEMBLERS "")
foreach(t ${LLVM_TARGETS_TO_BUILD})
set( td ${LLVM_MAIN_SRC_DIR}/lib/Target/${t} )
file(GLOB asmp_file "${td}/*AsmPrinter.cpp")
if( asmp_file )
set(LLVM_ENUM_ASM_PRINTERS
"${LLVM_ENUM_ASM_PRINTERS}LLVM_ASM_PRINTER(${t})\n")
endif()
if( EXISTS ${td}/AsmParser/CMakeLists.txt )
set(LLVM_ENUM_ASM_PARSERS
"${LLVM_ENUM_ASM_PARSERS}LLVM_ASM_PARSER(${t})\n")
endif()
if( EXISTS ${td}/Disassembler/CMakeLists.txt )
set(LLVM_ENUM_DISASSEMBLERS
"${LLVM_ENUM_DISASSEMBLERS}LLVM_DISASSEMBLER(${t})\n")
endif()
endforeach(t)
# Produce the target definition files, which provide a way for clients to easily
# include various classes of targets.
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmPrinters.def.in
${LLVM_BINARY_DIR}/include/llvm/Config/AsmPrinters.def
)
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmParsers.def.in
${LLVM_BINARY_DIR}/include/llvm/Config/AsmParsers.def
)
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Disassemblers.def.in
${LLVM_BINARY_DIR}/include/llvm/Config/Disassemblers.def
)
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Targets.def.in
${LLVM_BINARY_DIR}/include/llvm/Config/Targets.def
)
# Configure the three LLVM configuration header files.
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)
@ -187,10 +375,6 @@ endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
include(AddLLVM)
include(TableGen)
macro(llvm_tablegen)
tablegen(LLVM ${ARGN})
endmacro()
if( MINGW )
# People report that -O3 is unreliable on MinGW. The traditional
# build also uses -O2 for that reason:
@ -212,32 +396,23 @@ add_subdirectory(utils/FileUpdate)
add_subdirectory(utils/count)
add_subdirectory(utils/not)
add_subdirectory(utils/llvm-lit)
add_subdirectory(utils/json-bench)
add_subdirectory(utils/yaml-bench)
add_subdirectory(projects)
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_RUNTIME
"Build the LLVM runtime libraries. If OFF, just generate build targets." ON)
option(LLVM_INCLUDE_RUNTIME "Generate build targets for the LLVM runtimes" ON)
if( LLVM_INCLUDE_RUNTIME )
add_subdirectory(runtime)
endif()
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 targets." OFF)
if( LLVM_INCLUDE_TESTS )
add_subdirectory(test)
add_subdirectory(utils/unittest)
@ -277,8 +452,8 @@ 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)
set(CPACK_PACKAGE_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${LLVM_VERSION_MINOR})
add_version_info_from_vcs(CPACK_PACKAGE_VERSION_PATCH)
include(CPack)

View File

@ -83,6 +83,10 @@ N: John T. Criswell
E: criswell@uiuc.edu
D: Original Autoconf support, documentation improvements, bug fixes
N: Anshuman Dasgupta
E: adasgupt@codeaurora.org
D: Deterministic finite automaton based infrastructure for VLIW packetization
N: Stefanus Du Toit
E: stefanus.dutoit@rapidmind.com
D: Bug fixes and minor improvements
@ -95,6 +99,10 @@ N: Alkis Evlogimenos
E: alkis@evlogimenos.com
D: Linear scan register allocator, many codegen improvements, Java frontend
N: Hal Finkel
E: hfinkel@anl.gov
D: Basic-block autovectorization, PowerPC backend improvements
N: Ryan Flynn
E: pizza@parseerror.com
D: Miscellaneous bug fixes
@ -143,6 +151,8 @@ N: James Grosbach
E: grosbach@apple.com
D: SjLj exception handling support
D: General fixes and improvements for the ARM back-end
D: MCJIT
D: ARM integrated assembler and assembly parser
N: Lang Hames
E: lhames@gmail.com
@ -265,6 +275,7 @@ N: Takumi Nakamura
E: geek4civic@gmail.com
E: chapuni@hf.rim.or.jp
D: Cygwin and MinGW support.
D: Win32 tweaks.
S: Yokohama, Japan
N: Edward O'Callaghan
@ -313,6 +324,19 @@ W: http://vladimir_prus.blogspot.com
E: ghost@cs.msu.su
D: Made inst_iterator behave like a proper iterator, LowerConstantExprs pass
N: Xerxes Ranby
E: xerxes@zafena.se
D: Cmake dependency chain and various bug fixes
N: Chad Rosier
E: mcrosier@apple.com
D: ARM fast-isel improvements
D: Performance monitoring
N: Nadav Rotem
E: nadav.rotem@intel.com
D: Vector code generation improvements.
N: Roman Samoilov
E: roman@codedgers.com
D: MSIL backend
@ -363,12 +387,9 @@ E: lauro.venancio@indt.org.br
D: ARM backend improvements
D: Thread Local Storage implementation
N: Xerxes Ranby
E: xerxes@zafena.se
D: Cmake dependency chain and various bug fixes
N: Bill Wendling
E: wendling@apple.com
D: Exception handling
D: Bunches of stuff
N: Bob Wilson

View File

@ -4,7 +4,7 @@ LLVM Release License
University of Illinois/NCSA
Open Source License
Copyright (c) 2003-2011 University of Illinois at Urbana-Champaign.
Copyright (c) 2003-2012 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
@ -67,3 +67,4 @@ Autoconf llvm/autoconf
CellSPU backend llvm/lib/Target/CellSPU/README.txt
Google Test llvm/utils/unittest/googletest
OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}

24
LLVMBuild.txt Normal file
View File

@ -0,0 +1,24 @@
;===- ./LLVMBuild.txt ------------------------------------------*- Conf -*--===;
;
; The LLVM Compiler Infrastructure
;
; This file is distributed under the University of Illinois Open Source
; License. See LICENSE.TXT for details.
;
;===------------------------------------------------------------------------===;
;
; This is an LLVMBuild description file for the components in this subdirectory.
;
; For more information on the LLVMBuild system, please see:
;
; http://llvm.org/docs/LLVMBuild.html
;
;===------------------------------------------------------------------------===;
[common]
subdirectories = bindings docs examples lib projects runtime tools utils
[component_0]
type = Group
name = Miscellaneous
parent = $ROOT

View File

@ -27,7 +27,7 @@ LEVEL := .
ifneq ($(findstring llvmCore, $(RC_ProjectName)),llvmCore) # Normal build (not "Apple-style").
ifeq ($(BUILD_DIRS_ONLY),1)
DIRS := lib/Support lib/TableGen utils
DIRS := lib/Support lib/TableGen utils tools/llvm-config
OPTIONAL_DIRS := tools/clang/utils/TableGen
else
DIRS := lib/Support lib/TableGen utils lib/VMCore lib tools/llvm-shlib \
@ -68,20 +68,14 @@ endif
ifeq ($(MAKECMDGOALS),install-clang)
DIRS := tools/clang/tools/driver tools/clang/lib/Headers \
tools/clang/tools/libclang tools/clang/tools/c-index-test \
tools/clang/include/clang-c \
tools/clang/runtime tools/clang/docs \
tools/lto runtime
OPTIONAL_DIRS :=
NO_INSTALL = 1
endif
ifeq ($(MAKECMDGOALS),install-clang-c)
DIRS := tools/clang/tools/driver tools/clang/lib/Headers \
tools/clang/tools/libclang tools/clang/tools/c-index-test \
tools/clang/include/clang-c
OPTIONAL_DIRS :=
NO_INSTALL = 1
endif
ifeq ($(MAKECMDGOALS),clang-only)
DIRS := $(filter-out tools docs unittests, $(DIRS)) \
tools/clang tools/lto
@ -126,11 +120,14 @@ cross-compile-build-tools:
$(MAKE) -C BuildTools \
BUILD_DIRS_ONLY=1 \
UNIVERSAL= \
TARGET_NATIVE_ARCH="$(TARGET_NATIVE_ARCH)" \
TARGETS_TO_BUILD="$(TARGETS_TO_BUILD)" \
ENABLE_OPTIMIZED=$(ENABLE_OPTIMIZED) \
ENABLE_PROFILING=$(ENABLE_PROFILING) \
ENABLE_COVERAGE=$(ENABLE_COVERAGE) \
DISABLE_ASSERTIONS=$(DISABLE_ASSERTIONS) \
ENABLE_EXPENSIVE_CHECKS=$(ENABLE_EXPENSIVE_CHECKS) \
ENABLE_LIBCPP=$(ENABLE_LIBCPP) \
CFLAGS= \
CXXFLAGS= \
) || exit 1;
@ -166,7 +163,6 @@ clang-only: all
tools-only: all
libs-only: all
install-clang: install
install-clang-c: install
install-libs: install
# If SHOW_DIAGNOSTICS is enabled, clear the diagnostics file first.
@ -179,11 +175,18 @@ all-local:: clean-diagnostics
endif
#------------------------------------------------------------------------
# Make sure the generated headers are up-to-date. This must be kept in
# sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
# Make sure the generated files are up-to-date. This must be kept in
# sync with the AC_CONFIG_HEADER and AC_CONFIG_FILE invocations in
# autoconf/configure.ac.
# Note that Makefile.config is covered by its own separate rule
# in Makefile.rules where it can be reused by sub-projects.
#------------------------------------------------------------------------
FilesToConfig := \
bindings/ocaml/llvm/META.llvm \
docs/doxygen.cfg \
llvm.spec \
include/llvm/Config/config.h \
include/llvm/Config/llvm-config.h \
include/llvm/Config/Targets.def \
include/llvm/Config/AsmPrinters.def \
include/llvm/Config/AsmParsers.def \
@ -209,7 +212,7 @@ ifneq ($(ENABLE_OPTIMIZED),1)
$(Echo) '*****' configure with --enable-optimized.
ifeq ($(SHOW_DIAGNOSTICS),1)
$(Verb) if test -s $(LLVM_OBJ_ROOT)/$(BuildMode)/diags; then \
$(LLVM_SRC_ROOT)/utils/show-diagnostics \
$(LLVM_SRC_ROOT)/utils/clang-parse-diagnostics-file -a \
$(LLVM_OBJ_ROOT)/$(BuildMode)/diags; \
fi
endif
@ -243,7 +246,7 @@ SVN-UPDATE-OPTIONS =
AWK = awk
SUB-SVN-DIRS = $(AWK) '/\?\ \ \ \ \ \ / {print $$2}' \
| LC_ALL=C xargs $(SVN) info 2>/dev/null \
| $(AWK) '/Path:\ / {print $$2}'
| $(AWK) '/^Path:\ / {print $$2}'
update:
$(SVN) $(SVN-UPDATE-OPTIONS) update $(LLVM_SRC_ROOT)

View File

@ -13,7 +13,7 @@
#===------------------------------------------------------------------------===#
# Define LLVM specific info and directories based on the autoconf variables
LLVMPackageName := @PACKAGE_NAME@
LLVMPackageName := @PACKAGE_TARNAME@
LLVMVersion := @PACKAGE_VERSION@
LLVM_CONFIGTIME := @LLVM_CONFIGTIME@
@ -46,11 +46,19 @@ realpath = $(shell cd $(1); $(PWD))
PROJ_OBJ_DIR := $(call realpath, .)
PROJ_OBJ_ROOT := $(call realpath, $(PROJ_OBJ_DIR)/$(LEVEL))
ifeq ($(PROJECT_NAME),llvm)
CLANG_SRC_ROOT := @CLANG_SRC_ROOT@
ifeq ($(PROJECT_NAME),$(LLVMPackageName))
LLVM_SRC_ROOT := $(call realpath, @abs_top_srcdir@)
LLVM_OBJ_ROOT := $(call realpath, @abs_top_builddir@)
PROJ_SRC_ROOT := $(LLVM_SRC_ROOT)
PROJ_SRC_DIR := $(call realpath, $(LLVM_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)))
PROJ_SRC_DIR := $(LLVM_SRC_ROOT)$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR))
ifneq ($(CLANG_SRC_ROOT),)
CLANG_SRC_ROOT:= $(call realpath, $(CLANG_SRC_ROOT))
PROJ_SRC_DIR := $(patsubst $(LLVM_SRC_ROOT)/tools/clang%,$(CLANG_SRC_ROOT)%,$(PROJ_SRC_DIR))
endif
prefix := @prefix@
PROJ_prefix := $(prefix)
PROJ_VERSION := $(LLVMVersion)
@ -78,7 +86,12 @@ PROJ_VERSION := 1.0
endif
endif
LLVMMAKE := $(LLVM_SRC_ROOT)/make
INTERNAL_PREFIX := @INTERNAL_PREFIX@
ifneq ($(INTERNAL_PREFIX),)
PROJ_internal_prefix := $(INTERNAL_PREFIX)
else
PROJ_internal_prefix := $(prefix)
endif
PROJ_bindir := $(PROJ_prefix)/bin
PROJ_libdir := $(PROJ_prefix)/lib
@ -101,6 +114,7 @@ TARGET_OS=@TARGET_OS@
# Target hardware architecture
ARCH=@ARCH@
TARGET_NATIVE_ARCH := $(ARCH)
# Indicates, whether we're cross-compiling LLVM or not
LLVM_CROSS_COMPILING=@LLVM_CROSS_COMPILING@
@ -161,7 +175,6 @@ SED := @SED@
TAR := @TAR@
# Paths to miscellaneous programs we hope are present but might not be
PERL := @PERL@
BZIP2 := @BZIP2@
CAT := @CAT@
DOT := @DOT@
@ -180,7 +193,6 @@ RUNTEST := @RUNTEST@
TCLSH := @TCLSH@
ZIP := @ZIP@
HAVE_PERL := @HAVE_PERL@
HAVE_PTHREAD := @HAVE_PTHREAD@
LIBS := @LIBS@
@ -202,6 +214,10 @@ RDYNAMIC := @RDYNAMIC@
# These are options that can either be enabled here, or can be enabled on the
# make command line (ie, make ENABLE_PROFILING=1):
# When ENABLE_LIBCPP is enabled, LLVM uses libc++ by default to build.
#ENABLE_LIBCPP = 0
ENABLE_LIBCPP = @ENABLE_LIBCPP@
# When ENABLE_OPTIMIZED is enabled, LLVM code is optimized and output is put
# into the "Release" directories. Otherwise, LLVM code is not optimized and
# output is put in the "Debug" directories.
@ -319,9 +335,19 @@ BINUTILS_INCDIR := @BINUTILS_INCDIR@
NO_MISSING_FIELD_INITIALIZERS = @NO_MISSING_FIELD_INITIALIZERS@
# -Wno-variadic-macros
NO_VARIADIC_MACROS = @NO_VARIADIC_MACROS@
# -Wcovered-switch-default
COVERED_SWITCH_DEFAULT = @COVERED_SWITCH_DEFAULT@
# 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@
# Flags to control building support for Intel JIT Events API
USE_INTEL_JITEVENTS := @USE_INTEL_JITEVENTS@
INTEL_JITEVENTS_INCDIR := @INTEL_JITEVENTS_INCDIR@
INTEL_JITEVENTS_LIBDIR := @INTEL_JITEVENTS_LIBDIR@
# Flags to control building support for OProfile JIT API
USE_OPROFILE := @USE_OPROFILE@

View File

@ -57,6 +57,72 @@ VPATH=$(PROJ_SRC_DIR)
$(UserTargets)::
#------------------------------------------------------------------------
# LLVMBuild Integration
#------------------------------------------------------------------------
#
# We use llvm-build to generate all the data required by the Makefile based
# build system in one swoop:
#
# - We generate a file (a Makefile fragment) in the object root which contains
# all the definitions that are required by Makefiles across the entire
# project.
#
# - We generate the library table used by llvm-config.
#
# - We generate the dependencies for the Makefile fragment, so that we will
# automatically reconfigure outselves.
# The path to the llvm-build tool itself.
LLVMBuildTool := $(PROJ_SRC_ROOT)/utils/llvm-build/llvm-build
# The files we are going to generate using llvm-build.
LLVMBuildMakeFrag := $(PROJ_OBJ_ROOT)/Makefile.llvmbuild
LLVMConfigLibraryDependenciesInc := \
$(PROJ_OBJ_ROOT)/tools/llvm-config/LibraryDependencies.inc
# This is for temporary backwards compatibility.
ifndef TARGET_NATIVE_ARCH
TARGET_NATIVE_ARCH := $(ARCH)
endif
# The rule to create the LLVMBuild Makefile fragment as well as the llvm-config
# library table.
#
# Note that this target gets its real dependencies generated for us by
# llvm-build.
#
# We include a dependency on this Makefile to ensure that changes to the
# generation command get picked up.
$(LLVMBuildMakeFrag): $(PROJ_SRC_ROOT)/Makefile.rules \
$(PROJ_OBJ_ROOT)/Makefile.config
$(Echo) Constructing LLVMBuild project information.
$(Verb) $(LLVMBuildTool) \
--native-target "$(TARGET_NATIVE_ARCH)" \
--enable-targets "$(TARGETS_TO_BUILD)" \
--write-library-table $(LLVMConfigLibraryDependenciesInc) \
--write-make-fragment $(LLVMBuildMakeFrag)
# For completeness, let Make know how the extra files are generated.
$(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrag)
# Include the generated Makefile fragment.
#
# We currently only include the dependencies for the fragment itself if we are
# at the top-level. Otherwise, recursive invocations would ends up doing
# substantially more redundant stat'ing.
#
# This means that we won't properly regenerate things for developers used to
# building from a subdirectory, but that is always somewhat unreliable.
ifeq ($(LEVEL),.)
LLVMBUILD_INCLUDE_DEPENDENCIES := 1
# Clean the generated makefile fragment at the top-level.
clean-local::
-$(Verb) $(RM) -f $(LLVMBuildMakeFrag)
endif
-include $(LLVMBuildMakeFrag)
################################################################################
# PRECONDITIONS: that which must be built/checked first
################################################################################
@ -245,6 +311,11 @@ else
endif
endif
ifeq ($(ENABLE_LIBCPP),1)
CXX.Flags += -stdlib=libc++
LD.Flags += -stdlib=libc++
endif
ifeq ($(ENABLE_PROFILING),1)
BuildMode := $(BuildMode)+Profile
CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
@ -253,9 +324,9 @@ ifeq ($(ENABLE_PROFILING),1)
KEEP_SYMBOLS := 1
endif
#ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
# CXX.Flags += -fvisibility-inlines-hidden
#endif
ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
CXX.Flags += -fvisibility-inlines-hidden
endif
ifdef ENABLE_EXPENSIVE_CHECKS
# GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
@ -445,8 +516,12 @@ endif
#--------------------------------------------------------------------
# Full Paths To Compiled Tools and Utilities
#--------------------------------------------------------------------
EchoCmd = $(ECHO) llvm[$(MAKELEVEL)]:
Echo = @$(EchoCmd)
EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
ifdef BUILD_DIRS_ONLY
EchoCmd := $(EchoCmd) "(build tools)":
endif
Echo := @$(EchoCmd)
ifndef LLVMAS
LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
endif
@ -457,7 +532,11 @@ ifndef LLVM_TBLGEN
LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
endif
endif
LLVM_CONFIG := $(LLVMToolDir)/llvm-config
ifeq ($(LLVM_CROSS_COMPILING),1)
LLVM_CONFIG := $(BuildLLVMToolDir)/llvm-config$(BUILD_EXEEXT)
else
LLVM_CONFIG := $(LLVMToolDir)/llvm-config$(EXEEXT)
endif
ifndef LLVMLD
LLVMLD := $(LLVMToolDir)/llvm-ld$(EXEEXT)
endif
@ -571,7 +650,7 @@ ifndef NO_PEDANTIC
CompileCommonOpts += -pedantic -Wno-long-long
endif
CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
$(EXTRA_OPTIONS)
$(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT)
# Enable cast-qual for C++; the workaround is to use const_cast.
CXX.Flags += -Wcast-qual
@ -622,7 +701,13 @@ ifeq ($(HOST_OS),AuroraUX)
CPP.BaseFlags += -include llvm/Support/Solaris.h
endif # !HOST_OS - AuroraUX.
LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
# On Windows, SharedLibDir != LibDir. The order is important.
ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
LD.Flags += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir)
else
LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
endif
CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
# All -I flags should go here, so that they don't confuse llvm-config.
CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
@ -631,6 +716,10 @@ CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
$(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
$(CPP.BaseFlags)
ifeq ($(INCLUDE_BUILD_DIR),1)
CPP.Flags += -I$(ObjDir)
endif
# SHOW_DIAGNOSTICS support.
ifeq ($(SHOW_DIAGNOSTICS),1)
Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
@ -639,35 +728,18 @@ else
Compile.Wrapper :=
endif
ifeq ($(BUILD_COMPONENT), 1)
Compile.C = $(Compile.Wrapper) \
$(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Compile.CXX = $(Compile.Wrapper) \
$(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
$(CPPFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Preprocess.CXX= $(Compile.Wrapper) \
$(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \
$(CompileCommonOpts) $(CXX.Flags) -E
Link = $(Compile.Wrapper) \
$(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
$(LD.Flags) $(LDFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
else
Compile.C = $(Compile.Wrapper) \
Compile.C = $(Compile.Wrapper) \
$(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Compile.CXX = $(Compile.Wrapper) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Compile.CXX = $(Compile.Wrapper) \
$(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Preprocess.CXX= $(Compile.Wrapper) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Preprocess.CXX= $(Compile.Wrapper) \
$(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
$(CompileCommonOpts) $(CXX.Flags) -E
Link = $(Compile.Wrapper) \
$(CompileCommonOpts) $(CXX.Flags) -E
Link = $(Compile.Wrapper) \
$(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
$(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
endif
$(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
BCCompile.C = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts)
@ -806,7 +878,7 @@ endif
# Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
#-----------------------------------------------------------
ifdef OPTIONAL_PARALLEL_DIRS
PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) && echo "$(T)"))
PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)"))
endif
#-----------------------------------------------------------
@ -828,13 +900,20 @@ unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
$(ParallelTargets) :
$(Verb) if ([ ! -f $(@D)/Makefile ] || \
command test $(@D)/Makefile -ot \
$(PROJ_SRC_DIR)/$(@D)/Makefile ); then \
$(MKDIR) $(@D); \
$(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
$(Verb) \
SD=$(PROJ_SRC_DIR)/$(@D); \
DD=$(@D); \
if [ ! -f $$SD/Makefile ]; then \
SD=$(@D); \
DD=$(notdir $(@D)); \
fi; \
if ([ ! -f $$DD/Makefile ] || \
command test $$DD/Makefile -ot \
$$SD/Makefile ); then \
$(MKDIR) $$DD; \
$(CP) $$SD/Makefile $$DD/Makefile; \
fi; \
$(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
$(MAKE) -C $$DD $(subst $(@D)/.make,,$@)
endif
#---------------------------------------------------------
@ -991,7 +1070,7 @@ ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
$(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
$(Verb) echo "{" > $@
$(Verb) grep -q "\<" $< && echo " global:" >> $@ || :
$(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || :
$(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
ifneq ($(HOST_OS),OpenBSD)
$(Verb) echo " local: *;" >> $@
@ -1353,7 +1432,7 @@ LD.Flags += -Wl,-exported_symbol,_main
endif
endif
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD))
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU))
ifneq ($(ARCH), Mips)
LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
endif
@ -1413,12 +1492,23 @@ else
$(ToolBuildPath): $(ToolDir)/.dir
endif
ifdef CODESIGN_TOOLS
$(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
$(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
$(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
$(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
$(StripWarnMsg)
$(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME)
$(Verb) codesign -s - $@
else
$(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
$(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
$(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
$(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
$(StripWarnMsg)
endif
ifneq ($(strip $(ToolAliasBuildPath)),)
$(ToolAliasBuildPath): $(ToolBuildPath)
@ -1435,12 +1525,19 @@ install-local::
uninstall-local::
$(Echo) Uninstall circumvented with NO_INSTALL
else
DestTool = $(DESTDIR)$(PROJ_bindir)/$(TOOLEXENAME)
ifdef INTERNAL_TOOL
ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin
else
ToolBinDir = $(DESTDIR)$(PROJ_bindir)
endif
DestTool = $(ToolBinDir)/$(TOOLEXENAME)
install-local:: $(DestTool)
$(DestTool): $(ToolBuildPath) $(DESTDIR)$(PROJ_bindir)
$(DestTool): $(ToolBuildPath)
$(Echo) Installing $(BuildMode) $(DestTool)
$(Verb) $(MKDIR) $(ToolBinDir)
$(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
uninstall-local::
@ -1449,7 +1546,7 @@ uninstall-local::
# TOOLALIAS install.
ifdef TOOLALIAS
DestToolAlias = $(DESTDIR)$(PROJ_bindir)/$(TOOLALIAS)$(EXEEXT)
DestToolAlias = $(ToolBinDir)/$(TOOLALIAS)$(EXEEXT)
install-local:: $(DestToolAlias)
@ -1783,6 +1880,9 @@ $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
$(Echo) "Building $(<F) decoder tables with tblgen"
$(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
$(ObjDir)/%GenDFAPacketizer.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
$(Echo) "Building $(<F) DFA packetizer tables with tblgen"
$(Verb) $(LLVMTableGen) -gen-dfa-packetizer -o $(call SYSPATH, $@) $<
clean-local::
-$(Verb) $(RM) -f $(INCFiles)
@ -1815,7 +1915,6 @@ clean-local::
ifneq ($(strip $(ObjRootDir)),)
-$(Verb) $(RM) -rf $(ObjRootDir)
endif
-$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
-$(Verb) $(RM) -f *$(SHLIBEXT)
endif
@ -2209,6 +2308,7 @@ printvars::
$(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
$(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
$(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
$(Echo) "PROJ_internal_prefix : " '$(PROJ_internal_prefix)'
$(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
$(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
$(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'

View File

@ -1,4 +0,0 @@
DepModule:
BuildCmd: ./build-for-llvm-top.sh
CleanCmd: make clean -C ../build.llvm
InstallCmd: make install -C ../build.llvm

View File

@ -1,3 +1,4 @@
Low Level Virtual Machine (LLVM)
================================
@ -13,3 +14,5 @@ assistance with LLVM.
If you're writing a package for LLVM, see docs/Packaging.html for our
suggestions.

View File

@ -14,9 +14,9 @@ clean() {
### Periods should be escaped with backslash for use by grep.
###
### If you update these, please also update docs/GettingStarted.html
want_autoconf_version='2\.61'
want_autoconf_version='2\.60'
want_autoheader_version=$want_autoconf_version
want_aclocal_version='1\.10'
want_aclocal_version='1\.9\.6'
want_libtool_version='1\.5\.22'
### END NOTE #########################################################

4
autoconf/config.sub vendored
View File

@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011 Free Software Foundation, Inc.
timestamp='2011-08-23'
timestamp='2011-11-02'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -256,6 +256,7 @@ case $basic_machine in
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fido | fr30 | frv \
| hexagon \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
@ -367,6 +368,7 @@ case $basic_machine in
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hexagon-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \

View File

@ -30,13 +30,15 @@ dnl=== SECTION 1: Initialization & Setup
dnl===
dnl===-----------------------------------------------------------------------===
dnl Initialize autoconf and define the package name, version number and
dnl email address for reporting bugs.
AC_INIT([[llvm]],[[3.0]],[llvmbugs@cs.uiuc.edu])
dnl address for reporting bugs.
AC_INIT([LLVM],[3.1svn],[http://llvm.org/bugs/])
AC_DEFINE([LLVM_VERSION_MAJOR], [3], [Major version of the LLVM API])
AC_DEFINE([LLVM_VERSION_MINOR], [1], [Minor version of the LLVM API])
dnl Provide a copyright substitution and ensure the copyright notice is included
dnl in the output of --version option of the generated configure script.
AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2011 University of Illinois at Urbana-Champaign."])
AC_COPYRIGHT([Copyright (c) 2003-2011 University of Illinois at Urbana-Champaign.])
AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2012 University of Illinois at Urbana-Champaign."])
AC_COPYRIGHT([Copyright (c) 2003-2012 University of Illinois at Urbana-Champaign.])
dnl Indicate that we require autoconf 2.60 or later.
AC_PREREQ(2.60)
@ -114,6 +116,7 @@ do
llvm-tv) AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
safecode) AC_CONFIG_SUBDIRS([projects/safecode]) ;;
llvm-kernel) AC_CONFIG_SUBDIRS([projects/llvm-kernel]) ;;
compiler-rt) ;;
llvm-gcc) ;;
test-suite) ;;
llvm-test) ;;
@ -188,7 +191,7 @@ AC_CACHE_CHECK([type of operating system we're going to host on],
llvm_cv_no_link_all_option="-Wl,-noall_load"
llvm_cv_os_type="Minix"
llvm_cv_platform_type="Unix" ;;
*-*-freebsd*)
*-*-freebsd* | *-*-kfreebsd-gnu)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="FreeBSD"
@ -223,6 +226,11 @@ AC_CACHE_CHECK([type of operating system we're going to host on],
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="Linux"
llvm_cv_platform_type="Unix" ;;
*-*-gnu*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="GNU"
llvm_cv_platform_type="Unix" ;;
*-*-solaris*)
llvm_cv_link_all_option="-Wl,-z,allextract"
llvm_cv_no_link_all_option="-Wl,-z,defaultextract"
@ -278,7 +286,7 @@ AC_CACHE_CHECK([type of operating system we're going to target],
llvm_cv_target_os_type="Darwin" ;;
*-*-minix*)
llvm_cv_target_os_type="Minix" ;;
*-*-freebsd*)
*-*-freebsd* | *-*-kfreebsd-gnu)
llvm_cv_target_os_type="FreeBSD" ;;
*-*-openbsd*)
llvm_cv_target_os_type="OpenBSD" ;;
@ -292,6 +300,8 @@ AC_CACHE_CHECK([type of operating system we're going to target],
llvm_cv_target_os_type="Interix" ;;
*-*-linux*)
llvm_cv_target_os_type="Linux" ;;
*-*-gnu*)
llvm_cv_target_os_type="GNU" ;;
*-*-solaris*)
llvm_cv_target_os_type="SunOS" ;;
*-*-auroraux*)
@ -352,13 +362,12 @@ AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
amd64-* | x86_64-*) llvm_cv_target_arch="x86_64" ;;
sparc*-*) llvm_cv_target_arch="Sparc" ;;
powerpc*-*) llvm_cv_target_arch="PowerPC" ;;
alpha*-*) llvm_cv_target_arch="Alpha" ;;
arm*-*) llvm_cv_target_arch="ARM" ;;
mips-*) llvm_cv_target_arch="Mips" ;;
mipsel-*) llvm_cv_target_arch="Mips" ;;
xcore-*) llvm_cv_target_arch="XCore" ;;
msp430-*) llvm_cv_target_arch="MSP430" ;;
s390x-*) llvm_cv_target_arch="SystemZ" ;;
bfin-*) llvm_cv_target_arch="Blackfin" ;;
hexagon-*) llvm_cv_target_arch="Hexagon" ;;
mblaze-*) llvm_cv_target_arch="MBlaze" ;;
ptx-*) llvm_cv_target_arch="PTX" ;;
*) llvm_cv_target_arch="Unknown" ;;
@ -368,7 +377,7 @@ if test "$llvm_cv_target_arch" = "Unknown" ; then
AC_MSG_WARN([Configuring LLVM for an unknown target archicture])
fi
# Determine the LLVM native architecture for the target
dnl Determine the LLVM native architecture for the target
case "$llvm_cv_target_arch" in
x86) LLVM_NATIVE_ARCH="X86" ;;
x86_64) LLVM_NATIVE_ARCH="X86" ;;
@ -381,7 +390,7 @@ AC_SUBST(ARCH,$llvm_cv_target_arch)
dnl Check for the endianness of the target
AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
dnl Check for build platform executable suffix if we're crosscompiling
dnl Check for build platform executable suffix if we're cross-compiling
if test "$cross_compiling" = yes; then
AC_SUBST(LLVM_CROSS_COMPILING, [1])
AC_BUILD_EXEEXT
@ -418,9 +427,21 @@ dnl=== SECTION 3: Command line arguments for the configure script.
dnl===
dnl===-----------------------------------------------------------------------===
dnl --enable-libcpp : check whether or not to use libc++ on the command line
AC_ARG_ENABLE(libcpp,
AS_HELP_STRING([--enable-libcpp],
[Use libc++ if available (default is NO)]),,
enableval=default)
case "$enableval" in
yes) AC_SUBST(ENABLE_LIBCPP,[1]) ;;
no) AC_SUBST(ENABLE_LIBCPP,[0]) ;;
default) AC_SUBST(ENABLE_LIBCPP,[0]);;
*) AC_MSG_ERROR([Invalid setting for --enable-libcpp. Use "yes" or "no"]) ;;
esac
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=$optimize)
--enable-optimized,[Compile with optimizations enabled (default is NO)]),,enableval=$optimize)
if test ${enableval} = "no" ; then
AC_SUBST(ENABLE_OPTIMIZED,[[]])
else
@ -438,7 +459,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
@ -489,13 +510,11 @@ 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,0) ;;
ARM) AC_SUBST(TARGET_HAS_JIT,1) ;;
Mips) AC_SUBST(TARGET_HAS_JIT,1) ;;
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) ;;
Hexagon) 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) ;;
@ -532,12 +551,13 @@ AC_ARG_ENABLE(threads,
[Use threads if available (default is YES)]),,
enableval=default)
case "$enableval" in
yes) AC_SUBST(ENABLE_THREADS,[1]) ;;
no) AC_SUBST(ENABLE_THREADS,[0]) ;;
default) AC_SUBST(ENABLE_THREADS,[1]) ;;
yes) AC_SUBST(LLVM_ENABLE_THREADS,[1]) ;;
no) AC_SUBST(LLVM_ENABLE_THREADS,[0]) ;;
default) AC_SUBST(LLVM_ENABLE_THREADS,[1]) ;;
*) AC_MSG_ERROR([Invalid setting for --enable-threads. Use "yes" or "no"]) ;;
esac
AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled])
AC_DEFINE_UNQUOTED([LLVM_ENABLE_THREADS],$LLVM_ENABLE_THREADS,
[Define if threads enabled])
dnl Allow disablement of pthread.h
AC_ARG_ENABLE(pthreads,
@ -607,30 +627,28 @@ 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,
xcore, msp430, systemz, blackfin, ptx, cbe, and cpp (default=all)]),,
host, x86, x86_64, sparc, powerpc, arm, mips, spu, hexagon,
xcore, msp430, ptx, 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 XCore MSP430 SystemZ Blackfin CBackend CppBackend MBlaze PTX" ;;
all) TARGETS_TO_BUILD="X86 Sparc PowerPC ARM Mips CellSPU XCore MSP430 CppBackend MBlaze PTX Hexagon" ;;
*)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
case "$a_target" in
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;;
powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;;
alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;;
arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
mipsel) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
spu) TARGETS_TO_BUILD="CellSPU $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" ;;
blackfin) TARGETS_TO_BUILD="Blackfin $TARGETS_TO_BUILD" ;;
cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;;
cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;;
hexagon) TARGETS_TO_BUILD="Hexagon $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
@ -638,15 +656,13 @@ case "$enableval" in
x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
Sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;;
PowerPC) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;;
Alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;;
ARM) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
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" ;;
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" ;;
Hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
PTX) TARGETS_TO_BUILD="PTX $TARGETS_TO_BUILD" ;;
*) AC_MSG_ERROR([Can not set target to build]) ;;
esac ;;
@ -657,8 +673,8 @@ case "$enableval" in
esac
AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD)
# Determine whether we are building LLVM support for the native architecture.
# If so, define LLVM_NATIVE_ARCH to that LLVM target.
dnl Determine whether we are building LLVM support for the native architecture.
dnl If so, define LLVM_NATIVE_ARCH to that LLVM target.
for a_target in $TARGETS_TO_BUILD; do
if test "$a_target" = "$LLVM_NATIVE_ARCH"; then
AC_DEFINE_UNQUOTED(LLVM_NATIVE_ARCH, $LLVM_NATIVE_ARCH,
@ -670,6 +686,9 @@ for a_target in $TARGETS_TO_BUILD; do
if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser"
fi
if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then
LLVM_NATIVE_DISASSEMBLER="LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler"
fi
AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGET, $LLVM_NATIVE_TARGET,
[LLVM name for the native Target init function, if available])
AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETINFO, $LLVM_NATIVE_TARGETINFO,
@ -682,11 +701,15 @@ for a_target in $TARGETS_TO_BUILD; do
AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPARSER, $LLVM_NATIVE_ASMPARSER,
[LLVM name for the native AsmParser init function, if available])
fi
if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then
AC_DEFINE_UNQUOTED(LLVM_NATIVE_DISASSEMBLER, $LLVM_NATIVE_DISASSEMBLER,
[LLVM name for the native Disassembler init function, if available])
fi
fi
done
# Build the LLVM_TARGET and LLVM_... macros for Targets.def and the individual
# target feature def files.
dnl Build the LLVM_TARGET and LLVM_... macros for Targets.def and the individual
dnl target feature def files.
LLVM_ENUM_TARGETS=""
LLVM_ENUM_ASM_PRINTERS=""
LLVM_ENUM_ASM_PARSERS=""
@ -708,21 +731,6 @@ AC_SUBST(LLVM_ENUM_ASM_PRINTERS)
AC_SUBST(LLVM_ENUM_ASM_PARSERS)
AC_SUBST(LLVM_ENUM_DISASSEMBLERS)
dnl Prevent the CBackend from using printf("%a") for floating point so older
dnl C compilers that cannot deal with the 0x0p+0 hex floating point format
dnl can still compile the CBE's output
AC_ARG_ENABLE([cbe-printf-a],AS_HELP_STRING([--enable-cbe-printf-a],
[Enable C Backend output with hex floating point via %a (default is YES)]),,
enableval=default)
case "$enableval" in
yes) AC_SUBST(ENABLE_CBE_PRINTF_A,[1]) ;;
no) AC_SUBST(ENABLE_CBE_PRINTF_A,[0]) ;;
default) AC_SUBST(ENABLE_CBE_PRINTF_A,[1]) ;;
*) AC_MSG_ERROR([Invalid setting for --enable-cbe-printf-a. Use "yes" or "no"]) ;;
esac
AC_DEFINE_UNQUOTED([ENABLE_CBE_PRINTF_A],$ENABLE_CBE_PRINTF_A,
[Define if CBE is enabled for printf %a output])
dnl Override the option to use for optimized builds.
AC_ARG_WITH(optimize-option,
AS_HELP_STRING([--with-optimize-option],
@ -795,6 +803,17 @@ case "$withval" in
*) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;;
esac
AC_ARG_WITH(clang-srcdir,
AS_HELP_STRING([--with-clang-srcdir],
[Directory to the out-of-tree Clang source]),,
withval="-")
case "$withval" in
-) clang_src_root="" ;;
/* | [[A-Za-z]]:[[\\/]]*) clang_src_root="$withval" ;;
*) clang_src_root="$ac_pwd/$withval" ;;
esac
AC_SUBST(CLANG_SRC_ROOT,[$clang_src_root])
AC_ARG_WITH(clang-resource-dir,
AS_HELP_STRING([--with-clang-resource-dir],
[Relative directory from the Clang binary for resource files]),,
@ -809,33 +828,15 @@ AC_ARG_WITH(c-include-dirs,
AC_DEFINE_UNQUOTED(C_INCLUDE_DIRS,"$withval",
[Directories clang will search for headers])
AC_ARG_WITH(cxx-include-root,
AS_HELP_STRING([--with-cxx-include-root],
[Directory with the libstdc++ headers.]),,
# Clang normally uses the system c++ headers and libraries. With this option,
# clang will use the ones provided by a gcc installation instead. This option should
# be passed the same value that was used with --prefix when configuring gcc.
AC_ARG_WITH(gcc-toolchain,
AS_HELP_STRING([--with-gcc-toolchain],
[Directory where gcc is installed.]),,
withval="")
AC_DEFINE_UNQUOTED(CXX_INCLUDE_ROOT,"$withval",
[Directory with the libstdc++ headers.])
AC_ARG_WITH(cxx-include-arch,
AS_HELP_STRING([--with-cxx-include-arch],
[Architecture of the libstdc++ headers.]),,
withval="")
AC_DEFINE_UNQUOTED(CXX_INCLUDE_ARCH,"$withval",
[Arch the libstdc++ headers.])
AC_ARG_WITH(cxx-include-32bit-dir,
AS_HELP_STRING([--with-cxx-include-32bit-dir],
[32 bit multilib dir.]),,
withval="")
AC_DEFINE_UNQUOTED(CXX_INCLUDE_32BIT_DIR,"$withval",
[32 bit multilib directory.])
AC_ARG_WITH(cxx-include-64bit-dir,
AS_HELP_STRING([--with-cxx-include-64bit-dir],
[64 bit multilib directory.]),,
withval="")
AC_DEFINE_UNQUOTED(CXX_INCLUDE_64BIT_DIR,"$withval",
[64 bit multilib directory.])
AC_DEFINE_UNQUOTED(GCC_INSTALL_PREFIX,"$withval",
[Directory where gcc is installed.])
dnl Allow linking of LLVM with GPLv3 binutils code.
AC_ARG_WITH(binutils-include,
@ -873,6 +874,12 @@ AC_ARG_ENABLE(libffi,AS_HELP_STRING(
esac],
llvm_cv_enable_libffi=no)
AC_ARG_WITH(internal-prefix,
AS_HELP_STRING([--with-internal-prefix],
[Installation directory for internal files]),,
withval="")
AC_SUBST(INTERNAL_PREFIX,[$withval])
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 4: Check for programs we need and that they are the right version
@ -991,16 +998,6 @@ if test "$XDOT_PY" != "echo xdot.py" ; then
[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])
AC_SUBST(PERL)
if test x"$PERL" = xnone; then
AC_SUBST(HAVE_PERL,0)
AC_MSG_ERROR([perl is required but was not found, please install it])
else
AC_SUBST(HAVE_PERL,1)
fi
dnl Find the install program
AC_PROG_INSTALL
dnl Prepend src dir to install path dir if it's a relative path
@ -1101,7 +1098,8 @@ dnl Check optional compiler flags.
AC_MSG_CHECKING([optional compiler flags])
CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros])
CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers])
AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS])
CXX_FLAG_CHECK(COVERED_SWITCH_DEFAULT, [-Wcovered-switch-default])
AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT])
dnl===-----------------------------------------------------------------------===
dnl===
@ -1133,7 +1131,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 && test "$ENABLE_PTHREADS" -eq 1 ; then
if test "$LLVM_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],
@ -1178,29 +1176,83 @@ AC_ARG_WITH(oprofile,
*) llvm_cv_oppath="${withval}/lib/oprofile"
CPPFLAGS="-I${withval}/include";;
esac
if test -n "$llvm_cv_oppath" ; then
LIBS="$LIBS -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}"
dnl Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537744:
dnl libbfd is not included properly in libopagent in some Debian
dnl versions. If libbfd isn't found at all, we assume opagent works
dnl anyway.
AC_SEARCH_LIBS(bfd_init, bfd, [], [])
AC_SEARCH_LIBS(op_open_agent, opagent, [], [
echo "Error! You need to have libopagent around."
exit -1
])
AC_CHECK_HEADER([opagent.h], [], [
echo "Error! You need to have opagent.h around."
exit -1
])
fi
case $llvm_cv_os_type in
Linux)
if test -n "$llvm_cv_oppath" ; then
LIBS="$LIBS -lopagent -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}"
dnl Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537744:
dnl libbfd is not included properly in libopagent in some Debian
dnl versions. If libbfd isn't found at all, we assume opagent works
dnl anyway.
AC_SEARCH_LIBS(bfd_init, bfd, [], [])
AC_SEARCH_LIBS(op_open_agent, opagent, [], [
echo "Error! You need to have libopagent around."
exit -1
])
AC_CHECK_HEADER([opagent.h], [], [
echo "Error! You need to have opagent.h around."
exit -1
])
fi ;;
*)
AC_MSG_ERROR([OProfile support is available on Linux only.]) ;;
esac
],
[
AC_SUBST(USE_OPROFILE, [0])
])
AC_DEFINE_UNQUOTED([USE_OPROFILE],$USE_OPROFILE,
AC_DEFINE_UNQUOTED([LLVM_USE_OPROFILE],$USE_OPROFILE,
[Define if we have the oprofile JIT-support library])
dnl Enable support for Intel JIT Events API.
AC_ARG_WITH(intel-jitevents,
AS_HELP_STRING([--with-intel-jitevents=<vtune-amplifier-dir>],
[Specify location of run-time support library for Intel JIT API (default=/opt/intel/vtune_amplifier_xe_2011)]),
[
case $llvm_cv_os_type in
Linux|Win32|Cygwin|MingW) ;;
*)
AC_MSG_ERROR([
Intel JIT API support is available on Linux and Windows only."]) ;;
esac
AC_SUBST(USE_INTEL_JITEVENTS, [1])
case "$llvm_cv_target_arch" in
x86) llvm_intel_jitevents_archdir="lib32";;
x86_64) llvm_intel_jitevents_archdir="lib64";;
*) echo "Target architecture $llvm_cv_target_arch does not support Intel JIT Events API"
exit -1;;
esac
INTEL_JITEVENTS_INCDIR="/opt/intel/vtune_amplifier_xe_2011/include"
INTEL_JITEVENTS_LIBDIR="/opt/intel/vtune_amplifier_xe_2011/$llvm_intel_jitevents_archdir"
case "$withval" in
/* | [[A-Za-z]]:[[\\/]]*) INTEL_JITEVENTS_INCDIR=$withval/include
INTEL_JITEVENTS_LIBDIR=$withval/$llvm_intel_jitevents_archdir ;;
*) ;;
esac
AC_SUBST(INTEL_JITEVENTS_INCDIR)
AC_SUBST(INTEL_JITEVENTS_LIBDIR)
LIBS="$LIBS -L${INTEL_JITEVENTS_LIBDIR}"
CPPFLAGS="$CPPFLAGS -I$INTEL_JITEVENTS_INCDIR"
AC_SEARCH_LIBS(iJIT_IsProfilingActive, jitprofiling, [], [
echo "Error! Cannot find libjitprofiling.a. Please check path specified in flag --with-intel-jitevents"
exit -1
])
AC_CHECK_HEADER([jitprofiling.h], [], [
echo "Error! Cannot find jitprofiling.h. Please check path specified in flag --with-intel-jitevents"
exit -1
])
],
[
AC_SUBST(USE_INTEL_JITEVENTS, [0])
])
AC_DEFINE_UNQUOTED([LLVM_USE_INTEL_JITEVENTS],$USE_INTEL_JITEVENTS,
[Define if we have the Intel JIT API runtime support library])
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 6: Check for header files
@ -1224,7 +1276,7 @@ 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])
AC_CHECK_HEADERS([fenv.h])
if test "$ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then
if test "$LLVM_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))
@ -1282,7 +1334,7 @@ AC_CHECK_FUNCS([backtrace ceilf floorf roundf rintf nearbyintf getcwd ])
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([mktemp posix_spawn pread realpath sbrk setrlimit strdup ])
AC_CHECK_FUNCS([strerror strerror_r setenv ])
AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev])
@ -1405,9 +1457,9 @@ dnl Propagate the run-time library path variable that the libltdl
dnl checks found to the Makefiles so we can use it there too
AC_SUBST(SHLIBPATH_VAR,$libltdl_cv_shlibpath_var)
# Translate the various configuration directories and other basic
# information into substitutions that will end up in Makefile.config.in
# that these configured values can be used by the makefiles
dnl Translate the various configuration directories and other basic
dnl information into substitutions that will end up in Makefile.config.in
dnl that these configured values can be used by the makefiles
if test "${prefix}" = "NONE" ; then
prefix="/usr/local"
fi
@ -1432,8 +1484,13 @@ AC_SUBST(LLVM_INFODIR)
AC_SUBST(LLVM_MANDIR)
AC_SUBST(LLVM_CONFIGTIME)
# Place the various directores into the config.h file as #defines so that we
# can know about the installation paths within LLVM.
dnl Disable embedding timestamps in the build directory, with ENABLE_TIMESTAMPS.
if test "${ENABLE_TIMESTAMPS}" = "0"; then
LLVM_CONFIGTIME="(timestamp not enabled)"
fi
dnl Place the various directories into the config.h file as #defines so that we
dnl can know about the installation paths within LLVM.
AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX",
[Installation prefix directory])
AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR",
@ -1454,10 +1511,10 @@ AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR",
[Installation directory for man pages])
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
[Time at which LLVM was configured])
AC_DEFINE_UNQUOTED(LLVM_HOSTTRIPLE, "$host",
[Host triple we were built on])
AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target",
[Target triple LLVM will generate code for by default])
# Determine which bindings to build.
dnl Determine which bindings to build.
if test "$BINDINGS_TO_BUILD" = auto ; then
BINDINGS_TO_BUILD=""
if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then
@ -1466,11 +1523,11 @@ if test "$BINDINGS_TO_BUILD" = auto ; then
fi
AC_SUBST(BINDINGS_TO_BUILD,$BINDINGS_TO_BUILD)
# This isn't really configurey, but it avoids having to repeat the list in
# other files.
dnl This isn't really configurey, but it avoids having to repeat the list in
dnl other files.
AC_SUBST(ALL_BINDINGS,ocaml)
# Do any work necessary to ensure that bindings have what they need.
dnl Do any work necessary to ensure that bindings have what they need.
binding_prereqs_failed=0
for a_binding in $BINDINGS_TO_BUILD ; do
case "$a_binding" in
@ -1534,7 +1591,7 @@ dnl===-----------------------------------------------------------------------===
dnl Configure header files
dnl WARNING: dnl If you add or remove any of the following config headers, then
dnl you MUST also update Makefile.rules so that the variable FilesToConfig
dnl you MUST also update Makefile so that the variable FilesToConfig
dnl contains the same list of files as AC_CONFIG_HEADERS below. This ensures the
dnl files can be updated automatically when their *.in sources change.
AC_CONFIG_HEADERS([include/llvm/Config/config.h include/llvm/Config/llvm-config.h])
@ -1556,12 +1613,18 @@ AC_CONFIG_FILES([llvm.spec])
dnl Configure doxygen's configuration file
AC_CONFIG_FILES([docs/doxygen.cfg])
if test -f ${srcdir}/tools/clang/README.txt; then
AC_CONFIG_FILES([tools/clang/docs/doxygen.cfg])
fi
dnl Do the first stage of configuration for llvm-config.in.
AC_CONFIG_FILES([tools/llvm-config/llvm-config.in])
dnl Configure clang, if present
if test "${clang_src_root}" = ""; then
clang_src_root="$srcdir/tools/clang"
fi
if test -f ${clang_src_root}/README.txt; then
dnl Use variables to stay under 80 columns.
configh="include/clang/Config/config.h"
doxy="docs/doxygen.cfg"
AC_CONFIG_HEADERS([tools/clang/${configh}:${clang_src_root}/${configh}.in])
AC_CONFIG_FILES([tools/clang/${doxy}:${clang_src_root}/${doxy}.in])
fi
dnl OCaml findlib META file
AC_CONFIG_FILES([bindings/ocaml/llvm/META.llvm])

View File

@ -4668,7 +4668,7 @@ static const void *lt_preloaded_setup() {
# linked before any other PIC object. But we must not use
# pic_flag when linking with -static. The problem exists in
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
*-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
case "$compile_command " in
*" -static "*) ;;
*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;

View File

@ -1,2 +1,2 @@
AC_DEFUN([CXX_FLAG_CHECK],
[AC_SUBST($1, `$CXX $2 -fsyntax-only -xc /dev/null 2>/dev/null && echo $2`)])
[AC_SUBST($1, `$CXX -Werror $2 -fsyntax-only -xc /dev/null 2>/dev/null && echo $2`)])

View File

@ -19,7 +19,7 @@ fi
AC_SINGLE_CXX_CHECK([ac_cv_func_std_isinf_in_cmath],
[std::isinf], [<cmath>],
[float f; std::isinf(f)}])
[float f; std::isinf(f);])
if test "$ac_cv_func_std_isinf_in_cmath" = "yes" ; then
AC_DEFINE([HAVE_STD_ISINF_IN_CMATH],1,[Set to 1 if the std::isinf function is found in <cmath>])
fi

View File

@ -6,7 +6,7 @@ AC_DEFUN([AC_HUGE_VAL_CHECK],[
AC_CACHE_CHECK([for HUGE_VAL sanity], [ac_cv_huge_val_sanity],[
AC_LANG_PUSH([C++])
ac_save_CXXFLAGS=$CXXFLAGS
CXXFLAGS=-pedantic
CXXFLAGS="$CXXFLAGS -pedantic"
AC_RUN_IFELSE(
AC_LANG_PROGRAM(
[#include <math.h>],

View File

@ -1384,7 +1384,7 @@ dgux*)
shlibpath_var=LD_LIBRARY_PATH
;;
freebsd1*)
freebsd1.*)
dynamic_linker=no
;;
@ -1407,7 +1407,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
freebsd[[123]]*) objformat=aout ;;
freebsd[[123]].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@ -1425,7 +1425,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
freebsd2*)
freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[[01]]* | freebsdelf3.[[01]]*)
@ -3099,7 +3099,7 @@ case $host_os in
;;
esac
;;
freebsd[[12]]*)
freebsd[[12]].*)
# C++ shared libraries reported to be fairly broken before switch to ELF
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
@ -5858,7 +5858,7 @@ _LT_EOF
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
freebsd1*)
freebsd1.*)
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
@ -5874,7 +5874,7 @@ _LT_EOF
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
freebsd2*)
freebsd2.*)
_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
_LT_AC_TAGVAR(hardcode_direct, $1)=yes
_LT_AC_TAGVAR(hardcode_minus_L, $1)=yes

View File

@ -10,7 +10,7 @@ AC_DEFUN([AC_LINK_GET_VERSION],
# Check for ld64.
if (echo "$version_string" | grep -q "ld64"); then
llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)#\1#")
llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)\( (.*)\)\{0,1\}#\1#")
else
llvm_cv_link_version=$(echo "$version_string" | sed -e "s#[^0-9]*\([0-9.]*\).*#\1#")
fi

View File

@ -1,16 +0,0 @@
dnl Check for a reasonable version of Perl.
dnl $1 - Minimum Perl version. Typically 5.006.
dnl
AC_DEFUN([LLVM_PROG_PERL], [
AC_PATH_PROG(PERL, [perl], [none])
if test "$PERL" != "none"; then
AC_MSG_CHECKING(for Perl $1 or newer)
if $PERL -e 'use $1;' 2>&1 > /dev/null; then
AC_MSG_RESULT(yes)
else
PERL=none
AC_MSG_RESULT(not found)
fi
fi
])

View File

@ -8,8 +8,10 @@ AC_DEFUN([AC_CXX_USE_VISIBILITY_INLINES_HIDDEN],
[llvm_cv_cxx_visibility_inlines_hidden],
[ AC_LANG_PUSH([C++])
oldcxxflags="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
CXXFLAGS="$CXXFLAGS -O0 -fvisibility-inlines-hidden -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[template <typename T> struct X { void __attribute__((noinline)) f() {} };],
[X<int>().f();])],
[llvm_cv_cxx_visibility_inlines_hidden=yes],[llvm_cv_cxx_visibility_inlines_hidden=no])
CXXFLAGS="$oldcxxflags"
AC_LANG_POP([C++])

21
bindings/LLVMBuild.txt Normal file
View File

@ -0,0 +1,21 @@
;===- ./bindings/LLVMBuild.txt ---------------------------------*- Conf -*--===;
;
; The LLVM Compiler Infrastructure
;
; This file is distributed under the University of Illinois Open Source
; License. See LICENSE.TXT for details.
;
;===------------------------------------------------------------------------===;
;
; This is an LLVMBuild description file for the components in this subdirectory.
;
; For more information on the LLVMBuild system, please see:
;
; http://llvm.org/docs/LLVMBuild.html
;
;===------------------------------------------------------------------------===;
[component_0]
type = Group
name = Bindings
parent = $ROOT

View File

@ -238,14 +238,14 @@ clean-cmis::
# Also install the .mli's (headers) as documentation.
install-cmis: $(OutputsCMI) $(OcamlHeaders)
$(Verb) $(MKDIR) $(PROJ_libocamldir)
$(Verb) for i in $(OutputsCMI:$(OcamlDir)/%=%); do \
$(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \
$(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \
done
$(Verb) for i in $(OcamlHeaders:$(ObjDir)/%=%); do \
$(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \
$(DataInstall) $(ObjDir)/$$i "$(PROJ_libocamldir)/$$i"; \
done
$(Verb) for i in $(OutputsCMI:$(OcamlDir)/%=%); do \
$(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \
$(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \
done
uninstall-cmis::
$(Verb) for i in $(OutputsCMI:$(OcamlDir)/%=%); do \

View File

@ -1,6 +1,6 @@
name = "llvm"
version = "@PACKAGE_VERSION@"
description = "Low Level Virtual Machine OCaml bindings"
description = "LLVM OCaml bindings"
archive(byte) = "llvm.cma"
archive(native) = "llvm.cmxa"
directory = "."

View File

@ -30,11 +30,13 @@ copy-meta: $(OcamlDir)/META.llvm
$(OcamlDir)/META.llvm: META.llvm
$(Verb) $(CP) -f $< $@
install-meta:: $(ObjDir)/META.llvm
install-meta:: $(OcamlDir)/META.llvm
$(Echo) "Install $(BuildMode) $(DestMETA)"
$(Verb) $(MKDIR) $(PROJ_libocamldir)
$(Verb) $(DataInstall) META.llvm "$(DestMETA)"
$(Verb) $(DataInstall) $< "$(DestMETA)"
uninstall-meta::
$(Echo) "Uninstalling $(DestMETA)"
-$(Verb) $(RM) -f "$(DestMETA)"
.PHONY: copy-meta install-meta uninstall-meta

View File

@ -20,6 +20,7 @@ type llmemorybuffer
module TypeKind = struct
type t =
| Void
| Half
| Float
| Double
| X86fp80
@ -1234,5 +1235,6 @@ let rec string_of_lltype ty =
| TypeKind.X86fp80 -> "x86_fp80"
| TypeKind.Double -> "double"
| TypeKind.Float -> "float"
| TypeKind.Half -> "half"
| TypeKind.Void -> "void"
| TypeKind.Metadata -> "metadata"

View File

@ -53,6 +53,7 @@ type llmemorybuffer
module TypeKind : sig
type t =
Void
| Half
| Float
| Double
| X86fp80

View File

@ -21,7 +21,6 @@
#include "caml/memory.h"
#include "caml/fail.h"
#include "caml/callback.h"
#include "llvm/Config/config.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@ -1164,7 +1163,7 @@ CAMLprim value llvm_instr_get_opcode(LLVMValueRef Inst) {
if (!LLVMIsAInstruction(Inst))
failwith("Not an instruction");
o = LLVMGetInstructionOpcode(Inst);
assert (o <= LLVMUnwind );
assert (o <= LLVMLandingPad);
return Val_int(o);
}

View File

@ -0,0 +1,67 @@
This directory contains Python bindings for LLVM's C library.
The bindings are currently a work in progress and are far from complete.
Use at your own risk.
Developer Info
==============
The single Python package is "llvm." Modules inside this package roughly
follow the names of the modules/headers defined by LLVM's C API.
Testing
-------
All test code is location in llvm/tests. Tests are written as classes
which inherit from llvm.tests.base.TestBase, which is a convenience base
class that provides common functionality.
Tests can be executed by installing nose:
pip install nosetests
Then by running nosetests:
nosetests
To see more output:
nosetests -v
To step into the Python debugger while running a test, add the following
to your test at the point you wish to enter the debugger:
import pdb; pdb.set_trace()
Then run nosetests:
nosetests -s -v
You should strive for high code coverage. To see current coverage:
pip install coverage
nosetests --with-coverage --cover-html
Then open cover/index.html in your browser of choice to see the code coverage.
Style Convention
----------------
All code should pass PyFlakes. First, install PyFlakes:
pip install pyflakes
Then at any time run it to see a report:
pyflakes .
Eventually we'll provide a Pylint config file. In the meantime, install
Pylint:
pip install pylint
And run:
pylint llvm
And try to keep the number of violations to a minimum.

View File

View File

@ -0,0 +1,106 @@
#===- common.py - Python LLVM Bindings -----------------------*- python -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
from ctypes import POINTER
from ctypes import c_void_p
from ctypes import cdll
import ctypes.util
__all__ = [
'c_object_p',
'find_library',
'get_library',
]
c_object_p = POINTER(c_void_p)
class LLVMObject(object):
"""Base class for objects that are backed by an LLVM data structure.
This class should never be instantiated outside of this package.
"""
def __init__(self, ptr, ownable=True, disposer=None):
assert isinstance(ptr, c_object_p)
self._ptr = self._as_parameter_ = ptr
self._self_owned = True
self._ownable = ownable
self._disposer = disposer
self._owned_objects = []
def take_ownership(self, obj):
"""Take ownership of another object.
When you take ownership of another object, you are responsible for
destroying that object. In addition, a reference to that object is
placed inside this object so the Python garbage collector will not
collect the object while it is still alive in libLLVM.
This method should likely only be called from within modules inside
this package.
"""
assert isinstance(obj, LLVMObject)
self._owned_objects.append(obj)
obj._self_owned = False
def from_param(self):
"""ctypes function that converts this object to a function parameter."""
return self._as_parameter_
def __del__(self):
if not hasattr(self, '_self_owned') or not hasattr(self, '_disposer'):
return
if self._self_owned and self._disposer:
self._disposer(self)
class CachedProperty(object):
"""Decorator that caches the result of a property lookup.
This is a useful replacement for @property. It is recommended to use this
decorator on properties that invoke C API calls for which the result of the
call will be idempotent.
"""
def __init__(self, wrapped):
self.wrapped = wrapped
try:
self.__doc__ = wrapped.__doc__
except: # pragma: no cover
pass
def __get__(self, instance, instance_type=None):
if instance is None:
return self
value = self.wrapped(instance)
setattr(instance, self.wrapped.__name__, value)
return value
def find_library():
# FIXME should probably have build system define absolute path of shared
# library at install time.
for lib in ['LLVM-3.1svn', 'libLLVM-3.1svn', 'LLVM', 'libLLVM']:
result = ctypes.util.find_library(lib)
if result:
return result
return None
def get_library():
"""Obtain a reference to the llvm library."""
lib = find_library()
if not lib:
raise Exception('LLVM shared library not found!')
return cdll.LoadLibrary(lib)

View File

@ -0,0 +1,98 @@
#===- core.py - Python LLVM Bindings -------------------------*- python -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
from .common import LLVMObject
from .common import c_object_p
from .common import get_library
from . import enumerations
from ctypes import POINTER
from ctypes import byref
from ctypes import c_char_p
__all__ = [
"lib",
"MemoryBuffer",
]
lib = get_library()
class OpCode(object):
"""Represents an individual OpCode enumeration."""
_value_map = {}
def __init__(self, name, value):
self.name = name
self.value = value
def __repr__(self):
return 'OpCode.%s' % self.name
@staticmethod
def from_value(value):
"""Obtain an OpCode instance from a numeric value."""
result = OpCode._value_map.get(value, None)
if result is None:
raise ValueError('Unknown OpCode: %d' % value)
return result
@staticmethod
def register(name, value):
"""Registers a new OpCode enumeration.
This is called by this module for each enumeration defined in
enumerations. You should not need to call this outside this module.
"""
if value in OpCode._value_map:
raise ValueError('OpCode value already registered: %d' % value)
opcode = OpCode(name, value)
OpCode._value_map[value] = opcode
setattr(OpCode, name, opcode)
class MemoryBuffer(LLVMObject):
"""Represents an opaque memory buffer."""
def __init__(self, filename=None):
"""Create a new memory buffer.
Currently, we support creating from the contents of a file at the
specified filename.
"""
if filename is None:
raise Exception("filename argument must be defined")
memory = c_object_p()
out = c_char_p(None)
result = lib.LLVMCreateMemoryBufferWithContentsOfFile(filename,
byref(memory), byref(out))
if result:
raise Exception("Could not create memory buffer: %s" % out.value)
LLVMObject.__init__(self, memory, disposer=lib.LLVMDisposeMemoryBuffer)
def register_library(library):
library.LLVMCreateMemoryBufferWithContentsOfFile.argtypes = [c_char_p,
POINTER(c_object_p), POINTER(c_char_p)]
library.LLVMCreateMemoryBufferWithContentsOfFile.restype = bool
library.LLVMDisposeMemoryBuffer.argtypes = [MemoryBuffer]
def register_enumerations():
for name, value in enumerations.OpCodes:
OpCode.register(name, value)
register_library(lib)
register_enumerations()

View File

@ -0,0 +1,134 @@
#===- disassembler.py - Python LLVM Bindings -----------------*- python -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
from ctypes import CFUNCTYPE
from ctypes import POINTER
from ctypes import addressof
from ctypes import byref
from ctypes import c_byte
from ctypes import c_char_p
from ctypes import c_int
from ctypes import c_size_t
from ctypes import c_ubyte
from ctypes import c_uint64
from ctypes import c_void_p
from ctypes import cast
from .common import LLVMObject
from .common import c_object_p
from .common import get_library
__all__ = [
'Disassembler',
]
lib = get_library()
callbacks = {}
class Disassembler(LLVMObject):
"""Represents a disassembler instance.
Disassembler instances are tied to specific "triple," which must be defined
at creation time.
Disassembler instances can disassemble instructions from multiple sources.
"""
def __init__(self, triple):
"""Create a new disassembler instance.
The triple argument is the triple to create the disassembler for. This
is something like 'i386-apple-darwin9'.
"""
ptr = lib.LLVMCreateDisasm(c_char_p(triple), c_void_p(None), c_int(0),
callbacks['op_info'](0), callbacks['symbol_lookup'](0))
if not ptr.contents:
raise Exception('Could not obtain disassembler for triple: %s' %
triple)
LLVMObject.__init__(self, ptr, disposer=lib.LLVMDisasmDispose)
def get_instruction(self, source, pc=0):
"""Obtain the next instruction from an input source.
The input source should be a str or bytearray or something that
represents a sequence of bytes.
This function will start reading bytes from the beginning of the
source.
The pc argument specifies the address that the first byte is at.
This returns a 2-tuple of:
long number of bytes read. 0 if no instruction was read.
str representation of instruction. This will be the assembly that
represents the instruction.
"""
buf = cast(c_char_p(source), POINTER(c_ubyte))
out_str = cast((c_byte * 255)(), c_char_p)
result = lib.LLVMDisasmInstruction(self, buf, c_uint64(len(source)),
c_uint64(pc), out_str, 255)
return (result, out_str.value)
def get_instructions(self, source, pc=0):
"""Obtain multiple instructions from an input source.
This is like get_instruction() except it is a generator for all
instructions within the source. It starts at the beginning of the
source and reads instructions until no more can be read.
This generator returns 3-tuple of:
long address of instruction.
long size of instruction, in bytes.
str representation of instruction.
"""
source_bytes = c_char_p(source)
out_str = cast((c_byte * 255)(), c_char_p)
# This could probably be written cleaner. But, it does work.
buf = cast(source_bytes, POINTER(c_ubyte * len(source))).contents
offset = 0
address = pc
end_address = pc + len(source)
while address < end_address:
b = cast(addressof(buf) + offset, POINTER(c_ubyte))
result = lib.LLVMDisasmInstruction(self, b,
c_uint64(len(source) - offset), c_uint64(address),
out_str, 255)
if result == 0:
break
yield (address, result, out_str.value)
address += result
offset += result
def register_library(library):
library.LLVMCreateDisasm.argtypes = [c_char_p, c_void_p, c_int,
callbacks['op_info'], callbacks['symbol_lookup']]
library.LLVMCreateDisasm.restype = c_object_p
library.LLVMDisasmDispose.argtypes = [Disassembler]
library.LLVMDisasmInstruction.argtypes = [Disassembler, POINTER(c_ubyte),
c_uint64, c_uint64, c_char_p, c_size_t]
library.LLVMDisasmInstruction.restype = c_size_t
callbacks['op_info'] = CFUNCTYPE(c_int, c_void_p, c_uint64, c_uint64, c_uint64,
c_int, c_void_p)
callbacks['symbol_lookup'] = CFUNCTYPE(c_char_p, c_void_p, c_uint64,
POINTER(c_uint64), c_uint64,
POINTER(c_char_p))
register_library(lib)

View File

@ -0,0 +1,211 @@
#===- enumerations.py - Python LLVM Enumerations -------------*- python -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
r"""
LLVM Enumerations
=================
This file defines enumerations from LLVM.
Each enumeration is exposed as a list of 2-tuples. These lists are consumed by
dedicated types elsewhere in the package. The enumerations are centrally
defined in this file so they are easier to locate and maintain.
"""
__all__ = [
'Attributes',
'OpCodes',
'TypeKinds',
'Linkages',
'Visibility',
'CallConv',
'IntPredicate',
'RealPredicate',
'LandingPadClauseTy',
]
Attributes = [
('ZExt', 1 << 0),
('MSExt', 1 << 1),
('NoReturn', 1 << 2),
('InReg', 1 << 3),
('StructRet', 1 << 4),
('NoUnwind', 1 << 5),
('NoAlias', 1 << 6),
('ByVal', 1 << 7),
('Nest', 1 << 8),
('ReadNone', 1 << 9),
('ReadOnly', 1 << 10),
('NoInline', 1 << 11),
('AlwaysInline', 1 << 12),
('OptimizeForSize', 1 << 13),
('StackProtect', 1 << 14),
('StackProtectReq', 1 << 15),
('Alignment', 31 << 16),
('NoCapture', 1 << 21),
('NoRedZone', 1 << 22),
('ImplicitFloat', 1 << 23),
('Naked', 1 << 24),
('InlineHint', 1 << 25),
('StackAlignment', 7 << 26),
('ReturnsTwice', 1 << 29),
('UWTable', 1 << 30),
('NonLazyBind', 1 << 31),
]
OpCodes = [
('Ret', 1),
('Br', 2),
('Switch', 3),
('IndirectBr', 4),
('Invoke', 5),
('Unreachable', 7),
('Add', 8),
('FAdd', 9),
('Sub', 10),
('FSub', 11),
('Mul', 12),
('FMul', 13),
('UDiv', 14),
('SDiv', 15),
('FDiv', 16),
('URem', 17),
('SRem', 18),
('FRem', 19),
('Shl', 20),
('LShr', 21),
('AShr', 22),
('And', 23),
('Or', 24),
('Xor', 25),
('Alloca', 26),
('Load', 27),
('Store', 28),
('GetElementPtr', 29),
('Trunc', 30),
('ZExt', 31),
('SExt', 32),
('FPToUI', 33),
('FPToSI', 34),
('UIToFP', 35),
('SIToFP', 36),
('FPTrunc', 37),
('FPExt', 38),
('PtrToInt', 39),
('IntToPtr', 40),
('BitCast', 41),
('ICmp', 42),
('FCmpl', 43),
('PHI', 44),
('Call', 45),
('Select', 46),
('UserOp1', 47),
('UserOp2', 48),
('AArg', 49),
('ExtractElement', 50),
('InsertElement', 51),
('ShuffleVector', 52),
('ExtractValue', 53),
('InsertValue', 54),
('Fence', 55),
('AtomicCmpXchg', 56),
('AtomicRMW', 57),
('Resume', 58),
('LandingPad', 59),
]
TypeKinds = [
('Void', 0),
('Half', 1),
('Float', 2),
('Double', 3),
('X86_FP80', 4),
('FP128', 5),
('PPC_FP128', 6),
('Label', 7),
('Integer', 8),
('Function', 9),
('Struct', 10),
('Array', 11),
('Pointer', 12),
('Vector', 13),
('Metadata', 14),
('X86_MMX', 15),
]
Linkages = [
('External', 0),
('AvailableExternally', 1),
('LinkOnceAny', 2),
('LinkOnceODR', 3),
('WeakAny', 4),
('WeakODR', 5),
('Appending', 6),
('Internal', 7),
('Private', 8),
('DLLImport', 9),
('DLLExport', 10),
('ExternalWeak', 11),
('Ghost', 12),
('Common', 13),
('LinkerPrivate', 14),
('LinkerPrivateWeak', 15),
('LinkerPrivateWeakDefAuto', 16),
]
Visibility = [
('Default', 0),
('Hidden', 1),
('Protected', 2),
]
CallConv = [
('CCall', 0),
('FastCall', 8),
('ColdCall', 9),
('X86StdcallCall', 64),
('X86FastcallCall', 65),
]
IntPredicate = [
('EQ', 32),
('NE', 33),
('UGT', 34),
('UGE', 35),
('ULT', 36),
('ULE', 37),
('SGT', 38),
('SGE', 39),
('SLT', 40),
('SLE', 41),
]
RealPredicate = [
('PredicateFalse', 0),
('OEQ', 1),
('OGT', 2),
('OGE', 3),
('OLT', 4),
('OLE', 5),
('ONE', 6),
('ORD', 7),
('UNO', 8),
('UEQ', 9),
('UGT', 10),
('UGE', 11),
('ULT', 12),
('ULE', 13),
('UNE', 14),
('PredicateTrue', 15),
]
LandingPadClauseTy = [
('Catch', 0),
('Filter', 1),
]

View File

@ -0,0 +1,523 @@
#===- object.py - Python Object Bindings --------------------*- python -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
r"""
Object File Interface
=====================
This module provides an interface for reading information from object files
(e.g. binary executables and libraries).
Using this module, you can obtain information about an object file's sections,
symbols, and relocations. These are represented by the classes ObjectFile,
Section, Symbol, and Relocation, respectively.
Usage
-----
The only way to use this module is to start by creating an ObjectFile. You can
create an ObjectFile by loading a file (specified by its path) or by creating a
llvm.core.MemoryBuffer and loading that.
Once you have an object file, you can inspect its sections and symbols directly
by calling get_sections() and get_symbols() respectively. To inspect
relocations, call get_relocations() on a Section instance.
Iterator Interface
------------------
The LLVM bindings expose iteration over sections, symbols, and relocations in a
way that only allows one instance to be operated on at a single time. This is
slightly annoying from a Python perspective, as it isn't very Pythonic to have
objects that "expire" but are still active from a dynamic language.
To aid working around this limitation, each Section, Symbol, and Relocation
instance caches its properties after first access. So, if the underlying
iterator is advanced, the properties can still be obtained provided they have
already been retrieved.
In addition, we also provide a "cache" method on each class to cache all
available data. You can call this on each obtained instance. Or, you can pass
cache=True to the appropriate get_XXX() method to have this done for you.
Here are some examples on how to perform iteration:
obj = ObjectFile(filename='/bin/ls')
# This is OK. Each Section is only accessed inside its own iteration slot.
section_names = []
for section in obj.get_sections():
section_names.append(section.name)
# This is NOT OK. You perform a lookup after the object has expired.
symbols = list(obj.get_symbols())
for symbol in symbols:
print symbol.name # This raises because the object has expired.
# In this example, we mix a working and failing scenario.
symbols = []
for symbol in obj.get_symbols():
symbols.append(symbol)
print symbol.name
for symbol in symbols:
print symbol.name # OK
print symbol.address # NOT OK. We didn't look up this property before.
# Cache everything up front.
symbols = list(obj.get_symbols(cache=True))
for symbol in symbols:
print symbol.name # OK
"""
from ctypes import c_char_p
from ctypes import c_uint64
from .common import CachedProperty
from .common import LLVMObject
from .common import c_object_p
from .common import get_library
from .core import MemoryBuffer
__all__ = [
"lib",
"ObjectFile",
"Relocation",
"Section",
"Symbol",
]
class ObjectFile(LLVMObject):
"""Represents an object/binary file."""
def __init__(self, filename=None, contents=None):
"""Construct an instance from a filename or binary data.
filename must be a path to a file that can be opened with open().
contents can be either a native Python buffer type (like str) or a
llvm.core.MemoryBuffer instance.
"""
if contents:
assert isinstance(contents, MemoryBuffer)
if filename is not None:
contents = MemoryBuffer(filename=filename)
if contents is None:
raise Exception('No input found.')
ptr = lib.LLVMCreateObjectFile(contents)
LLVMObject.__init__(self, ptr, disposer=lib.LLVMDisposeObjectFile)
self.take_ownership(contents)
def get_sections(self, cache=False):
"""Obtain the sections in this object file.
This is a generator for llvm.object.Section instances.
Sections are exposed as limited-use objects. See the module's
documentation on iterators for more.
"""
sections = lib.LLVMGetSections(self)
last = None
while True:
if lib.LLVMIsSectionIteratorAtEnd(self, sections):
break
last = Section(sections)
if cache:
last.cache()
yield last
lib.LLVMMoveToNextSection(sections)
last.expire()
if last is not None:
last.expire()
lib.LLVMDisposeSectionIterator(sections)
def get_symbols(self, cache=False):
"""Obtain the symbols in this object file.
This is a generator for llvm.object.Symbol instances.
Each Symbol instance is a limited-use object. See this module's
documentation on iterators for more.
"""
symbols = lib.LLVMGetSymbols(self)
last = None
while True:
if lib.LLVMIsSymbolIteratorAtEnd(self, symbols):
break
last = Symbol(symbols, self)
if cache:
last.cache()
yield last
lib.LLVMMoveToNextSymbol(symbols)
last.expire()
if last is not None:
last.expire()
lib.LLVMDisposeSymbolIterator(symbols)
class Section(LLVMObject):
"""Represents a section in an object file."""
def __init__(self, ptr):
"""Construct a new section instance.
Section instances can currently only be created from an ObjectFile
instance. Therefore, this constructor should not be used outside of
this module.
"""
LLVMObject.__init__(self, ptr)
self.expired = False
@CachedProperty
def name(self):
"""Obtain the string name of the section.
This is typically something like '.dynsym' or '.rodata'.
"""
if self.expired:
raise Exception('Section instance has expired.')
return lib.LLVMGetSectionName(self)
@CachedProperty
def size(self):
"""The size of the section, in long bytes."""
if self.expired:
raise Exception('Section instance has expired.')
return lib.LLVMGetSectionSize(self)
@CachedProperty
def contents(self):
if self.expired:
raise Exception('Section instance has expired.')
return lib.LLVMGetSectionContents(self)
@CachedProperty
def address(self):
"""The address of this section, in long bytes."""
if self.expired:
raise Exception('Section instance has expired.')
return lib.LLVMGetSectionAddress(self)
def has_symbol(self, symbol):
"""Returns whether a Symbol instance is present in this Section."""
if self.expired:
raise Exception('Section instance has expired.')
assert isinstance(symbol, Symbol)
return lib.LLVMGetSectionContainsSymbol(self, symbol)
def get_relocations(self, cache=False):
"""Obtain the relocations in this Section.
This is a generator for llvm.object.Relocation instances.
Each instance is a limited used object. See this module's documentation
on iterators for more.
"""
if self.expired:
raise Exception('Section instance has expired.')
relocations = lib.LLVMGetRelocations(self)
last = None
while True:
if lib.LLVMIsRelocationIteratorAtEnd(self, relocations):
break
last = Relocation(relocations)
if cache:
last.cache()
yield last
lib.LLVMMoveToNextRelocation(relocations)
last.expire()
if last is not None:
last.expire()
lib.LLVMDisposeRelocationIterator(relocations)
def cache(self):
"""Cache properties of this Section.
This can be called as a workaround to the single active Section
limitation. When called, the properties of the Section are fetched so
they are still available after the Section has been marked inactive.
"""
getattr(self, 'name')
getattr(self, 'size')
getattr(self, 'contents')
getattr(self, 'address')
def expire(self):
"""Expire the section.
This is called internally by the section iterator.
"""
self.expired = True
class Symbol(LLVMObject):
"""Represents a symbol in an object file."""
def __init__(self, ptr, object_file):
assert isinstance(ptr, c_object_p)
assert isinstance(object_file, ObjectFile)
LLVMObject.__init__(self, ptr)
self.expired = False
self._object_file = object_file
@CachedProperty
def name(self):
"""The str name of the symbol.
This is often a function or variable name. Keep in mind that name
mangling could be in effect.
"""
if self.expired:
raise Exception('Symbol instance has expired.')
return lib.LLVMGetSymbolName(self)
@CachedProperty
def address(self):
"""The address of this symbol, in long bytes."""
if self.expired:
raise Exception('Symbol instance has expired.')
return lib.LLVMGetSymbolAddress(self)
@CachedProperty
def file_offset(self):
"""The offset of this symbol in the file, in long bytes."""
if self.expired:
raise Exception('Symbol instance has expired.')
return lib.LLVMGetSymbolFileOffset(self)
@CachedProperty
def size(self):
"""The size of the symbol, in long bytes."""
if self.expired:
raise Exception('Symbol instance has expired.')
return lib.LLVMGetSymbolSize(self)
@CachedProperty
def section(self):
"""The Section to which this Symbol belongs.
The returned Section instance does not expire, unlike Sections that are
commonly obtained through iteration.
Because this obtains a new section iterator each time it is accessed,
calling this on a number of Symbol instances could be expensive.
"""
sections = lib.LLVMGetSections(self._object_file)
lib.LLVMMoveToContainingSection(sections, self)
return Section(sections)
def cache(self):
"""Cache all cacheable properties."""
getattr(self, 'name')
getattr(self, 'address')
getattr(self, 'file_offset')
getattr(self, 'size')
def expire(self):
"""Mark the object as expired to prevent future API accesses.
This is called internally by this module and it is unlikely that
external callers have a legitimate reason for using it.
"""
self.expired = True
class Relocation(LLVMObject):
"""Represents a relocation definition."""
def __init__(self, ptr):
"""Create a new relocation instance.
Relocations are created from objects derived from Section instances.
Therefore, this constructor should not be called outside of this
module. See Section.get_relocations() for the proper method to obtain
a Relocation instance.
"""
assert isinstance(ptr, c_object_p)
LLVMObject.__init__(self, ptr)
self.expired = False
@CachedProperty
def address(self):
"""The address of this relocation, in long bytes."""
if self.expired:
raise Exception('Relocation instance has expired.')
return lib.LLVMGetRelocationAddress(self)
@CachedProperty
def offset(self):
"""The offset of this relocation, in long bytes."""
if self.expired:
raise Exception('Relocation instance has expired.')
return lib.LLVMGetRelocationOffset(self)
@CachedProperty
def symbol(self):
"""The Symbol corresponding to this Relocation."""
if self.expired:
raise Exception('Relocation instance has expired.')
ptr = lib.LLVMGetRelocationSymbol(self)
return Symbol(ptr)
@CachedProperty
def type_number(self):
"""The relocation type, as a long."""
if self.expired:
raise Exception('Relocation instance has expired.')
return lib.LLVMGetRelocationType(self)
@CachedProperty
def type_name(self):
"""The relocation type's name, as a str."""
if self.expired:
raise Exception('Relocation instance has expired.')
return lib.LLVMGetRelocationTypeName(self)
@CachedProperty
def value_string(self):
if self.expired:
raise Exception('Relocation instance has expired.')
return lib.LLVMGetRelocationValueString(self)
def expire(self):
"""Expire this instance, making future API accesses fail."""
self.expired = True
def cache(self):
"""Cache all cacheable properties on this instance."""
getattr(self, 'address')
getattr(self, 'offset')
getattr(self, 'symbol')
getattr(self, 'type')
getattr(self, 'type_name')
getattr(self, 'value_string')
def register_library(library):
"""Register function prototypes with LLVM library instance."""
# Object.h functions
library.LLVMCreateObjectFile.argtypes = [MemoryBuffer]
library.LLVMCreateObjectFile.restype = c_object_p
library.LLVMDisposeObjectFile.argtypes = [ObjectFile]
library.LLVMGetSections.argtypes = [ObjectFile]
library.LLVMGetSections.restype = c_object_p
library.LLVMDisposeSectionIterator.argtypes = [c_object_p]
library.LLVMIsSectionIteratorAtEnd.argtypes = [ObjectFile, c_object_p]
library.LLVMIsSectionIteratorAtEnd.restype = bool
library.LLVMMoveToNextSection.argtypes = [c_object_p]
library.LLVMMoveToContainingSection.argtypes = [c_object_p, c_object_p]
library.LLVMGetSymbols.argtypes = [ObjectFile]
library.LLVMGetSymbols.restype = c_object_p
library.LLVMDisposeSymbolIterator.argtypes = [c_object_p]
library.LLVMIsSymbolIteratorAtEnd.argtypes = [ObjectFile, c_object_p]
library.LLVMIsSymbolIteratorAtEnd.restype = bool
library.LLVMMoveToNextSymbol.argtypes = [c_object_p]
library.LLVMGetSectionName.argtypes = [c_object_p]
library.LLVMGetSectionName.restype = c_char_p
library.LLVMGetSectionSize.argtypes = [c_object_p]
library.LLVMGetSectionSize.restype = c_uint64
library.LLVMGetSectionContents.argtypes = [c_object_p]
library.LLVMGetSectionContents.restype = c_char_p
library.LLVMGetSectionAddress.argtypes = [c_object_p]
library.LLVMGetSectionAddress.restype = c_uint64
library.LLVMGetSectionContainsSymbol.argtypes = [c_object_p, c_object_p]
library.LLVMGetSectionContainsSymbol.restype = bool
library.LLVMGetRelocations.argtypes = [c_object_p]
library.LLVMGetRelocations.restype = c_object_p
library.LLVMDisposeRelocationIterator.argtypes = [c_object_p]
library.LLVMIsRelocationIteratorAtEnd.argtypes = [c_object_p, c_object_p]
library.LLVMIsRelocationIteratorAtEnd.restype = bool
library.LLVMMoveToNextRelocation.argtypes = [c_object_p]
library.LLVMGetSymbolName.argtypes = [Symbol]
library.LLVMGetSymbolName.restype = c_char_p
library.LLVMGetSymbolAddress.argtypes = [Symbol]
library.LLVMGetSymbolAddress.restype = c_uint64
library.LLVMGetSymbolFileOffset.argtypes = [Symbol]
library.LLVMGetSymbolFileOffset.restype = c_uint64
library.LLVMGetSymbolSize.argtypes = [Symbol]
library.LLVMGetSymbolSize.restype = c_uint64
library.LLVMGetRelocationAddress.argtypes = [c_object_p]
library.LLVMGetRelocationAddress.restype = c_uint64
library.LLVMGetRelocationOffset.argtypes = [c_object_p]
library.LLVMGetRelocationOffset.restype = c_uint64
library.LLVMGetRelocationSymbol.argtypes = [c_object_p]
library.LLVMGetRelocationSymbol.restype = c_object_p
library.LLVMGetRelocationType.argtypes = [c_object_p]
library.LLVMGetRelocationType.restype = c_uint64
library.LLVMGetRelocationTypeName.argtypes = [c_object_p]
library.LLVMGetRelocationTypeName.restype = c_char_p
library.LLVMGetRelocationValueString.argtypes = [c_object_p]
library.LLVMGetRelocationValueString.restype = c_char_p
lib = get_library()
register_library(lib)

View File

View File

@ -0,0 +1,32 @@
import os.path
import unittest
POSSIBLE_TEST_BINARIES = [
'libreadline.so.5',
'libreadline.so.6',
]
POSSIBLE_TEST_BINARY_PATHS = [
'/usr/lib/debug',
'/lib',
'/usr/lib',
'/usr/local/lib',
'/lib/i386-linux-gnu',
]
class TestBase(unittest.TestCase):
def get_test_binary(self):
"""Helper to obtain a test binary for object file testing.
FIXME Support additional, highly-likely targets or create one
ourselves.
"""
for d in POSSIBLE_TEST_BINARY_PATHS:
for lib in POSSIBLE_TEST_BINARIES:
path = os.path.join(d, lib)
if os.path.exists(path):
return path
raise Exception('No suitable test binaries available!')
get_test_binary.__test__ = False

View File

@ -0,0 +1,23 @@
from .base import TestBase
from ..core import OpCode
from ..core import MemoryBuffer
class TestCore(TestBase):
def test_opcode(self):
self.assertTrue(hasattr(OpCode, 'Ret'))
self.assertTrue(isinstance(OpCode.Ret, OpCode))
self.assertEqual(OpCode.Ret.value, 1)
op = OpCode.from_value(1)
self.assertTrue(isinstance(op, OpCode))
self.assertEqual(op, OpCode.Ret)
def test_memory_buffer_create_from_file(self):
source = self.get_test_binary()
MemoryBuffer(filename=source)
def test_memory_buffer_failing(self):
with self.assertRaises(Exception):
MemoryBuffer(filename="/hopefully/this/path/doesnt/exist")

View File

@ -0,0 +1,28 @@
from .base import TestBase
from ..disassembler import Disassembler
class TestDisassembler(TestBase):
def test_instantiate(self):
Disassembler('i686-apple-darwin9')
def test_basic(self):
sequence = '\x67\xe3\x81' # jcxz -127
triple = 'i686-apple-darwin9'
disassembler = Disassembler(triple)
count, s = disassembler.get_instruction(sequence)
self.assertEqual(count, 3)
self.assertEqual(s, '\tjcxz\t-127')
def test_get_instructions(self):
sequence = '\x67\xe3\x81\x01\xc7' # jcxz -127; addl %eax, %edi
disassembler = Disassembler('i686-apple-darwin9')
instructions = list(disassembler.get_instructions(sequence))
self.assertEqual(len(instructions), 2)
self.assertEqual(instructions[0], (0, 3, '\tjcxz\t-127'))
self.assertEqual(instructions[1], (3, 2, '\taddl\t%eax, %edi'))

View File

@ -0,0 +1,67 @@
from .base import TestBase
from ..object import ObjectFile
from ..object import Relocation
from ..object import Section
from ..object import Symbol
class TestObjectFile(TestBase):
def get_object_file(self):
source = self.get_test_binary()
return ObjectFile(filename=source)
def test_create_from_file(self):
self.get_object_file()
def test_get_sections(self):
o = self.get_object_file()
count = 0
for section in o.get_sections():
count += 1
assert isinstance(section, Section)
assert isinstance(section.name, str)
assert isinstance(section.size, long)
assert isinstance(section.contents, str)
assert isinstance(section.address, long)
self.assertGreater(count, 0)
for section in o.get_sections():
section.cache()
def test_get_symbols(self):
o = self.get_object_file()
count = 0
for symbol in o.get_symbols():
count += 1
assert isinstance(symbol, Symbol)
assert isinstance(symbol.name, str)
assert isinstance(symbol.address, long)
assert isinstance(symbol.size, long)
assert isinstance(symbol.file_offset, long)
self.assertGreater(count, 0)
for symbol in o.get_symbols():
symbol.cache()
def test_symbol_section_accessor(self):
o = self.get_object_file()
for symbol in o.get_symbols():
section = symbol.section
assert isinstance(section, Section)
break
def test_get_relocations(self):
o = self.get_object_file()
for section in o.get_sections():
for relocation in section.get_relocations():
assert isinstance(relocation, Relocation)
assert isinstance(relocation.address, long)
assert isinstance(relocation.offset, long)
assert isinstance(relocation.type_number, long)
assert isinstance(relocation.type_name, str)
assert isinstance(relocation.value_string, str)

View File

@ -1,68 +0,0 @@
#!/bin/sh
# This includes the Bourne shell library from llvm-top. Since this file is
# generally only used when building from llvm-top, it is safe to assume that
# llvm is checked out into llvm-top in which case .. just works.
. ../library.sh
# Process the options passed in to us by the build script into standard
# variables.
process_arguments "$@"
# First, see if the build directory is there. If not, create it.
build_dir="$LLVM_TOP/build.llvm"
if test ! -d "$build_dir" ; then
mkdir -p "$build_dir"
fi
# See if we have previously been configured by sensing the presence
# of the config.status scripts
config_status="$build_dir/config.status"
if test ! -f "$config_status" -o "$config_status" -ot "$0" ; then
# We must configure so build a list of configure options
config_options="--prefix=$PREFIX --with-llvmgccdir=$PREFIX"
if test "$OPTIMIZED" -eq 1 ; then
config_options="$config_options --enable-optimized"
else
config_options="$config_options --disable-optimized"
fi
if test "$DEBUG" -eq 1 ; then
config_options="$config_options --enable-debug"
else
config_options="$config_options --disable-debug"
fi
if test "$ASSERTIONS" -eq 1 ; then
config_options="$config_options --enable-assertions"
else
config_options="$config_options --disable-assertions"
fi
if test "$CHECKING" -eq 1 ; then
config_options="$config_options --enable-expensive-checks"
else
config_options="$config_options --disable-expensive-checks"
fi
if test "$DOXYGEN" -eq 1 ; then
config_options="$config_options --enable-doxygen"
else
config_options="$config_options --disable-doxygen"
fi
if test "$THREADS" -eq 1 ; then
config_options="$config_options --enable-threads"
else
config_options="$config_options --disable-threads"
fi
config_options="$config_options $OPTIONS_DASH $OPTIONS_DASH_DASH"
src_dir=`pwd`
cd "$build_dir"
msg 0 Configuring $module with:
msg 0 " $src_dir/configure" $config_options
$src_dir/configure $config_options || \
die $? "Configuring $module module failed"
else
msg 0 Module $module already configured, ignoring configure options.
cd "$build_dir"
fi
msg 0 Building $module with:
msg 0 " make" $OPTIONS_ASSIGN tools-only
make $OPTIONS_ASSIGN tools-only

View File

@ -94,7 +94,7 @@ endif()
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(isatty unistd.h 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)
@ -126,6 +126,8 @@ 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(posix_spawn spawn.h HAVE_POSIX_SPAWN)
check_symbol_exists(pread unistd.h HAVE_PREAD)
check_symbol_exists(rindex strings.h HAVE_RINDEX)
check_symbol_exists(strchr string.h HAVE_STRCHR)
check_symbol_exists(strcmp string.h HAVE_STRCMP)
@ -285,16 +287,18 @@ include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-Wno-variadic-macros" SUPPORTS_NO_VARIADIC_MACROS_FLAG)
include(GetTargetTriple)
get_target_triple(LLVM_HOSTTRIPLE)
include(GetHostTriple)
get_host_triple(LLVM_HOST_TRIPLE)
# FIXME: We don't distinguish the target and the host. :(
set(TARGET_TRIPLE "${LLVM_HOSTTRIPLE}")
# By default, we target the host, but this can be overridden at CMake
# invocation time.
set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}")
set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
# Determine the native architecture.
string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
if( LLVM_NATIVE_ARCH STREQUAL "host" )
string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_HOSTTRIPLE})
string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_HOST_TRIPLE})
endif ()
if (LLVM_NATIVE_ARCH MATCHES "i[2-6]86")
@ -309,8 +313,6 @@ elseif (LLVM_NATIVE_ARCH MATCHES "sparc")
set(LLVM_NATIVE_ARCH Sparc)
elseif (LLVM_NATIVE_ARCH MATCHES "powerpc")
set(LLVM_NATIVE_ARCH PowerPC)
elseif (LLVM_NATIVE_ARCH MATCHES "alpha")
set(LLVM_NATIVE_ARCH Alpha)
elseif (LLVM_NATIVE_ARCH MATCHES "arm")
set(LLVM_NATIVE_ARCH ARM)
elseif (LLVM_NATIVE_ARCH MATCHES "mips")
@ -333,6 +335,16 @@ else ()
set(LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo)
set(LLVM_NATIVE_TARGETMC LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC)
set(LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter)
# We don't have an ASM parser for all architectures yet.
if (EXISTS ${CMAKE_SOURCE_DIR}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/CMakeLists.txt)
set(LLVM_NATIVE_ASMPARSER LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser)
endif ()
# We don't have an disassembler for all architectures yet.
if (EXISTS ${CMAKE_SOURCE_DIR}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/CMakeLists.txt)
set(LLVM_NATIVE_DISASSEMBLER LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler)
endif ()
endif ()
if( MINGW )
@ -380,14 +392,15 @@ endif( PURE_WINDOWS )
set(RETSIGTYPE void)
if( LLVM_ENABLE_THREADS )
if( HAVE_PTHREAD_H OR WIN32 )
set(ENABLE_THREADS 1)
# Check if threading primitives aren't supported on this platform
if( NOT HAVE_PTHREAD_H AND NOT WIN32 )
set(LLVM_ENABLE_THREADS 0)
endif()
endif()
if( ENABLE_THREADS )
if( LLVM_ENABLE_THREADS )
message(STATUS "Threads enabled.")
else( ENABLE_THREADS )
else( LLVM_ENABLE_THREADS )
message(STATUS "Threads disabled.")
endif()

View File

@ -25,17 +25,16 @@ macro(add_llvm_library name)
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endif()
set_target_properties(${name} PROPERTIES FOLDER "Libraries")
# Add the explicit dependency information for this library.
#
# It would be nice to verify that we have the dependencies for this library
# name, but using get_property(... SET) doesn't suffice to determine if a
# property has been set to an empty value.
get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${name})
target_link_libraries(${name} ${lib_deps})
endmacro(add_llvm_library name)
macro(add_llvm_library_dependencies name)
# Save the dependencies of the LLVM library in a variable so that we can
# query it when resolve llvm-config-style component -> library mappings.
set_property(GLOBAL PROPERTY LLVM_LIB_DEPS_${name} ${ARGN})
# Then add the actual dependencies to the library target.
target_link_libraries(${name} ${ARGN})
endmacro(add_llvm_library_dependencies name)
macro(add_llvm_loadable_module name)
if( NOT LLVM_ON_UNIX OR CYGWIN )
message(STATUS "Loadable modules not supported on this platform.

View File

@ -4,9 +4,9 @@ set(LLVM_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
foreach(lib ${llvm_libs})
get_property(llvm_lib_deps GLOBAL PROPERTY LLVM_LIB_DEPS_${lib})
get_property(llvm_lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${lib})
set(all_llvm_lib_deps
"${all_llvm_lib_deps}\nset_property(GLOBAL PROPERTY LLVM_LIB_DEPS_${lib} ${llvm_lib_deps})")
"${all_llvm_lib_deps}\nset_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${lib} ${llvm_lib_deps})")
endforeach(lib)
configure_file(
@ -32,6 +32,6 @@ install(DIRECTORY .
PATTERN LLVMConfig.cmake EXCLUDE
PATTERN LLVMConfigVersion.cmake EXCLUDE
PATTERN LLVM-Config.cmake EXCLUDE
PATTERN GetTargetTriple.cmake EXCLUDE
PATTERN GetHostTriple.cmake EXCLUDE
PATTERN VersionFromVCS.cmake EXCLUDE
PATTERN CheckAtomic.cmake EXCLUDE)

View File

@ -60,7 +60,7 @@ variables (LLVM_USE_CRT_DEBUG, etc) instead.")
make_crt_regex(MSVC_CRT_REGEX ${MSVC_CRT})
foreach(build_type ${CMAKE_CONFIGURATION_TYPES})
foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
string(TOUPPER "${build_type}" build)
if (NOT LLVM_USE_CRT_${build})
get_current_crt(LLVM_USE_CRT_${build}
@ -75,7 +75,7 @@ variables (LLVM_USE_CRT_DEBUG, etc) instead.")
endif(NOT LLVM_USE_CRT_${build})
endforeach(build_type)
foreach(build_type ${CMAKE_CONFIGURATION_TYPES})
foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
string(TOUPPER "${build_type}" build)
if ("${LLVM_USE_CRT_${build}}" STREQUAL "")
set(flag_string " ")

View File

@ -1,7 +1,7 @@
# Returns the host triple.
# Invokes config.guess
function( get_target_triple var )
function( get_host_triple var )
if( MSVC )
if( CMAKE_CL_64 )
set( value "x86_64-pc-win32" )
@ -27,4 +27,4 @@ function( get_target_triple var )
endif( MSVC )
set( ${var} ${value} PARENT_SCOPE )
message(STATUS "Target triple: ${value}")
endfunction( get_target_triple var )
endfunction( get_host_triple var )

View File

@ -1,3 +1,7 @@
# This CMake module is responsible for interpreting the user defined LLVM_
# options and executing the appropriate CMake commands to realize the users'
# selections.
include(AddLLVMDefinitions)
if( CMAKE_COMPILER_IS_GNUCXX )
@ -20,13 +24,6 @@ else()
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 )
@ -52,9 +49,6 @@ if(WIN32)
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")
@ -82,7 +76,7 @@ if( LLVM_ENABLE_PIC )
# 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 )
elseif( WIN32 OR CYGWIN)
# On Windows all code is PIC. MinGW warns if -fPIC is used.
else()
include(CheckCXXCompilerFlag)
@ -94,12 +88,20 @@ if( LLVM_ENABLE_PIC )
else( SUPPORTS_FPIC_FLAG )
message(WARNING "-fPIC not supported.")
endif()
if( WIN32 OR CYGWIN)
# MinGW warns if -fvisibility-inlines-hidden is used.
else()
check_cxx_compiler_flag("-fvisibility-inlines-hidden" SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG)
if( SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
endif()
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 )
@ -134,6 +136,10 @@ endif()
if( MSVC )
include(ChooseMSVCCRT)
if( MSVC11 )
add_llvm_definitions(-D_VARIADIC_MAX=10)
endif()
# Add definitions that make MSVC much less annoying.
add_llvm_definitions(
# For some reason MS wants to deprecate a bunch of standard functions...
@ -180,6 +186,10 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
if (LLVM_ENABLE_PEDANTIC)
add_llvm_definitions( -pedantic -Wno-long-long )
endif (LLVM_ENABLE_PEDANTIC)
check_cxx_compiler_flag("-Werror -Wcovered-switch-default" SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG)
if( SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG )
add_llvm_definitions( -Wcovered-switch-default )
endif()
endif (LLVM_ENABLE_WARNINGS)
if (LLVM_ENABLE_WERROR)
add_llvm_definitions( -Werror )
@ -189,5 +199,3 @@ endif( MSVC )
add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
add_llvm_definitions( -D__STDC_FORMAT_MACROS )
add_llvm_definitions( -D__STDC_LIMIT_MACROS )
option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON)

View File

@ -152,7 +152,7 @@ function(explicit_map_components_to_libraries out_libs)
set(processed)
while( cursor LESS lst_size )
list(GET expanded_components ${cursor} lib)
get_property(lib_deps GLOBAL PROPERTY LLVM_LIB_DEPS_${lib})
get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${lib})
list(APPEND expanded_components ${lib_deps})
# Remove duplicates at the front:
list(REVERSE expanded_components)

View File

@ -1,5 +1,7 @@
# This file provides information and services to the final user.
set(LLVM_VERSION_MAJOR @LLVM_VERSION_MAJOR@)
set(LLVM_VERSION_MINOR @LLVM_VERSION_MINOR@)
set(LLVM_PACKAGE_VERSION @PACKAGE_VERSION@)
set(LLVM_COMMON_DEPENDS @LLVM_COMMON_DEPENDS@)

View File

@ -51,6 +51,7 @@ function(add_public_tablegen_target target)
add_custom_target(${target}
DEPENDS ${TABLEGEN_OUTPUT})
add_dependencies(${target} ${LLVM_COMMON_DEPENDS})
set_target_properties(${target} PROPERTIES FOLDER "Tablegenning")
endif( TABLEGEN_OUTPUT )
endfunction()
@ -76,7 +77,10 @@ endif()
macro(add_tablegen target project)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})
set(${target}_OLD_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS})
set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} TableGen)
add_llvm_utility(${target} ${ARGN})
set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS})
set(${project}_TABLEGEN "${target}" CACHE
STRING "Native TableGen executable. Saves building one when cross-compiling.")
@ -110,7 +114,6 @@ macro(add_tablegen target project)
endif()
endif()
target_link_libraries(${target} LLVMSupport LLVMTableGen)
if( MINGW )
target_link_libraries(${target} imagehlp psapi)
if(CMAKE_SIZEOF_VOID_P MATCHES "8")

View File

@ -3,7 +3,7 @@
# existence of certain subdirectories under CMAKE_CURRENT_SOURCE_DIR.
function(add_version_info_from_vcs VERS)
set(result ${${VERS}})
string(REPLACE "svn" "" result "${${VERS}}")
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn" )
set(result "${result}svn")
# FindSubversion does not work with symlinks. See PR 8437
@ -13,6 +13,7 @@ function(add_version_info_from_vcs VERS)
if( Subversion_FOUND )
subversion_wc_info( ${CMAKE_CURRENT_SOURCE_DIR} Project )
if( Project_WC_REVISION )
set(SVN_REVISION ${Project_WC_REVISION} PARENT_SCOPE)
set(result "${result}-r${Project_WC_REVISION}")
endif()
endif()
@ -21,24 +22,47 @@ function(add_version_info_from_vcs VERS)
# Try to get a ref-id
find_program(git_executable NAMES git git.exe git.cmd)
if( git_executable )
execute_process(COMMAND ${git_executable} show-ref HEAD
set(is_git_svn_rev_exact false)
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(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
string(REGEX MATCH r[0-9]+ git_svn_rev ${git_output})
string(LENGTH "${git_svn_rev}" rev_length)
math(EXPR rev_length "${rev_length}-1")
string(SUBSTRING "${git_svn_rev}" 1 ${rev_length} git_svn_rev_number)
set(SVN_REVISION ${git_svn_rev_number} PARENT_SCOPE)
set(git_svn_rev "-svn-${git_svn_rev}")
# Determine if the HEAD points directly at a subversion revision.
execute_process(COMMAND ${git_executable} svn find-rev HEAD
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}")
string(STRIP "${git_output}" git_head_svn_rev_number)
if( git_head_svn_rev_number EQUAL git_svn_rev_number )
set(is_git_svn_rev_exact true)
endif()
endif()
else()
set(git_svn_rev "")
endif()
execute_process(COMMAND
${git_executable} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
TIMEOUT 5
RESULT_VARIABLE git_result
OUTPUT_VARIABLE git_output)
if( git_result EQUAL 0 AND NOT is_git_svn_rev_exact )
string(STRIP "${git_output}" git_ref_id)
set(GIT_COMMIT ${git_ref_id} PARENT_SCOPE)
set(result "${result}${git_svn_rev}-${git_ref_id}")
else()
set(result "${result}${git_svn_rev}")
endif()
endif()
endif()

4715
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -418,9 +418,8 @@ implementing, you just override the interfaces you can improve.</p>
<div>
<p>With only two special exceptions (the <tt><a
href="#basic-aa">basicaa</a></tt> and <a href="#no-aa"><tt>no-aa</tt></a>
passes) every alias analysis pass chains to another alias analysis
<p>With only one special exception (the <a href="#no-aa"><tt>no-aa</tt></a>
pass) every alias analysis pass chains to another alias analysis
implementation (for example, the user can specify "<tt>-basicaa -ds-aa
-licm</tt>" to get the maximum benefit from both alias
analyses). The alias analysis class automatically takes care of most of this
@ -1061,7 +1060,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: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2012-01-31 00:05:41 +0100 (Tue, 31 Jan 2012) $
</address>
</body>

View File

@ -232,7 +232,7 @@ non-obvious ways. Here are some hints and tips:<p>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2011-10-31 12:21:59 +0100 (Mon, 31 Oct 2011) $
</address>
</body>

View File

@ -1,29 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="llvm.css" type="text/css" media="screen">
<title>Building the LLVM C/C++ Front-End</title>
<meta HTTP-EQUIV="REFRESH" CONTENT="3; URL=GCCFEBuildInstrs.html">
</head>
<body>
<div class="doc_title">
This page has moved <a href="GCCFEBuildInstrs.html">here</A>.
</div>
<!-- *********************************************************************** -->
<hr>
<address>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
<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/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2008-02-13 17:46:10 +0100 (Wed, 13 Feb 2008) $
</address>
</body>
</html>

View File

@ -145,7 +145,7 @@
text. Generator's names are case-sensitive. Example:</p>
<div class="doc_code">
<p><tt>cmake -G "Visual Studio 8 2005" path/to/llvm/source/root</tt></p>
<p><tt>cmake -G "Visual Studio 9 2008" path/to/llvm/source/root</tt></p>
</div>
<p>For a given development platform there can be more than one
@ -250,7 +250,7 @@
<dd>Semicolon-separated list of targets to build, or <i>all</i> for
building all targets. Case-sensitive. For Visual C++ defaults
to <i>X86</i>. On the other cases defaults to <i>all</i>. Example:
<i>-DLLVM_TARGETS_TO_BUILD="X86;PowerPC;Alpha"</i>.</dd>
<i>-DLLVM_TARGETS_TO_BUILD="X86;PowerPC"</i>.</dd>
<dt><b>LLVM_BUILD_TOOLS</b>:BOOL</dt>
<dd>Build LLVM tools. Defaults to ON. Targets for building each tool
@ -352,6 +352,24 @@
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>
<dt><b>LLVM_CLANG_SOURCE_DIR</b>:PATH</dt>
<dd>Path to Clang's source directory. Defaults to tools/clang.
Clang will not be built when it is empty or it does not point valid
path.</dd>
<dt><b>LLVM_USE_OPROFILE</b>:BOOL</dt>
<dd> Enable building OProfile JIT support. Defaults to OFF</dd>
<dt><b>LLVM_USE_INTEL_JITEVENTS</b>:BOOL</dt>
<dd> Enable building support for Intel JIT Events API. Defaults to OFF</dd>
<dt><b>LLVM_INTEL_JITEVENTS_DIR</b>:PATH</dt>
<dd> Path to installation of Intel(R) VTune(TM) Amplifier XE 2011,
used to locate the <tt>jitprofiling</tt> library. Default =
<tt>%VTUNE_AMPLIFIER_XE_2011_DIR%</tt> (Windows)
| <tt>/opt/intel/vtune_amplifier_xe_2011</tt> (Linux) </dd>
</dl>
</div>

View File

@ -50,6 +50,7 @@
<li><a href="#machinebasicblock">The <tt>MachineBasicBlock</tt>
class</a></li>
<li><a href="#machinefunction">The <tt>MachineFunction</tt> class</a></li>
<li><a href="#machineinstrbundle"><tt>MachineInstr Bundles</tt></a></li>
</ul>
</li>
<li><a href="#mc">The "MC" Layer</a>
@ -97,6 +98,14 @@
<li><a href="#regAlloc_builtIn">Built in register allocators</a></li>
</ul></li>
<li><a href="#codeemit">Code Emission</a></li>
<li><a href="#vliw_packetizer">VLIW Packetizer</a>
<ul>
<li><a href="#vliw_mapping">Mapping from instructions to functional
units</a></li>
<li><a href="#vliw_repr">How the packetization tables are
generated and used</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#nativeassembler">Implementing a Native Assembler</a></li>
@ -698,6 +707,21 @@ ret
</div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="callclobber">Call-clobbered registers</a>
</h4>
<div>
<p>Some machine instructions, like calls, clobber a large number of physical
registers. Rather than adding <code>&lt;def,dead&gt;</code> operands for
all of them, it is possible to use an <code>MO_RegisterMask</code> operand
instead. The register mask operand holds a bit mask of preserved registers,
and everything else is considered to be clobbered by the instruction. </p>
</div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="ssa">Machine code in SSA form</a>
@ -753,6 +777,90 @@ ret
</div>
<!-- ======================================================================= -->
<h3>
<a name="machineinstrbundle"><tt>MachineInstr Bundles</tt></a>
</h3>
<div>
<p>LLVM code generator can model sequences of instructions as MachineInstr
bundles. A MI bundle can model a VLIW group / pack which contains an
arbitrary number of parallel instructions. It can also be used to model
a sequential list of instructions (potentially with data dependencies) that
cannot be legally separated (e.g. ARM Thumb2 IT blocks).</p>
<p>Conceptually a MI bundle is a MI with a number of other MIs nested within:
</p>
<div class="doc_code">
<pre>
--------------
| Bundle | ---------
-------------- \
| ----------------
| | MI |
| ----------------
| |
| ----------------
| | MI |
| ----------------
| |
| ----------------
| | MI |
| ----------------
|
--------------
| Bundle | --------
-------------- \
| ----------------
| | MI |
| ----------------
| |
| ----------------
| | MI |
| ----------------
| |
| ...
|
--------------
| Bundle | --------
-------------- \
|
...
</pre>
</div>
<p> MI bundle support does not change the physical representations of
MachineBasicBlock and MachineInstr. All the MIs (including top level and
nested ones) are stored as sequential list of MIs. The "bundled" MIs are
marked with the 'InsideBundle' flag. A top level MI with the special BUNDLE
opcode is used to represent the start of a bundle. It's legal to mix BUNDLE
MIs with indiviual MIs that are not inside bundles nor represent bundles.
</p>
<p> MachineInstr passes should operate on a MI bundle as a single unit. Member
methods have been taught to correctly handle bundles and MIs inside bundles.
The MachineBasicBlock iterator has been modified to skip over bundled MIs to
enforce the bundle-as-a-single-unit concept. An alternative iterator
instr_iterator has been added to MachineBasicBlock to allow passes to
iterate over all of the MIs in a MachineBasicBlock, including those which
are nested inside bundles. The top level BUNDLE instruction must have the
correct set of register MachineOperand's that represent the cumulative
inputs and outputs of the bundled MIs.</p>
<p> Packing / bundling of MachineInstr's should be done as part of the register
allocation super-pass. More specifically, the pass which determines what
MIs should be bundled together must be done after code generator exits SSA
form (i.e. after two-address pass, PHI elimination, and copy coalescing).
Bundles should only be finalized (i.e. adding BUNDLE MIs and input and
output register MachineOperands) after virtual registers have been
rewritten into physical registers. This requirement eliminates the need to
add virtual register operands to BUNDLE instructions which would effectively
double the virtual register def and use lists.</p>
</div>
</div>
<!-- *********************************************************************** -->
@ -2001,6 +2109,73 @@ to implement an assembler for your target.</p>
</div>
<!-- ======================================================================= -->
<h3>
<a name="vliw_packetizer">VLIW Packetizer</a>
</h3>
<div>
<p>In a Very Long Instruction Word (VLIW) architecture, the compiler is
responsible for mapping instructions to functional-units available on
the architecture. To that end, the compiler creates groups of instructions
called <i>packets</i> or <i>bundles</i>. The VLIW packetizer in LLVM is
a target-independent mechanism to enable the packetization of machine
instructions.</p>
<!-- _______________________________________________________________________ -->
<h4>
<a name="vliw_mapping">Mapping from instructions to functional units</a>
</h4>
<div>
<p>Instructions in a VLIW target can typically be mapped to multiple functional
units. During the process of packetizing, the compiler must be able to reason
about whether an instruction can be added to a packet. This decision can be
complex since the compiler has to examine all possible mappings of instructions
to functional units. Therefore to alleviate compilation-time complexity, the
VLIW packetizer parses the instruction classes of a target and generates tables
at compiler build time. These tables can then be queried by the provided
machine-independent API to determine if an instruction can be accommodated in a
packet.</p>
</div>
<!-- ======================================================================= -->
<h4>
<a name="vliw_repr">
How the packetization tables are generated and used
</a>
</h4>
<div>
<p>The packetizer reads instruction classes from a target's itineraries and
creates a deterministic finite automaton (DFA) to represent the state of a
packet. A DFA consists of three major elements: inputs, states, and
transitions. The set of inputs for the generated DFA represents the instruction
being added to a packet. The states represent the possible consumption
of functional units by instructions in a packet. In the DFA, transitions from
one state to another occur on the addition of an instruction to an existing
packet. If there is a legal mapping of functional units to instructions, then
the DFA contains a corresponding transition. The absence of a transition
indicates that a legal mapping does not exist and that the instruction cannot
be added to the packet.</p>
<p>To generate tables for a VLIW target, add <i>Target</i>GenDFAPacketizer.inc
as a target to the Makefile in the target directory. The exported API provides
three functions: <tt>DFAPacketizer::clearResources()</tt>,
<tt>DFAPacketizer::reserveResources(MachineInstr *MI)</tt>, and
<tt>DFAPacketizer::canReserveResources(MachineInstr *MI)</tt>. These functions
allow a target packetizer to add an instruction to an existing packet and to
check whether an instruction can be added to a packet. See
<tt>llvm/CodeGen/DFAPacketizer.h</tt> for more information.</p>
</div>
</div>
</div>
<!-- *********************************************************************** -->
@ -2212,16 +2387,14 @@ is the key:</p>
<tr>
<th>Feature</th>
<th>ARM</th>
<th>Alpha</th>
<th>Blackfin</th>
<th>CellSPU</th>
<th>Hexagon</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>
@ -2229,16 +2402,14 @@ is the key:</p>
<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="yes"></td> <!-- Hexagon -->
<td class="no"></td> <!-- MBlaze -->
<td class="unknown"></td> <!-- MSP430 -->
<td class="no"></td> <!-- Mips -->
<td class="yes"></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>
@ -2246,16 +2417,14 @@ is the key:</p>
<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="no"></td> <!-- Hexagon -->
<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>
@ -2263,16 +2432,14 @@ is the key:</p>
<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="no"></td> <!-- Hexagon -->
<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>
@ -2280,16 +2447,14 @@ is the key:</p>
<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> <!-- Hexagon -->
<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"></td> <!-- X86 -->
<td class="unknown"></td> <!-- XCore -->
</tr>
@ -2297,16 +2462,14 @@ is the key:</p>
<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> <!-- Hexagon -->
<td class="no"></td> <!-- MBlaze -->
<td class="unknown"></td> <!-- MSP430 -->
<td class="no"></td> <!-- Mips -->
<td class="yes"></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>
@ -2314,16 +2477,14 @@ is the key:</p>
<tr>
<td><a href="#feat_objectwrite">.o&nbsp;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="no"></td> <!-- Hexagon -->
<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>
@ -2331,20 +2492,33 @@ is the key:</p>
<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="yes"></td> <!-- Hexagon -->
<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_segstacks">segmented stacks</a></td>
<td class="no"></td> <!-- ARM -->
<td class="no"></td> <!-- CellSPU -->
<td class="no"></td> <!-- Hexagon -->
<td class="no"></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="partial"><a href="#feat_segstacks_x86">*</a></td> <!-- X86 -->
<td class="no"></td> <!-- XCore -->
</tr>
</table>
@ -2428,6 +2602,22 @@ more more details</a>.</p>
</div>
<!-- _______________________________________________________________________ -->
<h4 id="feat_segstacks">Segmented Stacks</h4>
<div>
<p>This box indicates whether the target supports segmented stacks. This
replaces the traditional large C stack with many linked segments. It
is compatible with the <a href="http://gcc.gnu.org/wiki/SplitStacks">gcc
implementation</a> used by the Go front end.</p>
<p id="feat_segstacks_x86">Basic support exists on the X86 backend. Currently
vararg doesn't work and the object files are not marked the way the gold
linker expects, but simple Go programs can be built by dragonegg.</p>
</div>
</div>
<!-- ======================================================================= -->
@ -2992,7 +3182,7 @@ MOVSX32rm16 -&gt; 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: 2011-11-03 07:43:54 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2012-03-27 13:25:16 +0200 (Tue, 27 Mar 2012) $
</address>
</body>

View File

@ -31,6 +31,7 @@
Errors</a></li>
<li><a href="#ci_portable_code">Write Portable Code</a></li>
<li><a href="#ci_rtti_exceptions">Do not use RTTI or Exceptions</a></li>
<li><a href="#ci_static_ctors">Do not use Static Constructors</a></li>
<li><a href="#ci_class_struct">Use of <tt>class</tt>/<tt>struct</tt> Keywords</a></li>
</ol></li>
</ol></li>
@ -84,17 +85,16 @@
<!-- *********************************************************************** -->
<h2>
<a name="introduction">Introduction</a>
</h2>
<h2><a name="introduction">Introduction</a></h2>
<!-- *********************************************************************** -->
<div>
<p>This document attempts to describe a few coding standards that are being used
in the LLVM source tree. Although no coding standards should be regarded as
absolute requirements to be followed in all instances, coding standards can be
useful.</p>
absolute requirements to be followed in all instances, coding standards are
particularly important for large-scale code bases that follow a library-based
design (like LLVM).</p>
<p>This document intentionally does not prescribe fixed standards for religious
issues such as brace placement and space usage. For issues like this, follow
@ -102,14 +102,27 @@ the golden rule:</p>
<blockquote>
<p><b><a name="goldenrule">If you are adding a significant body of source to a
project, feel free to use whatever style you are most comfortable with. If you
are extending, enhancing, or bug fixing already implemented code, use the style
that is already being used so that the source is uniform and easy to
follow.</a></b></p>
<p><b><a name="goldenrule">If you are extending, enhancing, or bug fixing
already implemented code, use the style that is already being used so that the
source is uniform and easy to follow.</a></b></p>
</blockquote>
<p>Note that some code bases (e.g. libc++) have really good reasons to deviate
from the coding standards. In the case of libc++, this is because the naming
and other conventions are dictated by the C++ standard. If you think there is
a specific good reason to deviate from the standards here, please bring it up
on the LLVMdev mailing list.</p>
<p>There are some conventions that are not uniformly followed in the code base
(e.g. the naming convention). This is because they are relatively new, and a
lot of code was written before they were put in place. Our long term goal is
for the entire codebase to follow the convention, but we explicitly <em>do
not</em> want patches that do large-scale reformating of existing code. OTOH,
it is reasonable to rename the methods of a class if you're about to change it
in some other way. Just do the reformating as a separate commit from the
functionality change. </p>
<p>The ultimate goal of these guidelines is the increase readability and
maintainability of our common source base. If you have suggestions for topics to
be included, please mail them to <a
@ -140,11 +153,11 @@ href="mailto:sabre@nondot.org">Chris</a>.</p>
<div>
<p>Comments are one critical part of readability and maintainability. Everyone
knows they should comment, so should you. When writing comments, write them as
English prose, which means they should use proper capitalization, punctuation,
etc. Although we all should probably
comment our code more than we do, there are a few very critical places that
documentation is very useful:</p>
knows they should comment their code, and so should you. When writing comments,
write them as English prose, which means they should use proper capitalization,
punctuation, etc. Aim to describe what a code is trying to do and why, not
"how" it does it at a micro level. Here are a few critical things to
document:</p>
<h5>File Headers</h5>
@ -152,9 +165,7 @@ documentation is very useful:</p>
<p>Every source file should have a header on it that describes the basic
purpose of the file. If a file does not have a header, it should not be
checked into Subversion. Most source trees will probably have a standard
file header format. The standard format for the LLVM source tree looks like
this:</p>
checked into the tree. The standard header looks like this:</p>
<div class="doc_code">
<pre>
@ -197,9 +208,8 @@ included, as well as any notes or "gotchas" in the code to watch out for.</p>
<p>Classes are one fundamental part of a good object oriented design. As such,
a class definition should have a comment block that explains what the class is
used for... if it's not obvious. If it's so completely obvious your grandma
could figure it out, it's probably safe to leave it out. Naming classes
something sane goes a long ways towards avoiding writing documentation.</p>
used for and how it works. Every non-trivial class is expected to have a
doxygen comment block.</p>
<h5>Method information</h5>
@ -210,8 +220,7 @@ something sane goes a long ways towards avoiding writing documentation.</p>
documented properly. A quick note about what it does and a description of the
borderline behaviour is all that is necessary here (unless something
particularly tricky or insidious is going on). The hope is that people can
figure out how to use your interfaces without reading the code itself... that is
the goal metric.</p>
figure out how to use your interfaces without reading the code itself.</p>
<p>Good things to talk about here are what happens when something unexpected
happens: does the method return null? Abort? Format your hard disk?</p>
@ -397,14 +406,6 @@ if ((V = getValue())) {
<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:</p>
<div class="doc_code">
<pre>
-Wall -Winline -W -Wwrite-strings -Wno-unused
</pre>
</div>
</div>
<!-- _______________________________________________________________________ -->
@ -447,6 +448,51 @@ than <tt>dynamic_cast&lt;&gt;</tt>.</p>
</div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="ci_static_ctors">Do not use Static Constructors</a>
</h4>
<div>
<p>Static constructors and destructors (e.g. global variables whose types have
a constructor or destructor) should not be added to the code base, and should be
removed wherever possible. Besides <a
href="http://yosefk.com/c++fqa/ctors.html#fqa-10.12">well known problems</a>
where the order of initialization is undefined between globals in different
source files, the entire concept of static constructors is at odds with the
common use case of LLVM as a library linked into a larger application.</p>
<p>Consider the use of LLVM as a JIT linked into another application (perhaps
for <a href="http://llvm.org/Users.html">OpenGL, custom languages</a>,
<a href="http://llvm.org/devmtg/2010-11/Gritz-OpenShadingLang.pdf">shaders in
movies</a>, etc). Due to the design of static constructors, they must be
executed at startup time of the entire application, regardless of whether or
how LLVM is used in that larger application. There are two problems with
this:</p>
<ol>
<li>The time to run the static constructors impacts startup time of
applications &mdash; a critical time for GUI apps, among others.</li>
<li>The static constructors cause the app to pull many extra pages of memory
off the disk: both the code for the constructor in each <tt>.o</tt> file and
the small amount of data that gets touched. In addition, touched/dirty pages
put more pressure on the VM system on low-memory machines.</li>
</ol>
<p>We would really like for there to be zero cost for linking in an additional
LLVM target or other library into an application, but static constructors
violate this goal.</p>
<p>That said, LLVM unfortunately does contain static constructors. It would be
a <a href="http://llvm.org/PR11944">great project</a> for someone to purge all
static constructors from LLVM, and then enable the
<tt>-Wglobal-constructors</tt> warning flag (when building with Clang) to ensure
we do not regress in the future.
</p>
</div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="ci_class_struct">Use of <tt>class</tt> and <tt>struct</tt> Keywords</a>
@ -1151,22 +1197,10 @@ prefer it.</p>
<div>
<p>The use of <tt>#include &lt;iostream&gt;</tt> in library files is
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 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
&mdash; 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
put more pressure on the VM system on low-memory machines.</li>
</ol>
hereby <b><em>forbidden</em></b>, because many common implementations
transparently inject a <a href="#ci_static_ctors">static constructor</a> into
every translation unit that includes it.</p>
<p>Note that using the other stream headers (<tt>&lt;sstream&gt;</tt> for
example) is not problematic in this regard &mdash;
just <tt>&lt;iostream&gt;</tt>. However, <tt>raw_ostream</tt> provides various
@ -1527,7 +1561,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: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2012-03-27 13:25:16 +0200 (Tue, 27 Mar 2012) $
</address>
</body>

View File

@ -49,7 +49,7 @@ MAN := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_MAN_DIR)%.1, $(POD))
PS := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_PS_DIR)%.ps, $(POD))
# The set of man pages we will not install
NO_INSTALL_MANS = $(DST_MAN_DIR)FileCheck.1
NO_INSTALL_MANS = $(DST_MAN_DIR)FileCheck.1 $(DST_MAN_DIR)llvm-build.1
# The set of man pages that we will install
INSTALL_MANS = $(filter-out $(NO_INSTALL_MANS), $(MAN))

View File

@ -72,6 +72,12 @@ options) arguments to the tool you are interested in.</p>
<li><a href="/cmds/llvm-diff.html"><b>llvm-diff</b></a> -
structurally compare two modules</li>
<li><a href="/cmds/llvm-cov.html"><b>llvm-cov</b></a> -
emit coverage information</li>
<li><a href="/cmds/llvm-stress.html"><b>llvm-stress</b></a> -
generate random .ll files to fuzz different llvm components</li>
</ul>
</div>
@ -129,7 +135,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: 2011-09-20 20:24:04 +0200 (Tue, 20 Sep 2011) $
Last modified: $Date: 2012-02-26 09:35:53 +0100 (Sun, 26 Feb 2012) $
</address>
</body>

View File

@ -28,7 +28,7 @@ By default B<lit> will use a succinct progress display and will only print
summary information for test failures. See L<"OUTPUT OPTIONS"> for options
controlling the B<lit> progress display and output.
B<lit> also includes a number of options for controlling how tests are exected
B<lit> also includes a number of options for controlling how tests are executed
(specific features may depend on the particular test format). See L<"EXECUTION
OPTIONS"> for more information.
@ -37,7 +37,7 @@ the options specified on the command line, see L<"SELECTION OPTIONS"> for
more information.
Users interested in the B<lit> architecture or designing a B<lit> testing
implementation should see L<"LIT ARCHITECTURE">
implementation should see L<"LIT INFRASTRUCTURE">
=head1 GENERAL OPTIONS
@ -159,8 +159,8 @@ other results are not collated in any reasonable fashion.
=head1 EXIT STATUS
B<lit> will exit with an exit code of 1 if there are any FAIL or XPASS
results. Otherwise, it will exit with the status 0. Other exit codes used for
non-test related failures (for example a user error or an internal program
results. Otherwise, it will exit with the status 0. Other exit codes are used
for non-test related failures (for example a user error or an internal program
error).
=head1 TEST DISCOVERY
@ -208,7 +208,7 @@ suite.
The test succeeded, but it was expected to fail. This is used for tests which
were specified as expected to fail, but are now succeeding (generally because
the feautre they test was broken and has been fixed).
the feature they test was broken and has been fixed).
=item B<FAIL>
@ -227,7 +227,7 @@ which can report unsupported tests.
=back
Depending on the test format tests may produce additional information about
their status (generally only for failures). See the L<Output|"LIT OUTPUT">
their status (generally only for failures). See the L<Output|"OUTPUT OPTIONS">
section for more information.
=head1 LIT INFRASTRUCTURE
@ -247,7 +247,7 @@ suite>. Test suites serve to define the format of the tests they contain, the
logic for finding those tests, and any additional information to run the tests.
B<lit> identifies test suites as directories containing I<lit.cfg> or
I<lit.site.cfg> files (see also B<--config-prefix>. Test suites are initially
I<lit.site.cfg> files (see also B<--config-prefix>). Test suites are initially
discovered by recursively searching up the directory hierarchy for all the input
files passed on the command line. You can use B<--show-suites> to display the
discovered test suites at startup.
@ -283,13 +283,13 @@ builds this is the directory that will be scanned for tests.
B<test_exec_root> For out-of-dir builds, the path to the test suite root inside
the object directory. This is where tests will be run and temporary output files
places.
placed.
B<environment> A dictionary representing the environment to use when executing
tests in the suite.
B<suffixes> For B<lit> test formats which scan directories for tests, this
variable as a list of suffixes to identify test files. Used by: I<ShTest>,
variable is a list of suffixes to identify test files. Used by: I<ShTest>,
I<TclTest>.
B<substitutions> For B<lit> test formats which substitute variables into a test
@ -301,6 +301,9 @@ reported as unsupported. Used by: I<ShTest>, I<TclTest>.
B<parent> The parent configuration, this is the config object for the directory
containing the test suite, or None.
B<root> The root configuration. This is the top-most B<lit> configuration in
the project.
B<on_clone> The config is actually cloned for every subdirectory inside a test
suite, to allow local configuration on a per-directory basis. The I<on_clone>
variable can be set to a Python function which will be called whenever a
@ -315,7 +318,7 @@ directory being scanned.
Once test suites are located, B<lit> recursively traverses the source directory
(following I<test_src_root>) looking for tests. When B<lit> enters a
sub-directory, it first checks to see if a nest test suite is defined in that
sub-directory, it first checks to see if a nested test suite is defined in that
directory. If so, it loads that test suite recursively, otherwise it
instantiates a local test config for the directory (see L<"LOCAL CONFIGURATION
FILES">).
@ -338,6 +341,53 @@ define subdirectories of optional tests, or to change other configuration
parameters -- for example, to change the test format, or the suffixes which
identify test files.
=head2 TEST RUN OUTPUT FORMAT
The b<lit> output for a test run conforms to the following schema, in both short
and verbose modes (although in short mode no PASS lines will be shown). This
schema has been chosen to be relatively easy to reliably parse by a machine (for
example in buildbot log scraping), and for other tools to generate.
Each test result is expected to appear on a line that matches:
<result code>: <test name> (<progress info>)
where <result-code> is a standard test result such as PASS, FAIL, XFAIL, XPASS,
UNRESOLVED, or UNSUPPORTED. The performance result codes of IMPROVED and
REGRESSED are also allowed.
The <test name> field can consist of an arbitrary string containing no newline.
The <progress info> field can be used to report progress information such as
(1/300) or can be empty, but even when empty the parentheses are required.
Each test result may include additional (multiline) log information in the
following format.
<log delineator> TEST '(<test name>)' <trailing delineator>
... log message ...
<log delineator>
where <test name> should be the name of a preceeding reported test, <log
delineator> is a string of '*' characters I<at least> four characters long (the
recommended length is 20), and <trailing delineator> is an arbitrary (unparsed)
string.
The following is an example of a test run output which consists of four tests A,
B, C, and D, and a log message for the failing test C.
=head3 Example Test Run Output Listing
PASS: A (1 of 4)
PASS: B (2 of 4)
FAIL: C (3 of 4)
******************** TEST 'C' FAILED ********************
Test 'C' failed as a result of exit code 1.
********************
PASS: D (4 of 4)
=back
=head2 LIT EXAMPLE TESTS
The B<lit> distribution contains several example implementations of test suites

View File

@ -45,7 +45,7 @@ Print a summary of command line options.
=item B<-O>=I<uint>
Generate code at different optimization levels. These correspond to the I<-O0>,
I<-O1>, I<-O2>, I<-O3>, and I<-O4> optimization levels used by B<llvm-gcc> and
I<-O1>, I<-O2>, and I<-O3> optimization levels used by B<llvm-gcc> and
B<clang>.
=item B<-mtriple>=I<target triple>

View File

@ -0,0 +1,86 @@
=pod
=head1 NAME
llvm-build - LLVM Project Build Utility
=head1 SYNOPSIS
B<llvm-build> [I<options>]
=head1 DESCRIPTION
B<llvm-build> is a tool for working with LLVM projects that use the LLVMBuild
system for describing their components.
At heart, B<llvm-build> is responsible for loading, verifying, and manipulating
the project's component data. The tool is primarily designed for use in
implementing build systems and tools which need access to the project structure
information.
=head1 OPTIONS
=over
=item B<-h>, B<--help>
Print the builtin program help.
=item B<--source-root>=I<PATH>
If given, load the project at the given source root path. If this option is not
given, the location of the project sources will be inferred from the location of
the B<llvm-build> script itself.
=item B<--print-tree>
Print the component tree for the project.
=item B<--write-library-table>
Write out the C++ fragment which defines the components, library names, and
required libraries. This C++ fragment is built into L<llvm-config|llvm-config>
in order to provide clients with the list of required libraries for arbitrary
component combinations.
=item B<--write-llvmbuild>
Write out new I<LLVMBuild.txt> files based on the loaded components. This is
useful for auto-upgrading the schema of the files. B<llvm-build> will try to a
limited extent to preserve the comments which were written in the original
source file, although at this time it only preserves block comments that preceed
the section names in the I<LLVMBuild> files.
=item B<--write-cmake-fragment>
Write out the LLVMBuild in the form of a CMake fragment, so it can easily be
consumed by the CMake based build system. The exact contents and format of this
file are closely tied to how LLVMBuild is integrated with CMake, see LLVM's
top-level CMakeLists.txt.
=item B<--write-make-fragment>
Write out the LLVMBuild in the form of a Makefile fragment, so it can easily be
consumed by a Make based build system. The exact contents and format of this
file are closely tied to how LLVMBuild is integrated with the Makefiles, see
LLVM's Makefile.rules.
=item B<--llvmbuild-source-root>=I<PATH>
If given, expect the I<LLVMBuild> files for the project to be rooted at the
given path, instead of inside the source tree itself. This option is primarily
designed for use in conjunction with B<--write-llvmbuild> to test changes to
I<LLVMBuild> schema.
=back
=head1 EXIT STATUS
B<llvm-build> exits with 0 if operation was successful. Otherwise, it will exist
with a non-zero value.
=head1 AUTHOR
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -0,0 +1,45 @@
=pod
=head1 NAME
llvm-cov - emit coverage information
=head1 SYNOPSIS
B<llvm-cov> [-gcno=filename] [-gcda=filename] [dump]
=head1 DESCRIPTION
The experimental B<llvm-cov> tool reads in description file generated by compiler
and coverage data file generated by instrumented program. This program assumes
that the description and data file uses same format as gcov files.
=head1 OPTIONS
=over
=item B<-gcno=filename]
This option selects input description file generated by compiler while instrumenting
program.
=item B<-gcda=filename]
This option selects coverage data file generated by instrumented compiler.
=item B<-dump>
This options enables output dump that is suitable for a developer to help debug
B<llvm-cov> itself.
=back
=head1 EXIT STATUS
B<llvm-cov> returns 1 if it cannot read input files. Otherwise, it exits with zero.
=head1 AUTHOR
B<llvm-cov> is maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -0,0 +1,42 @@
=pod
=head1 NAME
llvm-stress - generate random .ll files
=head1 SYNOPSIS
B<llvm-cov> [-gcno=filename] [-gcda=filename] [dump]
=head1 DESCRIPTION
The B<llvm-stress> tool is used to generate random .ll files that can be used to
test different components of LLVM.
=head1 OPTIONS
=over
=item B<-o> I<filename>
Specify the output filename.
=item B<-size> I<size>
Specify the size of the generated .ll file.
=item B<-seed> I<seed>
Specify the seed to be used for the randomly generated instructions.
=back
=head1 EXIT STATUS
B<llvm-stress> returns 0.
=head1 AUTHOR
B<llvm-stress> is maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -41,6 +41,10 @@ Specify where to find other target description files for inclusion. The
F<directory> value should be a full or partial path to a directory that contains
target description files.
=item B<-asmparsernum> F<N>
Make -gen-asm-parser emit assembly writer number F<N>.
=item B<-asmwriternum> F<N>
Make -gen-asm-writer emit assembly writer number F<N>.
@ -57,27 +61,19 @@ Print all records to standard output (default).
Print enumeration values for a class
=item B<-print-sets>
Print expanded sets for testing DAG exprs.
=item B<-gen-emitter>
Generate machine code emitter.
=item B<-gen-register-enums>
=item B<-gen-register-info>
Generate the enumeration values for all registers.
Generate registers and register classes info.
=item B<-gen-register-desc>
Generate a register info description for each register.
=item B<-gen-register-desc-header>
Generate a register info description header for each register.
=item B<-gen-instr-enums>
Generate enumeration values for instructions.
=item B<-gen-instr-desc>
=item B<-gen-instr-info>
Generate instruction descriptions.
@ -85,10 +81,30 @@ Generate instruction descriptions.
Generate the assembly writer.
=item B<-gen-disassembler>
Generate disassembler.
=item B<-gen-pseudo-lowering>
Generate pseudo instruction lowering.
=item B<-gen-dag-isel>
Generate a DAG (Directed Acycle Graph) instruction selector.
=item B<-gen-asm-matcher>
Generate assembly instruction matcher.
=item B<-gen-dfa-packetizer>
Generate DFA Packetizer for VLIW targets.
=item B<-gen-fast-isel>
Generate a "fast" instruction selector.
=item B<-gen-subtarget>
Generate subtarget enumerations.
@ -97,6 +113,14 @@ Generate subtarget enumerations.
Generate intrinsic information.
=item B<-gen-tgt-intrinsic>
Generate target intrinsic information.
=item B<-gen-enhanced-disassembly-info>
Generate enhanced disassembly info.
=item B<-version>
Show the version number of this program.

View File

@ -21,7 +21,6 @@
<ol>
<li><a href="#hw">Hardware</a>
<ol>
<li><a href="#alpha">Alpha</a></li>
<li><a href="#arm">ARM</a></li>
<li><a href="#ia64">Itanium</a></li>
<li><a href="#mips">MIPS</a></li>
@ -48,17 +47,6 @@
<div>
<!-- ======================================================================= -->
<h3><a name="alpha">Alpha</a></h3>
<div>
<ul>
<li><a
href="http://ftp.digital.com/pub/Digital/info/semiconductor/literature/dsc-library.html">Alpha manuals</a>
</li>
</ul>
</div>
<!-- ======================================================================= -->
<h3><a name="arm">ARM</a></h3>
@ -272,7 +260,7 @@ processors.</li>
<a href="http://misha.brukman.net">Misha Brukman</a><br>
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
Last modified: $Date: 2011-10-28 00:56:32 +0200 (Fri, 28 Oct 2011) $
</address>
</body>

View File

@ -147,7 +147,7 @@ coordinate with GDB to get better debug information.
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
<a href="mailto:reid.kleckner@gmail.com">Reid Kleckner</a><br>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2011-10-31 12:21:59 +0100 (Mon, 31 Oct 2011) $
</address>
</body>
</html>

View File

@ -43,7 +43,7 @@
the distributed nature of LLVM's development. By stating the policy in clear
terms, we hope each developer can know ahead of time what to expect when
making LLVM contributions. This policy covers all llvm.org subprojects,
including Clang, LLDB, etc.</p>
including Clang, LLDB, libc++, etc.</p>
<p>This policy is also designed to accomplish the following objectives:</p>
<ol>
@ -52,6 +52,9 @@
<li>Make life as simple and easy for contributors as possible.</li>
<li>Keep the top of Subversion trees as stable as possible.</li>
<li>Establish awareness of the project's <a href="#clp">copyright,
license, and patent policies</a> with contributors to the project.</li>
</ol>
<p>This policy is aimed at frequent contributors to LLVM. People interested in
@ -212,6 +215,10 @@
<li><b>Jakob Olesen</b>: Register allocators and TableGen.</li>
<li><b>Duncan Sands</b>: dragonegg and llvm-gcc 4.2.</li>
<li><b>Peter Collingbourne</b>: libclc.</li>
<li><b>Tobias Grosser</b>: polly.</li>
</ol>
<p>Note that code ownership is completely different than reviewers: anyone can
@ -495,19 +502,25 @@
<!--=========================================================================-->
<div>
<p>This section addresses the issues of copyright, license and patents for the
LLVM project. The copyright holder for the code is held by the individual
contributors of the code and the terms of its license to LLVM users and
developers is the
<a href="http://www.opensource.org/licenses/UoI-NCSA.php">University of
Illinois/NCSA Open Source License</a>.</p>
<div class="doc_notes">
<p style="text-align:center;font-weight:bold">NOTE: This section deals with
legal matters but does not provide legal advice. We are not lawyers, please
seek legal counsel from an attorney.</p>
legal matters but does not provide legal advice. We are not lawyers &mdash;
please seek legal counsel from an attorney.</p>
</div>
<div>
<p>This section addresses the issues of copyright, license and patents for the
LLVM project. The copyright for the code is held by the individual
contributors of the code and the terms of its license to LLVM users and
developers is the
<a href="http://www.opensource.org/licenses/UoI-NCSA.php">University of
Illinois/NCSA Open Source License</a> (with portions dual licensed under the
<a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a>,
see below). As contributor to the LLVM project, you agree to allow any
contributions to the project to licensed under these terms.</p>
<!-- _______________________________________________________________________ -->
<h3><a name="copyright">Copyright</a></h3>
<div>
@ -535,7 +548,10 @@
<h3><a name="license">License</a></h3>
<div>
<p>We intend to keep LLVM perpetually open source and to use a liberal open
source license. All of the code in LLVM is available under the
source license. <b>As a contributor to the project, you agree that any
contributions be licensed under the terms of the corresponding
subproject.</b>
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>
@ -556,7 +572,7 @@
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
(<b>compiler_rt, libc++, and libclc</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
@ -570,16 +586,17 @@
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>
<p>Note that the LLVM Project does distribute llvm-gcc and dragonegg, <b>which
are 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
implies that <b>any code linked into llvm-gcc and distributed to others may
be subject to the viral aspects of the GPL</b> (for example, a proprietary
code generator linked into llvm-gcc must be made available under the GPL).
This is not a problem for code already distributed under a more liberal
license (like the UIUC license), and does not affect code generated by
llvm-gcc. It may be a problem if you intend to base commercial development
on llvm-gcc without redistributing your source code.</p>
license (like the UIUC license), and GPL-containing subprojects are kept
in separate SVN repositories whose LICENSE.txt files specifically indicate
that they contain GPL code.</p>
<p>We have no plans to change the license of LLVM. If you have questions or
comments about the license, please contact the
@ -596,7 +613,8 @@
arbitrary purposes (including commercial use).</p>
<p>When contributing code, we expect contributors to notify us of any potential
for patent-related trouble with their changes. If you or your employer own
for patent-related trouble with their changes (including from third parties).
If you or your employer own
the rights to a patent and would like to contribute code to LLVM that relies
on it, we require that the copyright owner sign an agreement that allows any
other user of LLVM to freely use your patent. Please contact
@ -606,6 +624,8 @@
</div>
</div>
<!-- *********************************************************************** -->
<hr>
<address>
@ -616,7 +636,7 @@
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: 2011-10-07 19:26:38 +0200 (Fri, 07 Oct 2011) $
Last modified: $Date: 2012-03-27 13:25:16 +0200 (Tue, 27 Mar 2012) $
</address>
</body>
</html>

View File

@ -38,7 +38,6 @@
<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>
@ -50,7 +49,7 @@
</tr></table>
<div class="doc_author">
<p>Written by <a href="mailto:jlaskey@mac.com">Jim Laskey</a></p>
<p>Written by the <a href="http://llvm.org/">LLVM Team</a></p>
</div>
@ -498,23 +497,6 @@
</div>
<!-- ======================================================================= -->
<h4>
<a name="llvm_eh_sjlj_dispatchsetup">llvm.eh.sjlj.dispatchsetup</a>
</h4>
<div>
<pre>
void @llvm.eh.sjlj.dispatchsetup(i32 %dispatch_value)
</pre>
<p>For SJLJ based exception handling, the <tt>llvm.eh.sjlj.dispatchsetup</tt>
intrinsic is used by targets to do any unwind edge setup they need. By
default, no action is taken.</p>
</div>
</div>
<!-- ======================================================================= -->
@ -573,9 +555,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="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-09-27 22:16:57 +0200 (Tue, 27 Sep 2011) $
Last modified: $Date: 2012-03-27 13:25:16 +0200 (Tue, 27 Mar 2012) $
</address>
</body>

View File

@ -105,19 +105,6 @@ function and then be turned into an instruction if warranted.</p>
support for it. Generally you must do the following steps:</p>
<dl>
<dt>Add support to the C backend in <tt>lib/Target/CBackend/</tt></dt>
<dd>Depending on the intrinsic, there are a few ways to implement this. For
most intrinsics, it makes sense to add code to lower your intrinsic in
<tt>LowerIntrinsicCall</tt> in <tt>lib/CodeGen/IntrinsicLowering.cpp</tt>.
Second, if it makes sense to lower the intrinsic to an expanded sequence of
C code in all cases, just emit the expansion in <tt>visitCallInst</tt> in
<tt>Writer.cpp</tt>. If the intrinsic has some way to express it with GCC
(or any other compiler) extensions, it can be conditionally supported based
on the compiler compiling the CBE output (see <tt>llvm.prefetch</tt> for an
example). Third, if the intrinsic really has no way to be lowered, just
have the code generator emit code that prints an error message and calls
abort if executed.</dd>
<dt>Add support to the .td file for the target(s) of your choice in
<tt>lib/Target/*/*.td</tt>.</dt>
@ -385,7 +372,7 @@ void calcTypeName(const Type *Ty,
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a>
<br>
Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2012-03-23 06:50:46 +0100 (Fri, 23 Mar 2012) $
</address>
</body>

View File

@ -140,6 +140,8 @@
</h2>
<!-- *********************************************************************** -->
<div>
<div class="question">
<p>Why are the LLVM source code and the front-end distributed under different
licenses?</p>
@ -185,12 +187,16 @@
GPL, as explained in the first question above.</p>
</div>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="source">Source Code</a>
</h2>
<!-- *********************************************************************** -->
<div>
<div class="question">
<p>In what language is LLVM written?</p>
</div>
@ -223,12 +229,16 @@ LLVM have been ported to a plethora of platforms.</p>
</div>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="build">Build Problems</a>
</h2>
<!-- *********************************************************************** -->
<div>
<div class="question">
<p>When I run configure, it finds the wrong C compiler.</p>
</div>
@ -435,11 +445,15 @@ Stop.
<p>We regret the inconvenience.</p>
</div>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="felangs">Source Languages</a>
</h2>
<div>
<div class="question">
<p><a name="langs">What source languages are supported?</a></p>
</div>
@ -540,11 +554,15 @@ Stop.
Instruction</a>.</p>
</div>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="cfe">Using the GCC Front End</a>
</h2>
<div>
<div class="question">
<p>When I compile software that uses a configure script, the configure script
thinks my system has all of the header files and libraries it is testing for.
@ -697,11 +715,15 @@ Stop.
order to have the result conform to the platform ABI.</p>
</div>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="cfe_code">Questions about code generated by the GCC front-end</a>
</h2>
<div>
<div class="question">
<p><a name="iosinit">What is this <tt>llvm.global_ctors</tt> and
<tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I <tt>#include
@ -907,6 +929,8 @@ F.i:
</div>
</div>
<!-- *********************************************************************** -->
<hr>
@ -917,7 +941,7 @@ F.i:
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: 2011-09-20 02:42:28 +0200 (Tue, 20 Sep 2011) $
Last modified: $Date: 2012-03-27 13:25:16 +0200 (Tue, 27 Mar 2012) $
</address>
</body>

View File

@ -429,7 +429,8 @@ programs that use different garbage collection algorithms (or none at all).</p>
<p>The <tt>llvm.gcroot</tt> intrinsic is used to inform LLVM that a stack
variable references an object on the heap and is to be tracked for garbage
collection. The exact impact on generated code is specified by a <a
href="#plugin">compiler plugin</a>.</p>
href="#plugin">compiler plugin</a>. All calls to <tt>llvm.gcroot</tt> <b>must</b> reside
inside the first basic block.</p>
<p>A compiler which uses mem2reg to raise imperative code using <tt>alloca</tt>
into SSA form need only add a call to <tt>@llvm.gcroot</tt> for those variables
@ -437,7 +438,9 @@ which a pointers into the GC heap.</p>
<p>It is also important to mark intermediate values with <tt>llvm.gcroot</tt>.
For example, consider <tt>h(f(), g())</tt>. Beware leaking the result of
<tt>f()</tt> in the case that <tt>g()</tt> triggers a collection.</p>
<tt>f()</tt> in the case that <tt>g()</tt> triggers a collection. Note, that
stack variables must be initialized and marked with <tt>llvm.gcroot</tt> in
function's prologue.</p>
<p>The first argument <b>must</b> be a value referring to an alloca instruction
or a bitcast of an alloca. The second contains a pointer to metadata that
@ -1379,7 +1382,7 @@ Fergus Henderson. International Symposium on Memory Management 2002.</p>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-08-12 08:17:17 +0200 (Fri, 12 Aug 2011) $
Last modified: $Date: 2012-03-03 05:32:33 +0100 (Sat, 03 Mar 2012) $
</address>
</body>

View File

@ -594,10 +594,10 @@ idx3 = (char*) &amp;MyVar + 8
because LLVM has no restrictions on mixing types in addressing, loads or
stores.</p>
<p>It would be possible to add special annotations to the IR, probably using
metadata, to describe a different type system (such as the C type system),
and do type-based aliasing on top of that. This is a much bigger
undertaking though.</p>
<p>LLVM's type-based alias analysis pass uses metadata to describe a different
type system (such as the C type system), and performs type-based aliasing
on top of that. Further details are in the
<a href="LangRef.html#tbaa">language reference</a>.</p>
</div>
@ -747,7 +747,7 @@ idx3 = (char*) &amp;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: 2011-11-03 07:43:54 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2011-10-31 14:04:26 +0100 (Mon, 31 Oct 2011) $
</address>
</body>
</html>

View File

@ -29,7 +29,6 @@
<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>
<li><a href="#cross-compile">Cross-Compiling LLVM</a></li>
@ -52,7 +51,7 @@
<li><a href="#tutorial">An Example Using the LLVM Tool Chain</a>
<ol>
<li><a href="#tutorial4">Example with llvm-gcc4</a></li>
<li><a href="#tutorial4">Example with Clang</a></li>
</ol>
<li><a href="#problems">Common Problems</a>
<li><a href="#links">Links</a>
@ -82,16 +81,15 @@ basic information.</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>
needed to use LLVM. 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 Clang 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
end uses the GCC parser to convert code to LLVM. Once
compiled into LLVM bitcode, a program can be manipulated with the LLVM tools
from the LLVM suite.</p>
<p>The second piece is the <a href="http://clang.llvm.org/">Clang</a> front end.
This component compiles C, C++, Objective C, and Objective C++ code into LLVM
bitcode. Once 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 Test Suite. It is a suite of programs
@ -109,83 +107,98 @@ and performance.
<div>
<p>The LLVM Getting Started documentation may be out of date. So, the Clang
<a href="http://clang.llvm.org/get_started.html">Getting Started</a> page might
also be a good place to start.</p>
<p>Here's the short story for getting up and running quickly with LLVM:</p>
<ol>
<li>Read the documentation.</li>
<li>Read the documentation.</li>
<li>Remember that you were warned twice about reading the documentation.</li>
<li>Install the llvm-gcc-4.2 front end if you intend to compile C or C++
(see <a href="#installcf">Install the GCC Front End</a> for details):
<ol>
<li><tt>cd <i>where-you-want-the-C-front-end-to-live</i></tt></li>
<li><tt>gunzip --stdout llvm-gcc-4.2-<i>version</i>-<i>platform</i>.tar.gz | tar -xvf -</tt></li>
<li><tt><i>install-binutils-binary-from-MinGW</i></tt> (Windows only)</li>
<li>Note: If the binary extension is "<tt>.bz</tt>" use <tt>bunzip2</tt> instead of <tt>gunzip</tt>.</li>
<li>Note: On Windows, use <a href="http://www.7-zip.org/">7-Zip</a> or a similar archiving tool.</li>
<li>Add <tt>llvm-gcc</tt>'s "<tt>bin</tt>" directory to your <tt>PATH</tt> environment variable.</li>
</ol></li>
<li>Get the LLVM Source Code
<li>Checkout LLVM:
<ul>
<li>With the distributed files (or use <a href="#checkout">SVN</a>):
<ol>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>gunzip --stdout llvm-<i>version</i>.tar.gz | tar -xvf -</tt>
</ol></li>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
</ul>
</li>
</ul></li>
<li><b>[Optional]</b> Get the Test Suite Source Code
<li>Checkout Clang:
<ul>
<li>With the distributed files (or use <a href="#checkout">SVN</a>):
<ol>
<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>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>cd llvm/tools</tt>
<li><tt>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
</ul>
</li>
</ul></li>
<li>Checkout Compiler-RT:
<ul>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>cd llvm/projects</tt>
<li><tt>svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk
compiler-rt</tt></li>
</ul>
</li>
<li>Get the Test Suite Source Code <b>[Optional]</b>
<ul>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>cd llvm/projects</tt>
<li><tt>svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite</tt></li>
</ul>
</li>
<li>Configure the LLVM Build Environment
<ol>
<li>Configure and build LLVM and Clang:
<ul>
<li><tt>cd <i>where-you-want-to-build-llvm</i></tt></li>
<li><tt><i>/path/to/llvm/</i>configure [options]</tt><br>
Some common options:
<li><tt>mkdir build</tt> (for building without polluting the source dir)</li>
<li><tt>cd build</tt></li>
<li><tt>../llvm/configure [options]</tt>
<br>Some common options:
<ul>
<li><tt>--prefix=<i>directory</i></tt>
<p>Specify for <i>directory</i> the full pathname of where you
<li><tt>--prefix=<i>directory</i></tt> -
Specify for <i>directory</i> the full pathname of where you
want the LLVM tools and libraries to be installed (default
<tt>/usr/local</tt>).</p></li>
<li><tt>--with-llvmgccdir=<i>directory</i></tt>
<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 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
<tt><i>directory</i></tt>.</p></li>
<tt>/usr/local</tt>).</li>
</ul>
</ol></li>
<li>Build the LLVM Suite:
<ol>
<li><tt>gmake -k |&amp; tee gnumake.out
&nbsp;&nbsp;&nbsp;# this is csh or tcsh syntax</tt></li>
<li>If you get an "internal compiler error (ICE)" or test failures, see
<a href="#brokengcc">below</a>.</li>
</ol>
<ul>
<li><tt>--enable-optimized</tt> -
Compile with optimizations enabled (default is NO).</li>
</ul>
<ul>
<li><tt>--enable-assertions</tt> -
Compile with assertion checks enabled (default is YES).</li>
</ul>
</li>
<li><tt>make [-j]</tt> - The -j specifies the number of jobs (commands) to
run simultaneously. This builds both LLVM and Clang for Debug+Asserts mode.
The --enabled-optimized configure option is used to specify a Release build.</li>
<li><tt>make check-all</tt> -
This run the regression tests to ensure everything is in working order.</li>
<li><tt>make update</tt> -
This command is used to update all the svn repositories at once, rather then
having to <tt>cd</tt> into the individual repositories and running
<tt>svn update</tt>.</li>
<li>It is also possible to use CMake instead of the makefiles. With CMake
it is also possible to generate project files for several IDEs: Eclipse
CDT4, CodeBlocks, Qt-Creator (use the CodeBlocks generator), KDevelop3.</li>
<li>If you get an "internal compiler error (ICE)" or test failures, see
<a href="#brokengcc">below</a>.</li>
</ul>
</li>
</ol>
<p>Consult the <a href="#starting">Getting Started with LLVM</a> section for
detailed information on configuring and compiling LLVM. See <a
href="#environment">Setting Up Your Environment</a> for tips that simplify
working with the GCC front end and LLVM tools. Go to <a href="#layout">Program
working with the Clang front end and LLVM tools. Go to <a href="#layout">Program
Layout</a> to learn about the layout of the source code tree.</p>
</div>
@ -283,7 +296,7 @@ software you will need.</p>
<tr>
<td>Windows</td>
<td>x86<sup><a href="#pf_1">1</a></sup></td>
<td>Visual Studio 2005 SP1 or higher<sup><a href="#pf_4">4</a>,<a href="#pf_5">5</a></sup></td>
<td>Visual Studio 2008 or higher<sup><a href="#pf_4">4</a>,<a href="#pf_5">5</a></sup></td>
<tr>
<td>AIX<sup><a href="#pf_3">3</a>,<a href="#pf_4">4</a></sup></td>
<td>PowerPC</td>
@ -361,10 +374,6 @@ able to assemble, disassemble, analyze, and optimize LLVM bitcode. Code
generation should work as well, although the generated native code may not work
on your platform.</p>
<p>The GCC front end is not very portable at the moment. If you want to get it
to work on another platform, you can download a copy of the source and <a
href="GCCFEBuildInstrs.html">try to compile it</a> on your platform.</p>
</div>
<!-- ======================================================================= -->
@ -430,7 +439,7 @@ href="GCCFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<tr>
<td><a href="http://www.perl.com/download.csp">perl</a></td>
<td>&ge;5.6.0</td>
<td>Nightly tester, utilities</td>
<td>Utilities</td>
</tr>
<tr>
@ -441,13 +450,13 @@ href="GCCFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<tr>
<td><a href="http://www.gnu.org/software/autoconf/">GNU Autoconf</a></td>
<td>2.61</td>
<td>2.60</td>
<td>Configuration script builder<sup><a href="#sf4">4</a></sup></td>
</tr>
<tr>
<td><a href="http://www.gnu.org/software/automake/">GNU Automake</a></td>
<td>1.10</td>
<td>1.9.6</td>
<td>aclocal macro generator<sup><a href="#sf4">4</a></sup></td>
</tr>
@ -471,8 +480,8 @@ href="GCCFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<li><a name="sf3">Only needed if you want to run the automated test
suite in the <tt>llvm/test</tt> directory.</a></li>
<li><a name="sf4">If you want to make changes to the configure scripts,
you will need GNU autoconf (2.61), and consequently, GNU M4 (version 1.4
or higher). You will also need automake (1.10). We only use aclocal
you will need GNU autoconf (2.60), and consequently, GNU M4 (version 1.4
or higher). You will also need automake (1.9.6). We only use aclocal
from that package.</a></li>
</ol>
</div>
@ -516,9 +525,8 @@ href="GCCFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<p>LLVM is very demanding of the host C++ compiler, and as such tends to expose
bugs in the compiler. In particular, several versions of GCC crash when trying
to compile LLVM. We routinely use GCC 3.3.3, 3.4.0, and Apple 4.0.1
successfully with them (however, see important notes below). Other versions
of GCC will probably work as well. GCC versions listed
to compile LLVM. We routinely use GCC 4.2 (and higher) or Clang.
Other versions of GCC will probably work as well. GCC versions listed
here are known to not work. If you are using one of these versions, please try
to upgrade your GCC to something more recent. If you run into a problem with a
version of GCC not listed here, please <a href="mailto:llvmdev@cs.uiuc.edu">let
@ -538,8 +546,7 @@ href="http://gcc.gnu.org/PR13392">serious bug</a> which causes it to crash in
the "<tt>convert_from_eh_region_ranges_1</tt>" GCC function.</p>
<p><b>Cygwin GCC 3.3.3</b>: The version of GCC 3.3.3 commonly shipped with
Cygwin does not work. Please <a href="GCCFEBuildInstrs.html#cygwin">upgrade
to a newer version</a> if possible.</p>
Cygwin does not work.</p>
<p><b>SuSE GCC 3.3.3</b>: The version of GCC 3.3.3 shipped with SuSE 9.1 (and
possibly others) does not compile LLVM correctly (it appears that exception
handling is broken in some cases). Please download the FSF 3.3.3 or upgrade
@ -651,12 +658,6 @@ All these paths are absolute:</p>
can be the same as SRC_ROOT).
<br><br>
<dt>LLVMGCCDIR
<dd>
This is where the LLVM GCC Front End is installed.
<p>
For the pre-built GCC front end binaries, the LLVMGCCDIR is
<tt>llvm-gcc/<i>platform</i>/llvm-gcc</tt>.
</dl>
</div>
@ -747,7 +748,6 @@ revision), you can checkout it from the '<tt>tags</tt>' directory (instead of
subdirectories of the '<tt>tags</tt>' directory:</p>
<ul>
<li>Release 3.0: <b>RELEASE_30/final</b></li>
<li>Release 2.9: <b>RELEASE_29/final</b></li>
<li>Release 2.8: <b>RELEASE_28</b></li>
<li>Release 2.7: <b>RELEASE_27</b></li>
@ -784,10 +784,6 @@ you get it from the Subversion repository:</p>
configured by the LLVM configure script as well as automatically updated when
you run <tt>svn update</tt>.</p>
<p>If you would like to get the GCC front end source code, you can also get it
and build it yourself. Please follow <a href="GCCFEBuildInstrs.html">these
instructions</a> to successfully get and build the LLVM GCC front-end.</p>
</div>
<!-- ======================================================================= -->
@ -891,6 +887,8 @@ Then, your .git/config should have [imap] sections.
folder = "[Gmail]/Drafts"
; example for Japanese, "Modified UTF-7" encoded.
folder = "[Gmail]/&amp;Tgtm+DBN-"
; example for Traditional Chinese
folder = "[Gmail]/&amp;g0l6Pw-"
</pre>
</div>
@ -949,76 +947,6 @@ git svn rebase -l
</div>
<!-- ======================================================================= -->
<h3>
<a name="installcf">Install the GCC Front End</a>
</h3>
<div>
<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-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>
<p>To install the GCC front end, do the following (on Windows, use an archival tool
like <a href="http://www.7-zip.org/">7-zip</a> that understands gzipped tars):</p>
<ol>
<li><tt>cd <i>where-you-want-the-front-end-to-live</i></tt></li>
<li><tt>gunzip --stdout llvm-gcc-4.2-<i>version</i>-<i>platform</i>.tar.gz | tar -xvf
-</tt></li>
</ol>
<p>Once the binary is uncompressed, if you're using a *nix-based system, add a symlink for
<tt>llvm-gcc</tt> and <tt>llvm-g++</tt> to some directory in your path. If you're using a
Windows-based system, add the <tt>bin</tt> subdirectory of your front end installation directory
to your <tt>PATH</tt> environment variable. For example, if you uncompressed the binary to
<tt>c:\llvm-gcc</tt>, add <tt>c:\llvm-gcc\bin</tt> to your <tt>PATH</tt>.</p>
<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 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
test-suite will pick it up.
</p>
<p>As a convenience for Windows users, the front end binaries for MinGW/x86 include
versions of the required w32api and mingw-runtime binaries. The last remaining step for
Windows users is to simply uncompress the binary binutils package from
<a href="http://mingw.org/">MinGW</a> into your front end installation directory. While the
front end installation steps are not quite the same as a typical manual MinGW installation,
they should be similar enough to those who have previously installed MinGW on Windows systems.</p>
<p>To install binutils on Windows:</p>
<ol>
<li><tt><i>download GNU Binutils from <a href="http://sourceforge.net/projects/mingw/files/">MinGW Downloads</a></i></tt></li>
<li><tt>cd <i>where-you-uncompressed-the-front-end</i></tt></li>
<li><tt><i>uncompress archived binutils directories (not the tar file) into the current directory</i></tt></li>
</ol>
<p>The binary versions of the LLVM GCC front end may not suit all of your needs. For
example, the binary distribution may include an old version of a system header
file, not "fix" a header file that needs to be fixed for GCC, or it may be linked with
libraries not available on your system. In cases like these, you may want to try
<a href="GCCFEBuildInstrs.html">building the GCC front end from source</a>. Thankfully,
this is much easier now than it was in the past.</p>
<p>We also do not currently support updating of the GCC front end by manually overlaying
newer versions of the w32api and mingw-runtime binary packages that may become available
from MinGW. At this time, it's best to think of the MinGW LLVM GCC front end binary as
a self-contained convenience package that requires Windows users to simply download and
uncompress the GNU Binutils binary package from the MinGW project.</p>
<p>Regardless of your platform, if you discover that installing the LLVM GCC front end
binaries is not as easy as previously described, or you would like to suggest improvements,
please let us know how you would like to see things improved by dropping us a note on our
<a href="http://llvm.org/docs/#maillist">mailing list</a>.</p>
</div>
<!-- ======================================================================= -->
<h3>
<a name="config">Local LLVM Configuration</a>
@ -1057,29 +985,6 @@ script to configure the build system:</p>
<p>The following options can be used to set or enable LLVM specific options:</p>
<dl>
<dt><i>--with-llvmgccdir</i></dt>
<dd>Path to the LLVM C/C++ FrontEnd to be used with this LLVM configuration.
The value of this option should specify the full pathname of the C/C++ Front
End to be used. If this option is not provided, the PATH will be searched for
a program named <i>llvm-gcc</i> and the C/C++ FrontEnd install directory will
be inferred from the path found. If the option is not given, and no llvm-gcc
can be found in the path then a warning will be produced by
<tt>configure</tt> indicating this situation. LLVM may still be built with
the <tt>tools-only</tt> target but attempting to build the runtime libraries
will fail as these libraries require llvm-gcc and llvm-g++. See
<a href="#installcf">Install the GCC Front End</a> for details on installing
the C/C++ Front End. See
<a href="GCCFEBuildInstrs.html">Bootstrapping the LLVM C/C++ Front-End</a>
for details on building the C/C++ Front End.</dd>
<dt><i>--with-tclinclude</i></dt>
<dd>Path to the tcl include directory under which <tt>tclsh</tt> can be
found. Use this if you have multiple tcl installations on your machine and you
want to use a specific one (8.x) for LLVM. LLVM only uses tcl for running the
dejagnu based test suite in <tt>llvm/test</tt>. If you don't specify this
option, the LLVM configure script will search for the tcl 8.4 and 8.3
releases.
<br><br>
</dd>
<dt><i>--enable-optimized</i></dt>
<dd>
Enables optimized compilation (debugging symbols are removed
@ -1110,7 +1015,7 @@ script to configure the build system:</p>
selected as the target of the build host. You can also specify a comma
separated list of target names that you want available in llc. The target
names use all lower case. The current set of targets is: <br>
<tt>alpha, ia64, powerpc, skeleton, sparc, x86</tt>.
<tt>arm, cbe, cpp, hexagon, mblaze, mips, mipsel, msp430, powerpc, ptx, sparc, spu, x86, x86_64, xcore</tt>.
<br><br></dd>
<dt><i>--enable-doxygen</i></dt>
<dd>Look for the doxygen program and enable construction of doxygen based
@ -1483,7 +1388,7 @@ different <a href="#tools">tools</a>.</p>
<dd> This directory contains files that describe various target architectures
for code generation. For example, the <tt>llvm/lib/Target/X86</tt>
directory holds the X86 machine description while
<tt>llvm/lib/Target/CBackend</tt> implements the LLVM-to-C converter.</dd>
<tt>llvm/lib/Target/ARM</tt> implements the ARM backend.</dd>
<dt><tt><b>llvm/lib/CodeGen/</b></tt></dt>
<dd> This directory contains the major parts of the code generator: Instruction
@ -1530,7 +1435,7 @@ different <a href="#tools">tools</a>.</p>
<div>
<p>This directory contains libraries which are compiled into LLVM bitcode and
used when linking programs with the GCC front end. Most of these libraries are
used when linking programs with the Clang front end. Most of these libraries are
skeleton versions of real libraries; for example, libc is a stripped down
version of glibc.</p>
@ -1692,12 +1597,6 @@ are code generators for parts of LLVM infrastructure.</p>
directory, switch to directory <tt>llvm/tools/llc</tt> and build it,
causing a re-linking of LLC.<br><br>
<dt><tt><b>NewNightlyTest.pl</b></tt> and
<tt><b>NightlyTestTemplate.html</b></tt> <dd>These files are used in a
cron script to generate nightly status reports of the functionality of
tools, and the results can be seen by following the appropriate link on
the <a href="http://llvm.org/">LLVM homepage</a>.<br><br>
<dt><tt><b>TableGen/</b></tt> <dd>The <tt>TableGen</tt> directory contains
the tool used to generate register descriptions, instruction set
descriptions, and even assemblers from common TableGen description
@ -1722,20 +1621,11 @@ are code generators for parts of LLVM infrastructure.</p>
<!-- *********************************************************************** -->
<div>
<p>This section gives an example of using LLVM. llvm-gcc3 is now obsolete,
so we only include instructions for llvm-gcc4.
</p>
<p><b>Note:</b> The <i>gcc4</i> frontend's invocation is <b><i>considerably different</i></b>
from the previous <i>gcc3</i> frontend. In particular, the <i>gcc4</i> frontend <b><i>does not</i></b>
create bitcode by default: <i>gcc4</i> produces native code. As the example below illustrates,
the '--emit-llvm' flag is needed to produce LLVM bitcode output. For <i>makefiles</i> and
<i>configure</i> scripts, the CFLAGS variable needs '--emit-llvm' to produce bitcode
output.</p>
<p>This section gives an example of using LLVM with the Clang front end.</p>
<!-- ======================================================================= -->
<h3>
<a name="tutorial4">Example with llvm-gcc4</a>
<a name="tutorial4">Example with clang</a>
</h3>
<div>
@ -1755,24 +1645,21 @@ int main() {
<li><p>Next, compile the C file into a native executable:</p>
<div class="doc_code"><pre>% llvm-gcc hello.c -o hello</pre></div>
<div class="doc_code"><pre>% clang hello.c -o hello</pre></div>
<p>Note that llvm-gcc works just like GCC by default. The standard -S and
<p>Note that clang works just like GCC by default. The standard -S and
-c arguments work as usual (producing a native .s or .o file,
respectively).</p></li>
<li><p>Next, compile the C file into a LLVM bitcode file:</p>
<div class="doc_code">
<pre>% llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc</pre></div>
<pre>% clang -O3 -emit-llvm hello.c -c -o hello.bc</pre></div>
<p>The -emit-llvm option can be used with the -S or -c options to emit an
LLVM ".ll" or ".bc" file (respectively) for the code. This allows you
to use the <a href="CommandGuide/index.html">standard LLVM tools</a> on
the bitcode file.</p>
<p>Unlike llvm-gcc3, llvm-gcc4 correctly responds to -O[0123] arguments.
</p></li>
the bitcode file.</p></li>
<li><p>Run the program in both forms. To run the program, use:</p>
@ -1811,7 +1698,7 @@ int main() {
<div class="doc_code"><pre>% ./hello.native</pre></div>
<p>Note that using llvm-gcc to compile directly to native code (i.e. when
<p>Note that using clang to compile directly to native code (i.e. when
the -emit-llvm option is not present) does steps 6/7/8 for you.</p>
</li>
@ -1870,7 +1757,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: 2011-10-17 08:31:32 +0200 (Mon, 17 Oct 2011) $
Last modified: $Date: 2012-03-27 13:25:16 +0200 (Tue, 27 Mar 2012) $
</address>
</body>
</html>

View File

@ -44,7 +44,7 @@
<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,
use LLVM. 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>
@ -88,8 +88,8 @@
<div>
<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
<p>Any system that can adequately run Visual Studio 2008 is fine. The LLVM
source tree and object files, libraries and executables will consume
approximately 3GB.</p>
</div>
@ -98,10 +98,9 @@
<h3><a name="software"><b>Software</b></a></h3>
<div>
<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 need Visual Studio 2008 or higher. Earlier versions of Visual
Studio have bugs, are not completely compatible, or do not support the C++
standard well enough.</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>
@ -363,7 +362,7 @@ out:</p>
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: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
Last modified: $Date: 2012-01-25 23:00:23 +0100 (Wed, 25 Jan 2012) $
</address>
</body>
</html>

View File

@ -89,11 +89,11 @@ placed.
<tt>-emit-llvm</tt> or <tt>-flto</tt>, or the <tt>-O4</tt> flag which is
synonymous with <tt>-O3 -flto</tt>.</p>
<p><tt>Clang</tt> has a <tt>-use-gold-plugin</tt> option which looks for the
gold plugin in the same directories as it looks for <tt>cc1</tt> and passes
the <tt>-plugin</tt> option to <tt>ld</tt>. It will not look for an alternate
linker, which is why you need gold to be the installed system linker in your
path.</p>
<p>Any of these flags will also cause <tt>clang</tt> to look for the
gold plugin in the <tt>lib</tt> directory under its prefix and pass the
<tt>-plugin</tt> option to <tt>ld</tt>. It will not look for an alternate
linker, which is why you need gold to be the installed system linker in
your path.</p>
<p>If you want <tt>ar</tt> and <tt>nm</tt> to work seamlessly as well, install
<tt>LLVMgold.so</tt> to <tt>/usr/lib/bfd-plugins</tt>. If you built your
@ -141,10 +141,10 @@ void foo4(void) {
}
--- command lines ---
$ clang -flto a.c -c -o a.o # &lt;-- a.o is LLVM bitcode file
$ ar q a.a a.o # &lt;-- a.a is an archive with LLVM bitcode
$ clang b.c -c -o b.o # &lt;-- b.o is native object file
$ clang -use-gold-plugin a.a b.o -o main # &lt;-- link with LLVMgold plugin
$ clang -flto a.c -c -o a.o # &lt;-- a.o is LLVM bitcode file
$ ar q a.a a.o # &lt;-- a.a is an archive with LLVM bitcode
$ clang b.c -c -o b.o # &lt;-- b.o is native object file
$ clang -flto a.a b.o -o main # &lt;-- link with LLVMgold plugin
</pre>
<p>Gold informs the plugin that foo3 is never referenced outside the IR,
@ -171,13 +171,12 @@ $ clang -use-gold-plugin a.a b.o -o main # &lt;-- link with LLVMgold plugin
<li>Follow the instructions <a href="#build">on how to build LLVMgold.so</a>.</li>
<li>Install the newly built binutils to <tt>$PREFIX</tt></li>
<li>Copy <tt>Release/lib/LLVMgold.so</tt> to
<tt>$PREFIX/libexec/gcc/x86_64-unknown-linux-gnu/4.2.1/</tt> and
<tt>$PREFIX/lib/bfd-plugins/</tt></li>
<li>Set environment variables (<tt>$PREFIX</tt> is where you installed clang and
binutils):
<pre class="doc_code">
export CC="$PREFIX/bin/clang -use-gold-plugin"
export CXX="$PREFIX/bin/clang++ -use-gold-plugin"
export CC="$PREFIX/bin/clang -flto"
export CXX="$PREFIX/bin/clang++ -flto"
export AR="$PREFIX/bin/ar"
export NM="$PREFIX/bin/nm"
export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a
@ -187,8 +186,8 @@ export CFLAGS="-O4"
<li>Or you can just set your path:
<pre class="doc_code">
export PATH="$PREFIX/bin:$PATH"
export CC="clang -use-gold-plugin"
export CXX="clang++ -use-gold-plugin"
export CC="clang -flto"
export CXX="clang++ -flto"
export RANLIB=/bin/true
export CFLAGS="-O4"
</pre></li>

142
docs/HowToAddABuilder.html Normal file
View File

@ -0,0 +1,142 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>
How To Add Your Build Configuration To LLVM Buildbot Infrastructure
</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>
<h1>How To Add Your Build Configuration To LLVM Buildbot Infrastructure</h1>
<ol>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#steps">Steps To Add Builder To LLVM Buildbot</a></li>
</ol>
<div class="doc_author">
<p>Written by <a href="mailto:gkistanova@gmail.com">Galina Kistanova</a></p>
</div>
<!-- *********************************************************************** -->
<h2><a name="introduction">Introduction</a></h2>
<!-- *********************************************************************** -->
<div>
<p>This document contains information about adding a build configuration and
buildslave to private slave builder to LLVM Buildbot Infrastructure
<a href="http://lab.llvm.org:8011">http://lab.llvm.org:8011</a></p>
</div>
<!-- *********************************************************************** -->
<h2><a name="steps">Steps To Add Builder To LLVM Buildbot</a></h2>
<!-- *********************************************************************** -->
<div>
<p>Volunteers can provide their build machines to work as build slaves to
public LLVM Buildbot.</p>
<p>Here are the steps you can follow to do so:</p>
<ol>
<li><p>Check the existing build configurations to make sure the one you are
interested in is not covered yet or gets built on your computer much
faster than on the existing one. We prefer faster builds so developers
will get feedback sooner after changes get committed.</p></li>
<li><p>The computer you will be registering with the LLVM buildbot
infrastructure should have all dependencies installed and you can
actually build your configuration successfully. Please check what degree
of parallelism (-j param) would give the fastest build.
You can build multiple configurations on one computer.</p></li>
<li><p>Install buildslave (currently we are using buildbot version 0.8.5).
Depending on the platform, buildslave could be available to download and
install with your packet manager, or you can download it directly from
<a href="http://trac.buildbot.net">http://trac.buildbot.net</a> and
install it manually.</p></li>
<li><p>Create a designated user account, your buildslave will be running
under, and set appropriate permissions.</p></li>
<li><p>Choose the buildslave root directory (all builds will be placed under
it), buildslave access name and password the build master will be using
to authenticate your buildslave.</p></li>
<li><p>Create a buildslave in context of that buildslave account.
Point it to the <b>lab.llvm.org</b> port <b>9990</b> (see
<a href="http://buildbot.net/buildbot/docs/current/full.html#creating-a-slave">
Buildbot documentation, Creating a slave</a>
for more details) by running the following command:</p>
<div class="doc_code">
<pre>
$ buildslave create-slave <i>buildslave-root-directory</i> \
lab.llvm.org:9990 \
<i>buildslave-access-name buildslave-access-password</i>
</pre>
</div></li>
<li><p>Fill the buildslave description and admin name/e-mail.
Here is an example of the buildslave description:</p>
<div class="doc_code">
<pre>
Windows 7 x64
Core i7 (2.66GHz), 16GB of RAM
g++.exe (TDM-1 mingw32) 4.4.0
GNU Binutils 2.19.1
cmake version 2.8.4
Microsoft(R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
</pre>
</div></li>
<li><p>Make sure you can actually start the buildslave successfully. Then set
up your buildslave to start automatically at the start up time.
See the buildbot documentation for help.
You may want to restart your computer to see if it works.</p></li>
<li><p>Send a patch which adds your build slave and your builder to zorg.</p>
<ul>
<li>slaves are added to
<tt>buildbot/osuosl/master/config/slaves.py</tt></li>
<li>builders are added to
<tt>buildbot/osuosl/master/config/builders.py</tt></li>
</ul></li>
<li><p>Send the buildslave access name and the access password directly
to <a href="mailto:gkistanova@gmail.com">Galina Kistanova</a>, and wait
till she will let you know that your changes are applied and buildmaster
is reconfigured.</p>
<li><p>Check the status of your buildslave on the
<a href="http://lab.llvm.org:8011/waterfall">Waterfall Display</a>
to make sure it is connected, and
<a href="http://lab.llvm.org:8011/buildslaves/your-buildslave-name">
http://lab.llvm.org:8011/buildslaves/&lt;your-buildslave-name&gt;</a>
to see if administrator contact and slave information are correct.</p>
</li>
<li><p>Wait for the first build to succeed and enjoy.</p></li>
</ol>
</div>
<!-- *********************************************************************** -->
<hr>
<address>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
<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: 2011-10-31 12:50:0 -0700 (Mon, 31 Oct 2011) $
</address>
</body>
</html>

View File

@ -575,7 +575,7 @@ $ svn copy https://llvm.org/svn/llvm-project/test-suite/branches/release_XY \
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: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2011-10-31 12:21:59 +0100 (Mon, 31 Oct 2011) $
</address>
</body>
</html>

View File

@ -341,7 +341,7 @@ the following:</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: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2011-10-31 12:21:59 +0100 (Mon, 31 Oct 2011) $
</address>
</body>

363
docs/LLVMBuild.html Normal file
View File

@ -0,0 +1,363 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>LLVMBuild Documentation</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>
<h1>LLVMBuild Guide</h1>
<ol>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#projectorg">Project Organization</a></li>
<li><a href="#buildintegration">Build Integration</a></li>
<li><a href="#componentoverview">Component Overview</a></li>
<li><a href="#formatreference">Format Reference</a></li>
</ol>
<!-- *********************************************************************** -->
<h2><a name="introduction">Introduction</a></h2>
<!-- *********************************************************************** -->
<div>
<p>This document describes the <tt>LLVMBuild</tt> organization and files which
we use to describe parts of the LLVM ecosystem. For description of specific
LLVMBuild related tools, please see the command guide.</p>
<p>LLVM is designed to be a modular set of libraries which can be flexibly
mixed together in order to build a variety of tools, like compilers, JITs,
custom code generators, optimization passes, interpreters, and so on. Related
projects in the LLVM system like Clang and LLDB also tend to follow this
philosophy.</p>
<p>In order to support this usage style, LLVM has a fairly strict structure as
to how the source code and various components are organized. The
<tt>LLVMBuild.txt</tt> files are the explicit specification of that structure,
and are used by the build systems and other tools in order to develop the LLVM
project.</p>
</div>
<!-- *********************************************************************** -->
<h2><a name="projectorg">Project Organization</a></h2>
<!-- *********************************************************************** -->
<!-- FIXME: We should probably have an explicit top level project object. Good
place to hang project level data, name, etc. Also useful for serving as the
$ROOT of project trees for things which can be checked out separately. -->
<div>
<p>The source code for LLVM projects using the LLVMBuild system (LLVM, Clang,
and LLDB) is organized into <em>components</em>, which define the separate
pieces of functionality that make up the project. These projects may consist
of many libraries, associated tools, build tools, or other utility tools (for
example, testing tools).</p>
<p>For the most part, the project contents are organized around defining one
main component per each subdirectory. Each such directory contains
an <tt>LLVMBuild.txt</tt> which contains the component definitions.</p>
<p>The component descriptions for the project as a whole are automatically
gathered by the LLVMBuild tools. The tools automatically traverse the source
directory structure to find all of the component description files. NOTE: For
performance/sanity reasons, we only traverse into subdirectories when the
parent itself contains an <tt>LLVMBuild.txt</tt> description file.</p>
</div>
<!-- *********************************************************************** -->
<h2><a name="buildintegration">Build Integration</a></h2>
<!-- *********************************************************************** -->
<div>
<p>The LLVMBuild files themselves are just a declarative way to describe the
project structure. The actual building of the LLVM project is handled by
another build system (currently we support
both <a href="MakefileGuide.html">Makefiles</a>
and <a href="CMake.html">CMake</a>.</p>
<p>The build system implementation will load the relevant contents of the
LLVMBuild files and use that to drive the actual project build. Typically, the
build system will only need to load this information at "configure" time, and
use it to generative native information. Build systems will also handle
automatically reconfiguring their information when the contents of
the <i>LLVMBuild.txt</i> files change.</p>
<p>Developers generally are not expected to need to be aware of the details of
how the LLVMBuild system is integrated into their build. Ideally, LLVM
developers who are not working on the build system would only ever need to
modify the contents of the <i>LLVMBuild.txt</i> description files (although we
have not reached this goal yet).</p>
<p>For more information on the utility tool we provide to help interfacing
with the build system, please see
the <a href="CommandGuide/html/llvm-build.html">llvm-build</a>
documentation.</p>
</div>
<!-- *********************************************************************** -->
<h2><a name="componentoverview">Component Overview</a></h2>
<!-- *********************************************************************** -->
<div>
<p>As mentioned earlier, LLVM projects are organized into
logical <em>components</em>. Every component is typically grouped into it's
own subdirectory. Generally, a component is organized around a coherent group
of sources which have some kind of clear API separation from other parts of
the code.</p>
<p>LLVM primarily uses the following types of components:</p>
<ul>
<li><em>Libraries</em> - Library components define a distinct API which can
be independently linked into LLVM client applications. Libraries typically
have private and public header files, and may specify a link of required
libraries that they build on top of.</li>
<li><em>Build Tools</em> - Build tools are applications which are designed
to be run as part of the build process (typically to generate other source
files). Currently, LLVM uses one main build tool
called <a href="TableGenFundamentals.html">TableGen</a> to generate a
variety of source files.</li>
<li><em>Tools</em> - Command line applications which are built using the
LLVM component libraries. Most LLVM tools are small and are primarily
frontends to the library interfaces.</li>
<!-- FIXME: We also need shared libraries as a first class component, but this
is not yet implemented. -->
</ul>
<p>Components are described using <em>LLVMBuild.txt</em> files in the
directories that define the component. See
the <a href="#formatreference">Format Reference</a> section for information on
the exact format of these files.</p>
</div>
<!-- *********************************************************************** -->
<h2><a name="formatreference">LLVMBuild Format Reference</a></h2>
<!-- *********************************************************************** -->
<div>
<p>LLVMBuild files are written in a simple variant of the INI or configuration
file format (<a href="http://en.wikipedia.org/wiki/INI_file">Wikipedia
entry</a>). The format defines a list of sections each of which may contain
some number of properties. A simple example of the file format is below:</p>
<div class="doc_code">
<pre>
<i>; Comments start with a semi-colon.</i>
<i>; Sections are declared using square brackets.</i>
[component_0]
<i>; Properties are declared using '=' and are contained in the previous section.
;
; We support simple string and boolean scalar values and list values, where
; items are separated by spaces. There is no support for quoting, and so
; property values may not contain spaces.</i>
property_name = property_value
list_property_name = value_1 value_2 <em>...</em> value_n
boolean_property_name = 1 <em>(or 0)</em>
</pre>
</div>
<p>LLVMBuild files are expected to define a strict set of sections and
properties. An typical component description file for a library
component would look typically look like the following example:</p>
<div class="doc_code">
<pre>
[component_0]
type = Library
name = Linker
parent = Libraries
required_libraries = Archive BitReader Core Support TransformUtils
</pre>
</div>
<p>A full description of the exact sections and properties which are allowed
follows.</p>
<p>Each file may define exactly one common component, named "common". The
common component may define the following properties:</p>
<ul>
<li><i>subdirectories</i> <b>[optional]</b>
<p>If given, a list of the names of the subdirectories from the current
subpath to search for additional LLVMBuild files.</p></li>
</ul>
<p>Each file may define multiple components. Each component is described by a
section who name starts with "component". The remainder of the section name is
ignored, but each section name must be unique. Typically components are just
number in order for files with multiple components ("component_0",
"component_1", and so on).<p>
<p><b>Section names not matches this format (or the "common" section) are
currently unused and are disallowed.</b></p>
<p>Every component is defined by the properties in the section. The exact list
of properties that are allowed depends on the component
type. Components <b>may not</b> define any properties other than those
expected by the component type.</p>
<p>Every component must define the following properties:</p>
<ul>
<li><i>type</i> <b>[required]</b>
<p>The type of the component. Supported component types are
detailed below. Most components will define additional properties which
may be required or optional.</p></li>
<li><i>name</i> <b>[required]</b>
<p>The name of the component. Names are required to be unique
across the entire project.</p></li>
<li><i>parent</i> <b>[required]</b>
<p>The name of the logical parent of the component. Components are
organized into a logical tree to make it easier to navigate and organize
groups of components. The parent's have no semantics as far as the project
build is concerned, however. Typically, the parent will be the main
component of the parent directory.</p>
<!-- FIXME: Should we make the parent optional, and default to parent
directories component? -->
<p>Components may reference the root pseudo component using '$ROOT' to
indicate they should logically be grouped at the top-level.</p>
</li>
</ul>
<p>Components may define the following properties:</p>
<ul>
<li><i>dependencies</i> <b>[optional]</b>
<p>If specified, a list of names of components which <i>must</i> be built
prior to this one. This should only be exactly those components which
produce some tool or source code required for building the
component.</p>
<p><em>NOTE:</em> Group and LibraryGroup components have no semantics for
the actual build, and are not allowed to specify dependencies.</p></li>
</ul>
<p>The following section lists the available component types, as well as the
properties which are associated with that component.</p>
<ul>
<li><i>type = Group</i>
<p>Group components exist purely to allow additional arbitrary structuring
of the logical components tree. For example, one might define a
"Libraries" group to hold all of the root library components.</p>
<p>Group components have no additionally properties.</p>
</li>
<li><i>type = Library</i>
<p>Library components define an individual library which should be built
from the source code in the component directory.</p>
<p>Components with this type use the following properties:</p>
<ul>
<li><i>library_name</i> <b>[optional]</b>
<p>If given, the name to use for the actual library file on disk. If
not given, the name is derived from the component name
itself.</p></li>
<li><i>required_libraries</i> <b>[optional]</b>
<p>If given, a list of the names of Library or LibraryGroup components
which must also be linked in whenever this library is used. That is,
the link time dependencies for this component. When tools are built,
the build system will include the transitive closer of
all <i>required_libraries</i> for the components the tool needs.</p></li>
<li><i>add_to_library_groups</i> <b>[optional]</b>
<p>If given, a list of the names of LibraryGroup components which this
component is also part of. This allows nesting groups of
components. For example, the <i>X86</i> target might define a library
group for all of the <i>X86</i> components. That library group might
then be included in the <i>all-targets</i> library group.</p></li>
</ul>
</li>
<li><i>type = LibraryGroup</i>
<p>LibraryGroup components are a mechanism to allow easy definition of
useful sets of related components. In particular, we use them to easily
specify things like "all targets", or "all assembly printers".</p>
<p>Components with this type use the following properties:</p>
<ul>
<li><i>required_libraries</i> <b>[optional]</b>
<p>See the Library type for a description of this property.</p></li>
<li><i>add_to_library_groups</i> <b>[optional]</b>
<p>See the Library type for a description of this property.</p></li>
</ul>
</li>
<li><i>type = TargetGroup</i>
<p>TargetGroup components are an extension of LibraryGroups, specifically
for defining LLVM targets (which are handled specially in a few
places).</p>
<p>The name of the component should always be the name of the target.</p>
<p>Components with this type use the LibraryGroup properties in addition
to:</p>
<ul>
<li><i>has_asmparser</i> <b>[optional]</b> <b>[boolean]</b>
<p>Whether this target defines an assembly parser.</p></li>
<li><i>has_asmprinter</i> <b>[optional]</b> <b>[boolean]</b>
<p>Whether this target defines an assembly printer.</p></li>
<li><i>has_disassembler</i> <b>[optional]</b> <b>[boolean]</b>
<p>Whether this target defines a disassembler.</p></li>
<li><i>has_jit</i> <b>[optional]</b> <b>[boolean]</b>
<p>Whether this target supports JIT compilation.</p></li>
</ul>
</li>
<li><i>type = Tool</i>
<p>Tool components define standalone command line tools which should be
built from the source code in the component directory and linked.</p>
<p>Components with this type use the following properties:</p>
<ul>
<li><i>required_libraries</i> <b>[optional]</b>
<p>If given, a list of the names of Library or LibraryGroup components
which this tool is required to be linked with. <b>NOTE:</b> The values
should be the component names, which may not always match up with the
actual library names on disk.</p>
<p>Build systems are expected to properly include all of the libraries
required by the linked components (i.e., the transitive closer
of <em>required_libraries</em>).</p>
<p>Build systems are also expected to understand that those library
components must be built prior to linking -- they do not also need to
be listed under <i>dependencies</i>.</p></li>
</ul>
</li>
<li><i>type = BuildTool</i>
<p>BuildTool components are like Tool components, except that the tool is
supposed to be built for the platform where the build is running (instead
of that platform being targetted). Build systems are expected to handle
the fact that required libraries may need to be built for multiple
platforms in order to be able to link this tool.</p>
<p>BuildTool components currently use the exact same properties as Tool
components, the type distinction is only used to differentiate what the
tool is built for.</p>
</li>
</ul>
</div>
<!-- *********************************************************************** -->
<hr>
<address>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
<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$
</address>
</body>
</html>

21
docs/LLVMBuild.txt Normal file
View File

@ -0,0 +1,21 @@
;===- ./docs/LLVMBuild.txt -------------------------------------*- Conf -*--===;
;
; The LLVM Compiler Infrastructure
;
; This file is distributed under the University of Illinois Open Source
; License. See LICENSE.TXT for details.
;
;===------------------------------------------------------------------------===;
;
; This is an LLVMBuild description file for the components in this subdirectory.
;
; For more information on the LLVMBuild system, please see:
;
; http://llvm.org/docs/LLVMBuild.html
;
;===------------------------------------------------------------------------===;
[component_0]
type = Group
name = Docs
parent = $ROOT

File diff suppressed because it is too large Load Diff

View File

@ -275,7 +275,7 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</dl>
</div>
</div>
</div>
<!-- *********************************************************************** -->
<hr>
<address> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
@ -284,7 +284,7 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a><a
href="http://llvm.org/">The LLVM Team</a><br>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-09-27 20:44:01 +0200 (Tue, 27 Sep 2011) $
Last modified: $Date: 2012-01-05 09:18:41 +0100 (Thu, 05 Jan 2012) $
</address>
<!-- vim: sw=2
-->

View File

@ -393,7 +393,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: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2011-10-31 12:21:59 +0100 (Mon, 31 Oct 2011) $
</address>
</body>

View File

@ -113,7 +113,7 @@ line numbers.</dd>
<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: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2011-10-31 12:21:59 +0100 (Mon, 31 Oct 2011) $
</address>
</body>
</html>

View File

@ -126,6 +126,7 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print " <p>\n" if !
<tr><td><a href="#adce">-adce</a></td><td>Aggressive Dead Code Elimination</td></tr>
<tr><td><a href="#always-inline">-always-inline</a></td><td>Inliner for always_inline functions</td></tr>
<tr><td><a href="#argpromotion">-argpromotion</a></td><td>Promote 'by reference' arguments to scalars</td></tr>
<tr><td><a href="#bb-vectorize">-bb-vectorize</a></td><td>Combine instructions to form vector instructions within basic blocks</td></tr>
<tr><td><a href="#block-placement">-block-placement</a></td><td>Profile Guided Basic Block Placement</td></tr>
<tr><td><a href="#break-crit-edges">-break-crit-edges</a></td><td>Break critical edges in CFG</td></tr>
<tr><td><a href="#codegenprepare">-codegenprepare</a></td><td>Optimize for code generation</td></tr>
@ -815,6 +816,26 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print " <p>\n" if !
</p>
</div>
<!-------------------------------------------------------------------------- -->
<h3>
<a name="bb-vectorize">-bb-vectorize: Basic-Block Vectorization</a>
</h3>
<div>
<p>This pass combines instructions inside basic blocks to form vector
instructions. It iterates over each basic block, attempting to pair
compatible instructions, repeating this process until no additional
pairs are selected for vectorization. When the outputs of some pair
of compatible instructions are used as inputs by some other pair of
compatible instructions, those pairs are part of a potential
vectorization chain. Instruction pairs are only fused into vector
instructions when they are part of a chain longer than some
threshold length. Moreover, the pass attempts to find the best
possible chain for each pair of compatible instructions. These
heuristics are intended to prevent vectorization in cases where
it would not yield a performance increase of the resulting code.
</p>
</div>
<!-------------------------------------------------------------------------- -->
<h3>
<a name="block-placement">-block-placement: Profile Guided Basic Block Placement</a>
@ -2039,7 +2060,7 @@ if (X &lt; 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: 2011-11-04 07:30:50 +0100 (Fri, 04 Nov 2011) $
Last modified: $Date: 2012-02-01 04:51:43 +0100 (Wed, 01 Feb 2012) $
</address>
</body>

View File

@ -81,11 +81,13 @@ option</a></li>
<li><a href="#dss_smallset">"llvm/ADT/SmallSet.h"</a></li>
<li><a href="#dss_smallptrset">"llvm/ADT/SmallPtrSet.h"</a></li>
<li><a href="#dss_denseset">"llvm/ADT/DenseSet.h"</a></li>
<li><a href="#dss_sparseset">"llvm/ADT/SparseSet.h"</a></li>
<li><a href="#dss_FoldingSet">"llvm/ADT/FoldingSet.h"</a></li>
<li><a href="#dss_set">&lt;set&gt;</a></li>
<li><a href="#dss_setvector">"llvm/ADT/SetVector.h"</a></li>
<li><a href="#dss_uniquevector">"llvm/ADT/UniqueVector.h"</a></li>
<li><a href="#dss_otherset">Other Set-Like ContainerOptions</a></li>
<li><a href="#dss_immutableset">"llvm/ADT/ImmutableSet.h"</a></li>
<li><a href="#dss_otherset">Other Set-Like Container Options</a></li>
</ul></li>
<li><a href="#ds_map">Map-Like Containers (std::map, DenseMap, etc)</a>
<ul>
@ -97,6 +99,7 @@ option</a></li>
<li><a href="#dss_intervalmap">"llvm/ADT/IntervalMap.h"</a></li>
<li><a href="#dss_map">&lt;map&gt;</a></li>
<li><a href="#dss_inteqclasses">"llvm/ADT/IntEqClasses.h"</a></li>
<li><a href="#dss_immutablemap">"llvm/ADT/ImmutableMap.h"</a></li>
<li><a href="#dss_othermap">Other Map-Like Container Options</a></li>
</ul></li>
<li><a href="#ds_bit">BitVector-like containers</a>
@ -995,7 +998,7 @@ vector is also useful when interfacing with code that expects vectors :).
<pre>
for ( ... ) {
std::vector&lt;foo&gt; V;
use V;
// make use of V.
}
</pre>
</div>
@ -1006,7 +1009,7 @@ for ( ... ) {
<pre>
std::vector&lt;foo&gt; V;
for ( ... ) {
use V;
// make use of V.
V.clear();
}
</pre>
@ -1486,6 +1489,24 @@ href="#dss_densemap">DenseMap</a> has.
</div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="dss_sparseset">"llvm/ADT/SparseSet.h"</a>
</h4>
<div>
<p>SparseSet holds a small number of objects identified by unsigned keys of
moderate size. It uses a lot of memory, but provides operations that are
almost as fast as a vector. Typical keys are physical registers, virtual
registers, or numbered basic blocks.</p>
<p>SparseSet is useful for algorithms that need very fast clear/find/insert/erase
and fast iteration over small sets. It is not intended for building composite
data structures.</p>
</div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="dss_FoldingSet">"llvm/ADT/FoldingSet.h"</a>
@ -1608,6 +1629,29 @@ factors, and produces a lot of malloc traffic. It should be avoided.</p>
</div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="dss_immutableset">"llvm/ADT/ImmutableSet.h"</a>
</h4>
<div>
<p>
ImmutableSet is an immutable (functional) set implementation based on an AVL
tree.
Adding or removing elements is done through a Factory object and results in the
creation of a new ImmutableSet object.
If an ImmutableSet already exists with the given contents, then the existing one
is returned; equality is compared with a FoldingSetNodeID.
The time and space complexity of add or remove operations is logarithmic in the
size of the original set.
<p>
There is no method for returning an element of the set, you can only check for
membership.
</div>
<!-- _______________________________________________________________________ -->
<h4>
@ -1728,7 +1772,7 @@ pointers, or map other small types to each other.
<p>
There are several aspects of DenseMap that you should be aware of, however. The
iterators in a densemap are invalidated whenever an insertion occurs, unlike
iterators in a DenseMap are invalidated whenever an insertion occurs, unlike
map. Also, because DenseMap allocates space for a large number of key/value
pairs (it starts with 64 by default), it will waste a lot of space if your keys
or values are large. Finally, you must implement a partial specialization of
@ -1736,6 +1780,14 @@ DenseMapInfo for the key that you want, if it isn't already supported. This
is required to tell DenseMap about two special marker values (which can never be
inserted into the map) that it needs internally.</p>
<p>
DenseMap's find_as() method supports lookup operations using an alternate key
type. This is useful in cases where the normal key type is expensive to
construct, but cheap to compare against. The DenseMapInfo is responsible for
defining the appropriate comparison and hashing methods for each alternate
key type used.
</p>
</div>
<!-- _______________________________________________________________________ -->
@ -1812,6 +1864,25 @@ it can be edited again.</p>
</div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="dss_immutablemap">"llvm/ADT/ImmutableMap.h"</a>
</h4>
<div>
<p>
ImmutableMap is an immutable (functional) map implementation based on an AVL
tree.
Adding or removing elements is done through a Factory object and results in the
creation of a new ImmutableMap object.
If an ImmutableMap already exists with the given key set, then the existing one
is returned; equality is compared with a FoldingSetNodeID.
The time and space complexity of add or remove operations is logarithmic in the
size of the original map.
</div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="dss_othermap">Other Map-Like Container Options</a>
@ -2496,7 +2567,7 @@ block but not delete it, you can use the <tt>removeFromParent()</tt> method.</p>
<div>
<p><i>Replacing individual instructions</i></p>
<h5><i>Replacing individual instructions</i></h5>
<p>Including "<a href="/doxygen/BasicBlockUtils_8h-source.html">llvm/Transforms/Utils/BasicBlockUtils.h</a>"
permits use of two very useful replace functions: <tt>ReplaceInstWithValue</tt>
@ -2504,6 +2575,7 @@ and <tt>ReplaceInstWithInst</tt>.</p>
<h5><a name="schanges_deleting">Deleting <tt>Instruction</tt>s</a></h5>
<div>
<ul>
<li><tt>ReplaceInstWithValue</tt>
@ -2540,7 +2612,9 @@ ReplaceInstWithInst(instToReplace-&gt;getParent()-&gt;getInstList(), ii,
</pre></div></li>
</ul>
<p><i>Replacing multiple uses of <tt>User</tt>s and <tt>Value</tt>s</i></p>
</div>
<h5><i>Replacing multiple uses of <tt>User</tt>s and <tt>Value</tt>s</i></h5>
<p>You can use <tt>Value::replaceAllUsesWith</tt> and
<tt>User::replaceUsesOfWith</tt> to change more than one use at a time. See the
@ -3234,13 +3308,12 @@ helpful member functions that try to make common operations easy.</p>
<div>
<ul>
<li><tt>Module::Module(std::string name = "")</tt></li>
</ul>
<li><tt>Module::Module(std::string name = "")</tt>
<p>Constructing a <a href="#Module">Module</a> is easy. You can optionally
<p>Constructing a <a href="#Module">Module</a> is easy. You can optionally
provide a name for it (probably based on the name of the translation unit).</p>
</li>
<ul>
<li><tt>Module::iterator</tt> - Typedef for function list iterator<br>
<tt>Module::const_iterator</tt> - Typedef for const_iterator.<br>
@ -4052,7 +4125,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: 2011-11-03 07:43:54 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2012-03-27 13:25:16 +0200 (Tue, 27 Mar 2012) $
</address>
</body>

View File

@ -482,7 +482,7 @@ Mailing List</a>.</p>
<a href="mailto:criswell@uiuc.edu">John Criswell</a><br>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a>
<br>
Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2011-10-31 12:21:59 +0100 (Mon, 31 Oct 2011) $
</address>
</body>

File diff suppressed because it is too large Load Diff

View File

@ -20,18 +20,12 @@
<li><a href="#alloca">Variable Sized Allocas</a></li>
</ol>
</li>
<li><a href="#results">Results</a>
<ol>
<li><a href="#go">Go on LLVM</a></li>
<li><a href="#abi">Runtime ABI</a></li>
</ol>
</li>
</ol>
<h2><a name="intro">Introduction</a></h2>
<div>
<p>
Segmented stack allows stack space to be allocated incrementally than as a monolithic chunk (of some worst case size) at thread initialization. This is done by allocating stack blocks (henceforth called <em>stacklets</em>) and linking them into a doubly linked list. The function prologue is responsible for checking if the current stacklet has enough space for the function to execute; and if not, call into the libgcc runtime to allocate more stack space. Support for segmented stacks on x86 / Linux is currently being worked on.
Segmented stack allows stack space to be allocated incrementally than as a monolithic chunk (of some worst case size) at thread initialization. This is done by allocating stack blocks (henceforth called <em>stacklets</em>) and linking them into a doubly linked list. The function prologue is responsible for checking if the current stacklet has enough space for the function to execute; and if not, call into the libgcc runtime to allocate more stack space. When using <tt>llc</tt>, segmented stacks can be enabled by adding <tt>-segmented-stacks</tt> to the command line.
</p>
<p>
The runtime functionality is <a href="http://gcc.gnu.org/wiki/SplitStacks">already there in libgcc</a>.

File diff suppressed because it is too large Load Diff

View File

@ -310,7 +310,7 @@
<a href="mailto:rspencer@x10sys.com">Reid Spencer</a><br>
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2011-10-31 12:21:59 +0100 (Mon, 31 Oct 2011) $
</address>
</body>
</html>

View File

@ -37,6 +37,7 @@
<ol>
<li><a href="#include">File inclusion</a></li>
<li><a href="#globallet">'let' expressions</a></li>
<li><a href="#foreach">'foreach' blocks</a></li>
</ol></li>
</ol></li>
<li><a href="#backends">TableGen backends</a>
@ -208,6 +209,14 @@ file, to factor out the common features that instructions of its class share. A
key feature of TableGen is that it allows the end-user to define the
abstractions they prefer to use when describing their information.</p>
<p>Each def record has a special entry called "NAME." This is the
name of the def ("ADD32rr" above). In the general case def names can
be formed from various kinds of string processing expressions and NAME
resolves to the final value obtained after resolving all of those
expressions. The user may refer to NAME anywhere she desires to use
the ultimate name of the def. NAME should not be defined anywhere
else in user code to avoid conflict problems.</p>
</div>
<!-- ======================================================================= -->
@ -393,6 +402,14 @@ which case the user must specify it explicitly.</dd>
<dt><tt>list[4-7,17,2-3]</tt></dt>
<dd>A slice of the 'list' list, including elements 4,5,6,7,17,2, and 3 from
it. Elements may be included multiple times.</dd>
<dt><tt>foreach &lt;var&gt; = &lt;list&gt; in { &lt;body&gt; }</tt></dt>
<dt><tt>foreach &lt;var&gt; = &lt;list&gt; in &lt;def&gt;</tt></dt>
<dd> Replicate &lt;body&gt; or &lt;def&gt;, replacing instances of
&lt;var&gt; with each value in &lt;list&gt;. &lt;var&gt; is scoped at the
level of the <tt>foreach</tt> loop and must not conflict with any other object
introduced in &lt;body&gt; or &lt;def&gt;. Currently only <tt>def</tt>s are
expanded within &lt;body&gt;.
</dd>
<dt><tt>(DEF a, b)</tt></dt>
<dd>a dag value. The first element is required to be a record definition, the
remaining elements in the list may be arbitrary other values, including nested
@ -400,6 +417,10 @@ which case the user must specify it explicitly.</dd>
<dt><tt>!strconcat(a, b)</tt></dt>
<dd>A string value that is the result of concatenating the 'a' and 'b'
strings.</dd>
<dt><tt>str1#str2</tt></dt>
<dd>"#" (paste) is a shorthand for !strconcat. It may concatenate
things that are not quoted strings, in which case an implicit
!cast&lt;string&gt; is done on the operand of the paste.</dd>
<dt><tt>!cast&lt;type&gt;(a)</tt></dt>
<dd>A symbol of type <em>type</em> obtained by looking up the string 'a' in
the symbol table. If the type of 'a' does not match <em>type</em>, TableGen
@ -868,6 +889,39 @@ several levels of multiclass instanciations. This also avoids the need of using
</pre>
</div>
<!-- -------------------------------------------------------------------------->
<h4>
<a name="foreach">Looping</a>
</h4>
<div>
<p>TableGen supports the '<tt>foreach</tt>' block, which textually replicates
the loop body, substituting iterator values for iterator references in the
body. Example:</p>
<div class="doc_code">
<pre>
<b>foreach</b> i = [0, 1, 2, 3] in {
<b>def</b> R#i : Register&lt;...&gt;;
<b>def</b> F#i : Register&lt;...&gt;;
}
</pre>
</div>
<p>This will create objects <tt>R0</tt>, <tt>R1</tt>, <tt>R2</tt> and
<tt>R3</tt>. <tt>foreach</tt> blocks may be nested. If there is only
one item in the body the braces may be elided:</p>
<div class="doc_code">
<pre>
<b>foreach</b> i = [0, 1, 2, 3] in
<b>def</b> R#i : Register&lt;...&gt;;
</pre>
</div>
</div>
</div>
</div>
@ -912,7 +966,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: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2012-03-27 13:25:16 +0200 (Tue, 27 Mar 2012) $
</address>
</body>

View File

@ -0,0 +1,351 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>LLVM test-suite Makefile Guide</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>
<h1>
LLVM test-suite Makefile Guide
</h1>
<ol>
<li><a href="#overview">Overview</a></li>
<li><a href="#testsuitestructure">Test suite structure</a></li>
<li><a href="#testsuiterun">Running the test suite</a>
<ul>
<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 test-suite</a></li>
</ul>
</li>
</ol>
<div class="doc_author">
<p>Written by John T. Criswell, Daniel Dunbar, Reid Spencer, and Tanya Lattner</p>
</div>
<!--=========================================================================-->
<h2><a name="overview">Overview</a></h2>
<!--=========================================================================-->
<div>
<p>This document describes the features of the Makefile-based LLVM
test-suite. This way of interacting with the test-suite is deprecated in favor
of running the test-suite using LNT, but may continue to prove useful for some
users. See the Testing
Guide's <a href="TestingGuide.html#testsuitequickstart">test-suite
Quickstart</a> section for more information.</p>
</div>
<!--=========================================================================-->
<h2><a name="testsuitestructure">Test suite Structure</a></h2>
<!--=========================================================================-->
<div>
<p>The <tt>test-suite</tt> module contains a number of programs that can be compiled
with LLVM and executed. These programs are compiled using the native compiler
and various LLVM backends. The output from the program compiled with the
native compiler is assumed correct; the results from the other programs are
compared to the native program output and pass if they match.</p>
<p>When executing tests, it is usually a good idea to start out with a subset of
the available tests or programs. This makes test run times smaller at first and
later on this is useful to investigate individual test failures. To run some
test only on a subset of programs, simply change directory to the programs you
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>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>test-suite</tt> tests are divided into three types of tests: MultiSource,
SingleSource, and External.</p>
<ul>
<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>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>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 test-suite
<tt>configure</tt> script.</p></li>
</ul>
<p>Each tree is then subdivided into several categories, including applications,
benchmarks, regression tests, code that is strange grammatically, etc. These
organizations should be relatively self explanatory.</p>
<p>Some tests are known to fail. Some are bugs that we have not fixed yet;
others are features that we haven't added yet (or may never add). In the
regression tests, the result for such tests will be XFAIL (eXpected FAILure).
In this way, you can tell the difference between an expected and unexpected
failure.</p>
<p>The tests in the test suite have no such feature at this time. If the
test passes, only warnings and other miscellaneous output will be generated. If
a test fails, a large &lt;program&gt; FAILED message will be displayed. This
will help you separate benign warnings from actual test failures.</p>
</div>
<!--=========================================================================-->
<h2><a name="testsuiterun">Running the test suite</a></h2>
<!--=========================================================================-->
<div>
<p>First, all tests are executed within the LLVM object directory tree. They
<i>are not</i> executed inside of the LLVM source tree. This is because the
test suite creates temporary files during execution.</p>
<p>To run the test suite, you need to use the following steps:</p>
<ol>
<li><tt>cd</tt> into the <tt>llvm/projects</tt> directory in your source tree.
</li>
<li><p>Check out the <tt>test-suite</tt> module with:</p>
<div class="doc_code">
<pre>
% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
</pre>
</div>
<p>This will get the test suite into <tt>llvm/projects/test-suite</tt>.</p>
</li>
<li><p>Configure and build <tt>llvm</tt>.</p></li>
<li><p>Configure and build <tt>llvm-gcc</tt>.</p></li>
<li><p>Install <tt>llvm-gcc</tt> somewhere.</p></li>
<li><p><em>Re-configure</em> <tt>llvm</tt> from the top level of
each build tree (LLVM object directory tree) in which you want
to run the test suite, just as you do before building LLVM.</p>
<p>During the <em>re-configuration</em>, you must either: (1)
have <tt>llvm-gcc</tt> you just built in your path, or (2)
specify the directory where your just-built <tt>llvm-gcc</tt> is
installed using <tt>--with-llvmgccdir=$LLVM_GCC_DIR</tt>.</p>
<p>You must also tell the configure machinery that the test suite
is available so it can be configured for your build tree:</p>
<div class="doc_code">
<pre>
% cd $LLVM_OBJ_ROOT ; $LLVM_SRC_ROOT/configure [--with-llvmgccdir=$LLVM_GCC_DIR]
</pre>
</div>
<p>[Remember that <tt>$LLVM_GCC_DIR</tt> is the directory where you
<em>installed</em> llvm-gcc, not its src or obj directory.]</p>
</li>
<li><p>You can now run the test suite from your build tree as follows:</p>
<div class="doc_code">
<pre>
% cd $LLVM_OBJ_ROOT/projects/test-suite
% make
</pre>
</div>
</li>
</ol>
<p>Note that the second and third steps only need to be done once. After you
have the suite checked out and configured, you don't need to do it again (unless
the test code or configure script changes).</p>
<!-- _______________________________________________________________________ -->
<h3>
<a name="testsuiteexternal">Configuring External Tests</a>
</h3>
<!-- _______________________________________________________________________ -->
<div>
<p>In order to run the External tests in the <tt>test-suite</tt>
module, you must specify <i>--with-externals</i>. This
must be done during the <em>re-configuration</em> step (see above),
and the <tt>llvm</tt> re-configuration must recognize the
previously-built <tt>llvm-gcc</tt>. If any of these is missing or
neglected, the External tests won't work.</p>
<dl>
<dt><i>--with-externals</i></dt>
<dt><i>--with-externals=&lt;<tt>directory</tt>&gt;</i></dt>
</dl>
This tells LLVM where to find any external tests. They are expected to be
in specifically named subdirectories of &lt;<tt>directory</tt>&gt;.
If <tt>directory</tt> is left unspecified,
<tt>configure</tt> uses the default value
<tt>/home/vadve/shared/benchmarks/speccpu2000/benchspec</tt>.
Subdirectory names known to LLVM include:
<dl>
<dt>spec95</dt>
<dt>speccpu2000</dt>
<dt>speccpu2006</dt>
<dt>povray31</dt>
</dl>
Others are added from time to time, and can be determined from
<tt>configure</tt>.
</div>
<!-- _______________________________________________________________________ -->
<h3>
<a name="testsuitetests">Running different tests</a>
</h3>
<!-- _______________________________________________________________________ -->
<div>
<p>In addition to the regular "whole program" tests, the <tt>test-suite</tt>
module also provides a mechanism for compiling the programs in different ways.
If the variable TEST is defined on the <tt>gmake</tt> command line, the test system will
include a Makefile named <tt>TEST.&lt;value of TEST variable&gt;.Makefile</tt>.
This Makefile can modify build rules to yield different results.</p>
<p>For example, the LLVM nightly tester uses <tt>TEST.nightly.Makefile</tt> to
create the nightly test reports. To run the nightly tests, run <tt>gmake
TEST=nightly</tt>.</p>
<p>There are several TEST Makefiles available in the tree. Some of them are
designed for internal LLVM research and will not work outside of the LLVM
research group. They may still be valuable, however, as a guide to writing your
own TEST Makefile for any optimization or analysis passes that you develop with
LLVM.</p>
</div>
<!-- _______________________________________________________________________ -->
<h3>
<a name="testsuiteoutput">Generating test output</a>
</h3>
<!-- _______________________________________________________________________ -->
<div>
<p>There are a number of ways to run the tests and generate output. The most
simple one is simply running <tt>gmake</tt> with no arguments. This will
compile and run all programs in the tree using a number of different methods
and compare results. Any failures are reported in the output, but are likely
drowned in the other output. Passes are not reported explicitely.</p>
<p>Somewhat better is running <tt>gmake TEST=sometest test</tt>, which runs
the specified test and usually adds per-program summaries to the output
(depending on which sometest you use). For example, the <tt>nightly</tt> test
explicitely outputs TEST-PASS or TEST-FAIL for every test after each program.
Though these lines are still drowned in the output, it's easy to grep the
output logs in the Output directories.</p>
<p>Even better are the <tt>report</tt> and <tt>report.format</tt> targets
(where <tt>format</tt> is one of <tt>html</tt>, <tt>csv</tt>, <tt>text</tt> or
<tt>graphs</tt>). The exact contents of the report are dependent on which
<tt>TEST</tt> you are running, but the text results are always shown at the
end of the run and the results are always stored in the
<tt>report.&lt;type&gt;.format</tt> file (when running with
<tt>TEST=&lt;type&gt;</tt>).
The <tt>report</tt> also generate a file called
<tt>report.&lt;type&gt;.raw.out</tt> containing the output of the entire test
run.
</div>
<!-- _______________________________________________________________________ -->
<h3>
<a name="testsuitecustom">Writing custom tests for the test suite</a>
</h3>
<!-- _______________________________________________________________________ -->
<div>
<p>Assuming you can run the test suite, (e.g. "<tt>gmake TEST=nightly report</tt>"
should work), it is really easy to run optimizations or code generator
components against every program in the tree, collecting statistics or running
custom checks for correctness. At base, this is how the nightly tester works,
it's just one example of a general framework.</p>
<p>Lets say that you have an LLVM optimization pass, and you want to see how
many times it triggers. First thing you should do is add an LLVM
<a href="ProgrammersManual.html#Statistic">statistic</a> to your pass, which
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, a
"<tt>test-suite/TEST.XXX.Makefile</tt>" fragment (where XXX is the name of your
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>
<p>If you are interested in testing an optimization pass, check out the
"libcalls" test as an example. It can be run like this:<p>
<div class="doc_code">
<pre>
% cd llvm/projects/test-suite/MultiSource/Benchmarks # or some other level
% make TEST=libcalls report
</pre>
</div>
<p>This will do a bunch of stuff, then eventually print a table like this:</p>
<div class="doc_code">
<pre>
Name | total | #exit |
...
FreeBench/analyzer/analyzer | 51 | 6 |
FreeBench/fourinarow/fourinarow | 1 | 1 |
FreeBench/neural/neural | 19 | 9 |
FreeBench/pifft/pifft | 5 | 3 |
MallocBench/cfrac/cfrac | 1 | * |
MallocBench/espresso/espresso | 52 | 12 |
MallocBench/gs/gs | 4 | * |
Prolangs-C/TimberWolfMC/timberwolfmc | 302 | * |
Prolangs-C/agrep/agrep | 33 | 12 |
Prolangs-C/allroots/allroots | * | * |
Prolangs-C/assembler/assembler | 47 | * |
Prolangs-C/bison/mybison | 74 | * |
...
</pre>
</div>
<p>This basically is grepping the -stats output and displaying it in a table.
You can also use the "TEST=libcalls report.html" target to get the table in HTML
form, similarly for report.csv and report.tex.</p>
<p>The source for this is in test-suite/TEST.libcalls.*. The format is pretty
simple: the Makefile indicates how to run the test (in this case,
"<tt>opt -simplify-libcalls -stats</tt>"), and the report contains one line for
each column of the output. The first value is the header for the column and the
second is the regex to grep the output of the command for. There are lots of
example reports that can do fancy stuff.</p>
</div>
</div>
<!-- *********************************************************************** -->
<hr>
<address>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
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$
</address>
</body>
</html>

View File

@ -18,14 +18,13 @@
<li><a href="#org">LLVM testing infrastructure organization</a>
<ul>
<li><a href="#regressiontests">Regression tests</a></li>
<li><a href="#testsuite">Test suite</a></li>
<li><a href="#testsuite"><tt>test-suite</tt></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>
@ -37,13 +36,10 @@
<li><a href="#rtfeatures">Other features</a></li>
</ul>
</li>
<li><a href="#testsuitestructure">Test suite structure</a></li>
<li><a href="#testsuiterun">Running the test suite</a>
<li><a href="#testsuiteoverview"><tt>test-suite</tt> Overview</a>
<ul>
<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 test-suite</a></li>
<li><a href="#testsuitequickstart"><tt>test-suite</tt> Quickstart</a></li>
<li><a href="#testsuitemakefiles"><tt>test-suite</tt> Makefiles</a></li>
</ul>
</li>
</ol>
@ -85,10 +81,13 @@ as <a href="http://python.org">Python</a> 2.4 or later.</p>
<p>The LLVM testing infrastructure contains two major categories of tests:
regression tests and whole programs. The regression tests are contained inside
the LLVM repository itself under <tt>llvm/test</tt> and are expected to always
pass -- they should be run before every commit. The whole programs tests are
referred to as the "LLVM test suite" and are in the <tt>test-suite</tt> module
in subversion.
</p>
pass -- they should be run before every commit.</p>
<p>The whole programs tests are referred to as the "LLVM test suite" (or
"test-suite") and are in the <tt>test-suite</tt> module in subversion. For
historical reasons, these tests are also referred to as the "nightly tests" in
places, which is less ambiguous than "test-suite" and remains in use although we
run them much more often than nightly.</p>
<!-- _______________________________________________________________________ -->
<h3><a name="regressiontests">Regression tests</a></h3>
@ -118,20 +117,19 @@ application or benchmark.</p>
</div>
<!-- _______________________________________________________________________ -->
<h3><a name="testsuite">Test suite</a></h3>
<h3><a name="testsuite"><tt>test-suite</tt></a></h3>
<!-- _______________________________________________________________________ -->
<div>
<p>The test suite contains whole programs, which are pieces of
code which can be compiled and linked into a stand-alone program that can be
executed. These programs are generally written in high level languages such as
C or C++, but sometimes they are written straight in LLVM assembly.</p>
<p>The test suite contains whole programs, which are pieces of code which can be
compiled and linked into a stand-alone program that can be executed. These
programs are generally written in high level languages such as C or C++.</p>
<p>These programs are compiled and then executed using several different
methods (native compiler, LLVM C backend, LLVM JIT, LLVM native code generation,
etc). The output of these programs is compared to ensure that LLVM is compiling
the program correctly.</p>
<p>These programs are compiled using a user specified compiler and set of flags,
and then executed to capture the program output and timing information. The
output of these programs is compared to a reference output to ensure that the
program is being compiled correctly.</p>
<p>In addition to compiling and executing programs, whole program tests serve as
a way of benchmarking LLVM performance, both in terms of the efficiency of the
@ -168,15 +166,14 @@ test suite for more information . This test suite is located in the
<p>The tests are located in two separate Subversion modules. The regressions
tests are in the main "llvm" module under the directory
<tt>llvm/test</tt> (so you get these tests for free with the main llvm tree).
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
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.
Alternatively, you can configure the <tt>test-suite</tt> module manually.</p>
<tt>llvm/test</tt> (so you get these tests for free with the main llvm
tree). Use "make check-all" to run the regression tests after building
LLVM.</p>
<p>The more comprehensive test suite that includes whole programs in C and C++
is in the <tt>test-suite</tt>
module. See <a href="#testsuitequickstart"><tt>test-suite</tt> Quickstart</a>
for more information on running these tests.</p>
<!-- _______________________________________________________________________ -->
<h3><a name="quickregressiontests">Regression tests</a></h3>
@ -242,60 +239,6 @@ script which is built as part of LLVM. For example, to run the
</div>
<!-- _______________________________________________________________________ -->
<h3><a name="quicktestsuite">Test suite</a></h3>
<!-- _______________________________________________________________________ -->
<div>
<p>To run the comprehensive test suite (tests that compile and execute whole
programs), first checkout and setup the <tt>test-suite</tt> module:</p>
<div class="doc_code">
<pre>
% cd llvm/projects
% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
% cd ..
% ./configure --with-llvmgccdir=$LLVM_GCC_DIR
</pre>
</div>
<p>where <tt>$LLVM_GCC_DIR</tt> is the directory where
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++
compiler drivers are called <tt>llvm-gcc</tt> and <tt>llvm-g++</tt>
respectively. If this is not the case,
use <tt>--with-llvmgcc</tt>/<tt>--with-llvmgxx</tt> to specify each
executable's location.</p>
<p>Then, run the entire test suite by running make in the <tt>test-suite</tt>
directory:</p>
<div class="doc_code">
<pre>
% cd projects/test-suite
% gmake
</pre>
</div>
<p>Usually, running the "nightly" set of tests is a good idea, and you can also
let it generate a report by running:</p>
<div class="doc_code">
<pre>
% cd projects/test-suite
% gmake TEST=nightly report report.html
</pre>
</div>
<p>Any of the above commands can also be run in a subdirectory of
<tt>projects/test-suite</tt> to run the specified test only on the programs in
that subdirectory.</p>
</div>
<!-- _______________________________________________________________________ -->
<h3><a name="quickdebuginfotests">Debugging Information tests</a></h3>
<div>
@ -799,37 +742,10 @@ define two separate CHECK lines that match on the same line.
you need multiple temporaries. This is useful as the destination of some
redirected output.</dd>
<dt><b>llvmlibsdir</b> (%llvmlibsdir)</dt>
<dd>The directory where the LLVM libraries are located.</dd>
<dt><b>target_triplet</b> (%target_triplet)</dt>
<dd>The target triplet that corresponds to the current host machine (the one
running the test cases). This should probably be called "host".<dd>
<dt><b>llvmgcc</b> (%llvmgcc)</dt>
<dd>The full path to the <tt>llvm-gcc</tt> executable as specified in the
configured LLVM environment</dd>
<dt><b>llvmgxx</b> (%llvmgxx)</dt>
<dd>The full path to the <tt>llvm-gxx</tt> executable as specified in the
configured LLVM environment</dd>
<dt><b>gccpath</b></dt>
<dd>The full path to the C compiler used to <i>build </i> LLVM. Note that
this might not be gcc.</dd>
<dt><b>gxxpath</b></dt>
<dd>The full path to the C++ compiler used to <i>build </i> LLVM. Note that
this might not be g++.</dd>
<dt><b>compile_c</b> (%compile_c)</dt>
<dd>The full command line used to compile LLVM C source code. This has all
the configured -I, -D and optimization options.</dd>
<dt><b>compile_cxx</b> (%compile_cxx)</dt>
<dd>The full command used to compile LLVM C++ source code. This has
all the configured -I, -D and optimization options.</dd>
<dt><b>link</b> (%link)</dt>
<dd>This full link command used to link LLVM executables. This has all the
configured -I, -L and -l options.</dd>
@ -907,30 +823,15 @@ define two separate CHECK lines that match on the same line.
</div>
<!--=========================================================================-->
<h2><a name="testsuitestructure">Test suite Structure</a></h2>
<h2><a name="testsuiteoverview"><tt>test-suite</tt> Overview</a></h2>
<!--=========================================================================-->
<div>
<p>The <tt>test-suite</tt> module contains a number of programs that can be compiled
with LLVM and executed. These programs are compiled using the native compiler
and various LLVM backends. The output from the program compiled with the
native compiler is assumed correct; the results from the other programs are
compared to the native program output and pass if they match.</p>
<p>When executing tests, it is usually a good idea to start out with a subset of
the available tests or programs. This makes test run times smaller at first and
later on this is useful to investigate individual test failures. To run some
test only on a subset of programs, simply change directory to the programs you
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>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>The <tt>test-suite</tt> module contains a number of programs that can be
compiled and executed. The <tt>test-suite</tt> includes reference outputs for
all of the programs, so that the output of the executed program can be checked
for correctness.</p>
<p><tt>test-suite</tt> tests are divided into three types of tests: MultiSource,
SingleSource, and External.</p>
@ -952,248 +853,40 @@ go here.</p></li>
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 test-suite
<tt>configure</tt> script.</p></li>
how to properly compile these programs from somewhere else. When
using <tt>LNT</tt>, use the <tt>--test-externals</tt> option to include these
tests in the results.</p></li>
</ul>
<p>Each tree is then subdivided into several categories, including applications,
benchmarks, regression tests, code that is strange grammatically, etc. These
organizations should be relatively self explanatory.</p>
<p>Some tests are known to fail. Some are bugs that we have not fixed yet;
others are features that we haven't added yet (or may never add). In the
regression tests, the result for such tests will be XFAIL (eXpected FAILure).
In this way, you can tell the difference between an expected and unexpected
failure.</p>
<p>The tests in the test suite have no such feature at this time. If the
test passes, only warnings and other miscellaneous output will be generated. If
a test fails, a large &lt;program&gt; FAILED message will be displayed. This
will help you separate benign warnings from actual test failures.</p>
</div>
<!--=========================================================================-->
<h2><a name="testsuiterun">Running the test suite</a></h2>
<h2><a name="testsuitequickstart"><tt>test-suite</tt> Quickstart</a></h2>
<!--=========================================================================-->
<div>
<p>The modern way of running the <tt>test-suite</tt> is focused on testing and
benchmarking complete compilers using
the <a href="http://llvm.org/docs/lnt">LNT</a> testing infrastructure.</p>
<p>First, all tests are executed within the LLVM object directory tree. They
<i>are not</i> executed inside of the LLVM source tree. This is because the
test suite creates temporary files during execution.</p>
<p>To run the test suite, you need to use the following steps:</p>
<ol>
<li><tt>cd</tt> into the <tt>llvm/projects</tt> directory in your source tree.
</li>
<li><p>Check out the <tt>test-suite</tt> module with:</p>
<div class="doc_code">
<pre>
% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
</pre>
<p>For more information on using LNT to execute the <tt>test-suite</tt>, please
see the <a href="http://llvm.org/docs/lnt/quickstart.html">LNT Quickstart</a>
documentation.</p>
</div>
<p>This will get the test suite into <tt>llvm/projects/test-suite</tt>.</p>
</li>
<li><p>Configure and build <tt>llvm</tt>.</p></li>
<li><p>Configure and build <tt>llvm-gcc</tt>.</p></li>
<li><p>Install <tt>llvm-gcc</tt> somewhere.</p></li>
<li><p><em>Re-configure</em> <tt>llvm</tt> from the top level of
each build tree (LLVM object directory tree) in which you want
to run the test suite, just as you do before building LLVM.</p>
<p>During the <em>re-configuration</em>, you must either: (1)
have <tt>llvm-gcc</tt> you just built in your path, or (2)
specify the directory where your just-built <tt>llvm-gcc</tt> is
installed using <tt>--with-llvmgccdir=$LLVM_GCC_DIR</tt>.</p>
<p>You must also tell the configure machinery that the test suite
is available so it can be configured for your build tree:</p>
<div class="doc_code">
<pre>
% cd $LLVM_OBJ_ROOT ; $LLVM_SRC_ROOT/configure [--with-llvmgccdir=$LLVM_GCC_DIR]
</pre>
</div>
<p>[Remember that <tt>$LLVM_GCC_DIR</tt> is the directory where you
<em>installed</em> llvm-gcc, not its src or obj directory.]</p>
</li>
<li><p>You can now run the test suite from your build tree as follows:</p>
<div class="doc_code">
<pre>
% cd $LLVM_OBJ_ROOT/projects/test-suite
% make
</pre>
</div>
</li>
</ol>
<p>Note that the second and third steps only need to be done once. After you
have the suite checked out and configured, you don't need to do it again (unless
the test code or configure script changes).</p>
<!-- _______________________________________________________________________ -->
<h3>
<a name="testsuiteexternal">Configuring External Tests</a>
</h3>
<!-- _______________________________________________________________________ -->
<!--=========================================================================-->
<h2><a name="testsuitemakefiles"><tt>test-suite</tt> Makefiles</a></h2>
<!--=========================================================================-->
<div>
<p>In order to run the External tests in the <tt>test-suite</tt>
module, you must specify <i>--with-externals</i>. This
must be done during the <em>re-configuration</em> step (see above),
and the <tt>llvm</tt> re-configuration must recognize the
previously-built <tt>llvm-gcc</tt>. If any of these is missing or
neglected, the External tests won't work.</p>
<dl>
<dt><i>--with-externals</i></dt>
<dt><i>--with-externals=&lt;<tt>directory</tt>&gt;</i></dt>
</dl>
This tells LLVM where to find any external tests. They are expected to be
in specifically named subdirectories of &lt;<tt>directory</tt>&gt;.
If <tt>directory</tt> is left unspecified,
<tt>configure</tt> uses the default value
<tt>/home/vadve/shared/benchmarks/speccpu2000/benchspec</tt>.
Subdirectory names known to LLVM include:
<dl>
<dt>spec95</dt>
<dt>speccpu2000</dt>
<dt>speccpu2006</dt>
<dt>povray31</dt>
</dl>
Others are added from time to time, and can be determined from
<tt>configure</tt>.
</div>
<!-- _______________________________________________________________________ -->
<h3>
<a name="testsuitetests">Running different tests</a>
</h3>
<!-- _______________________________________________________________________ -->
<div>
<p>In addition to the regular "whole program" tests, the <tt>test-suite</tt>
module also provides a mechanism for compiling the programs in different ways.
If the variable TEST is defined on the <tt>gmake</tt> command line, the test system will
include a Makefile named <tt>TEST.&lt;value of TEST variable&gt;.Makefile</tt>.
This Makefile can modify build rules to yield different results.</p>
<p>For example, the LLVM nightly tester uses <tt>TEST.nightly.Makefile</tt> to
create the nightly test reports. To run the nightly tests, run <tt>gmake
TEST=nightly</tt>.</p>
<p>There are several TEST Makefiles available in the tree. Some of them are
designed for internal LLVM research and will not work outside of the LLVM
research group. They may still be valuable, however, as a guide to writing your
own TEST Makefile for any optimization or analysis passes that you develop with
LLVM.</p>
</div>
<!-- _______________________________________________________________________ -->
<h3>
<a name="testsuiteoutput">Generating test output</a>
</h3>
<!-- _______________________________________________________________________ -->
<div>
<p>There are a number of ways to run the tests and generate output. The most
simple one is simply running <tt>gmake</tt> with no arguments. This will
compile and run all programs in the tree using a number of different methods
and compare results. Any failures are reported in the output, but are likely
drowned in the other output. Passes are not reported explicitely.</p>
<p>Somewhat better is running <tt>gmake TEST=sometest test</tt>, which runs
the specified test and usually adds per-program summaries to the output
(depending on which sometest you use). For example, the <tt>nightly</tt> test
explicitely outputs TEST-PASS or TEST-FAIL for every test after each program.
Though these lines are still drowned in the output, it's easy to grep the
output logs in the Output directories.</p>
<p>Even better are the <tt>report</tt> and <tt>report.format</tt> targets
(where <tt>format</tt> is one of <tt>html</tt>, <tt>csv</tt>, <tt>text</tt> or
<tt>graphs</tt>). The exact contents of the report are dependent on which
<tt>TEST</tt> you are running, but the text results are always shown at the
end of the run and the results are always stored in the
<tt>report.&lt;type&gt;.format</tt> file (when running with
<tt>TEST=&lt;type&gt;</tt>).
The <tt>report</tt> also generate a file called
<tt>report.&lt;type&gt;.raw.out</tt> containing the output of the entire test
run.
</div>
<!-- _______________________________________________________________________ -->
<h3>
<a name="testsuitecustom">Writing custom tests for the test suite</a>
</h3>
<!-- _______________________________________________________________________ -->
<div>
<p>Assuming you can run the test suite, (e.g. "<tt>gmake TEST=nightly report</tt>"
should work), it is really easy to run optimizations or code generator
components against every program in the tree, collecting statistics or running
custom checks for correctness. At base, this is how the nightly tester works,
it's just one example of a general framework.</p>
<p>Lets say that you have an LLVM optimization pass, and you want to see how
many times it triggers. First thing you should do is add an LLVM
<a href="ProgrammersManual.html#Statistic">statistic</a> to your pass, which
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, a
"<tt>test-suite/TEST.XXX.Makefile</tt>" fragment (where XXX is the name of your
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>
<p>If you are interested in testing an optimization pass, check out the
"libcalls" test as an example. It can be run like this:<p>
<div class="doc_code">
<pre>
% cd llvm/projects/test-suite/MultiSource/Benchmarks # or some other level
% make TEST=libcalls report
</pre>
</div>
<p>This will do a bunch of stuff, then eventually print a table like this:</p>
<div class="doc_code">
<pre>
Name | total | #exit |
...
FreeBench/analyzer/analyzer | 51 | 6 |
FreeBench/fourinarow/fourinarow | 1 | 1 |
FreeBench/neural/neural | 19 | 9 |
FreeBench/pifft/pifft | 5 | 3 |
MallocBench/cfrac/cfrac | 1 | * |
MallocBench/espresso/espresso | 52 | 12 |
MallocBench/gs/gs | 4 | * |
Prolangs-C/TimberWolfMC/timberwolfmc | 302 | * |
Prolangs-C/agrep/agrep | 33 | 12 |
Prolangs-C/allroots/allroots | * | * |
Prolangs-C/assembler/assembler | 47 | * |
Prolangs-C/bison/mybison | 74 | * |
...
</pre>
</div>
<p>This basically is grepping the -stats output and displaying it in a table.
You can also use the "TEST=libcalls report.html" target to get the table in HTML
form, similarly for report.csv and report.tex.</p>
<p>The source for this is in test-suite/TEST.libcalls.*. The format is pretty
simple: the Makefile indicates how to run the test (in this case,
"<tt>opt -simplify-libcalls -stats</tt>"), and the report contains one line for
each column of the output. The first value is the header for the column and the
second is the regex to grep the output of the command for. There are lots of
example reports that can do fancy stuff.</p>
</div>
<p>Historically, the <tt>test-suite</tt> was executed using a complicated setup
of Makefiles. The LNT based approach above is recommended for most users, but
there are some testing scenarios which are not supported by the LNT approach. In
addition, LNT currently uses the Makefile setup under the covers and so
developers who are interested in how LNT works under the hood may want to
understand the Makefile based setup.</p>
<p>For more information on the <tt>test-suite</tt> Makefile setup, please see
the <a href="TestSuiteMakefileGuide.html">Test Suite Makefile Guide.</a></p>
</div>
<!-- *********************************************************************** -->
@ -1207,7 +900,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: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $
Last modified: $Date: 2012-03-27 13:25:16 +0200 (Tue, 27 Mar 2012) $
</address>
</body>
</html>

View File

@ -1,448 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Using The LLVM Libraries</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>
<h1>Using The LLVM Libraries</h1>
<ol>
<li><a href="#abstract">Abstract</a></li>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#descriptions">Library Descriptions</a></li>
<li><a href="#dependencies">Library Dependencies</a></li>
<li><a href="#rot">Linkage Rules Of Thumb</a>
<ol>
<li><a href="#always">Always link LLVMCore, LLVMSupport, LLVMSystem</a>
<li><a href="#onlyone">Never link both archive and re-linked</a>
</ol>
</li>
</ol>
<div class="doc_author">
<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, 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>
<!-- ======================================================================= -->
<h2><a name="abstract">Abstract</a></h2>
<div>
<p>Amongst other things, LLVM is a toolkit for building compilers, linkers,
runtime executives, virtual machines, and other program execution related
tools. In addition to the LLVM tool set, the functionality of LLVM is
available through a set of libraries. To use LLVM as a toolkit for
constructing tools, a developer needs to understand what is contained in the
various libraries, what they depend on, and how to use them. Fortunately,
there is a tool, <tt>llvm-config</tt> to aid with this. This document
describes the contents of the libraries and how to use <tt>llvm-config</tt>
to generate command line options.
</p>
</div>
<!-- ======================================================================= -->
<h2><a name="introduction">Introduction</a></h2>
<div>
<p>If you're writing a compiler, virtual machine, or any other utility based
on LLVM, you'll need to figure out which of the many libraries files you will
need to link with to be successful. An understanding of the contents of these
libraries will be useful in coming up with an optimal specification for the
libraries to link with. The purpose of this document is to reduce some of
the trial and error that the author experienced in using LLVM.</p>
<p>LLVM produces two types of libraries: archives (ending in <tt>.a</tt>) and
objects (ending in <tt>.o</tt>). However, both are libraries. Libraries ending
in <tt>.o</tt> are known as re-linked libraries because they contain all the
compilation units of the library linked together as a single <tt>.o</tt> file.
Furthermore, several of the libraries have <em>both</em> forms of library. The
re-linked libraries are used whenever you want to include all symbols from the
library. The archive libraries are used whenever you want to only resolve
outstanding symbols at that point in the link without including everything in
the library. </p>
<p>If you're using the LLVM Makefile system to link your tools,you will use
the <tt>LLVMLIBS</tt> make variable.
(see the <a href="MakefileGuide.html#LLVMLIBS">Makefile Guide</a> for
details). This variable specifies which LLVM libraries to link into your tool
and the order in which they will be linked. You specify re-linked libraries by
naming the library without a suffix. You specify archive libraries by naming
the library with a <tt>.a</tt> suffix but without the <tt>lib</tt> prefix. The
order in which the libraries appear in the <tt>LLVMLIBS</tt> variable
definition is the order in which they will be linked. Getting this order
correct for your tool can sometimes be challenging.
</div>
<!-- ======================================================================= -->
<h2><a name="descriptions">Library Descriptions</a></h2>
<div>
<p>The table below categorizes each library
<table style="text-align:left">
<tr><th>Library</th><th>Forms</th><th>Description</th></tr>
<tr><th colspan="3">Core Libraries</th></tr>
<tr><td>LLVMArchive</td><td><tt>.a</tt></td>
<td>LLVM archive reading and writing</td></tr>
<tr><td>LLVMAsmParser</td><td><tt>.a</tt></td>
<td>LLVM assembly parsing</td></tr>
<tr><td>LLVMBCReader</td><td><tt>.a</tt></td>
<td>LLVM bitcode reading</td></tr>
<tr><td>LLVMBCWriter</td><td><tt>.a</tt></td>
<td>LLVM bitcode writing</td></tr>
<tr><td>LLVMCore</td><td><tt>.a</tt></td>
<td>LLVM core intermediate representation</td></tr>
<tr><td>LLVMDebugger</td><td><tt>.a</tt></td>
<td>Source level debugging support</td></tr>
<tr><td>LLVMLinker</td><td><tt>.a</tt></td>
<td>Bitcode and archive linking interface</td></tr>
<tr><td>LLVMSupport</td><td><tt>.a</tt></td>
<td>General support utilities</td></tr>
<tr><td>LLVMSystem</td><td><tt>.a</tt></td>
<td>Operating system abstraction layer</td></tr>
<tr><td>LLVMbzip2</td><td><tt>.a</tt></td>
<td>BZip2 compression library</td></tr>
<tr><th colspan="3">Analysis Libraries</th></tr>
<tr><td>LLVMAnalysis</td><td><tt>.a</tt></td>
<td>Various analysis passes.</td></tr>
<tr><td>LLVMDataStructure</td><td><tt>.o</tt></td>
<td>Data structure analysis passes.</td></tr>
<tr><td>LLVMipa</td><td><tt>.a</tt></td>
<td>Inter-procedural analysis passes.</td></tr>
<tr><th colspan="3">Transformation Libraries</th></tr>
<tr><td>LLVMInstrumentation</td><td><tt>.a</tt></td>
<td>Instrumentation passes.</td></tr>
<tr><td>LLVMipo</td><td><tt>.a</tt></td>
<td>All inter-procedural optimization passes.</td></tr>
<tr><td>LLVMScalarOpts</td><td><tt>.a</tt></td>
<td>All scalar optimization passes.</td></tr>
<tr><td>LLVMTransformUtils</td><td><tt>.a</tt></td>
<td>Transformation utilities used by many passes.</td></tr>
<tr><th colspan="3">Code Generation Libraries </th></tr>
<tr><td>LLVMCodeGen</td><td><tt>.o</tt></td>
<td>Native code generation infrastructure</td></tr>
<tr><td>LLVMSelectionDAG</td><td><tt>.o</tt></td>
<td>Aggressive instruction selector for directed acyclic graphs</td></tr>
<tr><th colspan="3">Target Libraries</th></tr>
<tr><td>LLVMAlpha</td><td><tt>.o</tt></td>
<td>Code generation for Alpha architecture</td></tr>
<tr><td>LLVMARM</td><td><tt>.o</tt></td>
<td>Code generation for ARM architecture</td></tr>
<tr><td>LLVMCBackend</td><td><tt>.o</tt></td>
<td>'C' language code generator.</td></tr>
<tr><td>LLVMPowerPC</td><td><tt>.o</tt></td>
<td>Code generation for PowerPC architecture</td></tr>
<tr><td>LLVMSparc</td><td><tt>.o</tt></td>
<td>Code generation for Sparc architecture</td></tr>
<tr><td>LLVMTarget</td><td><tt>.a</tt></td>
<td>Generic code generation utilities.</td></tr>
<tr><td>LLVMX86</td><td><tt>.o</tt></td>
<td>Code generation for Intel x86 architecture</td></tr>
<tr><th colspan="3">Runtime Libraries</th></tr>
<tr><td>LLVMInterpreter</td><td><tt>.o</tt></td>
<td>Bitcode Interpreter</td></tr>
<tr><td>LLVMJIT</td><td><tt>.o</tt></td>
<td>Bitcode JIT Compiler</td></tr>
<tr><td>LLVMExecutionEngine</td><td><tt>.o</tt></td>
<td>Virtual machine engine</td></tr>
</table>
</div>
<!-- ======================================================================= -->
<h2><a name="dependencies">Using llvm-config</a></h2>
<div>
<p>The <tt>llvm-config</tt> tool is a perl script that produces on its output
various kinds of information. For example, the source or object directories
used to build LLVM can be accessed by passing options to <tt>llvm-config</tt>.
For complete details on this tool, please see the
<a href="CommandGuide/html/llvm-config.html">manual page</a>.</p>
<p>To understand the relationships between libraries, the <tt>llvm-config</tt>
can be very useful. If all you know is that you want certain libraries to
be available, you can generate the complete set of libraries to link with
using one of four options, as below:</p>
<ol>
<li><tt>--ldflags</tt>. This generates the command line options necessary to
be passed to the <tt>ld</tt> tool in order to link with LLVM. Most notably,
the <tt>-L</tt> option is provided to specify a library search directory
that contains the LLVM libraries.</li>
<li><tt>--libs</tt>. This generates command line options suitable for
use with a gcc-style linker. That is, libraries are given with a -l option
and object files are given with a full path.</li>
<li><tt>--libnames</tt>. This generates a list of just the library file
names. If you know the directory in which these files reside (see --ldflags)
then you can find the libraries there.</li>
<li><tt>--libfiles</tt>. This generates the full path names of the
LLVM library files.</li>
</ol>
<p>If you wish to delve further into how <tt>llvm-config</tt> generates the
correct order (based on library dependencies), please see the tool named
<tt>GenLibDeps.pl</tt> in the <tt>utils</tt> source directory of LLVM.</p>
<!-- =======NOTE: =========================================================-->
<!-- === The following graphs and <dl> list are generated automatically ===-->
<!-- === by the util named GenLibDeps.pl in the llvm/utils directory. ===-->
<!-- === This should be updated whenever new libraries are added, ===-->
<!-- === removed, or changed ===-->
<!-- =======NOTE: =========================================================-->
<h3>Dependency Relationships Of Libraries</h3>
<p>This graph shows the dependency of archive libraries on other archive
libraries or objects. Where a library has both archive and object forms, only
the archive form is shown.</p>
<img src="img/libdeps.gif" alt="Library Dependencies">
<h3>Dependency Relationships Of Object Files</h3>
<p>This graph shows the dependency of object files on archive libraries or
other objects. Where a library has both object and archive forms, only the
dependency to the archive form is shown.</p>
<img src="img/objdeps.gif" alt="Object File Dependencies">
<p>The following list shows the dependency relationships between libraries in
textual form. The information is the same as shown on the graphs but arranged
alphabetically.</p>
<dl>
<dt><b>libLLVMAnalysis.a</b></dt><dd><ul>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
</ul></dd>
<dt><b>libLLVMArchive.a</b></dt><dd><ul>
<li>libLLVMBCReader.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
</ul></dd>
<dt><b>libLLVMAsmParser.a</b></dt><dd><ul>
<li>libLLVMCore.a</li>
<li>libLLVMSystem.a</li>
</ul></dd>
<dt><b>libLLVMBCReader.a</b></dt><dd><ul>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
</ul></dd>
<dt><b>libLLVMBCWriter.a</b></dt><dd><ul>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
</ul></dd>
<dt><b>libLLVMCodeGen.a</b></dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
</ul></dd>
<dt><b>libLLVMCore.a</b></dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
</ul></dd>
<dt><b>libLLVMDebugger.a</b></dt><dd><ul>
<li>libLLVMBCReader.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
</ul></dd>
<dt><b>libLLVMInstrumentation.a</b></dt><dd><ul>
<li>libLLVMCore.a</li>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTransformUtils.a</li>
</ul></dd>
<dt><b>libLLVMLinker.a</b></dt><dd><ul>
<li>libLLVMArchive.a</li>
<li>libLLVMBCReader.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
</ul></dd>
<dt><b>libLLVMScalarOpts.a</b></dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
</ul></dd>
<dt><b>libLLVMSelectionDAG.a</b></dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMCodeGen.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
</ul></dd>
<dt><b>libLLVMSupport.a</b></dt><dd><ul>
<li>libLLVMSystem.a</li>
<li>libLLVMbzip2.a</li>
</ul></dd>
<dt><b>libLLVMSystem.a</b></dt><dd>
</dd>
<dt><b>libLLVMTarget.a</b></dt><dd><ul>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
</ul></dd>
<dt><b>libLLVMTransformUtils.a</b></dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMipa.a</li>
</ul></dd>
<dt><b>libLLVMbzip2.a</b></dt><dd>
</dd>
<dt><b>libLLVMipa.a</b></dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
</ul></dd>
<dt><b>libLLVMipo.a</b></dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
<li>libLLVMipa.a</li>
</ul></dd>
<dt><b>libLLVMlto.a</b></dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMBCReader.a</li>
<li>libLLVMBCWriter.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMLinker.a</li>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMipa.a</li>
<li>libLLVMipo.a</li>
</ul></dd>
<dt><b>LLVMARM.o</b></dt><dd><ul>
<li>libLLVMCodeGen.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSelectionDAG.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
</ul></dd>
<dt><b>LLVMAlpha.o</b></dt><dd><ul>
<li>libLLVMCodeGen.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSelectionDAG.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
</ul></dd>
<dt><b>LLVMCBackend.o</b></dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMCodeGen.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
<li>libLLVMipa.a</li>
</ul></dd>
<dt><b>LLVMExecutionEngine.o</b></dt><dd><ul>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
</ul></dd>
<dt><b>LLVMInterpreter.o</b></dt><dd><ul>
<li>LLVMExecutionEngine.o</li>
<li>libLLVMCodeGen.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
</ul></dd>
<dt><b>LLVMJIT.o</b></dt><dd><ul>
<li>LLVMExecutionEngine.o</li>
<li>libLLVMCore.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
</ul></dd>
<dt><b>LLVMPowerPC.o</b></dt><dd><ul>
<li>libLLVMCodeGen.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSelectionDAG.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
</ul></dd>
<dt><b>LLVMSparc.o</b></dt><dd><ul>
<li>libLLVMCodeGen.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSelectionDAG.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
</ul></dd>
<dt><b>LLVMX86.o</b></dt><dd><ul>
<li>libLLVMCodeGen.a</li>
<li>libLLVMCore.a</li>
<li>libLLVMSelectionDAG.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
</ul></dd>
</dl>
</div>
<!-- ======================================================================= -->
<h2><a name="rot">Linkage Rules Of Thumb</a></h2>
<div>
<p>This section contains various "rules of thumb" about what files you
should link into your programs.</p>
<!-- ======================================================================= -->
<h3>
<a name="always">Always Link LLVMCore, LLVMSupport, and LLVMSystem</a>
</h3>
<div>
<p>No matter what you do with LLVM, the last three entries in the value of
your LLVMLIBS make variable should always be:
<tt>LLVMCore LLVMSupport.a LLVMSystem.a</tt>. There are no <tt>LLVM</tt>
programs that don't depend on these three.</p>
</div>
<!-- ======================================================================= -->
<h3>
<a name="onlyone">Never link both archive and re-linked library</a>
</h3>
<div>
<p>There is never any point to linking both the re-linked (<tt>.o</tt>) and
the archive (<tt>.a</tt>) versions of a library. Since the re-linked version
includes the entire library, the archive version will not resolve any symbols.
You could even end up with link error if you place the archive version before
the re-linked version on the linker's command line.</p>
</div>
</div>
<!-- ======================================================================= -->
<hr>
<div class="doc_footer">
<address>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
<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="mailto:rspencer@x10sys.com">Reid Spencer</a>
</address>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a>
<br>Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $ </div>
</body>
</html>
<!-- vim: sw=2 ts=2 ai
-->

View File

@ -77,7 +77,7 @@ either assembly code or binary code (usable for a JIT compiler).
<p>
The backend of LLVM features a target-independent code generator that may create
output for several types of target CPUs &mdash; including X86, PowerPC, Alpha,
output for several types of target CPUs &mdash; including X86, PowerPC, ARM,
and SPARC. The backend may also be used to generate code targeted at SPUs of the
Cell processor or GPUs to support the execution of compute kernels.
</p>
@ -2526,7 +2526,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: 2011-06-16 01:28:14 +0200 (Thu, 16 Jun 2011) $
Last modified: $Date: 2012-03-01 16:14:19 +0100 (Thu, 01 Mar 2012) $
</address>
</body>

View File

@ -417,17 +417,17 @@ USAGE: opt [options] &lt;input bitcode&gt;
OPTIONS:
Optimizations available:
...
-funcresolve - Resolve Functions
-gcse - Global Common Subexpression Elimination
-globaldce - Dead Global Elimination
<b>-hello - Hello World Pass</b>
-indvars - Canonicalize Induction Variables
-inline - Function Integration/Inlining
-instcombine - Combine redundant instructions
-globalopt - Global Variable Optimizer
-globalsmodref-aa - Simple mod/ref analysis for globals
-gvn - Global Value Numbering
<b>-hello - Hello World Pass</b>
-indvars - Induction Variable Simplification
-inline - Function Integration/Inlining
-insert-edge-profiling - Insert instrumentation for edge profiling
...
</pre></div>
<p>The pass name get added as the information string for your pass, giving some
<p>The pass name gets added as the information string for your pass, giving some
documentation to users of <tt>opt</tt>. Now that you have a working pass, you
would go ahead and make it do the cool transformations you want. Once you get
it all working and tested, it may become useful to find out how fast your pass
@ -545,7 +545,7 @@ following signature:</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnModule(Module &amp;M) = 0;
<b>virtual bool</b> runOnModule(Module &amp;M) = 0;
</pre></div>
<p>The <tt>runOnModule</tt> method performs the interesting work of the pass.
@ -612,7 +612,7 @@ false if they didn't.</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doInitialization(CallGraph &amp;CG);
<b>virtual bool</b> doInitialization(CallGraph &amp;CG);
</pre></div>
<p>The <tt>doIninitialize</tt> method is allowed to do most of the things that
@ -633,7 +633,7 @@ fast).</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnSCC(CallGraphSCC &amp;SCC) = 0;
<b>virtual bool</b> runOnSCC(CallGraphSCC &amp;SCC) = 0;
</pre></div>
<p>The <tt>runOnSCC</tt> method performs the interesting work of the pass, and
@ -652,7 +652,7 @@ otherwise.</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doFinalization(CallGraph &amp;CG);
<b>virtual bool</b> doFinalization(CallGraph &amp;CG);
</pre></div>
<p>The <tt>doFinalization</tt> method is an infrequently used method that is
@ -704,7 +704,7 @@ should return true if they modified the program, or false if they didn't.</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doInitialization(Module &amp;M);
<b>virtual bool</b> doInitialization(Module &amp;M);
</pre></div>
<p>The <tt>doIninitialize</tt> method is allowed to do most of the things that
@ -732,7 +732,7 @@ free functions that it needs, adding prototypes to the module if necessary.</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnFunction(Function &amp;F) = 0;
<b>virtual bool</b> runOnFunction(Function &amp;F) = 0;
</pre></div><p>
<p>The <tt>runOnFunction</tt> method must be implemented by your subclass to do
@ -751,7 +751,7 @@ be returned if the function is modified.</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doFinalization(Module &amp;M);
<b>virtual bool</b> doFinalization(Module &amp;M);
</pre></div>
<p>The <tt>doFinalization</tt> method is an infrequently used method that is
@ -790,7 +790,7 @@ program, or false if they didn't. </p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doInitialization(Loop *, LPPassManager &amp;LPM);
<b>virtual bool</b> doInitialization(Loop *, LPPassManager &amp;LPM);
</pre></div>
<p>The <tt>doInitialization</tt> method is designed to do simple initialization
@ -811,7 +811,7 @@ information.</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnLoop(Loop *, LPPassManager &amp;LPM) = 0;
<b>virtual bool</b> runOnLoop(Loop *, LPPassManager &amp;LPM) = 0;
</pre></div><p>
<p>The <tt>runOnLoop</tt> method must be implemented by your subclass to do
@ -829,7 +829,7 @@ should be used to update loop nest.</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doFinalization();
<b>virtual bool</b> doFinalization();
</pre></div>
<p>The <tt>doFinalization</tt> method is an infrequently used method that is
@ -869,7 +869,7 @@ methods should return true if they modified the program, or false if they didn n
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doInitialization(Region *, RGPassManager &amp;RGM);
<b>virtual bool</b> doInitialization(Region *, RGPassManager &amp;RGM);
</pre></div>
<p>The <tt>doInitialization</tt> method is designed to do simple initialization
@ -890,7 +890,7 @@ information.</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnRegion(Region *, RGPassManager &amp;RGM) = 0;
<b>virtual bool</b> runOnRegion(Region *, RGPassManager &amp;RGM) = 0;
</pre></div><p>
<p>The <tt>runOnRegion</tt> method must be implemented by your subclass to do
@ -908,7 +908,7 @@ should be used to update region tree.</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doFinalization();
<b>virtual bool</b> doFinalization();
</pre></div>
<p>The <tt>doFinalization</tt> method is an infrequently used method that is
@ -957,7 +957,7 @@ href="#FunctionPass"><tt>FunctionPass</tt></a>'s have, but also have the followi
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doInitialization(Function &amp;F);
<b>virtual bool</b> doInitialization(Function &amp;F);
</pre></div>
<p>The <tt>doIninitialize</tt> method is allowed to do most of the things that
@ -978,7 +978,7 @@ fast).</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnBasicBlock(BasicBlock &amp;BB) = 0;
<b>virtual bool</b> runOnBasicBlock(BasicBlock &amp;BB) = 0;
</pre></div>
<p>Override this function to do the work of the <tt>BasicBlockPass</tt>. This
@ -998,7 +998,7 @@ if the basic block is modified.</p>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doFinalization(Function &amp;F);
<b>virtual bool</b> doFinalization(Function &amp;F);
</pre></div>
<p>The <tt>doFinalization</tt> method is an infrequently used method that is
@ -1051,7 +1051,7 @@ data)</li>
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnMachineFunction(MachineFunction &amp;MF) = 0;
<b>virtual bool</b> runOnMachineFunction(MachineFunction &amp;MF) = 0;
</pre></div>
<p><tt>runOnMachineFunction</tt> can be considered the main entry point of a
@ -1104,7 +1104,7 @@ implement the virtual <tt>print</tt> method:</p>
<div>
<div class="doc_code"><pre>
<b>virtual void</b> print(std::ostream &amp;O, <b>const</b> Module *M) <b>const</b>;
<b>virtual void</b> print(std::ostream &amp;O, <b>const</b> Module *M) <b>const</b>;
</pre></div>
<p>The <tt>print</tt> method must be implemented by "analyses" in order to print
@ -1154,7 +1154,7 @@ having any prerequisite passes, and invalidating <b>all</b> other passes.</p>
<div>
<div class="doc_code"><pre>
<b>virtual void</b> getAnalysisUsage(AnalysisUsage &amp;Info) <b>const</b>;
<b>virtual void</b> getAnalysisUsage(AnalysisUsage &amp;Info) <b>const</b>;
</pre></div>
<p>By implementing the <tt>getAnalysisUsage</tt> method, the required and
@ -1242,11 +1242,11 @@ the fact that it hacks on the CFG.
<div>
<div class="doc_code"><pre>
<i>// This example modifies the program, but does not modify the CFG</i>
<b>void</b> <a href="http://llvm.org/doxygen/structLICM.html">LICM</a>::getAnalysisUsage(AnalysisUsage &amp;AU) <b>const</b> {
AU.setPreservesCFG();
AU.addRequired&lt;<a href="http://llvm.org/doxygen/classllvm_1_1LoopInfo.html">LoopInfo</a>&gt;();
}
<i>// This example modifies the program, but does not modify the CFG</i>
<b>void</b> <a href="http://llvm.org/doxygen/structLICM.html">LICM</a>::getAnalysisUsage(AnalysisUsage &amp;AU) <b>const</b> {
AU.setPreservesCFG();
AU.addRequired&lt;<a href="http://llvm.org/doxygen/classllvm_1_1LoopInfo.html">LoopInfo</a>&gt;();
}
</pre></div>
</div>
@ -1268,10 +1268,10 @@ method. It takes a single template argument that specifies which pass class you
want, and returns a reference to that pass. For example:</p>
<div class="doc_code"><pre>
bool LICM::runOnFunction(Function &amp;F) {
LoopInfo &amp;LI = getAnalysis&lt;LoopInfo&gt;();
...
}
bool LICM::runOnFunction(Function &amp;F) {
LoopInfo &amp;LI = getAnalysis&lt;LoopInfo&gt;();
...
}
</pre></div>
<p>This method call returns a reference to the pass desired. You may get a
@ -1285,11 +1285,11 @@ A module level pass can use function level analysis info using this interface.
For example:</p>
<div class="doc_code"><pre>
bool ModuleLevelPass::runOnModule(Module &amp;M) {
...
DominatorTree &amp;DT = getAnalysis&lt;DominatorTree&gt;(Func);
...
}
bool ModuleLevelPass::runOnModule(Module &amp;M) {
...
DominatorTree &amp;DT = getAnalysis&lt;DominatorTree&gt;(Func);
...
}
</pre></div>
<p>In above example, runOnFunction for DominatorTree is called by pass manager
@ -1302,11 +1302,11 @@ If your pass is capable of updating analyses if they exist (e.g.,
if it is active. For example:</p>
<div class="doc_code"><pre>
...
if (DominatorSet *DS = getAnalysisIfAvailable&lt;DominatorSet&gt;()) {
<i>// A DominatorSet is active. This code will update it.</i>
}
...
...
if (DominatorSet *DS = getAnalysisIfAvailable&lt;DominatorSet&gt;()) {
<i>// A DominatorSet is active. This code will update it.</i>
}
...
</pre></div>
</div>
@ -1405,7 +1405,7 @@ Unlike registration of passes, there is no command line argument to be specified
for the Analysis Group Interface itself, because it is "abstract":</p>
<div class="doc_code"><pre>
<b>static</b> RegisterAnalysisGroup&lt;<a href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis</a>&gt; A("<i>Alias Analysis</i>");
<b>static</b> RegisterAnalysisGroup&lt;<a href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis</a>&gt; A("<i>Alias Analysis</i>");
</pre></div>
<p>Once the analysis is registered, passes can declare that they are valid
@ -1416,10 +1416,9 @@ implementations of the interface by using the following code:</p>
//<i> Declare that we implement the AliasAnalysis interface</i>
INITIALIZE_AG_PASS(FancyAA, <a href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis</a>, "<i>somefancyaa</i>",
"<i>A more complex alias analysis implementation</i>",
false, // <i>Is CFG Only?</i>
true, // <i>Is Analysis?</i>
false, // <i>Is default Analysis Group implementation?</i>
);
false, // <i>Is CFG Only?</i>
true, // <i>Is Analysis?</i>
false); // <i>Is default Analysis Group implementation?</i>
}
</pre></div>
@ -1436,8 +1435,7 @@ this macro.</p>
"<i>Basic Alias Analysis (default AA impl)</i>",
false, // <i>Is CFG Only?</i>
true, // <i>Is Analysis?</i>
true, // <i>Is default Analysis Group implementation?</i>
);
true); // <i>Is default Analysis Group implementation?</i>
}
</pre></div>
@ -1606,10 +1604,10 @@ we need to add the following <a
href="#getAnalysisUsage"><tt>getAnalysisUsage</tt></a> method to our pass:</p>
<div class="doc_code"><pre>
<i>// We don't modify the program, so we preserve all analyses</i>
<b>virtual void</b> getAnalysisUsage(AnalysisUsage &amp;AU) <b>const</b> {
AU.setPreservesAll();
}
<i>// We don't modify the program, so we preserve all analyses</i>
<b>virtual void</b> getAnalysisUsage(AnalysisUsage &amp;AU) <b>const</b> {
AU.setPreservesAll();
}
</pre></div>
<p>Now when we run our pass, we get this output:</p>
@ -1717,19 +1715,19 @@ machine passes. Here we will describe how to <i>register</i> a register
allocator machine pass.</p>
<p>Implement your register allocator machine pass. In your register allocator
.cpp file add the following include;</p>
<tt>.cpp</tt> file add the following include;</p>
<div class="doc_code"><pre>
#include "llvm/CodeGen/RegAllocRegistry.h"
#include "llvm/CodeGen/RegAllocRegistry.h"
</pre></div>
<p>Also in your register allocator .cpp file, define a creator function in the
form; </p>
<div class="doc_code"><pre>
FunctionPass *createMyRegisterAllocator() {
return new MyRegisterAllocator();
}
FunctionPass *createMyRegisterAllocator() {
return new MyRegisterAllocator();
}
</pre></div>
<p>Note that the signature of this function should match the type of
@ -1737,9 +1735,9 @@ form; </p>
"installing" declaration, in the form;</p>
<div class="doc_code"><pre>
static RegisterRegAlloc myRegAlloc("myregalloc",
" my register allocator help string",
createMyRegisterAllocator);
static RegisterRegAlloc myRegAlloc("myregalloc",
"my register allocator help string",
createMyRegisterAllocator);
</pre></div>
<p>Note the two spaces prior to the help string produces a tidy result on the
@ -1790,11 +1788,11 @@ MachinePassRegistry RegisterMyPasses::Registry;
<p>And finally, declare the command line option for your passes. Example:</p>
<div class="doc_code"><pre>
cl::opt&lt;RegisterMyPasses::FunctionPassCtor, false,
RegisterPassParser&lt;RegisterMyPasses&gt; &gt;
MyPassOpt("mypass",
cl::init(&amp;createDefaultMyPass),
cl::desc("my pass option help"));
cl::opt&lt;RegisterMyPasses::FunctionPassCtor, false,
RegisterPassParser&lt;RegisterMyPasses&gt; &gt;
MyPassOpt("mypass",
cl::init(&amp;createDefaultMyPass),
cl::desc("my pass option help"));
</pre></div>
<p>Here the command option is "mypass", with createDefaultMyPass as the default
@ -1949,7 +1947,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: 2011-10-11 09:03:52 +0200 (Tue, 11 Oct 2011) $
Last modified: $Date: 2012-04-08 13:52:52 +0200 (Sun, 08 Apr 2012) $
</address>
</body>

View File

@ -47,7 +47,7 @@ OUTPUT_DIRECTORY = @abs_top_builddir@/docs/doxygen
# source files, where putting all generated files in the same directory would
# otherwise cause performance problems for the file system.
CREATE_SUBDIRS = YES
CREATE_SUBDIRS = NO
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this

Some files were not shown because too many files have changed in this diff Show More