Vendor import of llvm trunk r130700:

http://llvm.org/svn/llvm-project/llvm/trunk@130700
This commit is contained in:
Dimitry Andric 2011-05-02 19:34:44 +00:00
parent d0e4e96dc1
commit 6b943ff3a3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/llvm/dist/; revision=221337
svn path=/vendor/llvm/llvm-r130700/; revision=221338; tag=vendor/llvm/llvm-r130700
1574 changed files with 61681 additions and 32596 deletions

View File

@ -10,7 +10,7 @@ set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
)
set(PACKAGE_VERSION "2.9")
set(PACKAGE_VERSION "3.0")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
@ -81,6 +81,9 @@ set(LLVM_ALL_TARGETS
XCore
)
# List of targets with JIT support:
set(LLVM_TARGETS_WITH_JIT X86 PowerPC ARM)
if( MSVC )
set(LLVM_TARGETS_TO_BUILD X86
CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
@ -135,9 +138,15 @@ include(AddLLVMDefinitions)
option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
include(config-ix)
# MSVC has a gazillion warnings with this.
if( MSVC )
option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF)
else( MSVC )
option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
endif()
include(HandleLLVMOptions)
option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF)
@ -145,6 +154,12 @@ else()
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
endif()
# 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)
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake
${LLVM_BINARY_DIR}/include/llvm/Config/config.h)
@ -161,16 +176,6 @@ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
# MSVC has a gazillion warnings with this.
if( MSVC )
option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF)
else( MSVC )
option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
endif()
option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR})
@ -182,15 +187,6 @@ endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
include(AddLLVM)
include(TableGen)
if( MINGW )
get_system_libs(LLVM_SYSTEM_LIBS_LIST)
foreach(l ${LLVM_SYSTEM_LIBS_LIST})
set(LLVM_SYSTEM_LIBS "${LLVM_SYSTEM_LIBS} -l${l}")
endforeach()
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES}${LLVM_SYSTEM_LIBS}")
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES}${LLVM_SYSTEM_LIBS}")
endif()
if( MINGW )
# People report that -O3 is unreliable on MinGW. The traditional
# build also uses -O2 for that reason:
@ -231,6 +227,13 @@ 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)
@ -239,7 +242,7 @@ if( LLVM_INCLUDE_EXAMPLES )
endif()
option(LLVM_BUILD_TESTS
"Build LLVM unit tests. If OFF, just generate build targes." OFF)
"Build LLVM unit tests. If OFF, just generate build targets." OFF)
if( LLVM_INCLUDE_TESTS )
add_subdirectory(test)
add_subdirectory(utils/unittest)
@ -260,6 +263,7 @@ install(DIRECTORY include/
PATTERN "*.h"
PATTERN "*.td"
PATTERN "*.inc"
PATTERN "LICENSE.TXT"
PATTERN ".svn" EXCLUDE
)

View File

@ -168,6 +168,15 @@ install-clang: install
install-clang-c: install
install-libs: install
# If SHOW_DIAGNOSTICS is enabled, clear the diagnostics file first.
ifeq ($(SHOW_DIAGNOSTICS),1)
clean-diagnostics:
$(Verb) rm -f $(LLVM_OBJ_ROOT)/$(BuildMode)/diags
.PHONY: clean-diagnostics
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
@ -198,6 +207,12 @@ ifneq ($(ENABLE_OPTIMIZED),1)
$(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
$(Echo) '*****' make an optimized build. Alternatively you can
$(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_OBJ_ROOT)/$(BuildMode)/diags; \
fi
endif
endif
endif

View File

@ -444,11 +444,11 @@ endif
# LLVM Capable Compiler
#--------------------------------------------------------------------
ifeq ($(LLVMCC_OPTION),llvm-gcc)
ifneq ($(findstring llvm-gcc,$(LLVMCC_OPTION)),)
LLVMCC := $(LLVMGCC)
LLVMCXX := $(LLVMGXX)
else
ifeq ($(LLVMCC_OPTION),clang)
ifneq ($(findstring clang,$(LLVMCC_OPTION)),)
ifneq ($(CLANGPATH),)
LLVMCC := $(CLANGPATH)
LLVMCXX := $(CLANGXXPATH)
@ -646,26 +646,42 @@ CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
$(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
$(CPP.BaseFlags)
# SHOW_DIAGNOSTICS support.
ifeq ($(SHOW_DIAGNOSTICS),1)
Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
else
Compile.Wrapper :=
endif
ifeq ($(BUILD_COMPONENT), 1)
Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
Compile.C = $(Compile.Wrapper) \
$(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
Compile.CXX = $(Compile.Wrapper) \
$(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
$(CPPFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \
Preprocess.CXX= $(Compile.Wrapper) \
$(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \
$(CompileCommonOpts) $(CXX.Flags) -E
Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
$(LDFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip)
Link = $(Compile.Wrapper) \
$(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
$(LD.Flags) $(LDFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
else
Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
Compile.C = $(Compile.Wrapper) \
$(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
Compile.CXX = $(Compile.Wrapper) \
$(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) -c
Preprocess.CXX= $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
Preprocess.CXX= $(Compile.Wrapper) \
$(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
$(CompileCommonOpts) $(CXX.Flags) -E
Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LDFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip)
Link = $(Compile.Wrapper) \
$(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
$(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
endif
BCCompile.C = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
@ -719,6 +735,24 @@ BaseNameSources := $(sort $(basename $(Sources)))
ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
#----------------------------------------------------------
# For Mingw MSYS bash and Python/w32:
#
# $(ECHOPATH) prints DOSish pathstring.
# ex) $(ECHOPATH) /include/sys/types.h
# --> C:/mingw/include/sys/types.h
# built-in "echo" does not transform path to DOSish path.
#
# FIXME: It would not be needed when MSYS's python
# were provided.
#----------------------------------------------------------
ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
ECHOPATH := $(Verb)python -u -c "import sys;print ' '.join(sys.argv[1:])"
else
ECHOPATH := $(Verb)$(ECHO)
endif
###############################################################################
# DIRECTORIES: Handle recursive descent of directory structure
###############################################################################
@ -1510,31 +1544,31 @@ BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d";
$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
$< -o $(ObjDir)/$*.ll -S -$(LLVMCC_EMITIR_FLAG) ; \
$< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
$(BC_DEPEND_MOVEFILE)
$(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
$(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
$< -o $(ObjDir)/$*.ll -S -$(LLVMCC_EMITIR_FLAG) ; \
$< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
$(BC_DEPEND_MOVEFILE)
$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
$< -o $(ObjDir)/$*.ll -S -$(LLVMCC_EMITIR_FLAG) ; \
$< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
$(BC_DEPEND_MOVEFILE)
$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
$(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
$< -o $(ObjDir)/$*.ll -S -$(LLVMCC_EMITIR_FLAG) ; \
$< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
$(BC_DEPEND_MOVEFILE)
$(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
$(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
$(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
$< -o $(ObjDir)/$*.ll -S -$(LLVMCC_EMITIR_FLAG) ; \
$< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \
$(BC_DEPEND_MOVEFILE)
# Provide alternate rule sets if dependencies are disabled
@ -1562,23 +1596,23 @@ $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
$(BCCompile.CXX) $< -o $@ -S -$(LLVMCC_EMITIR_FLAG)
$(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
$(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
$(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)"
$(BCCompile.CXX) $< -o $@ -S -$(LLVMCC_EMITIR_FLAG)
$(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
$(BCCompile.CXX) $< -o $@ -S -$(LLVMCC_EMITIR_FLAG)
$(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
$(BCCompile.C) $< -o $@ -S -$(LLVMCC_EMITIR_FLAG)
$(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
$(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
$(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)"
$(BCCompile.C) $< -o $@ -S -$(LLVMCC_EMITIR_FLAG)
$(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG)
endif
@ -1990,7 +2024,7 @@ $(DistZip) : $(TopDistDir)/.makedistdir
$(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
$(Echo) ===== DISTRIBUTION PACKAGING SUCESSFUL =====
$(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
@ -2139,8 +2173,13 @@ install-local::
$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
$(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
cd $(PROJ_SRC_ROOT)/include && \
for hdr in `find . -type f '!' '(' -name '*~' \
-o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS | \
for hdr in `find . -type f \
'(' -name LICENSE.TXT \
-o -name '*.def' \
-o -name '*.h' \
-o -name '*.inc' \
-o -name '*.td' \
')' -print | grep -v CVS | \
grep -v .svn` ; do \
instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
if test \! -d "$$instdir" ; then \
@ -2153,7 +2192,19 @@ install-local::
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
$(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
cd $(PROJ_OBJ_ROOT)/include && \
for hdr in `find . -type f -print | grep -v CVS` ; do \
for hdr in `find . -type f \
'(' -name LICENSE.TXT \
-o -name '*.def' \
-o -name '*.h' \
-o -name '*.inc' \
-o -name '*.td' \
')' -print | grep -v CVS | \
grep -v .svn` ; do \
instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
if test \! -d "$$instdir" ; then \
$(EchoCmd) Making install directory $$instdir ; \
$(MKDIR) $$instdir ;\
fi ; \
$(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
done ; \
fi

View File

@ -31,7 +31,7 @@ dnl===
dnl===-----------------------------------------------------------------------===
dnl Initialize autoconf and define the package name, version number and
dnl email address for reporting bugs.
AC_INIT([[llvm]],[[2.9svn]],[llvmbugs@cs.uiuc.edu])
AC_INIT([[llvm]],[[3.0svn]],[llvmbugs@cs.uiuc.edu])
dnl Provide a copyright substitution and ensure the copyright notice is included
dnl in the output of --version option of the generated configure script.
@ -657,12 +657,19 @@ for a_target in $TARGETS_TO_BUILD; do
LLVM_NATIVE_TARGET="LLVMInitialize${LLVM_NATIVE_ARCH}Target"
LLVM_NATIVE_TARGETINFO="LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo"
LLVM_NATIVE_ASMPRINTER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter"
if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser"
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,
[LLVM name for the native TargetInfo init function, if available])
AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPRINTER, $LLVM_NATIVE_ASMPRINTER,
[LLVM name for the native AsmPrinter init function, if available])
if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPARSER, $LLVM_NATIVE_ASMPARSER,
[LLVM name for the native AsmParser init function, if available])
fi
fi
done
@ -1422,6 +1429,24 @@ if test "$llvm_cv_os_type" = "MingW" ; then
AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2]))
fi
dnl Check Win32 API EnumerateLoadedModules.
if test "$llvm_cv_os_type" = "MingW" ; then
AC_MSG_CHECKING([whether EnumerateLoadedModules() accepts new decl])
AC_COMPILE_IFELSE([[#include <windows.h>
#include <imagehlp.h>
extern void foo(PENUMLOADED_MODULES_CALLBACK);
extern void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID));]],
[
AC_MSG_RESULT([yes])
llvm_cv_win32_elmcb_pcstr="PCSTR"
],
[
AC_MSG_RESULT([no])
llvm_cv_win32_elmcb_pcstr="PSTR"
])
AC_DEFINE_UNQUOTED([WIN32_ELMCB_PCSTR],$llvm_cv_win32_elmcb_pcstr,[Type of 1st arg on ELM Callback])
fi
dnl Check for variations in the Standard C++ library and STL. These macros are
dnl provided by LLVM in the autoconf/m4 directory.
AC_FUNC_ISNAN

View File

@ -1118,7 +1118,7 @@ if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
# We can hardcode non-existant directories.
# We can hardcode non-existent directories.
if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
# If the only mechanism to avoid hardcoding is shlibpath_var, we
# have to relink, otherwise we might link with an installed library

View File

@ -156,7 +156,7 @@ AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
osf[[1234]]*)
# dlopen did load deplibs (at least at 4.x), but until the 5.x series,
# it did *not* use an RPATH in a shared library to find objects the
# library depends on, so we explictly say `no'.
# library depends on, so we explicitly say `no'.
libltdl_cv_sys_dlopen_deplibs=no
;;
osf5.0|osf5.0a|osf5.1)

View File

@ -224,6 +224,7 @@ check_type_exists(error_t errno.h HAVE_ERROR_T)
# available programs checks
function(llvm_find_program name)
string(TOUPPER ${name} NAME)
string(REGEX REPLACE "\\." "_" NAME ${NAME})
find_program(LLVM_PATH_${NAME} ${name})
mark_as_advanced(LLVM_PATH_${NAME})
if(LLVM_PATH_${NAME})
@ -241,6 +242,7 @@ llvm_find_program(neato)
llvm_find_program(fdp)
llvm_find_program(dot)
llvm_find_program(dotty)
llvm_find_program(xdot.py)
if( LLVM_ENABLE_FFI )
find_path(FFI_INCLUDE_PATH ffi.h PATHS ${FFI_INCLUDE_DIR})
@ -269,6 +271,10 @@ if( LLVM_ENABLE_FFI )
check_symbol_exists(ffi_call ${FFI_HEADER} HAVE_FFI_CALL)
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${FFI_INCLUDE_PATH})
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${FFI_LIBRARY_PATH})
else()
unset(HAVE_FFI_FFI_H CACHE)
unset(HAVE_FFI_H CACHE)
unset(HAVE_FFI_CALL CACHE)
endif( LLVM_ENABLE_FFI )
# Define LLVM_MULTITHREADED if gcc atomic builtins exists.
@ -319,24 +325,19 @@ elseif (LLVM_NATIVE_ARCH MATCHES "xcore")
elseif (LLVM_NATIVE_ARCH MATCHES "msp430")
set(LLVM_NATIVE_ARCH MSP430)
else ()
message(STATUS
"Unknown architecture ${LLVM_NATIVE_ARCH}; lli will not JIT code")
set(LLVM_NATIVE_ARCH)
message(FATAL_ERROR "Unknown architecture ${LLVM_NATIVE_ARCH}")
endif ()
if (LLVM_NATIVE_ARCH)
list(FIND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH} NATIVE_ARCH_IDX)
if (NATIVE_ARCH_IDX EQUAL -1)
message(STATUS
"Native target ${LLVM_NATIVE_ARCH} is not selected; lli will not JIT code")
set(LLVM_NATIVE_ARCH)
else ()
message(STATUS "Native target architecture is ${LLVM_NATIVE_ARCH}")
set(LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target)
set(LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo)
set(LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter)
endif ()
endif()
list(FIND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH} NATIVE_ARCH_IDX)
if (NATIVE_ARCH_IDX EQUAL -1)
message(STATUS
"Native target ${LLVM_NATIVE_ARCH} is not selected; lli will not JIT code")
else ()
message(STATUS "Native target architecture is ${LLVM_NATIVE_ARCH}")
set(LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target)
set(LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo)
set(LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter)
endif ()
if( MINGW )
set(HAVE_LIBIMAGEHLP 1)
@ -365,6 +366,21 @@ else( MSVC )
set(LTDL_DLOPEN_DEPLIBS 0) # TODO
endif( MSVC )
if( PURE_WINDOWS )
CHECK_CXX_SOURCE_COMPILES("
#include <windows.h>
#include <imagehlp.h>
extern \"C\" void foo(PENUMLOADED_MODULES_CALLBACK);
extern \"C\" void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID));
int main(){return 0;}"
HAVE_ELMCB_PCSTR)
if( HAVE_ELMCB_PCSTR )
set(WIN32_ELMCB_PCSTR "PCSTR")
else()
set(WIN32_ELMCB_PCSTR "PSTR")
endif()
endif( PURE_WINDOWS )
# FIXME: Signal handler return type, currently hardcoded to 'void'
set(RETSIGTYPE void)

View File

@ -1,5 +1,5 @@
include(LLVMProcessSources)
include(LLVMConfig)
include(LLVM-Config)
macro(add_llvm_library name)
llvm_process_sources( ALL_FILES ${ARGN} )
@ -10,13 +10,20 @@ macro(add_llvm_library name)
endif( LLVM_COMMON_DEPENDS )
if( BUILD_SHARED_LIBS )
get_system_libs(sl)
target_link_libraries( ${name} ${sl} )
llvm_config( ${name} ${LLVM_LINK_COMPONENTS} )
endif()
install(TARGETS ${name}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
# Ensure that the system libraries always comes last on the
# list. Without this, linking the unit tests on MinGW fails.
link_system_libs( ${name} )
if( EXCLUDE_FROM_ALL )
set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON)
else()
install(TARGETS ${name}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endif()
# The LLVM Target library shall be built before its sublibraries
# (asmprinter, etc) because those may use tablegenned files which
# generation is triggered by the main LLVM target library. Necessary
@ -45,15 +52,22 @@ ${name} ignored.")
add_library( ${name} ${libkind} ${ALL_FILES} )
set_target_properties( ${name} PROPERTIES PREFIX "" )
llvm_config( ${name} ${LLVM_LINK_COMPONENTS} )
link_system_libs( ${name} )
if (APPLE)
# Darwin-specific linker flags for loadable modules.
set_target_properties(${name} PROPERTIES
LINK_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
endif()
install(TARGETS ${name}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
if( EXCLUDE_FROM_ALL )
set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON)
else()
install(TARGETS ${name}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endif()
endif()
set_target_properties(${name} PROPERTIES FOLDER "Loadable modules")
@ -68,23 +82,12 @@ macro(add_llvm_executable name)
add_executable(${name} ${ALL_FILES})
endif()
set(EXCLUDE_FROM_ALL OFF)
if( LLVM_USED_LIBS )
foreach(lib ${LLVM_USED_LIBS})
target_link_libraries( ${name} ${lib} )
endforeach(lib)
endif( LLVM_USED_LIBS )
if( LLVM_LINK_COMPONENTS )
llvm_config(${name} ${LLVM_LINK_COMPONENTS})
endif( LLVM_LINK_COMPONENTS )
target_link_libraries( ${name} ${LLVM_USED_LIBS} )
llvm_config( ${name} ${LLVM_LINK_COMPONENTS} )
if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
if( NOT MINGW )
get_system_libs(llvm_system_libs)
if( llvm_system_libs )
target_link_libraries(${name} ${llvm_system_libs})
endif()
endif()
link_system_libs( ${name} )
endmacro(add_llvm_executable name)

View File

@ -1,15 +1,22 @@
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/share/llvm/cmake")
set(LLVM_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
configure_file(
LLVM.cmake
${llvm_cmake_builddir}/LLVM.cmake
LLVMConfig.cmake.in
${llvm_cmake_builddir}/LLVMConfig.cmake
@ONLY)
configure_file(
LLVMConfigVersion.cmake.in
${llvm_cmake_builddir}/LLVMConfigVersion.cmake
@ONLY)
install(FILES
${llvm_cmake_builddir}/LLVM.cmake
LLVMConfig.cmake
${llvm_cmake_builddir}/LLVMConfig.cmake
${llvm_cmake_builddir}/LLVMConfigVersion.cmake
LLVM-Config.cmake
LLVMLibDeps.cmake
DESTINATION share/llvm/cmake)
@ -17,16 +24,11 @@ install(DIRECTORY .
DESTINATION share/llvm/cmake
FILES_MATCHING PATTERN *.cmake
PATTERN .svn EXCLUDE
PATTERN LLVM.cmake EXCLUDE
PATTERN LLVMConfig.cmake EXCLUDE
PATTERN LLVMConfigVersion.cmake EXCLUDE
PATTERN LLVM-Config.cmake EXCLUDE
PATTERN LLVMLibDeps.cmake EXCLUDE
PATTERN FindBison.cmake EXCLUDE
PATTERN GetTargetTriple.cmake EXCLUDE
PATTERN VersionFromVCS.cmake EXCLUDE
PATTERN CheckAtomic.cmake EXCLUDE)
install(FILES
${llvm_cmake_builddir}/LLVM.cmake
LLVMConfig.cmake
LLVMLibDeps.cmake
DESTINATION share/llvm/cmake)

View File

@ -84,7 +84,7 @@ if( LLVM_ENABLE_PIC )
if( SUPPORTS_FPIC_FLAG )
message(STATUS "Building with -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
else( SUPPORTS_FPIC_FLAG )
message(WARNING "-fPIC not supported.")
endif()
@ -102,6 +102,29 @@ if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
endif( LLVM_BUILD_32_BITS )
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
if( MSVC_IDE AND ( MSVC90 OR MSVC10 ) )
# Only Visual Studio 2008 and 2010 officially supports /MP.
# Visual Studio 2005 do support it but it's experimental there.
set(LLVM_COMPILER_JOBS "0" CACHE STRING
"Number of parallel compiler jobs. 0 means use all processors. Default is 0.")
if( NOT LLVM_COMPILER_JOBS STREQUAL "1" )
if( LLVM_COMPILER_JOBS STREQUAL "0" )
add_llvm_definitions( /MP )
else()
if (MSVC10)
message(FATAL_ERROR
"Due to a bug in CMake only 0 and 1 is supported for "
"LLVM_COMPILER_JOBS when generating for Visual Studio 2010")
else()
message(STATUS "Number of parallel compiler jobs set to " ${LLVM_COMPILER_JOBS})
add_llvm_definitions( /MP${LLVM_COMPILER_JOBS} )
endif()
endif()
else()
message(STATUS "Parallel compilation disabled")
endif()
endif()
if( MSVC )
include(ChooseMSVCCRT)
@ -130,7 +153,7 @@ if( MSVC )
-wd4715 # Suppress ''function' : not all control paths return a value'
-wd4800 # Suppress ''type' : forcing value to bool 'true' or 'false' (performance warning)'
-wd4065 # Suppress 'switch statement contains 'default' but no 'case' labels'
-wd4181 # Suppress 'qualifier applied to reference type; ignored'
-w14062 # Promote "enumerator in switch of enum is not handled" to level 1 warning.
)

View File

@ -16,6 +16,12 @@ function(get_system_libs return_var)
endfunction(get_system_libs)
function(link_system_libs target)
get_system_libs(llvm_system_libs)
target_link_libraries(${target} ${llvm_system_libs})
endfunction(link_system_libs)
function(is_llvm_target_library library return_var)
# Sets variable `return_var' to ON if `library' corresponds to a
# LLVM supported target. To OFF if it doesn't.
@ -23,7 +29,8 @@ function(is_llvm_target_library library return_var)
string(TOUPPER "${library}" capitalized_lib)
string(TOUPPER "${LLVM_ALL_TARGETS}" targets)
foreach(t ${targets})
if( capitalized_lib STREQUAL "LLVM${t}" OR
if( capitalized_lib STREQUAL t OR
capitalized_lib STREQUAL "LLVM${t}" OR
capitalized_lib STREQUAL "LLVM${t}CODEGEN" OR
capitalized_lib STREQUAL "LLVM${t}ASMPARSER" OR
capitalized_lib STREQUAL "LLVM${t}ASMPRINTER" OR
@ -61,6 +68,26 @@ function(explicit_map_components_to_libraries out_libs)
set( link_components ${ARGN} )
get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
string(TOUPPER "${llvm_libs}" capitalized_libs)
# Expand some keywords:
list(FIND LLVM_TARGETS_TO_BUILD "${LLVM_NATIVE_ARCH}" have_native_backend)
list(FIND link_components "engine" engine_required)
if( NOT engine_required EQUAL -1 )
list(FIND LLVM_TARGETS_WITH_JIT "${LLVM_NATIVE_ARCH}" have_jit)
if( NOT have_native_backend EQUAL -1 AND NOT have_jit EQUAL -1 )
list(APPEND link_components "jit")
list(APPEND link_components "native")
else()
list(APPEND link_components "interpreter")
endif()
endif()
list(FIND link_components "native" native_required)
if( NOT native_required EQUAL -1 )
if( NOT have_native_backend EQUAL -1 )
list(APPEND link_components ${LLVM_NATIVE_ARCH})
endif()
endif()
# Translate symbolic component names to real libraries:
foreach(c ${link_components})
# add codegen, asmprinter, asmparser, disassembler
@ -94,14 +121,13 @@ function(explicit_map_components_to_libraries out_libs)
list(APPEND expanded_components "LLVM${c}Disassembler")
endif()
elseif( c STREQUAL "native" )
list(APPEND expanded_components "LLVM${LLVM_NATIVE_ARCH}CodeGen")
# already processed
elseif( c STREQUAL "nativecodegen" )
list(APPEND expanded_components "LLVM${LLVM_NATIVE_ARCH}CodeGen")
elseif( c STREQUAL "backend" )
# same case as in `native'.
elseif( c STREQUAL "engine" )
# TODO: as we assume we are on X86, this is `jit'.
list(APPEND expanded_components "LLVMJIT")
# already processed
elseif( c STREQUAL "all" )
list(APPEND expanded_components ${llvm_libs})
else( NOT idx LESS 0 )
@ -109,7 +135,7 @@ function(explicit_map_components_to_libraries out_libs)
string(TOUPPER "${c}" capitalized)
list(FIND capitalized_libs LLVM${capitalized} lib_idx)
if( lib_idx LESS 0 )
# The component is unkown. Maybe is an ommitted target?
# The component is unknown. Maybe is an omitted target?
is_llvm_target_library(${c} iltl_result)
if( NOT iltl_result )
message(FATAL_ERROR "Library `${c}' not found in list of llvm libraries.")

View File

@ -10,6 +10,8 @@ set(LLVM_ALL_TARGETS @LLVM_ALL_TARGETS@)
set(LLVM_TARGETS_TO_BUILD @LLVM_TARGETS_TO_BUILD@)
set(LLVM_TARGETS_WITH_JIT @LLVM_TARGETS_WITH_JIT@)
set(TARGET_TRIPLE "@TARGET_TRIPLE@")
set(LLVM_TOOLS_BINARY_DIR @LLVM_TOOLS_BINARY_DIR@)
@ -20,21 +22,26 @@ set(LLVM_NATIVE_ARCH @LLVM_NATIVE_ARCH@)
set(LLVM_ENABLE_PIC @LLVM_ENABLE_PIC@)
set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS)
set(HAVE_LIBDL @HAVE_LIBDL@)
set(HAVE_LIBPTHREAD @HAVE_LIBPTHREAD)
set(HAVE_LIBPTHREAD @HAVE_LIBPTHREAD@)
set(LLVM_ON_UNIX @LLVM_ON_UNIX@)
set(LLVM_ON_WIN32 @LLVM_ON_WIN32@)
set(LLVM_INSTALL_PREFIX @LLVM_INSTALL_PREFIX@)
set(LLVM_INCLUDE_DIRS ${LLVM_INSTALL_PREFIX}/include)
set(LLVM_LIBRARY_DIRS ${LLVM_INSTALL_PREFIX}/lib)
set(LLVM_DEFINITIONS "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS")
# We try to include using the current setting of CMAKE_MODULE_PATH,
# which suppossedly was filled by the user with the directory where
# this file was installed:
include( LLVMConfig OPTIONAL RESULT_VARIABLE LLVMCONFIG_INCLUDED )
include( LLVM-Config OPTIONAL RESULT_VARIABLE LLVMCONFIG_INCLUDED )
# If failed, we assume that this is an un-installed build:
if( NOT LLVMCONFIG_INCLUDED )
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"@LLVM_SOURCE_DIR@/cmake/modules")
include( LLVMConfig )
include( LLVM-Config )
endif()

View File

@ -0,0 +1 @@
set(PACKAGE_VERSION "@PACKAGE_VERSION@")

View File

@ -30,11 +30,11 @@ set(MSVC_LIB_DEPS_LLVMLinker LLVMArchive LLVMBitReader LLVMCore LLVMSupport LLVM
set(MSVC_LIB_DEPS_LLVMMBlazeAsmParser LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMSupport LLVMTarget)
set(MSVC_LIB_DEPS_LLVMMBlazeAsmPrinter LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMMBlazeCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMBlazeAsmPrinter LLVMMBlazeInfo LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget)
set(MSVC_LIB_DEPS_LLVMMBlazeDisassembler LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMMBlazeDisassembler LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC)
set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMDisassembler LLVMARMInfo LLVMAlphaCodeGen LLVMAlphaInfo LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmParser LLVMMBlazeCodeGen LLVMMBlazeDisassembler LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430CodeGen LLVMMSP430Info LLVMMipsCodeGen LLVMMipsInfo LLVMPTXCodeGen LLVMPTXInfo LLVMPowerPCCodeGen LLVMPowerPCInfo LLVMSparcCodeGen LLVMSparcInfo LLVMSupport LLVMSystemZCodeGen LLVMSystemZInfo LLVMX86AsmParser LLVMX86CodeGen LLVMX86Disassembler LLVMX86Info LLVMXCoreCodeGen LLVMXCoreInfo)
set(MSVC_LIB_DEPS_LLVMMCJIT LLVMExecutionEngine LLVMSupport LLVMTarget)
set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMDisassembler LLVMARMInfo LLVMAlphaCodeGen LLVMAlphaInfo LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmParser LLVMMBlazeCodeGen LLVMMBlazeDisassembler LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430CodeGen LLVMMSP430Info LLVMMipsCodeGen LLVMMipsInfo LLVMPTXCodeGen LLVMPTXInfo LLVMPowerPCCodeGen LLVMPowerPCInfo LLVMSparcCodeGen LLVMSparcInfo LLVMSupport LLVMSystemZCodeGen LLVMSystemZInfo LLVMTarget LLVMX86AsmParser LLVMX86CodeGen LLVMX86Disassembler LLVMX86Info LLVMXCoreCodeGen LLVMXCoreInfo)
set(MSVC_LIB_DEPS_LLVMMCJIT LLVMCore LLVMExecutionEngine LLVMRuntimeDyld LLVMSupport LLVMTarget)
set(MSVC_LIB_DEPS_LLVMMCParser LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMSP430AsmPrinter LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMTarget)
@ -47,6 +47,7 @@ set(MSVC_LIB_DEPS_LLVMPTXInfo LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMPowerPCCodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCAsmPrinter LLVMPowerPCInfo LLVMSelectionDAG LLVMSupport LLVMTarget)
set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMRuntimeDyld LLVMObject LLVMSupport)
set(MSVC_LIB_DEPS_LLVMScalarOpts LLVMAnalysis LLVMCore LLVMInstCombine LLVMSupport LLVMTarget LLVMTransformUtils)
set(MSVC_LIB_DEPS_LLVMSelectionDAG LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget LLVMTransformUtils)
set(MSVC_LIB_DEPS_LLVMSparcCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSparcInfo LLVMSupport LLVMTarget)
@ -61,7 +62,7 @@ set(MSVC_LIB_DEPS_LLVMX86AsmPrinter LLVMMC LLVMSupport LLVMX86Utils)
set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMX86AsmPrinter LLVMX86Info LLVMX86Utils)
set(MSVC_LIB_DEPS_LLVMX86Disassembler LLVMMC LLVMSupport LLVMX86Info)
set(MSVC_LIB_DEPS_LLVMX86Info LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMX86Utils LLVMSupport)
set(MSVC_LIB_DEPS_LLVMX86Utils LLVMCore LLVMSupport)
set(MSVC_LIB_DEPS_LLVMXCoreCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMXCoreInfo)
set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMMC LLVMSupport)
set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport)

99
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.60 for llvm 2.9svn.
# Generated by GNU Autoconf 2.60 for llvm 3.0svn.
#
# Report bugs to <llvmbugs@cs.uiuc.edu>.
#
@ -561,8 +561,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='llvm'
PACKAGE_TARNAME='-llvm-'
PACKAGE_VERSION='2.9svn'
PACKAGE_STRING='llvm 2.9svn'
PACKAGE_VERSION='3.0svn'
PACKAGE_STRING='llvm 3.0svn'
PACKAGE_BUGREPORT='llvmbugs@cs.uiuc.edu'
ac_unique_file="lib/VMCore/Module.cpp"
@ -1328,7 +1328,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures llvm 2.9svn to adapt to many kinds of systems.
\`configure' configures llvm 3.0svn to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1394,7 +1394,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of llvm 2.9svn:";;
short | recursive ) echo "Configuration of llvm 3.0svn:";;
esac
cat <<\_ACEOF
@ -1551,7 +1551,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
llvm configure 2.9svn
llvm configure 3.0svn
generated by GNU Autoconf 2.60
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -1567,7 +1567,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by llvm $as_me 2.9svn, which was
It was created by llvm $as_me 3.0svn, which was
generated by GNU Autoconf 2.60. Invocation command line was
$ $0 $@
@ -5117,6 +5117,9 @@ _ACEOF
LLVM_NATIVE_TARGET="LLVMInitialize${LLVM_NATIVE_ARCH}Target"
LLVM_NATIVE_TARGETINFO="LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo"
LLVM_NATIVE_ASMPRINTER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter"
if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser"
fi
cat >>confdefs.h <<_ACEOF
#define LLVM_NATIVE_TARGET $LLVM_NATIVE_TARGET
@ -5132,6 +5135,13 @@ cat >>confdefs.h <<_ACEOF
#define LLVM_NATIVE_ASMPRINTER $LLVM_NATIVE_ASMPRINTER
_ACEOF
if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
cat >>confdefs.h <<_ACEOF
#define LLVM_NATIVE_ASMPARSER $LLVM_NATIVE_ASMPARSER
_ACEOF
fi
fi
done
@ -11561,7 +11571,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 11564 "configure"
#line 11574 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11713,7 +11723,7 @@ else
osf[1234]*)
# dlopen did load deplibs (at least at 4.x), but until the 5.x series,
# it did *not* use an RPATH in a shared library to find objects the
# library depends on, so we explictly say `no'.
# library depends on, so we explicitly say `no'.
libltdl_cv_sys_dlopen_deplibs=no
;;
osf5.0|osf5.0a|osf5.1)
@ -20650,6 +20660,73 @@ fi
fi
if test "$llvm_cv_os_type" = "MingW" ; then
{ echo "$as_me:$LINENO: checking whether EnumerateLoadedModules() accepts new decl" >&5
echo $ECHO_N "checking whether EnumerateLoadedModules() accepts new decl... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
#include <windows.h>
#include <imagehlp.h>
extern void foo(PENUMLOADED_MODULES_CALLBACK);
extern void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID));
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
llvm_cv_win32_elmcb_pcstr="PCSTR"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
llvm_cv_win32_elmcb_pcstr="PSTR"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
cat >>confdefs.h <<_ACEOF
#define WIN32_ELMCB_PCSTR $llvm_cv_win32_elmcb_pcstr
_ACEOF
fi
{ echo "$as_me:$LINENO: checking for isnan in <math.h>" >&5
echo $ECHO_N "checking for isnan in <math.h>... $ECHO_C" >&6; }
@ -22942,7 +23019,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by llvm $as_me 2.9svn, which was
This file was extended by llvm $as_me 3.0svn, which was
generated by GNU Autoconf 2.60. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -22995,7 +23072,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
llvm config.status 2.9svn
llvm config.status 3.0svn
configured by $0, generated by GNU Autoconf 2.60,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -7,9 +7,9 @@
</head>
<body>
<div class="doc_title">
<h1>
LLVM Alias Analysis Infrastructure
</div>
</h1>
<ol>
<li><a href="#introduction">Introduction</a></li>
@ -59,12 +59,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="introduction">Introduction</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Alias Analysis (aka Pointer Analysis) is a class of techniques which attempt
to determine whether or not two pointers ever can point to the same object in
@ -96,12 +96,12 @@ know</a>.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="overview"><tt>AliasAnalysis</tt> Class Overview</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The <a
href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html"><tt>AliasAnalysis</tt></a>
@ -122,14 +122,12 @@ multiple values, values which are not
<a href="LangRef.html#constants">constants</a> are all defined within the
same function.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="pointers">Representation of Pointers</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Most importantly, the <tt>AliasAnalysis</tt> class provides several methods
which are used to query whether or not two memory objects alias, whether
@ -181,11 +179,11 @@ that the accesses alias.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="alias">The <tt>alias</tt> method</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The <tt>alias</tt> method is the primary interface used to determine whether
or not two memory objects alias each other. It takes two memory objects as
input and returns MustAlias, PartialAlias, MayAlias, or NoAlias as
@ -194,14 +192,13 @@ appropriate.</p>
<p>Like all <tt>AliasAnalysis</tt> interfaces, the <tt>alias</tt> method requires
that either the two pointer values be defined within the same function, or at
least one of the values is a <a href="LangRef.html#constants">constant</a>.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="MustMayNo">Must, May, and No Alias Responses</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The NoAlias response may be used when there is never an immediate dependence
between any memory reference <i>based</i> on one pointer and any memory
reference <i>based</i> the other. The most obvious example is when the two
@ -227,12 +224,14 @@ implies that the pointers compare equal.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="ModRefInfo">The <tt>getModRefInfo</tt> methods</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="ModRefInfo">The <tt>getModRefInfo</tt> methods</a>
</h3>
<div>
<p>The <tt>getModRefInfo</tt> methods return information about whether the
execution of an instruction can read or modify a memory location. Mod/Ref
@ -250,25 +249,23 @@ memory written to by CS2. Note that this relation is not commutative.</p>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="OtherItfs">Other useful <tt>AliasAnalysis</tt> methods</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
Several other tidbits of information are often collected by various alias
analysis implementations and can be put to good use by various clients.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
The <tt>pointsToConstantMemory</tt> method
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>pointsToConstantMemory</tt> method returns true if and only if the
analysis can prove that the pointer only points to unchanging memory locations
@ -279,12 +276,12 @@ memory location to be modified.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="simplemodref">The <tt>doesNotAccessMemory</tt> and
<tt>onlyReadsMemory</tt> methods</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>These methods are used to provide very simple mod/ref information for
function calls. The <tt>doesNotAccessMemory</tt> method returns true for a
@ -307,13 +304,17 @@ functions that satisfy the <tt>doesNotAccessMemory</tt> method also satisfies
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="writingnew">Writing a new <tt>AliasAnalysis</tt> Implementation</a>
</div>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="writingnew">Writing a new <tt>AliasAnalysis</tt> Implementation</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Writing a new alias analysis implementation for LLVM is quite
straight-forward. There are already several implementations that you can use
@ -321,14 +322,12 @@ for examples, and the following information should help fill in any details.
For a examples, take a look at the <a href="#impls">various alias analysis
implementations</a> included with LLVM.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="passsubclasses">Different Pass styles</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The first step to determining what type of <a
href="WritingAnLLVMPass.html">LLVM pass</a> you need to use for your Alias
@ -352,11 +351,11 @@ solve:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="requiredcalls">Required initialization calls</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Your subclass of <tt>AliasAnalysis</tt> is required to invoke two methods on
the <tt>AliasAnalysis</tt> base class: <tt>getAnalysisUsage</tt> and
@ -393,11 +392,11 @@ bool run(Module &amp;M) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="interfaces">Interfaces which may be specified</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>All of the <a
href="/doxygen/classllvm_1_1AliasAnalysis.html"><tt>AliasAnalysis</tt></a>
@ -412,11 +411,11 @@ implementing, you just override the interfaces you can improve.</p>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="chaining"><tt>AliasAnalysis</tt> chaining behavior</a>
</div>
</h3>
<div class="doc_text">
<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>
@ -451,11 +450,11 @@ updated.</p>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="updating">Updating analysis results for transformations</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
Alias analysis information is initially computed for a static snapshot of the
program, but clients will use this information to make transformations to the
@ -471,12 +470,11 @@ their internal data structures are kept up-to-date as the program changes (for
example, when an instruction is deleted), and clients of alias analysis must be
sure to call these interfaces appropriately.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">The <tt>deleteValue</tt> method</div>
<h4>The <tt>deleteValue</tt> method</h4>
<div class="doc_text">
<div>
The <tt>deleteValue</tt> method is called by transformations when they remove an
instruction or any other value from the program (including values that do not
use pointers). Typically alias analyses keep data structures that have entries
@ -485,9 +483,9 @@ any entries for the specified value, if they exist.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">The <tt>copyValue</tt> method</div>
<h4>The <tt>copyValue</tt> method</h4>
<div class="doc_text">
<div>
The <tt>copyValue</tt> method is used when a new value is introduced into the
program. There is no way to introduce a value into the program that did not
exist before (this doesn't make sense for a safe compiler transformation), so
@ -496,9 +494,9 @@ new value has exactly the same properties as the value being copied.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">The <tt>replaceWithNewValue</tt> method</div>
<h4>The <tt>replaceWithNewValue</tt> method</h4>
<div class="doc_text">
<div>
This method is a simple helper method that is provided to make clients easier to
use. It is implemented by copying the old analysis information to the new
value, then deleting the old value. This method cannot be overridden by alias
@ -506,9 +504,9 @@ analysis implementations.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">The <tt>addEscapingUse</tt> method</div>
<h4>The <tt>addEscapingUse</tt> method</h4>
<div class="doc_text">
<div>
<p>The <tt>addEscapingUse</tt> method is used when the uses of a pointer
value have changed in ways that may invalidate precomputed analysis information.
Implementations may either use this callback to provide conservative responses
@ -527,12 +525,14 @@ uses below:</p>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="implefficiency">Efficiency Issues</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="implefficiency">Efficiency Issues</a>
</h3>
<div>
<p>From the LLVM perspective, the only thing you need to do to provide an
efficient alias analysis is to make sure that alias analysis <b>queries</b> are
@ -544,11 +544,11 @@ method as possible (within reason).</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="limitations">Limitations</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The AliasAnalysis infrastructure has several limitations which make
writing a new <tt>AliasAnalysis</tt> implementation difficult.</p>
@ -567,7 +567,7 @@ which are intended to allow a pass to keep an AliasAnalysis consistent,
however there's no way for a pass to declare in its
<tt>getAnalysisUsage</tt> that it does so. Some passes attempt to use
<tt>AU.addPreserved&lt;AliasAnalysis&gt;</tt>, however this doesn't
actually have any effect.</tt>
actually have any effect.</p>
<p><tt>AliasAnalysisCounter</tt> (<tt>-count-aa</tt>) and <tt>AliasDebugger</tt>
(<tt>-debug-aa</tt>) are implemented as <tt>ModulePass</tt> classes, so if your
@ -616,25 +616,25 @@ from itself.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="using">Using alias analysis results</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="using">Using alias analysis results</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>There are several different ways to use alias analysis results. In order of
preference, these are...</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="memdep">Using the <tt>MemoryDependenceAnalysis</tt> Pass</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The <tt>memdep</tt> pass uses alias analysis to provide high-level dependence
information about memory-using instructions. This will tell you which store
@ -645,11 +645,11 @@ efficient, and is used by Dead Store Elimination, GVN, and memcpy optimizations.
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="ast">Using the <tt>AliasSetTracker</tt> class</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Many transformations need information about alias <b>sets</b> that are active
in some scope, rather than information about pairwise aliasing. The <tt><a
@ -678,14 +678,12 @@ sunk to outside of the loop, promoting the memory location to a register for the
duration of the loop nest. Both of these transformations only apply if the
pointer argument is loop-invariant.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
The AliasSetTracker implementation
</div>
</h4>
<div class="doc_text">
<div>
<p>The AliasSetTracker class is implemented to be as efficient as possible. It
uses the union-find algorithm to efficiently merge AliasSets when a pointer is
@ -706,12 +704,14 @@ are.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="direct">Using the <tt>AliasAnalysis</tt> interface directly</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="direct">Using the <tt>AliasAnalysis</tt> interface directly</a>
</h3>
<div>
<p>If neither of these utility class are what your pass needs, you should use
the interfaces exposed by the <tt>AliasAnalysis</tt> class directly. Try to use
@ -721,13 +721,15 @@ best precision and efficiency.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="exist">Existing alias analysis implementations and clients</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="exist">Existing alias analysis implementations and clients</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>If you're going to be working with the LLVM alias analysis infrastructure,
you should know what clients and implementations of alias analysis are
@ -735,28 +737,24 @@ available. In particular, if you are implementing an alias analysis, you should
be aware of the <a href="#aliasanalysis-debug">the clients</a> that are useful
for monitoring and evaluating different implementations.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="impls">Available <tt>AliasAnalysis</tt> implementations</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>This section lists the various implementations of the <tt>AliasAnalysis</tt>
interface. With the exception of the <a href="#no-aa"><tt>-no-aa</tt></a> and
<a href="#basic-aa"><tt>-basicaa</tt></a> implementations, all of these <a
href="#chaining">chain</a> to other alias analysis implementations.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="no-aa">The <tt>-no-aa</tt> pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>-no-aa</tt> pass is just like what it sounds: an alias analysis that
never returns any useful information. This pass can be useful if you think that
@ -766,11 +764,11 @@ problem.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="basic-aa">The <tt>-basicaa</tt> pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>-basicaa</tt> pass is an aggressive local analysis that "knows"
many important facts:</p>
@ -794,11 +792,11 @@ many important facts:</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="globalsmodref">The <tt>-globalsmodref-aa</tt> pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>This pass implements a simple context-sensitive mod/ref and alias analysis
for internal global variables that don't "have their address taken". If a
@ -818,11 +816,11 @@ non-address taken globals), but is very quick analysis.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="steens-aa">The <tt>-steens-aa</tt> pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>-steens-aa</tt> pass implements a variation on the well-known
"Steensgaard's algorithm" for interprocedural alias analysis. Steensgaard's
@ -841,11 +839,11 @@ module, it is not part of the LLVM core.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="ds-aa">The <tt>-ds-aa</tt> pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>-ds-aa</tt> pass implements the full Data Structure Analysis
algorithm. Data Structure Analysis is a modular unification-based,
@ -864,11 +862,11 @@ module, it is not part of the LLVM core.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="scev-aa">The <tt>-scev-aa</tt> pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>-scev-aa</tt> pass implements AliasAnalysis queries by
translating them into ScalarEvolution queries. This gives it a
@ -877,22 +875,23 @@ and loop induction variables than other alias analyses have.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="aliasanalysis-xforms">Alias analysis driven transformations</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="aliasanalysis-xforms">Alias analysis driven transformations</a>
</h3>
<div>
LLVM includes several alias-analysis driven transformations which can be used
with any of the implementations above.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="adce">The <tt>-adce</tt> pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>-adce</tt> pass, which implements Aggressive Dead Code Elimination
uses the <tt>AliasAnalysis</tt> interface to delete calls to functions that do
@ -902,11 +901,11 @@ not have side-effects and are not used.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="licm">The <tt>-licm</tt> pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>-licm</tt> pass implements various Loop Invariant Code Motion related
transformations. It uses the <tt>AliasAnalysis</tt> interface for several
@ -927,11 +926,11 @@ no may aliases to the loaded/stored memory location.</li>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="argpromotion">The <tt>-argpromotion</tt> pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>
The <tt>-argpromotion</tt> pass promotes by-reference arguments to be passed in
by-value instead. In particular, if pointer arguments are only loaded from it
@ -942,38 +941,38 @@ pointer.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="gvn">The <tt>-gvn</tt>, <tt>-memcpyopt</tt>, and <tt>-dse</tt>
passes</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>These passes use AliasAnalysis information to reason about loads and stores.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="aliasanalysis-debug">Clients for debugging and evaluation of
implementations</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="aliasanalysis-debug">Clients for debugging and evaluation of
implementations</a>
</h3>
<div>
<p>These passes are useful for evaluating the various alias analysis
implementations. You can use them with commands like '<tt>opt -ds-aa
-aa-eval foo.bc -disable-output -stats</tt>'.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="print-alias-sets">The <tt>-print-alias-sets</tt> pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>-print-alias-sets</tt> pass is exposed as part of the
<tt>opt</tt> tool to print out the Alias Sets formed by the <a
@ -990,11 +989,11 @@ the <tt>AliasSetTracker</tt> class. To use it, use something like:</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="count-aa">The <tt>-count-aa</tt> pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>-count-aa</tt> pass is useful to see how many queries a particular
pass is making and what responses are returned by the alias analysis. As an
@ -1014,11 +1013,11 @@ when debugging a transformation or an alias analysis implementation.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="aa-eval">The <tt>-aa-eval</tt> pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>-aa-eval</tt> pass simply iterates through all pairs of pointers in a
function and asks an alias analysis whether or not the pointers alias. This
@ -1028,13 +1027,17 @@ algorithm will have a lower number of may aliases).</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="memdep">Memory Dependence Analysis</a>
</div>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="memdep">Memory Dependence Analysis</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>If you're just looking to be a client of alias analysis information, consider
using the Memory Dependence Analysis interface instead. MemDep is a lazy,
@ -1056,8 +1059,8 @@ analysis directly.</p>
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-01-03 22:38:41 +0100 (Mon, 03 Jan 2011) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-21 03:52:00 +0200 (Thu, 21 Apr 2011) $
</address>
</body>

View File

@ -7,7 +7,7 @@
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>
<div class="doc_title"> LLVM Bitcode File Format </div>
<h1> LLVM Bitcode File Format</h1>
<ol>
<li><a href="#abstract">Abstract</a></li>
<li><a href="#overview">Overview</a></li>
@ -47,10 +47,10 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="abstract">Abstract</a></div>
<h2><a name="abstract">Abstract</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This document describes the LLVM bitstream file format and the encoding of
the LLVM IR into it.</p>
@ -58,10 +58,10 @@ the LLVM IR into it.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="overview">Overview</a></div>
<h2><a name="overview">Overview</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
What is commonly known as the LLVM bitcode file format (also, sometimes
@ -88,10 +88,10 @@ wrapper format, then describes the record structure used by LLVM IR files.
</div>
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="bitstream">Bitstream Format</a></div>
<h2><a name="bitstream">Bitstream Format</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
The bitstream format is literally a stream of bits, with a very simple
@ -114,13 +114,12 @@ href="CommandGuide/html/llvm-bcanalyzer.html">llvm-bcanalyzer</a> tool can be
used to dump and inspect arbitrary bitstreams, which is very useful for
understanding the encoding.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="magic">Magic Numbers</a>
</div>
<h3>
<a name="magic">Magic Numbers</a>
</h3>
<div class="doc_text">
<div>
<p>The first two bytes of a bitcode file are 'BC' (0x42, 0x43).
The second two bytes are an application-specific magic number. Generic
@ -130,10 +129,11 @@ bitcode, while application-specific programs will want to look at all four.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="primitives">Primitives</a>
</div>
<h3>
<a name="primitives">Primitives</a>
</h3>
<div class="doc_text">
<div>
<p>
A bitstream literally consists of a stream of bits, which are read in order
@ -144,13 +144,12 @@ Width Integers</a> or as <a href="#variablewidth">Variable Width
Integers</a>.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="fixedwidth">Fixed Width Integers</a>
</div>
<h4>
<a name="fixedwidth">Fixed Width Integers</a>
</h4>
<div class="doc_text">
<div>
<p>Fixed-width integer values have their low bits emitted directly to the file.
For example, a 3-bit integer value encodes 1 as 001. Fixed width integers
@ -161,10 +160,11 @@ Integers</a>.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="variablewidth">Variable Width
Integers</a></div>
<h4>
<a name="variablewidth">Variable Width Integers</a>
</h4>
<div class="doc_text">
<div>
<p>Variable-width integer (VBR) values encode values of arbitrary size,
optimizing for the case where the values are small. Given a 4-bit VBR field,
@ -182,9 +182,9 @@ value of 24 (011 << 3) with no continuation. The sum (3+24) yields the value
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="char6">6-bit characters</a></div>
<h4><a name="char6">6-bit characters</a></h4>
<div class="doc_text">
<div>
<p>6-bit characters encode common characters into a fixed 6-bit field. They
represent the following characters with the following 6-bit values:</p>
@ -206,9 +206,9 @@ characters not in the set.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="wordalign">Word Alignment</a></div>
<h4><a name="wordalign">Word Alignment</a></h4>
<div class="doc_text">
<div>
<p>Occasionally, it is useful to emit zero bits until the bitstream is a
multiple of 32 bits. This ensures that the bit position in the stream can be
@ -216,12 +216,14 @@ represented as a multiple of 32-bit words.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="abbrevid">Abbreviation IDs</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="abbrevid">Abbreviation IDs</a>
</h3>
<div>
<p>
A bitstream is a sequential series of <a href="#blocks">Blocks</a> and
@ -253,10 +255,11 @@ an <a href="#abbrev_records">abbreviated record encoding</a>.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="blocks">Blocks</a>
</div>
<h3>
<a name="blocks">Blocks</a>
</h3>
<div class="doc_text">
<div>
<p>
Blocks in a bitstream denote nested regions of the stream, and are identified by
@ -297,13 +300,10 @@ its own set of abbreviations, and its own abbrev id width. When a sub-block is
popped, the saved values are restored.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="ENTER_SUBBLOCK">ENTER_SUBBLOCK
Encoding</a></div>
<h4><a name="ENTER_SUBBLOCK">ENTER_SUBBLOCK Encoding</a></h4>
<div class="doc_text">
<div>
<p><tt>[ENTER_SUBBLOCK, blockid<sub>vbr8</sub>, newabbrevlen<sub>vbr4</sub>,
&lt;align32bits&gt;, blocklen<sub>32</sub>]</tt></p>
@ -322,10 +322,9 @@ reader to skip over the entire block in one jump.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="END_BLOCK">END_BLOCK
Encoding</a></div>
<h4><a name="END_BLOCK">END_BLOCK Encoding</a></h4>
<div class="doc_text">
<div>
<p><tt>[END_BLOCK, &lt;align32bits&gt;]</tt></p>
@ -337,13 +336,14 @@ an even multiple of 32-bits.
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="datarecord">Data Records</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="datarecord">Data Records</a>
</h3>
<div>
<p>
Data records consist of a record code and a number of (up to) 64-bit
integer values. The interpretation of the code and values is
@ -355,13 +355,10 @@ which encodes the target triple of a module. The code is
ASCII codes for the characters in the string.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="UNABBREV_RECORD">UNABBREV_RECORD
Encoding</a></div>
<h4><a name="UNABBREV_RECORD">UNABBREV_RECORD Encoding</a></h4>
<div class="doc_text">
<div>
<p><tt>[UNABBREV_RECORD, code<sub>vbr6</sub>, numops<sub>vbr6</sub>,
op0<sub>vbr6</sub>, op1<sub>vbr6</sub>, ...]</tt></p>
@ -385,10 +382,9 @@ bits. This is not an efficient encoding, but it is fully general.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="abbrev_records">Abbreviated Record
Encoding</a></div>
<h4><a name="abbrev_records">Abbreviated Record Encoding</a></h4>
<div class="doc_text">
<div>
<p><tt>[&lt;abbrevid&gt;, fields...]</tt></p>
@ -409,11 +405,14 @@ operand value).</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="abbreviations">Abbreviations</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="abbreviations">Abbreviations</a>
</h3>
<div>
<p>
Abbreviations are an important form of compression for bitstreams. The idea is
to specify a dense encoding for a class of records once, then use that encoding
@ -431,13 +430,11 @@ As a concrete example, LLVM IR files usually emit an abbreviation
for binary operators. If a specific LLVM module contained no or few binary
operators, the abbreviation does not need to be emitted.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="DEFINE_ABBREV">DEFINE_ABBREV
Encoding</a></div>
<h4><a name="DEFINE_ABBREV">DEFINE_ABBREV Encoding</a></h4>
<div class="doc_text">
<div>
<p><tt>[DEFINE_ABBREV, numabbrevops<sub>vbr5</sub>, abbrevop0, abbrevop1,
...]</tt></p>
@ -552,11 +549,14 @@ used for any other string value.
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="stdblocks">Standard Blocks</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="stdblocks">Standard Blocks</a>
</h3>
<div>
<p>
In addition to the basic block structure and record encodings, the bitstream
@ -565,13 +565,10 @@ stream is to be decoded or other metadata. In the future, new standard blocks
may be added. Block IDs 0-7 are reserved for standard blocks.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="BLOCKINFO">#0 - BLOCKINFO
Block</a></div>
<h4><a name="BLOCKINFO">#0 - BLOCKINFO Block</a></h4>
<div class="doc_text">
<div>
<p>
The <tt>BLOCKINFO</tt> block allows the description of metadata for other
@ -620,11 +617,15 @@ from the corresponding blocks. It is not safe to skip them.
</div>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="wrapper">Bitcode Wrapper Format</a></div>
<h2><a name="wrapper">Bitcode Wrapper Format</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Bitcode files for LLVM IR may optionally be wrapped in a simple wrapper
@ -652,10 +653,10 @@ value that can be used to encode the CPU of the target.
</div>
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="llvmir">LLVM IR Encoding</a></div>
<h2><a name="llvmir">LLVM IR Encoding</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
LLVM IR is encoded into a bitstream by defining blocks and records. It uses
@ -666,16 +667,17 @@ that the writer uses, as these are fully self-described in the file, and the
reader is not allowed to build in any knowledge of this.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="basics">Basics</a>
</div>
<h3>
<a name="basics">Basics</a>
</h3>
<div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="ir_magic">LLVM IR Magic Number</a></div>
<h4><a name="ir_magic">LLVM IR Magic Number</a></h4>
<div class="doc_text">
<div>
<p>
The magic number for LLVM IR files is:
@ -695,9 +697,9 @@ When combined with the bitcode magic number and viewed as bytes, this is
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="ir_signed_vbr">Signed VBRs</a></div>
<h4><a name="ir_signed_vbr">Signed VBRs</a></h4>
<div class="doc_text">
<div>
<p>
<a href="#variablewidth">Variable Width Integer</a> encoding is an efficient way to
@ -728,9 +730,9 @@ within <tt>CONSTANTS_BLOCK</tt> blocks.
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="ir_blocks">LLVM IR Blocks</a></div>
<h4><a name="ir_blocks">LLVM IR Blocks</a></h4>
<div class="doc_text">
<div>
<p>
LLVM IR is defined with the following blocks:
@ -758,11 +760,14 @@ LLVM IR is defined with the following blocks:
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="MODULE_BLOCK">MODULE_BLOCK Contents</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="MODULE_BLOCK">MODULE_BLOCK Contents</a>
</h3>
<div>
<p>The <tt>MODULE_BLOCK</tt> block (id 8) is the top-level block for LLVM
bitcode files, and each bitcode file must contain exactly one. In
@ -782,13 +787,10 @@ following sub-blocks:
<li><a href="#METADATA_BLOCK"><tt>METADATA_BLOCK</tt></a></li>
</ul>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="MODULE_CODE_VERSION">MODULE_CODE_VERSION Record</a>
</div>
<h4><a name="MODULE_CODE_VERSION">MODULE_CODE_VERSION Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[VERSION, version#]</tt></p>
@ -798,10 +800,9 @@ time.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="MODULE_CODE_TRIPLE">MODULE_CODE_TRIPLE Record</a>
</div>
<h4><a name="MODULE_CODE_TRIPLE">MODULE_CODE_TRIPLE Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[TRIPLE, ...string...]</tt></p>
<p>The <tt>TRIPLE</tt> record (code 2) contains a variable number of
@ -810,10 +811,9 @@ specification string.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="MODULE_CODE_DATALAYOUT">MODULE_CODE_DATALAYOUT Record</a>
</div>
<h4><a name="MODULE_CODE_DATALAYOUT">MODULE_CODE_DATALAYOUT Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[DATALAYOUT, ...string...]</tt></p>
<p>The <tt>DATALAYOUT</tt> record (code 3) contains a variable number of
@ -822,10 +822,9 @@ specification string.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="MODULE_CODE_ASM">MODULE_CODE_ASM Record</a>
</div>
<h4><a name="MODULE_CODE_ASM">MODULE_CODE_ASM Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[ASM, ...string...]</tt></p>
<p>The <tt>ASM</tt> record (code 4) contains a variable number of
@ -834,10 +833,9 @@ individual assembly blocks separated by newline (ASCII 10) characters.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="MODULE_CODE_SECTIONNAME">MODULE_CODE_SECTIONNAME Record</a>
</div>
<h4><a name="MODULE_CODE_SECTIONNAME">MODULE_CODE_SECTIONNAME Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[SECTIONNAME, ...string...]</tt></p>
<p>The <tt>SECTIONNAME</tt> record (code 5) contains a variable number
@ -850,10 +848,9 @@ referenced by the 1-based index in the <i>section</i> fields of
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="MODULE_CODE_DEPLIB">MODULE_CODE_DEPLIB Record</a>
</div>
<h4><a name="MODULE_CODE_DEPLIB">MODULE_CODE_DEPLIB Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[DEPLIB, ...string...]</tt></p>
<p>The <tt>DEPLIB</tt> record (code 6) contains a variable number of
@ -864,10 +861,9 @@ library name referenced.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="MODULE_CODE_GLOBALVAR">MODULE_CODE_GLOBALVAR Record</a>
</div>
<h4><a name="MODULE_CODE_GLOBALVAR">MODULE_CODE_GLOBALVAR Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[GLOBALVAR, pointer type, isconst, initid, linkage, alignment, section, visibility, threadlocal]</tt></p>
<p>The <tt>GLOBALVAR</tt> record (code 7) marks the declaration or
@ -923,16 +919,15 @@ encoding of the visibility of this variable:
is <tt>thread_local</tt></li>
<li><i>unnamed_addr</i>: If present and non-zero, indicates that the variable
has <tt>unnamed_addr<tt></li>
has <tt>unnamed_addr</tt></li>
</ul>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="MODULE_CODE_FUNCTION">MODULE_CODE_FUNCTION Record</a>
</div>
<h4><a name="MODULE_CODE_FUNCTION">MODULE_CODE_FUNCTION Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[FUNCTION, type, callingconv, isproto, linkage, paramattr, alignment, section, visibility, gc]</tt></p>
@ -980,16 +975,15 @@ index in the table of
<a href="#MODULE_CODE_GCNAME">MODULE_CODE_GCNAME</a> entries.</li>
<li><i>unnamed_addr</i>: If present and non-zero, indicates that the function
has <tt>unnamed_addr<tt></li>
has <tt>unnamed_addr</tt></li>
</ul>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="MODULE_CODE_ALIAS">MODULE_CODE_ALIAS Record</a>
</div>
<h4><a name="MODULE_CODE_ALIAS">MODULE_CODE_ALIAS Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[ALIAS, alias type, aliasee val#, linkage, visibility]</tt></p>
@ -1011,10 +1005,9 @@ for this alias</li>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="MODULE_CODE_PURGEVALS">MODULE_CODE_PURGEVALS Record</a>
</div>
<h4><a name="MODULE_CODE_PURGEVALS">MODULE_CODE_PURGEVALS Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[PURGEVALS, numvals]</tt></p>
<p>The <tt>PURGEVALS</tt> record (code 10) resets the module-level
@ -1025,10 +1018,9 @@ new value indices will start from the given <i>numvals</i> value.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="MODULE_CODE_GCNAME">MODULE_CODE_GCNAME Record</a>
</div>
<h4><a name="MODULE_CODE_GCNAME">MODULE_CODE_GCNAME Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[GCNAME, ...string...]</tt></p>
<p>The <tt>GCNAME</tt> record (code 11) contains a variable number of
@ -1039,11 +1031,14 @@ the module. These records can be referenced by 1-based index in the <i>gc</i>
fields of <tt>FUNCTION</tt> records.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="PARAMATTR_BLOCK">PARAMATTR_BLOCK Contents</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="PARAMATTR_BLOCK">PARAMATTR_BLOCK Contents</a>
</h3>
<div>
<p>The <tt>PARAMATTR_BLOCK</tt> block (id 9) contains a table of
entries describing the attributes of function parameters. These
@ -1057,14 +1052,10 @@ href="#FUNC_CODE_INST_CALL"><tt>INST_CALL</tt></a> records.</p>
that each is unique (i.e., no two indicies represent equivalent
attribute lists). </p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="PARAMATTR_CODE_ENTRY">PARAMATTR_CODE_ENTRY Record</a>
</div>
<h4><a name="PARAMATTR_CODE_ENTRY">PARAMATTR_CODE_ENTRY Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[ENTRY, paramidx0, attr0, paramidx1, attr1...]</tt></p>
@ -1105,11 +1096,14 @@ the logarithm base 2 of the requested alignment, plus 1</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="TYPE_BLOCK">TYPE_BLOCK Contents</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="TYPE_BLOCK">TYPE_BLOCK Contents</a>
</h3>
<div>
<p>The <tt>TYPE_BLOCK</tt> block (id 10) contains records which
constitute a table of type operator entries used to represent types
@ -1124,13 +1118,10 @@ type operator records.
each entry is unique (i.e., no two indicies represent structurally
equivalent types). </p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_NUMENTRY">TYPE_CODE_NUMENTRY Record</a>
</div>
<h4><a name="TYPE_CODE_NUMENTRY">TYPE_CODE_NUMENTRY Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[NUMENTRY, numentries]</tt></p>
@ -1142,10 +1133,9 @@ in the block.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_VOID">TYPE_CODE_VOID Record</a>
</div>
<h4><a name="TYPE_CODE_VOID">TYPE_CODE_VOID Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[VOID]</tt></p>
@ -1155,10 +1145,9 @@ type table.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_FLOAT">TYPE_CODE_FLOAT Record</a>
</div>
<h4><a name="TYPE_CODE_FLOAT">TYPE_CODE_FLOAT Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[FLOAT]</tt></p>
@ -1168,10 +1157,9 @@ floating point) type to the type table.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_DOUBLE">TYPE_CODE_DOUBLE Record</a>
</div>
<h4><a name="TYPE_CODE_DOUBLE">TYPE_CODE_DOUBLE Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[DOUBLE]</tt></p>
@ -1181,10 +1169,9 @@ floating point) type to the type table.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_LABEL">TYPE_CODE_LABEL Record</a>
</div>
<h4><a name="TYPE_CODE_LABEL">TYPE_CODE_LABEL Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[LABEL]</tt></p>
@ -1194,10 +1181,9 @@ the type table.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_OPAQUE">TYPE_CODE_OPAQUE Record</a>
</div>
<h4><a name="TYPE_CODE_OPAQUE">TYPE_CODE_OPAQUE Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[OPAQUE]</tt></p>
@ -1208,10 +1194,9 @@ unified.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_INTEGER">TYPE_CODE_INTEGER Record</a>
</div>
<h4><a name="TYPE_CODE_INTEGER">TYPE_CODE_INTEGER Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[INTEGER, width]</tt></p>
@ -1222,10 +1207,9 @@ integer type.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_POINTER">TYPE_CODE_POINTER Record</a>
</div>
<h4><a name="TYPE_CODE_POINTER">TYPE_CODE_POINTER Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[POINTER, pointee type, address space]</tt></p>
@ -1243,10 +1227,9 @@ default address space is zero.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_FUNCTION">TYPE_CODE_FUNCTION Record</a>
</div>
<h4><a name="TYPE_CODE_FUNCTION">TYPE_CODE_FUNCTION Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[FUNCTION, vararg, ignored, retty, ...paramty... ]</tt></p>
@ -1268,10 +1251,9 @@ parameter types of the function</li>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_STRUCT">TYPE_CODE_STRUCT Record</a>
</div>
<h4><a name="TYPE_CODE_STRUCT">TYPE_CODE_STRUCT Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[STRUCT, ispacked, ...eltty...]</tt></p>
@ -1287,10 +1269,9 @@ types of the structure</li>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_ARRAY">TYPE_CODE_ARRAY Record</a>
</div>
<h4><a name="TYPE_CODE_ARRAY">TYPE_CODE_ARRAY Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[ARRAY, numelts, eltty]</tt></p>
@ -1305,10 +1286,9 @@ table. The operand fields are</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_VECTOR">TYPE_CODE_VECTOR Record</a>
</div>
<h4><a name="TYPE_CODE_VECTOR">TYPE_CODE_VECTOR Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[VECTOR, numelts, eltty]</tt></p>
@ -1323,10 +1303,9 @@ table. The operand fields are</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_X86_FP80">TYPE_CODE_X86_FP80 Record</a>
</div>
<h4><a name="TYPE_CODE_X86_FP80">TYPE_CODE_X86_FP80 Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[X86_FP80]</tt></p>
@ -1336,10 +1315,9 @@ floating point) type to the type table.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_FP128">TYPE_CODE_FP128 Record</a>
</div>
<h4><a name="TYPE_CODE_FP128">TYPE_CODE_FP128 Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[FP128]</tt></p>
@ -1349,10 +1327,9 @@ floating point) type to the type table.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_PPC_FP128">TYPE_CODE_PPC_FP128 Record</a>
</div>
<h4><a name="TYPE_CODE_PPC_FP128">TYPE_CODE_PPC_FP128 Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[PPC_FP128]</tt></p>
@ -1362,10 +1339,9 @@ floating point) type to the type table.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TYPE_CODE_METADATA">TYPE_CODE_METADATA Record</a>
</div>
<h4><a name="TYPE_CODE_METADATA">TYPE_CODE_METADATA Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[METADATA]</tt></p>
@ -1374,11 +1350,14 @@ type to the type table.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="CONSTANTS_BLOCK">CONSTANTS_BLOCK Contents</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="CONSTANTS_BLOCK">CONSTANTS_BLOCK Contents</a>
</h3>
<div>
<p>The <tt>CONSTANTS_BLOCK</tt> block (id 11) ...
</p>
@ -1387,10 +1366,11 @@ type to the type table.
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="FUNCTION_BLOCK">FUNCTION_BLOCK Contents</a>
</div>
<h3>
<a name="FUNCTION_BLOCK">FUNCTION_BLOCK Contents</a>
</h3>
<div class="doc_text">
<div>
<p>The <tt>FUNCTION_BLOCK</tt> block (id 12) ...
</p>
@ -1409,23 +1389,21 @@ type to the type table.
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="TYPE_SYMTAB_BLOCK">TYPE_SYMTAB_BLOCK Contents</a>
</div>
<h3>
<a name="TYPE_SYMTAB_BLOCK">TYPE_SYMTAB_BLOCK Contents</a>
</h3>
<div class="doc_text">
<div>
<p>The <tt>TYPE_SYMTAB_BLOCK</tt> block (id 13) contains entries which
map between module-level named types and their corresponding type
indices.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="TST_CODE_ENTRY">TST_CODE_ENTRY Record</a>
</div>
<h4><a name="TST_CODE_ENTRY">TST_CODE_ENTRY Record</a></h4>
<div class="doc_text">
<div>
<p><tt>[ENTRY, typeid, ...string...]</tt></p>
@ -1436,12 +1414,14 @@ name. Each entry corresponds to a single named type.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="VALUE_SYMTAB_BLOCK">VALUE_SYMTAB_BLOCK Contents</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="VALUE_SYMTAB_BLOCK">VALUE_SYMTAB_BLOCK Contents</a>
</h3>
<div>
<p>The <tt>VALUE_SYMTAB_BLOCK</tt> block (id 14) ...
</p>
@ -1450,10 +1430,11 @@ name. Each entry corresponds to a single named type.
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="METADATA_BLOCK">METADATA_BLOCK Contents</a>
</div>
<h3>
<a name="METADATA_BLOCK">METADATA_BLOCK Contents</a>
</h3>
<div class="doc_text">
<div>
<p>The <tt>METADATA_BLOCK</tt> block (id 15) ...
</p>
@ -1462,16 +1443,18 @@ name. Each entry corresponds to a single named type.
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="METADATA_ATTACHMENT">METADATA_ATTACHMENT Contents</a>
</div>
<h3>
<a name="METADATA_ATTACHMENT">METADATA_ATTACHMENT Contents</a>
</h3>
<div class="doc_text">
<div>
<p>The <tt>METADATA_ATTACHMENT</tt> block (id 16) ...
</p>
</div>
</div>
<!-- *********************************************************************** -->
<hr>
@ -1480,8 +1463,8 @@ name. Each entry corresponds to a single named type.
<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">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-01-08 17:42:36 +0100 (Sat, 08 Jan 2011) $
<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) $
</address>
</body>
</html>

View File

@ -6,9 +6,9 @@
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<div class="doc_title">
<h1>
LLVM bugpoint tool: design and usage
</div>
</h1>
<ul>
<li><a href="#desc">Description</a></li>
@ -27,12 +27,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="desc">Description</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p><tt>bugpoint</tt> narrows down the source of problems in LLVM tools and
passes. It can be used to debug three types of failures: optimizer crashes,
@ -50,12 +50,12 @@ href="HowToSubmitABug.html">How To Submit a Bug Report document</a>.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="design">Design Philosophy</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p><tt>bugpoint</tt> is designed to be a useful tool without requiring any
hooks into the LLVM infrastructure at all. It works with any and all LLVM
@ -68,14 +68,12 @@ is still worth it. Note that <tt>bugpoint</tt> is generally very quick unless
debugging a miscompilation where each test of the program (which requires
executing it) takes a long time.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="autoselect">Automatic Debugger Selection</a>
</div>
</h3>
<div class="doc_text">
<div>
<p><tt>bugpoint</tt> reads each <tt>.bc</tt> or <tt>.ll</tt> file specified on
the command line and links them together into a single module, called the test
@ -104,11 +102,11 @@ Otherwise, there is no problem <tt>bugpoint</tt> can debug.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="crashdebug">Crash debugger</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>If an optimizer or code generator crashes, <tt>bugpoint</tt> will try as hard
as it can to reduce the list of passes (for optimizer crashes) and the size of
@ -129,11 +127,11 @@ reproduce the failure with <tt>opt</tt> or <tt>llc</tt>.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="codegendebug">Code generator debugger</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The code generator debugger attempts to narrow down the amount of code that
is being miscompiled by the selected code generator. To do this, it takes the
@ -150,11 +148,11 @@ good code.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="miscompilationdebug">Miscompilation debugger</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The miscompilation debugger works similarly to the code generator debugger.
It works by splitting the test program into two pieces, running the
@ -166,13 +164,15 @@ assumes that the selected code generator is working properly.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="advice">Advice for using bugpoint</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="advice">Advice for using bugpoint</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<tt>bugpoint</tt> can be a remarkably useful tool, but it sometimes works in
non-obvious ways. Here are some hints and tips:<p>
@ -242,8 +242,8 @@ non-obvious ways. Here are some hints and tips:<p>
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: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

View File

@ -21,7 +21,7 @@ This page has moved <a href="GCCFEBuildInstrs.html">here</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>
<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>

View File

@ -6,9 +6,9 @@
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<div class="doc_title">
<h1>
Building LLVM with CMake
</div>
</h1>
<ul>
<li><a href="#intro">Introduction</a></li>
@ -22,6 +22,9 @@
<li><a href="#testing">Executing the test suite</a>
<li><a href="#cross">Cross compiling</a>
<li><a href="#embedding">Embedding LLVM in your project</a>
<ul>
<li><a href="#passdev">Developing LLVM pass out of source</a></li>
</ul></li>
<li><a href="#specifics">Compiler/Platform specific topics</a>
<ul>
<li><a href="#msvc">Microsoft Visual C++</a></li>
@ -33,12 +36,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="intro">Introduction</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p><a href="http://www.cmake.org/">CMake</a> is a cross-platform
build-generator tool. CMake does not build the project, it generates
@ -56,12 +59,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="quickstart">Quick start</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p> We use here the command-line, non-interactive CMake interface </p>
@ -109,12 +112,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="usage">Basic CMake usage</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This section explains basic aspects of CMake, mostly for
explaining those options which you may need on your day-to-day
@ -157,12 +160,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="options">Options and variables</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Variables customize how the build will be generated. Options are
boolean variables, with possible values ON/OFF. Options and
@ -191,14 +194,12 @@
<p><tt>cmake -DVARIABLE:TYPE=value path/to/llvm/source</tt></p>
</div>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="freccmake">Frequently-used CMake variables</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Here are listed some of the CMake variables that are used often,
along with a brief explanation and LLVM-specific notes. For full
@ -237,11 +238,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="llvmvars">LLVM-specific variables</a>
</div>
</h3>
<div class="doc_text">
<div>
<dl>
<dt><b>LLVM_TARGETS_TO_BUILD</b>:STRING</dt>
@ -342,7 +343,7 @@
<dt><b>LLVM_LIT_TOOLS_DIR</b>:STRING</dt>
<dd>The path to GnuWin32 tools for tests. Valid on Windows host.
Defaults to "", then Lit seeks tools according to %PATH%.
Lit can find tools(eg. grep, sort, &c) on LLVM_LIT_TOOLS_DIR at first,
Lit can find tools(eg. grep, sort, &amp;c) on LLVM_LIT_TOOLS_DIR at first,
without specifying GnuWin32 to %PATH%.</dd>
<dt><b>LLVM_ENABLE_FFI</b>:BOOL</dt>
@ -354,13 +355,15 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="testing">Executing the test suite</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="testing">Executing the test suite</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Testing is performed when the <i>check</i> target is built. For
instance, if you are using makefiles, execute this command while on
@ -375,12 +378,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="cross">Cross compiling</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>See <a href="http://www.vtk.org/Wiki/CMake_Cross_Compiling">this
wiki page</a> for generic instructions on how to cross-compile
@ -396,12 +399,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="embedding">Embedding LLVM in your project</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The most difficult part of adding LLVM to the build of a project
is to determine the set of LLVM libraries corresponding to the set
@ -418,7 +421,7 @@
endif()
<b># We incorporate the CMake features provided by LLVM:</b>
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LLVM_ROOT}/share/llvm/cmake")
include(LLVM)
include(LLVMConfig)
<b># Now set the header and library paths:</b>
include_directories( ${LLVM_ROOT}/include )
link_directories( ${LLVM_ROOT}/lib )
@ -436,20 +439,111 @@
headers on the LLVM source directory (if we are building
out-of-source.)</p>
<p>Alternativaly, you can utilize CMake's <i>find_package</i>
functionality. Here is an equivalent variant of snippet shown above:</p>
<div class="doc_code">
<pre>
find_package(LLVM)
if( NOT LLVM_FOUND )
message(FATAL_ERROR "LLVM package can't be found. Set CMAKE_PREFIX_PATH variable to LLVM's installation prefix.")
endif()
include_directories( ${LLVM_INCLUDE_DIRS} )
link_directories( ${LLVM_LIBRARY_DIRS} )
llvm_map_components_to_libraries(REQ_LLVM_LIBRARIES jit native)
target_link_libraries(mycompiler ${REQ_LLVM_LIBRARIES})
</pre>
</div>
<!-- ======================================================================= -->
<h3>
<a name="passdev">Developing LLVM pass out of source</a>
</h3>
<div>
<p>It is possible to develop LLVM passes against installed LLVM.
An example of project layout provided below:</p>
<div class="doc_code">
<pre>
&lt;project dir&gt;/
|
CMakeLists.txt
&lt;pass name&gt;/
|
CMakeLists.txt
Pass.cpp
...
</pre>
</div>
<p>Contents of &lt;project dir&gt;/CMakeLists.txt:</p>
<div class="doc_code">
<pre>
find_package(LLVM)
<b># Define add_llvm_* macro's.</b>
include(AddLLVM)
add_definitions(${LLVM_DEFINITIONS})
include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIRS})
add_subdirectory(&lt;pass name&gt;)
</pre>
</div>
<p>Contents of &lt;project dir&gt;/&lt;pass name&gt;/CMakeLists.txt:</p>
<div class="doc_code">
<pre>
add_llvm_loadable_module(LLVMPassname
Pass.cpp
)
</pre>
</div>
<p>When you are done developing your pass, you may wish to integrate it
into LLVM source tree. You can achieve it in two easy steps:<br>
1. Copying &lt;pass name&gt; folder into &lt;LLVM root&gt;/lib/Transform directory.<br>
2. Adding "add_subdirectory(&lt;pass name&gt;)" line into &lt;LLVM root&gt;/lib/Transform/CMakeLists.txt</p>
</div>
<!-- *********************************************************************** -->
</div>
<!-- *********************************************************************** -->
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="specifics">Compiler/Platform specific topics</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Notes for specific compilers and/or platforms.</p>
<h3>
<a name="msvc">Microsoft Visual C++</a>
</h3>
<div>
<dl>
<dt><b>LLVM_COMPILER_JOBS</b>:STRING</dt>
<dd>Specifies the maximum number of parallell compiler jobs to use
per project when building with msbuild or Visual Studio. Only supported for
Visual Studio 2008 and Visual Studio 2010 CMake generators. 0 means use all
processors. Default is 0.</dd>
</dl>
</div>
</div>
<!-- *********************************************************************** -->
@ -462,7 +556,7 @@
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
<a href="mailto:ofv@wanadoo.es">Oscar Fuentes</a><br>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-08-09 03:59:36 +0100 (Mon, 9 Aug 2010) $
</address>

File diff suppressed because it is too large Load Diff

View File

@ -7,9 +7,9 @@
</head>
<body>
<div class="doc_title">
<h1>
LLVM Coding Standards
</div>
</h1>
<ol>
<li><a href="#introduction">Introduction</a></li>
@ -83,12 +83,12 @@
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="introduction">Introduction</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<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
@ -117,22 +117,26 @@ href="mailto:sabre@nondot.org">Chris</a>.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="mechanicalissues">Mechanical Source Issues</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="sourceformating">Source Code Formatting</a>
</div>
</h3>
<div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="scf_commenting">Commenting</a>
</div>
</h4>
<div class="doc_text">
<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
@ -141,7 +145,9 @@ 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>
<b>File Headers</b>
<h5>File Headers</h5>
<div>
<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
@ -184,7 +190,9 @@ Here it's only two lines. If an algorithm is being implemented or something
tricky is going on, a reference to the paper where it is published should be
included, as well as any notes or "gotchas" in the code to watch out for.</p>
<b>Class overviews</b>
</div>
<h5>Class overviews</h5>
<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
@ -193,7 +201,9 @@ 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>
<b>Method information</b>
<h5>Method information</h5>
<div>
<p>Methods defined in a class (as well as any global functions) should also be
documented properly. A quick note about what it does and a description of the
@ -207,12 +217,14 @@ happens: does the method return null? Abort? Format your hard disk?</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="scf_commentformat">Comment Formatting</a>
</div>
<div class="doc_text">
<!-- _______________________________________________________________________ -->
<h4>
<a name="scf_commentformat">Comment Formatting</a>
</h4>
<div>
<p>In general, prefer C++ style (<tt>//</tt>) comments. They take less space,
require less typing, don't have nesting problems, etc. There are a few cases
@ -233,11 +245,11 @@ These nest properly and are better behaved in general than C style comments.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="scf_includes"><tt>#include</tt> Style</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>Immediately after the <a href="#scf_commenting">header file comment</a> (and
include guards if working on a header file), the <a
@ -273,11 +285,11 @@ implements are defined.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="scf_codewidth">Source Code Width</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>Write your code to fit within 80 columns of text. This helps those of us who
like to print out code and look at your code in an xterm without resizing
@ -298,11 +310,11 @@ for debate.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="scf_spacestabs">Use Spaces Instead of Tabs</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>In all cases, prefer spaces to tabs in source files. People have different
preferred indentation levels, and different styles of indentation that they
@ -319,11 +331,11 @@ makes for incredible diffs that are absolutely worthless.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="scf_indentation">Indent Code Consistently</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>Okay, in your first year of programming you were told that indentation is
important. If you didn't believe and internalize this then, now is the time.
@ -331,19 +343,21 @@ Just do it.</p>
</div>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="compilerissues">Compiler Issues</a>
</div>
</h3>
<div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="ci_warningerrors">Treat Compiler Warnings Like Errors</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>If your code has compiler warnings in it, something is wrong &mdash; you
aren't casting values correctly, your have "questionable" constructs in your
@ -393,11 +407,11 @@ be fixed by massaging the code appropriately.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="ci_portable_code">Write Portable Code</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>In almost all cases, it is possible and within reason to write completely
portable code. If there are cases where it isn't possible to write portable
@ -412,10 +426,10 @@ libSystem.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="ci_rtti_exceptions">Do not use RTTI or Exceptions</a>
</div>
<div class="doc_text">
</h4>
<div>
<p>In an effort to reduce code and executable size, LLVM does not use RTTI
(e.g. <tt>dynamic_cast&lt;&gt;</tt>) or exceptions. These two language features
@ -433,10 +447,10 @@ than <tt>dynamic_cast&lt;&gt;</tt>.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="ci_class_struct">Use of <tt>class</tt> and <tt>struct</tt> Keywords</a>
</div>
<div class="doc_text">
</h4>
<div>
<p>In C++, the <tt>class</tt> and <tt>struct</tt> keywords can be used almost
interchangeably. The only difference is when they are used to declare a class:
@ -454,26 +468,32 @@ which case <tt>struct</tt> is allowed.</p>
</div>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="styleissues">Style Issues</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="macro">The High-Level Issues</a>
</div>
</h3>
<!-- ======================================================================= -->
<div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="hl_module">A Public Header File <b>is</b> a Module</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>C++ doesn't do too well in the modularity department. There is no real
encapsulation or data hiding (unless you use expensive protocol classes), but it
@ -499,11 +519,11 @@ translation unit.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="hl_dontinclude"><tt>#include</tt> as Little as Possible</a>
</div>
</h4>
<div class="doc_text">
<div>
<p><tt>#include</tt> hurts compile time performance. Don't do it unless you
have to, especially in header files.</p>
@ -528,11 +548,11 @@ dependencies that you'll find out about later.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="hl_privateheaders">Keep "Internal" Headers Private</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>Many modules have a complex implementation that causes them to use more than
one implementation (<tt>.cpp</tt>) file. It is often tempting to put the
@ -549,11 +569,11 @@ class itself. Just make them private (or protected) and all is well.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="hl_earlyexit">Use Early Exits and <tt>continue</tt> to Simplify Code</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>When reading code, keep in mind how much state and how many previous
decisions have to be remembered by the reader to understand a block of code.
@ -658,11 +678,11 @@ can be a big understandability win.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="hl_else_after_return">Don't use <tt>else</tt> after a <tt>return</tt></a>
</div>
</h4>
<div class="doc_text">
<div>
<p>For similar reasons above (reduction of indentation and easier reading),
please do not use '<tt>else</tt>' or '<tt>else if</tt>' after something that
@ -741,11 +761,11 @@ track of when reading the code.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="hl_predicateloops">Turn Predicate Loops into Predicate Functions</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>It is very common to write small loops that just compute a boolean value.
There are a number of ways that people commonly write these, but an example of
@ -802,20 +822,24 @@ locality.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="micro">The Low-Level Issues</a>
</div>
<!-- ======================================================================= -->
<h3>
<a name="micro">The Low-Level Issues</a>
</h3>
<!-- ======================================================================= -->
<div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="ll_naming">Name Types, Functions, Variables, and Enumerators Properly</a>
</div>
<h4>
<a name="ll_naming">
Name Types, Functions, Variables, and Enumerators Properly
</a>
</h4>
<div class="doc_text">
<div>
<p>Poorly-chosen names can mislead the reader and cause bugs. We cannot stress
enough how important it is to use <em>descriptive</em> names. Pick names that
@ -894,11 +918,11 @@ Vehicle MakeVehicle(VehicleType Type) {
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="ll_assert">Assert Liberally</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>Use the "<tt>assert</tt>" macro to its fullest. Check all of your
preconditions and assumptions, you never know when a bug (not necessarily even
@ -997,11 +1021,11 @@ assert(NewToSet &amp;&amp; "The value shouldn't be in the set yet");
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="ll_ns_std">Do Not Use '<tt>using namespace std</tt>'</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>In LLVM, we prefer to explicitly prefix all identifiers from the standard
namespace with an "<tt>std::</tt>" prefix, rather than rely on
@ -1035,12 +1059,13 @@ use any others.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="ll_virtual_anch">Provide a Virtual Method Anchor for Classes
in Headers</a>
</div>
<h4>
<a name="ll_virtual_anch">
Provide a Virtual Method Anchor for Classes in Headers
</a>
</h4>
<div class="doc_text">
<div>
<p>If a class is defined in a header file and has a v-table (either it has
virtual methods or it derives from classes with virtual methods), it must
@ -1052,11 +1077,11 @@ increasing link times.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="ll_end">Don't evaluate <tt>end()</tt> every time through a loop</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>Because C++ doesn't have a standard "<tt>foreach</tt>" loop (though it can be
emulated with macros and may be coming in C++'0x) we end up writing a lot of
@ -1114,11 +1139,11 @@ prefer it.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="ll_iostream"><tt>#include &lt;iostream&gt;</tt> is Forbidden</a>
</div>
</h4>
<div class="doc_text">
<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
@ -1149,11 +1174,11 @@ the <tt>llvm::MemoryBuffer</tt> API for reading files.</b></p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="ll_raw_ostream">Use <tt>raw_ostream</tt></a>
</div>
</h4>
<div class="doc_text">
<div>
<p>LLVM includes a lightweight, simple, and efficient stream implementation
in <tt>llvm/Support/raw_ostream.h</tt>, which provides all of the common
@ -1169,11 +1194,11 @@ declarations and constant references to <tt>raw_ostream</tt> instances.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="ll_avoidendl">Avoid <tt>std::endl</tt></a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>std::endl</tt> modifier, when used with <tt>iostreams</tt> outputs a
newline to the output stream specified. In addition to doing this, however, it
@ -1191,22 +1216,25 @@ it's better to use a literal <tt>'\n'</tt>.</p>
</div>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="nano">Microscopic Details</a>
</div>
</h3>
<!-- ======================================================================= -->
<div>
<p>This section describes preferred low-level formatting guidelines along with
reasoning on why we prefer them.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="micro_spaceparen">Spaces Before Parentheses</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>We prefer to put a space before an open parenthesis only in control flow
statements, but not in normal function call expressions and function-like
@ -1260,11 +1288,11 @@ this misinterpretation.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="micro_preincrement">Prefer Preincrement</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>Hard fast rule: Preincrement (<tt>++X</tt>) may be no slower than
postincrement (<tt>X++</tt>) and could very well be a lot faster than it. Use
@ -1280,11 +1308,11 @@ get in the habit of always using preincrement, and you won't have a problem.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="micro_namespaceindent">Namespace Indentation</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>
In general, we strive to reduce indentation wherever possible. This is useful
@ -1368,11 +1396,11 @@ the contents of the namespace.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="micro_anonns">Anonymous Namespaces</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>After talking about namespaces in general, you may be wondering about
anonymous namespaces in particular.
@ -1452,15 +1480,17 @@ namespace just because it was declared there.
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="seealso">See Also</a>
</div>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="seealso">See Also</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>A lot of these comments and recommendations have been culled for other
sources. Two particularly important books for our work are:</p>
@ -1491,8 +1521,8 @@ something.</p>
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-02-20 03:03:04 +0100 (Sun, 20 Feb 2011) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

View File

@ -240,6 +240,6 @@ define two separate CHECK lines that match on the same line.
=head1 AUTHORS
Maintained by The LLVM Team (L<http://llvm.org>).
Maintained by The LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -21,7 +21,7 @@ distribution.
=head1 OPTIONS
=over
=over
=item B<--additional-so> F<library>
@ -87,7 +87,7 @@ mis-management.
=item B<-find-bugs>
Continually randomize the specified passes and run them on the test program
until a bug is found or the user kills B<bugpoint>.
until a bug is found or the user kills B<bugpoint>.
=item B<-help>
@ -147,6 +147,21 @@ This option defines the command to use with the B<--run-custom> and
B<--safe-custom> options to execute the bitcode testcase. This can
be useful for cross-compilation.
=item B<--compile-command> I<command>
This option defines the command to use with the B<--compile-custom>
option to compile the bitcode testcase. This can be useful for
testing compiler output without running any link or execute stages. To
generate a reduced unit test, you may add CHECK directives to the
testcase and pass the name of an executable compile-command script in this form:
#!/bin/sh
llc "$@"
not FileCheck [bugpoint input file].ll < bugpoint-test-program.s
This script will "fail" as long as FileCheck passes. So the result
will be the minimum bitcode that passes FileCheck.
=item B<--safe-path> I<path>
This option defines the path to the command to execute with the
@ -166,6 +181,6 @@ L<opt|opt>
=head1 AUTHOR
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -3,15 +3,15 @@
<html>
<head>
<title>LLVM Command Guide</title>
<link rel="stylesheet" href="/docs/llvm.css" type="text/css">
<link rel="stylesheet" href="../llvm.css" type="text/css">
</head>
<body>
<div class="doc_title">
<h1>
LLVM Command Guide
</div>
</h1>
<div class="doc_text">
<div>
<p>These documents are HTML versions of the <a href="man/man1/">man pages</a>
for all of the LLVM tools. These pages describe how to use the LLVM commands
@ -23,12 +23,12 @@ options) arguments to the tool you are interested in.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="basic">Basic Commands</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<ul>
@ -80,12 +80,12 @@ options) arguments to the tool you are interested in.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="frontend">C and C++ Front-end Commands</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<ul>
<li><a href="/cmds/llvmgcc.html"><b>llvm-gcc</b></a> -
@ -99,13 +99,13 @@ options) arguments to the tool you are interested in.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="debug">Debugging Tools</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<ul>
@ -123,12 +123,12 @@ options) arguments to the tool you are interested in.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="internal">Internal Tools</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<ul>
<li><a href="/cmds/FileCheck.html"><b>FileCheck</b></a> -
@ -150,8 +150,8 @@ options) arguments to the tool you are interested in.</p>
<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: 2010-09-08 01:10:21 +0200 (Wed, 08 Sep 2010) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

View File

@ -349,6 +349,6 @@ L<valgrind(1)>
=head1 AUTHOR
Written by Daniel Dunbar and maintained by the LLVM Team (L<http://llvm.org>).
Written by Daniel Dunbar and maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -196,6 +196,6 @@ L<lli|lli>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -214,6 +214,6 @@ L<llc|llc>
=head1 AUTHOR
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -401,6 +401,6 @@ L<llvm-ranlib|llvm-ranlib>, ar(1)
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -72,6 +72,6 @@ L<llvm-dis|llvm-dis>, L<gccas|gccas>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -268,7 +268,7 @@ The number of bytes consumed by instructions in the function.
=item B<Average Instruction Size>
The average number of bytes consumed by the instructions in the funtion. This
The average number of bytes consumed by the instructions in the function. This
value is computed by dividing Instruction Size by Instructions.
=item B<Bytes Per Instruction>
@ -310,6 +310,6 @@ L<llvm-dis|llvm-dis>, L<http://llvm.org/docs/BitCodeFormat.html>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -126,6 +126,6 @@ occurs, it will exit with a non-zero value.
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -48,6 +48,6 @@ massive detected differences in blocks.
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -55,6 +55,6 @@ L<llvm-as|llvm-as>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -68,6 +68,6 @@ L<bugpoint|bugpoint>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -229,6 +229,6 @@ L<llvm-link|llvm-link>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -74,6 +74,6 @@ L<gccld|gccld>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -117,6 +117,6 @@ L<llvm-dis|llvm-dis>, ar(1), nm(1)
=head1 AUTHOR
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -52,6 +52,6 @@ information. Otherwise, it exits with zero.
=head1 AUTHOR
B<llvm-prof> is maintained by the LLVM Team (L<http://llvm.org>).
B<llvm-prof> is maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -47,6 +47,6 @@ L<llvm-ar|llvm-ar>, ranlib(1)
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -185,6 +185,6 @@ L<llvm-dis|llvm-dis>, L<llc|llc>, L<llvm-link|llvm-link>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -70,7 +70,7 @@ L<llvm-g++|llvmgxx>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -79,7 +79,7 @@ L<llvm-gcc|llvmgcc>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -138,6 +138,6 @@ occurs, it will exit with a non-zero value.
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -110,6 +110,6 @@ occurs, it will exit with a non-zero value.
=head1 AUTHORS
Maintained by The LLVM Team (L<http://llvm.org>).
Maintained by The LLVM Team (L<http://llvm.org/>).
=cut

View File

@ -8,9 +8,9 @@
</head>
<body>
<div class="doc_title">
<h1>
CommandLine 2.0 Library Manual
</div>
</h1>
<ol>
<li><a href="#introduction">Introduction</a></li>
@ -100,12 +100,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="introduction">Introduction</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This document describes the CommandLine argument processing library. It will
show you how to use it, and what it can do. The CommandLine library uses a
@ -184,12 +184,12 @@ href="mailto:sabre@nondot.org">Chris Lattner</a>.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="quickstart">Quick Start Guide</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This section of the manual runs through a simple CommandLine'ification of a
basic compiler tool. This is intended to show you how to jump into using the
@ -231,11 +231,11 @@ represented like this:</p>
<a href="#cl::opt">cl::opt</a>&lt;string&gt; OutputFilename("<i>o</i>", <a href="#cl::desc">cl::desc</a>("<i>Specify output filename</i>"), <a href="#cl::value_desc">cl::value_desc</a>("<i>filename</i>"));
</pre></div>
<p>This declares a global variable "<tt>OutputFilename</tt>" that is used to
capture the result of the "<tt>o</tt>" argument (first parameter). We specify
that this is a simple scalar option by using the "<tt><a
href="#cl::opt">cl::opt</a></tt>" template (as opposed to the <a
href="#list">"<tt>cl::list</tt> template</a>), and tell the CommandLine library
<p>This declares a global variable &quot;<tt>OutputFilename</tt>&quot; that is used to
capture the result of the &quot;<tt>o</tt>&quot; argument (first parameter). We specify
that this is a simple scalar option by using the &quot;<tt><a
href="#cl::opt">cl::opt</a></tt>&quot; template (as opposed to the <a
href="#list">&quot;<tt>cl::list</tt> template</a>), and tell the CommandLine library
that the data type that we are parsing is a string.</p>
<p>The second and third parameters (which are optional) are used to specify what
@ -321,14 +321,12 @@ OPTIONS:
<p>... indicating that an input filename is expected.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="bool">Boolean Arguments</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>In addition to input and output filenames, we would like the compiler example
to support three boolean flags: "<tt>-f</tt>" to force writing binary output to
@ -406,11 +404,11 @@ and <a href="#list">lists</a> of options.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="alias">Argument Aliases</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>So far, the example works well, except for the fact that we need to check the
quiet condition like this now:</p>
@ -456,12 +454,12 @@ uses.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="onealternative">Selecting an alternative from a set of
possibilities</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>So far we have seen how the CommandLine library handles builtin types like
<tt>std::string</tt>, <tt>bool</tt> and <tt>int</tt>, but how does it handle
@ -567,11 +565,11 @@ which is when you would use it.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="namedalternatives">Named Alternatives</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Another useful argument form is a named alternative style. We shall use this
style in our compiler to specify different debug levels that can be used.
@ -629,11 +627,11 @@ that you can choose the form most appropriate for your application.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="list">Parsing a list of options</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Now that we have the standard run-of-the-mill argument types out of the way,
lets get a little wild and crazy. Lets say that we want our optimizer to accept
@ -699,11 +697,11 @@ checking we have to do.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="bits">Collecting options as a set of flags</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Instead of collecting sets of options in a list, it is also possible to
gather information for enum values in a <b>bit vector</b>. The representation used by
@ -758,11 +756,11 @@ href="#list"> <tt>cl::list</tt></a> option.</p>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="description">Adding freeform text to help output</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>As our program grows and becomes more mature, we may decide to put summary
information about what it does into the help output. The help output is styled
@ -800,28 +798,27 @@ OPTIONS:
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="referenceguide">Reference Guide</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="referenceguide">Reference Guide</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Now that you know the basics of how to use the CommandLine library, this
section will give you the detailed information you need to tune how command line
options work, as well as information on more "advanced" command line option
processing capabilities.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="positional">Positional Arguments</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Positional arguments are those arguments that are not named, and are not
specified with a hyphen. Positional arguments should be used when an option is
@ -854,15 +851,12 @@ that command line options will be ordered according to how they are listed in a
are defined in multiple .cpp files. The fix for this problem is simply to
define all of your positional arguments in one .cpp file.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="--">Specifying positional options with hyphens</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>Sometimes you may want to specify a value to your positional argument that
starts with a hyphen (for example, searching for '<tt>-foo</tt>' in a file). At
@ -895,10 +889,10 @@ can use it like this:</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="getPosition">Determining absolute position with getPosition()</a>
</div>
<div class="doc_text">
</h4>
<div>
<p>Sometimes an option can affect or modify the meaning of another option. For
example, consider <tt>gcc</tt>'s <tt>-x LANG</tt> option. This tells
<tt>gcc</tt> to ignore the suffix of subsequent positional arguments and force
@ -954,11 +948,11 @@ can use it like this:</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="cl::ConsumeAfter">The <tt>cl::ConsumeAfter</tt> modifier</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>cl::ConsumeAfter</tt> <a href="#formatting">formatting option</a> is
used to construct programs that use "interpreter style" option processing. With
@ -1006,12 +1000,14 @@ href="#cl::list">cl::list</a> option.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="storage">Internal vs External Storage</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="storage">Internal vs External Storage</a>
</h3>
<div>
<p>By default, all command line options automatically hold the value that they
parse from the command line. This is very convenient in the common case,
@ -1076,11 +1072,11 @@ that <tt>DebugFlag</tt> is automatically set.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="attributes">Option Attributes</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>This section describes the basic attributes that you can specify on
options.</p>
@ -1166,11 +1162,11 @@ obviously).</li>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="modifiers">Option Modifiers</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Option modifiers are the flags and expressions that you pass into the
constructors for <tt><a href="#cl::opt">cl::opt</a></tt> and <tt><a
@ -1196,14 +1192,12 @@ category. The CommandLine library specifies defaults for all of these settings
that are the most useful in practice and the most common, which mean that you
usually shouldn't have to worry about these.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="hiding">Hiding an option from <tt>-help</tt> output</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>cl::NotHidden</tt>, <tt>cl::Hidden</tt>, and
<tt>cl::ReallyHidden</tt> modifiers are used to control whether or not an option
@ -1230,12 +1224,12 @@ indicates that the option should not appear in any help output.</li>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="numoccurrences">Controlling the number of occurrences required and
allowed</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>This group of options is used to control how many time an option is allowed
(or required) to be specified on the command line of your program. Specifying a
@ -1279,11 +1273,11 @@ retained.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="valrequired">Controlling whether or not a value must be specified</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>This group of options is used to control whether or not the option allows a
value to be present. In the case of the CommandLine library, a value is either
@ -1328,11 +1322,11 @@ when <a href="#extensionguide">extending the library</a>.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="formatting">Controlling other formatting options</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The formatting option group is used to specify that the command line option
has special abilities and is otherwise different from other command line
@ -1409,11 +1403,11 @@ strategy basically looks like this:</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="misc">Miscellaneous option modifiers</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The miscellaneous option modifiers are the only flags where you can specify
more than one flag from the set: they are not mutually exclusive. These flags
@ -1453,11 +1447,11 @@ only makes sense with a <a href="#cl::list">cl::list</a> option.</li>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="response">Response files</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>Some systems, such as certain variants of Microsoft Windows and
some older Unices have a relatively low limit on command-line
@ -1474,13 +1468,14 @@ and
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="toplevel">Top-Level Classes and Functions</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="toplevel">Top-Level Classes and Functions</a>
</h3>
<div>
<p>Despite all of the built-in flexibility, the CommandLine option library
really only consists of one function (<a
@ -1490,15 +1485,13 @@ href="#cl::list"><tt>cl::list</tt></a>, and <a
href="#cl::alias"><tt>cl::alias</tt></a>. This section describes these three
classes in detail.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="cl::ParseCommandLineOptions">The <tt>cl::ParseCommandLineOptions</tt>
function</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>cl::ParseCommandLineOptions</tt> function is designed to be called
directly from <tt>main</tt>, and is used to fill in the values of all of the
@ -1514,12 +1507,12 @@ which holds <a href="#description">additional extra text</a> to emit when the
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="cl::ParseEnvironmentOptions">The <tt>cl::ParseEnvironmentOptions</tt>
function</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>cl::ParseEnvironmentOptions</tt> function has mostly the same effects
as <a
@ -1551,12 +1544,12 @@ input.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="cl::SetVersionPrinter">The <tt>cl::SetVersionPrinter</tt>
function</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>cl::SetVersionPrinter</tt> function is designed to be called
directly from <tt>main</tt> and <i>before</i>
@ -1572,11 +1565,11 @@ called when the <tt>--version</tt> option is given by the user.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="cl::opt">The <tt>cl::opt</tt> class</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>cl::opt</tt> class is the class used to represent scalar command line
options, and is the one used most of the time. It is a templated class which
@ -1607,11 +1600,11 @@ href="#customparser">custom parser</a>.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="cl::list">The <tt>cl::list</tt> class</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>cl::list</tt> class is the class used to represent a list of command
line options. It too is a templated class which can take up to three
@ -1634,11 +1627,11 @@ be used.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="cl::bits">The <tt>cl::bits</tt> class</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>cl::bits</tt> class is the class used to represent a list of command
line options in the form of a bit vector. It is also a templated class which
@ -1659,11 +1652,11 @@ must be of <b>type</b> <tt>unsigned</tt> if external storage is used.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="cl::alias">The <tt>cl::alias</tt> class</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>cl::alias</tt> class is a nontemplated class that is used to form
aliases for other arguments.</p>
@ -1682,11 +1675,11 @@ the conversion from string to data.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="cl::extrahelp">The <tt>cl::extrahelp</tt> class</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>cl::extrahelp</tt> class is a nontemplated class that allows extra
help text to be printed out for the <tt>-help</tt> option.</p>
@ -1709,12 +1702,14 @@ single <tt>cl::extrahelp</tt> instance.</p>
</pre></div>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="builtinparsers">Builtin parsers</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="builtinparsers">Builtin parsers</a>
</h3>
<div>
<p>Parsers control how the string value taken from the command line is
translated into a typed value, suitable for use in a C++ program. By default,
@ -1773,27 +1768,27 @@ exponential notation (ex: <tt>1.7e15</tt>) and properly supports locales.
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="extensionguide">Extension Guide</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="extensionguide">Extension Guide</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Although the CommandLine library has a lot of functionality built into it
already (as discussed previously), one of its true strengths lie in its
extensibility. This section discusses how the CommandLine library works under
the covers and illustrates how to do some simple, common, extensions.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="customparser">Writing a custom parser</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>One of the simplest and most common extensions is the use of a custom parser.
As <a href="#builtinparsers">discussed previously</a>, parsers are the portion
@ -1932,11 +1927,11 @@ tutorial.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="explotingexternal">Exploiting external storage</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Several of the LLVM libraries define static <tt>cl::opt</tt> instances that
will automatically be included in any program that links with that library.
This is a feature. However, sometimes it is necessary to know the value of the
@ -1951,16 +1946,18 @@ tutorial.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="dynamicopts">Dynamically adding command line options</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>TODO: fill in this section</p>
</div>
</div>
<!-- *********************************************************************** -->
<hr>
@ -1971,8 +1968,8 @@ tutorial.</p>
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: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Tutorial - Using LLVMC</title>
<link rel="stylesheet" href="llvm.css" type="text/css" />
</head>
@ -18,7 +18,7 @@ The ReST source lives in the directory 'tools/llvmc/doc'. -->
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#introduction" id="id1">Introduction</a></li>
<li><a class="reference internal" href="#compiling-with-llvmc" id="id2">Compiling with LLVMC</a></li>
<li><a class="reference internal" href="#using-the-llvmc-program" id="id2">Using the <tt class="docutils literal">llvmc</tt> program</a></li>
<li><a class="reference internal" href="#using-llvmc-to-generate-toolchain-drivers" id="id3">Using LLVMC to generate toolchain drivers</a></li>
</ul>
</div>
@ -26,51 +26,47 @@ The ReST source lives in the directory 'tools/llvmc/doc'. -->
<p>Written by <a href="mailto:foldr@codedgers.com">Mikhail Glushenkov</a></p>
</div><div class="section" id="introduction">
<h1><a class="toc-backref" href="#id1">Introduction</a></h1>
<p>LLVMC is a generic compiler driver, which plays the same role for LLVM
as the <tt class="docutils literal"><span class="pre">gcc</span></tt> program does for GCC - the difference being that LLVMC
is designed to be more adaptable and easier to customize. Most of
LLVMC functionality is implemented via plugins, which can be loaded
dynamically or compiled in. This tutorial describes the basic usage
and configuration of LLVMC.</p>
<p>LLVMC is a generic compiler driver, which plays the same role for LLVM as the
<tt class="docutils literal">gcc</tt> program does for GCC - the difference being that LLVMC is designed to be
more adaptable and easier to customize. Most of LLVMC functionality is
implemented via high-level TableGen code, from which a corresponding C++ source
file is automatically generated. This tutorial describes the basic usage and
configuration of LLVMC.</p>
</div>
<div class="section" id="compiling-with-llvmc">
<h1><a class="toc-backref" href="#id2">Compiling with LLVMC</a></h1>
<p>In general, LLVMC tries to be command-line compatible with <tt class="docutils literal"><span class="pre">gcc</span></tt> as
much as possible, so most of the familiar options work:</p>
<div class="section" id="using-the-llvmc-program">
<h1><a class="toc-backref" href="#id2">Using the <tt class="docutils literal">llvmc</tt> program</a></h1>
<p>In general, <tt class="docutils literal">llvmc</tt> tries to be command-line compatible with <tt class="docutils literal">gcc</tt> as much
as possible, so most of the familiar options work:</p>
<pre class="literal-block">
$ llvmc -O3 -Wall hello.cpp
$ ./a.out
hello
</pre>
<p>This will invoke <tt class="docutils literal"><span class="pre">llvm-g++</span></tt> under the hood (you can see which
commands are executed by using the <tt class="docutils literal"><span class="pre">-v</span></tt> option). For further help on
command-line LLVMC usage, refer to the <tt class="docutils literal"><span class="pre">llvmc</span> <span class="pre">--help</span></tt> output.</p>
<p>This will invoke <tt class="docutils literal"><span class="pre">llvm-g++</span></tt> under the hood (you can see which commands are
executed by using the <tt class="docutils literal"><span class="pre">-v</span></tt> option). For further help on command-line LLVMC
usage, refer to the <tt class="docutils literal">llvmc <span class="pre">--help</span></tt> output.</p>
</div>
<div class="section" id="using-llvmc-to-generate-toolchain-drivers">
<h1><a class="toc-backref" href="#id3">Using LLVMC to generate toolchain drivers</a></h1>
<p>LLVMC plugins are written mostly using <a class="reference external" href="http://llvm.org/docs/TableGenFundamentals.html">TableGen</a>, so you need to
be familiar with it to get anything done.</p>
<p>Start by compiling <tt class="docutils literal"><span class="pre">example/Simple</span></tt>, which is a primitive wrapper for
<tt class="docutils literal"><span class="pre">gcc</span></tt>:</p>
<p>LLVMC-based drivers are written mostly using <a class="reference external" href="http://llvm.org/docs/TableGenFundamentals.html">TableGen</a>, so you need to be
familiar with it to get anything done.</p>
<p>Start by compiling <tt class="docutils literal">example/Simple</tt>, which is a primitive wrapper for
<tt class="docutils literal">gcc</tt>:</p>
<pre class="literal-block">
$ cd $LLVM_DIR/tools/llvmc
$ cp -r example/Simple plugins/Simple
# NB: A less verbose way to compile standalone LLVMC-based drivers is
# described in the reference manual.
$ make LLVMC_BASED_DRIVER_NAME=mygcc LLVMC_BUILTIN_PLUGINS=Simple
$ cd $LLVM_OBJ_DIR/tools/examples/Simple
$ make
$ cat &gt; hello.c
[...]
$ mygcc hello.c
#include &lt;stdio.h&gt;
int main() { printf(&quot;Hello\n&quot;); }
$ $LLVM_BIN_DIR/Simple -v hello.c
gcc hello.c -o hello.out
$ ./hello.out
Hello
</pre>
<p>Here we link our plugin with the LLVMC core statically to form an executable
file called <tt class="docutils literal"><span class="pre">mygcc</span></tt>. It is also possible to build our plugin as a dynamic
library to be loaded by the <tt class="docutils literal"><span class="pre">llvmc</span></tt> executable (or any other LLVMC-based
standalone driver); this is described in the reference manual.</p>
<p>Contents of the file <tt class="docutils literal"><span class="pre">Simple.td</span></tt> look like this:</p>
<p>We have thus produced a simple driver called, appropriately, <tt class="docutils literal">Simple</tt>, from
the input TableGen file <tt class="docutils literal">Simple.td</tt>. The <tt class="docutils literal">llvmc</tt> program itself is generated
using a similar process (see <tt class="docutils literal">llvmc/src</tt>). Contents of the file <tt class="docutils literal">Simple.td</tt>
look like this:</p>
<pre class="literal-block">
// Include common definitions
include &quot;llvm/CompilerDriver/Common.td&quot;
@ -80,33 +76,36 @@ def gcc : Tool&lt;
[(in_language &quot;c&quot;),
(out_language &quot;executable&quot;),
(output_suffix &quot;out&quot;),
(cmd_line &quot;gcc $INFILE -o $OUTFILE&quot;),
(sink)
(command &quot;gcc&quot;),
(sink),
// -o is what is used by default, out_file_option here is included for
// instructive purposes.
(out_file_option &quot;-o&quot;)
]&gt;;
// Language map
def LanguageMap : LanguageMap&lt;[LangToSuffixes&lt;&quot;c&quot;, [&quot;c&quot;]&gt;]&gt;;
def LanguageMap : LanguageMap&lt;[(lang_to_suffixes &quot;c&quot;, &quot;c&quot;)]&gt;;
// Compilation graph
def CompilationGraph : CompilationGraph&lt;[Edge&lt;&quot;root&quot;, &quot;gcc&quot;&gt;]&gt;;
def CompilationGraph : CompilationGraph&lt;[(edge &quot;root&quot;, &quot;gcc&quot;)]&gt;;
</pre>
<p>As you can see, this file consists of three parts: tool descriptions,
language map, and the compilation graph definition.</p>
<p>At the heart of LLVMC is the idea of a compilation graph: vertices in
this graph are tools, and edges represent a transformation path
between two tools (for example, assembly source produced by the
compiler can be transformed into executable code by an assembler). The
compilation graph is basically a list of edges; a special node named
<tt class="docutils literal"><span class="pre">root</span></tt> is used to mark graph entry points.</p>
<p>Tool descriptions are represented as property lists: most properties
in the example above should be self-explanatory; the <tt class="docutils literal"><span class="pre">sink</span></tt> property
means that all options lacking an explicit description should be
forwarded to this tool.</p>
<p>The <tt class="docutils literal"><span class="pre">LanguageMap</span></tt> associates a language name with a list of suffixes
and is used for deciding which toolchain corresponds to a given input
file.</p>
<p>To learn more about LLVMC customization, refer to the reference
manual and plugin source code in the <tt class="docutils literal"><span class="pre">plugins</span></tt> directory.</p>
<p>As you can see, this file consists of three parts: tool descriptions, language
map, and the compilation graph definition.</p>
<p>At the heart of LLVMC is the idea of a compilation graph: vertices in this graph
are tools, and edges represent a transformation path between two tools (for
example, assembly source produced by the compiler can be transformed into
executable code by an assembler). The compilation graph is basically a list of
edges; a special node named <tt class="docutils literal">root</tt> is used to mark graph entry points.</p>
<p>Tool descriptions are represented as property lists: most properties in the
example above should be self-explanatory; the <tt class="docutils literal">sink</tt> property means that all
options lacking an explicit description should be forwarded to this tool.</p>
<p>The <tt class="docutils literal">LanguageMap</tt> associates a language name with a list of suffixes and is
used for deciding which toolchain corresponds to a given input file.</p>
<p>To learn more about writing your own drivers with LLVMC, refer to the reference
manual and examples in the <tt class="docutils literal">examples</tt> directory. Of a particular interest is
the <tt class="docutils literal">Skeleton</tt> example, which can serve as a template for your LLVMC-based
drivers.</p>
<hr />
<address>
<a href="http://jigsaw.w3.org/css-validator/check/referer">

View File

@ -9,9 +9,9 @@
<body>
<div class="doc_title">
<h1>
Architecture/platform information for compiler writers
</div>
</h1>
<div class="doc_warning">
<p>Note: This document is a work-in-progress. Additions and clarifications
@ -43,13 +43,15 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="hw">Hardware</a></div>
<h2><a name="hw">Hardware</a></h2>
<!-- *********************************************************************** -->
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="alpha">Alpha</a></div>
<div>
<div class="doc_text">
<!-- ======================================================================= -->
<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>
@ -58,9 +60,9 @@ href="http://ftp.digital.com/pub/Digital/info/semiconductor/literature/dsc-libra
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="arm">ARM</a></div>
<h3><a name="arm">ARM</a></h3>
<div class="doc_text">
<div>
<ul>
<li><a href="http://www.arm.com/documentation/">ARM documentation</a>
(<a href="http://www.arm.com/documentation/ARMProcessor_Cores/">Processor
@ -70,9 +72,9 @@ Cores</a>)</li>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="ia64">Itanium (ia64)</a></div>
<h3><a name="ia64">Itanium (ia64)</a></h3>
<div class="doc_text">
<div>
<ul>
<li><a
href="http://developer.intel.com/design/itanium2/documentation.htm">Itanium documentation</a>
@ -81,9 +83,9 @@ href="http://developer.intel.com/design/itanium2/documentation.htm">Itanium docu
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="mips">MIPS</a></div>
<h3><a name="mips">MIPS</a></h3>
<div class="doc_text">
<div>
<ul>
<li><a
href="http://mips.com/content/Documentation/MIPSDocumentation/ProcessorArchitecture/doclibrary">MIPS
@ -92,12 +94,14 @@ Processor Architecture</a></li>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="ppc">PowerPC</a></div>
<h3><a name="ppc">PowerPC</a></h3>
<div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">IBM - Official manuals and docs</div>
<h4>IBM - Official manuals and docs</h4>
<div class="doc_text">
<div>
<ul>
<li><a
@ -129,9 +133,9 @@ PowerPC architecture</a></li>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">Other documents, collections, notes</div>
<h4>Other documents, collections, notes</h4>
<div class="doc_text">
<div>
<ul>
<li><a href="http://penguinppc.org/dev/#library">PowerPC ABI documents</a></li>
@ -143,10 +147,12 @@ branch stubs for powerpc64-linux (from binutils)</a></li>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="sparc">SPARC</a></div>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3><a name="sparc">SPARC</a></h3>
<div>
<ul>
<li><a href="http://www.sparc.org/resource.htm">SPARC resources</a></li>
@ -156,12 +162,14 @@ branch stubs for powerpc64-linux (from binutils)</a></li>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="x86">X86</a></div>
<h3><a name="x86">X86</a></h3>
<div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">AMD - Official manuals and docs</div>
<h4>AMD - Official manuals and docs</h4>
<div class="doc_text">
<div>
<ul>
<li><a
href="http://www.amd.com/us-en/Processors/TechnicalResources/0,,30_182_739,00.html">AMD processor manuals</a></li>
@ -170,9 +178,9 @@ href="http://www.amd.com/us-en/Processors/TechnicalResources/0,,30_182_739,00.ht
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">Intel - Official manuals and docs</div>
<h4>Intel - Official manuals and docs</h4>
<div class="doc_text">
<div>
<ul>
<li><a
href="http://developer.intel.com/design/pentium4/manuals/index_new.htm">IA-32
@ -184,19 +192,21 @@ Itanium documentation</a></li>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">Other x86-specific information</div>
<h4>Other x86-specific information</h4>
<div class="doc_text">
<div>
<ul>
<li><a href="http://www.agner.org/assem/calling_conventions.pdf">Calling
conventions for different C++ compilers and operating systems</a></li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="other">Other relevant lists</a></div>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3><a name="other">Other relevant lists</a></h3>
<div>
<ul>
<li><a href="http://gcc.gnu.org/readings.html">GCC reading list</a></li>
@ -204,14 +214,18 @@ conventions for different C++ compilers and operating systems</a></li>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="abi">ABI</a></div>
<h2><a name="abi">ABI</a></h2>
<!-- *********************************************************************** -->
<div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="linux">Linux</a></div>
<h3><a name="linux">Linux</a></h3>
<div class="doc_text">
<div>
<ol>
<li><a href="http://www.linuxbase.org/spec/ELF/ppc64/">PowerPC 64-bit ELF ABI
Supplement</a></li>
@ -219,9 +233,9 @@ Supplement</a></li>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="osx">OS X</a></div>
<h3><a name="osx">OS X</a></h3>
<div class="doc_text">
<div>
<ol>
<li><a
href="http://developer.apple.com/documentation/Darwin/RuntimeArchitecture-date.html">Mach-O
@ -232,8 +246,10 @@ ABI</a></li>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="misc">Miscellaneous resources</a></div>
<h2><a name="misc">Miscellaneous resources</a></h2>
<!-- *********************************************************************** -->
<ul>
@ -255,8 +271,8 @@ processors.</li>
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
<a href="http://misha.brukman.net">Misha Brukman</a><br>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

View File

@ -7,7 +7,7 @@
</head>
<body>
<div class="doc_title">Debugging JITed Code With GDB</div>
<h1>Debugging JITed Code With GDB</h1>
<ol>
<li><a href="#example">Example usage</a></li>
<li><a href="#background">Background</a></li>
@ -15,9 +15,9 @@
<div class="doc_author">Written by Reid Kleckner</div>
<!--=========================================================================-->
<div class="doc_section"><a name="example">Example usage</a></div>
<h2><a name="example">Example usage</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>In order to debug code JITed by LLVM, you need GDB 7.0 or newer, which is
available on most modern distributions of Linux. The version of GDB that Apple
@ -96,9 +96,9 @@ function names.
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="background">Background</a></div>
<h2><a name="background">Background</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>Without special runtime support, debugging dynamically generated code with
GDB (as well as most debuggers) can be quite painful. Debuggers generally read
@ -145,8 +145,8 @@ coordinate with GDB to get better debug information.
<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:reid.kleckner@gmail.com">Reid Kleckner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-07-07 22:16:45 +0200 (Wed, 07 Jul 2010) $
<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) $
</address>
</body>
</html>

View File

@ -8,7 +8,7 @@
</head>
<body>
<div class="doc_title">LLVM Developer Policy</div>
<h1>LLVM Developer Policy</h1>
<ol>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#policies">Developer Policies</a>
@ -34,9 +34,9 @@
<div class="doc_author">Written by the LLVM Oversight Team</div>
<!--=========================================================================-->
<div class="doc_section"><a name="introduction">Introduction</a></div>
<h2><a name="introduction">Introduction</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>This document contains the LLVM Developer Policy which defines the project's
policy towards developers and their contributions. The intent of this policy
is to eliminate miscommunication, rework, and confusion that might arise from
@ -63,20 +63,19 @@
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="policies">Developer Policies</a></div>
<h2><a name="policies">Developer Policies</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>This section contains policies that pertain to frequent LLVM developers. We
always welcome <a href="#patches">one-off patches</a> from people who do not
routinely contribute to LLVM, but we expect more from frequent contributors
to keep the system as efficient as possible for everyone. Frequent LLVM
contributors are expected to meet the following requirements in order for
LLVM to maintain a high standard of quality.<p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="informed">Stay Informed</a> </div>
<div class="doc_text">
<h3><a name="informed">Stay Informed</a></h3>
<div>
<p>Developers should stay informed by reading at least the "dev" mailing list
for the projects you are interested in, such as
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">llvmdev</a> for
@ -102,9 +101,9 @@
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="patches">Making a Patch</a></div>
<h3><a name="patches">Making a Patch</a></h3>
<div class="doc_text">
<div>
<p>When making a patch for review, the goal is to make it as easy for the
reviewer to read it as possible. As such, we recommend that you:</p>
@ -142,8 +141,8 @@
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="reviews">Code Reviews</a></div>
<div class="doc_text">
<h3><a name="reviews">Code Reviews</a></h3>
<div>
<p>LLVM has a code review policy. Code review is one way to increase the quality
of software. We generally follow these policies:</p>
@ -174,8 +173,8 @@
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="owners">Code Owners</a></div>
<div class="doc_text">
<h3><a name="owners">Code Owners</a></h3>
<div>
<p>The LLVM Project relies on two features of its process to maintain rapid
development in addition to the high quality of its source base: the
@ -225,8 +224,8 @@
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="testcases">Test Cases</a></div>
<div class="doc_text">
<h3><a name="testcases">Test Cases</a></h3>
<div>
<p>Developers are required to create test cases for any bugs fixed and any new
features added. Some tips for getting your testcase approved:</p>
@ -258,8 +257,8 @@
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="quality">Quality</a></div>
<div class="doc_text">
<h3><a name="quality">Quality</a></h3>
<div>
<p>The minimum quality standards that any change must satisfy before being
committed to the main development branch are:</p>
@ -318,9 +317,8 @@
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection">
<a name="commitaccess">Obtaining Commit Access</a></div>
<div class="doc_text">
<h3><a name="commitaccess">Obtaining Commit Access</a></h3>
<div>
<p>We grant commit access to contributors with a track record of submitting high
quality patches. If you would like commit access, please send an email to
@ -381,8 +379,8 @@
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="newwork">Making a Major Change</a></div>
<div class="doc_text">
<h3><a name="newwork">Making a Major Change</a></h3>
<div>
<p>When a developer begins a major new project with the aim of contributing it
back to LLVM, s/he should inform the community with an email to
the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">llvmdev</a>
@ -410,9 +408,8 @@
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="incremental">Incremental Development</a>
</div>
<div class="doc_text">
<h3><a name="incremental">Incremental Development</a></h3>
<div>
<p>In the LLVM project, we do all significant changes as a series of incremental
patches. We have a strong dislike for huge changes or long-term development
branches. Long-term development branches have a number of drawbacks:</p>
@ -472,9 +469,8 @@
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="attribution">Attribution of
Changes</a></div>
<div class="doc_text">
<h3><a name="attribution">Attribution of Changes</a></h3>
<div>
<p>We believe in correct attribution of contributions to their contributors.
However, we do not want the source code to be littered with random
attributions "this code written by J. Random Hacker" (this is noisy and
@ -486,13 +482,15 @@ Changes</a></div>
<p>Overall, please do not add contributor names to the source code.</p>
</div>
<!--=========================================================================-->
<div class="doc_section">
<a name="clp">Copyright, License, and Patents</a>
</div>
<!--=========================================================================-->
<h2>
<a name="clp">Copyright, License, and Patents</a>
</h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>This section addresses the issues of copyright, license and patents for the
LLVM project. Currently, the University of Illinois is the LLVM copyright
holder and the terms of its license to LLVM users and developers is the
@ -504,11 +502,10 @@ Changes</a></div>
legal matters but does not provide legal advice. We are not lawyers, please
seek legal counsel from an attorney.</p>
</div>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="copyright">Copyright</a></div>
<div class="doc_text">
<h3><a name="copyright">Copyright</a></h3>
<div>
<p>The LLVM project does not require copyright assignments, which means that the
copyright for the code in the project is held by its respective contributors
@ -530,8 +527,8 @@ Changes</a></div>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="license">License</a></div>
<div class="doc_text">
<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
<a href="http://www.opensource.org/licenses/UoI-NCSA.php">University of
@ -585,8 +582,8 @@ Changes</a></div>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="patents">Patents</a></div>
<div class="doc_text">
<h3><a name="patents">Patents</a></h3>
<div>
<p>To the best of our knowledge, LLVM does not infringe on any patents (we have
actually removed code from LLVM in the past that was found to infringe).
Having code in LLVM that infringes on patents would violate an important goal
@ -602,6 +599,8 @@ Changes</a></div>
details.</p>
</div>
</div>
<!-- *********************************************************************** -->
<hr>
<address>
@ -611,8 +610,8 @@ Changes</a></div>
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
Written by the
<a href="mailto:llvm-oversight@cs.uiuc.edu">LLVM Oversight Group</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-11-16 22:32:53 +0100 (Tue, 16 Nov 2010) $
<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) $
</address>
</body>
</html>

View File

@ -11,7 +11,7 @@
<body>
<div class="doc_title">Exception Handling in LLVM</div>
<h1>Exception Handling in LLVM</h1>
<table class="layout" style="width:100%">
<tr class="layout">
@ -58,10 +58,10 @@
<!-- *********************************************************************** -->
<div class="doc_section"><a name="introduction">Introduction</a></div>
<h2><a name="introduction">Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This document is the central repository for all information pertaining to
exception handling in LLVM. It describes the format that LLVM exception
@ -70,14 +70,12 @@
provides specific examples of what exception handling information is used for
in C/C++.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="itanium">Itanium ABI Zero-cost Exception Handling</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Exception handling for most programming languages is designed to recover from
conditions that rarely occur during general use of an application. To that
@ -106,11 +104,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="sjlj">Setjmp/Longjmp Exception Handling</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Setjmp/Longjmp (SJLJ) based exception handling uses LLVM intrinsics
<a href="#llvm_eh_sjlj_setjmp"><tt>llvm.eh.sjlj.setjmp</tt></a> and
@ -138,11 +136,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="overview">Overview</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>When an exception is thrown in LLVM code, the runtime does its best to find a
handler suited to processing the circumstance.</p>
@ -185,12 +183,14 @@
</div>
<!-- ======================================================================= -->
<div class="doc_section">
<a name="codegen">LLVM Code Generation</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h2>
<a name="codegen">LLVM Code Generation</a>
</h2>
<div>
<p>At the time of this writing, only C++ exception handling support is available
in LLVM. So the remainder of this document will be somewhat C++-centric.</p>
@ -200,14 +200,12 @@
we will describe the implementation of LLVM exception handling in terms of
C++ examples.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="throw">Throw</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Languages that support exception handling typically provide a <tt>throw</tt>
operation to initiate the exception process. Internally, a throw operation
@ -225,11 +223,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="try_catch">Try/Catch</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>A call within the scope of a <i>try</i> statement can potentially raise an
exception. In those circumstances, the LLVM C++ front-end replaces the call
@ -313,11 +311,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="cleanups">Cleanups</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>To handle destructors and cleanups in <tt>try</tt> code, control may not run
directly from a landing pad to the first catch. Control may actually flow
@ -332,11 +330,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="throw_filters">Throw Filters</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>C++ allows the specification of which exception types can be thrown from a
function. To represent this a top level landing pad may exist to filter out
@ -359,11 +357,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="restrictions">Restrictions</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The semantics of the invoke instruction require that any exception that
unwinds through an invoke call should result in a branch to the invoke's
@ -384,25 +382,25 @@
</div>
<!-- ======================================================================= -->
<div class="doc_section">
<a name="format_common_intrinsics">Exception Handling Intrinsics</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h2>
<a name="format_common_intrinsics">Exception Handling Intrinsics</a>
</h2>
<div>
<p>LLVM uses several intrinsic functions (name prefixed with "llvm.eh") to
provide exception handling information at various points in generated
code.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="llvm_eh_exception">llvm.eh.exception</a>
</div>
</h4>
<div class="doc_text">
<div>
<pre>
i8* %<a href="#llvm_eh_exception">llvm.eh.exception</a>()
@ -413,11 +411,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="llvm_eh_selector">llvm.eh.selector</a>
</div>
</h4>
<div class="doc_text">
<div>
<pre>
i32 %<a href="#llvm_eh_selector">llvm.eh.selector</a>(i8*, i8*, ...)
@ -445,11 +443,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="llvm_eh_typeid_for">llvm.eh.typeid.for</a>
</div>
</h4>
<div class="doc_text">
<div>
<pre>
i32 %<a href="#llvm_eh_typeid_for">llvm.eh.typeid.for</a>(i8*)
@ -463,11 +461,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="llvm_eh_sjlj_setjmp">llvm.eh.sjlj.setjmp</a>
</div>
</h4>
<div class="doc_text">
<div>
<pre>
i32 %<a href="#llvm_eh_sjlj_setjmp">llvm.eh.sjlj.setjmp</a>(i8*)
@ -492,11 +490,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="llvm_eh_sjlj_longjmp">llvm.eh.sjlj.longjmp</a>
</div>
</h4>
<div class="doc_text">
<div>
<pre>
void %<a href="#llvm_eh_sjlj_longjmp">llvm.eh.sjlj.setjmp</a>(i8*)
@ -507,16 +505,16 @@
style exception handling. The single parameter is a pointer to a
buffer populated by <a href="#llvm_eh_sjlj_setjmp">
<tt>llvm.eh.sjlj.setjmp</tt></a>. The frame pointer and stack pointer
are restored from the buffer, then control is transfered to the
are restored from the buffer, then control is transferred to the
destination address.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="llvm_eh_sjlj_lsda">llvm.eh.sjlj.lsda</a>
</div>
</h4>
<div class="doc_text">
<div>
<pre>
i8* %<a href="#llvm_eh_sjlj_lsda">llvm.eh.sjlj.lsda</a>()
@ -531,11 +529,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="llvm_eh_sjlj_callsite">llvm.eh.sjlj.callsite</a>
</div>
</h4>
<div class="doc_text">
<div>
<pre>
void %<a href="#llvm_eh_sjlj_callsite">llvm.eh.sjlj.callsite</a>(i32)
@ -549,11 +547,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="llvm_eh_sjlj_dispatchsetup">llvm.eh.sjlj.dispatchsetup</a>
</div>
</h4>
<div class="doc_text">
<div>
<pre>
void %<a href="#llvm_eh_sjlj_dispatchsetup">llvm.eh.sjlj.dispatchsetup</a>(i32)
@ -565,24 +563,24 @@
</div>
<!-- ======================================================================= -->
<div class="doc_section">
<a name="asm">Asm Table Formats</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h2>
<a name="asm">Asm Table Formats</a>
</h2>
<div>
<p>There are two tables that are used by the exception handling runtime to
determine which actions should take place when an exception is thrown.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="unwind_tables">Exception Handling Frame</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>An exception handling frame <tt>eh_frame</tt> is very similar to the unwind
frame used by dwarf debug info. The frame contains all the information
@ -596,11 +594,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="exception_tables">Exception Tables</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>An exception table contains information about what actions to take when an
exception is thrown in a particular part of a function's code. There is one
@ -611,12 +609,14 @@
</div>
<!-- ======================================================================= -->
<div class="doc_section">
<a name="todo">ToDo</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h2>
<a name="todo">ToDo</a>
</h2>
<div>
<ol>
@ -636,8 +636,8 @@
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: 2010-12-10 00:05:48 +0100 (Fri, 10 Dec 2010) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

View File

@ -8,9 +8,9 @@
<body>
<div class="doc_title">
<h1>
Extending LLVM: Adding instructions, intrinsics, types, etc.
</div>
</h1>
<ol>
<li><a href="#introduction">Introduction and Warning</a></li>
@ -31,12 +31,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="introduction">Introduction and Warning</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>During the course of using LLVM, you may wish to customize it for your
research project or for experimentation. At this point, you may realize that
@ -68,12 +68,12 @@ effort by doing so.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="intrinsic">Adding a new intrinsic function</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Adding a new intrinsic function to LLVM is much easier than adding a new
instruction. Almost all extensions to LLVM should start as an intrinsic
@ -130,12 +130,12 @@ support for it. Generally you must do the following steps:</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="sdnode">Adding a new SelectionDAG node</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>As with intrinsics, adding a new SelectionDAG node to LLVM is much easier
than adding a new instruction. New nodes are often added to help represent
@ -220,12 +220,12 @@ complicated behavior in a single node (rotate).</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="instruction">Adding a new instruction</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p><span class="doc_warning">WARNING: adding instructions changes the bitcode
format, and it will take some effort to maintain compatibility with
@ -277,25 +277,23 @@ to understand this new instruction.</p>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="type">Adding a new type</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p><span class="doc_warning">WARNING: adding new types changes the bitcode
format, and will break compatibility with currently-existing LLVM
installations.</span> Only add new types if it is absolutely necessary.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="fund_type">Adding a fundamental type</a>
</div>
</h3>
<div class="doc_text">
<div>
<ol>
@ -317,11 +315,11 @@ installations.</span> Only add new types if it is absolutely necessary.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="derived_type">Adding a derived type</a>
</div>
</h3>
<div class="doc_text">
<div>
<ol>
<li><tt>llvm/include/llvm/Type.h</tt>:
@ -373,6 +371,8 @@ void calcTypeName(const Type *Ty,
</div>
</div>
<!-- *********************************************************************** -->
<hr>
@ -382,9 +382,9 @@ void calcTypeName(const Type *Ty,
<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>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a>
<br>
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

View File

@ -12,9 +12,9 @@
</head>
<body>
<div class="doc_title">
<h1>
LLVM: Frequently Asked Questions
</div>
</h1>
<ol>
<li><a href="#license">License</a>
@ -133,14 +133,14 @@
</ol>
<div class="doc_author">
<p>Written by <a href="http://llvm.org">The LLVM Team</a></p>
<p>Written by <a href="http://llvm.org/">The LLVM Team</a></p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="license">License</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="question">
@ -189,9 +189,9 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="source">Source Code</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="question">
@ -227,9 +227,9 @@ LLVM have been ported to a plethora of platforms.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="build">Build Problems</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="question">
@ -449,7 +449,9 @@ Stop.
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="felangs">Source Languages</a></div>
<h2>
<a name="felangs">Source Languages</a>
</h2>
<div class="question">
<p><a name="langs">What source languages are supported?</a></p>
@ -555,9 +557,9 @@ Stop.
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="cfe">Using the GCC Front End</a>
</div>
</h2>
<div class="question">
<p>When I compile software that uses a configure script, the configure script
@ -712,9 +714,9 @@ Stop.
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="cfe_code">Questions about code generated by the GCC front-end</a>
</div>
</h2>
<div class="question">
<p><a name="iosinit">What is this <tt>llvm.global_ctors</tt> and
@ -930,8 +932,8 @@ F.i:
<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: 2010-05-28 19:07:41 +0200 (Fri, 28 May 2010) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-19 01:59:50 +0200 (Tue, 19 Apr 2011) $
</address>
</body>

View File

@ -8,9 +8,9 @@
</head>
<body>
<div class="doc_title">
<h1>
Building the LLVM GCC Front-End
</div>
</h1>
<ol>
<li><a href="#instructions">Building llvm-gcc from Source</a></li>
@ -24,10 +24,10 @@
</div>
<!-- *********************************************************************** -->
<h1><a name="instructions">Building llvm-gcc from Source</a></h1>
<h2><a name="instructions">Building llvm-gcc from Source</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This section describes how to acquire and build llvm-gcc 4.2, which is based
on the GCC 4.2.1 front-end. Supported languages are Ada, C, C++, Fortran,
@ -67,10 +67,10 @@ svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk <i>dst-directory</i>
</div>
<!-- *********************************************************************** -->
<h1><a name="ada">Building the Ada front-end</a></h1>
<h2><a name="ada">Building the Ada front-end</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Building with support for Ada amounts to following the directions in the
top-level <tt>README.LLVM</tt> file, adding ",ada" to EXTRALANGS, for example:
<tt>EXTRALANGS=,ada</tt></p>
@ -100,7 +100,7 @@ top-level <tt>README.LLVM</tt> file, adding ",ada" to EXTRALANGS, for example:
<li><p>Because the Ada front-end is experimental, it is wise to build the
compiler with checking enabled. This causes it to run much slower, but
helps catch mistakes in the compiler (please report any problems using
<a href="http://llvm.org/bugs">LLVM bugzilla</a>).</p></li>
<a href="http://llvm.org/bugs/">LLVM bugzilla</a>).</p></li>
<li><p>The Ada front-end <a href="http://llvm.org/PR2007">fails to
bootstrap</a>, due to lack of LLVM support for
<tt>setjmp</tt>/<tt>longjmp</tt> style exception handling (used
@ -233,10 +233,10 @@ make install
</div>
<!-- *********************************************************************** -->
<h1><a name="fortran">Building the Fortran front-end</a></h1>
<h2><a name="fortran">Building the Fortran front-end</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>To build with support for Fortran, follow the directions in the top-level
<tt>README.LLVM</tt> file, adding ",fortran" to EXTRALANGS, for example:</p>
@ -247,10 +247,10 @@ EXTRALANGS=,fortran
</div>
<!-- *********************************************************************** -->
<h1><a name="license">License Information</a></h1>
<h2><a name="license">License Information</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
The LLVM GCC frontend is licensed to you under the GNU General Public License
and the GNU Lesser General Public License. Please see the files COPYING and
@ -271,8 +271,8 @@ More information is <a href="FAQ.html#license">available in the FAQ</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: 2010-08-31 21:40:21 +0200 (Tue, 31 Aug 2010) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

View File

@ -13,9 +13,9 @@
</head>
<body>
<div class="doc_title">
<h1>
Accurate Garbage Collection with LLVM
</div>
</h1>
<ol>
<li><a href="#introduction">Introduction</a>
@ -79,12 +79,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="introduction">Introduction</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Garbage collection is a widely used technique that frees the programmer from
having to know the lifetimes of heap objects, making software easier to produce
@ -124,14 +124,12 @@ techniques dominates any low-level losses.</p>
<p>This document describes the mechanisms and interfaces provided by LLVM to
support accurate garbage collection.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="feature">Goals and non-goals</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>LLVM's intermediate representation provides <a href="#intrinsics">garbage
collection intrinsics</a> that offer support for a broad class of
@ -151,14 +149,14 @@ collector models. For instance, the intrinsics permit:</p>
support a broad class of garbage collected languages including Scheme, ML, Java,
C#, Perl, Python, Lua, Ruby, other scripting languages, and more.</p>
<p>However, LLVM does not itself provide a garbage collector&#151;this should
<p>However, LLVM does not itself provide a garbage collector&mdash;this should
be part of your language's runtime library. LLVM provides a framework for
compile time <a href="#plugin">code generation plugins</a>. The role of these
plugins is to generate code and data structures which conforms to the <em>binary
interface</em> specified by the <em>runtime library</em>. This is similar to the
relationship between LLVM and DWARF debugging info, for example. The
difference primarily lies in the lack of an established standard in the domain
of garbage collection&#151;thus the plugins.</p>
of garbage collection&mdash;thus the plugins.</p>
<p>The aspects of the binary interface with which LLVM's GC support is
concerned are:</p>
@ -198,13 +196,15 @@ compiler matures.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="quickstart">Getting started</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="quickstart">Getting started</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Using a GC with LLVM implies many things, for example:</p>
@ -246,14 +246,12 @@ compiler matures.</p>
includes a highly portable, built-in ShadowStack code generator. It is compiled
into <tt>llc</tt> and works even with the interpreter and C backends.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="quickstart-compiler">In your compiler</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>To turn the shadow stack on for your functions, first call:</p>
@ -276,11 +274,11 @@ switching to a more advanced GC.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="quickstart-runtime">In your runtime</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The shadow stack doesn't imply a memory allocation algorithm. A semispace
collector or building atop <tt>malloc</tt> are great places to start, and can
@ -343,11 +341,11 @@ void visitGCRoots(void (*Visitor)(void **Root, const void *Meta)) {
}</pre></div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="shadow-stack">About the shadow stack</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Unlike many GC algorithms which rely on a cooperative code generator to
compile stack maps, this algorithm carefully maintains a linked list of stack
@ -372,13 +370,15 @@ in order to improve performance.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="core">IR features</a><a name="intrinsics"></a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="core">IR features</a><a name="intrinsics"></a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This section describes the garbage collection facilities provided by the
<a href="LangRef.html">LLVM intermediate representation</a>. The exact behavior
@ -390,18 +390,16 @@ intended to be a complete interface to any garbage collector. A program will
need to interface with the GC library using the facilities provided by that
program.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="gcattr">Specifying GC code generation: <tt>gc "..."</tt></a>
</div>
</h3>
<div class="doc_code"><tt>
define <i>ty</i> @<i>name</i>(...) <span style="text-decoration: underline">gc "<i>name</i>"</span> { ...
</tt></div>
<div class="doc_text">
<div>
<p>The <tt>gc</tt> function attribute is used to specify the desired GC style
to the compiler. Its programmatic equivalent is the <tt>setGC</tt> method of
@ -418,15 +416,15 @@ programs that use different garbage collection algorithms (or none at all).</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="gcroot">Identifying GC roots on the stack: <tt>llvm.gcroot</tt></a>
</div>
</h3>
<div class="doc_code"><tt>
void @llvm.gcroot(i8** %ptrloc, i8* %metadata)
</tt></div>
<div class="doc_text">
<div>
<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
@ -494,11 +492,11 @@ CodeBlock:
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="barriers">Reading and writing references in the heap</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Some collectors need to be informed when the mutator (the program that needs
garbage collection) either reads a pointer from or writes a pointer to a field
@ -534,18 +532,16 @@ require the corresponding barrier. Such a GC plugin will replace the intrinsic
calls with the corresponding <tt>load</tt> or <tt>store</tt> instruction if they
are used.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="gcwrite">Write barrier: <tt>llvm.gcwrite</tt></a>
</div>
</h4>
<div class="doc_code"><tt>
void @llvm.gcwrite(i8* %value, i8* %object, i8** %derived)
</tt></div>
<div class="doc_text">
<div>
<p>For write barriers, LLVM provides the <tt>llvm.gcwrite</tt> intrinsic
function. It has exactly the same semantics as a non-volatile <tt>store</tt> to
@ -559,15 +555,15 @@ implement reference counting.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="gcread">Read barrier: <tt>llvm.gcread</tt></a>
</div>
</h4>
<div class="doc_code"><tt>
i8* @llvm.gcread(i8* %object, i8** %derived)<br>
</tt></div>
<div class="doc_text">
<div>
<p>For read barriers, LLVM provides the <tt>llvm.gcread</tt> intrinsic function.
It has exactly the same semantics as a non-volatile <tt>load</tt> from the
@ -580,13 +576,17 @@ writes.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="plugin">Implementing a collector plugin</a>
</div>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="plugin">Implementing a collector plugin</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>User code specifies which GC code generation to use with the <tt>gc</tt>
function attribute or, equivalently, with the <tt>setGC</tt> method of
@ -666,14 +666,12 @@ $ llvm-as &lt; sample.ll | llc -load=MyGC.so</pre></blockquote>
<p>It is also possible to statically link the collector plugin into tools, such
as a language-specific compiler front-end.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="collector-algos">Overview of available features</a>
</div>
</h3>
<div class="doc_text">
<div>
<p><tt>GCStrategy</tt> provides a range of features through which a plugin
may do useful work. Some of these are callbacks, some are algorithms that can
@ -958,11 +956,11 @@ interest.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="stack-map">Computing stack maps</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>LLVM automatically computes a stack map. One of the most important features
of a <tt>GCStrategy</tt> is to compile this information into the executable in
@ -1014,11 +1012,11 @@ for collector plugins which implement reference counting or a shadow stack.</p>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="init-roots">Initializing roots to null: <tt>InitRoots</tt></a>
</div>
</h3>
<div class="doc_text">
<div>
<blockquote><pre
>MyGC::MyGC() {
@ -1039,12 +1037,12 @@ this feature should be used by all GC plugins. It is enabled by default.</p>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="custom">Custom lowering of intrinsics: <tt>CustomRoots</tt>,
<tt>CustomReadBarriers</tt>, and <tt>CustomWriteBarriers</tt></a>
</div>
</h3>
<div class="doc_text">
<div>
<p>For GCs which use barriers or unusual treatment of stack roots, these
flags allow the collector to perform arbitrary transformations of the LLVM
@ -1129,11 +1127,11 @@ bool MyGC::performCustomLowering(Function &amp;F) {
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="safe-points">Generating safe points: <tt>NeededSafePoints</tt></a>
</div>
</h3>
<div class="doc_text">
<div>
<p>LLVM can compute four kinds of safe points:</p>
@ -1193,11 +1191,11 @@ safe point (because only the topmost function has been patched).</p>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="assembly">Emitting assembly code: <tt>GCMetadataPrinter</tt></a>
</div>
</h3>
<div class="doc_text">
<div>
<p>LLVM allows a plugin to print arbitrary assembly code before and after the
rest of a module's assembly code. At the end of the module, the GC can compile
@ -1341,14 +1339,15 @@ void MyGCPrinter::finishAssembly(std::ostream &amp;OS, AsmPrinter &amp;AP,
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="references">References</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="references">References</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p><a name="appel89">[Appel89]</a> Runtime Tags Aren't Necessary. Andrew
W. Appel. Lisp and Symbolic Computation 19(7):703-705, July 1989.</p>
@ -1379,8 +1378,8 @@ Fergus Henderson. International Symposium on Memory Management 2002.</p>
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: 2010-05-11 22:16:09 +0200 (Tue, 11 May 2010) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

View File

@ -11,9 +11,9 @@
</head>
<body>
<div class="doc_title">
<h1>
The Often Misunderstood GEP Instruction
</div>
</h1>
<ol>
<li><a href="#intro">Introduction</a></li>
@ -58,10 +58,10 @@
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro"><b>Introduction</b></a></div>
<h2><a name="intro">Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This document seeks to dispel the mystery and confusion surrounding LLVM's
<a href="LangRef.html#i_getelementptr">GetElementPtr</a> (GEP) instruction.
Questions about the wily GEP instruction are
@ -72,21 +72,20 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="addresses"><b>Address Computation</b></a></div>
<h2><a name="addresses">Address Computation</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>When people are first confronted with the GEP instruction, they tend to
relate it to known concepts from other programming paradigms, most notably C
array indexing and field selection. GEP closely resembles C array indexing
and field selection, however it's is a little different and this leads to
the following questions.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="firstptr"><b>What is the first index of the GEP instruction?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="firstptr">What is the first index of the GEP instruction?</a>
</h3>
<div>
<p>Quick answer: The index stepping through the first operand.</p>
<p>The confusion with the first index usually arises from thinking about
the GetElementPtr instruction as if it was a C index operator. They aren't the
@ -205,11 +204,11 @@ idx3 = (char*) &amp;MyVar + 8
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="extra_index"><b>Why is the extra 0 index required?</b></a>
</div>
<h3>
<a name="extra_index">Why is the extra 0 index required?</a>
</h3>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Quick answer: there are no superfluous indices.</p>
<p>This question arises most often when the GEP instruction is applied to a
global variable which is always a pointer type. For example, consider
@ -247,10 +246,10 @@ idx3 = (char*) &amp;MyVar + 8
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="deref"><b>What is dereferenced by GEP?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="deref">What is dereferenced by GEP?</a>
</h3>
<div>
<p>Quick answer: nothing.</p>
<p>The GetElementPtr instruction dereferences nothing. That is, it doesn't
access memory in any way. That's what the Load and Store instructions are for.
@ -302,10 +301,10 @@ idx3 = (char*) &amp;MyVar + 8
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="lead0"><b>Why don't GEP x,0,0,1 and GEP x,1 alias?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="lead0">Why don't GEP x,0,0,1 and GEP x,1 alias?</a>
</h3>
<div>
<p>Quick Answer: They compute different address locations.</p>
<p>If you look at the first indices in these GEP
instructions you find that they are different (0 and 1), therefore the address
@ -331,10 +330,10 @@ idx3 = (char*) &amp;MyVar + 8
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="trail0"><b>Why do GEP x,1,0,0 and GEP x,1 alias?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="trail0">Why do GEP x,1,0,0 and GEP x,1 alias?</a>
</h3>
<div>
<p>Quick Answer: They compute the same address location.</p>
<p>These two GEP instructions will compute the same address because indexing
through the 0th element does not change the address. However, it does change
@ -355,10 +354,10 @@ idx3 = (char*) &amp;MyVar + 8
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="vectors"><b>Can GEP index into vector elements?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="vectors">Can GEP index into vector elements?</a>
</h3>
<div>
<p>This hasn't always been forcefully disallowed, though it's not recommended.
It leads to awkward special cases in the optimizers, and fundamental
inconsistency in the IR. In the future, it will probably be outright
@ -368,10 +367,10 @@ idx3 = (char*) &amp;MyVar + 8
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="addrspace"><b>What effect do address spaces have on GEPs?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="addrspace">What effect do address spaces have on GEPs?</a>
</h3>
<div>
<p>None, except that the address space qualifier on the first operand pointer
type always matches the address space qualifier on the result type.</p>
@ -379,11 +378,12 @@ idx3 = (char*) &amp;MyVar + 8
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="int"><b>How is GEP different from ptrtoint, arithmetic,
and inttoptr?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="int">
How is GEP different from ptrtoint, arithmetic, and inttoptr?
</a>
</h3>
<div>
<p>It's very similar; there are only subtle differences.</p>
<p>With ptrtoint, you have to pick an integer type. One approach is to pick i64;
@ -409,11 +409,13 @@ idx3 = (char*) &amp;MyVar + 8
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="be"><b>I'm writing a backend for a target which needs custom
lowering for GEP. How do I do this?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="be">
I'm writing a backend for a target which needs custom lowering for GEP.
How do I do this?
</a>
</h3>
<div>
<p>You don't. The integer computation implied by a GEP is target-independent.
Typically what you'll need to do is make your backend pattern-match
expressions trees involving ADD, MUL, etc., which are what GEP is lowered
@ -431,10 +433,10 @@ idx3 = (char*) &amp;MyVar + 8
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="vla"><b>How does VLA addressing work with GEPs?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="vla">How does VLA addressing work with GEPs?</a>
</h3>
<div>
<p>GEPs don't natively support VLAs. LLVM's type system is entirely static,
and GEP address computations are guided by an LLVM type.</p>
@ -450,16 +452,18 @@ idx3 = (char*) &amp;MyVar + 8
VLA and non-VLA indexing in the same manner.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="rules"><b>Rules</b></a></div>
<!-- *********************************************************************** -->
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="bounds"><b>What happens if an array index is out of bounds?</b></a>
</div>
<div class="doc_text">
<!-- *********************************************************************** -->
<h2><a name="rules">Rules</a></h2>
<!-- *********************************************************************** -->
<div>
<!-- *********************************************************************** -->
<h3>
<a name="bounds">What happens if an array index is out of bounds?</a>
</h3>
<div>
<p>There are two senses in which an array index can be out of bounds.</p>
<p>First, there's the array type which comes from the (static) type of
@ -498,20 +502,20 @@ idx3 = (char*) &amp;MyVar + 8
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="negative"><b>Can array indices be negative?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="negative">Can array indices be negative?</a>
</h3>
<div>
<p>Yes. This is basically a special case of array indices being out
of bounds.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="compare"><b>Can I compare two values computed with GEPs?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="compare">Can I compare two values computed with GEPs?</a>
</h3>
<div>
<p>Yes. If both addresses are within the same allocated object, or
one-past-the-end, you'll get the comparison result you expect. If either
is outside of it, integer arithmetic wrapping may occur, so the
@ -520,11 +524,13 @@ idx3 = (char*) &amp;MyVar + 8
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="types"><b>Can I do GEP with a different pointer type than the type of
the underlying object?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="types">
Can I do GEP with a different pointer type than the type of
the underlying object?
</a>
</h3>
<div>
<p>Yes. There are no restrictions on bitcasting a pointer value to an arbitrary
pointer type. The types in a GEP serve only to define the parameters for the
underlying integer computation. They need not correspond with the actual
@ -538,11 +544,12 @@ idx3 = (char*) &amp;MyVar + 8
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="null"><b>Can I cast an object's address to integer and add it
to null?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="null">
Can I cast an object's address to integer and add it to null?
</a>
</h3>
<div>
<p>You can compute an address that way, but if you use GEP to do the add,
you can't use that pointer to actually access the object, unless the
object is managed outside of LLVM.</p>
@ -562,11 +569,13 @@ idx3 = (char*) &amp;MyVar + 8
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="ptrdiff"><b>Can I compute the distance between two objects, and add
that value to one address to compute the other address?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="ptrdiff">
Can I compute the distance between two objects, and add
that value to one address to compute the other address?
</a>
</h3>
<div>
<p>As with arithmetic on null, You can use GEP to compute an address that
way, but you can't use that pointer to actually access the object if you
do, unless the object is managed outside of LLVM.</p>
@ -577,10 +586,10 @@ idx3 = (char*) &amp;MyVar + 8
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="tbaa"><b>Can I do type-based alias analysis on LLVM IR?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="tbaa">Can I do type-based alias analysis on LLVM IR?</a>
</h3>
<div>
<p>You can't do type-based alias analysis using LLVM's built-in type system,
because LLVM has no restrictions on mixing types in addressing, loads or
stores.</p>
@ -594,10 +603,10 @@ idx3 = (char*) &amp;MyVar + 8
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="overflow"><b>What happens if a GEP computation overflows?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="overflow">What happens if a GEP computation overflows?</a>
</h3>
<div>
<p>If the GEP lacks the <tt>inbounds</tt> keyword, the value is the result
from evaluating the implied two's complement integer computation. However,
since there's no guarantee of where an object will be allocated in the
@ -624,11 +633,12 @@ idx3 = (char*) &amp;MyVar + 8
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="check"><b>How can I tell if my front-end is following the
rules?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="check">
How can I tell if my front-end is following the rules?
</a>
</h3>
<div>
<p>There is currently no checker for the getelementptr rules. Currently,
the only way to do this is to manually check each place in your front-end
where GetElementPtr operators are created.</p>
@ -641,16 +651,18 @@ idx3 = (char*) &amp;MyVar + 8
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="rationale"><b>Rationale</b></a></div>
<!-- *********************************************************************** -->
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="goals"><b>Why is GEP designed this way?</b></a>
</div>
<div class="doc_text">
<!-- *********************************************************************** -->
<h2><a name="rationale">Rationale</a></h2>
<!-- *********************************************************************** -->
<div>
<!-- *********************************************************************** -->
<h3>
<a name="goals">Why is GEP designed this way?</a>
</h3>
<div>
<p>The design of GEP has the following goals, in rough unofficial
order of priority:</p>
<ul>
@ -669,10 +681,10 @@ idx3 = (char*) &amp;MyVar + 8
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="i32"><b>Why do struct member indices always use i32?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="i32">Why do struct member indices always use i32?</a>
</h3>
<div>
<p>The specific type i32 is probably just a historical artifact, however it's
wide enough for all practical purposes, so there's been no need to change it.
It doesn't necessarily imply i32 address arithmetic; it's just an identifier
@ -684,10 +696,10 @@ idx3 = (char*) &amp;MyVar + 8
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="uglygep"><b>What's an uglygep?</b></a>
</div>
<div class="doc_text">
<h3>
<a name="uglygep">What's an uglygep?</a>
</h3>
<div>
<p>Some LLVM optimizers operate on GEPs by internally lowering them into
more primitive integer expressions, which allows them to be combined
with other integer expressions and/or split into multiple separate
@ -704,11 +716,13 @@ idx3 = (char*) &amp;MyVar + 8
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="summary"><b>Summary</b></a></div>
<h2><a name="summary">Summary</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>In summary, here's some things to always remember about the GetElementPtr
instruction:</p>
<ol>
@ -732,8 +746,8 @@ idx3 = (char*) &amp;MyVar + 8
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-02-11 22:50:52 +0100 (Fri, 11 Feb 2011) $
<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) $
</address>
</body>
</html>

View File

@ -8,9 +8,9 @@
</head>
<body>
<div class="doc_title">
<h1>
Getting Started with the LLVM System
</div>
</h1>
<ul>
<li><a href="#overview">Overview</a>
@ -62,7 +62,7 @@
<p>Written by:
<a href="mailto:criswell@uiuc.edu">John Criswell</a>,
<a href="mailto:sabre@nondot.org">Chris Lattner</a>,
<a href="http://misha.brukman.net">Misha Brukman</a>,
<a href="http://misha.brukman.net/">Misha Brukman</a>,
<a href="http://www.cs.uiuc.edu/~vadve">Vikram Adve</a>, and
<a href="mailto:gshi1@uiuc.edu">Guochun Shi</a>.
</p>
@ -70,12 +70,12 @@
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="overview"><b>Overview</b></a>
</div>
<h2>
<a name="overview">Overview</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to LLVM! In order to get started, you first need to know some
basic information.</p>
@ -102,12 +102,12 @@ and performance.
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="quickstart"><b>Getting Started Quickly (A Summary)</b></a>
</div>
<h2>
<a name="quickstart">Getting Started Quickly (A Summary)</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Here's the short story for getting up and running quickly with LLVM:</p>
@ -116,13 +116,13 @@ and performance.
<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):</li>
(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>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>
@ -191,25 +191,23 @@ Layout</a> to learn about the layout of the source code tree.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="requirements"><b>Requirements</b></a>
</div>
<h2>
<a name="requirements">Requirements</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Before you begin to use the LLVM system, review the requirements given below.
This may save you some trouble by knowing ahead of time what hardware and
software you will need.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="hardware"><b>Hardware</b></a>
</div>
<h3>
<a name="hardware">Hardware</a>
</h3>
<div class="doc_text">
<div>
<p>LLVM is known to work on the following platforms:</p>
@ -268,7 +266,8 @@ software you will need.</p>
<tr>
<td>MinGW/Win32</td>
<td>x86<sup><a href="#pf_1">1</a>,<a href="#pf_6">6</a>,
<a href="#pf_8">8</a>, <a href="#pf_10">10</a></sup></td>
<a href="#pf_8">8</a>, <a href="#pf_10">10</a>,
<a href="#pf_11">11</a></sup></td>
<td>GCC 3.4.X, binutils 2.20</td>
</tr>
</table>
@ -311,6 +310,11 @@ software you will need.</p>
<td>Itanium (IA-64)</td>
<td>HP aCC</td>
</tr>
<tr>
<td>Windows x64</td>
<td>x86-64</td>
<td>mingw-w64's GCC-4.5.x<sup><a href="#pf_12">12</a></sup></td>
</tr>
</table>
<p><b>Notes:</b></p>
@ -337,9 +341,10 @@ up</a></li>
before any Windows-based versions such as Strawberry Perl and
ActivePerl, as these have Windows-specifics that will cause the
build to fail.</a></li>
<li><a name="pf_11">In general, LLVM modules requiring dynamic linking can
not be built on Windows. However, you can build LLVM tools using
<i>"make tools-only"</i>.</li>
<li><a name="pf_11">To use LLVM modules on Win32-based system,
you may configure LLVM with <i>&quot;--enable-shared&quot;</i>.</a></li>
<li><a name="pf_12">To compile SPU backend, you need to add
<tt>&quot;LDFLAGS=-Wl,--stack,16777216&quot;</tt> to configure.</a></li>
</ol>
</div>
@ -363,8 +368,10 @@ href="GCCFEBuildInstrs.html">try to compile it</a> on your platform.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="software"><b>Software</b></a></div>
<div class="doc_text">
<h3>
<a name="software">Software</a>
</h3>
<div>
<p>Compiling LLVM requires that you have several software packages
installed. The table below lists those required packages. The Package column
is the usual name for the software package that LLVM depends on. The Version
@ -380,13 +387,13 @@ href="GCCFEBuildInstrs.html">try to compile it</a> on your platform.</p>
</tr>
<tr>
<td><a href="http://gcc.gnu.org">GCC</a></td>
<td><a href="http://gcc.gnu.org/">GCC</a></td>
<td>3.4.2</td>
<td>C/C++ compiler<sup><a href="#sf1">1</a></sup></td>
</tr>
<tr>
<td><a href="http://www.gnu.org/software/texinfo">TeXinfo</a></td>
<td><a href="http://www.gnu.org/software/texinfo/">TeXinfo</a></td>
<td>4.5</td>
<td>For building the CFE</td>
</tr>
@ -397,6 +404,11 @@ href="GCCFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<td>Subversion access to LLVM<sup><a href="#sf2">2</a></sup></td>
</tr>
<!-- FIXME:
Do we support dg?
Are DejaGnu and expect obsolete?
Shall we mention Python? -->
<tr>
<td><a href="http://savannah.gnu.org/projects/dejagnu">DejaGnu</a></td>
<td>1.4.2</td>
@ -428,13 +440,13 @@ href="GCCFEBuildInstrs.html">try to compile it</a> on your platform.</p>
</tr>
<tr>
<td><a href="http://www.gnu.org/software/autoconf">GNU Autoconf</a></td>
<td><a href="http://www.gnu.org/software/autoconf/">GNU Autoconf</a></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><a href="http://www.gnu.org/software/automake/">GNU Automake</a></td>
<td>1.9.6</td>
<td>aclocal macro generator<sup><a href="#sf4">4</a></sup></td>
</tr>
@ -496,11 +508,11 @@ href="GCCFEBuildInstrs.html">try to compile it</a> on your platform.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="brokengcc">Broken versions of GCC and other tools</a>
</div>
</h3>
<div class="doc_text">
<div>
<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
@ -593,15 +605,15 @@ upgrading to a newer version of Gold.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="starting"><b>Getting Started with LLVM</b></a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="starting">Getting Started with LLVM</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The remainder of this guide is meant to get you up and running with
LLVM and to give you some basic information about the LLVM environment.</p>
@ -611,14 +623,13 @@ href="#layout">general layout</a> of the the LLVM source tree, a <a
href="#tutorial">simple example</a> using the LLVM tool chain, and <a
href="#links">links</a> to find more information about LLVM or to get
help via e-mail.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="terminology">Terminology and Notation</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Throughout this manual, the following names are used to denote paths
specific to the local system and working environment. <i>These are not
@ -651,11 +662,11 @@ All these paths are absolute:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="environment">Setting Up Your Environment</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
In order to compile and use LLVM, you may need to set some environment
@ -674,11 +685,11 @@ variables.
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="unpack">Unpacking the LLVM Archives</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
If you have the LLVM distribution, you will need to unpack it before you
@ -708,11 +719,11 @@ compressed with the gzip program.
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="checkout">Checkout LLVM from Subversion</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>If you have access to our Subversion repository, you can get a fresh copy of
the entire source code. All you need to do is check it out from Subversion as
@ -736,6 +747,7 @@ revision), you can checkout it from the '<tt>tags</tt>' directory (instead of
subdirectories of the '<tt>tags</tt>' directory:</p>
<ul>
<li>Release 2.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>
<li>Release 2.6: <b>RELEASE_26</b></li>
@ -778,30 +790,30 @@ instructions</a> to successfully get and build the LLVM GCC front-end.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="git_mirror">GIT mirror</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>GIT mirrors are available for a number of LLVM subprojects. These mirrors
sync automatically with each Subversion commit and contain all necessary
git-svn marks (so, you can recreate git-svn metadata locally). Note that right
now mirrors reflect only <tt>trunk</tt> for each project. You can do the
read-only GIT clone of LLVM via:
read-only GIT clone of LLVM via:</p>
<pre>
% git clone http://llvm.org/git/llvm.git
</pre>
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="installcf">Install the GCC Front End</a>
</div>
</h3>
<div class="doc_text">
<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.
@ -810,7 +822,7 @@ you can optionally <a href="GCCFEBuildInstrs.html">build llvm-gcc yourself</a> a
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>
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>
@ -867,11 +879,11 @@ please let us know how you would like to see things improved by dropping us a no
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="config">Local LLVM Configuration</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Once checked out from the Subversion repository, the LLVM suite source
code must be
@ -989,11 +1001,11 @@ script to configure the build system:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="compile">Compiling the LLVM Suite Source Code</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Once you have configured LLVM, you can build it. There are three types of
builds:</p>
@ -1123,11 +1135,11 @@ that directory that is out of date.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="cross-compile">Cross-Compiling LLVM</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>It is possible to cross-compile LLVM itself. That is, you can create LLVM
executables and libraries to be hosted on a platform different from the
platform where they are build (a Canadian Cross build). To configure a
@ -1141,11 +1153,11 @@ that directory that is out of date.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="objfiles">The Location of LLVM Object Files</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The LLVM build system is capable of sharing a single LLVM source tree among
several LLVM builds. Hence, it is possible to build LLVM for several different
@ -1201,11 +1213,11 @@ named after the build type:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="optionalconfig">Optional Configuration Items</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
If you're running on a Linux system that supports the "<a
@ -1225,7 +1237,7 @@ $ ./hello.bc
<p>
This allows you to execute LLVM bitcode files directly. On Debian, you
can also use this command instead of the 'echo' command above:</p>
can also use this command instead of the 'echo' command above:
</p>
<div class="doc_code">
@ -1236,31 +1248,37 @@ $ sudo update-binfmts --install llvm /path/to/lli --magic 'BC'
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="layout"><b>Program Layout</b></a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="layout">Program Layout</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>One useful source of information about the LLVM source base is the LLVM <a
href="http://www.doxygen.org">doxygen</a> documentation available at <tt><a
href="http://www.doxygen.org/">doxygen</a> documentation available at <tt><a
href="http://llvm.org/doxygen/">http://llvm.org/doxygen/</a></tt>.
The following is a brief introduction to code layout:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="examples"><tt>llvm/examples</tt></a></div>
<div class="doc_text">
<h3>
<a name="examples"><tt>llvm/examples</tt></a>
</h3>
<div>
<p>This directory contains some simple examples of how to use the LLVM IR and
JIT.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="include"><tt>llvm/include</tt></a></div>
<div class="doc_text">
<h3>
<a name="include"><tt>llvm/include</tt></a>
</h3>
<div>
<p>This directory contains public header files exported from the LLVM
library. The three main subdirectories of this directory are:</p>
@ -1287,8 +1305,11 @@ library. The three main subdirectories of this directory are:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="lib"><tt>llvm/lib</tt></a></div>
<div class="doc_text">
<h3>
<a name="lib"><tt>llvm/lib</tt></a>
</h3>
<div>
<p>This directory contains most of the source files of the LLVM system. In LLVM,
almost all code exists in libraries, making it very easy to share code among the
@ -1327,6 +1348,10 @@ different <a href="#tools">tools</a>.</p>
<dd> This directory contains the major parts of the code generator: Instruction
Selector, Instruction Scheduling, and Register Allocation.</dd>
<dt><tt><b>llvm/lib/MC/</b></tt></dt>
<dd>(FIXME: T.B.D.)</dd>
<!--FIXME: obsoleted -->
<dt><tt><b>llvm/lib/Debugger/</b></tt></dt>
<dd> This directory contains the source level debugger library that makes
it possible to instrument LLVM programs so that a debugger could identify
@ -1340,6 +1365,7 @@ different <a href="#tools">tools</a>.</p>
<dd> This directory contains the source code that corresponds to the header
files located in <tt>llvm/include/Support/</tt>.</dd>
<!--FIXME: obsoleted -->
<dt><tt><b>llvm/lib/System/</b></tt></dt>
<dd>This directory contains the operating system abstraction layer that
shields LLVM from platform-specific coding.</dd>
@ -1348,8 +1374,11 @@ different <a href="#tools">tools</a>.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="projects"><tt>llvm/projects</tt></a></div>
<div class="doc_text">
<h3>
<a name="projects"><tt>llvm/projects</tt></a>
</h3>
<div>
<p>This directory contains projects that are not strictly part of LLVM but are
shipped with LLVM. This is also the directory where you should create your own
LLVM-based projects. See <tt>llvm/projects/sample</tt> for an example of how
@ -1357,8 +1386,11 @@ different <a href="#tools">tools</a>.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="runtime"><tt>llvm/runtime</tt></a></div>
<div class="doc_text">
<h3>
<a name="runtime"><tt>llvm/runtime</tt></a>
</h3>
<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
@ -1371,16 +1403,22 @@ end to compile.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="test"><tt>llvm/test</tt></a></div>
<div class="doc_text">
<h3>
<a name="test"><tt>llvm/test</tt></a>
</h3>
<div>
<p>This directory contains feature and regression tests and other basic sanity
checks on the LLVM infrastructure. These are intended to run quickly and cover
a lot of territory without being exhaustive.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="test-suite"><tt>test-suite</tt></a></div>
<div class="doc_text">
<h3>
<a name="test-suite"><tt>test-suite</tt></a>
</h3>
<div>
<p>This is not a directory in the normal llvm module; it is a separate
Subversion
module that must be checked out (usually to <tt>projects/test-suite</tt>).
@ -1395,8 +1433,11 @@ end to compile.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="tools"><tt>llvm/tools</tt></a></div>
<div class="doc_text">
<h3>
<a name="tools"><tt>llvm/tools</tt></a>
</h3>
<div>
<p>The <b>tools</b> directory contains the executables built out of the
libraries above, which form the main part of the user interface. You can
@ -1480,8 +1521,11 @@ information is in the <a href="CommandGuide/index.html">Command Guide</a>.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="utils"><tt>llvm/utils</tt></a></div>
<div class="doc_text">
<h3>
<a name="utils"><tt>llvm/utils</tt></a>
</h3>
<div>
<p>This directory contains utilities for working with LLVM source code, and some
of the utilities are actually required as part of the build process because they
@ -1542,13 +1586,15 @@ are code generators for parts of LLVM infrastructure.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="tutorial">An Example Using the LLVM Tool Chain</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="tutorial">An Example Using the LLVM Tool Chain</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This section gives an example of using LLVM. llvm-gcc3 is now obsolete,
so we only include instructions for llvm-gcc4.
</p>
@ -1559,12 +1605,13 @@ create bitcode by default: <i>gcc4</i> produces native code. As the example belo
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>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="tutorial4">Example with llvm-gcc4</a></div>
<h3>
<a name="tutorial4">Example with llvm-gcc4</a>
</h3>
<div class="doc_text">
<div>
<ol>
<li><p>First, create a simple C file, name it 'hello.c':</p>
@ -1645,14 +1692,15 @@ int main() {
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="problems">Common Problems</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="problems">Common Problems</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>If you are having problems building or using LLVM, or if you have any other
general questions about LLVM, please consult the <a href="FAQ.html">Frequently
@ -1661,12 +1709,12 @@ Asked Questions</a> page.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="links">Links</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This document is just an <b>introduction</b> on how to use LLVM to do
some simple things... there are many more interesting and complicated things
@ -1694,8 +1742,8 @@ 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-02-01 21:08:28 +0100 (Tue, 01 Feb 2011) $
<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) $
</address>
</body>
</html>

View File

@ -8,9 +8,9 @@
</head>
<body>
<div class="doc_title">
<h1>
Getting Started with the LLVM System using Microsoft Visual Studio
</div>
</h1>
<ul>
<li><a href="#overview">Overview</a>
@ -26,19 +26,17 @@
</ul>
<div class="doc_author">
<p>Written by:
<a href="mailto:jeffc@jolt-lang.org">Jeff Cohen</a>
</p>
<p>Written by: <a href="http://llvm.org/">The LLVM Team</a></p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="overview"><b>Overview</b></a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to LLVM on Windows! This document only covers LLVM on Windows using
Visual Studio, not mingw or cygwin. In order to get started, you first need to
@ -72,25 +70,23 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="requirements"><b>Requirements</b></a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Before you begin to use the LLVM system, review the requirements given
below. This may save you some trouble by knowing ahead of time what hardware
and software you will need.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="hardware"><b>Hardware</b></a>
</div>
</h3>
<div class="doc_text">
<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
@ -99,8 +95,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="software"><b>Software</b></a></div>
<div class="doc_text">
<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
@ -120,13 +116,15 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="quickstart"><b>Getting Started</b></a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="quickstart"><b>Getting Started</b></a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Here's the short story for getting up and running quickly with LLVM:</p>
@ -196,7 +194,9 @@
<ul>
<li>If %PATH% does not contain GnuWin32, you may specify LLVM_LIT_TOOLS_DIR
on CMake for the path to GnuWin32.</li>
<li>You can run LLVM tests to build the project "check".</li>
<li>You can run LLVM tests by merely building the project
"check". The test results will be shown in the VS output
window.</li>
</ul>
</li>
@ -215,25 +215,26 @@
<p>Note that quite a few of these test will fail.</p>
</li>
<li>A specific test or test directory can be run with:</li>
<li>A specific test or test directory can be run with:
<div class="doc_code">
<pre>
% llvm-lit test/path/to/test
</pre>
</div>
</li>
</ul>
</ol>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="tutorial">An Example Using the LLVM Tool Chain</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<ol>
<li><p>First, create a simple C file, name it 'hello.c':</p>
@ -318,12 +319,12 @@ int main() {
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="problems">Common Problems</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>If you are having problems building or using LLVM, or if you have any other
general questions about LLVM, please consult the <a href="FAQ.html">Frequently
@ -332,12 +333,12 @@ Asked Questions</a> page.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="links">Links</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This document is just an <b>introduction</b> to how to use LLVM to do
some simple things... there are many more interesting and complicated things
@ -361,9 +362,8 @@ out:</p>
<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:jeffc@jolt-lang.org">Jeff Cohen</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-02-20 16:34:12 +0100 (Sun, 20 Feb 2011) $
<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) $
</address>
</body>
</html>

View File

@ -7,7 +7,7 @@
</head>
<body>
<div class="doc_title">LLVM gold plugin</div>
<h1>LLVM gold plugin</h1>
<ol>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#build">How to build it</a></li>
@ -21,9 +21,9 @@
<div class="doc_author">Written by Nick Lewycky</div>
<!--=========================================================================-->
<div class="doc_section"><a name="introduction">Introduction</a></div>
<h2><a name="introduction">Introduction</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>Building with link time optimization requires cooperation from the
system linker. LTO support on Linux systems requires that you use
the <a href="http://sourceware.org/binutils">gold linker</a> which supports
@ -33,14 +33,14 @@ project.</p>
<p>The LLVM gold plugin implements the
<a href="http://gcc.gnu.org/wiki/whopr/driver">gold plugin interface</a>
on top of
<a href="http://llvm.org/docs/LinkTimeOptimization.html#lto">libLTO</a>.
<a href="LinkTimeOptimization.html#lto">libLTO</a>.
The same plugin can also be used by other tools such as <tt>ar</tt> and
<tt>nm</tt>.
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="build">How to build it</a></div>
<h2><a name="build">How to build it</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>You need to have gold with plugin support and build the LLVMgold
plugin. Check whether you have gold running <tt>/usr/bin/ld -v</tt>. It will
report &#8220;GNU gold&#8221; or else &#8220GNU ld&#8221; if not. If you have
@ -72,9 +72,9 @@ placed.
</ul>
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="usage">Usage</a></div>
<h2><a name="usage">Usage</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>The linker takes a <tt>-plugin</tt> option that points to the path of
the plugin <tt>.so</tt> file. To find out what link command <tt>gcc</tt>
would run in a given situation, run <tt>gcc -v <em>[...]</em></tt> and look
@ -95,14 +95,13 @@ placed.
own gold, be sure to install the <tt>ar</tt> and <tt>nm-new</tt> you built to
<tt>/usr/bin</tt>.
<p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="example1">Example of link time optimization</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The following example shows a worked example of the gold plugin mixing
LLVM bitcode and native code.
<pre class="doc_code">
@ -145,14 +144,20 @@ $ llvm-gcc -use-gold-plugin 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,
leading LLVM to delete that function. However, unlike in the
<a href="http://llvm.org/docs/LinkTimeOptimization.html#example1">libLTO
<a href="LinkTimeOptimization.html#example1">libLTO
example</a> gold does not currently eliminate foo4.</p>
</div>
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="lto_autotools">Quickstart for using LTO with autotooled projects</a></div>
<h2>
<a name="lto_autotools">
Quickstart for using LTO with autotooled projects
</a>
</h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>Once your system <tt>ld</tt>, <tt>ar</tt> and <tt>nm</tt> all support LLVM
bitcode, everything is in place for an easy to use LTO build of autotooled
projects:</p>
@ -189,9 +194,9 @@ export CFLAGS="-O4"
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="licensing">Licensing</a></div>
<h2><a name="licensing">Licensing</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>Gold is licensed under the GPLv3. LLVMgold uses the interface file
<tt>plugin-api.h</tt> from gold which means that the resulting LLVMgold.so
binary is also GPLv3. This can still be used to link non-GPLv3 programs just
@ -206,7 +211,7 @@ as much as gold could without the plugin.</p>
<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:nicholas@metrix.on.ca">Nick Lewycky</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-04-16 23:58:21 -0800 (Fri, 16 Apr 2010) $
</address>
</body>

View File

@ -60,11 +60,11 @@ Understood. :)
Yup, I think that this makes a lot of sense. I am still intrigued,
however, by the prospect of a minimally allocated VM representation... I
think that it could have definate advantages for certain applications
think that it could have definite advantages for certain applications
(think very small machines, like PDAs). I don't, however, think that our
initial implementations should focus on this. :)
Here are some other auxilliary goals that I think we should consider:
Here are some other auxiliary goals that I think we should consider:
1. Primary goal: Support a high performance dynamic compilation
system. This means that we have an "ideal" division of labor between

View File

@ -40,7 +40,7 @@ IDEAS TO CONSIDER
packaged with the bytecodes themselves. As a conceptual implementation
idea, we could include an immediate dominator number for each basic block
in the LLVM bytecode program. Basic blocks could be numbered according
to the order of occurance in the bytecode representation.
to the order of occurrence in the bytecode representation.
2. Including loop header and body information. This would facilitate
detection of intervals and natural loops.

View File

@ -39,7 +39,7 @@ declaration and calling syntax.
Very true. If you're implementing an object oriented language, however,
remember that you have to do all the pointer to member function stuff
yourself.... so everytime you invoke a virtual method one is involved
yourself.... so every time you invoke a virtual method one is involved
(instead of having C++ hide it for you behind "syntactic sugar").
> And the old array syntax:

View File

@ -18,7 +18,7 @@ suggested, as specified below:
Very true. We should discuss this more, but my reasoning is more of a
consistency argument. There are VERY few instructions that can have all
of the types eliminated, and doing so when available unnecesarily makes
of the types eliminated, and doing so when available unnecessarily makes
the language more difficult to handle. Especially when you see 'int
%this' and 'bool %that' all over the place, I think it would be
disorienting to see:
@ -44,7 +44,7 @@ branches).
No. This was something I was debating for a while, and didn't really feel
strongly about either way. It is common to switch on other types in HLL's
(for example signed int's are particually common), but in this case, all
(for example signed int's are particularly common), but in this case, all
that will be added is an additional 'cast' instruction. I removed that
from the spec.
@ -160,7 +160,7 @@ that can be trivally translated into a conditional move...
> I agree that we need a static data space. Otherwise, emulating global
> data gets unnecessarily complex.
Definately. Also a later item though. :)
Definitely. Also a later item though. :)
> We once talked about adding a symbolic thread-id field to each
> ..

View File

@ -42,7 +42,7 @@ Does using GCC's backend buy us anything?
> optimization (step 16 in your list). Do you have a breakdown of that?
Not really. The irritating part of GCC is that it mixes it all up and
doesn't have a clean seperation of concerns. A lot of the "back end
doesn't have a clean separation of concerns. A lot of the "back end
optimization" happens right along with other data optimizations (ie, CSE
of machine specific things).

View File

@ -17,7 +17,7 @@ iterator to an instruction, which, given just an Instruction*, requires a
linear search of the basic block the instruction is contained in... just
to insert an instruction before another instruction, or to delete an
instruction! This complicates algorithms that should be very simple (like
simple constant propogation), because they aren't actually sparse anymore,
simple constant propagation), because they aren't actually sparse anymore,
they have to traverse basic blocks to remove constant propogated
instructions.

View File

@ -7,7 +7,7 @@
</head>
<body>
<div class="doc_title">How To Release LLVM To The Public</div>
<h1>How To Release LLVM To The Public</h1>
<ol>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#criteria">Qualification Criteria</a></li>
@ -17,495 +17,597 @@
<div class="doc_author">
<p>Written by <a href="mailto:tonic@nondot.org">Tanya Lattner</a>,
<a href="mailto:rspencer@x10sys.com">Reid Spencer</a>,
<a href="mailto:criswell@cs.uiuc.edu">John Criswell</a>
<a href="mailto:criswell@cs.uiuc.edu">John Criswell</a>, &amp;
<a href="mailto:wendling@apple.com">Bill Wendling</a>
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="introduction">Introduction</a></div>
<h2><a name="introduction">Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>
This document collects information about successfully releasing LLVM
(including subprojects llvm-gcc and Clang) to the public.
It is the release manager's responsibility to ensure that a high quality
build of LLVM is released.
</p>
<div>
<p>This document contains information about successfully releasing LLVM &mdash;
including subprojects: e.g., <tt>llvm-gcc</tt> and <tt>clang</tt> &mdash; to
the public. It is the Release Manager's responsibility to ensure that a high
quality build of LLVM is released.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="process">Release Timeline</a></div>
<h2><a name="process">Release Timeline</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>LLVM is released on a time based schedule (currently every 6 months). We
do not have dot releases because of the nature of LLVM incremental
development philosophy. The release schedule is roughly as follows:
</p>
<div>
<p>LLVM is released on a time based schedule &mdash; roughly every 6 months. We
do not normally have dot releases because of the nature of LLVM's incremental
development philosophy. That said, the only thing preventing dot releases for
critical bug fixes from happening is a lack of resources &mdash; testers,
machines, time, etc. And, because of the high quality we desire for LLVM
releases, we cannot allow for a truncated form of release qualification.</p>
<p>The release process is roughly as follows:</p>
<ul>
<li><p>Set code freeze and branch creation date for 6 months after last code
freeze date. Announce release schedule to the LLVM community and update
the website.</p></li>
<li><p>Create release branch and begin release process.</p></li>
<li><p>Send out release candidate sources for first round of testing. Testing
lasts 7-10 days. During the first round of testing, any regressions found
should be fixed. Patches are merged from mainline into the release
branch. Also, all features need to be completed during this time. Any
features not completed at the end of the first round of testing will be
removed or disabled for the release.</p></li>
<li><p>Generate and send out the second release candidate sources. Only
<em>critial</em> bugs found during this testing phase will be fixed. Any
bugs introduced by merged patches will be fixed. If so a third round of
testing is needed.</p></li>
<li><p>The release notes are updated.</p></li>
<li><p>Finally, release!</p></li>
</ul>
</div>
<!-- *********************************************************************** -->
<h2><a name="process">Release Process</a></h2>
<!-- *********************************************************************** -->
<div>
<ol>
<li>Set code freeze and branch creation date for 6 months after last code freeze
date. Announce release schedule to the LLVM community and update the website.</li>
<li>Create release branch and begin release process. </li>
<li>Send out pre-release for first round of testing. Testing will last 7-10 days.
During the first round of testing, regressions should be found and fixed. Patches
are merged from mainline to the release branch.</li>
<li>Generate and send out second pre-release. Bugs found during this time will
not be fixed unless absolutely critical. Bugs introduce by patches merged in
will be fixed and if so, a 3rd round of testing is needed.</li>
<li>The release notes should be updated during the first and second round of
pre-release testing.</li>
<li>Finally, release!</li>
</ol>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="process">Release Process</a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<li><a href="#release-admin">Release Administrative Tasks</a>
<ol>
<li><a href="#release-admin">Release Administrative Tasks</a></li>
<ol>
<li><a href="#branch">Create Release Branch</a></li>
<li><a href="#verchanges">Update Version Numbers</a></li>
</ol>
<li><a href="#release-build">Building the Release</a></li>
<ol>
</ol>
</li>
<li><a href="#release-build">Building the Release</a>
<ol>
<li><a href="#dist">Build the LLVM Source Distributions</a></li>
<li><a href="#build">Build LLVM</a></li>
<li><a href="#llvmgccbin">Build the LLVM-GCC Binary Distribution</a></li>
<li><a href="#clangbin">Build the Clang Binary Distribution</a></li>
<li><a href="#target-build">Target Specific Build Details</a></li>
</ol>
<li><a href="#release-qualify">Release Qualification Criteria</a></li>
<ol>
</ol>
</li>
<li><a href="#release-qualify">Release Qualification Criteria</a>
<ol>
<li><a href="#llvm-qualify">Qualify LLVM</a></li>
<li><a href="#llvmgcc-qualify">Qualify LLVM-GCC</a></li>
<li><a href="#clang-qualify">Qualify Clang</a></li>
<li><a href="#targets">Specific Target Qualification Details</a></li>
</ol>
<li><a href="#commTest">Community Testing</a></li>
<li><a href="#release-patch">Release Patch Rules</a></li>
</ol>
</li>
<li><a href="#release-final">Release final tasks</a></li>
<ol>
<li><a href="#commTest">Community Testing</a></li>
<li><a href="#release-patch">Release Patch Rules</a></li>
<li><a href="#release-final">Release final tasks</a>
<ol>
<li><a href="#updocs">Update Documentation</a></li>
<li><a href="#tag">Tag the LLVM Release Branch</a></li>
<li><a href="#tag">Tag the LLVM Final Release</a></li>
<li><a href="#updemo">Update the LLVM Demo Page</a></li>
<li><a href="#webupdates">Update the LLVM Website</a></li>
<li><a href="#announce">Announce the Release</a></li>
</ol>
</ol>
</div>
</li>
</ol>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="release-admin">
Release Administrative Tasks</a></div>
<h3><a name="release-admin">Release Administrative Tasks</a></h3>
<div class="doc_text">
This section describes a few administrative tasks that need to be done for the
release process to begin. Specifically, it involves creating the release branch,
resetting version numbers, and creating the release tarballs for the release
team to begin testing.
</div>
<div>
<p>This section describes a few administrative tasks that need to be done for
the release process to begin. Specifically, it involves:</p>
<ul>
<li>Creating the release branch,</li>
<li>Setting version numbers, and</li>
<li>Tagging release candidates for the release team to begin testing</li>
</ul>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="branch">Create Release Branch</a></div>
<div class="doc_text">
<p>Branch the Subversion HEAD using the following procedure:</p>
<ol>
<li>
<p>Verify that the current Subversion HEAD is in decent shape by examining
nightly tester or buildbot results.</p></li>
<li>
<p>Request all developers to refrain from committing. Offenders get commit
rights taken away (temporarily).</p></li>
<li>
<p> Create the release branch for <tt>llvm</tt>, <tt>llvm-gcc4.2</tt>,
<tt>clang</tt>, and the <tt>test-suite</tt>. The branch name will be
<tt>release_XX</tt>,where <tt>XX</tt> is the major and minor release numbers.
<tt>Clang</tt> will have a different release number than <tt>llvm</tt>/
<tt>llvm-gcc4</tt> since its first release was years later
(still deciding if this will be true or not). These branches
can be created without checking out anything from subversion.
</p>
<div class="doc_code">
<pre>
svn copy https://llvm.org/svn/llvm-project/llvm/trunk \
https://llvm.org/svn/llvm-project/llvm/branches/release_<i>XX</i>
svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk \
https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_<i>XX</i>
svn copy https://llvm.org/svn/llvm-project/test-suite/trunk \
https://llvm.org/svn/llvm-project/test-suite/branches/release_<i>XX</i>
svn copy https://llvm.org/svn/llvm-project/cfe/trunk \
https://llvm.org/svn/llvm-project/cfe/branches/release_<i>XX</i>
</pre>
</div>
<h4><a name="branch">Create Release Branch</a></h4>
<li>
<p>Advise developers they can work on Subversion HEAD again.</p></li>
<li>
<p>The Release Manager should switch to the release branch (as all changes
to the release will now be done in the branch). The easiest way to do this
is to grab another working copy using the following commands:</p>
<div>
<p>Branch the Subversion trunk using the following procedure:</p>
<ol>
<li><p>Remind developers that the release branching is imminent and to refrain
from committing patches that might break the build. E.g., new features,
large patches for works in progress, an overhaul of the type system, an
exciting new TableGen feature, etc.</p></li>
<li><p>Verify that the current Subversion trunk is in decent shape by
examining nightly tester and buildbot results.</p></li>
<li><p>Create the release branch for <tt>llvm</tt>, <tt>llvm-gcc-4.2</tt>,
<tt>clang</tt>, and the <tt>test-suite</tt> from the last known good
revision. The branch's name is <tt>release_XY</tt>, where <tt>X</tt> is
the major and <tt>Y</tt> the minor release numbers. The branches should be
created using the following commands:</p>
<div class="doc_code">
<pre>
svn co https://llvm.org/svn/llvm-project/llvm/branches/release_<i>XX</i>
svn co https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_<i>XX</i>
svn co https://llvm.org/svn/llvm-project/test-suite/branches/release_<i>XX</i>
svn co https://llvm.org/svn/llvm-project/cfe/branches/release_<i>XX</i>
$ svn copy https://llvm.org/svn/llvm-project/llvm/trunk \
https://llvm.org/svn/llvm-project/llvm/branches/release_<i>XY</i>
$ svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk \
https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_<i>XY</i>
$ svn copy https://llvm.org/svn/llvm-project/test-suite/trunk \
https://llvm.org/svn/llvm-project/test-suite/branches/release_<i>XY</i>
$ svn copy https://llvm.org/svn/llvm-project/cfe/trunk \
https://llvm.org/svn/llvm-project/cfe/branches/release_<i>XY</i>
</pre>
</div></li>
</ol>
</div>
<li><p>Advise developers that they may now check their patches into the
Subversion tree again.</p></li>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="verchanges">Update LLVM Version</a></div>
<div class="doc_text">
<p>
After creating the LLVM release branch, update the release branches'
autoconf/configure.ac version from X.Xsvn to just X.X. Update it on mainline
as well to be the next version (X.X+1svn). Regenerated the configure script
for both. This must be done for both <tt>llvm</tt> and the
<tt>test-suite</tt>.
</p>
<p>FIXME: Add a note about <tt>clang</tt>.</p>
<p>In addition, the version number of all the Bugzilla components must be
updated for the next release.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="dist">Build the LLVM Source Distributions</a></div>
<div class="doc_text">
<p>
Create source distributions for <tt>LLVM</tt>, <tt>LLVM-GCC</tt>,
<tt>clang</tt>, and the llvm <tt>test-suite</tt> by exporting the source from
Subversion and archiving it. This can be done with the following commands:
</p>
<li><p>The Release Manager should switch to the release branch, because all
changes to the release will now be done in the branch. The easiest way to
do this is to grab a working copy using the following commands:</p>
<div class="doc_code">
<pre>
svn export https://llvm.org/svn/llvm-project/llvm/branches/release_<i>XX</i> llvm-X.X
svn export https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_<i>XX</i> llvm-gcc4.2-X.X.source
svn export https://llvm.org/svn/llvm-project/test-suite/branches/release_<i>XX</i> llvm-test-X.X
svn export https://llvm.org/svn/llvm-project/cfe/branches/release_<i>XX</i> clang-X.X
tar -czvf - llvm-X.X | gzip &gt; llvm-X.X.tar.gz
tar -czvf - llvm-test-X.X | gzip &gt; llvm-test-X.X.tar.gz
tar -czvf - llvm-gcc4.2-X.X.source | gzip &gt; llvm-gcc-4.2-X.X.source.tar.gz
tar -czvf - clang-X.X | gzip &gt; clang-X.X.tar.gz
$ svn co https://llvm.org/svn/llvm-project/llvm/branches/release_<i>XY</i> llvm-<i>X.Y</i>
$ svn co https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_<i>XY</i> llvm-gcc-4.2-<i>X.Y</i>
$ svn co https://llvm.org/svn/llvm-project/test-suite/branches/release_<i>XY</i> test-suite-<i>X.Y</i>
$ svn co https://llvm.org/svn/llvm-project/cfe/branches/release_<i>XY</i> clang-<i>X.Y</i>
</pre>
</div></li>
</ol>
</div>
<!-- ======================================================================= -->
<h4><a name="verchanges">Update LLVM Version</a></h4>
<div>
<p>After creating the LLVM release branch, update the release branches'
<tt>autoconf</tt> and <tt>configure.ac</tt> versions from '<tt>X.Ysvn</tt>'
to '<tt>X.Y</tt>'. Update it on mainline as well to be the next version
('<tt>X.Y+1svn</tt>'). Regenerate the configure scripts for both
<tt>llvm</tt> and the <tt>test-suite</tt>.</p>
<p>In addition, the version numbers of all the Bugzilla components must be
updated for the next release.</p>
</div>
<!-- ======================================================================= -->
<h4><a name="dist">Build the LLVM Release Candidates</a></h4>
<div>
<p>Create release candidates for <tt>llvm</tt>, <tt>llvm-gcc</tt>,
<tt>clang</tt>, and the LLVM <tt>test-suite</tt> by tagging the branch with
the respective release candidate number. For instance, to create <b>Release
Candidate 1</b> you would issue the following commands:</p>
<div class="doc_code">
<pre>
$ svn mkdir https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_<i>XY</i>
$ svn copy https://llvm.org/svn/llvm-project/llvm/branches/release_<i>XY</i> \
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_<i>XY</i>/rc1
$ svn mkdir https://llvm.org/svn/llvm-project/llvm-gcc-4.2/tags/RELEASE_<i>XY</i>
$ svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_<i>XY</i> \
https://llvm.org/svn/llvm-project/llvm-gcc-4.2/tags/RELEASE_<i>XY</i>/rc1
$ svn mkdir https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_<i>XY</i>
$ svn copy https://llvm.org/svn/llvm-project/test-suite/branches/release_<i>XY</i> \
https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_<i>XY</i>/rc1
$ svn mkdir https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_<i>XY</i>
$ svn copy https://llvm.org/svn/llvm-project/cfe/branches/release_<i>XY</i> \
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_<i>XY</i>/rc1
</pre>
</div>
<p>Similarly, <b>Release Candidate 2</b> would be named <tt>RC2</tt> and so
on. This keeps a permanent copy of the release candidate around for people to
export and build as they wish. The final released sources will be tagged in
the <tt>RELEASE_<i>XY</i></tt> directory as <tt>Final</tt>
(c.f. <a href="#tag">Tag the LLVM Final Release</a>).</p>
<p>The Release Manager may supply pre-packaged source tarballs for users. This
can be done with the following commands:</p>
<div class="doc_code">
<pre>
$ svn export https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_<i>XY</i>/rc1 llvm-<i>X.Y</i>rc1
$ svn export https://llvm.org/svn/llvm-project/llvm-gcc-4.2/tags/RELEASE_<i>XY</i>/rc1 llvm-gcc4.2-<i>X.Y</i>rc1
$ svn export https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_<i>XY</i>/rc1 llvm-test-<i>X.Y</i>rc1
$ svn export https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_<i>XY</i>/rc1 clang-<i>X.Y</i>rc1
$ tar -cvf - llvm-<i>X.Y</i>rc1 | gzip &gt; llvm-<i>X.Y</i>rc1.src.tar.gz
$ tar -cvf - llvm-test-<i>X.Y</i>rc1 | gzip &gt; llvm-test-<i>X.Y</i>rc1.src.tar.gz
$ tar -cvf - llvm-gcc4.2-<i>X.Y</i>rc1 | gzip &gt; llvm-gcc-4.2-<i>X.Y</i>rc1.src.tar.gz
$ tar -cvf - clang-<i>X.Y</i>rc1 | gzip &gt; clang-<i>X.Y</i>rc1.src.tar.gz
</pre>
</div>
</div>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="release-build">
Building the Release</a></div>
<h3><a name="release-build">Building the Release</a></h3>
<div class="doc_text">
The build of <tt>llvm</tt>, <tt>llvm-gcc</tt>, and <tt>clang</tt> must be free
of errors and warnings in both debug, release+asserts, and release builds.
If all builds are clean, then the release passes build qualification.
<div>
<p>The builds of <tt>llvm</tt>, <tt>llvm-gcc</tt>, and <tt>clang</tt>
<em>must</em> be free of errors and warnings in Debug, Release+Asserts, and
Release builds. If all builds are clean, then the release passes Build
Qualification.</p>
<p>The <tt>make</tt> options for building the different modes:</p>
<table>
<tr><th>Mode</th><th>Options</th></tr>
<tr align="left"><td>Debug</td><td><tt>ENABLE_OPTIMIZED=0</tt></td></tr>
<tr align="left"><td>Release+Asserts</td><td><tt>ENABLE_OPTIMIZED=1</tt></td></tr>
<tr align="left"><td>Release</td><td><tt>ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1</tt></td></tr>
</table>
<!-- ======================================================================= -->
<h4><a name="build">Build LLVM</a></h4>
<div>
<p>Build <tt>Debug</tt>, <tt>Release+Asserts</tt>, and <tt>Release</tt> versions
of <tt>llvm</tt> on all supported platforms. Directions to build
<tt>llvm</tt> are
<a href="GettingStarted.html#quickstart">here</a>.</p>
</div>
<!-- ======================================================================= -->
<h4><a name="llvmgccbin">Build the LLVM GCC Binary Distribution</a></h4>
<div>
<p>Creating the <tt>llvm-gcc</tt> binary distribution (Release/Optimized)
requires performing the following steps for each supported platform:</p>
<ol>
<li>debug: ENABLE_OPTIMIZED=0</li>
<li>release+asserts: ENABLE_OPTIMIZED=1</li>
<li>release: ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1</li>
<li><p>Build the <tt>llvm-gcc</tt> front-end by following the directions in
the <tt>README.LLVM</tt> file. The front-end must be compiled with C, C++,
Objective-C (Mac only), Objective-C++ (Mac only), and Fortran
support.</p></li>
<li><p>Boostrapping must be enabled.</p></li>
<li><p>Be sure to build with <tt>LLVM_VERSION_INFO=X.Y</tt>, where <tt>X</tt>
is the major and <tt>Y</tt> is the minor release numbers.</p></li>
<li><p>Copy the installation directory to a directory named for the specific
target. For example on Red Hat Enterprise Linux, the directory would be
named <tt>llvm-gcc4.2-2.6-x86-linux-RHEL4</tt>. Archive and compress the
new directory.</p></li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="build">Build LLVM</a></div>
<div class="doc_text">
<p>
Build both debug, release+asserts (optimized), and release versions of
LLVM on all supported platforms. Direction to build llvm are
<a href="http://llvm.org/docs/GettingStarted.html#quickstart">here</a>.
</p>
<h4><a name="clangbin">Build Clang Binary Distribution</a></h4>
<div>
<p>Creating the <tt>clang</tt> binary distribution
(Debug/Release+Asserts/Release) requires performing the following steps for
each supported platform:</p>
<ol>
<li>Build clang according to the directions
<a href="http://clang.llvm.org/get_started.html">here</a>.</li>
<li>Build both a debug and release version of clang. The binary will be the
release build.</lI>
<li>Package <tt>clang</tt> (details to follow).</li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="llvmgccbin">Build the LLVM GCC Binary Distribution</a></div>
<div class="doc_text">
<p>
Creating the LLVM GCC binary distribution (release/optimized) requires
performing the following steps for each supported platform:
</p>
<h4><a name="target-build">Target Specific Build Details</a></h4>
<ol>
<li>
Build the LLVM GCC front-end by following the directions in the README.LLVM
file. The frontend must be compiled with c, c++, objc (mac only),
objc++ (mac only) and fortran support. </li>
<li>Please boostrap as well.</li>
<li>Be sure to build with LLVM_VERSION_INFO=X.X, where X is the major and
minor release numbers.
</li>
<div>
<li>
Copy the installation directory to a directory named for the specific target.
For example on Red Hat Enterprise Linux, the directory would be named
<tt>llvm-gcc4.2-2.6-x86-linux-RHEL4</tt>. Archive and compress the new directory.
</li>
</ol>
</div>
<p>The table below specifies which compilers are used for each Arch/OS
combination when qualifying the build of <tt>llvm</tt>, <tt>llvm-gcc</tt>,
and <tt>clang</tt>.</p>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="clangbin">Build Clang
Binary Distribution</a></div>
<div class="doc_text">
<p>
Creating the Clang binary distribution (debug/release/release) requires
performing the following steps for each supported platform:
</p>
<ol>
<li>
Build clang according to the directions
<a href="http://clang.llvm.org/get_started.html">here</a>.
</li>
<li>Build both a debug and release version of clang, but the binary
will be a release build.</lI>
<li>
Package clang (details to follow).
</li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="target-build">Target Specific Build
Details</a></div>
<div class="doc_text">
<p>
The table below specifies which compilers are used for each arch/os combination
when qualifying the build of <tt>llvm</tt>, <tt>llvm-gcc</tt>, <tt>clang.
</tt></p>
<p>
<table>
<table>
<tr><th>Architecture</th><th>OS</th><th>compiler</th></tr>
<tr><td>x86-32</td><td>Mac OS 10.5</td><td>gcc 4.0.1</td></tr>
<tr><td>x86-32</td><td>Linux</td><td>gcc 4.2.X, gcc 4.3.X</td></tr>
<tr><td>x86-32</td><td>FreeBSD</td><td>gcc 4.2.X</td></tr>
<tr><td>x86-32</td><td>mingw</td><td>gcc 3.4.5</td></tr>
<tr><td>x86-32</td><td>mingw</td><td>gcc 3.4.5</td></tr>
<tr><td>x86-64</td><td>Mac OS 10.5</td><td>gcc 4.0.1</td></tr>
<tr><td>x86-64</td><td>Linux</td><td>gcc 4.2.X, gcc 4.3.X</td></tr>
<tr><td>x86-64</td><td>FreeBSD</td><td>gcc 4.2.X</td></tr>
</table>
</p>
</table>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="release-qualify">
Building the Release</a></div>
<div class="doc_text">
A release is qualified when it has no regressions from the previous
release (or baseline). Regressions are related to correctness only and not
performance at this time. <b>Regressions are new failures in the set of tests that
are used to qualify each product and only include things on the list.
Ultimately, there is no end to the number of possible bugs in a release. We
need a very concrete and definitive release criteria that ensures we have
monotonically improving quality on some metric. The metric we use is
described below. This doesn't mean that we don't care about other things,
but this are things that must be satisfied before a release can go out</b>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="llvm-qualify">Qualify LLVM</a></div>
<div class="doc_text">
<p>
LLVM is qualified when it has a clean dejagnu test run without a frontend and
it has no regressions when using either <tt>llvm-gcc</tt> or <tt>clang</tt>
with the <tt>test-suite</tt> from the previous release.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="llvmgcc-qualify">Qualify LLVM-GCC</a></div>
<div class="doc_text">
<p>
<tt>LLVM-GCC</tt> is qualified when front-end specific tests in the
<tt>llvm</tt> dejagnu test suite all pass and there are no regressions in
the <tt>test-suite</tt>.</p>
<p>We do not use the gcc dejagnu test suite as release criteria.</p>
<h3><a name="release-qualify">Building the Release</a></h3>
<div>
<p>A release is qualified when it has no regressions from the previous release
(or baseline). Regressions are related to correctness first and performance
second. (We may tolerate some minor performance regressions if they are
deemed necessary for the general quality of the compiler.)</p>
<p><b>Regressions are new failures in the set of tests that are used to qualify
each product and only include things on the list. Every release will have
some bugs in it. It is the reality of developing a complex piece of
software. We need a very concrete and definitive release criteria that
ensures we have monotonically improving quality on some metric. The metric we
use is described below. This doesn't mean that we don't care about other
criteria, but these are the criteria which we found to be most important and
which must be satisfied before a release can go out</b></p>
<!-- ======================================================================= -->
<h4><a name="llvm-qualify">Qualify LLVM</a></h4>
<div>
<p>LLVM is qualified when it has a clean test run without a front-end. And it
has no regressions when using either <tt>llvm-gcc</tt> or <tt>clang</tt> with
the <tt>test-suite</tt> from the previous release.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="clang-qualify">Qualify Clang</a></div>
<div class="doc_text">
<tt>Clang</tt> is qualified when front-end specific tests in the
<tt>llvm</tt> dejagnu test suite all pass, clang's own test suite passes
cleanly, and there are no regressions in the <tt>test-suite</tt>.</p>
<h4><a name="llvmgcc-qualify">Qualify LLVM-GCC</a></h4>
<div>
<p><tt>LLVM-GCC</tt> is qualified when front-end specific tests in the
<tt>llvm</tt> regression test suite all pass and there are no regressions in
the <tt>test-suite</tt>.</p>
<p>We do not use the GCC DejaGNU test suite as release criteria.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="targets">Specific Target
Qualification Details</a></div>
<div class="doc_text">
<p><table>
<tr><th>Architecture</th><th>OS</th><th>llvm-gcc baseline</th><th>clang baseline
</th><th>tests</th></tr>
<h4><a name="clang-qualify">Qualify Clang</a></h4>
<div>
<p><tt>Clang</tt> is qualified when front-end specific tests in the
<tt>llvm</tt> dejagnu test suite all pass, clang's own test suite passes
cleanly, and there are no regressions in the <tt>test-suite</tt>.</p>
</div>
<!-- ======================================================================= -->
<h4><a name="targets">Specific Target Qualification Details</a></h4>
<div>
<table>
<tr><th>Architecture</th><th>OS</th><th>llvm-gcc baseline</th><th>clang baseline</th><th>tests</th></tr>
<tr><td>x86-32</td><td>Linux</td><td>last release</td><td>last release</td><td>llvm dejagnu, clang tests, test-suite (including spec)</td></tr>
<tr><td>x86-32</td><td>FreeBSD</td><td>none</td><td>last release</td><td>llvm dejagnu, clang tests, test-suite</td></tr>
<tr><td>x86-32</td><td>mingw</td><td>last release</td><td>none</td><td>QT</td></tr>
<tr><td>x86-64</td><td>Mac OS 10.X</td><td>last release</td><td>last release</td><td>llvm dejagnu, clang tests, test-suite (including spec)</td></tr>
<tr><td>x86-64</td><td>Linux</td><td>last release</td><td>last release</td><td>llvm dejagnu, clang tests, test-suite (including spec)</td></tr>
<tr><td>x86-64</td><td>FreeBSD</td><td>none</td><td>last release</td><td>llvm dejagnu, clang tests, test-suite</td></tr>
</table></p>
</table>
</div>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="commTest">Community Testing</a></div>
<div class="doc_text">
<p>
Once all testing has been completed and appropriate bugs filed, the pre-release
tar balls may be put on the website and the LLVM community is notified. Ask that
all LLVM developers test the release in 2 ways:</p>
<ol>
<li>Download llvm-X.X, llvm-test-X.X, and the appropriate llvm-gcc4
and/or clang binary. Build LLVM.
Run "make check" and the full llvm-test suite (make TEST=nightly report).</li>
<li>Download llvm-X.X, llvm-test-X.X, and the llvm-gcc4 and/or clang source.
Compile everything. Run "make check" and the full llvm-test suite (make TEST=nightly
report).</li>
</ol>
<p>Ask LLVM developers to submit the report and make check results to the list.
Attempt to verify that there are no regressions from the previous release.
The results are not used to qualify a release, but to spot other potential
problems. For unsupported targets, verify that make check at least is
clean.</p>
<h3><a name="commTest">Community Testing</a></h3>
<div>
<p>Once all testing has been completed and appropriate bugs filed, the release
candidate tarballs are put on the website and the LLVM community is
notified. Ask that all LLVM developers test the release in 2 ways:</p>
<ol>
<li>Download <tt>llvm-<i>X.Y</i></tt>, <tt>llvm-test-<i>X.Y</i></tt>, and the
appropriate <tt>llvm-gcc</tt> and/or <tt>clang</tt> binary. Build
LLVM. Run <tt>make check</tt> and the full LLVM test suite (<tt>make
TEST=nightly report</tt>).</li>
<li>Download <tt>llvm-<i>X.Y</i></tt>, <tt>llvm-test-<i>X.Y</i></tt>, and the
<tt>llvm-gcc</tt> and/or <tt>clang</tt> source. Compile everything. Run
<tt>make check</tt> and the full LLVM test suite (<tt>make TEST=nightly
report</tt>).</li>
</ol>
<p>Ask LLVM developers to submit the test suite report and <tt>make check</tt>
results to the list. Verify that there are no regressions from the previous
release. The results are not used to qualify a release, but to spot other
potential problems. For unsupported targets, verify that <tt>make check</tt>
is at least clean.</p>
<p>During the first round of testing time,
all regressions must be fixed before the second pre-release is created.</p>
<p>During the first round of testing, all regressions must be fixed before the
second release candidate is tagged.</p>
<p>If this is the second round of testing, this is only to ensure the bug
fixes previously merged in have not created new major problems. This is not
the time to solve additional and unrelated bugs. If no patches are merged in,
the release is determined to be ready and the release manager may move onto
the next step.
</p>
<p>If this is the second round of testing, the testing is only to ensure that
bug fixes previously merged in have not created new major problems. <i>This
is not the time to solve additional and unrelated bugs!</i> If no patches are
merged in, the release is determined to be ready and the release manager may
move onto the next stage.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="release-patch">Release Patch Rules
</a></div>
<div class="doc_text">
<p>
Below are the rules regarding patching the release branch.</p>
<p>
<li>Patches applied to the release branch are only applied by the release
manager.</li>
<li>During the first round of testing, patches that fix regressions or that
are small and relatively risk free (verified by the appropriate code owner)
are applied to the branch. Code owners are asked to be very conservative in
approving patches for the branch and we reserve the right to reject any patch
that does not fix a regression as previously defined.</li>
<li>During the remaining rounds of testing, only patches that fix regressions
may be applied.</li>
</p>
</div>
<h3><a name="release-patch">Release Patch Rules</a></h3>
<div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="release-final">Release Final Tasks
</a></div>
<div class="doc_text">
<p>
The final stages of the release process involving tagging the release branch,
updating documentation that refers to the release, and updating the demo
page.</p>
<p>FIXME: Add a note if anything needs to be done to the clang website.
Eventually the websites will be merged hopefully.</p>
</div>
<p>Below are the rules regarding patching the release branch:</p>
<ol>
<li><p>Patches applied to the release branch may only be applied by the
release manager.</p></li>
<li><p>During the first round of testing, patches that fix regressions or that
are small and relatively risk free (verified by the appropriate code
owner) are applied to the branch. Code owners are asked to be very
conservative in approving patches for the branch. We reserve the right to
reject any patch that does not fix a regression as previously
defined.</p></li>
<li><p>During the remaining rounds of testing, only patches that fix critical
regressions may be applied.</p></li>
</ol>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="updocs">Update Documentation</a></div>
<div class="doc_text">
<p>
Review the documentation and ensure that it is up to date. The Release Notes
must be updated to reflect bug fixes, new known issues, and changes in the
list of supported platforms. The Getting Started Guide should be updated to
reflect the new release version number tag avaiable from Subversion and
changes in basic system requirements. Merge both changes from mainline into
the release branch.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="tag">Tag the Release Branch</a></div>
<div class="doc_text">
<p>Tag the release branch using the following procedure:</p>
<h3><a name="release-final">Release Final Tasks</a></h3>
<div>
<p>The final stages of the release process involves tagging the "final" release
branch, updating documentation that refers to the release, and updating the
demo page.</p>
<!-- ======================================================================= -->
<h4><a name="updocs">Update Documentation</a></h4>
<div>
<p>Review the documentation and ensure that it is up to date. The "Release
Notes" must be updated to reflect new features, bug fixes, new known issues,
and changes in the list of supported platforms. The "Getting Started Guide"
should be updated to reflect the new release version number tag avaiable from
Subversion and changes in basic system requirements. Merge both changes from
mainline into the release branch.</p>
</div>
<!-- ======================================================================= -->
<h4><a name="tag">Tag the LLVM Final Release</a></h4>
<div>
<p>Tag the final release sources using the following procedure:</p>
<div class="doc_code">
<pre>
svn copy https://llvm.org/svn/llvm-project/llvm/branches/release_XX \
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_<i>XX</i>
svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX \
https://llvm.org/svn/llvm-project/llvm-gcc-4.2/tags/RELEASE_<i>XX</i>
svn copy https://llvm.org/svn/llvm-project/test-suite/branches/release_XX \
https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_<i>XX</i>
$ svn copy https://llvm.org/svn/llvm-project/llvm/branches/release_XY \
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_<i>XY</i>/Final
$ svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XY \
https://llvm.org/svn/llvm-project/llvm-gcc-4.2/tags/RELEASE_<i>XY</i>/Final
$ svn copy https://llvm.org/svn/llvm-project/test-suite/branches/release_XY \
https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_<i>XY</i>/Final
$ svn copy https://llvm.org/svn/llvm-project/cfe/branches/release_XY \
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_<i>XY</i>/Final
</pre>
</div>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="updemo">Update the LLVM Demo Page</a></div>
<div class="doc_text">
<p>
The LLVM demo page must be updated to use the new release. This consists of
using the llvm-gcc binary and building LLVM. Update the website demo page
configuration to use the new release.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="webupdates">Update the LLVM Website</a></div>
<div class="doc_text">
<p>
The website must be updated before the release announcement is sent out. Here is
what to do:</p>
<ol>
<li> Check out the <tt>website</tt> module from CVS. </li>
<li> Create a new subdirectory X.X in the releases directory. </li>
<li> Commit the <tt>llvm</tt>, <tt>test-suite</tt>, <tt>llvm-gcc</tt> source,
<tt>clang source</tt>, <tt>clang binaries</tt>,
and <tt>llvm-gcc</tt> binaries in this new directory. </li>
<li> Copy and commit the <tt>llvm/docs</tt> and <tt>LICENSE.txt</tt>
files into this new directory. The docs should be built with BUILD_FOR_WEBSITE=1.</li>
<li> Commit the index.html to the release/X.X directory to redirect (use from previous
release. </li>
<li> Update the <tt>releases/download.html</tt> file with the new release. </li>
<li>Update the <tt>releases/index.html</tt> with the new release and link to
release documentation.</li>
<li> Finally, update the main page (<tt>index.html</tt> and sidebar) to
point to the new release and release announcement. Make sure this all gets
committed back into Subversion.</li>
</ol>
<h3><a name="updemo">Update the LLVM Demo Page</a></h3>
<div>
<p>The LLVM demo page must be updated to use the new release. This consists of
using the new <tt>llvm-gcc</tt> binary and building LLVM.</p>
<!-- ======================================================================= -->
<h4><a name="webupdates">Update the LLVM Website</a></h4>
<div>
<p>The website must be updated before the release announcement is sent out. Here
is what to do:</p>
<ol>
<li>Check out the <tt>www</tt> module from Subversion.</li>
<li>Create a new subdirectory <tt>X.Y</tt> in the releases directory.</li>
<li>Commit the <tt>llvm</tt>, <tt>test-suite</tt>, <tt>llvm-gcc</tt> source,
<tt>clang source</tt>, <tt>clang binaries</tt>, and <tt>llvm-gcc</tt>
binaries in this new directory.</li>
<li>Copy and commit the <tt>llvm/docs</tt> and <tt>LICENSE.txt</tt> files
into this new directory. The docs should be built with
<tt>BUILD_FOR_WEBSITE=1</tt>.</li>
<li>Commit the <tt>index.html</tt> to the <tt>release/X.Y</tt> directory to
redirect (use from previous release.</li>
<li>Update the <tt>releases/download.html</tt> file with the new release.</li>
<li>Update the <tt>releases/index.html</tt> with the new release and link to
release documentation.</li>
<li>Finally, update the main page (<tt>index.html</tt> and sidebar) to point
to the new release and release announcement. Make sure this all gets
committed back into Subversion.</li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="announce">Announce the Release</a></div>
<div class="doc_text">
<p>Have Chris send out the release announcement when everything is finished.</p>
<h4><a name="announce">Announce the Release</a></h4>
<div>
<p>Have Chris send out the release announcement when everything is finished.</p>
</div>
</div>
</div>
<!-- *********************************************************************** -->
@ -515,9 +617,9 @@ svn copy https://llvm.org/svn/llvm-project/test-suite/branches/release_XX \
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.cs.uiuc.edu">The LLVM Compiler Infrastructure</a>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a>
<br>
Last modified: $Date: 2010-07-07 09:48:00 +0200 (Wed, 07 Jul 2010) $
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>
</html>

View File

@ -7,9 +7,9 @@
</head>
<body>
<div class="doc_title">
<h1>
How to submit an LLVM bug report
</div>
</h1>
<table class="layout" style="width: 90%" >
<tr class="layout">
@ -37,12 +37,12 @@
</table>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="introduction">Introduction - Got bugs?</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>If you're working with LLVM and run into a bug, we definitely want to know
about it. This document describes what you can do to increase the odds of
@ -76,12 +76,12 @@ information:</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="crashers">Crashing Bugs</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>More often than not, bugs in the compiler cause it to crash&mdash;often due
to an assertion failure of some sort. The most important
@ -109,14 +109,12 @@ with the following extra command line options:</p>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="front-end">Front-end bugs</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>If the problem is in the front-end, you should re-run the same
<tt>llvm-gcc</tt> command that resulted in the crash, but add the
@ -137,11 +135,11 @@ has instructions on the best way to use delta.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="ct_optimizer">Compile-time optimization bugs</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>If you find that a bug crashes in the optimizer, compile your test-case to a
<tt>.bc</tt> file by passing "<tt><b>-emit-llvm -O0 -c -o foo.bc</b></tt>".
@ -171,11 +169,11 @@ that bugpoint emits. If something goes wrong with bugpoint, please submit the
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="ct_codegen">Code generator bugs</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>If you find a bug that crashes llvm-gcc in the code generator, compile your
source file to a .bc file by passing "<tt><b>-emit-llvm -c -o foo.bc</b></tt>"
@ -207,13 +205,15 @@ that bugpoint emits. If something goes wrong with bugpoint, please submit the
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="miscompilations">Miscompilations</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="miscompilations">Miscompilations</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>If llvm-gcc successfully produces an executable, but that executable doesn't
run right, this is either a bug in the code or a bug in the
@ -241,12 +241,12 @@ error.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="codegen">Incorrect code generation</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Similarly to debugging incorrect compilation by mis-behaving passes, you can
debug incorrect code generation by either LLC or the JIT, using
@ -338,9 +338,9 @@ the following:</p>
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a>
<br>
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

File diff suppressed because it is too large Load Diff

View File

@ -9,12 +9,12 @@
content="A glossary of terms used with the LLVM project.">
</head>
<body>
<div class="doc_title">The LLVM Lexicon</div>
<h1>The LLVM Lexicon</h1>
<p class="doc_warning">NOTE: This document is a work in progress!</p>
<!-- *********************************************************************** -->
<div class="doc_section">Table Of Contents</div>
<h2>Table Of Contents</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<table>
<tr><th colspan="8"><b>- <a href="#A">A</a> -</b></th></tr>
<tr>
@ -83,19 +83,20 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">Definitions</div>
<h2>Definitions</h2>
<!-- *********************************************************************** -->
<div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="A">- A -</a></div>
<div class="doc_text">
<h3><a name="A">- A -</a></h3>
<div>
<dl>
<dt><a name="ADCE"><b>ADCE</b></a></dt>
<dd>Aggressive Dead Code Elimination</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="B">- B -</a></div>
<div class="doc_text">
<h3><a name="B">- B -</a></h3>
<div>
<dl>
<dt><a name="BURS"><b>BURS</b></a></dt>
<dd>Bottom Up Rewriting System&mdash;A method of instruction selection for
@ -104,8 +105,8 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="C">- C -</a></div>
<div class="doc_text">
<h3><a name="C">- C -</a></h3>
<div>
<dl>
<dt><a name="CSE"><b>CSE</b></a></dt>
<dd>Common Subexpression Elimination. An optimization that removes common
@ -116,8 +117,8 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="D">- D -</a></div>
<div class="doc_text">
<h3><a name="D">- D -</a></h3>
<div>
<dl>
<dt><a name="DAG"><b>DAG</b></a></dt>
<dd>Directed Acyclic Graph</dd>
@ -136,8 +137,8 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="G">- G -</a></div>
<div class="doc_text">
<h3><a name="G">- G -</a></h3>
<div>
<dl>
<dt><a name="GC"><b>GC</b></a></dt>
<dd>Garbage Collection. The practice of using reachability analysis instead
@ -145,8 +146,8 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="H">- H -</a></div>
<div class="doc_text">
<h3><a name="H">- H -</a></h3>
<div>
<dl>
<dt><a name="Heap"><b>Heap</b></a></dt>
<dd>In garbage collection, the region of memory which is managed using
@ -154,8 +155,8 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="I">- I -</a></div>
<div class="doc_text">
<h3><a name="I">- I -</a></h3>
<div>
<dl>
<dt><a name="IPA"><b>IPA</b></a></dt>
<dd>Inter-Procedural Analysis. Refers to any variety of code analysis that
@ -169,8 +170,8 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="L">- L -</a></div>
<div class="doc_text">
<h3><a name="L">- L -</a></h3>
<div>
<dl>
<dt><a name="LCSSA"><b>LCSSA</b></a></dt>
<dd>Loop-Closed Static Single Assignment Form</dd>
@ -183,16 +184,16 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="M">- M -</a></div>
<div class="doc_text">
<h3><a name="M">- M -</a></h3>
<div>
<dl>
<dt><a name="MC"><b>MC</b></a></dt>
<dd>Machine Code</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="O">- O -</a></div>
<div class="doc_text">
<h3><a name="O">- O -</a></h3>
<div>
<dl>
<dt><a name="Object_Pointer"><b>Object Pointer</b></a></dt>
<dd>A pointer to an object such that the garbage collector is able to trace
@ -202,8 +203,8 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="P">- P -</a></div>
<div class="doc_text">
<h3><a name="P">- P -</a></h3>
<div>
<dl>
<dt><a name="PRE"><b>PRE</b></a></dt>
<dd>Partial Redundancy Elimination</dd>
@ -211,8 +212,8 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="R">- R -</a></div>
<div class="doc_text">
<h3><a name="R">- R -</a></h3>
<div>
<dl>
<dt><a name="RAUW"><b>RAUW</b></a></dt> <dd>An abbreviation for Replace
All Uses With. The functions User::replaceUsesOfWith(),
@ -234,8 +235,8 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="S">- S -</a></div>
<div class="doc_text">
<h3><a name="S">- S -</a></h3>
<div>
<dl>
<dt><a name="Safe_Point"><b>Safe Point</b></a></dt>
<dd>In garbage collection, it is necessary to identify <a href="#Root">stack
@ -261,6 +262,8 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
function.</dd>
</dl>
</div>
</div>
<!-- *********************************************************************** -->
<hr>
<address> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
@ -268,8 +271,8 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
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 Team</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
<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) $
</address>
<!-- vim: sw=2
-->

View File

@ -6,9 +6,9 @@
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<div class="doc_title">
<h1>
LLVM Link Time Optimization: Design and Implementation
</div>
</h1>
<ul>
<li><a href="#desc">Description</a></li>
@ -36,12 +36,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="desc">Description</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
LLVM features powerful intermodular optimizations which can be used at link
time. Link Time Optimization (LTO) is another name for intermodular optimization
@ -50,12 +50,12 @@ and design between the LTO optimizer and the linker.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="design">Design Philosophy</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
The LLVM Link Time Optimizer provides complete transparency, while doing
intermodular optimization, in the compiler tool chain. Its main goal is to let
@ -69,14 +69,13 @@ the linker and LLVM optimizer helps to do optimizations that are not possible
in other models. The linker input allows the optimizer to avoid relying on
conservative escape analysis.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="example1">Example of link time optimization</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The following example illustrates the advantages of LTO's integrated
approach and clean interface. This example requires a system linker which
supports LTO through the interface described in this document. Here,
@ -145,11 +144,11 @@ $ llvm-gcc a.o main.o -o main # &lt;-- standard link command without any modific
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="alternative_approaches">Alternative Approaches</a>
</div>
</h3>
<div class="doc_text">
<div>
<dl>
<dt><b>Compiler driver invokes link time optimizer separately.</b></dt>
<dd>In this model the link time optimizer is not able to take advantage of
@ -175,12 +174,14 @@ $ llvm-gcc a.o main.o -o main # &lt;-- standard link command without any modific
</dl>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="multiphase">Multi-phase communication between libLTO and linker</a>
</div>
<div class="doc_text">
<!-- *********************************************************************** -->
<h2>
<a name="multiphase">Multi-phase communication between libLTO and linker</a>
</h2>
<div>
<p>The linker collects information about symbol defininitions and uses in
various link objects which is more accurate than any information collected
by other tools during typical build cycles. The linker collects this
@ -192,14 +193,13 @@ $ llvm-gcc a.o main.o -o main # &lt;-- standard link command without any modific
Our goal is to take advantage of tight integration between the linker and
the optimizer by sharing this information during various linking phases.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="phase1">Phase 1 : Read LLVM Bitcode Files</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The linker first reads all object files in natural order and collects
symbol information. This includes native object files as well as LLVM bitcode
files. To minimize the cost to the linker in the case that all .o files
@ -219,11 +219,11 @@ $ llvm-gcc a.o main.o -o main # &lt;-- standard link command without any modific
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="phase2">Phase 2 : Symbol Resolution</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>In this stage, the linker resolves symbols using global symbol table.
It may report undefined symbol errors, read archive members, replace
weak symbols, etc. The linker is able to do this seamlessly even though it
@ -233,10 +233,10 @@ $ llvm-gcc a.o main.o -o main # &lt;-- standard link command without any modific
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="phase3">Phase 3 : Optimize Bitcode Files</a>
</div>
<div class="doc_text">
</h3>
<div>
<p>After symbol resolution, the linker tells the LTO shared object which
symbols are needed by native object files. In the example above, the linker
reports that only <tt>foo1()</tt> is used by native object files using
@ -248,11 +248,11 @@ $ llvm-gcc a.o main.o -o main # &lt;-- standard link command without any modific
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="phase4">Phase 4 : Symbol Resolution after optimization</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>In this phase, the linker reads optimized a native object file and
updates the internal global symbol table to reflect any changes. The linker
also collects information about any changes in use of external symbols by
@ -264,12 +264,14 @@ $ llvm-gcc a.o main.o -o main # &lt;-- standard link command without any modific
bitcode files.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="lto">libLTO</a>
</div>
<div class="doc_text">
<!-- *********************************************************************** -->
<h2>
<a name="lto">libLTO</a>
</h2>
<div>
<p><tt>libLTO</tt> is a shared object that is part of the LLVM tools, and
is intended for use by a linker. <tt>libLTO</tt> provides an abstract C
interface to use the LLVM interprocedural optimizer without exposing details
@ -278,14 +280,13 @@ $ llvm-gcc a.o main.o -o main # &lt;-- standard link command without any modific
be possible for a completely different compilation technology to provide
a different libLTO that works with their object files and the standard
linker tool.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="lto_module_t">lto_module_t</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>A non-native object file is handled via an <tt>lto_module_t</tt>.
The following functions allow the linker to check if a file (on disk
@ -325,11 +326,11 @@ lto_module_get_symbol_attribute(lto_module_t, unsigned int)
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="lto_code_gen_t">lto_code_gen_t</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Once the linker has loaded each non-native object files into an
<tt>lto_module_t</tt>, it can request libLTO to process them all and
@ -371,6 +372,8 @@ of the native object files.</p>
</div>
</div>
<!-- *********************************************************************** -->
<hr>
@ -381,8 +384,8 @@ of the native object files.</p>
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
Devang Patel and Nick Kledzik<br>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-09-29 22:09:55 +0200 (Wed, 29 Sep 2010) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

View File

@ -7,7 +7,7 @@
</head>
<body>
<div class="doc_title">LLVM Makefile Guide</div>
<h1>LLVM Makefile Guide</h1>
<ol>
<li><a href="#introduction">Introduction</a></li>
@ -77,10 +77,10 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="introduction">Introduction </a></div>
<h2><a name="introduction">Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This document provides <em>usage</em> information about the LLVM makefile
system. While loosely patterned after the BSD makefile system, LLVM has taken
a departure from BSD in order to implement additional features needed by LLVM.
@ -99,20 +99,19 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="general">General Concepts</a></div>
<h2><a name="general">General Concepts</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The LLVM Makefile System is the component of LLVM that is responsible for
building the software, testing it, generating distributions, checking those
distributions, installing and uninstalling, etc. It consists of a several
files throughout the source tree. These files and other general concepts are
described in this section.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="projects">Projects</a></div>
<div class="doc_text">
<h3><a name="projects">Projects</a></h3>
<div>
<p>The LLVM Makefile System is quite generous. It not only builds its own
software, but it can build yours too. Built into the system is knowledge of
the <tt>llvm/projects</tt> directory. Any directory under <tt>projects</tt>
@ -129,8 +128,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="varvalues">Variable Values</a></div>
<div class="doc_text">
<h3><a name="varvalues">Variable Values</a></h3>
<div>
<p>To use the makefile system, you simply create a file named
<tt>Makefile</tt> in your directory and declare values for certain variables.
The variables and values that you select determine what the makefile system
@ -139,16 +138,15 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="including">Including Makefiles</a></div>
<div class="doc_text">
<h3><a name="including">Including Makefiles</a></h3>
<div>
<p>Setting variables alone is not enough. You must include into your Makefile
additional files that provide the rules of the LLVM Makefile system. The
various files involved are described in the sections that follow.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="Makefile">Makefile</a></div>
<div class="doc_text">
<h4><a name="Makefile">Makefile</a></h4>
<div>
<p>Each directory to participate in the build needs to have a file named
<tt>Makefile</tt>. This is the file first read by <tt>make</tt>. It has three
sections:</p>
@ -163,9 +161,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="Makefile.common">Makefile.common</a>
</div>
<div class="doc_text">
<h4><a name="Makefile.common">Makefile.common</a></h4>
<div>
<p>Every project must have a <tt>Makefile.common</tt> file at its top source
directory. This file serves three purposes:</p>
<ol>
@ -182,9 +179,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="Makefile.config">Makefile.config</a>
</div>
<div class="doc_text">
<h4><a name="Makefile.config">Makefile.config</a></h4>
<div>
<p>Every project must have a <tt>Makefile.config</tt> at the top of its
<em>build</em> directory. This file is <b>generated</b> by the
<tt>configure</tt> script from the pattern provided by the
@ -196,8 +192,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="Makefile.rules">Makefile.rules</a></div>
<div class="doc_text">
<h4><a name="Makefile.rules">Makefile.rules</a></h4>
<div>
<p>This file, located at <tt>$(LLVM_SRC_ROOT)/Makefile.rules</tt> is the heart
of the LLVM Makefile System. It provides all the logic, dependencies, and
rules for building the targets supported by the system. What it does largely
@ -205,9 +201,11 @@
have been set <em>before</em> <tt>Makefile.rules</tt> is included.
</div>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="Comments">Comments</a></div>
<div class="doc_text">
<h3><a name="Comments">Comments</a></h3>
<div>
<p>User Makefiles need not have comments in them unless the construction is
unusual or it does not strictly follow the rules and patterns of the LLVM
makefile system. Makefile comments are invoked with the pound (#) character.
@ -215,19 +213,20 @@
by <tt>make</tt>.</p>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="tutorial">Tutorial</a></div>
<h2><a name="tutorial">Tutorial</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This section provides some examples of the different kinds of modules you
can build with the LLVM makefile system. In general, each directory you
provide will build a single object although that object may be composed of
additionally compiled components.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="libraries">Libraries</a></div>
<div class="doc_text">
<h3><a name="libraries">Libraries</a></h3>
<div>
<p>Only a few variable definitions are needed to build a regular library.
Normally, the makefile system will build all the software into a single
<tt>libname.o</tt> (pre-linked) object. This means the library is not
@ -256,11 +255,10 @@
<tt>-load</tt> option. See the
<a href="WritingAnLLVMPass.html#makefile">WritingAnLLVMPass.html</a> document
for an example of why you might want to do this.
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="BCModules">Bitcode Modules</a></div>
<div class="doc_text">
<h4><a name="BCModules">Bitcode Modules</a></h4>
<div>
<p>In some situations, it is desirable to build a single bitcode module from
a variety of sources, instead of an archive, shared library, or bitcode
library. Bitcode modules can be specified in addition to any of the other
@ -280,10 +278,10 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="LoadableModules">Loadable Modules</a>
</div>
<div class="doc_text">
</h4>
<div>
<p>In some situations, you need to create a loadable module. Loadable modules
can be loaded into programs like <tt>opt</tt> or <tt>llc</tt> to specify
additional passes to run or targets to support. Loadable modules are also
@ -311,9 +309,11 @@
library which is part of <tt>lib/System</tt> implementation.</p>
</div>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="tools">Tools</a></div>
<div class="doc_text">
<h3><a name="tools">Tools</a></h3>
<div>
<p>For building executable programs (tools), you must provide the name of the
tool and the names of the libraries you wish to link with the tool. For
example:</p>
@ -344,11 +344,10 @@
syntax is used. Note that in order to use the <tt>.a</tt> suffix, the library
in question must have been built with the <tt>ARCHIVE_LIBRARY</tt> option set.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="JIT">JIT Tools</a></div>
<div class="doc_text">
<h4><a name="JIT">JIT Tools</a></h4>
<div>
<p>Many tools will want to use the JIT features of LLVM. To do this, you
simply specify that you want an execution 'engine', and the makefiles will
automatically link in the appropriate JIT for the host or an interpreter
@ -367,11 +366,15 @@
</tt></pre>
</div>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="targets">Targets Supported</a></div>
<h2><a name="targets">Targets Supported</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This section describes each of the targets that can be built using the LLVM
Makefile system. Any target can be invoked from any directory but not all are
applicable to a given directory (e.g. "check", "dist" and "install" will
@ -426,11 +429,10 @@
<td>Remove built objects from installation directory.
</td></tr>
</table>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="all">all (default)</a></div>
<div class="doc_text">
<h3><a name="all">all (default)</a></h3>
<div>
<p>When you invoke <tt>make</tt> with no arguments, you are implicitly
instructing it to seek the "all" target (goal). This target is used for
building the software recursively and will do different things in different
@ -440,15 +442,15 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="all-local">all-local</a></div>
<div class="doc_text">
<h3><a name="all-local">all-local</a></h3>
<div>
<p>This target is the same as <a href="#all">all</a> but it operates only on
the current directory instead of recursively.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="check">check</a></div>
<div class="doc_text">
<h3><a name="check">check</a></h3>
<div>
<p>This target can be invoked from anywhere within a project's directories
but always invokes the <a href="#check-local"><tt>check-local</tt></a> target
in the project's <tt>test</tt> directory, if it exists and has a
@ -464,8 +466,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="check-local">check-local</a></div>
<div class="doc_text">
<h3><a name="check-local">check-local</a></h3>
<div>
<p>This target should be implemented by the <tt>Makefile</tt> in the project's
<tt>test</tt> directory. It is invoked by the <tt>check</tt> target elsewhere.
Each project is free to define the actions of <tt>check-local</tt> as
@ -475,8 +477,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="clean">clean</a></div>
<div class="doc_text">
<h3><a name="clean">clean</a></h3>
<div>
<p>This target cleans the build directory, recursively removing all things
that the Makefile builds. The cleaning rules have been made guarded so they
shouldn't go awry (via <tt>rm -f $(UNSET_VARIABLE)/*</tt> which will attempt
@ -484,15 +486,15 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="clean-local">clean-local</a></div>
<div class="doc_text">
<h3><a name="clean-local">clean-local</a></h3>
<div>
<p>This target does the same thing as <tt>clean</tt> but only for the current
(local) directory.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="dist">dist</a></div>
<div class="doc_text">
<h3><a name="dist">dist</a></h3>
<div>
<p>This target builds a distribution tarball. It first builds the entire
project using the <tt>all</tt> target and then tars up the necessary files and
compresses it. The generated tarball is sufficient for a casual source
@ -500,8 +502,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="dist-check">dist-check</a></div>
<div class="doc_text">
<h3><a name="dist-check">dist-check</a></h3>
<div>
<p>This target does the same thing as the <tt>dist</tt> target but also checks
the distribution tarball. The check is made by unpacking the tarball to a new
directory, configuring it, building it, installing it, and then verifying that
@ -512,16 +514,16 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="dist-clean">dist-clean</a></div>
<div class="doc_text">
<h3><a name="dist-clean">dist-clean</a></h3>
<div>
<p>This is a special form of the <tt>clean</tt> clean target. It performs a
normal <tt>clean</tt> but also removes things pertaining to building the
distribution.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="install">install</a></div>
<div class="doc_text">
<h3><a name="install">install</a></h3>
<div>
<p>This target finalizes shared objects and executables and copies all
libraries, headers, executables and documentation to the directory given
with the <tt>--prefix</tt> option to <tt>configure</tt>. When completed,
@ -538,8 +540,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="preconditions">preconditions</a></div>
<div class="doc_text">
<h3><a name="preconditions">preconditions</a></h3>
<div>
<p>This utility target checks to see if the <tt>Makefile</tt> in the object
directory is older than the <tt>Makefile</tt> in the source directory and
copies it if so. It also reruns the <tt>configure</tt> script if that needs to
@ -549,15 +551,15 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="printvars">printvars</a></div>
<div class="doc_text">
<h3><a name="printvars">printvars</a></h3>
<div>
<p>This utility target just causes the LLVM makefiles to print out some of
the makefile variables so that you can double check how things are set. </p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="reconfigure">reconfigure</a></div>
<div class="doc_text">
<h3><a name="reconfigure">reconfigure</a></h3>
<div>
<p>This utility target will force a reconfigure of LLVM or your project. It
simply runs <tt>$(PROJ_OBJ_ROOT)/config.status --recheck</tt> to rerun the
configuration tests and rebuild the configured files. This isn't generally
@ -566,8 +568,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="spotless">spotless</a></div>
<div class="doc_text">
<h3><a name="spotless">spotless</a></h3>
<div>
<p>This utility target, only available when <tt>$(PROJ_OBJ_ROOT)</tt> is not
the same as <tt>$(PROJ_SRC_ROOT)</tt>, will completely clean the
<tt>$(PROJ_OBJ_ROOT)</tt> directory by removing its content entirely and
@ -578,8 +580,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="tags">tags</a></div>
<div class="doc_text">
<h3><a name="tags">tags</a></h3>
<div>
<p>This target will generate a <tt>TAGS</tt> file in the top-level source
directory. It is meant for use with emacs, XEmacs, or ViM. The TAGS file
provides an index of symbol definitions so that the editor can jump you to the
@ -587,18 +589,20 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="uninstall">uninstall</a></div>
<div class="doc_text">
<h3><a name="uninstall">uninstall</a></h3>
<div>
<p>This target is the opposite of the <tt>install</tt> target. It removes the
header, library and executable files from the installation directories. Note
that the directories themselves are not removed because it is not guaranteed
that LLVM is the only thing installing there (e.g. --prefix=/usr).</p>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="variables">Variables</a></div>
<h2><a name="variables">Variables</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Variables are used to tell the LLVM Makefile System what to do and to
obtain information from it. Variables are also used internally by the LLVM
Makefile System. Variable names that contain only the upper case alphabetic
@ -606,11 +610,10 @@
variables are internal to the LLVM Makefile System and should not be relied
upon nor modified. The sections below describe how to use the LLVM Makefile
variables.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="setvars">Control Variables</a></div>
<div class="doc_text">
<h3><a name="setvars">Control Variables</a></h3>
<div>
<p>Variables listed in the table below should be set <em>before</em> the
inclusion of <a href="#Makefile.common"><tt>$(LEVEL)/Makefile.common</tt></a>.
These variables provide input to the LLVM make system that tell it what to do
@ -762,8 +765,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="overvars">Override Variables</a></div>
<div class="doc_text">
<h3><a name="overvars">Override Variables</a></h3>
<div>
<p>Override variables can be used to override the default
values provided by the LLVM makefile system. These variables can be set in
several ways:</p>
@ -868,8 +871,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="getvars">Readable Variables</a></div>
<div class="doc_text">
<h3><a name="getvars">Readable Variables</a></h3>
<div>
<p>Variables listed in the table below can be used by the user's Makefile but
should not be changed. Changing the value will generally cause the build to go
wrong, so don't do it.</p>
@ -939,8 +942,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="intvars">Internal Variables</a></div>
<div class="doc_text">
<h3><a name="intvars">Internal Variables</a></h3>
<div>
<p>Variables listed below are used by the LLVM Makefile System
and considered internal. You should not use these variables under any
circumstances.</p>
@ -1018,6 +1021,8 @@
</tt></p>
</div>
</div>
<!-- *********************************************************************** -->
<hr>
<address>
@ -1027,8 +1032,8 @@
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
<a href="mailto:rspencer@x10sys.com">Reid Spencer</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-10-22 14:54:34 +0200 (Fri, 22 Oct 2010) $
<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) $
</address>
</body>
</html>

View File

@ -7,7 +7,7 @@
</head>
<body>
<div class="doc_title">Advice on Packaging LLVM</div>
<h1>Advice on Packaging LLVM</h1>
<ol>
<li><a href="#overview">Overview</a></li>
<li><a href="#compilation">Compile Flags</a></li>
@ -17,9 +17,9 @@
</ol>
<!--=========================================================================-->
<div class="doc_section"><a name="overview">Overview</a></div>
<h2><a name="overview">Overview</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>LLVM sets certain default configure options to make sure our developers don't
break things for constrained platforms. These settings are not optimal for most
@ -34,9 +34,9 @@ developed against each.
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="compilation">Compile Flags</a></div>
<h2><a name="compilation">Compile Flags</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>LLVM runs much more quickly when it's optimized and assertions are removed.
However, such a build is currently incompatible with users who build without
@ -65,9 +65,9 @@ versions of LLVM in parallel. The following configure flags are relevant:
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="cxx-features">C++ Features</a></div>
<h2><a name="cxx-features">C++ Features</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<dl>
<dt>RTTI</dt><dd>LLVM disables RTTI by default. Add <tt>REQUIRES_RTTI=1</tt>
@ -78,9 +78,9 @@ versions of LLVM in parallel. The following configure flags are relevant:
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="shared-library">Shared Library</a></div>
<h2><a name="shared-library">Shared Library</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>Configure with <tt>--enable-shared</tt> to build
<tt>libLLVM-<var>major</var>.<var>minor</var>.(so|dylib)</tt> and link the tools
@ -89,9 +89,9 @@ against it. This saves lots of binary size at the cost of some startup time.
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="deps">Dependencies</a></div>
<h2><a name="deps">Dependencies</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<dl>
<dt><tt>--enable-libffi</tt></dt><dd>Depend on <a
@ -111,8 +111,8 @@ line numbers.</dd>
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: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
<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) $
</address>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
</head>
<body>
<div class="doc_title">Creating an LLVM Project</div>
<h1>Creating an LLVM Project</h1>
<ol>
<li><a href="#overview">Overview</a></li>
@ -30,10 +30,10 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="overview">Overview</a></div>
<h2><a name="overview">Overview</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The LLVM build system is designed to facilitate the building of third party
projects that use LLVM header files, libraries, and tools. In order to use
@ -73,12 +73,12 @@ provide enough information on how to write your own Makefiles.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="create">Create a Project from the Sample Project</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Follow these simple steps to start your project:</p>
@ -145,12 +145,12 @@ project should build.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="source">Source Tree Layout</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>In order to use the LLVM build system, you will want to organize your
source code so that it can benefit from the build system's features.
@ -230,26 +230,24 @@ your <b>tools</b> directory.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="makefiles">Writing LLVM Style Makefiles</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The LLVM build system provides a convenient way to build libraries and
executables. Most of your project Makefiles will only need to define a few
variables. Below is a list of the variables one can set and what they can
do:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="reqVars">Required Variables</a>
</div>
</h3>
<div class="doc_text">
<div>
<dl>
<dt>LEVEL
@ -263,11 +261,11 @@ do:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="varsBuildDir">Variables for Building Subdirectories</a>
</div>
</h3>
<div class="doc_text">
<div>
<dl>
<dt>DIRS
@ -294,11 +292,11 @@ do:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="varsBuildLib">Variables for Building Libraries</a>
</div>
</h3>
<div class="doc_text">
<div>
<dl>
<dt>LIBRARYNAME
@ -325,11 +323,11 @@ do:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="varsBuildProg">Variables for Building Programs</a>
</div>
</h3>
<div class="doc_text">
<div>
<dl>
<dt>TOOLNAME
@ -368,11 +366,11 @@ do:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="miscVars">Miscellaneous Variables</a>
</div>
</h3>
<div class="doc_text">
<div>
<dl>
<dt>ExtraSource
@ -398,13 +396,15 @@ do:</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="objcode">Placement of Object Code</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="objcode">Placement of Object Code</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The final location of built libraries and executables will depend upon
whether you do a Debug, Release, or Profile build.</p>
@ -427,12 +427,12 @@ whether you do a Debug, Release, or Profile build.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="help">Further Help</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>If you have any questions or need any help creating an LLVM project,
the LLVM team would be more than happy to help. You can always post your
@ -451,9 +451,9 @@ Mailing List</a>.</p>
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
<a href="mailto:criswell@uiuc.edu">John Criswell</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a>
<br>
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
</head>
<body>
<div class="doc_title">Source Level Debugging with LLVM</div>
<h1>Source Level Debugging with LLVM</h1>
<table class="layout" style="width:100%">
<tr class="layout">
@ -68,10 +68,10 @@ height="369">
<!-- *********************************************************************** -->
<div class="doc_section"><a name="introduction">Introduction</a></div>
<h2><a name="introduction">Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This document is the central repository for all information pertaining to
debug information in LLVM. It describes the <a href="#format">actual format
@ -80,14 +80,12 @@ height="369">
Further, this document provides specific examples of what debug information
for C/C++ looks like.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="phil">Philosophy behind LLVM debugging information</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The idea of the LLVM debugging information is to capture how the important
pieces of the source-language's Abstract Syntax Tree map onto LLVM code.
@ -133,11 +131,11 @@ height="369">
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="consumers">Debug information consumers</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The role of debug information is to provide meta information normally
stripped away during the compilation process. This meta information provides
@ -157,11 +155,11 @@ height="369">
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="debugopt">Debugging optimized code</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>An extremely high priority of LLVM debugging information is to make it
interact well with optimizations and analysis. In particular, the LLVM debug
@ -226,13 +224,15 @@ height="369">
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="format">Debugging information format</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="format">Debugging information format</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>LLVM debugging information has been carefully designed to make it possible
for the optimizer to optimize the program and debugging information without
@ -265,14 +265,12 @@ height="369">
common to any source-language. The <a href="#ccxx_frontend">next section</a>
describes the data layout conventions used by the C and C++ front-ends.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="debug_info_descriptors">Debug information descriptors</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>In consideration of the complexity and volume of debug information, LLVM
provides a specification for well formed debug descriptors. </p>
@ -312,14 +310,12 @@ height="369">
<p>The details of the various descriptors follow.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_compile_units">Compile unit descriptors</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -351,11 +347,11 @@ height="369">
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_files">File descriptors</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -380,11 +376,11 @@ height="369">
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_global_variables">Global variable descriptors</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -407,16 +403,17 @@ height="369">
</div>
<p>These descriptors provide debug information about globals variables. The
provide details such as name, type and where the variable is defined.</p>
provide details such as name, type and where the variable is defined. All
global variables are collected by named metadata <tt>!llvm.dbg.gv</tt>.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_subprograms">Subprogram descriptors</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -432,30 +429,35 @@ provide details such as name, type and where the variable is defined.</p>
i32, ;; Line number where defined
metadata, ;; Reference to type descriptor
i1, ;; True if the global is local to compile unit (static)
i1 ;; True if the global is defined in the compile unit (not extern)
i32 ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual
i32 ;; Index into a virtual function
i1, ;; True if the global is defined in the compile unit (not extern)
i32, ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual
i32, ;; Index into a virtual function
metadata, ;; indicates which base type contains the vtable pointer for the
;; derived class
i1 ;; isArtificial
i1 ;; isOptimized
Function *;; Pointer to LLVM function
i1, ;; isArtificial
i1, ;; isOptimized
Function *,;; Pointer to LLVM function
metadata, ;; Lists function template parameters
metadata ;; Function declaration descriptor
}
</pre>
</div>
<p>These descriptors provide debug information about functions, methods and
subprograms. They provide details such as name, return types and the source
location where the subprogram is defined.</p>
location where the subprogram is defined.
All subprogram descriptors are collected by a named metadata
<tt>!llvm.dbg.sp</tt>.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_blocks">Block descriptors</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -463,7 +465,9 @@ provide details such as name, type and where the variable is defined.</p>
i32, ;; Tag = 11 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_lexical_block)
metadata,;; Reference to context descriptor
i32, ;; Line number
i32 ;; Column number
i32, ;; Column number
metadata,;; Reference to source file
i32 ;; Unique ID to identify blocks from a template function
}
</pre>
</div>
@ -475,11 +479,11 @@ provide details such as name, type and where the variable is defined.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_basic_type">Basic type descriptors</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -527,11 +531,11 @@ DW_ATE_unsigned_char = 8
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_derived_type">Derived type descriptors</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -544,7 +548,12 @@ DW_ATE_unsigned_char = 8
i64, ;; Size in bits
i64, ;; Alignment in bits
i64, ;; Offset in bits
metadata ;; Reference to type derived from
metadata, ;; Reference to type derived from
metadata, ;; (optional) Name of the Objective C property assoicated with
;; Objective-C an ivar
metadata, ;; (optional) Name of the Objective C property getter selector.
metadata, ;; (optional) Name of the Objective C property setter selector.
i32 ;; (optional) Objective C property attributes.
}
</pre>
</div>
@ -594,11 +603,11 @@ DW_TAG_restrict_type = 55
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_composite_type">Composite type descriptors</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -644,7 +653,8 @@ DW_TAG_inheritance = 28
<p>The members of enumeration types (tag = <tt>DW_TAG_enumeration_type</tt>) are
<a href="#format_enumeration">enumerator descriptors</a>, each representing
the definition of enumeration value for the set.</p>
the definition of enumeration value for the set. All enumeration type
descriptors are collected by named metadata <tt>!llvm.dbg.enum</tt>.</p>
<p>The members of structure (tag = <tt>DW_TAG_structure_type</tt>) or union (tag
= <tt>DW_TAG_union_type</tt>) types are any one of
@ -680,11 +690,11 @@ DW_TAG_inheritance = 28
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_subrange">Subrange descriptors</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -700,16 +710,17 @@ DW_TAG_inheritance = 28
<a href="#format_composite_type">composite type</a>. The low value defines
the lower bounds typically zero for C/C++. The high value is the upper
bounds. Values are 64 bit. High - low + 1 is the size of the array. If low
== high the array will be unbounded.</p>
> high the array bounds are not included in generated debugging information.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_enumeration">Enumerator descriptors</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -729,11 +740,11 @@ DW_TAG_inheritance = 28
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_variables">Local variables</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -742,7 +753,8 @@ DW_TAG_inheritance = 28
metadata, ;; Context
metadata, ;; Name
metadata, ;; Reference to file where defined
i32, ;; Line number where defined
i32, ;; 24 bit - Line number where defined
;; 8 bit - Argument number. 1 indicates 1st argument.
metadata ;; Type descriptor
}
</pre>
@ -771,39 +783,39 @@ DW_TAG_return_variable = 258
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="format_common_intrinsics">Debugger intrinsic functions</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="format_common_intrinsics">Debugger intrinsic functions</a>
</h3>
<div>
<p>LLVM uses several intrinsic functions (name prefixed with "llvm.dbg") to
provide debug information at various points in generated code.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_common_declare">llvm.dbg.declare</a>
</div>
</h4>
<div class="doc_text">
<div>
<pre>
void %<a href="#format_common_declare">llvm.dbg.declare</a>(metadata, metadata)
</pre>
<p>This intrinsic provides information about a local element (ex. variable.) The
first argument is metadata holding alloca for the variable.</tt>. The
first argument is metadata holding alloca for the variable. The
second argument is metadata containing description of the variable. </p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="format_common_value">llvm.dbg.value</a>
</div>
</h4>
<div class="doc_text">
<div>
<pre>
void %<a href="#format_common_value">llvm.dbg.value</a>(metadata, i64, metadata)
</pre>
@ -815,12 +827,14 @@ DW_TAG_return_variable = 258
user source variable. </p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="format_common_lifetime">Object lifetimes and scoping</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="format_common_lifetime">Object lifetimes and scoping</a>
</h3>
<div>
<p>In many languages, the local variables in functions can have their lifetimes
or scopes limited to a subset of a function. In the C family of languages,
for example, variables are only live (readable and writable) within the
@ -978,13 +992,15 @@ call void @llvm.dbg.declare(metadata, metadata !12), !dbg !14
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="ccxx_frontend">C/C++ front-end specific debug information</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="ccxx_frontend">C/C++ front-end specific debug information</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The C and C++ front-ends represent information about the program in a format
that is effectively identical
@ -1005,14 +1021,12 @@ call void @llvm.dbg.declare(metadata, metadata !12), !dbg !14
<p>The following sections provide examples of various C/C++ constructs and the
debug information that would best describe those constructs.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="ccxx_compile_units">C/C++ source file information</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Given the source files <tt>MySource.cpp</tt> and <tt>MyHeader.h</tt> located
in the directory <tt>/Users/mine/sources</tt>, the following code:</p>
@ -1086,11 +1100,11 @@ using <tt>Instruction::getMetadata()</tt> and
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="ccxx_global_variable">C/C++ global variable information</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Given an integer global variable declared as follows:</p>
@ -1156,11 +1170,11 @@ int MyGlobal = 100;
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="ccxx_subprogram">C/C++ function information</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Given a function declared as follows:</p>
@ -1192,7 +1206,14 @@ int main(int argc, char *argv[]) {
i32 1, ;; Line number
metadata !4, ;; Type
i1 false, ;; Is local
i1 true ;; Is definition
i1 true, ;; Is definition
i32 0, ;; Virtuality attribute, e.g. pure virtual function
i32 0, ;; Index into virtual table for C++ methods
i32 0, ;; Type that holds virtual table.
i32 0, ;; Flags
i1 false, ;; True if this function is optimized
Function *, ;; Pointer to llvm::Function
null ;; Function template parameters
}
;;
;; Define the subprogram itself.
@ -1206,22 +1227,20 @@ define i32 @main(i32 %argc, i8** %argv) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="ccxx_basic_types">C/C++ basic types</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The following are the basic type descriptors for C/C++ core types:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="ccxx_basic_type_bool">bool</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -1243,11 +1262,11 @@ define i32 @main(i32 %argc, i8** %argv) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="ccxx_basic_char">char</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -1269,11 +1288,11 @@ define i32 @main(i32 %argc, i8** %argv) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="ccxx_basic_unsigned_char">unsigned char</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -1295,11 +1314,11 @@ define i32 @main(i32 %argc, i8** %argv) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="ccxx_basic_short">short</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -1321,11 +1340,11 @@ define i32 @main(i32 %argc, i8** %argv) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="ccxx_basic_unsigned_short">unsigned short</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -1347,11 +1366,11 @@ define i32 @main(i32 %argc, i8** %argv) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="ccxx_basic_int">int</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -1372,11 +1391,11 @@ define i32 @main(i32 %argc, i8** %argv) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="ccxx_basic_unsigned_int">unsigned int</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -1398,11 +1417,11 @@ define i32 @main(i32 %argc, i8** %argv) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="ccxx_basic_long_long">long long</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -1424,11 +1443,11 @@ define i32 @main(i32 %argc, i8** %argv) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="ccxx_basic_unsigned_long_long">unsigned long long</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -1450,11 +1469,11 @@ define i32 @main(i32 %argc, i8** %argv) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="ccxx_basic_float">float</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -1476,11 +1495,11 @@ define i32 @main(i32 %argc, i8** %argv) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<h4>
<a name="ccxx_basic_double">double</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code">
<pre>
@ -1501,12 +1520,14 @@ define i32 @main(i32 %argc, i8** %argv) {
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="ccxx_derived_types">C/C++ derived types</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="ccxx_derived_types">C/C++ derived types</a>
</h3>
<div>
<p>Given the following as an example of C/C++ derived type:</p>
@ -1587,11 +1608,11 @@ typedef const int *IntPtr;
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="ccxx_composite_types">C/C++ struct/union types</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Given the following as an example of C/C++ struct type:</p>
@ -1700,11 +1721,11 @@ struct Color {
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="ccxx_enumeration_types">C/C++ enumeration types</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Given the following as an example of C/C++ enumeration type:</p>
@ -1765,6 +1786,8 @@ enum Trees {
</div>
</div>
<!-- *********************************************************************** -->
<hr>
@ -1775,8 +1798,8 @@ enum Trees {
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-02-03 01:22:17 +0100 (Thu, 03 Feb 2011) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

View File

@ -7,7 +7,7 @@
</head>
<body>
<div class="doc_title">System Library</div>
<h1>System Library</h1>
<ul>
<li><a href="#abstract">Abstract</a></li>
<li><a href="#requirements">Keeping LLVM Portable</a>
@ -36,8 +36,8 @@
<!-- *********************************************************************** -->
<div class="doc_section"><a name="abstract">Abstract</a></div>
<div class="doc_text">
<h2><a name="abstract">Abstract</a></h2>
<div>
<p>This document provides some details on LLVM's System Library, located in
the source at <tt>lib/System</tt> and <tt>include/llvm/System</tt>. The
library's purpose is to shield LLVM from the differences between operating
@ -63,21 +63,19 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="requirements">Keeping LLVM Portable</a>
</div>
<div class="doc_text">
</h2>
<div>
<p>In order to keep LLVM portable, LLVM developers should adhere to a set of
portability rules associated with the System Library. Adherence to these rules
should help the System Library achieve its goal of shielding LLVM from the
variations in operating system interfaces and doing so efficiently. The
following sections define the rules needed to fulfill this objective.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="headers">Don't Include System Headers</a>
</div>
<div class="doc_text">
<h3><a name="headers">Don't Include System Headers</a></h3>
<div>
<p>Except in <tt>lib/System</tt>, no LLVM source code should directly
<tt>#include</tt> a system header. Care has been taken to remove all such
<tt>#includes</tt> from LLVM while <tt>lib/System</tt> was being
@ -91,9 +89,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="expose">Don't Expose System Headers</a>
</div>
<div class="doc_text">
<h3><a name="expose">Don't Expose System Headers</a></h3>
<div>
<p>The System Library must shield LLVM from <em>all</em> system headers. To
obtain system level functionality, LLVM source must
<tt>#include "llvm/System/Thing.h"</tt> and nothing else. This means that
@ -103,8 +100,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="c_headers">Use Standard C Headers</a></div>
<div class="doc_text">
<h3><a name="c_headers">Use Standard C Headers</a></h3>
<div>
<p>The <em>standard</em> C headers (the ones beginning with "c") are allowed
to be exposed through the <tt>lib/System</tt> interface. These headers and
the things they declare are considered to be platform agnostic. LLVM source
@ -113,9 +110,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="cpp_headers">Use Standard C++ Headers</a>
</div>
<div class="doc_text">
<h3><a name="cpp_headers">Use Standard C++ Headers</a></h3>
<div>
<p>The <em>standard</em> C++ headers from the standard C++ library and
standard template library may be exposed through the <tt>lib/System</tt>
interface. These headers and the things they declare are considered to be
@ -124,8 +120,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="highlev">High Level Interface</a></div>
<div class="doc_text">
<h3><a name="highlev">High Level Interface</a></h3>
<div>
<p>The entry points specified in the interface of lib/System must be aimed at
completing some reasonably high level task needed by LLVM. We do not want to
simply wrap each operating system call. It would be preferable to wrap several
@ -143,8 +139,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="nounused">No Unused Functionality</a></div>
<div class="doc_text">
<h3><a name="nounused">No Unused Functionality</a></h3>
<div>
<p>There must be no functionality specified in the interface of lib/System
that isn't actually used by LLVM. We're not writing a general purpose
operating system wrapper here, just enough to satisfy LLVM's needs. And, LLVM
@ -153,9 +149,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="nodupl">No Duplicate Implementations</a>
</div>
<div class="doc_text">
<h3><a name="nodupl">No Duplicate Implementations</a></h3>
<div>
<p>The implementation of a function for a given platform must be written
exactly once. This implies that it must be possible to apply a function's
implementation to multiple operating systems if those operating systems can
@ -165,8 +160,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="virtuals">No Virtual Methods</a></div>
<div class="doc_text">
<h3><a name="virtuals">No Virtual Methods</a></h3>
<div>
<p>The System Library interfaces can be called quite frequently by LLVM. In
order to make those calls as efficient as possible, we discourage the use of
virtual methods. There is no need to use inheritance for implementation
@ -175,8 +170,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="nofunc">No Exposed Functions</a></div>
<div class="doc_text">
<h3><a name="nofunc">No Exposed Functions</a></h3>
<div>
<p>Any functions defined by system libraries (i.e. not defined by lib/System)
must not be exposed through the lib/System interface, even if the header file
for that function is not exposed. This prevents inadvertent use of system
@ -191,8 +186,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="nodata">No Exposed Data</a></div>
<div class="doc_text">
<h3><a name="nodata">No Exposed Data</a></h3>
<div>
<p>Any data defined by system libraries (i.e. not defined by lib/System) must
not be exposed through the lib/System interface, even if the header file for
that function is not exposed. As with functions, this prevents inadvertent use
@ -200,8 +195,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="softerrors">Minimize Soft Errors</a></div>
<div class="doc_text">
<h3><a name="softerrors">Minimize Soft Errors</a></h3>
<div>
<p>Operating system interfaces will generally provide error results for every
little thing that could go wrong. In almost all cases, you can divide these
error results into two groups: normal/good/soft and abnormal/bad/hard. That
@ -239,9 +234,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="throw_spec">No throw Specifications</a>
</div>
<div class="doc_text">
<h3><a name="throw_spec">No throw Specifications</a></h3>
<div>
<p>None of the lib/System interface functions may be declared with C++
<tt>throw()</tt> specifications on them. This requirement makes sure that the
compiler does not insert additional exception handling code into the interface
@ -252,8 +246,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="organization">Code Organization</a></div>
<div class="doc_text">
<h3><a name="organization">Code Organization</a></h3>
<div>
<p>Implementations of the System Library interface are separated by their
general class of operating system. Currently only Unix and Win32 classes are
defined but more could be added for other operating system classifications.
@ -281,8 +275,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="semantics">Consistent Semantics</a></div>
<div class="doc_text">
<h3><a name="semantics">Consistent Semantics</a></h3>
<div>
<p>The implementation of a lib/System interface can vary drastically between
platforms. That's okay as long as the end result of the interface function
is the same. For example, a function to create a directory is pretty straight
@ -296,12 +290,14 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="bug">Bug 351</a></div>
<div class="doc_text">
<h3><a name="bug">Bug 351</a></h3>
<div>
<p>See <a href="http://llvm.org/PR351">bug 351</a>
for further details on the progress of this work</p>
</div>
</div>
<!-- *********************************************************************** -->
<hr>
@ -312,8 +308,8 @@
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
<a href="mailto:rspencer@x10sys.com">Reid Spencer</a><br>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>
</html>

View File

@ -7,9 +7,9 @@
</head>
<body>
<div class="doc_title">TableGen Fundamentals</div>
<h1>TableGen Fundamentals</h1>
<div class="doc_text">
<div>
<ul>
<li><a href="#introduction">Introduction</a>
<ol>
@ -50,10 +50,10 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="introduction">Introduction</a></div>
<h2><a name="introduction">Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>TableGen's purpose is to help a human develop and maintain records of
domain-specific information. Because there may be a large number of these
@ -72,12 +72,10 @@ find an emacs "TableGen mode" and a vim language file in the
<tt>llvm/utils/emacs</tt> and <tt>llvm/utils/vim</tt> directories of your LLVM
distribution, respectively.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="concepts">Basic concepts</a></div>
<h3><a name="concepts">Basic concepts</a></h3>
<div class="doc_text">
<div>
<p>TableGen files consist of two key parts: 'classes' and 'definitions', both
of which are considered 'records'.</p>
@ -112,9 +110,9 @@ multiclass, as if they were declared in the current multiclass.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="example">An example record</a></div>
<h3><a name="example">An example record</a></h3>
<div class="doc_text">
<div>
<p>With no other arguments, TableGen parses the specified file and prints out
all of the classes, then all of the definitions. This is a good way to see what
@ -212,9 +210,9 @@ abstractions they prefer to use when describing their information.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="running">Running TableGen</a></div>
<h3><a name="running">Running TableGen</a></h3>
<div class="doc_text">
<div>
<p>TableGen runs just like any other LLVM tool. The first (optional) argument
specifies the file to read. If a filename is not specified, <tt>tblgen</tt>
@ -256,27 +254,28 @@ what you need and formats it in the appropriate way.</p>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="syntax">TableGen syntax</a></div>
<h2><a name="syntax">TableGen syntax</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>TableGen doesn't care about the meaning of data (that is up to the backend to
define), but it does care about syntax, and it enforces a simple type system.
This section describes the syntax and the constructs allowed in a TableGen file.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="primitives">TableGen primitives</a></div>
<h3><a name="primitives">TableGen primitives</a></h3>
<div>
<!-- -------------------------------------------------------------------------->
<div class="doc_subsubsection"><a name="comments">TableGen comments</a></div>
<h4><a name="comments">TableGen comments</a></h4>
<div class="doc_text">
<div>
<p>TableGen supports BCPL style "<tt>//</tt>" comments, which run to the end of
the line, and it also supports <b>nestable</b> "<tt>/* */</tt>" comments.</p>
@ -284,11 +283,11 @@ the line, and it also supports <b>nestable</b> "<tt>/* */</tt>" comments.</p>
</div>
<!-- -------------------------------------------------------------------------->
<div class="doc_subsubsection">
<h4>
<a name="types">The TableGen type system</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>TableGen files are strongly typed, in a simple (but complete) type-system.
These types are used to perform automatic conversions, check for errors, and to
@ -344,11 +343,11 @@ needed.</p>
</div>
<!-- -------------------------------------------------------------------------->
<div class="doc_subsubsection">
<h4>
<a name="values">TableGen values and expressions</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>TableGen allows for a pretty reasonable number of different expression forms
when building up values. These forms allow the TableGen file to be written in a
@ -433,12 +432,14 @@ to a "<tt>bits&lt;4&gt;</tt>" value, for example.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="classesdefs">Classes and definitions</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="classesdefs">Classes and definitions</a>
</h3>
<div>
<p>As mentioned in the <a href="#concepts">intro</a>, classes and definitions
(collectively known as 'records') in TableGen are the main high-level unit of
@ -473,14 +474,12 @@ between a group of records and isolating it in a single place. Also, classes
permit the specification of default values for their subclasses, allowing the
subclasses to override them as they wish.</p>
</div>
<!---------------------------------------------------------------------------->
<div class="doc_subsubsection">
<h4>
<a name="valuedef">Value definitions</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>Value definitions define named entries in records. A value must be defined
before it can be referred to as the operand for another value definition or
@ -492,11 +491,11 @@ equal sign. Value definitions require terminating semicolons.</p>
</div>
<!-- -------------------------------------------------------------------------->
<div class="doc_subsubsection">
<h4>
<a name="recordlet">'let' expressions</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>A record-level let expression is used to change the value of a value
definition in a record. This is primarily useful when a superclass defines a
@ -519,11 +518,11 @@ because the <tt>D</tt> class overrode its value.</p>
</div>
<!-- -------------------------------------------------------------------------->
<div class="doc_subsubsection">
<h4>
<a name="templateargs">Class template arguments</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>TableGen permits the definition of parameterized classes as well as normal
concrete classes. Parameterized TableGen classes specify a list of variable
@ -610,11 +609,11 @@ X86 backend.</p>
</div>
<!-- -------------------------------------------------------------------------->
<div class="doc_subsubsection">
<h4>
<a name="multiclass">Multiclass definitions and instances</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>
While classes with template arguments are a good way to factor commonality
@ -772,17 +771,21 @@ before them.
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="filescope">File scope entities</a>
</div>
<!-- ======================================================================= -->
<h3>
<a name="filescope">File scope entities</a>
</h3>
<div>
<!-- -------------------------------------------------------------------------->
<div class="doc_subsubsection">
<h4>
<a name="include">File inclusion</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>TableGen supports the '<tt>include</tt>' token, which textually substitutes
the specified file in place of the include directive. The filename should be
specified as a double quoted string immediately after the '<tt>include</tt>'
@ -797,11 +800,11 @@ keyword. Example:</p>
</div>
<!-- -------------------------------------------------------------------------->
<div class="doc_subsubsection">
<h4>
<a name="globallet">'let' expressions</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>"Let" expressions at file scope are similar to <a href="#recordlet">"let"
expressions within a record</a>, except they can specify a value binding for
@ -864,11 +867,15 @@ several levels of multiclass instanciations. This also avoids the need of using
</pre>
</div>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="codegen">Code Generator backend info</a></div>
<h2><a name="codegen">Code Generator backend info</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Expressions used by code generator to describe instructions and isel
patterns:</p>
@ -882,10 +889,10 @@ patterns:</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="backends">TableGen backends</a></div>
<h2><a name="backends">TableGen backends</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>TODO: How they work, how to write one. This section should not contain
details about any particular backend, except maybe -print-enums as an example.
@ -903,8 +910,8 @@ This should highlight the APIs in <tt>TableGen/Record.h</tt>.</p>
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-01-07 18:05:37 +0100 (Fri, 07 Jan 2011) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

View File

@ -7,9 +7,9 @@
</head>
<body>
<div class="doc_title">
<h1>
LLVM Testing Infrastructure Guide
</div>
</h1>
<ol>
<li><a href="#overview">Overview</a></li>
@ -52,10 +52,10 @@
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="overview">Overview</a></div>
<h2><a name="overview">Overview</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>This document is the reference manual for the LLVM testing infrastructure. It
documents the structure of the LLVM testing infrastructure, the tools needed to
@ -64,10 +64,10 @@ use it, and how to add and run tests.</p>
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="requirements">Requirements</a></div>
<h2><a name="requirements">Requirements</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>In order to use the LLVM testing infrastructure, you will need all of the
software required to build LLVM, as well
@ -76,10 +76,10 @@ as <a href="http://python.org">Python</a> 2.4 or later.</p>
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="org">LLVM testing infrastructure organization</a></div>
<h2><a name="org">LLVM testing infrastructure organization</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>The LLVM testing infrastructure contains two major categories of tests:
regression tests and whole programs. The regression tests are contained inside
@ -89,13 +89,11 @@ referred to as the "LLVM test suite" and are in the <tt>test-suite</tt> module
in subversion.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="regressiontests">Regression tests</a></div>
<h3><a name="regressiontests">Regression tests</a></h3>
<!-- _______________________________________________________________________ -->
<div class="doc_text">
<div>
<p>The regression tests are small pieces of code that test a specific feature of
LLVM or trigger a specific bug in LLVM. They are usually written in LLVM
@ -119,10 +117,10 @@ application or benchmark.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="testsuite">Test suite</a></div>
<h3><a name="testsuite">Test suite</a></h3>
<!-- _______________________________________________________________________ -->
<div class="doc_text">
<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
@ -144,11 +142,10 @@ generates code.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="debuginfotests">Debugging Information
tests</a></div>
<h3><a name="debuginfotests">Debugging Information tests</a></h3>
<!-- _______________________________________________________________________ -->
<div class="doc_text">
<div>
<p>The test suite contains tests to check quality of debugging information.
The test are written in C based languages or in LLVM assembly language. </p>
@ -160,11 +157,13 @@ test suite for more information . This test suite is located in the
</div>
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="quick">Quick start</a></div>
<h2><a name="quick">Quick start</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>The tests are located in two separate Subversion modules. The regressions
tests are in the main "llvm" module under the directory
@ -179,7 +178,8 @@ the <tt>test-suite</tt> directory will be automatically configured.
Alternatively, you can configure the <tt>test-suite</tt> module manually.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="quickregressiontests">Regression tests</a></div>
<h3><a name="quickregressiontests">Regression tests</a></h3>
<div>
<!-- _______________________________________________________________________ -->
<p>To run all of the LLVM regression tests, use master Makefile in
the <tt>llvm/test</tt> directory:</p>
@ -198,7 +198,7 @@ Alternatively, you can configure the <tt>test-suite</tt> module manually.</p>
</pre>
</div>
<p>If you have <a href="http://clang.llvm.org">Clang</a> checked out and built,
<p>If you have <a href="http://clang.llvm.org/">Clang</a> checked out and built,
you can run the LLVM and Clang tests simultaneously using:</p>
<p>or</p>
@ -239,10 +239,14 @@ script which is built as part of LLVM. For example, to run the
<p>For more information on using the 'lit' tool, see 'llvm-lit --help' or the
'lit' man page.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="quicktestsuite">Test suite</a></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>
@ -292,9 +296,10 @@ that subdirectory.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="quickdebuginfotests">Debugging Information
tests</a></div>
<h3><a name="quickdebuginfotests">Debugging Information tests</a></h3>
<div>
<!-- _______________________________________________________________________ -->
<div>
<p> To run debugging information tests simply checkout the tests inside
clang/test directory. </p>
@ -310,10 +315,14 @@ clang/test directory. </p>
</div>
</div>
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="rtstructure">Regression test structure</a></div>
<h2><a name="rtstructure">Regression test structure</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<div>
<p>The LLVM regression tests are driven by 'lit' and are located in
the <tt>llvm/test</tt> directory.
@ -335,12 +344,10 @@ clang/test directory. </p>
<li><tt>Verifier</tt>: tests the IR verifier.</li>
</ul>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="rtcustom">Writing new regression tests</a></div>
<h3><a name="rtcustom">Writing new regression tests</a></h3>
<!-- _______________________________________________________________________ -->
<div class="doc_text">
<div>
<p>The regression test structure is very simple, but does require some
information to be set. This information is gathered via <tt>configure</tt> and
is written to a file, <tt>lit.site.cfg</tt>
@ -492,10 +499,10 @@ negatives).</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="FileCheck">The FileCheck utility</a></div>
<h3><a name="FileCheck">The FileCheck utility</a></h3>
<!-- _______________________________________________________________________ -->
<div class="doc_text">
<div>
<p>A powerful feature of the RUN: lines is that it allows any arbitrary commands
to be executed as part of the test harness. While standard (portable) unix
@ -561,13 +568,12 @@ is a "subl" in between those labels. If it existed somewhere else in the file,
that would not count: "grep subl" matches if subl exists anywhere in the
file.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a
name="FileCheck-check-prefix">The FileCheck -check-prefix option</a></div>
<h4>
<a name="FileCheck-check-prefix">The FileCheck -check-prefix option</a>
</h4>
<div class="doc_text">
<div>
<p>The FileCheck -check-prefix option allows multiple test configurations to be
driven from one .ll file. This is useful in many circumstances, for example,
@ -598,10 +604,11 @@ both 32-bit and 64-bit code generation.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a
name="FileCheck-CHECK-NEXT">The "CHECK-NEXT:" directive</a></div>
<h4>
<a name="FileCheck-CHECK-NEXT">The "CHECK-NEXT:" directive</a>
</h4>
<div class="doc_text">
<div>
<p>Sometimes you want to match lines and would like to verify that matches
happen on exactly consecutive lines with no other lines in between them. In
@ -638,10 +645,11 @@ directive in a file.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a
name="FileCheck-CHECK-NOT">The "CHECK-NOT:" directive</a></div>
<h4>
<a name="FileCheck-CHECK-NOT">The "CHECK-NOT:" directive</a>
</h4>
<div class="doc_text">
<div>
<p>The CHECK-NOT: directive is used to verify that a string doesn't occur
between two matches (or the first match and the beginning of the file). For
@ -668,10 +676,11 @@ define i8 @coerce_offset0(i32 %V, i32* %P) {
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a
name="FileCheck-Matching">FileCheck Pattern Matching Syntax</a></div>
<h4>
<a name="FileCheck-Matching">FileCheck Pattern Matching Syntax</a>
</h4>
<div class="doc_text">
<div>
<p>The CHECK: and CHECK-NOT: directives both take a pattern to match. For most
uses of FileCheck, fixed string matching is perfectly sufficient. For some
@ -700,10 +709,11 @@ braces explicitly from the input, you can use something ugly like
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a
name="FileCheck-Variables">FileCheck Variables</a></div>
<h4>
<a name="FileCheck-Variables">FileCheck Variables</a>
</h4>
<div class="doc_text">
<div>
<p>It is often useful to match a pattern and then verify that it occurs again
later in the file. For codegen tests, this can be useful to allow any register,
@ -738,11 +748,12 @@ define two separate CHECK lines that match on the same line.
</div>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="rtvars">Variables and
substitutions</a></div>
<h3><a name="rtvars">Variables and substitutions</a></h3>
<!-- _______________________________________________________________________ -->
<div class="doc_text">
<div>
<p>With a RUN line there are a number of substitutions that are permitted. In
general, any Tcl variable that is available in the <tt>substitute</tt>
function (in <tt>test/lib/llvm.exp</tt>) can be substituted into a RUN line.
@ -835,9 +846,9 @@ substitutions</a></div>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="rtfeatures">Other Features</a></div>
<h3><a name="rtfeatures">Other Features</a></h3>
<!-- _______________________________________________________________________ -->
<div class="doc_text">
<div>
<p>To make RUN line writing easier, there are several shell scripts located
in the <tt>llvm/test/Scripts</tt> directory. This directory is in the PATH
when running tests, so you can just call these scripts using their name. For
@ -892,12 +903,13 @@ substitutions</a></div>
</div>
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="testsuitestructure">Test suite
Structure</a></div>
<h2><a name="testsuitestructure">Test suite Structure</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<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
@ -962,10 +974,10 @@ will help you separate benign warnings from actual test failures.</p>
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="testsuiterun">Running the test suite</a></div>
<h2><a name="testsuiterun">Running the test suite</a></h2>
<!--=========================================================================-->
<div class="doc_text">
<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
@ -1020,14 +1032,13 @@ test suite creates temporary files during execution.</p>
have the suite checked out and configured, you don't need to do it again (unless
the test code or configure script changes).</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection">
<a name="testsuiteexternal">Configuring External Tests</a></div>
<h3>
<a name="testsuiteexternal">Configuring External Tests</a>
</h3>
<!-- _______________________________________________________________________ -->
<div class="doc_text">
<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),
@ -1055,10 +1066,11 @@ the test code or configure script changes).</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection">
<a name="testsuitetests">Running different tests</a></div>
<h3>
<a name="testsuitetests">Running different tests</a>
</h3>
<!-- _______________________________________________________________________ -->
<div class="doc_text">
<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
@ -1078,10 +1090,11 @@ LLVM.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection">
<a name="testsuiteoutput">Generating test output</a></div>
<h3>
<a name="testsuiteoutput">Generating test output</a>
</h3>
<!-- _______________________________________________________________________ -->
<div class="doc_text">
<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
@ -1109,11 +1122,12 @@ LLVM.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection">
<a name="testsuitecustom">Writing custom tests for the test suite</a></div>
<h3>
<a name="testsuitecustom">Writing custom tests for the test suite</a>
</h3>
<!-- _______________________________________________________________________ -->
<div class="doc_text">
<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
@ -1179,6 +1193,8 @@ example reports that can do fancy stuff.</p>
</div>
</div>
<!-- *********************************************************************** -->
<hr>
@ -1189,8 +1205,8 @@ example reports that can do fancy stuff.</p>
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: 2011-02-15 10:23:02 +0100 (Tue, 15 Feb 2011) $
<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) $
</address>
</body>
</html>

View File

@ -5,7 +5,7 @@
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>
<div class="doc_title">Using The LLVM Libraries</div>
<h1>Using The LLVM Libraries</h1>
<ol>
<li><a href="#abstract">Abstract</a></li>
<li><a href="#introduction">Introduction</a></li>
@ -26,12 +26,12 @@
<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
if you use CMake, <a href="CMake.html#embedding">the CMake LLVM
guide</a>.</p>
<!-- ======================================================================= -->
<div class="doc_section"><a name="abstract">Abstract</a></div>
<div class="doc_text">
<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
@ -45,8 +45,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_section"> <a name="introduction">Introduction</a></div>
<div class="doc_text">
<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
@ -74,8 +74,8 @@
correct for your tool can sometimes be challenging.
</div>
<!-- ======================================================================= -->
<div class="doc_section"><a name="descriptions"></a>Library Descriptions</div>
<div class="doc_text">
<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>
@ -152,8 +152,8 @@
</div>
<!-- ======================================================================= -->
<div class="doc_section"><a name="dependencies"></a>Using llvm-config</div>
<div class="doc_text">
<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>.
@ -187,16 +187,16 @@
<!-- === This should be updated whenever new libraries are added, ===-->
<!-- === removed, or changed ===-->
<!-- =======NOTE: =========================================================-->
<h2>Dependency Relationships Of Libraries</h2>
<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"/>
<h2>Dependency Relationships Of Object Files</h2>
<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"/>
<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>
@ -280,8 +280,8 @@
<li>libLLVMSystem.a</li>
<li>libLLVMbzip2.a</li>
</ul></dd>
<dt><b>libLLVMSystem.a</b></dt><dd><ul>
</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>
@ -295,8 +295,8 @@
<li>libLLVMTarget.a</li>
<li>libLLVMipa.a</li>
</ul></dd>
<dt><b>libLLVMbzip2.a</b></dt><dd><ul>
</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>
@ -401,42 +401,46 @@
</div>
<!-- ======================================================================= -->
<div class="doc_section"><a name="rot">Linkage Rules Of Thumb</a></div>
<div class="doc_text">
<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>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="always">Always Link LLVMCore, LLVMSupport,
and LLVMSystem</a></div>
<div class="doc_text">
<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>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="onlyone">Never link both archive and
re-linked library</a></div>
<div class="doc_text">
<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>
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: 2010-09-17 02:30:52 +0200 (Fri, 17 Sep 2010) $ </div>
<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) $ </div>
</body>
</html>
<!-- vim: sw=2 ts=2 ai

View File

@ -9,9 +9,9 @@
<body>
<div class="doc_title">
<h1>
Writing an LLVM Compiler Backend
</div>
</h1>
<ol>
<li><a href="#intro">Introduction</a>
@ -61,12 +61,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="intro">Introduction</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
This document describes techniques for writing compiler backends that convert
@ -91,13 +91,11 @@ characteristics, such as a RISC instruction set and straightforward calling
conventions.
</p>
</div>
<div class="doc_subsection">
<h3>
<a name="Audience">Audience</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
The audience for this document is anyone who needs to write an LLVM backend to
@ -106,21 +104,21 @@ generate code for a specific hardware or software target.
</div>
<div class="doc_subsection">
<h3>
<a name="Prerequisite">Prerequisite Reading</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
These essential documents must be read before reading this document:
</p>
<ul>
<li><i><a href="http://www.llvm.org/docs/LangRef.html">LLVM Language Reference
<li><i><a href="LangRef.html">LLVM Language Reference
Manual</a></i> &mdash; a reference manual for the LLVM assembly language.</li>
<li><i><a href="http://www.llvm.org/docs/CodeGenerator.html">The LLVM
<li><i><a href="CodeGenerator.html">The LLVM
Target-Independent Code Generator</a></i> &mdash; a guide to the components
(classes and code generation algorithms) for translating the LLVM internal
representation into machine code for a specified target. Pay particular
@ -129,14 +127,14 @@ These essential documents must be read before reading this document:
Allocation, Prolog/Epilog Code Insertion, Late Machine Code Optimizations,
and Code Emission.</li>
<li><i><a href="http://www.llvm.org/docs/TableGenFundamentals.html">TableGen
<li><i><a href="TableGenFundamentals.html">TableGen
Fundamentals</a></i> &mdash;a document that describes the TableGen
(<tt>tblgen</tt>) application that manages domain-specific information to
support LLVM code generation. TableGen processes input from a target
description file (<tt>.td</tt> suffix) and generates C++ code that can be
used for code generation.</li>
<li><i><a href="http://www.llvm.org/docs/WritingAnLLVMPass.html">Writing an LLVM
<li><i><a href="WritingAnLLVMPass.html">Writing an LLVM
Pass</a></i> &mdash; The assembly printer is a <tt>FunctionPass</tt>, as are
several SelectionDAG processing steps.</li>
</ul>
@ -155,11 +153,11 @@ machine dependent features.
</div>
<div class="doc_subsection">
<h3>
<a name="Basic">Basic Steps</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
To write a compiler backend for LLVM that converts the LLVM IR to code for a
@ -220,17 +218,17 @@ that the class will need and which components will need to be subclassed.
</div>
<div class="doc_subsection">
<h3>
<a name="Preliminaries">Preliminaries</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
To actually create your compiler backend, you need to create and modify a few
files. The absolute minimum is discussed here. But to actually use the LLVM
target-independent code generator, you must perform the steps described in
the <a href="http://www.llvm.org/docs/CodeGenerator.html">LLVM
the <a href="CodeGenerator.html">LLVM
Target-Independent Code Generator</a> document.
</p>
@ -281,13 +279,15 @@ regenerate configure by running <tt>./autoconf/AutoRegen.sh</tt>.
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="TargetMachine">Target Machine</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="TargetMachine">Target Machine</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
<tt>LLVMTargetMachine</tt> is designed as a base class for targets implemented
@ -360,11 +360,6 @@ public:
</pre>
</div>
</div>
<div class="doc_text">
<ul>
<li><tt>getInstrInfo()</tt></li>
<li><tt>getRegisterInfo()</tt></li>
@ -398,10 +393,6 @@ SparcTargetMachine::SparcTargetMachine(const Module &amp;M, const std::string &a
</pre>
</div>
</div>
<div class="doc_text">
<p>Hyphens separate portions of the <tt>TargetDescription</tt> string.</p>
<ul>
@ -424,12 +415,12 @@ SparcTargetMachine::SparcTargetMachine(const Module &amp;M, const std::string &a
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="TargetRegistration">Target Registration</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
You must also register your target with the <tt>TargetRegistry</tt>, which is
@ -480,12 +471,12 @@ For more information, see
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="RegisterSet">Register Set and Register Classes</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
You should describe a concrete target-specific class that represents the
@ -514,14 +505,12 @@ input files and placed in <tt>XXXGenRegisterInfo.h.inc</tt> and
implementation of <tt>XXXRegisterInfo</tt> requires hand-coding.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="RegisterDef">Defining a Register</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
The <tt>XXXRegisterInfo.td</tt> file typically starts with register definitions
@ -700,11 +689,11 @@ fields of a register's TargetRegisterDesc.
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="RegisterClassDef">Defining a Register Class</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
The <tt>RegisterClass</tt> class (specified in <tt>Target.td</tt>) is used to
@ -894,12 +883,12 @@ namespace SP { // Register class instances
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="implementRegister">Implement a subclass of</a>
<a href="http://www.llvm.org/docs/CodeGenerator.html#targetregisterinfo">TargetRegisterInfo</a>
</div>
<a href="CodeGenerator.html#targetregisterinfo">TargetRegisterInfo</a>
</h3>
<div class="doc_text">
<div>
<p>
The final step is to hand code portions of <tt>XXXRegisterInfo</tt>, which
@ -933,13 +922,15 @@ implementation in <tt>SparcRegisterInfo.cpp</tt>:
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="InstructionSet">Instruction Set</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<h2>
<a name="InstructionSet">Instruction Set</a>
</h2>
<!-- *********************************************************************** -->
<div>
<p>
During the early stages of code generation, the LLVM IR code is converted to a
@ -1103,7 +1094,7 @@ The fifth parameter is a string that is used by the assembly printer and can be
left as an empty string until the assembly printer interface is implemented. The
sixth and final parameter is the pattern used to match the instruction during
the SelectionDAG Select Phase described in
(<a href="http://www.llvm.org/docs/CodeGenerator.html">The LLVM
(<a href="CodeGenerator.html">The LLVM
Target-Independent Code Generator</a>). This parameter is detailed in the next
section, <a href="#InstructionSelector">Instruction Selector</a>.
</p>
@ -1188,14 +1179,12 @@ correspond to the values in <tt>SparcInstrInfo.td</tt>. I.e.,
<tt>SPCC::ICC_NE = 9</tt>, <tt>SPCC::FCC_U = 23</tt> and so on.)
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="operandMapping">Instruction Operand Mapping</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
The code generator backend maps instruction operands to fields in the
@ -1283,12 +1272,12 @@ the <tt>rd</tt>, <tt>rs1</tt>, and <tt>rs2</tt> fields respectively.
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="implementInstr">Implement a subclass of </a>
<a href="http://www.llvm.org/docs/CodeGenerator.html#targetinstrinfo">TargetInstrInfo</a>
</div>
<a href="CodeGenerator.html#targetinstrinfo">TargetInstrInfo</a>
</h3>
<div class="doc_text">
<div>
<p>
The final step is to hand code portions of <tt>XXXInstrInfo</tt>, which
@ -1327,10 +1316,10 @@ implementation in <tt>SparcInstrInfo.cpp</tt>:
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="branchFolding">Branch Folding and If Conversion</a>
</div>
<div class="doc_text">
</h3>
<div>
<p>
Performance can be improved by combining instructions or by eliminating
@ -1485,13 +1474,15 @@ branch.
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="InstructionSelector">Instruction Selector</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="InstructionSelector">Instruction Selector</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
LLVM uses a <tt>SelectionDAG</tt> to represent LLVM IR instructions, and nodes
@ -1533,7 +1524,7 @@ selection pass into the queue of passes to run.
The LLVM static compiler (<tt>llc</tt>) is an excellent tool for visualizing the
contents of DAGs. To display the <tt>SelectionDAG</tt> before or after specific
processing phases, use the command line options for <tt>llc</tt>, described
at <a href="http://llvm.org/docs/CodeGenerator.html#selectiondag_process">
at <a href="CodeGenerator.html#selectiondag_process">
SelectionDAG Instruction Selection Process</a>.
</p>
@ -1642,14 +1633,12 @@ SDNode *Select_ISD_STORE(const SDValue &amp;N) {
</pre>
</div>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="LegalizePhase">The SelectionDAG Legalize Phase</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
The Legalize phase converts a DAG to use types and operations that are natively
@ -1716,14 +1705,12 @@ a <tt>LegalAction</tt> type enum value: <tt>Promote</tt>, <tt>Expand</tt>,
contains examples of all four <tt>LegalAction</tt> values.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="promote">Promote</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>
For an operation without native support for a given type, the specified type may
@ -1742,11 +1729,11 @@ setLoadExtAction(ISD::SEXTLOAD, MVT::i1, Promote);
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="expand">Expand</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>
For a type without native support, a value may need to be broken down further,
@ -1767,11 +1754,11 @@ setOperationAction(ISD::FCOS, MVT::f32, Expand);
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="custom">Custom</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>
For some operations, simple type promotion or operation expansion may be
@ -1833,11 +1820,11 @@ static SDValue LowerFP_TO_SINT(SDValue Op, SelectionDAG &amp;DAG) {
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="legal">Legal</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>
The <tt>Legal</tt> LegalizeAction enum value simply indicates that an
@ -1865,12 +1852,14 @@ if (TM.getSubtarget&lt;SparcSubtarget&gt;().isV9())
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="callingConventions">Calling Conventions</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="callingConventions">Calling Conventions</a>
</h3>
<div>
<p>
To support target-specific calling conventions, <tt>XXXGenCallingConv.td</tt>
@ -2015,13 +2004,15 @@ def RetCC_X86_32 : CallingConv&lt;[
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="assemblyPrinter">Assembly Printer</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="assemblyPrinter">Assembly Printer</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
During the code emission stage, the code generator may utilize an LLVM pass to
@ -2171,12 +2162,12 @@ output.
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="subtargetSupport">Subtarget Support</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Subtarget support is used to inform the code generation process of instruction
@ -2289,12 +2280,12 @@ XXXSubtarget::XXXSubtarget(const Module &amp;M, const std::string &amp;FS) {
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="jitSupport">JIT Support</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
The implementation of a target machine optionally includes a Just-In-Time (JIT)
@ -2333,14 +2324,12 @@ Both <tt>XXXJITInfo.cpp</tt> and <tt>XXXCodeEmitter.cpp</tt> must include the
that write data (in bytes, words, strings, etc.) to the output stream.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="mce">Machine Code Emitter</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
In <tt>XXXCodeEmitter.cpp</tt>, a target-specific of the <tt>Emitter</tt> class
@ -2478,11 +2467,11 @@ enum RelocationType {
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="targetJITInfo">Target JIT Info</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>
<tt>XXXJITInfo.cpp</tt> implements the JIT interfaces for target-specific
@ -2537,6 +2526,8 @@ with assembler.
</div>
</div>
<!-- *********************************************************************** -->
<hr>
@ -2547,9 +2538,9 @@ with assembler.
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
<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>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a>
<br>
Last modified: $Date: 2010-11-23 04:31:01 +0100 (Tue, 23 Nov 2010) $
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body>

View File

@ -8,9 +8,9 @@
</head>
<body>
<div class="doc_title">
<h1>
Writing an LLVM Pass
</div>
</h1>
<ol>
<li><a href="#introduction">Introduction - What is a pass?</a></li>
@ -121,12 +121,12 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="introduction">Introduction - What is a pass?</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The LLVM Pass Framework is an important part of the LLVM system, because LLVM
passes are where most of the interesting parts of the compiler exist. Passes
@ -156,12 +156,12 @@ more advanced features are discussed.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="quickstart">Quick Start - Writing hello world</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Here we describe how to write the "hello world" of passes. The "Hello" pass
is designed to simply print out the name of non-external functions that exist in
@ -169,14 +169,12 @@ the program being compiled. It does not modify the program at all, it just
inspects it. The source code and files for this pass are available in the LLVM
source tree in the <tt>lib/Transforms/Hello</tt> directory.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="makefile">Setting up the build environment</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>First, configure and build LLVM. This needs to be done directly inside the
LLVM source tree rather than in a separate objects directory.
@ -185,7 +183,7 @@ source tree in the <tt>lib/Transforms/Hello</tt> directory.</p>
<tt>lib/Transforms/Hello</tt>. Finally, you must set up a build script
(Makefile) that will compile the source code for the new pass. To do this,
copy the following into <tt>Makefile</tt>:</p>
<hr/>
<hr>
<div class="doc_code"><pre>
# Makefile for hello pass
@ -211,17 +209,20 @@ the <tt>opt</tt> or <tt>bugpoint</tt> tools via their <tt>-load</tt> options.
If your operating system uses a suffix other than .so (such as windows or
Mac OS/X), the appropriate extension will be used.</p>
<p>If you are used CMake to build LLVM, see
<a href="CMake.html#passdev">Developing an LLVM pass with CMake</a>.</p>
<p>Now that we have the build scripts set up, we just need to write the code for
the pass itself.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="basiccode">Basic code required</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Now that we have a way to compile our new pass, we just have to write it.
Start out with:</p>
@ -301,7 +302,7 @@ function.</p>
initialization value is not important.</p>
<div class="doc_code"><pre>
static RegisterPass<Hello> X("<i>hello</i>", "<i>Hello World Pass</i>",
static RegisterPass&lt;Hello&gt; X("<i>hello</i>", "<i>Hello World Pass</i>",
false /* Only looks at CFG */,
false /* Analysis Pass */);
} <i>// end of anonymous namespace</i>
@ -337,7 +338,7 @@ is supplied as fourth argument. </p>
};
char Hello::ID = 0;
static RegisterPass<Hello> X("hello", "Hello World Pass", false, false);
static RegisterPass&lt;Hello&gt; X("hello", "Hello World Pass", false, false);
}
</pre></div>
@ -353,11 +354,11 @@ them) to be useful.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="running">Running a pass with <tt>opt</tt></a>
</div>
</h3>
<div class="doc_text">
<div>
<p>Now that you have a brand new shiny shared object file, we can use the
<tt>opt</tt> command to run an LLVM program through your pass. Because you
@ -443,13 +444,15 @@ about some more details of how they work and how to use them.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="passtype">Pass classes and requirements</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="passtype">Pass classes and requirements</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>One of the first things that you should do when designing a new pass is to
decide what class you should subclass for your pass. The <a
@ -464,14 +467,12 @@ listed. This gives the LLVM Pass Infrastructure information necessary to
optimize how passes are run, so that the resultant compiler isn't unnecessarily
slow.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="ImmutablePass">The <tt>ImmutablePass</tt> class</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The most plain and boring type of pass is the "<tt><a
href="http://llvm.org/doxygen/classllvm_1_1ImmutablePass.html">ImmutablePass</a></tt>"
@ -490,11 +491,11 @@ invalidated, and are never "run".</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<h3>
<a name="ModulePass">The <tt>ModulePass</tt> class</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The "<tt><a
href="http://llvm.org/doxygen/classllvm_1_1ModulePass.html">ModulePass</a></tt>"
@ -516,14 +517,12 @@ DominatorTree for function definitions, not declarations.</p>
<tt>ModulePass</tt> and overload the <tt>runOnModule</tt> method with the
following signature:</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="runOnModule">The <tt>runOnModule</tt> method</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnModule(Module &amp;M) = 0;
@ -535,12 +534,14 @@ false otherwise.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="CallGraphSCCPass">The <tt>CallGraphSCCPass</tt> class</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="CallGraphSCCPass">The <tt>CallGraphSCCPass</tt> class</a>
</h3>
<div>
<p>The "<tt><a
href="http://llvm.org/doxygen/classllvm_1_1CallGraphSCCPass.html">CallGraphSCCPass</a></tt>"
@ -581,15 +582,14 @@ because it has to handle SCCs with more than one node in it. All of the virtual
methods described below should return true if they modified the program, or
false if they didn't.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="doInitialization_scc">The <tt>doInitialization(CallGraph &amp;)</tt>
method</a>
</div>
<h4>
<a name="doInitialization_scc">
The <tt>doInitialization(CallGraph &amp;)</tt> method
</a>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doInitialization(CallGraph &amp;CG);
@ -606,11 +606,11 @@ fast).</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="runOnSCC">The <tt>runOnSCC</tt> method</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnSCC(CallGraphSCC &amp;SCC) = 0;
@ -623,12 +623,13 @@ otherwise.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="doFinalization_scc">The <tt>doFinalization(CallGraph
&amp;)</tt> method</a>
</div>
<h4>
<a name="doFinalization_scc">
The <tt>doFinalization(CallGraph &amp;)</tt> method
</a>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doFinalization(CallGraph &amp;CG);
@ -641,12 +642,14 @@ program being compiled.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="FunctionPass">The <tt>FunctionPass</tt> class</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="FunctionPass">The <tt>FunctionPass</tt> class</a>
</h3>
<div>
<p>In contrast to <tt>ModulePass</tt> subclasses, <tt><a
href="http://llvm.org/doxygen/classllvm_1_1Pass.html">FunctionPass</a></tt>
@ -671,15 +674,14 @@ href="#basiccode">Hello World</a> pass for example). <tt>FunctionPass</tt>'s
may overload three virtual methods to do their work. All of these methods
should return true if they modified the program, or false if they didn't.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="doInitialization_mod">The <tt>doInitialization(Module &amp;)</tt>
method</a>
</div>
<h4>
<a name="doInitialization_mod">
The <tt>doInitialization(Module &amp;)</tt> method
</a>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doInitialization(Module &amp;M);
@ -703,11 +705,11 @@ free functions that it needs, adding prototypes to the module if necessary.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="runOnFunction">The <tt>runOnFunction</tt> method</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnFunction(Function &amp;F) = 0;
@ -720,12 +722,13 @@ be returned if the function is modified.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="doFinalization_mod">The <tt>doFinalization(Module
&amp;)</tt> method</a>
</div>
<h4>
<a name="doFinalization_mod">
The <tt>doFinalization(Module &amp;)</tt> method
</a>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doFinalization(Module &amp;M);
@ -738,12 +741,14 @@ program being compiled.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="LoopPass">The <tt>LoopPass</tt> class </a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="LoopPass">The <tt>LoopPass</tt> class </a>
</h3>
<div>
<p> All <tt>LoopPass</tt> execute on each loop in the function independent of
all of the other loops in the function. <tt>LoopPass</tt> processes loops in
@ -751,19 +756,18 @@ loop nest order such that outer most loop is processed last. </p>
<p> <tt>LoopPass</tt> subclasses are allowed to update loop nest using
<tt>LPPassManager</tt> interface. Implementing a loop pass is usually
straightforward. <tt>Looppass</tt>'s may overload three virtual methods to
straightforward. <tt>LoopPass</tt>'s may overload three virtual methods to
do their work. All these methods should return true if they modified the
program, or false if they didn't. </p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="doInitialization_loop">The <tt>doInitialization(Loop *,
LPPassManager &amp;)</tt>
method</a>
</div>
<h4>
<a name="doInitialization_loop">
The <tt>doInitialization(Loop *,LPPassManager &amp;)</tt> method
</a>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doInitialization(Loop *, LPPassManager &amp;LPM);
@ -780,11 +784,11 @@ information.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="runOnLoop">The <tt>runOnLoop</tt> method</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnLoop(Loop *, LPPassManager &amp;LPM) = 0;
@ -798,11 +802,11 @@ should be used to update loop nest.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="doFinalization_loop">The <tt>doFinalization()</tt> method</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doFinalization();
@ -815,12 +819,14 @@ program being compiled. </p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="RegionPass">The <tt>RegionPass</tt> class </a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="RegionPass">The <tt>RegionPass</tt> class </a>
</h3>
<div>
<p> <tt>RegionPass</tt> is similar to <a href="#LoopPass"><tt>LoopPass</tt></a>,
but executes on each single entry single exit region in the function.
@ -829,19 +835,18 @@ region is processed last. </p>
<p> <tt>RegionPass</tt> subclasses are allowed to update the region tree by using
the <tt>RGPassManager</tt> interface. You may overload three virtual methods of
<tt>RegionPass</tt> to implementing your own region pass is usually. All these
<tt>RegionPass</tt> to implement your own region pass. All these
methods should return true if they modified the program, or false if they didn not.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="doInitialization_region">The <tt>doInitialization(Region *,
RGPassManager &amp;)</tt>
method</a>
</div>
<h4>
<a name="doInitialization_region">
The <tt>doInitialization(Region *, RGPassManager &amp;)</tt> method
</a>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doInitialization(Region *, RGPassManager &amp;RGM);
@ -858,11 +863,11 @@ information.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="runOnRegion">The <tt>runOnRegion</tt> method</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnRegion(Region *, RGPassManager &amp;RGM) = 0;
@ -876,11 +881,11 @@ should be used to update region tree.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="doFinalization_region">The <tt>doFinalization()</tt> method</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doFinalization();
@ -893,14 +898,14 @@ program being compiled. </p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="BasicBlockPass">The <tt>BasicBlockPass</tt> class</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="BasicBlockPass">The <tt>BasicBlockPass</tt> class</a>
</h3>
<div>
<p><tt>BasicBlockPass</tt>'s are just like <a
href="#FunctionPass"><tt>FunctionPass</tt></a>'s, except that they must limit
@ -922,15 +927,14 @@ href="#doInitialization_mod"><tt>doInitialization(Module &amp;)</tt></a> and <a
href="#doFinalization_mod"><tt>doFinalization(Module &amp;)</tt></a> methods that <a
href="#FunctionPass"><tt>FunctionPass</tt></a>'s have, but also have the following virtual methods that may also be implemented:</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="doInitialization_fn">The <tt>doInitialization(Function
&amp;)</tt> method</a>
</div>
<h4>
<a name="doInitialization_fn">
The <tt>doInitialization(Function &amp;)</tt> method
</a>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doInitialization(Function &amp;F);
@ -947,11 +951,11 @@ fast).</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="runOnBasicBlock">The <tt>runOnBasicBlock</tt> method</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnBasicBlock(BasicBlock &amp;BB) = 0;
@ -965,12 +969,13 @@ if the basic block is modified.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="doFinalization_fn">The <tt>doFinalization(Function &amp;)</tt>
method</a>
</div>
<h4>
<a name="doFinalization_fn">
The <tt>doFinalization(Function &amp;)</tt> method
</a>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> doFinalization(Function &amp;F);
@ -984,12 +989,14 @@ finalization.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="MachineFunctionPass">The <tt>MachineFunctionPass</tt> class</a>
</div>
<div class="doc_text">
<!-- ======================================================================= -->
<h3>
<a name="MachineFunctionPass">The <tt>MachineFunctionPass</tt> class</a>
</h3>
<div>
<p>A <tt>MachineFunctionPass</tt> is a part of the LLVM code generator that
executes on the machine-dependent representation of each LLVM function in the
@ -1014,15 +1021,14 @@ href="#runOnMachineFunction"><tt>runOnMachineFunction</tt></a> (including global
data)</li>
</ol>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="runOnMachineFunction">The <tt>runOnMachineFunction(MachineFunction
&amp;MF)</tt> method</a>
</div>
<h4>
<a name="runOnMachineFunction">
The <tt>runOnMachineFunction(MachineFunction &amp;MF)</tt> method
</a>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual bool</b> runOnMachineFunction(MachineFunction &amp;MF) = 0;
@ -1043,13 +1049,17 @@ remember, you may not modify the LLVM <tt>Function</tt> or its contents from a
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="registration">Pass registration</a>
</div>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="registration">Pass registration</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>In the <a href="#basiccode">Hello World</a> example pass we illustrated how
pass registration works, and discussed some of the reasons that it is used and
@ -1066,14 +1076,12 @@ well as for debug output generated by the <tt>--debug-pass</tt> option.</p>
<p>If you want your pass to be easily dumpable, you should
implement the virtual <tt>print</tt> method:</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="print">The <tt>print</tt> method</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual void</b> print(std::ostream &amp;O, <b>const</b> Module *M) <b>const</b>;
@ -1093,13 +1101,15 @@ depended on.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="interaction">Specifying interactions between passes</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="interaction">Specifying interactions between passes</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>One of the main responsibilities of the <tt>PassManager</tt> is to make sure
that passes interact with each other correctly. Because <tt>PassManager</tt>
@ -1116,14 +1126,12 @@ specifies. If a pass does not implement the <tt><a
href="#getAnalysisUsage">getAnalysisUsage</a></tt> method, it defaults to not
having any prerequisite passes, and invalidating <b>all</b> other passes.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="getAnalysisUsage">The <tt>getAnalysisUsage</tt> method</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual void</b> getAnalysisUsage(AnalysisUsage &amp;Info) <b>const</b>;
@ -1139,11 +1147,14 @@ object:</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="AU::addRequired">The <tt>AnalysisUsage::addRequired&lt;&gt;</tt> and <tt>AnalysisUsage::addRequiredTransitive&lt;&gt;</tt> methods</a>
</div>
<h4>
<a name="AU::addRequired">
The <tt>AnalysisUsage::addRequired&lt;&gt;</tt>
and <tt>AnalysisUsage::addRequiredTransitive&lt;&gt;</tt> methods
</a>
</h4>
<div class="doc_text">
<div>
<p>
If your pass requires a previous pass to be executed (an analysis for example),
it can use one of these methods to arrange for it to be run before your pass.
@ -1165,11 +1176,13 @@ pass is.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="AU::addPreserved">The <tt>AnalysisUsage::addPreserved&lt;&gt;</tt> method</a>
</div>
<h4>
<a name="AU::addPreserved">
The <tt>AnalysisUsage::addPreserved&lt;&gt;</tt> method
</a>
</h4>
<div class="doc_text">
<div>
<p>
One of the jobs of the PassManager is to optimize how and when analyses are run.
In particular, it attempts to avoid recomputing data unless it needs to. For
@ -1200,22 +1213,13 @@ the fact that it hacks on the CFG.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="AU::examples">Example implementations of <tt>getAnalysisUsage</tt></a>
</div>
<h4>
<a name="AU::examples">
Example implementations of <tt>getAnalysisUsage</tt>
</a>
</h4>
<div class="doc_text">
<div class="doc_code"><pre>
<i>// This is an example implementation from an analysis, which does not modify
// the program at all, yet has a prerequisite.</i>
<b>void</b> <a href="http://llvm.org/doxygen/classllvm_1_1PostDominanceFrontier.html">PostDominanceFrontier</a>::getAnalysisUsage(AnalysisUsage &amp;AU) <b>const</b> {
AU.setPreservesAll();
AU.addRequired&lt;<a href="http://llvm.org/doxygen/classllvm_1_1PostDominatorTree.html">PostDominatorTree</a>&gt;();
}
</pre></div>
<p>and:</p>
<div>
<div class="doc_code"><pre>
<i>// This example modifies the program, but does not modify the CFG</i>
@ -1228,12 +1232,14 @@ the fact that it hacks on the CFG.
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="getAnalysis">The <tt>getAnalysis&lt;&gt;</tt> and
<tt>getAnalysisIfAvailable&lt;&gt;</tt> methods</a>
</div>
<h4>
<a name="getAnalysis">
The <tt>getAnalysis&lt;&gt;</tt> and
<tt>getAnalysisIfAvailable&lt;&gt;</tt> methods
</a>
</h4>
<div class="doc_text">
<div>
<p>The <tt>Pass::getAnalysis&lt;&gt;</tt> method is automatically inherited by
your class, providing you with access to the passes that you declared that you
@ -1285,13 +1291,15 @@ if it is active. For example:</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="analysisgroup">Implementing Analysis Groups</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="analysisgroup">Implementing Analysis Groups</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Now that we understand the basics of how passes are defined, how they are
used, and how they are required from other passes, it's time to get a little bit
@ -1310,14 +1318,12 @@ between these two extremes for other implementations). To cleanly support
situations like this, the LLVM Pass Infrastructure supports the notion of
Analysis Groups.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="agconcepts">Analysis Group Concepts</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>An Analysis Group is a single simple interface that may be implemented by
multiple different passes. Analysis Groups can be given human readable names
@ -1364,11 +1370,11 @@ hypothetical example) instead.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="registerag">Using <tt>RegisterAnalysisGroup</tt></a>
</div>
</h4>
<div class="doc_text">
<div>
<p>The <tt>RegisterAnalysisGroup</tt> template is used to register the analysis
group itself, while the <tt>INITIALIZE_AG_PASS</tt> is used to add pass
@ -1425,13 +1431,15 @@ pass is the default implementation for the interface.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="passStatistics">Pass Statistics</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="passStatistics">Pass Statistics</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The <a
href="http://llvm.org/doxygen/Statistic_8h-source.html"><tt>Statistic</tt></a>
class is designed to be an easy way to expose various success
@ -1443,12 +1451,12 @@ line. See the <a href="http://llvm.org/docs/ProgrammersManual.html#Statistic">St
<!-- *********************************************************************** -->
<div class="doc_section">
<h2>
<a name="passmanager">What PassManager does</a>
</div>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The <a
href="http://llvm.org/doxygen/PassManager_8h-source.html"><tt>PassManager</tt></a>
@ -1615,14 +1623,12 @@ Hello: main
<p>Which shows that we don't accidentally invalidate dominator information
anymore, and therefore do not have to compute it twice.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="releaseMemory">The <tt>releaseMemory</tt> method</a>
</div>
</h4>
<div class="doc_text">
<div>
<div class="doc_code"><pre>
<b>virtual void</b> releaseMemory();
@ -1643,13 +1649,15 @@ class, before the next call of <tt>run*</tt> in your pass.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="registering">Registering dynamically loaded passes</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="registering">Registering dynamically loaded passes</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p><i>Size matters</i> when constructing production quality tools using llvm,
both for the purposes of distribution, and for regulating the resident code size
@ -1676,14 +1684,12 @@ the static destructor <i>unregisters</i>. Thus a pass that is statically linked
in the tool will be registered at start up. A dynamically loaded pass will
register on load and unregister at unload.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection">
<h3>
<a name="registering_existing">Using existing registries</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>There are predefined registries to track instruction scheduling
(<tt>RegisterScheduler</tt>) and register allocation (<tt>RegisterRegAlloc</tt>)
@ -1744,11 +1750,11 @@ call line to <tt>llvm/Codegen/LinkAllCodegenComponents.h</tt>.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection">
<h3>
<a name="registering_new">Creating new registries</a>
</div>
</h3>
<div class="doc_text">
<div>
<p>The easiest way to get started is to clone one of the existing registries; we
recommend <tt>llvm/CodeGen/RegAllocRegistry.h</tt>. The key things to modify
@ -1776,13 +1782,15 @@ creator.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="debughints">Using GDB with dynamically loaded passes</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="debughints">Using GDB with dynamically loaded passes</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Unfortunately, using GDB with dynamically loaded passes is not as easy as it
should be. First of all, you can't set a breakpoint in a shared object that has
@ -1794,14 +1802,12 @@ GDB.</p>
transformation invoked by <tt>opt</tt>, although nothing described here depends
on that.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="breakpoint">Setting a breakpoint in your pass</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>First thing you do is start <tt>gdb</tt> on the <tt>opt</tt> process:</p>
@ -1842,11 +1848,11 @@ or do other standard debugging stuff.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="debugmisc">Miscellaneous Problems</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>Once you have the basics down, there are a couple of problems that GDB has,
some with solutions, some without.</p>
@ -1874,26 +1880,26 @@ href="mailto:sabre@nondot.org">Chris</a>.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="future">Future extensions planned</a>
</div>
<!-- *********************************************************************** -->
<h2>
<a name="future">Future extensions planned</a>
</h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Although the LLVM Pass Infrastructure is very capable as it stands, and does
some nifty stuff, there are things we'd like to add in the future. Here is
where we are going:</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<h4>
<a name="SMP">Multithreaded LLVM</a>
</div>
</h4>
<div class="doc_text">
<div>
<p>Multiple CPU machines are becoming more common and compilation can never be
fast enough: obviously we should allow for a multithreaded compiler. Because of
@ -1911,6 +1917,8 @@ Despite that, we have kept the LLVM passes SMP ready, and you should too.</p>
</div>
</div>
<!-- *********************************************************************** -->
<hr>
<address>
@ -1920,8 +1928,8 @@ Despite that, we have kept the LLVM passes SMP ready, and you should too.</p>
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-02-15 10:23:02 +0100 (Tue, 15 Feb 2011) $
<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) $
</address>
</body>

View File

@ -370,9 +370,39 @@ H2 {
H3 {
font-size: 100%;
}
H2, H3 {
border-bottom: 2px solid;
margin-top: 2em;
}
A.qindex {}
A.qindexRef {}
A.el { text-decoration: none; font-weight: bold }
A.elRef { font-weight: bold }
A.code { text-decoration: none; font-weight: normal; color: #4444ee }
A.codeRef { font-weight: normal; color: #4444ee }
div.memitem {
border: 1px solid #999999;
margin-top: 1.0em;
margin-bottom: 1.0em;
-webkit-border-radius: 0.5em;
-webkit-box-shadow: 3px 3px 6px #777777;
-moz-border-radius: 0.5em;
-moz-box-shadow: black 3px 3px 3px;
}
div.memproto {
background-color: #E3E4E5;
padding: 0.25em 0.5em;
-webkit-border-top-left-radius: 0.5em;
-webkit-border-top-right-radius: 0.5em;
-moz-border-radius-topleft: 0.5em;
-moz-border-radius-topright: 0.5em;
}
div.memdoc {
padding-left: 1em;
padding-right: 1em;
}

View File

@ -1,6 +1,6 @@
<hr>
<p class="footer">
Generated on $datetime for <a href="http://llvm.org">$projectname</a> by
Generated on $datetime for <a href="http://llvm.org/">$projectname</a> by
<a href="http://www.doxygen.org"><img src="doxygen.png" alt="Doxygen"
align="middle" border="0"/>$doxygenversion</a><br>
Copyright &copy; 2003-2009 University of Illinois at Urbana-Champaign.

View File

@ -7,13 +7,12 @@
</head>
<body>
<div class="doc_title">Documentation for the LLVM System at SVN head</div>
<h1>Documentation for the LLVM System at SVN head</h1>
<p class="doc_warning">If you are using a released version of LLVM,
see <a href="http://llvm.org/releases/">the download page</a> to find
your documentation.</p>
<div class="doc_text">
<table class="layout" width="95%"><tr class="layout"><td class="left">
<ul>
<li><a href="#llvmdesign">LLVM Design</a></li>
@ -32,14 +31,13 @@ your documentation.</p>
</p>
</form>
</td></tr></table>
</div>
<div class="doc_author">
<p>Written by <a href="http://llvm.org">The LLVM Team</a></p>
<p>Written by <a href="http://llvm.org/">The LLVM Team</a></p>
</div>
<!--=======================================================================-->
<div class="doc_section"><a name="llvmdesign">LLVM Design &amp; Overview</a></div>
<h2><a name="llvmdesign">LLVM Design &amp; Overview</a></h2>
<!--=======================================================================-->
<ul>
@ -57,7 +55,7 @@ frequent questions about LLVM's most frequently misunderstood instruction.</li>
</ul>
<!--=======================================================================-->
<div class="doc_section"><a name="userguide">LLVM User Guides</a></div>
<h2><a name="userguide">LLVM User Guides</a></h2>
<!--=======================================================================-->
<ul>
@ -75,7 +73,7 @@ LLVM for a custom language, and the facilities LLVM offers in tutorial form.</li
<li><a href="DeveloperPolicy.html">Developer Policy</a> - The LLVM project's
policy towards developers and their contributions.</li>
<li><a href="/docs/CommandGuide/index.html">LLVM Command Guide</a> - A reference
<li><a href="CommandGuide/index.html">LLVM Command Guide</a> - A reference
manual for the LLVM command line utilities ("man" pages for LLVM tools).<br>
Current tools:
<a href="/cmds/llvm-ar.html">llvm-ar</a>,
@ -131,7 +129,7 @@ href="irc://irc.oftc.net/llvm">join #llvm on irc.oftc.net</a> directly.</li>
<!--=======================================================================-->
<div class="doc_section"><a name="llvmprog">General LLVM Programming Documentation</a></div>
<h2><a name="llvmprog">General LLVM Programming Documentation</a></h2>
<!--=======================================================================-->
<ul>
@ -179,7 +177,7 @@ href="http://llvm.org/doxygen/inherits.html">classes</a>)
</ul>
<!--=======================================================================-->
<div class="doc_section"><a name="subsystems">LLVM Subsystem Documentation</a></div>
<h2><a name="subsystems">LLVM Subsystem Documentation</a></h2>
<!--=======================================================================-->
<ul>
@ -246,7 +244,7 @@ JITed code with GDB.</li>
<!--=======================================================================-->
<div class="doc_section"><a name="maillist">LLVM Mailing Lists</a></div>
<h2><a name="maillist">LLVM Mailing Lists</a></h2>
<!--=======================================================================-->
<ul>
@ -286,8 +284,8 @@ times each day, making it a high volume list.</li>
<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: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $
</address>
</body></html>

View File

@ -23,7 +23,7 @@ th { border: 2px solid gray; font-weight: bold; font-size: 105%;
* Documentation
*/
/* Common for title and header */
.doc_title, .doc_section, .doc_subsection, h1, h2 {
.doc_title, .doc_section, .doc_subsection, h1, h2, h3 {
color: black; background: url("img/lines.gif");
font-family: "Georgia,Palatino,Times,Roman,SanSerif"; font-weight: bold;
border-width: 1px;
@ -35,17 +35,17 @@ th { border: 2px solid gray; font-weight: bold; font-size: 105%;
padding-bottom: 2px
}
h1, .doc_section { text-align: center; font-size: 22pt;
h1, .doc_title, .title { text-align: left; font-size: 25pt }
h2, .doc_section { text-align: center; font-size: 22pt;
margin: 20pt 0pt 5pt 0pt; }
.doc_title, .title { text-align: left; font-size: 25pt }
h2, .doc_subsection { width: 75%;
h3, .doc_subsection { width: 75%;
text-align: left; font-size: 12pt;
padding: 4pt 4pt 4pt 4pt;
margin: 1.5em 0.5em 0.5em 0.5em }
h3, .doc_subsubsection { margin: 2.0em 0.5em 0.5em 0.5em;
h4, .doc_subsubsection { margin: 2.0em 0.5em 0.5em 0.5em;
font-weight: bold; font-style: oblique;
border-bottom: 1px solid #999999; font-size: 12pt;
width: 75%; }
@ -70,6 +70,10 @@ h3, .doc_subsubsection { margin: 2.0em 0.5em 0.5em 0.5em;
display: table;
}
h2+div, h2+p {text-align: left; padding-left: 20pt; padding-right: 10pt;}
h3+div, h3+p {text-align: left; padding-left: 20pt; padding-right: 10pt;}
h4+div, h4+p {text-align: left; padding-left: 20pt; padding-right: 10pt;}
/* It is preferrable to use <pre class="doc_code"> everywhere instead of the
* <div class="doc_code"><pre>...</ptr></div> construct.
*

View File

@ -11,7 +11,7 @@
<body>
<div class="doc_title">Kaleidoscope: Tutorial Introduction and the Lexer</div>
<h1>Kaleidoscope: Tutorial Introduction and the Lexer</h1>
<ul>
<li><a href="index.html">Up to Tutorial Index</a></li>
@ -30,10 +30,10 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro">Tutorial Introduction</a></div>
<h2><a name="intro">Tutorial Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to the "Implementing a language with LLVM" tutorial. This tutorial
runs through the implementation of a simple language, showing how fun and
@ -123,10 +123,10 @@ languages!</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="language">The Basic Language</a></div>
<h2><a name="language">The Basic Language</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This tutorial will be illustrated with a toy language that we'll call
"<a href="http://en.wikipedia.org/wiki/Kaleidoscope">Kaleidoscope</a>" (derived
@ -181,10 +181,10 @@ a Mandelbrot Set</a> at various levels of magnification.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="lexer">The Lexer</a></div>
<h2><a name="lexer">The Lexer</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>When it comes to implementing a language, the first thing needed is
the ability to process a text file and recognize what it says. The traditional
@ -341,8 +341,8 @@ so that you can use the lexer and parser together.
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
<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) $
</address>
</body>
</html>

View File

@ -11,7 +11,7 @@
<body>
<div class="doc_title">Kaleidoscope: Implementing a Parser and AST</div>
<h1>Kaleidoscope: Implementing a Parser and AST</h1>
<ul>
<li><a href="index.html">Up to Tutorial Index</a></li>
@ -36,10 +36,10 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro">Chapter 2 Introduction</a></div>
<h2><a name="intro">Chapter 2 Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to Chapter 2 of the "<a href="index.html">Implementing a language
with LLVM</a>" tutorial. This chapter shows you how to use the lexer, built in
@ -61,10 +61,10 @@ Tree.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="ast">The Abstract Syntax Tree (AST)</a></div>
<h2><a name="ast">The Abstract Syntax Tree (AST)</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The AST for a program captures its behavior in such a way that it is easy for
later stages of the compiler (e.g. code generation) to interpret. We basically
@ -178,10 +178,10 @@ bodies in Kaleidoscope.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="parserbasics">Parser Basics</a></div>
<h2><a name="parserbasics">Parser Basics</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Now that we have an AST to build, we need to define the parser code to build
it. The idea here is that we want to parse something like "x+y" (which is
@ -239,11 +239,10 @@ piece of our grammar: numeric literals.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="parserprimexprs">Basic Expression
Parsing</a></div>
<h2><a name="parserprimexprs">Basic Expression Parsing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>We start with numeric literals, because they are the simplest to process.
For each production in our grammar, we'll define a function which parses that
@ -394,11 +393,10 @@ They are a bit more complex.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="parserbinops">Binary Expression
Parsing</a></div>
<h2><a name="parserbinops">Binary Expression Parsing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Binary expressions are significantly harder to parse because they are often
ambiguous. For example, when given the string "x+y*z", the parser can choose
@ -617,10 +615,10 @@ handle function definitions, etc.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="parsertop">Parsing the Rest</a></div>
<h2><a name="parsertop">Parsing the Rest</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
The next thing missing is handling of function prototypes. In Kaleidoscope,
@ -714,10 +712,10 @@ actually <em>execute</em> this code we've built!</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="driver">The Driver</a></div>
<h2><a name="driver">The Driver</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The driver for this simply invokes all of the parsing pieces with a top-level
dispatch loop. There isn't much interesting here, so I'll just include the
@ -753,10 +751,10 @@ type "4+5;", and the parser will know you are done.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="conclusions">Conclusions</a></div>
<h2><a name="conclusions">Conclusions</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>With just under 400 lines of commented code (240 lines of non-comment,
non-blank code), we fully defined our minimal language, including a lexer,
@ -790,10 +788,10 @@ Representation (IR) from the AST.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="code">Full Code Listing</a></div>
<h2><a name="code">Full Code Listing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Here is the complete code listing for this and the previous chapter.
@ -1226,8 +1224,8 @@ int main() {
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
<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) $
</address>
</body>
</html>

View File

@ -11,7 +11,7 @@
<body>
<div class="doc_title">Kaleidoscope: Code generation to LLVM IR</div>
<h1>Kaleidoscope: Code generation to LLVM IR</h1>
<ul>
<li><a href="index.html">Up to Tutorial Index</a></li>
@ -34,10 +34,10 @@ Support</li>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro">Chapter 3 Introduction</a></div>
<h2><a name="intro">Chapter 3 Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to Chapter 3 of the "<a href="index.html">Implementing a language
with LLVM</a>" tutorial. This chapter shows you how to transform the <a
@ -57,10 +57,10 @@ releases page</a>.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="basics">Code Generation Setup</a></div>
<h2><a name="basics">Code Generation Setup</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
In order to generate LLVM IR, we want some simple setup to get started. First
@ -147,10 +147,10 @@ has already been done, and we'll just use it to emit code.
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="exprs">Expression Code Generation</a></div>
<h2><a name="exprs">Expression Code Generation</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Generating LLVM code for expression nodes is very straightforward: less
than 45 lines of commented code for all four of our expression nodes. First
@ -293,10 +293,10 @@ basic framework.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="funcs">Function Code Generation</a></div>
<h2><a name="funcs">Function Code Generation</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Code generation for prototypes and functions must handle a number of
details, which make their code less beautiful than expression code
@ -515,11 +515,10 @@ def bar() foo(1, 2); # error, unknown function "foo"
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="driver">Driver Changes and
Closing Thoughts</a></div>
<h2><a name="driver">Driver Changes and Closing Thoughts</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
For now, code generation to LLVM doesn't really get us much, except that we can
@ -657,10 +656,10 @@ support</a> to this so we can actually start running code!</p>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="code">Full Code Listing</a></div>
<h2><a name="code">Full Code Listing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Here is the complete code listing for our running example, enhanced with the
@ -1262,8 +1261,8 @@ int main() {
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2011-02-15 01:24:32 +0100 (Tue, 15 Feb 2011) $
<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) $
</address>
</body>
</html>

View File

@ -11,7 +11,7 @@
<body>
<div class="doc_title">Kaleidoscope: Adding JIT and Optimizer Support</div>
<h1>Kaleidoscope: Adding JIT and Optimizer Support</h1>
<ul>
<li><a href="index.html">Up to Tutorial Index</a></li>
@ -33,10 +33,10 @@ Flow</li>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro">Chapter 4 Introduction</a></div>
<h2><a name="intro">Chapter 4 Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to Chapter 4 of the "<a href="index.html">Implementing a language
with LLVM</a>" tutorial. Chapters 1-3 described the implementation of a simple
@ -48,11 +48,10 @@ for the Kaleidoscope language.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="trivialconstfold">Trivial Constant
Folding</a></div>
<h2><a name="trivialconstfold">Trivial Constant Folding</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Our demonstration for Chapter 3 is elegant and easy to extend. Unfortunately,
@ -134,11 +133,10 @@ range of optimizations that you can use, in the form of "passes".</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="optimizerpasses">LLVM Optimization
Passes</a></div>
<h2><a name="optimizerpasses">LLVM Optimization Passes</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>LLVM provides many optimization passes, which do many different sorts of
things and have different tradeoffs. Unlike other systems, LLVM doesn't hold
@ -266,10 +264,10 @@ executing it!</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="jit">Adding a JIT Compiler</a></div>
<h2><a name="jit">Adding a JIT Compiler</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Code that is available in LLVM IR can have a wide variety of tools
applied to it. For example, you can run optimizations on it (as we did above),
@ -474,10 +472,10 @@ tackling some interesting LLVM IR issues along the way.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="code">Full Code Listing</a></div>
<h2><a name="code">Full Code Listing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Here is the complete code listing for our running example, enhanced with the
@ -1078,7 +1076,7 @@ int main() {
// Create the JIT. This takes ownership of the module.
std::string ErrStr;
TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&amp;ErrStr).create();
if (!TheExecutionEngine) {
fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
exit(1);
@ -1130,8 +1128,8 @@ int main() {
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-11-16 18:28:22 +0100 (Tue, 16 Nov 2010) $
<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) $
</address>
</body>
</html>

View File

@ -11,7 +11,7 @@
<body>
<div class="doc_title">Kaleidoscope: Extending the Language: Control Flow</div>
<h1>Kaleidoscope: Extending the Language: Control Flow</h1>
<ul>
<li><a href="index.html">Up to Tutorial Index</a></li>
@ -48,10 +48,10 @@ User-defined Operators</li>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro">Chapter 5 Introduction</a></div>
<h2><a name="intro">Chapter 5 Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to Chapter 5 of the "<a href="index.html">Implementing a language
with LLVM</a>" tutorial. Parts 1-4 described the implementation of the simple
@ -65,14 +65,14 @@ have an if/then/else expression plus a simple 'for' loop.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="ifthen">If/Then/Else</a></div>
<h2><a name="ifthen">If/Then/Else</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Extending Kaleidoscope to support if/then/else is quite straightforward. It
basically requires adding lexer support for this "new" concept to the lexer,
basically requires adding support for this "new" concept to the lexer,
parser, AST, and LLVM code emitter. This example is nice, because it shows how
easy it is to "grow" a language over time, incrementally extending it as new
ideas are discovered.</p>
@ -108,15 +108,12 @@ Since Kaleidoscope allows side-effects, this behavior is important to nail down.
<p>Now that we know what we "want", lets break this down into its constituent
pieces.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="iflexer">Lexer Extensions for
If/Then/Else</a></div>
<h4><a name="iflexer">Lexer Extensions for If/Then/Else</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>The lexer extensions are straightforward. First we add new enum values
for the relevant tokens:</p>
@ -146,11 +143,10 @@ stuff:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="ifast">AST Extensions for
If/Then/Else</a></div>
<h4><a name="ifast">AST Extensions for If/Then/Else</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>To represent the new expression we add a new AST node for it:</p>
@ -172,11 +168,10 @@ public:
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="ifparser">Parser Extensions for
If/Then/Else</a></div>
<h4><a name="ifparser">Parser Extensions for If/Then/Else</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>Now that we have the relevant tokens coming from the lexer and we have the
AST node to build, our parsing logic is relatively straightforward. First we
@ -231,10 +226,10 @@ static ExprAST *ParsePrimary() {
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="ifir">LLVM IR for If/Then/Else</a></div>
<h4><a name="ifir">LLVM IR for If/Then/Else</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>Now that we have it parsing and building the AST, the final piece is adding
LLVM code generation support. This is the most interesting part of the
@ -347,11 +342,10 @@ directly.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="ifcodegen">Code Generation for
If/Then/Else</a></div>
<h4><a name="ifcodegen">Code Generation for If/Then/Else</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>In order to generate code for this, we implement the <tt>Codegen</tt> method
for <tt>IfExprAST</tt>:</p>
@ -472,7 +466,7 @@ are emitted, we can finish up with the merge code:</p>
// Emit merge block.
TheFunction->getBasicBlockList().push_back(MergeBB);
Builder.SetInsertPoint(MergeBB);
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()),
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2,
"iftmp");
PN->addIncoming(ThenV, ThenBB);
@ -500,11 +494,13 @@ another useful expression that is familiar from non-functional languages...</p>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="for">'for' Loop Expression</a></div>
<h2><a name="for">'for' Loop Expression</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Now that we know how to add basic control flow constructs to the language,
we have the tools to add more powerful things. Lets add something more
@ -533,14 +529,11 @@ variables, it will get more useful.</p>
<p>As before, lets talk about the changes that we need to Kaleidoscope to
support this.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="forlexer">Lexer Extensions for
the 'for' Loop</a></div>
<h4><a name="forlexer">Lexer Extensions for the 'for' Loop</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>The lexer extensions are the same sort of thing as for if/then/else:</p>
@ -566,11 +559,10 @@ the 'for' Loop</a></div>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="forast">AST Extensions for
the 'for' Loop</a></div>
<h4><a name="forast">AST Extensions for the 'for' Loop</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>The AST node is just as simple. It basically boils down to capturing
the variable name and the constituent expressions in the node.</p>
@ -593,11 +585,10 @@ public:
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="forparser">Parser Extensions for
the 'for' Loop</a></div>
<h4><a name="forparser">Parser Extensions for the 'for' Loop</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>The parser code is also fairly standard. The only interesting thing here is
handling of the optional step value. The parser code handles it by checking to
@ -653,11 +644,10 @@ static ExprAST *ParseForExpr() {
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="forir">LLVM IR for
the 'for' Loop</a></div>
<h4><a name="forir">LLVM IR for the 'for' Loop</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>Now we get to the good part: the LLVM IR we want to generate for this thing.
With the simple example above, we get this LLVM IR (note that this dump is
@ -699,11 +689,10 @@ expressions, and some basic blocks. Lets see how this fits together.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="forcodegen">Code Generation for
the 'for' Loop</a></div>
<h4><a name="forcodegen">Code Generation for the 'for' Loop</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>The first part of Codegen is very simple: we just output the start expression
for the loop value:</p>
@ -746,7 +735,7 @@ create an unconditional branch for the fall-through between the two blocks.</p>
Builder.SetInsertPoint(LoopBB);
// Start the PHI node with an entry for Start.
PHINode *Variable = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), VarName.c_str());
PHINode *Variable = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2, VarName.c_str());
Variable-&gt;addIncoming(StartVal, PreheaderBB);
</pre>
</div>
@ -876,11 +865,13 @@ language.</p>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="code">Full Code Listing</a></div>
<h2><a name="code">Full Code Listing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Here is the complete code listing for our running example, enhanced with the
@ -1452,7 +1443,7 @@ Value *IfExprAST::Codegen() {
// Emit merge block.
TheFunction-&gt;getBasicBlockList().push_back(MergeBB);
Builder.SetInsertPoint(MergeBB);
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()),
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2,
"iftmp");
PN-&gt;addIncoming(ThenV, ThenBB);
@ -1494,7 +1485,7 @@ Value *ForExprAST::Codegen() {
Builder.SetInsertPoint(LoopBB);
// Start the PHI node with an entry for Start.
PHINode *Variable = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), VarName.c_str());
PHINode *Variable = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2, VarName.c_str());
Variable-&gt;addIncoming(StartVal, PreheaderBB);
// Within the loop, the variable is defined equal to the PHI node. If it
@ -1721,7 +1712,7 @@ int main() {
// Create the JIT. This takes ownership of the module.
std::string ErrStr;
TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&amp;ErrStr).create();
if (!TheExecutionEngine) {
fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
exit(1);
@ -1773,8 +1764,8 @@ int main() {
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-11-16 18:28:22 +0100 (Tue, 16 Nov 2010) $
<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) $
</address>
</body>
</html>

View File

@ -11,7 +11,7 @@
<body>
<div class="doc_title">Kaleidoscope: Extending the Language: User-defined Operators</div>
<h1>Kaleidoscope: Extending the Language: User-defined Operators</h1>
<ul>
<li><a href="index.html">Up to Tutorial Index</a></li>
@ -34,10 +34,10 @@ Variables / SSA Construction</li>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro">Chapter 6 Introduction</a></div>
<h2><a name="intro">Chapter 6 Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to Chapter 6 of the "<a href="index.html">Implementing a language
with LLVM</a>" tutorial. At this point in our tutorial, we now have a fully
@ -60,10 +60,10 @@ an example of what you can build with Kaleidoscope and its feature set.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="idea">User-defined Operators: the Idea</a></div>
<h2><a name="idea">User-defined Operators: the Idea</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
The "operator overloading" that we will add to Kaleidoscope is more general than
@ -125,10 +125,10 @@ operators.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="binary">User-defined Binary Operators</a></div>
<h2><a name="binary">User-defined Binary Operators</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Adding support for user-defined binary operators is pretty simple with our
current framework. We'll first add support for the unary/binary keywords:</p>
@ -342,10 +342,10 @@ see what it takes.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="unary">User-defined Unary Operators</a></div>
<h2><a name="unary">User-defined Unary Operators</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Since we don't currently support unary operators in the Kaleidoscope
language, we'll need to add everything to support them. Above, we added simple
@ -491,10 +491,10 @@ is simpler primarily because it doesn't need to handle any predefined operators.
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="example">Kicking the Tires</a></div>
<h2><a name="example">Kicking the Tires</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>It is somewhat hard to believe, but with a few simple extensions we've
covered in the last chapters, we have grown a real-ish language. With this, we
@ -796,10 +796,10 @@ add variable mutation without building SSA in your front-end.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="code">Full Code Listing</a></div>
<h2><a name="code">Full Code Listing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Here is the complete code listing for our running example, enhanced with the
@ -1475,7 +1475,7 @@ Value *IfExprAST::Codegen() {
// Emit merge block.
TheFunction-&gt;getBasicBlockList().push_back(MergeBB);
Builder.SetInsertPoint(MergeBB);
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()),
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2,
"iftmp");
PN-&gt;addIncoming(ThenV, ThenBB);
@ -1517,7 +1517,7 @@ Value *ForExprAST::Codegen() {
Builder.SetInsertPoint(LoopBB);
// Start the PHI node with an entry for Start.
PHINode *Variable = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), VarName.c_str());
PHINode *Variable = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2, VarName.c_str());
Variable-&gt;addIncoming(StartVal, PreheaderBB);
// Within the loop, the variable is defined equal to the PHI node. If it
@ -1758,7 +1758,7 @@ int main() {
// Create the JIT. This takes ownership of the module.
std::string ErrStr;
TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&amp;ErrStr).create();
if (!TheExecutionEngine) {
fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
exit(1);
@ -1810,8 +1810,8 @@ int main() {
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-11-16 18:28:22 +0100 (Tue, 16 Nov 2010) $
<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) $
</address>
</body>
</html>

View File

@ -12,7 +12,7 @@
<body>
<div class="doc_title">Kaleidoscope: Extending the Language: Mutable Variables</div>
<h1>Kaleidoscope: Extending the Language: Mutable Variables</h1>
<ul>
<li><a href="index.html">Up to Tutorial Index</a></li>
@ -38,10 +38,10 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro">Chapter 7 Introduction</a></div>
<h2><a name="intro">Chapter 7 Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to Chapter 7 of the "<a href="index.html">Implementing a language
with LLVM</a>" tutorial. In chapters 1 through 6, we've built a very
@ -66,10 +66,10 @@ support for this, though the way it works is a bit unexpected for some.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="why">Why is this a hard problem?</a></div>
<h2><a name="why">Why is this a hard problem?</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
To understand why mutable variables cause complexities in SSA construction,
@ -140,10 +140,10 @@ logic.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="memory">Memory in LLVM</a></div>
<h2><a name="memory">Memory in LLVM</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The 'trick' here is that while LLVM does require all register values to be
in SSA form, it does not require (or permit) memory objects to be in SSA form.
@ -321,11 +321,10 @@ variables now!
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="kalvars">Mutable Variables in
Kaleidoscope</a></div>
<h2><a name="kalvars">Mutable Variables in Kaleidoscope</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Now that we know the sort of problem we want to tackle, lets see what this
looks like in the context of our little Kaleidoscope language. We're going to
@ -378,11 +377,10 @@ Kaleidoscope to support new variable definitions.
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="adjustments">Adjusting Existing Variables for
Mutation</a></div>
<h2><a name="adjustments">Adjusting Existing Variables for Mutation</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
The symbol table in Kaleidoscope is managed at code generation time by the
@ -648,10 +646,10 @@ we'll add the assignment operator.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="assignment">New Assignment Operator</a></div>
<h2><a name="assignment">New Assignment Operator</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>With our current framework, adding a new assignment operator is really
simple. We will parse it just like any other binary operator, but handle it
@ -745,11 +743,10 @@ add this next!
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="localvars">User-defined Local
Variables</a></div>
<h2><a name="localvars">User-defined Local Variables</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Adding var/in is just like any other other extensions we made to
Kaleidoscope: we extend the lexer, the parser, the AST and the code generator.
@ -979,10 +976,10 @@ anywhere in sight.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="code">Full Code Listing</a></div>
<h2><a name="code">Full Code Listing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Here is the complete code listing for our running example, enhanced with mutable
@ -1755,7 +1752,7 @@ Value *IfExprAST::Codegen() {
// Emit merge block.
TheFunction-&gt;getBasicBlockList().push_back(MergeBB);
Builder.SetInsertPoint(MergeBB);
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()),
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2,
"iftmp");
PN-&gt;addIncoming(ThenV, ThenBB);
@ -2160,8 +2157,8 @@ int main() {
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-11-16 18:28:22 +0100 (Tue, 16 Nov 2010) $
<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) $
</address>
</body>
</html>

View File

@ -11,8 +11,7 @@
<body>
<div class="doc_title">Kaleidoscope: Conclusion and other useful LLVM
tidbits</div>
<h1>Kaleidoscope: Conclusion and other useful LLVM tidbits</h1>
<ul>
<li><a href="index.html">Up to Tutorial Index</a></li>
@ -43,10 +42,10 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="conclusion">Tutorial Conclusion</a></div>
<h2><a name="conclusion">Tutorial Conclusion</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to the the final chapter of the "<a href="index.html">Implementing a
language with LLVM</a>" tutorial. In the course of this tutorial, we have grown
@ -154,23 +153,19 @@ are very useful if you want to take advantage of LLVM's capabilities.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="llvmirproperties">Properties of the LLVM
IR</a></div>
<h2><a name="llvmirproperties">Properties of the LLVM IR</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>We have a couple common questions about code in the LLVM IR form - lets just
get these out of the way right now, shall we?</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="targetindep">Target
Independence</a></div>
<h4><a name="targetindep">Target Independence</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>Kaleidoscope is an example of a "portable language": any program written in
Kaleidoscope will work the same way on any target that it runs on. Many other
@ -221,10 +216,10 @@ in-kernel language.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="safety">Safety Guarantees</a></div>
<h4><a name="safety">Safety Guarantees</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>Many of the languages above are also "safe" languages: it is impossible for
a program written in Java to corrupt its address space and crash the process
@ -243,11 +238,10 @@ list</a> if you are interested in more details.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="langspecific">Language-Specific
Optimizations</a></div>
<h4><a name="langspecific">Language-Specific Optimizations</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>One thing about LLVM that turns off many people is that it does not solve all
the world's problems in one system (sorry 'world hunger', someone else will have
@ -297,24 +291,23 @@ language-specific AST.
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="tipsandtricks">Tips and Tricks</a></div>
<h2><a name="tipsandtricks">Tips and Tricks</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>There is a variety of useful tips and tricks that you come to know after
working on/with LLVM that aren't obvious at first glance. Instead of letting
everyone rediscover them, this section talks about some of these issues.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="offsetofsizeof">Implementing portable
offsetof/sizeof</a></div>
<h4><a name="offsetofsizeof">Implementing portable offsetof/sizeof</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>One interesting thing that comes up, if you are trying to keep the code
generated by your compiler "target independent", is that you often need to know
@ -331,11 +324,10 @@ in a portable way.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="gcstack">Garbage Collected
Stack Frames</a></div>
<h4><a name="gcstack">Garbage Collected Stack Frames</a></h4>
<!-- ======================================================================= -->
<div class="doc_text">
<div>
<p>Some languages want to explicitly manage their stack frames, often so that
they are garbage collected or to allow easy implementation of closures. There
@ -349,6 +341,8 @@ Passing Style</a> and the use of tail calls (which LLVM also supports).</p>
</div>
</div>
<!-- *********************************************************************** -->
<hr>
<address>
@ -358,8 +352,8 @@ Passing Style</a> and the use of tail calls (which LLVM also supports).</p>
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
<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) $
</address>
</body>
</html>

View File

@ -12,7 +12,7 @@
<body>
<div class="doc_title">Kaleidoscope: Tutorial Introduction and the Lexer</div>
<h1>Kaleidoscope: Tutorial Introduction and the Lexer</h1>
<ul>
<li><a href="index.html">Up to Tutorial Index</a></li>
@ -35,10 +35,10 @@ AST</li>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro">Tutorial Introduction</a></div>
<h2><a name="intro">Tutorial Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to the "Implementing a language with LLVM" tutorial. This tutorial
runs through the implementation of a simple language, showing how fun and
@ -130,10 +130,10 @@ languages!</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="language">The Basic Language</a></div>
<h2><a name="language">The Basic Language</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>This tutorial will be illustrated with a toy language that we'll call
"<a href="http://en.wikipedia.org/wiki/Kaleidoscope">Kaleidoscope</a>" (derived
@ -188,10 +188,10 @@ a Mandelbrot Set</a> at various levels of magnification.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="lexer">The Lexer</a></div>
<h2><a name="lexer">The Lexer</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>When it comes to implementing a language, the first thing needed is
the ability to process a text file and recognize what it says. The traditional
@ -358,8 +358,8 @@ include a driver so that you can use the lexer and parser together.
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="mailto:idadesub@users.sourceforge.net">Erick Tryzelaar</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
<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) $
</address>
</body>
</html>

View File

@ -12,7 +12,7 @@
<body>
<div class="doc_title">Kaleidoscope: Implementing a Parser and AST</div>
<h1>Kaleidoscope: Implementing a Parser and AST</h1>
<ul>
<li><a href="index.html">Up to Tutorial Index</a></li>
@ -40,10 +40,10 @@
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro">Chapter 2 Introduction</a></div>
<h2><a name="intro">Chapter 2 Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to Chapter 2 of the "<a href="index.html">Implementing a language
with LLVM in Objective Caml</a>" tutorial. This chapter shows you how to use
@ -65,10 +65,10 @@ Tree.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="ast">The Abstract Syntax Tree (AST)</a></div>
<h2><a name="ast">The Abstract Syntax Tree (AST)</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The AST for a program captures its behavior in such a way that it is easy for
later stages of the compiler (e.g. code generation) to interpret. We basically
@ -146,10 +146,10 @@ bodies in Kaleidoscope.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="parserbasics">Parser Basics</a></div>
<h2><a name="parserbasics">Parser Basics</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Now that we have an AST to build, we need to define the parser code to build
it. The idea here is that we want to parse something like "x+y" (which is
@ -181,11 +181,10 @@ piece of our grammar: numeric literals.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="parserprimexprs">Basic Expression
Parsing</a></div>
<h2><a name="parserprimexprs">Basic Expression Parsing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>We start with numeric literals, because they are the simplest to process.
For each production in our grammar, we'll define a function which parses that
@ -303,11 +302,10 @@ They are a bit more complex.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="parserbinops">Binary Expression
Parsing</a></div>
<h2><a name="parserbinops">Binary Expression Parsing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Binary expressions are significantly harder to parse because they are often
ambiguous. For example, when given the string "x+y*z", the parser can choose
@ -517,10 +515,10 @@ handle function definitions, etc.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="parsertop">Parsing the Rest</a></div>
<h2><a name="parsertop">Parsing the Rest</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
The next thing missing is handling of function prototypes. In Kaleidoscope,
@ -596,10 +594,10 @@ actually <em>execute</em> this code we've built!</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="driver">The Driver</a></div>
<h2><a name="driver">The Driver</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>The driver for this simply invokes all of the parsing pieces with a top-level
dispatch loop. There isn't much interesting here, so I'll just include the
@ -652,10 +650,10 @@ type "4+5;", and the parser will know you are done.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="conclusions">Conclusions</a></div>
<h2><a name="conclusions">Conclusions</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>With just under 300 lines of commented code (240 lines of non-comment,
non-blank code), we fully defined our minimal language, including a lexer,
@ -689,10 +687,10 @@ Representation (IR) from the AST.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="code">Full Code Listing</a></div>
<h2><a name="code">Full Code Listing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Here is the complete code listing for this and the previous chapter.
@ -1038,8 +1036,8 @@ main ()
<a href="mailto:sabre@nondot.org">Chris Lattner</a>
<a href="mailto:erickt@users.sourceforge.net">Erick Tryzelaar</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-05-07 02:28:04 +0200 (Fri, 07 May 2010) $
<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) $
</address>
</body>
</html>

View File

@ -12,7 +12,7 @@
<body>
<div class="doc_title">Kaleidoscope: Code generation to LLVM IR</div>
<h1>Kaleidoscope: Code generation to LLVM IR</h1>
<ul>
<li><a href="index.html">Up to Tutorial Index</a></li>
@ -38,10 +38,10 @@ Support</li>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro">Chapter 3 Introduction</a></div>
<h2><a name="intro">Chapter 3 Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to Chapter 3 of the "<a href="index.html">Implementing a language
with LLVM</a>" tutorial. This chapter shows you how to transform the <a
@ -57,10 +57,10 @@ LLVM SVN to work. LLVM 2.2 and before will not work with it.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="basics">Code Generation Setup</a></div>
<h2><a name="basics">Code Generation Setup</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
In order to generate LLVM IR, we want some simple setup to get started. First
@ -128,10 +128,10 @@ that this has already been done, and we'll just use it to emit code.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="exprs">Expression Code Generation</a></div>
<h2><a name="exprs">Expression Code Generation</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Generating LLVM code for expression nodes is very straightforward: less
than 30 lines of commented code for all four of our expression nodes. First
@ -263,10 +263,10 @@ basic framework.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="funcs">Function Code Generation</a></div>
<h2><a name="funcs">Function Code Generation</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Code generation for prototypes and functions must handle a number of
details, which make their code less beautiful than expression code
@ -466,11 +466,10 @@ def bar() foo(1, 2); # error, unknown function "foo"
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="driver">Driver Changes and
Closing Thoughts</a></div>
<h2><a name="driver">Driver Changes and Closing Thoughts</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
For now, code generation to LLVM doesn't really get us much, except that we can
@ -607,10 +606,10 @@ support</a> to this so we can actually start running code!</p>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="code">Full Code Listing</a></div>
<h2><a name="code">Full Code Listing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Here is the complete code listing for our running example, enhanced with the
@ -1086,8 +1085,8 @@ main ()
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="mailto:idadesub@users.sourceforge.net">Erick Tryzelaar</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-05-28 19:07:41 +0200 (Fri, 28 May 2010) $
<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) $
</address>
</body>
</html>

View File

@ -12,7 +12,7 @@
<body>
<div class="doc_title">Kaleidoscope: Adding JIT and Optimizer Support</div>
<h1>Kaleidoscope: Adding JIT and Optimizer Support</h1>
<ul>
<li><a href="index.html">Up to Tutorial Index</a></li>
@ -37,10 +37,10 @@ Flow</li>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro">Chapter 4 Introduction</a></div>
<h2><a name="intro">Chapter 4 Introduction</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Welcome to Chapter 4 of the "<a href="index.html">Implementing a language
with LLVM</a>" tutorial. Chapters 1-3 described the implementation of a simple
@ -52,11 +52,10 @@ for the Kaleidoscope language.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="trivialconstfold">Trivial Constant
Folding</a></div>
<h2><a name="trivialconstfold">Trivial Constant Folding</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p><b>Note:</b> the default <tt>IRBuilder</tt> now always includes the constant
folding optimisations below.<p>
@ -148,11 +147,10 @@ range of optimizations that you can use, in the form of "passes".</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="optimizerpasses">LLVM Optimization
Passes</a></div>
<h2><a name="optimizerpasses">LLVM Optimization Passes</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>LLVM provides many optimization passes, which do many different sorts of
things and have different tradeoffs. Unlike other systems, LLVM doesn't hold
@ -283,10 +281,10 @@ executing it!</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="jit">Adding a JIT Compiler</a></div>
<h2><a name="jit">Adding a JIT Compiler</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>Code that is available in LLVM IR can have a wide variety of tools
applied to it. For example, you can run optimizations on it (as we did above),
@ -486,10 +484,10 @@ constructs</a>, tackling some interesting LLVM IR issues along the way.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="code">Full Code Listing</a></div>
<h2><a name="code">Full Code Listing</a></h2>
<!-- *********************************************************************** -->
<div class="doc_text">
<div>
<p>
Here is the complete code listing for our running example, enhanced with the
@ -1022,8 +1020,8 @@ extern double putchard(double X) {
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="mailto:idadesub@users.sourceforge.net">Erick Tryzelaar</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date: 2010-05-28 19:07:41 +0200 (Fri, 28 May 2010) $
<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) $
</address>
</body>
</html>

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