Compare commits
39 Commits
llvmorg-2.
...
llvmorg-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45d5bd27cb | ||
|
|
755a21f3ae | ||
|
|
688d4d27cf | ||
|
|
0df7b6319f | ||
|
|
5764e55d63 | ||
|
|
b5c059b832 | ||
|
|
bd43fcf5c5 | ||
|
|
1dc0dbf64d | ||
|
|
8c32fe0e61 | ||
|
|
2e406e7d52 | ||
|
|
1f6d36ff77 | ||
|
|
a5bea192e3 | ||
|
|
28c87da11f | ||
|
|
539eba2303 | ||
|
|
16c912d5f0 | ||
|
|
5e6d2c1282 | ||
|
|
ac864c0f53 | ||
|
|
35fb6225a6 | ||
|
|
b73b303f76 | ||
|
|
25c7375e28 | ||
|
|
9a8bae25b7 | ||
|
|
9eb9228a7b | ||
|
|
cbf56c683f | ||
|
|
407e88833c | ||
|
|
70c8b4ce40 | ||
|
|
9a3b80ebb8 | ||
|
|
d1e8ff86b5 | ||
|
|
05c9c7203d | ||
|
|
990c707d71 | ||
|
|
43195b190b | ||
|
|
d29e402cca | ||
|
|
02ac6f3362 | ||
|
|
ad4bf2f82b | ||
|
|
200b3953c2 | ||
|
|
e43c50a1a4 | ||
|
|
09489a21d9 | ||
|
|
1c81a16ffc | ||
|
|
357259b227 | ||
|
|
15fe03a879 |
10
llvm/.cvsignore
Normal file
10
llvm/.cvsignore
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
mklib
|
||||||
|
Makefile.config
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
cvs.out
|
||||||
|
autom4te.cache
|
||||||
|
configure.out
|
||||||
|
LLVM-*
|
||||||
|
_distcheckdir
|
||||||
|
llvm.spec
|
||||||
@@ -1,221 +0,0 @@
|
|||||||
project(LLVM)
|
|
||||||
cmake_minimum_required(VERSION 2.6.1)
|
|
||||||
|
|
||||||
set(PACKAGE_NAME llvm)
|
|
||||||
set(PACKAGE_VERSION 2.6svn)
|
|
||||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
|
||||||
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
|
|
||||||
|
|
||||||
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
|
|
||||||
message(FATAL_ERROR "In-source builds are not allowed.
|
|
||||||
CMake would overwrite the makefiles distributed with LLVM.
|
|
||||||
Please create a directory and run cmake from there, passing the path
|
|
||||||
to this source directory as the last argument.
|
|
||||||
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
|
|
||||||
Please delete them.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(FindPerl)
|
|
||||||
|
|
||||||
set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include)
|
|
||||||
set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin)
|
|
||||||
set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples)
|
|
||||||
|
|
||||||
set(LLVM_ALL_TARGETS
|
|
||||||
Alpha
|
|
||||||
ARM
|
|
||||||
CBackend
|
|
||||||
CellSPU
|
|
||||||
CppBackend
|
|
||||||
IA64
|
|
||||||
Mips
|
|
||||||
MSIL
|
|
||||||
PIC16
|
|
||||||
PowerPC
|
|
||||||
Sparc
|
|
||||||
X86
|
|
||||||
XCore
|
|
||||||
)
|
|
||||||
|
|
||||||
# List of targets whose asmprinters need to be forced to link
|
|
||||||
# into executables on some platforms (i.e. Windows):
|
|
||||||
set(LLVM_ASMPRINTERS_FORCE_LINK X86 PowerPC)
|
|
||||||
|
|
||||||
if( MSVC )
|
|
||||||
set(LLVM_TARGETS_TO_BUILD X86
|
|
||||||
CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
|
|
||||||
else( MSVC )
|
|
||||||
set(LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS}
|
|
||||||
CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
|
|
||||||
endif( MSVC )
|
|
||||||
|
|
||||||
option(LLVM_ENABLE_THREADS "Use threads if available." ON)
|
|
||||||
|
|
||||||
if( LLVM_TARGETS_TO_BUILD STREQUAL "all" )
|
|
||||||
set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
foreach(c ${LLVM_TARGETS_TO_BUILD})
|
|
||||||
list(FIND LLVM_ALL_TARGETS ${c} idx)
|
|
||||||
if( idx LESS 0 )
|
|
||||||
message(FATAL_ERROR "The target `${c}' does not exists.
|
|
||||||
It should be one of\n${LLVM_ALL_TARGETS}")
|
|
||||||
endif()
|
|
||||||
endforeach(c)
|
|
||||||
|
|
||||||
set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm)
|
|
||||||
|
|
||||||
# Add path for custom modules
|
|
||||||
set(CMAKE_MODULE_PATH
|
|
||||||
${CMAKE_MODULE_PATH}
|
|
||||||
"${LLVM_MAIN_SRC_DIR}/cmake"
|
|
||||||
"${LLVM_MAIN_SRC_DIR}/cmake/modules"
|
|
||||||
)
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
if(CYGWIN)
|
|
||||||
set(LLVM_ON_WIN32 0)
|
|
||||||
set(LLVM_ON_UNIX 1)
|
|
||||||
else(CYGWIN)
|
|
||||||
set(LLVM_ON_WIN32 1)
|
|
||||||
set(LLVM_ON_UNIX 0)
|
|
||||||
endif(CYGWIN)
|
|
||||||
set(LTDL_SHLIB_EXT ".dll")
|
|
||||||
set(EXEEXT ".exe")
|
|
||||||
# Maximum path length is 160 for non-unicode paths
|
|
||||||
set(MAXPATHLEN 160)
|
|
||||||
else(WIN32)
|
|
||||||
if(UNIX)
|
|
||||||
set(LLVM_ON_WIN32 0)
|
|
||||||
set(LLVM_ON_UNIX 1)
|
|
||||||
set(LTDL_SHLIB_EXT ".so")
|
|
||||||
set(EXEEXT "")
|
|
||||||
# FIXME: Maximum path length is currently set to 'safe' fixed value
|
|
||||||
set(MAXPATHLEN 2024)
|
|
||||||
else(UNIX)
|
|
||||||
MESSAGE(SEND_ERROR "Unable to determine platform")
|
|
||||||
endif(UNIX)
|
|
||||||
endif(WIN32)
|
|
||||||
|
|
||||||
if( EXISTS ${LLVM_TOOLS_BINARY_DIR}/llvm-config )
|
|
||||||
set(HAVE_LLVM_CONFIG 1)
|
|
||||||
endif( EXISTS ${LLVM_TOOLS_BINARY_DIR}/llvm-config )
|
|
||||||
|
|
||||||
include(config-ix)
|
|
||||||
|
|
||||||
option(LLVM_ENABLE_PIC "Build Position-Independent Code" OFF)
|
|
||||||
|
|
||||||
if( LLVM_ENABLE_PIC )
|
|
||||||
if( SUPPORTS_FPIC_FLAG )
|
|
||||||
message(STATUS "Building with -fPIC")
|
|
||||||
add_definitions(-fPIC)
|
|
||||||
else( SUPPORTS_FPIC_FLAG )
|
|
||||||
message(STATUS "Warning: -fPIC not supported.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} )
|
|
||||||
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
|
|
||||||
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
|
|
||||||
|
|
||||||
# set(CMAKE_VERBOSE_MAKEFILE true)
|
|
||||||
|
|
||||||
add_definitions( -D__STDC_LIMIT_MACROS )
|
|
||||||
add_definitions( -D__STDC_CONSTANT_MACROS )
|
|
||||||
|
|
||||||
set(LLVM_PLO_FLAGS "" CACHE
|
|
||||||
STRING "Flags for creating partially linked objects.")
|
|
||||||
|
|
||||||
if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
|
|
||||||
# TODO: support other platforms and toolchains.
|
|
||||||
option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
|
|
||||||
if( LLVM_BUILD_32_BITS )
|
|
||||||
message(STATUS "Building 32 bits executables and libraries.")
|
|
||||||
add_definitions( -m32 )
|
|
||||||
list(APPEND CMAKE_EXE_LINKER_FLAGS -m32)
|
|
||||||
list(APPEND CMAKE_SHARED_LINKER_FLAGS -m32)
|
|
||||||
set( LLVM_PLO_FLAGS -melf_i386 ${LLVM_PLO_FLAGS} )
|
|
||||||
endif( LLVM_BUILD_32_BITS )
|
|
||||||
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
|
|
||||||
|
|
||||||
if( MSVC )
|
|
||||||
add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS )
|
|
||||||
add_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS )
|
|
||||||
add_definitions( -D_SCL_SECURE_NO_DEPRECATE )
|
|
||||||
add_definitions( -wd4146 -wd4503 -wd4996 -wd4800 -wd4244 -wd4624 )
|
|
||||||
add_definitions( -wd4355 -wd4715 )
|
|
||||||
endif( MSVC )
|
|
||||||
|
|
||||||
include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR})
|
|
||||||
|
|
||||||
include(AddLLVM)
|
|
||||||
include(AddPartiallyLinkedObject)
|
|
||||||
include(TableGen)
|
|
||||||
|
|
||||||
add_subdirectory(lib/Support)
|
|
||||||
add_subdirectory(lib/System)
|
|
||||||
|
|
||||||
# Everything else depends on Support and System:
|
|
||||||
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} ${LLVM_LIBS} )
|
|
||||||
|
|
||||||
set(LLVM_TABLEGEN "tblgen" CACHE
|
|
||||||
STRING "Native TableGen executable. Saves building one when cross-compiling.")
|
|
||||||
|
|
||||||
add_subdirectory(utils/TableGen)
|
|
||||||
|
|
||||||
if( CMAKE_CROSSCOMPILING )
|
|
||||||
# This adds a dependency on target `tblgen', so must go after utils/TableGen
|
|
||||||
include( CrossCompileLLVM )
|
|
||||||
endif( CMAKE_CROSSCOMPILING )
|
|
||||||
|
|
||||||
add_subdirectory(include/llvm)
|
|
||||||
|
|
||||||
add_subdirectory(lib/VMCore)
|
|
||||||
add_subdirectory(lib/CodeGen)
|
|
||||||
add_subdirectory(lib/CodeGen/SelectionDAG)
|
|
||||||
add_subdirectory(lib/CodeGen/AsmPrinter)
|
|
||||||
add_subdirectory(lib/Bitcode/Reader)
|
|
||||||
add_subdirectory(lib/Bitcode/Writer)
|
|
||||||
add_subdirectory(lib/Transforms/Utils)
|
|
||||||
add_subdirectory(lib/Transforms/Instrumentation)
|
|
||||||
add_subdirectory(lib/Transforms/Scalar)
|
|
||||||
add_subdirectory(lib/Transforms/IPO)
|
|
||||||
add_subdirectory(lib/Transforms/Hello)
|
|
||||||
add_subdirectory(lib/Linker)
|
|
||||||
add_subdirectory(lib/Analysis)
|
|
||||||
add_subdirectory(lib/Analysis/IPA)
|
|
||||||
|
|
||||||
foreach(t ${LLVM_TARGETS_TO_BUILD})
|
|
||||||
message(STATUS "Targeting ${t}")
|
|
||||||
add_subdirectory(lib/Target/${t})
|
|
||||||
if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmPrinter/CMakeLists.txt )
|
|
||||||
add_subdirectory(lib/Target/${t}/AsmPrinter)
|
|
||||||
endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmPrinter/CMakeLists.txt )
|
|
||||||
endforeach(t)
|
|
||||||
|
|
||||||
add_subdirectory(lib/ExecutionEngine)
|
|
||||||
add_subdirectory(lib/ExecutionEngine/Interpreter)
|
|
||||||
add_subdirectory(lib/ExecutionEngine/JIT)
|
|
||||||
add_subdirectory(lib/Target)
|
|
||||||
add_subdirectory(lib/AsmParser)
|
|
||||||
add_subdirectory(lib/Debugger)
|
|
||||||
add_subdirectory(lib/Archive)
|
|
||||||
|
|
||||||
add_subdirectory(tools)
|
|
||||||
|
|
||||||
add_subdirectory(examples)
|
|
||||||
|
|
||||||
install(DIRECTORY include
|
|
||||||
DESTINATION .
|
|
||||||
PATTERN ".svn" EXCLUDE
|
|
||||||
PATTERN "*.cmake" EXCLUDE
|
|
||||||
PATTERN "*.in" EXCLUDE
|
|
||||||
)
|
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include
|
|
||||||
DESTINATION .
|
|
||||||
)
|
|
||||||
|
|
||||||
# TODO: make and install documentation.
|
|
||||||
@@ -15,8 +15,7 @@ D: The Sparc64 backend, provider of much wisdom, and motivator for LLVM
|
|||||||
|
|
||||||
N: Owen Anderson
|
N: Owen Anderson
|
||||||
E: resistor@mac.com
|
E: resistor@mac.com
|
||||||
D: LCSSA pass and related LoopUnswitch work
|
D: LCSSA pass and related LoopUnswitch work, TargetData refactoring, random improvements
|
||||||
D: GVNPRE pass, TargetData refactoring, random improvements
|
|
||||||
|
|
||||||
N: Henrik Bach
|
N: Henrik Bach
|
||||||
D: MingW Win32 API portability layer
|
D: MingW Win32 API portability layer
|
||||||
@@ -29,11 +28,6 @@ D: Target-independent code generator and analysis improvements
|
|||||||
N: Daniel Berlin
|
N: Daniel Berlin
|
||||||
E: dberlin@dberlin.org
|
E: dberlin@dberlin.org
|
||||||
D: ET-Forest implementation.
|
D: ET-Forest implementation.
|
||||||
D: Sparse bitmap
|
|
||||||
|
|
||||||
N: Neil Booth
|
|
||||||
E: neil@daikokuya.co.uk
|
|
||||||
D: APFloat implementation.
|
|
||||||
|
|
||||||
N: Misha Brukman
|
N: Misha Brukman
|
||||||
E: brukman+llvm@uiuc.edu
|
E: brukman+llvm@uiuc.edu
|
||||||
@@ -61,14 +55,6 @@ D: Register allocator improvements
|
|||||||
D: Loop optimizer improvements
|
D: Loop optimizer improvements
|
||||||
D: Target-independent code generator improvements
|
D: Target-independent code generator improvements
|
||||||
|
|
||||||
N: Dan Villiom Podlaski Christiansen
|
|
||||||
E: danchr@gmail.com
|
|
||||||
E: danchr@cs.au.dk
|
|
||||||
W: http://villiom.dk
|
|
||||||
D: LLVM Makefile improvements
|
|
||||||
D: Clang diagnostic & driver tweaks
|
|
||||||
S: Aarhus, Denmark
|
|
||||||
|
|
||||||
N: Jeff Cohen
|
N: Jeff Cohen
|
||||||
E: jeffc@jolt-lang.org
|
E: jeffc@jolt-lang.org
|
||||||
W: http://jolt-lang.org
|
W: http://jolt-lang.org
|
||||||
@@ -76,7 +62,7 @@ D: Native Win32 API portability layer
|
|||||||
|
|
||||||
N: John T. Criswell
|
N: John T. Criswell
|
||||||
E: criswell@uiuc.edu
|
E: criswell@uiuc.edu
|
||||||
D: Original Autoconf support, documentation improvements, bug fixes
|
D: Autoconf support, QMTest database, documentation improvements
|
||||||
|
|
||||||
N: Rafael Avila de Espindola
|
N: Rafael Avila de Espindola
|
||||||
E: rafael.espindola@gmail.com
|
E: rafael.espindola@gmail.com
|
||||||
@@ -105,37 +91,10 @@ N: Saem Ghani
|
|||||||
E: saemghani@gmail.com
|
E: saemghani@gmail.com
|
||||||
D: Callgraph class cleanups
|
D: Callgraph class cleanups
|
||||||
|
|
||||||
N: Mikhail Glushenkov
|
|
||||||
E: foldr@codedgers.com
|
|
||||||
D: Author of llvmc2
|
|
||||||
|
|
||||||
N: Dan Gohman
|
N: Dan Gohman
|
||||||
E: gohman@apple.com
|
E: djg@cray.com
|
||||||
D: Miscellaneous bug fixes
|
D: Miscellaneous bug fixes
|
||||||
|
|
||||||
N: David Greene
|
|
||||||
E: greened@obbligato.org
|
|
||||||
D: Miscellaneous bug fixes
|
|
||||||
D: Register allocation refactoring
|
|
||||||
|
|
||||||
N: Gabor Greif
|
|
||||||
E: ggreif@gmail.com
|
|
||||||
D: Improvements for space efficiency
|
|
||||||
|
|
||||||
N: Lang Hames
|
|
||||||
E: lhames@gmail.com
|
|
||||||
D: PBQP-based register allocator
|
|
||||||
|
|
||||||
N: Gordon Henriksen
|
|
||||||
E: gordonhenriksen@mac.com
|
|
||||||
D: Pluggable GC support
|
|
||||||
D: C interface
|
|
||||||
D: Ocaml bindings
|
|
||||||
|
|
||||||
N: Raul Fernandes Herbster
|
|
||||||
E: raul@dsc.ufcg.edu.br
|
|
||||||
D: JIT support for ARM
|
|
||||||
|
|
||||||
N: Paolo Invernizzi
|
N: Paolo Invernizzi
|
||||||
E: arathorn@fastwebnet.it
|
E: arathorn@fastwebnet.it
|
||||||
D: Visual C++ compatibility fixes
|
D: Visual C++ compatibility fixes
|
||||||
@@ -151,10 +110,6 @@ D: Support for packed types
|
|||||||
N: Dale Johannesen
|
N: Dale Johannesen
|
||||||
E: dalej@apple.com
|
E: dalej@apple.com
|
||||||
D: ARM constant islands improvements
|
D: ARM constant islands improvements
|
||||||
D: Tail merging improvements
|
|
||||||
D: Rewrite X87 back end
|
|
||||||
D: Use APFloat for floating point constants widely throughout compiler
|
|
||||||
D: Implement X87 long double
|
|
||||||
|
|
||||||
N: Eric Kidd
|
N: Eric Kidd
|
||||||
W: http://randomhacks.net/
|
W: http://randomhacks.net/
|
||||||
@@ -172,9 +127,7 @@ D: Author of the original C backend
|
|||||||
|
|
||||||
N: Christopher Lamb
|
N: Christopher Lamb
|
||||||
E: christopher.lamb@gmail.com
|
E: christopher.lamb@gmail.com
|
||||||
D: aligned load/store support, parts of noalias and restrict support
|
D: aligned load/store support
|
||||||
D: vreg subreg infrastructure, X86 codegen improvements based on subregs
|
|
||||||
D: address spaces
|
|
||||||
|
|
||||||
N: Jim Laskey
|
N: Jim Laskey
|
||||||
E: jlaskey@apple.com
|
E: jlaskey@apple.com
|
||||||
@@ -188,7 +141,7 @@ E: sabre@nondot.org
|
|||||||
W: http://nondot.org/~sabre/
|
W: http://nondot.org/~sabre/
|
||||||
D: Primary architect of LLVM
|
D: Primary architect of LLVM
|
||||||
|
|
||||||
N: Tanya Lattner (Tanya Brethour)
|
N: Tanya Lattner (formerly Tanya Brethour)
|
||||||
E: tonic@nondot.org
|
E: tonic@nondot.org
|
||||||
W: http://nondot.org/~tonic/
|
W: http://nondot.org/~tonic/
|
||||||
D: The initial llvm-ar tool, converted regression testsuite to dejagnu
|
D: The initial llvm-ar tool, converted regression testsuite to dejagnu
|
||||||
@@ -205,15 +158,10 @@ N: Nick Lewycky
|
|||||||
E: nicholas@mxc.ca
|
E: nicholas@mxc.ca
|
||||||
D: PredicateSimplifier pass
|
D: PredicateSimplifier pass
|
||||||
|
|
||||||
N: Bruno Cardoso Lopes
|
|
||||||
E: bruno.cardoso@gmail.com
|
|
||||||
W: http://www.brunocardoso.org
|
|
||||||
D: The Mips backend
|
|
||||||
|
|
||||||
N: Duraid Madina
|
N: Duraid Madina
|
||||||
E: duraid@octopus.com.au
|
E: duraid@octopus.com.au
|
||||||
W: http://kinoko.c.u-tokyo.ac.jp/~duraid/
|
W: http://kinoko.c.u-tokyo.ac.jp/~duraid/
|
||||||
D: IA64 backend, BigBlock register allocator
|
D: IA64 backend
|
||||||
|
|
||||||
N: Michael McCracken
|
N: Michael McCracken
|
||||||
E: michael.mccracken@gmail.com
|
E: michael.mccracken@gmail.com
|
||||||
@@ -223,23 +171,15 @@ N: Vladimir Merzliakov
|
|||||||
E: wanderer@rsu.ru
|
E: wanderer@rsu.ru
|
||||||
D: Test suite fixes for FreeBSD
|
D: Test suite fixes for FreeBSD
|
||||||
|
|
||||||
N: Scott Michel
|
|
||||||
E: scottm@aero.org
|
|
||||||
D: Added STI Cell SPU backend.
|
|
||||||
|
|
||||||
N: Morten Ofstad
|
N: Morten Ofstad
|
||||||
E: morten@hue.no
|
E: morten@hue.no
|
||||||
D: Visual C++ compatibility fixes
|
D: Visual C++ compatibility fixes
|
||||||
|
|
||||||
N: Richard Osborne
|
|
||||||
E: richard@xmos.com
|
|
||||||
D: XCore backend
|
|
||||||
|
|
||||||
N: Devang Patel
|
N: Devang Patel
|
||||||
E: dpatel@apple.com
|
E: dpatel@apple.com
|
||||||
D: LTO tool, PassManager rewrite, Loop Pass Manager, Loop Rotate
|
D: LTO tool, PassManager rewrite, Loop Pass Manager, Loop Rotate
|
||||||
D: GCC PCH Integration (llvm-gcc), llvm-gcc improvements
|
D: GCC PCH Integration (llvm-gcc), llvm-gcc improvements
|
||||||
D: Optimizer improvements, Loop Index Split
|
D: Optimizer improvements
|
||||||
|
|
||||||
N: Vladimir Prus
|
N: Vladimir Prus
|
||||||
W: http://vladimir_prus.blogspot.com
|
W: http://vladimir_prus.blogspot.com
|
||||||
@@ -252,16 +192,12 @@ D: MSIL backend
|
|||||||
|
|
||||||
N: Duncan Sands
|
N: Duncan Sands
|
||||||
E: baldrick@free.fr
|
E: baldrick@free.fr
|
||||||
D: Ada front-end, exception handling improvements
|
D: Ada front-end
|
||||||
|
|
||||||
N: Ruchira Sasanka
|
N: Ruchira Sasanka
|
||||||
E: sasanka@uiuc.edu
|
E: sasanka@uiuc.edu
|
||||||
D: Graph coloring register allocator for the Sparc64 backend
|
D: Graph coloring register allocator for the Sparc64 backend
|
||||||
|
|
||||||
N: Arnold Schwaighofer
|
|
||||||
E: arnold.schwaighofer@gmail.com
|
|
||||||
D: Tail call optimization for the x86 backend
|
|
||||||
|
|
||||||
N: Anand Shukla
|
N: Anand Shukla
|
||||||
E: ashukla@cs.uiuc.edu
|
E: ashukla@cs.uiuc.edu
|
||||||
D: The `paths' pass
|
D: The `paths' pass
|
||||||
@@ -269,7 +205,7 @@ D: The `paths' pass
|
|||||||
N: Reid Spencer
|
N: Reid Spencer
|
||||||
E: rspencer@reidspencer.com
|
E: rspencer@reidspencer.com
|
||||||
W: http://reidspencer.com/
|
W: http://reidspencer.com/
|
||||||
D: Lots of stuff, see: http://wiki.llvm.org/index.php/User:Reid
|
D: http://wiki.llvm.org/index.php/User:Reid
|
||||||
|
|
||||||
N: Adam Treat
|
N: Adam Treat
|
||||||
E: manyoso@yahoo.com
|
E: manyoso@yahoo.com
|
||||||
@@ -282,7 +218,5 @@ D: Thread Local Storage implementation
|
|||||||
|
|
||||||
N: Bill Wendling
|
N: Bill Wendling
|
||||||
E: isanbard@gmail.com
|
E: isanbard@gmail.com
|
||||||
D: Machine LICM
|
W: http://web.mac.com/bwendling/
|
||||||
D: Darwin exception handling
|
D: The `Lower Setjmp/Longjmp' pass, improvements to the -lowerswitch pass.
|
||||||
D: MMX & SSSE3 instructions
|
|
||||||
D: SPEC2006 support
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ LLVM Release License
|
|||||||
University of Illinois/NCSA
|
University of Illinois/NCSA
|
||||||
Open Source License
|
Open Source License
|
||||||
|
|
||||||
Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.
|
Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Developed by:
|
Developed by:
|
||||||
@@ -62,8 +62,8 @@ licenses, and/or restrictions:
|
|||||||
Program Directory
|
Program Directory
|
||||||
------- ---------
|
------- ---------
|
||||||
System Library llvm/lib/System
|
System Library llvm/lib/System
|
||||||
|
Compiler Driver llvm/tools/llvmc
|
||||||
Autoconf llvm/autoconf
|
Autoconf llvm/autoconf
|
||||||
llvm/projects/ModuleMaker/autoconf
|
llvm/projects/ModuleMaker/autoconf
|
||||||
llvm/projects/sample/autoconf
|
llvm/projects/sample/autoconf
|
||||||
CellSPU backend llvm/lib/Target/CellSPU/README.txt
|
GNU Libc llvm/runtime/GCCLibraries/libc
|
||||||
Google Test llvm/utils/unittest/googletest
|
|
||||||
|
|||||||
104
llvm/Makefile
104
llvm/Makefile
@@ -2,8 +2,8 @@
|
|||||||
#
|
#
|
||||||
# The LLVM Compiler Infrastructure
|
# The LLVM Compiler Infrastructure
|
||||||
#
|
#
|
||||||
# This file is distributed under the University of Illinois Open Source
|
# This file was developed by the LLVM research group and is distributed under
|
||||||
# License. See LICENSE.TXT for details.
|
# the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||||
#
|
#
|
||||||
#===------------------------------------------------------------------------===#
|
#===------------------------------------------------------------------------===#
|
||||||
|
|
||||||
@@ -17,18 +17,11 @@ LEVEL := .
|
|||||||
# 5. Build llvm-config, which determines inter-lib dependencies for tools.
|
# 5. Build llvm-config, which determines inter-lib dependencies for tools.
|
||||||
# 6. Build tools, runtime, docs.
|
# 6. Build tools, runtime, docs.
|
||||||
#
|
#
|
||||||
# When cross-compiling, there are some things (tablegen) that need to
|
DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
|
||||||
# be build for the build system first.
|
|
||||||
ifeq ($(BUILD_DIRS_ONLY),1)
|
|
||||||
DIRS := lib/System lib/Support utils
|
|
||||||
OPTIONAL_DIRS :=
|
|
||||||
else
|
|
||||||
DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
|
|
||||||
tools runtime docs
|
tools runtime docs
|
||||||
OPTIONAL_DIRS := examples projects bindings
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTRA_DIST := test unittests llvm.spec include win32 Xcode
|
OPTIONAL_DIRS := examples projects
|
||||||
|
EXTRA_DIST := test llvm.spec include win32 Xcode
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.config
|
include $(LEVEL)/Makefile.config
|
||||||
|
|
||||||
@@ -44,54 +37,16 @@ ifeq ($(MAKECMDGOALS),libs-only)
|
|||||||
OPTIONAL_DIRS :=
|
OPTIONAL_DIRS :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MAKECMDGOALS),install-libs)
|
|
||||||
DIRS := $(filter-out tools runtime docs, $(DIRS))
|
|
||||||
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(MAKECMDGOALS),tools-only)
|
ifeq ($(MAKECMDGOALS),tools-only)
|
||||||
DIRS := $(filter-out runtime docs, $(DIRS))
|
DIRS := $(filter-out runtime docs, $(DIRS))
|
||||||
OPTIONAL_DIRS :=
|
OPTIONAL_DIRS :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MAKECMDGOALS),install-clang)
|
|
||||||
DIRS := tools/clang/Driver tools/clang/lib/Headers tools/clang/tools/ccc
|
|
||||||
OPTIONAL_DIRS :=
|
|
||||||
NO_INSTALL = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(MAKECMDGOALS),clang-only)
|
|
||||||
DIRS := $(filter-out tools runtime docs, $(DIRS)) tools/clang
|
|
||||||
OPTIONAL_DIRS :=
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(MAKECMDGOALS),unittests)
|
|
||||||
DIRS := $(filter-out tools runtime docs, $(DIRS)) utils unittests
|
|
||||||
OPTIONAL_DIRS :=
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Don't install utils, examples, or projects they are only used to
|
# Don't install utils, examples, or projects they are only used to
|
||||||
# build LLVM.
|
# build LLVM.
|
||||||
ifeq ($(MAKECMDGOALS),install)
|
ifeq ($(MAKECMDGOALS),install)
|
||||||
DIRS := $(filter-out utils, $(DIRS))
|
DIRS := $(filter-out utils, $(DIRS))
|
||||||
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
|
OPTIONAL_DIRS :=
|
||||||
endif
|
|
||||||
|
|
||||||
# If we're cross-compiling, build the build-hosted tools first
|
|
||||||
ifeq ($(LLVM_CROSS_COMPILING),1)
|
|
||||||
all:: cross-compile-build-tools
|
|
||||||
|
|
||||||
clean::
|
|
||||||
$(Verb) rm -rf BuildTools
|
|
||||||
|
|
||||||
cross-compile-build-tools:
|
|
||||||
$(Verb) if [ ! -f BuildTools/Makefile ]; then \
|
|
||||||
$(MKDIR) BuildTools; \
|
|
||||||
cd BuildTools ; \
|
|
||||||
$(PROJ_SRC_DIR)/configure ; \
|
|
||||||
cd .. ; \
|
|
||||||
fi; \
|
|
||||||
($(MAKE) -C BuildTools BUILD_DIRS_ONLY=1 ) || exit 1;
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Include the main makefile machinery.
|
# Include the main makefile machinery.
|
||||||
@@ -117,18 +72,15 @@ debug-opt-prof:
|
|||||||
dist-hook::
|
dist-hook::
|
||||||
$(Echo) Eliminating files constructed by configure
|
$(Echo) Eliminating files constructed by configure
|
||||||
$(Verb) $(RM) -f \
|
$(Verb) $(RM) -f \
|
||||||
$(TopDistDir)/include/llvm/ADT/hash_map.h \
|
$(TopDistDir)/include/llvm/ADT/hash_map \
|
||||||
$(TopDistDir)/include/llvm/ADT/hash_set.h \
|
$(TopDistDir)/include/llvm/ADT/hash_set \
|
||||||
$(TopDistDir)/include/llvm/ADT/iterator.h \
|
$(TopDistDir)/include/llvm/ADT/iterator \
|
||||||
$(TopDistDir)/include/llvm/Config/config.h \
|
$(TopDistDir)/include/llvm/Config/config.h \
|
||||||
$(TopDistDir)/include/llvm/Support/DataTypes.h \
|
$(TopDistDir)/include/llvm/Support/DataTypes.h \
|
||||||
$(TopDistDir)/include/llvm/Support/ThreadSupport.h
|
$(TopDistDir)/include/llvm/Support/ThreadSupport.h
|
||||||
|
|
||||||
clang-only: all
|
|
||||||
tools-only: all
|
tools-only: all
|
||||||
libs-only: all
|
libs-only: all
|
||||||
install-clang: install
|
|
||||||
install-libs: install
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
# Make sure the generated headers are up-to-date. This must be kept in
|
# Make sure the generated headers are up-to-date. This must be kept in
|
||||||
@@ -137,9 +89,9 @@ install-libs: install
|
|||||||
FilesToConfig := \
|
FilesToConfig := \
|
||||||
include/llvm/Config/config.h \
|
include/llvm/Config/config.h \
|
||||||
include/llvm/Support/DataTypes.h \
|
include/llvm/Support/DataTypes.h \
|
||||||
include/llvm/ADT/hash_map.h \
|
include/llvm/ADT/hash_map \
|
||||||
include/llvm/ADT/hash_set.h \
|
include/llvm/ADT/hash_set \
|
||||||
include/llvm/ADT/iterator.h
|
include/llvm/ADT/iterator
|
||||||
FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
|
FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
|
||||||
|
|
||||||
all-local:: $(FilesToConfigPATH)
|
all-local:: $(FilesToConfigPATH)
|
||||||
@@ -150,15 +102,12 @@ $(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in
|
|||||||
|
|
||||||
# NOTE: This needs to remain as the last target definition in this file so
|
# NOTE: This needs to remain as the last target definition in this file so
|
||||||
# that it gets executed last.
|
# that it gets executed last.
|
||||||
ifneq ($(BUILD_DIRS_ONLY),1)
|
|
||||||
all::
|
all::
|
||||||
$(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
|
$(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
|
||||||
ifeq ($(BuildMode),Debug)
|
ifeq ($(BuildMode),Debug)
|
||||||
$(Echo) '*****' Note: Debug build can be 10 times slower than an
|
$(Echo) '*****' Note: Debug build can be 10 times slower than an
|
||||||
$(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
|
$(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
|
||||||
$(Echo) '*****' make an optimized build. Alternatively you can
|
$(Echo) '*****' make an optimized build.
|
||||||
$(Echo) '*****' configure with --enable-optimized.
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
check-llvm2cpp:
|
check-llvm2cpp:
|
||||||
@@ -179,29 +128,4 @@ show-footprint:
|
|||||||
$(Verb) du -sk $(ExmplDir)
|
$(Verb) du -sk $(ExmplDir)
|
||||||
$(Verb) du -sk $(ObjDir)
|
$(Verb) du -sk $(ObjDir)
|
||||||
|
|
||||||
build-for-llvm-top:
|
.PHONY: srpm rpm
|
||||||
$(Verb) if test ! -f ./config.status ; then \
|
|
||||||
./configure --prefix="$(LLVM_TOP)/install" \
|
|
||||||
--with-llvm-gcc="$(LLVM_TOP)/llvm-gcc" ; \
|
|
||||||
fi
|
|
||||||
$(Verb) $(MAKE) tools-only
|
|
||||||
|
|
||||||
SVN = svn
|
|
||||||
SVN-UPDATE-OPTIONS =
|
|
||||||
AWK = awk
|
|
||||||
SUB-SVN-DIRS = $(AWK) '/\?\ \ \ \ \ \ / {print $$2}' \
|
|
||||||
| LANG=C xargs $(SVN) info 2>/dev/null \
|
|
||||||
| $(AWK) '/Path:\ / {print $$2}'
|
|
||||||
|
|
||||||
update:
|
|
||||||
$(SVN) $(SVN-UPDATE-OPTIONS) update $(LLVM_SRC_ROOT)
|
|
||||||
@ $(SVN) status $(LLVM_SRC_ROOT) | $(SUB-SVN-DIRS) | xargs $(SVN) $(SVN-UPDATE-OPTIONS) update
|
|
||||||
|
|
||||||
happiness: update all check unittests
|
|
||||||
|
|
||||||
.PHONY: srpm rpm update happiness
|
|
||||||
|
|
||||||
# declare all targets at this level to be serial:
|
|
||||||
|
|
||||||
.NOTPARALLEL:
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
#
|
#
|
||||||
# The LLVM Compiler Infrastructure
|
# The LLVM Compiler Infrastructure
|
||||||
#
|
#
|
||||||
# This file is distributed under the University of Illinois Open Source
|
# This file was developed by the LLVM research group and is distributed under
|
||||||
# License. See LICENSE.TXT for details.
|
# the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||||
#
|
#
|
||||||
#===------------------------------------------------------------------------===#
|
#===------------------------------------------------------------------------===#
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
#
|
#
|
||||||
# The LLVM Compiler Infrastructure
|
# The LLVM Compiler Infrastructure
|
||||||
#
|
#
|
||||||
# This file is distributed under the University of Illinois Open Source
|
# This file was developed by the LLVM research group and is distributed under
|
||||||
# License. See LICENSE.TXT for details.
|
# the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||||
#
|
#
|
||||||
#===------------------------------------------------------------------------===#
|
#===------------------------------------------------------------------------===#
|
||||||
#
|
#
|
||||||
@@ -83,7 +83,7 @@ PROJ_docsdir := $(DESTDIR)$(PROJ_prefix)/docs/llvm
|
|||||||
PROJ_etcdir := $(DESTDIR)$(PROJ_prefix)/etc/llvm
|
PROJ_etcdir := $(DESTDIR)$(PROJ_prefix)/etc/llvm
|
||||||
PROJ_includedir := $(DESTDIR)$(PROJ_prefix)/include
|
PROJ_includedir := $(DESTDIR)$(PROJ_prefix)/include
|
||||||
PROJ_infodir := $(DESTDIR)$(PROJ_prefix)/info
|
PROJ_infodir := $(DESTDIR)$(PROJ_prefix)/info
|
||||||
PROJ_mandir := $(DESTDIR)$(PROJ_prefix)/share/man
|
PROJ_mandir := $(DESTDIR)$(PROJ_prefix)/man
|
||||||
|
|
||||||
# Determine if we're on a unix type operating system
|
# Determine if we're on a unix type operating system
|
||||||
LLVM_ON_UNIX:=@LLVM_ON_UNIX@
|
LLVM_ON_UNIX:=@LLVM_ON_UNIX@
|
||||||
@@ -102,14 +102,12 @@ LLVM_CROSS_COMPILING=@LLVM_CROSS_COMPILING@
|
|||||||
# tablegen call if we're cross-compiling).
|
# tablegen call if we're cross-compiling).
|
||||||
BUILD_EXEEXT=@BUILD_EXEEXT@
|
BUILD_EXEEXT=@BUILD_EXEEXT@
|
||||||
|
|
||||||
# Compilers for the build platflorm (mainly for tablegen
|
|
||||||
# call if we're cross-compiling).
|
|
||||||
BUILD_CC=@BUILD_CC@
|
|
||||||
BUILD_CXX=@BUILD_CXX@
|
|
||||||
|
|
||||||
# Target triple (cpu-vendor-os) for which we should generate code
|
# Target triple (cpu-vendor-os) for which we should generate code
|
||||||
TARGET_TRIPLE=@target@
|
TARGET_TRIPLE=@target@
|
||||||
|
|
||||||
|
# Targets that we should build
|
||||||
|
TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
|
||||||
|
|
||||||
# Extra options to compile LLVM with
|
# Extra options to compile LLVM with
|
||||||
EXTRA_OPTIONS=@EXTRA_OPTIONS@
|
EXTRA_OPTIONS=@EXTRA_OPTIONS@
|
||||||
|
|
||||||
@@ -154,13 +152,10 @@ PERL := @PERL@
|
|||||||
BZIP2 := @BZIP2@
|
BZIP2 := @BZIP2@
|
||||||
DOT := @DOT@
|
DOT := @DOT@
|
||||||
DOXYGEN := @DOXYGEN@
|
DOXYGEN := @DOXYGEN@
|
||||||
|
ETAGS := @ETAGS@
|
||||||
|
ETAGSFLAGS := @ETAGSFLAGS@
|
||||||
GROFF := @GROFF@
|
GROFF := @GROFF@
|
||||||
GZIP := @GZIP@
|
GZIP := @GZIP@
|
||||||
OCAMLC := @OCAMLC@
|
|
||||||
OCAMLOPT := @OCAMLOPT@
|
|
||||||
OCAMLDEP := @OCAMLDEP@
|
|
||||||
OCAMLDOC := @OCAMLDOC@
|
|
||||||
GAS := @GAS@
|
|
||||||
POD2HTML := @POD2HTML@
|
POD2HTML := @POD2HTML@
|
||||||
POD2MAN := @POD2MAN@
|
POD2MAN := @POD2MAN@
|
||||||
RUNTEST := @RUNTEST@
|
RUNTEST := @RUNTEST@
|
||||||
@@ -172,9 +167,6 @@ HAVE_PTHREAD := @HAVE_PTHREAD@
|
|||||||
|
|
||||||
LIBS := @LIBS@
|
LIBS := @LIBS@
|
||||||
|
|
||||||
# Targets that we should build
|
|
||||||
TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
|
|
||||||
|
|
||||||
# Path to location for LLVM C/C++ front-end. You can modify this if you
|
# Path to location for LLVM C/C++ front-end. You can modify this if you
|
||||||
# want to override the value set by configure.
|
# want to override the value set by configure.
|
||||||
LLVMGCCDIR := @LLVMGCCDIR@
|
LLVMGCCDIR := @LLVMGCCDIR@
|
||||||
@@ -217,11 +209,6 @@ OBJ_ROOT := .
|
|||||||
#DISABLE_ASSERTIONS = 1
|
#DISABLE_ASSERTIONS = 1
|
||||||
@DISABLE_ASSERTIONS@
|
@DISABLE_ASSERTIONS@
|
||||||
|
|
||||||
# When ENABLE_EXPENSIVE_CHECKS is enabled, builds of all of the LLVM
|
|
||||||
# code will include expensive checks, otherwise they are excluded.
|
|
||||||
#ENABLE_EXPENSIVE_CHECKS = 0
|
|
||||||
@ENABLE_EXPENSIVE_CHECKS@
|
|
||||||
|
|
||||||
# When DEBUG_RUNTIME is enabled, the runtime libraries will retain debug
|
# When DEBUG_RUNTIME is enabled, the runtime libraries will retain debug
|
||||||
# symbols.
|
# symbols.
|
||||||
#DEBUG_RUNTIME = 1
|
#DEBUG_RUNTIME = 1
|
||||||
@@ -240,9 +227,6 @@ ENABLE_THREADS := @ENABLE_THREADS@
|
|||||||
# Do we want to build with position independent code?
|
# Do we want to build with position independent code?
|
||||||
ENABLE_PIC := @ENABLE_PIC@
|
ENABLE_PIC := @ENABLE_PIC@
|
||||||
|
|
||||||
# Use -fvisibility-inlines-hidden?
|
|
||||||
ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
|
|
||||||
|
|
||||||
# This option tells the Makefiles to produce verbose output.
|
# This option tells the Makefiles to produce verbose output.
|
||||||
# It essentially prints the commands that make is executing
|
# It essentially prints the commands that make is executing
|
||||||
#VERBOSE = 1
|
#VERBOSE = 1
|
||||||
@@ -269,17 +253,3 @@ NOLINKALL := @NOLINKALL@
|
|||||||
# Get the value of HUGE_VAL_SANITY which will be either "yes" or "no" depending
|
# Get the value of HUGE_VAL_SANITY which will be either "yes" or "no" depending
|
||||||
# on the check.
|
# on the check.
|
||||||
HUGE_VAL_SANITY = @HUGE_VAL_SANITY@
|
HUGE_VAL_SANITY = @HUGE_VAL_SANITY@
|
||||||
|
|
||||||
# Bindings that we should build
|
|
||||||
BINDINGS_TO_BUILD := @BINDINGS_TO_BUILD@
|
|
||||||
ALL_BINDINGS := @ALL_BINDINGS@
|
|
||||||
OCAML_LIBDIR := @OCAML_LIBDIR@
|
|
||||||
|
|
||||||
# When compiling under Mingw/Cygwin, executables such as tblgen
|
|
||||||
# expect Windows paths, whereas the build system uses Unix paths.
|
|
||||||
# The function SYSPATH transforms Unix paths into Windows paths.
|
|
||||||
ifneq (,$(findstring -mno-cygwin, $(CXX)))
|
|
||||||
SYSPATH = $(shell echo $(1) | cygpath -m -f -)
|
|
||||||
else
|
|
||||||
SYSPATH = $(1)
|
|
||||||
endif
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
#
|
#
|
||||||
# The LLVM Compiler Infrastructure
|
# The LLVM Compiler Infrastructure
|
||||||
#
|
#
|
||||||
# This file is distributed under the University of Illinois Open Source
|
# This file was developed by the LLVM research group and is distributed under
|
||||||
# License. See LICENSE.TXT for details.
|
# the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||||
#
|
#
|
||||||
#===------------------------------------------------------------------------===#
|
#===------------------------------------------------------------------------===#
|
||||||
#
|
#
|
||||||
@@ -22,9 +22,9 @@
|
|||||||
RecursiveTargets := all clean clean-all install uninstall install-bytecode
|
RecursiveTargets := all clean clean-all install uninstall install-bytecode
|
||||||
LocalTargets := all-local clean-local clean-all-local check-local \
|
LocalTargets := all-local clean-local clean-all-local check-local \
|
||||||
install-local printvars uninstall-local \
|
install-local printvars uninstall-local \
|
||||||
install-bytecode-local unittests
|
install-bytecode-local
|
||||||
TopLevelTargets := check dist dist-check dist-clean dist-gzip dist-bzip2 \
|
TopLevelTargets := check dist dist-check dist-clean tags dist-gzip dist-bzip2 \
|
||||||
dist-zip unittests
|
dist-zip
|
||||||
UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
|
UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
|
||||||
InternalTargets := preconditions distdir dist-hook
|
InternalTargets := preconditions distdir dist-hook
|
||||||
|
|
||||||
@@ -38,10 +38,10 @@ InternalTargets := preconditions distdir dist-hook
|
|||||||
VPATH=$(PROJ_SRC_DIR)
|
VPATH=$(PROJ_SRC_DIR)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Reset the list of suffixes we know how to build.
|
# Reset the list of suffixes we know how to build
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .c .cpp .cc .h .hpp .lo .o .a .bc .td .ps .dot .ll
|
.SUFFIXES: .c .cpp .cc .h .hpp .y .l .lo .o .a .bc .td .ps .dot .ll
|
||||||
.SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
|
.SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@@ -159,7 +159,7 @@ endif
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
|
ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
|
||||||
|
|
||||||
Makefile: $(PROJ_SRC_DIR)/Makefile $(ExtraMakefiles)
|
Makefile: $(PROJ_SRC_DIR)/Makefile
|
||||||
$(Echo) "Updating Makefile"
|
$(Echo) "Updating Makefile"
|
||||||
$(Verb) $(MKDIR) $(@D)
|
$(Verb) $(MKDIR) $(@D)
|
||||||
$(Verb) $(CP) -f $< $@
|
$(Verb) $(CP) -f $< $@
|
||||||
@@ -171,7 +171,7 @@ $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_SRC_DIR)/Makefile%
|
|||||||
@case '$?' in \
|
@case '$?' in \
|
||||||
*Makefile.rules) ;; \
|
*Makefile.rules) ;; \
|
||||||
*.in) ;; \
|
*.in) ;; \
|
||||||
*) $(EchoCmd) "Updating $(@F)" ; \
|
*) $(Echo) "Updating $(@F)" ; \
|
||||||
$(MKDIR) $(@D) ; \
|
$(MKDIR) $(@D) ; \
|
||||||
$(CP) -f $< $@ ;; \
|
$(CP) -f $< $@ ;; \
|
||||||
esac
|
esac
|
||||||
@@ -195,16 +195,10 @@ install-bytecode:: install-bytecode-local
|
|||||||
# VARIABLES: Set up various variables based on configuration data
|
# VARIABLES: Set up various variables based on configuration data
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# Variable for if this make is for a "cleaning" target
|
|
||||||
ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),)
|
|
||||||
IS_CLEANING_TARGET=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Variables derived from configuration we are building
|
# Variables derived from configuration we are building
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
CPP.Defines :=
|
|
||||||
# OPTIMIZE_OPTION - The optimization level option we want to build LLVM with
|
# OPTIMIZE_OPTION - The optimization level option we want to build LLVM with
|
||||||
# this can be overridden on the make command line.
|
# this can be overridden on the make command line.
|
||||||
ifneq ($(OS),MingW)
|
ifneq ($(OS),MingW)
|
||||||
@@ -215,10 +209,9 @@ endif
|
|||||||
|
|
||||||
ifdef ENABLE_PROFILING
|
ifdef ENABLE_PROFILING
|
||||||
BuildMode := Profile
|
BuildMode := Profile
|
||||||
CXX.Flags += $(OPTIMIZE_OPTION) -pg -g
|
CXX.Flags := $(OPTIMIZE_OPTION) -pg -g
|
||||||
C.Flags += $(OPTIMIZE_OPTION) -pg -g
|
C.Flags := $(OPTIMIZE_OPTION) -pg -g
|
||||||
LD.Flags += $(OPTIMIZE_OPTION) -pg -g
|
LD.Flags := $(OPTIMIZE_OPTION) -pg -g
|
||||||
KEEP_SYMBOLS := 1
|
|
||||||
else
|
else
|
||||||
ifeq ($(ENABLE_OPTIMIZED),1)
|
ifeq ($(ENABLE_OPTIMIZED),1)
|
||||||
BuildMode := Release
|
BuildMode := Release
|
||||||
@@ -231,25 +224,21 @@ else
|
|||||||
|
|
||||||
# Darwin requires -fstrict-aliasing to be explicitly enabled.
|
# Darwin requires -fstrict-aliasing to be explicitly enabled.
|
||||||
ifeq ($(OS),Darwin)
|
ifeq ($(OS),Darwin)
|
||||||
EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing
|
EXTRA_OPTIONS += -fstrict-aliasing
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
|
CXX.Flags := $(OPTIMIZE_OPTION) $(OmitFramePointer)
|
||||||
C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
|
C.Flags := $(OPTIMIZE_OPTION) $(OmitFramePointer)
|
||||||
LD.Flags += $(OPTIMIZE_OPTION)
|
LD.Flags := $(OPTIMIZE_OPTION)
|
||||||
else
|
else
|
||||||
BuildMode := Debug
|
BuildMode := Debug
|
||||||
CXX.Flags += -g
|
CXX.Flags := -g
|
||||||
C.Flags += -g
|
C.Flags := -g
|
||||||
LD.Flags += -g
|
LD.Flags := -g
|
||||||
KEEP_SYMBOLS := 1
|
KEEP_SYMBOLS := 1
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
|
|
||||||
# CXX.Flags += -fvisibility-inlines-hidden
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# IF REQUIRES_EH=1 is specified then don't disable exceptions
|
# IF REQUIRES_EH=1 is specified then don't disable exceptions
|
||||||
ifndef REQUIRES_EH
|
ifndef REQUIRES_EH
|
||||||
CXX.Flags += -fno-exceptions
|
CXX.Flags += -fno-exceptions
|
||||||
@@ -264,17 +253,11 @@ endif
|
|||||||
# then disable assertions by defining the appropriate preprocessor symbols.
|
# then disable assertions by defining the appropriate preprocessor symbols.
|
||||||
ifdef DISABLE_ASSERTIONS
|
ifdef DISABLE_ASSERTIONS
|
||||||
BuildMode := $(BuildMode)-Asserts
|
BuildMode := $(BuildMode)-Asserts
|
||||||
CPP.Defines += -DNDEBUG
|
CXX.Flags += -DNDEBUG
|
||||||
|
C.Flags += -DNDEBUG
|
||||||
else
|
else
|
||||||
CPP.Defines += -D_DEBUG
|
CXX.Flags += -D_DEBUG
|
||||||
endif
|
C.Flags += -D_DEBUG
|
||||||
|
|
||||||
# If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
|
|
||||||
# configured), then enable expensive checks by defining the
|
|
||||||
# appropriate preprocessor symbols.
|
|
||||||
ifdef ENABLE_EXPENSIVE_CHECKS
|
|
||||||
BuildMode := $(BuildMode)+Checks
|
|
||||||
CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ENABLE_PIC),1)
|
ifeq ($(ENABLE_PIC),1)
|
||||||
@@ -284,8 +267,7 @@ endif
|
|||||||
|
|
||||||
CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual
|
CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual
|
||||||
C.Flags += $(CFLAGS)
|
C.Flags += $(CFLAGS)
|
||||||
CPP.Defines += $(CPPFLAGS)
|
CPP.BaseFlags += $(CPPFLAGS)
|
||||||
CPP.BaseFlags += $(CPP.Defines)
|
|
||||||
LD.Flags += $(LDFLAGS)
|
LD.Flags += $(LDFLAGS)
|
||||||
AR.Flags := cru
|
AR.Flags := cru
|
||||||
LibTool.Flags := --tag=CXX
|
LibTool.Flags := --tag=CXX
|
||||||
@@ -307,13 +289,7 @@ endif
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Directory locations
|
# Directory locations
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
TargetMode :=
|
ObjDir := $(PROJ_OBJ_DIR)/$(BuildMode)
|
||||||
ifeq ($(LLVM_CROSS_COMPILING),1)
|
|
||||||
BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
|
|
||||||
endif
|
|
||||||
|
|
||||||
ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
|
|
||||||
ObjDir := $(ObjRootDir)
|
|
||||||
LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
|
LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
|
||||||
ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
|
ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
|
||||||
ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
|
ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
|
||||||
@@ -335,7 +311,7 @@ LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
|
|||||||
endif
|
endif
|
||||||
ifndef TBLGEN
|
ifndef TBLGEN
|
||||||
ifeq ($(LLVM_CROSS_COMPILING),1)
|
ifeq ($(LLVM_CROSS_COMPILING),1)
|
||||||
TBLGEN := $(BuildLLVMToolDir)/tblgen$(BUILD_EXEEXT)
|
TBLGEN := $(LLVMToolDir)/tblgen$(BUILD_EXEEXT)
|
||||||
else
|
else
|
||||||
TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
|
TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
|
||||||
endif
|
endif
|
||||||
@@ -466,61 +442,40 @@ ifdef UNIVERSAL
|
|||||||
DISABLE_AUTO_DEPENDENCIES=1
|
DISABLE_AUTO_DEPENDENCIES=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS),SunOS)
|
|
||||||
CPP.BaseFlags += -include llvm/System/Solaris.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
|
LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
|
||||||
CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
|
CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
|
||||||
# All -I flags should go here, so that they don't confuse llvm-config.
|
# All -I flags should go here, so that they don't confuse llvm-config.
|
||||||
CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
|
CPP.Flags += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
|
||||||
$(patsubst %,-I%/include,\
|
-I$(PROJ_OBJ_ROOT)/include \
|
||||||
$(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
|
-I$(PROJ_SRC_ROOT)/include \
|
||||||
$(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
|
-I$(LLVM_OBJ_ROOT)/include \
|
||||||
|
-I$(LLVM_SRC_ROOT)/include \
|
||||||
$(CPP.BaseFlags)
|
$(CPP.BaseFlags)
|
||||||
|
|
||||||
ifeq ($(BUILD_COMPONENT), 1)
|
Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -c
|
||||||
Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -c
|
|
||||||
Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c
|
|
||||||
Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -E
|
|
||||||
Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \
|
|
||||||
$(LD.Flags) $(Strip)
|
|
||||||
Relink = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \
|
|
||||||
$(Relink.Flags)
|
|
||||||
else
|
|
||||||
Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -c
|
|
||||||
Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c
|
|
||||||
Preprocess.CXX= $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -E
|
|
||||||
Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \
|
|
||||||
$(LD.Flags) $(Strip)
|
|
||||||
Relink = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \
|
|
||||||
$(Relink.Flags)
|
|
||||||
endif
|
|
||||||
|
|
||||||
LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
|
LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
|
||||||
BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts)
|
BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts)
|
||||||
Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -E
|
Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -E
|
||||||
|
|
||||||
|
Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c
|
||||||
LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
|
LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
|
||||||
BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) \
|
BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) \
|
||||||
$(CompileCommonOpts)
|
$(CompileCommonOpts)
|
||||||
|
|
||||||
|
Preprocess.CXX= $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -E
|
||||||
|
Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \
|
||||||
|
$(LD.Flags) $(Strip)
|
||||||
LTLink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Link)
|
LTLink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Link)
|
||||||
|
Relink = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \
|
||||||
|
$(Relink.Flags)
|
||||||
LTRelink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Relink)
|
LTRelink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Relink)
|
||||||
LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \
|
LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \
|
||||||
$(Install.Flags)
|
$(Install.Flags)
|
||||||
ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
|
ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
|
||||||
ScriptInstall = $(INSTALL) -m 0755
|
ScriptInstall = $(INSTALL) -m 0755
|
||||||
DataInstall = $(INSTALL) -m 0644
|
DataInstall = $(INSTALL) -m 0644
|
||||||
|
TableGen = $(TBLGEN) -I $(PROJ_SRC_DIR) -I$(PROJ_SRC_ROOT)/include \
|
||||||
# When compiling under Mingw/Cygwin, the tblgen tool expects Windows
|
-I $(PROJ_SRC_ROOT)/lib/Target
|
||||||
# paths. In this case, the SYSPATH function (defined in
|
|
||||||
# Makefile.config) transforms Unix paths into Windows paths.
|
|
||||||
TableGen = $(TBLGEN) -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
|
|
||||||
-I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
|
|
||||||
-I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
|
|
||||||
-I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
|
|
||||||
|
|
||||||
Archive = $(AR) $(AR.Flags)
|
Archive = $(AR) $(AR.Flags)
|
||||||
LArchive = $(LLVMToolDir)/llvm-ar rcsf
|
LArchive = $(LLVMToolDir)/llvm-ar rcsf
|
||||||
ifdef RANLIB
|
ifdef RANLIB
|
||||||
@@ -536,13 +491,14 @@ endif
|
|||||||
|
|
||||||
ifndef SOURCES
|
ifndef SOURCES
|
||||||
Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
|
Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
|
||||||
$(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
|
$(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c $(PROJ_SRC_DIR)/*.y \
|
||||||
|
$(PROJ_SRC_DIR)/*.l))
|
||||||
else
|
else
|
||||||
Sources := $(SOURCES)
|
Sources := $(SOURCES)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef BUILT_SOURCES
|
ifdef BUILT_SOURCES
|
||||||
Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
|
Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BaseNameSources := $(sort $(basename $(Sources)))
|
BaseNameSources := $(sort $(basename $(Sources)))
|
||||||
@@ -560,8 +516,10 @@ ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
|
|||||||
# in the file so they get built before dependencies
|
# in the file so they get built before dependencies
|
||||||
#---------------------------------------------------------
|
#---------------------------------------------------------
|
||||||
|
|
||||||
$(PROJ_bindir) $(PROJ_libdir) $(PROJ_includedir) $(PROJ_etcdir)::
|
$(PROJ_bindir): $(PROJ_bindir)/.dir
|
||||||
$(Verb) $(MKDIR) $@
|
$(PROJ_libdir): $(PROJ_libdir)/.dir
|
||||||
|
$(PROJ_includedir): $(PROJ_includedir)/.dir
|
||||||
|
$(PROJ_etcdir): $(PROJ_etcdir)/.dir
|
||||||
|
|
||||||
# To create other directories, as needed, and timestamp their creation
|
# To create other directories, as needed, and timestamp their creation
|
||||||
%/.dir:
|
%/.dir:
|
||||||
@@ -612,13 +570,6 @@ $(RecursiveTargets)::
|
|||||||
done
|
done
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#-----------------------------------------------------------
|
|
||||||
# Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
|
|
||||||
#-----------------------------------------------------------
|
|
||||||
ifdef OPTIONAL_PARALLEL_DIRS
|
|
||||||
PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) && echo "$(T)"))
|
|
||||||
endif
|
|
||||||
|
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
# Handle the PARALLEL_DIRS options for parallel construction
|
# Handle the PARALLEL_DIRS options for parallel construction
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
@@ -728,7 +679,7 @@ LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
|
|||||||
LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
|
LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef IS_CLEANING_TARGET
|
ifeq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),)
|
||||||
ifdef LINK_COMPONENTS
|
ifdef LINK_COMPONENTS
|
||||||
|
|
||||||
# If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
|
# If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
|
||||||
@@ -763,7 +714,7 @@ $(warning Modules require llvm-gcc but no llvm-gcc is available ****)
|
|||||||
else
|
else
|
||||||
|
|
||||||
Module := $(LibDir)/$(MODULE_NAME).bc
|
Module := $(LibDir)/$(MODULE_NAME).bc
|
||||||
LinkModule := $(LLVMLD) -L$(CFERuntimeLibDir) -r
|
LinkModule := $(LLVMLD) -L$(CFERuntimeLibDir)
|
||||||
|
|
||||||
|
|
||||||
ifdef EXPORTED_SYMBOL_FILE
|
ifdef EXPORTED_SYMBOL_FILE
|
||||||
@@ -840,7 +791,7 @@ SharedLibKindMessage := "Loadable Module"
|
|||||||
else
|
else
|
||||||
SharedLibKindMessage := "Shared Library"
|
SharedLibKindMessage := "Shared Library"
|
||||||
endif
|
endif
|
||||||
$(LibName.LA): $(ObjectsLO) $(ProjLibsPaths) $(LLVMLibsPaths) $(LibDir)/.dir
|
$(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
|
||||||
$(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
|
$(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
|
||||||
$(LIBRARYNAME)$(SHLIBEXT)
|
$(LIBRARYNAME)$(SHLIBEXT)
|
||||||
$(Verb) $(LTLink) -o $@ $(ObjectsLO) $(ProjLibsOptions) \
|
$(Verb) $(LTLink) -o $@ $(ObjectsLO) $(ProjLibsOptions) \
|
||||||
@@ -868,7 +819,7 @@ DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
|
|||||||
|
|
||||||
install-local:: $(DestSharedLib)
|
install-local:: $(DestSharedLib)
|
||||||
|
|
||||||
$(DestSharedLib): $(LibName.LA) $(PROJ_libdir)
|
$(DestSharedLib): $(PROJ_libdir) $(LibName.LA)
|
||||||
$(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
|
$(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
|
||||||
$(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
|
$(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
|
||||||
$(Verb) $(LIBTOOL) --finish $(PROJ_libdir)
|
$(Verb) $(LIBTOOL) --finish $(PROJ_libdir)
|
||||||
@@ -935,7 +886,7 @@ uninstall-local::
|
|||||||
else
|
else
|
||||||
install-local:: $(DestBytecodeLib)
|
install-local:: $(DestBytecodeLib)
|
||||||
|
|
||||||
$(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir)
|
$(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA)
|
||||||
$(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
|
$(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
|
||||||
$(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
|
$(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
|
||||||
|
|
||||||
@@ -982,7 +933,7 @@ DestRelinkedLib = $(PROJ_libdir)/$(LIBRARYNAME).o
|
|||||||
|
|
||||||
install-local:: $(DestRelinkedLib)
|
install-local:: $(DestRelinkedLib)
|
||||||
|
|
||||||
$(DestRelinkedLib): $(LibName.O) $(PROJ_libdir)
|
$(DestRelinkedLib): $(PROJ_libdir) $(LibName.O)
|
||||||
$(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
|
$(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
|
||||||
$(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
|
$(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
|
||||||
|
|
||||||
@@ -1022,7 +973,7 @@ DestArchiveLib := $(PROJ_libdir)/lib$(LIBRARYNAME).a
|
|||||||
|
|
||||||
install-local:: $(DestArchiveLib)
|
install-local:: $(DestArchiveLib)
|
||||||
|
|
||||||
$(DestArchiveLib): $(LibName.A) $(PROJ_libdir)
|
$(DestArchiveLib): $(PROJ_libdir) $(LibName.A)
|
||||||
$(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
|
$(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
|
||||||
$(Verb) $(MKDIR) $(PROJ_libdir)
|
$(Verb) $(MKDIR) $(PROJ_libdir)
|
||||||
$(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
|
$(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
|
||||||
@@ -1084,7 +1035,7 @@ DestTool = $(PROJ_bindir)/$(TOOLNAME)
|
|||||||
|
|
||||||
install-local:: $(DestTool)
|
install-local:: $(DestTool)
|
||||||
|
|
||||||
$(DestTool): $(ToolBuildPath) $(PROJ_bindir)
|
$(DestTool): $(PROJ_bindir) $(ToolBuildPath)
|
||||||
$(Echo) Installing $(BuildMode) $(DestTool)
|
$(Echo) Installing $(BuildMode) $(DestTool)
|
||||||
$(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
|
$(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
|
||||||
|
|
||||||
@@ -1119,28 +1070,23 @@ ifndef DISABLE_AUTO_DEPENDENCIES
|
|||||||
# Create .lo files in the ObjDir directory from the .cpp and .c files...
|
# Create .lo files in the ObjDir directory from the .cpp and .c files...
|
||||||
#---------------------------------------------------------
|
#---------------------------------------------------------
|
||||||
|
|
||||||
DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
|
|
||||||
-MT "$(ObjDir)/$*.lo" -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
|
|
||||||
|
|
||||||
# If the build succeeded, move the dependency file over. If it failed, put an
|
|
||||||
# empty file there.
|
|
||||||
DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
|
|
||||||
else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
|
|
||||||
|
|
||||||
$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
|
||||||
$(Echo) "Compiling $*.cpp for $(BuildMode) build " $(PIC_FLAG)
|
$(Echo) "Compiling $*.cpp for $(BuildMode) build " $(PIC_FLAG)
|
||||||
$(Verb) if $(MAYBE_PIC_Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
$(Verb) if $(MAYBE_PIC_Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ;\
|
||||||
$(DEPEND_MOVEFILE)
|
then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
|
||||||
|
else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
|
||||||
|
|
||||||
$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
|
||||||
$(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
|
$(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
|
||||||
$(Verb) if $(MAYBE_PIC_Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
$(Verb) if $(MAYBE_PIC_Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ;\
|
||||||
$(DEPEND_MOVEFILE)
|
then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
|
||||||
|
else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
|
||||||
|
|
||||||
$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
|
$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
|
||||||
$(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
|
$(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
|
||||||
$(Verb) if $(MAYBE_PIC_Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
|
$(Verb) if $(MAYBE_PIC_Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
|
||||||
$(DEPEND_MOVEFILE)
|
then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
|
||||||
|
else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
|
||||||
|
|
||||||
#---------------------------------------------------------
|
#---------------------------------------------------------
|
||||||
# Create .bc files in the ObjDir directory from .cpp .cc and .c files...
|
# Create .bc files in the ObjDir directory from .cpp .cc and .c files...
|
||||||
@@ -1264,10 +1210,9 @@ $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
|
|||||||
ifdef TARGET
|
ifdef TARGET
|
||||||
|
|
||||||
TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
|
TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
|
||||||
$(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
|
$(LLVM_SRC_ROOT)/lib/Target/Target.td \
|
||||||
$(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
|
$(LLVM_SRC_ROOT)/lib/Target/TargetCallingConv.td \
|
||||||
$(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
|
$(LLVM_SRC_ROOT)/lib/Target/TargetSelectionDAG.td \
|
||||||
$(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
|
|
||||||
$(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
|
$(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
|
||||||
$(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
|
$(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
|
||||||
INCFiles := $(filter %.inc,$(BUILT_SOURCES))
|
INCFiles := $(filter %.inc,$(BUILT_SOURCES))
|
||||||
@@ -1280,7 +1225,7 @@ $(INCTMPFiles) : $(TBLGEN) $(TDFiles)
|
|||||||
# INCFiles rule: All of the tblgen generated files are emitted to
|
# INCFiles rule: All of the tblgen generated files are emitted to
|
||||||
# $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
|
# $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
|
||||||
# us to only "touch" the real file if the contents of it change. IOW, if
|
# us to only "touch" the real file if the contents of it change. IOW, if
|
||||||
# tblgen is modified, all of the .inc.tmp files are regenerated, but no
|
# tblgen is modified, all of the .inc.tmp files are regereated, but no
|
||||||
# dependencies of the .inc files are, unless the contents of the .inc file
|
# dependencies of the .inc files are, unless the contents of the .inc file
|
||||||
# changes.
|
# changes.
|
||||||
$(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
|
$(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
|
||||||
@@ -1289,68 +1234,168 @@ $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
|
|||||||
$(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
|
$(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
|
||||||
$(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
|
$(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
|
||||||
$(Echo) "Building $(<F) register names with tblgen"
|
$(Echo) "Building $(<F) register names with tblgen"
|
||||||
$(Verb) $(TableGen) -gen-register-enums -o $(call SYSPATH, $@) $<
|
$(Verb) $(TableGen) -gen-register-enums -o $@ $<
|
||||||
|
|
||||||
$(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \
|
$(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \
|
||||||
$(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir
|
$(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir
|
||||||
$(Echo) "Building $(<F) register information header with tblgen"
|
$(Echo) "Building $(<F) register information header with tblgen"
|
||||||
$(Verb) $(TableGen) -gen-register-desc-header -o $(call SYSPATH, $@) $<
|
$(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
|
||||||
|
|
||||||
$(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
|
$(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
|
||||||
$(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir
|
$(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir
|
||||||
$(Echo) "Building $(<F) register info implementation with tblgen"
|
$(Echo) "Building $(<F) register info implementation with tblgen"
|
||||||
$(Verb) $(TableGen) -gen-register-desc -o $(call SYSPATH, $@) $<
|
$(Verb) $(TableGen) -gen-register-desc -o $@ $<
|
||||||
|
|
||||||
$(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \
|
$(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \
|
||||||
$(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir
|
$(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir
|
||||||
$(Echo) "Building $(<F) instruction names with tblgen"
|
$(Echo) "Building $(<F) instruction names with tblgen"
|
||||||
$(Verb) $(TableGen) -gen-instr-enums -o $(call SYSPATH, $@) $<
|
$(Verb) $(TableGen) -gen-instr-enums -o $@ $<
|
||||||
|
|
||||||
$(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
|
$(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
|
||||||
$(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir
|
$(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir
|
||||||
$(Echo) "Building $(<F) instruction information with tblgen"
|
$(Echo) "Building $(<F) instruction information with tblgen"
|
||||||
$(Verb) $(TableGen) -gen-instr-desc -o $(call SYSPATH, $@) $<
|
$(Verb) $(TableGen) -gen-instr-desc -o $@ $<
|
||||||
|
|
||||||
$(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
|
$(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
|
||||||
$(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir
|
$(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir
|
||||||
$(Echo) "Building $(<F) assembly writer with tblgen"
|
$(Echo) "Building $(<F) assembly writer with tblgen"
|
||||||
$(Verb) $(TableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
|
$(Verb) $(TableGen) -gen-asm-writer -o $@ $<
|
||||||
|
|
||||||
$(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
|
$(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
|
||||||
$(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
|
$(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
|
||||||
$(Echo) "Building $(<F) assembly writer #1 with tblgen"
|
$(Echo) "Building $(<F) assembly writer #1 with tblgen"
|
||||||
$(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
|
$(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
|
||||||
|
|
||||||
$(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
|
$(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
|
||||||
$(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
|
$(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
|
||||||
$(Echo) "Building $(<F) code emitter with tblgen"
|
$(Echo) "Building $(<F) code emitter with tblgen"
|
||||||
$(Verb) $(TableGen) -gen-emitter -o $(call SYSPATH, $@) $<
|
$(Verb) $(TableGen) -gen-emitter -o $@ $<
|
||||||
|
|
||||||
$(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
|
$(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
|
||||||
$(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir
|
$(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir
|
||||||
$(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
|
$(Echo) "Building $(<F) instruction selector implementation with tblgen"
|
||||||
$(Verb) $(TableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
|
$(Verb) $(TableGen) -gen-dag-isel -o $@ $<
|
||||||
|
|
||||||
$(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
|
|
||||||
$(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir
|
|
||||||
$(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
|
|
||||||
$(Verb) $(TableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
|
|
||||||
|
|
||||||
$(TARGET:%=$(ObjDir)/%GenSubtarget.inc.tmp): \
|
$(TARGET:%=$(ObjDir)/%GenSubtarget.inc.tmp): \
|
||||||
$(ObjDir)/%GenSubtarget.inc.tmp : %.td $(ObjDir)/.dir
|
$(ObjDir)/%GenSubtarget.inc.tmp : %.td $(ObjDir)/.dir
|
||||||
$(Echo) "Building $(<F) subtarget information with tblgen"
|
$(Echo) "Building $(<F) subtarget information with tblgen"
|
||||||
$(Verb) $(TableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
|
$(Verb) $(TableGen) -gen-subtarget -o $@ $<
|
||||||
|
|
||||||
$(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
|
$(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
|
||||||
$(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir
|
$(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir
|
||||||
$(Echo) "Building $(<F) calling convention information with tblgen"
|
$(Echo) "Building $(<F) calling convention information with tblgen"
|
||||||
$(Verb) $(TableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
|
$(Verb) $(TableGen) -gen-callingconv -o $@ $<
|
||||||
|
|
||||||
clean-local::
|
clean-local::
|
||||||
-$(Verb) $(RM) -f $(INCFiles)
|
-$(Verb) $(RM) -f $(INCFiles)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# LEX AND YACC: Provide rules for generating sources with lex and yacc
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Provide rules for generating a .cpp source file from
|
||||||
|
# (f)lex input sources.
|
||||||
|
#---------------------------------------------------------
|
||||||
|
|
||||||
|
LexFiles := $(filter %.l,$(Sources))
|
||||||
|
|
||||||
|
ifneq ($(LexFiles),)
|
||||||
|
|
||||||
|
# Cancel built-in rules for lex
|
||||||
|
%.c: %.l
|
||||||
|
%.cpp: %.l
|
||||||
|
|
||||||
|
all:: $(LexFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs)
|
||||||
|
|
||||||
|
# Note the extra sed filtering here, used to cut down on the warnings emited
|
||||||
|
# by GCC. The last line is a gross hack to work around flex aparently not
|
||||||
|
# being able to resize the buffer on a large token input. Currently, for
|
||||||
|
# uninitialized string buffers in LLVM we can generate very long tokens, so
|
||||||
|
# this is a hack around it.
|
||||||
|
# FIXME. (f.e. char Buffer[10000] )
|
||||||
|
$(PROJ_SRC_DIR)/%.cpp: $(PROJ_SRC_DIR)/%.l
|
||||||
|
$(Echo) Flexing $*.l
|
||||||
|
$(Verb) $(FLEX) -t $(PROJ_SRC_DIR)/$*.l | \
|
||||||
|
$(SED) 's/void yyunput/inline void yyunput/' | \
|
||||||
|
$(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
|
||||||
|
$(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
|
||||||
|
> $(PROJ_SRC_DIR)/$*.cpp
|
||||||
|
|
||||||
|
# IFF the .l file has changed since it was last checked into CVS, copy the .l
|
||||||
|
# file to .l.cvs and the generated .cpp file to .cpp.cvs. We use this mechanism
|
||||||
|
# so that people without flex can build LLVM by copying the .cvs files to the
|
||||||
|
# source location and building them.
|
||||||
|
$(LexFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs): \
|
||||||
|
$(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp
|
||||||
|
$(Verb) $(CMP) -s $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs || \
|
||||||
|
($(CP) $< $@; $(CP) $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs)
|
||||||
|
|
||||||
|
$(LexFiles:%.l=$(ObjDir)/%.o) : \
|
||||||
|
$(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
|
||||||
|
|
||||||
|
clean-local::
|
||||||
|
-$(Verb) $(RM) -f $(LexOutput)
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Provide rules for generating a .cpp and .h source files
|
||||||
|
# from yacc (bison) input sources.
|
||||||
|
#---------------------------------------------------------
|
||||||
|
|
||||||
|
YaccFiles := $(filter %.y,$(Sources))
|
||||||
|
ifneq ($(YaccFiles),)
|
||||||
|
|
||||||
|
.PRECIOUS: $(YaccOutput)
|
||||||
|
|
||||||
|
all:: $(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs)
|
||||||
|
|
||||||
|
# Cancel built-in rules for yacc
|
||||||
|
%.c: %.y
|
||||||
|
%.cpp: %.y
|
||||||
|
%.h: %.y
|
||||||
|
|
||||||
|
# Rule for building the bison based parsers...
|
||||||
|
ifneq ($(BISON),)
|
||||||
|
$(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y
|
||||||
|
$(Echo) "Bisoning $*.y"
|
||||||
|
$(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
|
||||||
|
$(Verb) $(MV) -f $*.tab.c $(PROJ_SRC_DIR)/$*.cpp
|
||||||
|
$(Verb) $(MV) -f $*.tab.h $(PROJ_SRC_DIR)/$*.h
|
||||||
|
|
||||||
|
# IFF the .y file has changed since it was last checked into CVS, copy the .y
|
||||||
|
# file to .y.cvs and the generated .cpp/.h file to .cpp.cvs/.h.cvs. We use this
|
||||||
|
# mechanism so that people without flex can build LLVM by copying the .cvs files
|
||||||
|
# to the source location and building them.
|
||||||
|
$(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs): \
|
||||||
|
$(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp
|
||||||
|
$(Verb) $(CMP) -s $(PROJ_SRC_DIR)/$*.y $(PROJ_SRC_DIR)/$*.y.cvs || \
|
||||||
|
($(CP) $< $@; \
|
||||||
|
$(CP) $(PROJ_SRC_DIR)/$*.y $(PROJ_SRC_DIR)/$*.y.cvs; \
|
||||||
|
$(CP) $(PROJ_SRC_DIR)/$*.h $(PROJ_SRC_DIR)/$*.h.cvs)
|
||||||
|
|
||||||
|
else
|
||||||
|
$(PROJ_SRC_DIR)/%.cpp : $(PROJ_SRC_DIR)/%.cpp.cvs
|
||||||
|
$(Echo) "Bison of $*.y SKIPPED, bison not found -- copying .cpp.cvs"
|
||||||
|
$(Verb)$(CP) $(PROJ_SRC_DIR)/$*.cpp.cvs $(PROJ_SRC_DIR)/$*.cpp
|
||||||
|
|
||||||
|
$(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.h.cvs
|
||||||
|
$(Echo) "Bison of $*.y SKIPPED, bison not found -- copying .h.cvs"
|
||||||
|
$(Verb)$(CP) $(PROJ_SRC_DIR)/$*.h.cvs $(PROJ_SRC_DIR)/$*.h
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
$(YaccFiles:%.y=$(ObjDir)/%.o): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
|
||||||
|
|
||||||
|
YaccOutput := $(YaccFiles:%.y=%.output)
|
||||||
|
|
||||||
|
clean-local::
|
||||||
|
-$(Verb) $(RM) -f $(YaccOutput)
|
||||||
|
endif
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OTHER RULES: Other rules needed
|
# OTHER RULES: Other rules needed
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -1374,8 +1419,8 @@ endif
|
|||||||
# very conservative approach ensuring that empty variables do not cause
|
# very conservative approach ensuring that empty variables do not cause
|
||||||
# errors or disastrous removal.
|
# errors or disastrous removal.
|
||||||
clean-local::
|
clean-local::
|
||||||
ifneq ($(strip $(ObjRootDir)),)
|
ifneq ($(strip $(ObjDir)),)
|
||||||
-$(Verb) $(RM) -rf $(ObjRootDir)
|
-$(Verb) $(RM) -rf $(ObjDir)
|
||||||
endif
|
endif
|
||||||
-$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
|
-$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
|
||||||
ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
|
ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
|
||||||
@@ -1385,6 +1430,25 @@ endif
|
|||||||
clean-all-local::
|
clean-all-local::
|
||||||
-$(Verb) $(RM) -rf Debug Release Profile
|
-$(Verb) $(RM) -rf Debug Release Profile
|
||||||
|
|
||||||
|
# Build tags database for Emacs/Xemacs:
|
||||||
|
tags:: TAGS CTAGS
|
||||||
|
|
||||||
|
TAGS:
|
||||||
|
find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
|
||||||
|
$(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
|
||||||
|
$(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
|
||||||
|
$(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
|
||||||
|
-name '*.cpp' -o -name '*.h' | \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) -
|
||||||
|
|
||||||
|
CTAGS:
|
||||||
|
find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
|
||||||
|
$(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
|
||||||
|
$(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
|
||||||
|
$(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
|
||||||
|
\( -name '*.cpp' -o -name '*.h' \) -print | \
|
||||||
|
ctags -ImtT -o $(PROJ_OBJ_ROOT)/CTAGS -L -
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# DEPENDENCIES: Include the dependency files if we should
|
# DEPENDENCIES: Include the dependency files if we should
|
||||||
@@ -1392,13 +1456,13 @@ clean-all-local::
|
|||||||
ifndef DISABLE_AUTO_DEPENDENCIES
|
ifndef DISABLE_AUTO_DEPENDENCIES
|
||||||
|
|
||||||
# If its not one of the cleaning targets
|
# If its not one of the cleaning targets
|
||||||
ifndef IS_CLEANING_TARGET
|
ifneq ($(strip $(filter-out clean clean-local dist-clean,$(MAKECMDGOALS)))),)
|
||||||
|
|
||||||
# Get the list of dependency files
|
# Get the list of dependency files
|
||||||
DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
|
DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
|
||||||
DependFiles := $(DependFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
|
DependFiles := $(DependFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
|
||||||
|
|
||||||
-include $(DependFiles) ""
|
-include /dev/null $(DependFiles)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -1421,22 +1485,6 @@ check::
|
|||||||
$(EchoCmd) No test directory ; \
|
$(EchoCmd) No test directory ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# UNITTESTS: Running the unittests test suite
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
unittests::
|
|
||||||
$(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
|
|
||||||
if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
|
|
||||||
$(EchoCmd) Running unittests test suite ; \
|
|
||||||
$(MAKE) -C $(PROJ_OBJ_ROOT)/unittests ; \
|
|
||||||
else \
|
|
||||||
$(EchoCmd) No Makefile in unittests directory ; \
|
|
||||||
fi ; \
|
|
||||||
else \
|
|
||||||
$(EchoCmd) No unittests directory ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# DISTRIBUTION: Handle construction of a distribution tarball
|
# DISTRIBUTION: Handle construction of a distribution tarball
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -1525,7 +1573,6 @@ dist-check:: $(DistTarGZip)
|
|||||||
--srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
|
--srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
|
||||||
$(MAKE) all && \
|
$(MAKE) all && \
|
||||||
$(MAKE) check && \
|
$(MAKE) check && \
|
||||||
$(MAKE) unittests && \
|
|
||||||
$(MAKE) install && \
|
$(MAKE) install && \
|
||||||
$(MAKE) uninstall && \
|
$(MAKE) uninstall && \
|
||||||
$(MAKE) dist-clean && \
|
$(MAKE) dist-clean && \
|
||||||
@@ -1655,7 +1702,7 @@ install-local::
|
|||||||
$(Verb) $(MKDIR) $(PROJ_includedir)
|
$(Verb) $(MKDIR) $(PROJ_includedir)
|
||||||
$(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
|
$(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
|
||||||
cd $(PROJ_SRC_ROOT)/include && \
|
cd $(PROJ_SRC_ROOT)/include && \
|
||||||
for hdr in `find . -type f '!' '(' -name '*~' \
|
for hdr in `find . -type f '!' '(' -name '*~' -o -name '.cvsignore' \
|
||||||
-o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS | \
|
-o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS | \
|
||||||
grep -v .svn` ; do \
|
grep -v .svn` ; do \
|
||||||
instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \
|
instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \
|
||||||
@@ -1680,7 +1727,7 @@ uninstall-local::
|
|||||||
$(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
|
$(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
|
||||||
cd $(PROJ_SRC_ROOT)/include && \
|
cd $(PROJ_SRC_ROOT)/include && \
|
||||||
$(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
|
$(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
|
||||||
'!' '(' -name '*~' -o -name '.#*' \
|
'!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' \
|
||||||
-o -name '*.in' ')' -print ')' | \
|
-o -name '*.in' ')' -print ')' | \
|
||||||
grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \
|
grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \
|
||||||
cd $(PROJ_SRC_ROOT)/include && \
|
cd $(PROJ_SRC_ROOT)/include && \
|
||||||
@@ -1691,17 +1738,10 @@ endif
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
check-line-length:
|
check-line-length:
|
||||||
@echo searching for overlength lines in files: $(Sources)
|
@egrep -n '.{81}' $(Sources)
|
||||||
@echo
|
|
||||||
@echo
|
|
||||||
egrep -n '.{81}' $(Sources) /dev/null
|
|
||||||
|
|
||||||
check-for-tabs:
|
check-for-tabs:
|
||||||
@echo searching for tabs in files: $(Sources)
|
@egrep -n ' ' $(Sources)
|
||||||
@echo
|
|
||||||
@echo
|
|
||||||
egrep -n ' ' $(Sources) /dev/null
|
|
||||||
|
|
||||||
check-footprint:
|
check-footprint:
|
||||||
@ls -l $(LibDir) | awk '\
|
@ls -l $(LibDir) | awk '\
|
||||||
BEGIN { sum = 0; } \
|
BEGIN { sum = 0; } \
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
DepModule:
|
|
||||||
BuildCmd: ./build-for-llvm-top.sh
|
|
||||||
CleanCmd: make clean -C ../build.llvm
|
|
||||||
InstallCmd: make install -C ../build.llvm
|
|
||||||
@@ -10,3 +10,4 @@ the license agreement found in LICENSE.txt.
|
|||||||
|
|
||||||
Please see the HTML documentation provided in docs/index.html for further
|
Please see the HTML documentation provided in docs/index.html for further
|
||||||
assistance with LLVM.
|
assistance with LLVM.
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
2
llvm/autoconf/.cvsignore
Normal file
2
llvm/autoconf/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
aclocal.m4
|
||||||
|
autom4te.cache
|
||||||
@@ -3,29 +3,16 @@ die () {
|
|||||||
echo "$@" 1>&2
|
echo "$@" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
### NOTE: ############################################################"
|
|
||||||
### The below two variables specify the auto* versions
|
|
||||||
### periods should be escaped with backslash, for use by grep
|
|
||||||
want_autoconf_version='2\.60'
|
|
||||||
want_autoheader_version=$want_autoconf_version
|
|
||||||
### END NOTE #########################################################"
|
|
||||||
|
|
||||||
|
|
||||||
outfile=configure
|
outfile=configure
|
||||||
configfile=configure.ac
|
configfile=configure.ac
|
||||||
|
|
||||||
want_autoconf_version_clean=`echo $want_autoconf_version | sed -e 's/\\\\//g'`
|
|
||||||
want_autoheader_version_clean=`echo $want_autoheader_version | sed -e 's/\\\\//g'`
|
|
||||||
|
|
||||||
test -d autoconf && test -f autoconf/$configfile && cd autoconf
|
test -d autoconf && test -f autoconf/$configfile && cd autoconf
|
||||||
test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first"
|
test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first"
|
||||||
autoconf --version | grep $want_autoconf_version > /dev/null
|
autoconf --version | grep '2\.60' > /dev/null
|
||||||
test $? -eq 0 || die "Your autoconf was not detected as being $want_autoconf_version_clean"
|
test $? -eq 0 || die "Your autoconf was not detected as being 2.60"
|
||||||
aclocal --version | grep '^aclocal.*1\.9\.6' > /dev/null
|
aclocal --version | grep '^aclocal.*1\.9\.6' > /dev/null
|
||||||
test $? -eq 0 || die "Your aclocal was not detected as being 1.9.6"
|
test $? -eq 0 || die "Your aclocal was not detected as being 1.9.6"
|
||||||
autoheader --version | grep '^autoheader.*'$want_autoheader_version > /dev/null
|
autoheader --version | grep '^autoheader.*2\.60' > /dev/null
|
||||||
test $? -eq 0 || die "Your autoheader was not detected as being $want_autoheader_version_clean"
|
test $? -eq 0 || die "Your autoheader was not detected as being 2.60"
|
||||||
libtool --version | grep '1\.5\.22' > /dev/null
|
libtool --version | grep '1\.5\.22' > /dev/null
|
||||||
test $? -eq 0 || die "Your libtool was not detected as being 1.5.22"
|
test $? -eq 0 || die "Your libtool was not detected as being 1.5.22"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -40,9 +27,9 @@ echo ""
|
|||||||
echo "Regenerating aclocal.m4 with aclocal 1.9.6"
|
echo "Regenerating aclocal.m4 with aclocal 1.9.6"
|
||||||
cwd=`pwd`
|
cwd=`pwd`
|
||||||
aclocal --force -I $cwd/m4 || die "aclocal failed"
|
aclocal --force -I $cwd/m4 || die "aclocal failed"
|
||||||
echo "Regenerating configure with autoconf $want_autoconf_version_clean"
|
echo "Regenerating configure with autoconf 2.60"
|
||||||
autoconf --force --warnings=all -o ../$outfile $configfile || die "autoconf failed"
|
autoconf --force --warnings=all -o ../$outfile $configfile || die "autoconf failed"
|
||||||
cd ..
|
cd ..
|
||||||
echo "Regenerating config.h.in with autoheader $want_autoheader_version_clean"
|
echo "Regenerating config.h.in with autoheader 2.60"
|
||||||
autoheader --warnings=all -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed"
|
autoheader --warnings=all -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
dnl === configure.ac --------------------------------------------------------===
|
dnl === configure.ac --------------------------------------------------------===
|
||||||
dnl The LLVM Compiler Infrastructure
|
dnl The LLVM Compiler Infrastructure
|
||||||
dnl
|
dnl
|
||||||
dnl This file is distributed under the University of Illinois Open Source
|
dnl This file was developed by the LLVM research group and is distributed under
|
||||||
dnl License. See LICENSE.TXT for details.
|
dnl the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||||
dnl
|
dnl
|
||||||
dnl===-----------------------------------------------------------------------===
|
dnl===-----------------------------------------------------------------------===
|
||||||
dnl This is the LLVM configuration script. It is processed by the autoconf
|
dnl This is the LLVM configuration script. It is processed by the autoconf
|
||||||
@@ -31,12 +31,12 @@ dnl===
|
|||||||
dnl===-----------------------------------------------------------------------===
|
dnl===-----------------------------------------------------------------------===
|
||||||
dnl Initialize autoconf and define the package name, version number and
|
dnl Initialize autoconf and define the package name, version number and
|
||||||
dnl email address for reporting bugs.
|
dnl email address for reporting bugs.
|
||||||
AC_INIT([[llvm]],[[2.5]],[llvmbugs@cs.uiuc.edu])
|
AC_INIT([[llvm]],[[2.0]],[llvmbugs@cs.uiuc.edu])
|
||||||
|
|
||||||
dnl Provide a copyright substitution and ensure the copyright notice is included
|
dnl Provide a copyright substitution and ensure the copyright notice is included
|
||||||
dnl in the output of --version option of the generated configure script.
|
dnl in the output of --version option of the generated configure script.
|
||||||
AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign."])
|
AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign."])
|
||||||
AC_COPYRIGHT([Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.])
|
AC_COPYRIGHT([Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign.])
|
||||||
|
|
||||||
dnl Indicate that we require autoconf 2.59 or later. Ths is needed because we
|
dnl Indicate that we require autoconf 2.59 or later. Ths is needed because we
|
||||||
dnl use some autoconf macros only available in 2.59.
|
dnl use some autoconf macros only available in 2.59.
|
||||||
@@ -70,16 +70,12 @@ do
|
|||||||
sample) AC_CONFIG_SUBDIRS([projects/sample]) ;;
|
sample) AC_CONFIG_SUBDIRS([projects/sample]) ;;
|
||||||
privbracket) AC_CONFIG_SUBDIRS([projects/privbracket]) ;;
|
privbracket) AC_CONFIG_SUBDIRS([projects/privbracket]) ;;
|
||||||
llvm-stacker) AC_CONFIG_SUBDIRS([projects/llvm-stacker]) ;;
|
llvm-stacker) AC_CONFIG_SUBDIRS([projects/llvm-stacker]) ;;
|
||||||
# llvm-test is the old name of the test-suite, kept here for backwards
|
|
||||||
# compatibility
|
|
||||||
llvm-test) AC_CONFIG_SUBDIRS([projects/llvm-test]) ;;
|
llvm-test) AC_CONFIG_SUBDIRS([projects/llvm-test]) ;;
|
||||||
test-suite) AC_CONFIG_SUBDIRS([projects/test-suite]) ;;
|
|
||||||
llvm-reopt) AC_CONFIG_SUBDIRS([projects/llvm-reopt]);;
|
llvm-reopt) AC_CONFIG_SUBDIRS([projects/llvm-reopt]);;
|
||||||
llvm-gcc) AC_CONFIG_SUBDIRS([projects/llvm-gcc]) ;;
|
llvm-gcc) AC_CONFIG_SUBDIRS([projects/llvm-gcc]) ;;
|
||||||
llvm-java) AC_CONFIG_SUBDIRS([projects/llvm-java]) ;;
|
llvm-java) AC_CONFIG_SUBDIRS([projects/llvm-java]) ;;
|
||||||
llvm-tv) AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
|
llvm-tv) AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
|
||||||
llvm-poolalloc) AC_CONFIG_SUBDIRS([projects/llvm-poolalloc]) ;;
|
llvm-poolalloc) AC_CONFIG_SUBDIRS([projects/llvm-poolalloc]) ;;
|
||||||
poolalloc) AC_CONFIG_SUBDIRS([projects/poolalloc]) ;;
|
|
||||||
llvm-kernel) AC_CONFIG_SUBDIRS([projects/llvm-kernel]) ;;
|
llvm-kernel) AC_CONFIG_SUBDIRS([projects/llvm-kernel]) ;;
|
||||||
*)
|
*)
|
||||||
AC_MSG_WARN([Unknown project (${i}) won't be configured automatically])
|
AC_MSG_WARN([Unknown project (${i}) won't be configured automatically])
|
||||||
@@ -122,7 +118,7 @@ AC_CACHE_CHECK([type of operating system we're going to host on],
|
|||||||
llvm_cv_platform_type="Unix" ;;
|
llvm_cv_platform_type="Unix" ;;
|
||||||
*-*-darwin*)
|
*-*-darwin*)
|
||||||
llvm_cv_link_all_option="-Wl,-all_load"
|
llvm_cv_link_all_option="-Wl,-all_load"
|
||||||
llvm_cv_no_link_all_option="-Wl,-noall_load"
|
llvm_cv_link_all_option="-Wl,-noall_load"
|
||||||
llvm_cv_os_type="Darwin"
|
llvm_cv_os_type="Darwin"
|
||||||
llvm_cv_platform_type="Unix" ;;
|
llvm_cv_platform_type="Unix" ;;
|
||||||
*-*-freebsd*)
|
*-*-freebsd*)
|
||||||
@@ -140,11 +136,6 @@ AC_CACHE_CHECK([type of operating system we're going to host on],
|
|||||||
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
|
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
|
||||||
llvm_cv_os_type="NetBSD"
|
llvm_cv_os_type="NetBSD"
|
||||||
llvm_cv_platform_type="Unix" ;;
|
llvm_cv_platform_type="Unix" ;;
|
||||||
*-*-dragonfly*)
|
|
||||||
llvm_cv_link_all_option="-Wl,--whole-archive"
|
|
||||||
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
|
|
||||||
llvm_cv_os_type="DragonFly"
|
|
||||||
llvm_cv_platform_type="Unix" ;;
|
|
||||||
*-*-hpux*)
|
*-*-hpux*)
|
||||||
llvm_cv_link_all_option="-Wl,--whole-archive"
|
llvm_cv_link_all_option="-Wl,--whole-archive"
|
||||||
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
|
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
|
||||||
@@ -223,9 +214,6 @@ AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
|
|||||||
alpha*-*) llvm_cv_target_arch="Alpha" ;;
|
alpha*-*) llvm_cv_target_arch="Alpha" ;;
|
||||||
ia64-*) llvm_cv_target_arch="IA64" ;;
|
ia64-*) llvm_cv_target_arch="IA64" ;;
|
||||||
arm-*) llvm_cv_target_arch="ARM" ;;
|
arm-*) llvm_cv_target_arch="ARM" ;;
|
||||||
mips-*) llvm_cv_target_arch="Mips" ;;
|
|
||||||
pic16-*) llvm_cv_target_arch="PIC16" ;;
|
|
||||||
xcore-*) llvm_cv_target_arch="XCore" ;;
|
|
||||||
*) llvm_cv_target_arch="Unknown" ;;
|
*) llvm_cv_target_arch="Unknown" ;;
|
||||||
esac])
|
esac])
|
||||||
|
|
||||||
@@ -243,14 +231,6 @@ dnl Check for build platform executable suffix if we're crosscompiling
|
|||||||
if test "$cross_compiling" = yes; then
|
if test "$cross_compiling" = yes; then
|
||||||
AC_SUBST(LLVM_CROSS_COMPILING, [1])
|
AC_SUBST(LLVM_CROSS_COMPILING, [1])
|
||||||
AC_BUILD_EXEEXT
|
AC_BUILD_EXEEXT
|
||||||
ac_build_prefix=${build_alias}-
|
|
||||||
AC_CHECK_PROG(BUILD_CXX, ${ac_build_prefix}g++, ${ac_build_prefix}g++)
|
|
||||||
if test -z "$BUILD_CXX"; then
|
|
||||||
AC_CHECK_PROG(BUILD_CXX, g++, g++)
|
|
||||||
if test -z "$BUILD_CXX"; then
|
|
||||||
AC_CHECK_PROG(BUILD_CXX, c++, c++, , , /usr/ucb/c++)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
AC_SUBST(LLVM_CROSS_COMPILING, [0])
|
AC_SUBST(LLVM_CROSS_COMPILING, [0])
|
||||||
fi
|
fi
|
||||||
@@ -294,17 +274,6 @@ else
|
|||||||
AC_SUBST(DISABLE_ASSERTIONS,[[DISABLE_ASSERTIONS=1]])
|
AC_SUBST(DISABLE_ASSERTIONS,[[DISABLE_ASSERTIONS=1]])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl --enable-expensive-checks : check whether they want to turn on expensive debug checks:
|
|
||||||
AC_ARG_ENABLE(expensive-checks,AS_HELP_STRING(
|
|
||||||
[--enable-expensive-checks,Compile with expensive debug checks enabled (default is NO)]),, enableval="no")
|
|
||||||
if test ${enableval} = "yes" ; then
|
|
||||||
AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[ENABLE_EXPENSIVE_CHECKS=1]])
|
|
||||||
AC_SUBST(EXPENSIVE_CHECKS,[[yes]])
|
|
||||||
else
|
|
||||||
AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[]])
|
|
||||||
AC_SUBST(EXPENSIVE_CHECKS,[[no]])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl --enable-debug-runtime : should runtime libraries have debug symbols?
|
dnl --enable-debug-runtime : should runtime libraries have debug symbols?
|
||||||
AC_ARG_ENABLE(debug-runtime,
|
AC_ARG_ENABLE(debug-runtime,
|
||||||
AS_HELP_STRING([--enable-debug-runtime,Build runtime libs with debug symbols (default is NO)]),,enableval=no)
|
AS_HELP_STRING([--enable-debug-runtime,Build runtime libs with debug symbols (default is NO)]),,enableval=no)
|
||||||
@@ -331,9 +300,6 @@ else
|
|||||||
Alpha) AC_SUBST(TARGET_HAS_JIT,1) ;;
|
Alpha) AC_SUBST(TARGET_HAS_JIT,1) ;;
|
||||||
IA64) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
IA64) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||||
ARM) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
ARM) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||||
Mips) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
|
||||||
PIC16) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
|
||||||
XCore) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
|
||||||
*) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
*) AC_SUBST(TARGET_HAS_JIT,0) ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@@ -383,7 +349,7 @@ AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
|
|||||||
[Build specific host targets: all,host-only,{target-name} (default=all)]),,
|
[Build specific host targets: all,host-only,{target-name} (default=all)]),,
|
||||||
enableval=all)
|
enableval=all)
|
||||||
case "$enableval" in
|
case "$enableval" in
|
||||||
all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU PIC16 XCore CBackend MSIL CppBackend" ;;
|
all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM" ;;
|
||||||
host-only)
|
host-only)
|
||||||
case "$llvm_cv_target_arch" in
|
case "$llvm_cv_target_arch" in
|
||||||
x86) TARGETS_TO_BUILD="X86" ;;
|
x86) TARGETS_TO_BUILD="X86" ;;
|
||||||
@@ -393,10 +359,6 @@ case "$enableval" in
|
|||||||
Alpha) TARGETS_TO_BUILD="Alpha" ;;
|
Alpha) TARGETS_TO_BUILD="Alpha" ;;
|
||||||
IA64) TARGETS_TO_BUILD="IA64" ;;
|
IA64) TARGETS_TO_BUILD="IA64" ;;
|
||||||
ARM) TARGETS_TO_BUILD="ARM" ;;
|
ARM) TARGETS_TO_BUILD="ARM" ;;
|
||||||
Mips) TARGETS_TO_BUILD="Mips" ;;
|
|
||||||
CellSPU|SPU) TARGETS_TO_BUILD="CellSPU" ;;
|
|
||||||
PIC16) TARGETS_TO_BUILD="PIC16" ;;
|
|
||||||
XCore) TARGETS_TO_BUILD="XCore" ;;
|
|
||||||
*) AC_MSG_ERROR([Can not set target to build]) ;;
|
*) AC_MSG_ERROR([Can not set target to build]) ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
@@ -409,18 +371,12 @@ case "$enableval" in
|
|||||||
alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;;
|
alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;;
|
||||||
ia64) TARGETS_TO_BUILD="IA64 $TARGETS_TO_BUILD" ;;
|
ia64) TARGETS_TO_BUILD="IA64 $TARGETS_TO_BUILD" ;;
|
||||||
arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
|
arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
|
||||||
mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
|
|
||||||
spu) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
|
|
||||||
pic16) TARGETS_TO_BUILD="PIC16 $TARGETS_TO_BUILD" ;;
|
|
||||||
xcore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
|
|
||||||
cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;;
|
|
||||||
msil) TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;;
|
|
||||||
cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;;
|
|
||||||
*) AC_MSG_ERROR([Unrecognized target $a_target]) ;;
|
*) AC_MSG_ERROR([Unrecognized target $a_target]) ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
TARGETS_TO_BUILD="CBackend MSIL $TARGETS_TO_BUILD"
|
||||||
AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD)
|
AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD)
|
||||||
|
|
||||||
dnl Prevent the CBackend from using printf("%a") for floating point so older
|
dnl Prevent the CBackend from using printf("%a") for floating point so older
|
||||||
@@ -449,28 +405,6 @@ case "$withval" in
|
|||||||
*) AC_MSG_ERROR([Invalid path for --with-llvmgccdir. Provide full path]) ;;
|
*) AC_MSG_ERROR([Invalid path for --with-llvmgccdir. Provide full path]) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
dnl Allow a specific llvm-gcc compiler to be used with this LLVM config.
|
|
||||||
AC_ARG_WITH(llvmgcc,
|
|
||||||
AS_HELP_STRING([--with-llvmgcc],
|
|
||||||
[Specify location of llvm-gcc driver (default searches PATH)]),
|
|
||||||
LLVMGCC=$with_llvmgcc
|
|
||||||
WITH_LLVMGCCDIR="",)
|
|
||||||
|
|
||||||
dnl Allow a specific llvm-g++ compiler to be used with this LLVM config.
|
|
||||||
AC_ARG_WITH(llvmgxx,
|
|
||||||
AS_HELP_STRING([--with-llvmgxx],
|
|
||||||
[Specify location of llvm-g++ driver (default searches PATH)]),
|
|
||||||
LLVMGXX=$with_llvmgxx
|
|
||||||
WITH_LLVMGCCDIR="",)
|
|
||||||
|
|
||||||
if test -n "$LLVMGCC" && test -z "$LLVMGXX"; then
|
|
||||||
AC_MSG_ERROR([Invalid llvm-g++. Use --with-llvmgxx when --with-llvmgcc is used]);
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$LLVMGXX" && test -z "$LLVMGCC"; then
|
|
||||||
AC_MSG_ERROR([Invalid llvm-gcc. Use --with-llvmgcc when --with-llvmgxx is used]);
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Specify extra build options
|
dnl Specify extra build options
|
||||||
AC_ARG_WITH(extra-options,
|
AC_ARG_WITH(extra-options,
|
||||||
AS_HELP_STRING([--with-extra-options],
|
AS_HELP_STRING([--with-extra-options],
|
||||||
@@ -482,38 +416,6 @@ case "$withval" in
|
|||||||
esac
|
esac
|
||||||
AC_SUBST(EXTRA_OPTIONS,$EXTRA_OPTIONS)
|
AC_SUBST(EXTRA_OPTIONS,$EXTRA_OPTIONS)
|
||||||
|
|
||||||
dnl Allow specific bindings to be specified for building (or not)
|
|
||||||
AC_ARG_ENABLE([bindings],AS_HELP_STRING([--enable-bindings],
|
|
||||||
[Build specific language bindings: all,auto,none,{binding-name} (default=auto)]),,
|
|
||||||
enableval=default)
|
|
||||||
BINDINGS_TO_BUILD=""
|
|
||||||
case "$enableval" in
|
|
||||||
yes | default | auto) BINDINGS_TO_BUILD="auto" ;;
|
|
||||||
all ) BINDINGS_TO_BUILD="ocaml" ;;
|
|
||||||
none | no) BINDINGS_TO_BUILD="" ;;
|
|
||||||
*)for a_binding in `echo $enableval|sed -e 's/,/ /g' ` ; do
|
|
||||||
case "$a_binding" in
|
|
||||||
ocaml) BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" ;;
|
|
||||||
*) AC_MSG_ERROR([Unrecognized binding $a_binding]) ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
dnl Allow the ocaml libdir to be overridden. This could go in a configure
|
|
||||||
dnl script for bindings/ocaml/configure, except that its auto value depends on
|
|
||||||
dnl OCAMLC, which is found here to support tests.
|
|
||||||
AC_ARG_WITH([ocaml-libdir],
|
|
||||||
[AS_HELP_STRING([--with-ocaml-libdir],
|
|
||||||
[Specify install location for ocaml bindings (default is stdlib)])],
|
|
||||||
[],
|
|
||||||
[withval=auto])
|
|
||||||
case "$withval" in
|
|
||||||
auto) with_ocaml_libdir="$withval" ;;
|
|
||||||
/* | [[A-Za-z]]:[[\\/]]*) with_ocaml_libdir="$withval" ;;
|
|
||||||
*) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
dnl===-----------------------------------------------------------------------===
|
dnl===-----------------------------------------------------------------------===
|
||||||
dnl===
|
dnl===
|
||||||
dnl=== SECTION 4: Check for programs we need and that they are the right version
|
dnl=== SECTION 4: Check for programs we need and that they are the right version
|
||||||
@@ -605,20 +507,15 @@ dnl Checks for documentation and testing tools that we can do without. If these
|
|||||||
dnl are not found then they are set to "true" which always succeeds but does
|
dnl are not found then they are set to "true" which always succeeds but does
|
||||||
dnl nothing. This just lets the build output show that we could have done
|
dnl nothing. This just lets the build output show that we could have done
|
||||||
dnl something if the tool was available.
|
dnl something if the tool was available.
|
||||||
AC_PATH_PROG(BZIP2, [bzip2])
|
AC_PATH_PROG(BZIP2,[bzip2],[echo "Skipped: bzip2 not found"])
|
||||||
AC_PATH_PROG(DOXYGEN, [doxygen])
|
AC_PATH_PROG(DOXYGEN,[doxygen],[echo "Skipped: doxygen not found"])
|
||||||
AC_PATH_PROG(GROFF, [groff])
|
AC_PATH_PROG(GROFF,[groff],[echo "Skipped: groff not found"])
|
||||||
AC_PATH_PROG(GZIP, [gzip])
|
AC_PATH_PROG(GZIP,[gzip],[echo "Skipped: gzip not found"])
|
||||||
AC_PATH_PROG(POD2HTML, [pod2html])
|
AC_PATH_PROG(POD2HTML,[pod2html],[echo "Skipped: pod2html not found"])
|
||||||
AC_PATH_PROG(POD2MAN, [pod2man])
|
AC_PATH_PROG(POD2MAN,[pod2man],[echo "Skipped: pod2man not found"])
|
||||||
AC_PATH_PROG(RUNTEST, [runtest])
|
AC_PATH_PROG(RUNTEST,[runtest],[echo "Skipped: runtest not found"])
|
||||||
DJ_AC_PATH_TCLSH
|
DJ_AC_PATH_TCLSH
|
||||||
AC_PATH_PROG(ZIP, [zip])
|
AC_PATH_PROG(ZIP,[zip],[echo "Skipped: zip not found"])
|
||||||
AC_PATH_PROGS(OCAMLC, [ocamlc])
|
|
||||||
AC_PATH_PROGS(OCAMLOPT, [ocamlopt])
|
|
||||||
AC_PATH_PROGS(OCAMLDEP, [ocamldep])
|
|
||||||
AC_PATH_PROGS(OCAMLDOC, [ocamldoc])
|
|
||||||
AC_PATH_PROGS(GAS, [gas as])
|
|
||||||
|
|
||||||
dnl Determine if the linker supports the -R option.
|
dnl Determine if the linker supports the -R option.
|
||||||
AC_LINK_USE_R
|
AC_LINK_USE_R
|
||||||
@@ -635,18 +532,23 @@ if test "$lt_cv_dlopen_self" = "yes" ; then
|
|||||||
[Define if dlopen(0) will open the symbols of the program])
|
[Define if dlopen(0) will open the symbols of the program])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl Check if we know how to tell etags we are using C++:
|
||||||
|
etags_version=`$ETAGS --version 2>&1`
|
||||||
|
case "$etags_version" in
|
||||||
|
*[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
|
||||||
|
*GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
|
||||||
|
*) ETAGSFLAGS="" ;;
|
||||||
|
esac
|
||||||
|
AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
|
||||||
|
|
||||||
if test "$WITH_LLVMGCCDIR" = "default" ; then
|
if test "$WITH_LLVMGCCDIR" = "default" ; then
|
||||||
LLVMGCC="llvm-gcc${EXEEXT}"
|
LLVMGCC="llvm-gcc${EXEEXT}"
|
||||||
LLVMGXX="llvm-g++${EXEEXT}"
|
LLVMGXX="llvm-g++${EXEEXT}"
|
||||||
AC_PATH_PROG(LLVMGCC, $LLVMGCC, [])
|
AC_PATH_PROG(LLVMGCC, $LLVMGCC, [])
|
||||||
AC_PATH_PROG(LLVMGXX, $LLVMGXX, [])
|
AC_PATH_PROG(LLVMGXX, $LLVMGXX, [])
|
||||||
else
|
else
|
||||||
if test -z "$LLVMGCC"; then
|
|
||||||
LLVMGCC="$WITH_LLVMGCCDIR/bin/llvm-gcc${EXEEXT}"
|
LLVMGCC="$WITH_LLVMGCCDIR/bin/llvm-gcc${EXEEXT}"
|
||||||
fi
|
|
||||||
if test -z "$LLVMGXX"; then
|
|
||||||
LLVMGXX="$WITH_LLVMGCCDIR/bin/llvm-g++${EXEEXT}"
|
LLVMGXX="$WITH_LLVMGCCDIR/bin/llvm-g++${EXEEXT}"
|
||||||
fi
|
|
||||||
AC_SUBST(LLVMGCC,$LLVMGCC)
|
AC_SUBST(LLVMGCC,$LLVMGCC)
|
||||||
AC_SUBST(LLVMGXX,$LLVMGXX)
|
AC_SUBST(LLVMGXX,$LLVMGXX)
|
||||||
fi
|
fi
|
||||||
@@ -683,10 +585,11 @@ fi
|
|||||||
dnl Verify that GCC is version 3.0 or higher
|
dnl Verify that GCC is version 3.0 or higher
|
||||||
if test "$GCC" = "yes"
|
if test "$GCC" = "yes"
|
||||||
then
|
then
|
||||||
AC_COMPILE_IFELSE([[#if !defined(__GNUC__) || __GNUC__ < 3
|
gccmajor=`$CC --version | head -n 1 | sed 's/[[^0-9]]*\([[0-9.]]\).*/\1/'`
|
||||||
#error Unsupported GCC version
|
if test "$gccmajor" -lt "3"
|
||||||
#endif
|
then
|
||||||
]], [], [AC_MSG_ERROR([gcc 3.x required, but you have a lower version])])
|
AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Check for GNU Make. We use its extensions, so don't build without it
|
dnl Check for GNU Make. We use its extensions, so don't build without it
|
||||||
@@ -712,6 +615,12 @@ if test "$llvm_cv_os_type" = "MingW" ; then
|
|||||||
AC_CHECK_LIB(psapi, main)
|
AC_CHECK_LIB(psapi, main)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl lt_dlopen may be required for plugin support.
|
||||||
|
AC_SEARCH_LIBS(lt_dlopen,ltdl,AC_DEFINE([HAVE_LT_DLOPEN],[1],
|
||||||
|
[Define if lt_dlopen() is available on this platform]),
|
||||||
|
AC_MSG_WARN([lt_dlopen() not found - plugin support might
|
||||||
|
not be available]))
|
||||||
|
|
||||||
dnl dlopen() is required for plugin support.
|
dnl dlopen() is required for plugin support.
|
||||||
AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1],
|
AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1],
|
||||||
[Define if dlopen() is available on this platform.]),
|
[Define if dlopen() is available on this platform.]),
|
||||||
@@ -768,11 +677,10 @@ AC_HEADER_TIME
|
|||||||
|
|
||||||
AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
|
AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
|
||||||
AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h unistd.h utime.h])
|
AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h unistd.h utime.h])
|
||||||
AC_CHECK_HEADERS([windows.h])
|
AC_CHECK_HEADERS([windows.h sys/mman.h sys/param.h sys/resource.h sys/time.h])
|
||||||
AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h])
|
|
||||||
AC_CHECK_HEADERS([sys/types.h malloc/malloc.h mach/mach.h])
|
AC_CHECK_HEADERS([sys/types.h malloc/malloc.h mach/mach.h])
|
||||||
if test "$ENABLE_THREADS" -eq 1 ; then
|
if test "$ENABLE_THREADS" -eq 1 ; then
|
||||||
AC_CHECK_HEADERS(pthread.h,
|
AC_CHECK_HEADER(pthread.h,
|
||||||
AC_SUBST(HAVE_PTHREAD, 1),
|
AC_SUBST(HAVE_PTHREAD, 1),
|
||||||
AC_SUBST(HAVE_PTHREAD, 0))
|
AC_SUBST(HAVE_PTHREAD, 0))
|
||||||
else
|
else
|
||||||
@@ -802,8 +710,7 @@ dnl===
|
|||||||
dnl===-----------------------------------------------------------------------===
|
dnl===-----------------------------------------------------------------------===
|
||||||
|
|
||||||
AC_CHECK_FUNCS([backtrace ceilf floorf roundf rintf nearbyintf getcwd ])
|
AC_CHECK_FUNCS([backtrace ceilf floorf roundf rintf nearbyintf getcwd ])
|
||||||
AC_CHECK_FUNCS([powf fmodf strtof round ])
|
AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday])
|
||||||
AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ])
|
|
||||||
AC_CHECK_FUNCS([isatty mkdtemp mkstemp ])
|
AC_CHECK_FUNCS([isatty mkdtemp mkstemp ])
|
||||||
AC_CHECK_FUNCS([mktemp realpath sbrk setrlimit strdup strerror strerror_r ])
|
AC_CHECK_FUNCS([mktemp realpath sbrk setrlimit strdup strerror strerror_r ])
|
||||||
AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
|
AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
|
||||||
@@ -846,9 +753,6 @@ dnl=== SECTION 9: Additional checks, variables, etc.
|
|||||||
dnl===
|
dnl===
|
||||||
dnl===-----------------------------------------------------------------------===
|
dnl===-----------------------------------------------------------------------===
|
||||||
|
|
||||||
dnl Check, whether __dso_handle is present
|
|
||||||
AC_CHECK_FUNCS([__dso_handle])
|
|
||||||
|
|
||||||
dnl See if the llvm-gcc executable can compile to LLVM assembly
|
dnl See if the llvm-gcc executable can compile to LLVM assembly
|
||||||
AC_CACHE_CHECK([whether llvm-gcc is sane],[llvm_cv_llvmgcc_sanity],
|
AC_CACHE_CHECK([whether llvm-gcc is sane],[llvm_cv_llvmgcc_sanity],
|
||||||
[llvm_cv_llvmgcc_sanity="no"
|
[llvm_cv_llvmgcc_sanity="no"
|
||||||
@@ -877,7 +781,7 @@ if test "$llvm_cv_llvmgcc_sanity" = "yes" ; then
|
|||||||
llvmgccmajvers=[`echo $llvmgccversion | sed 's/^\([0-9]\).*/\1/'`]
|
llvmgccmajvers=[`echo $llvmgccversion | sed 's/^\([0-9]\).*/\1/'`]
|
||||||
AC_SUBST(LLVMGCC_VERSION,$llvmgccversion)
|
AC_SUBST(LLVMGCC_VERSION,$llvmgccversion)
|
||||||
AC_SUBST(LLVMGCC_MAJVERS,$llvmgccmajvers)
|
AC_SUBST(LLVMGCC_MAJVERS,$llvmgccmajvers)
|
||||||
llvmgcclangs=[`"$LLVMGCC" -v --help 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ ]*\).*/\1/'`]
|
llvmgcclangs=[`"$LLVMGCC" -v --help 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ -]*\).*/\1/'`]
|
||||||
AC_SUBST(LLVMGCC_LANGS,$llvmgcclangs)
|
AC_SUBST(LLVMGCC_LANGS,$llvmgcclangs)
|
||||||
AC_MSG_RESULT([ok])
|
AC_MSG_RESULT([ok])
|
||||||
fi
|
fi
|
||||||
@@ -923,7 +827,7 @@ AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR",
|
|||||||
[Installation directory for libraries])
|
[Installation directory for libraries])
|
||||||
AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR",
|
AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR",
|
||||||
[Installation directory for data files])
|
[Installation directory for data files])
|
||||||
AC_DEFINE_UNQUOTED(LLVM_DOCSDIR, "$LLVM_DOCSDIR",
|
AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR",
|
||||||
[Installation directory for documentation])
|
[Installation directory for documentation])
|
||||||
AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR",
|
AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR",
|
||||||
[Installation directory for config files])
|
[Installation directory for config files])
|
||||||
@@ -935,61 +839,6 @@ AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR",
|
|||||||
[Installation directory for man pages])
|
[Installation directory for man pages])
|
||||||
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
|
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
|
||||||
[Time at which LLVM was configured])
|
[Time at which LLVM was configured])
|
||||||
AC_DEFINE_UNQUOTED(LLVM_HOSTTRIPLE, "$host",
|
|
||||||
[Host triple we were built on])
|
|
||||||
|
|
||||||
# Determine which bindings to build.
|
|
||||||
if test "$BINDINGS_TO_BUILD" = auto ; then
|
|
||||||
BINDINGS_TO_BUILD=""
|
|
||||||
if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then
|
|
||||||
BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
AC_SUBST(BINDINGS_TO_BUILD,$BINDINGS_TO_BUILD)
|
|
||||||
|
|
||||||
# This isn't really configurey, but it avoids having to repeat the list in
|
|
||||||
# other files.
|
|
||||||
AC_SUBST(ALL_BINDINGS,ocaml)
|
|
||||||
|
|
||||||
# Do any work necessary to ensure that bindings have what they need.
|
|
||||||
binding_prereqs_failed=0
|
|
||||||
for a_binding in $BINDINGS_TO_BUILD ; do
|
|
||||||
case "$a_binding" in
|
|
||||||
ocaml)
|
|
||||||
if test "x$OCAMLC" = x ; then
|
|
||||||
AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc])
|
|
||||||
binding_prereqs_failed=1
|
|
||||||
fi
|
|
||||||
if test "x$OCAMLDEP" = x ; then
|
|
||||||
AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep])
|
|
||||||
binding_prereqs_failed=1
|
|
||||||
fi
|
|
||||||
if test "x$OCAMLOPT" = x ; then
|
|
||||||
AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt])
|
|
||||||
dnl ocamlopt is optional!
|
|
||||||
fi
|
|
||||||
if test "x$with_ocaml_libdir" != xauto ; then
|
|
||||||
AC_SUBST(OCAML_LIBDIR,$with_ocaml_libdir)
|
|
||||||
else
|
|
||||||
ocaml_stdlib="`"$OCAMLC" -where`"
|
|
||||||
if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~"
|
|
||||||
then
|
|
||||||
# ocaml stdlib is beneath our prefix; use stdlib
|
|
||||||
AC_SUBST(OCAML_LIBDIR,$ocaml_stdlib)
|
|
||||||
else
|
|
||||||
# ocaml stdlib is outside our prefix; use libdir/ocaml
|
|
||||||
AC_SUBST(OCAML_LIBDIR,$LLVM_LIBDIR/ocaml)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
if test "$binding_prereqs_failed" = 1 ; then
|
|
||||||
AC_MSG_ERROR([Prequisites for bindings not satisfied. Fix them or use configure --disable-bindings.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Determine if the compiler supports -fvisibility-inlines-hidden.
|
|
||||||
AC_CXX_USE_VISIBILITY_INLINES_HIDDEN
|
|
||||||
|
|
||||||
dnl===-----------------------------------------------------------------------===
|
dnl===-----------------------------------------------------------------------===
|
||||||
dnl===
|
dnl===
|
||||||
@@ -1004,9 +853,9 @@ dnl contains the same list of files as AC_CONFIG_HEADERS below. This ensures the
|
|||||||
dnl files can be updated automatically when their *.in sources change.
|
dnl files can be updated automatically when their *.in sources change.
|
||||||
AC_CONFIG_HEADERS([include/llvm/Config/config.h])
|
AC_CONFIG_HEADERS([include/llvm/Config/config.h])
|
||||||
AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h])
|
AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h])
|
||||||
AC_CONFIG_HEADERS([include/llvm/ADT/hash_map.h])
|
AC_CONFIG_HEADERS([include/llvm/ADT/hash_map])
|
||||||
AC_CONFIG_HEADERS([include/llvm/ADT/hash_set.h])
|
AC_CONFIG_HEADERS([include/llvm/ADT/hash_set])
|
||||||
AC_CONFIG_HEADERS([include/llvm/ADT/iterator.h])
|
AC_CONFIG_HEADERS([include/llvm/ADT/iterator])
|
||||||
|
|
||||||
dnl Configure the makefile's configuration data
|
dnl Configure the makefile's configuration data
|
||||||
AC_CONFIG_FILES([Makefile.config])
|
AC_CONFIG_FILES([Makefile.config])
|
||||||
@@ -1029,12 +878,10 @@ AC_CONFIG_MAKEFILE(lib/Makefile)
|
|||||||
AC_CONFIG_MAKEFILE(runtime/Makefile)
|
AC_CONFIG_MAKEFILE(runtime/Makefile)
|
||||||
AC_CONFIG_MAKEFILE(test/Makefile)
|
AC_CONFIG_MAKEFILE(test/Makefile)
|
||||||
AC_CONFIG_MAKEFILE(test/Makefile.tests)
|
AC_CONFIG_MAKEFILE(test/Makefile.tests)
|
||||||
AC_CONFIG_MAKEFILE(unittests/Makefile)
|
|
||||||
AC_CONFIG_MAKEFILE(tools/Makefile)
|
AC_CONFIG_MAKEFILE(tools/Makefile)
|
||||||
AC_CONFIG_MAKEFILE(utils/Makefile)
|
AC_CONFIG_MAKEFILE(utils/Makefile)
|
||||||
AC_CONFIG_MAKEFILE(projects/Makefile)
|
AC_CONFIG_MAKEFILE(projects/Makefile)
|
||||||
AC_CONFIG_MAKEFILE(bindings/Makefile)
|
|
||||||
AC_CONFIG_MAKEFILE(bindings/ocaml/Makefile.ocaml)
|
|
||||||
|
|
||||||
dnl Finally, crank out the output
|
dnl Finally, crank out the output
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
|||||||
0
llvm/autoconf/install-sh
Executable file → Normal file
0
llvm/autoconf/install-sh
Executable file → Normal file
@@ -25,7 +25,7 @@ else
|
|||||||
if AC_TRY_EVAL(ac_build_link); then
|
if AC_TRY_EVAL(ac_build_link); then
|
||||||
for file in conftest.*; do
|
for file in conftest.*; do
|
||||||
case $file in
|
case $file in
|
||||||
*.c | *.o | *.obj | *.dSYM) ;;
|
*.c | *.o | *.obj) ;;
|
||||||
*) ac_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
|
*) ac_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|||||||
6
llvm/autoconf/m4/libtool.m4
vendored
6
llvm/autoconf/m4/libtool.m4
vendored
@@ -1905,7 +1905,7 @@ AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
|||||||
AC_DEFUN([AC_ENABLE_SHARED],
|
AC_DEFUN([AC_ENABLE_SHARED],
|
||||||
[define([enable_shared_default], ifelse($1, no, no, yes))dnl
|
[define([enable_shared_default], ifelse($1, no, no, yes))dnl
|
||||||
AC_ARG_ENABLE([shared],
|
AC_ARG_ENABLE([shared],
|
||||||
AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],[build shared libraries @<:@default=enable_shared_default@:>@]),
|
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],[build shared libraries @<:@default=enable_shared_default@:>@])],
|
||||||
[p=${PACKAGE-default}
|
[p=${PACKAGE-default}
|
||||||
case $enableval in
|
case $enableval in
|
||||||
yes) enable_shared=yes ;;
|
yes) enable_shared=yes ;;
|
||||||
@@ -1943,7 +1943,7 @@ AC_ENABLE_SHARED(no)
|
|||||||
AC_DEFUN([AC_ENABLE_STATIC],
|
AC_DEFUN([AC_ENABLE_STATIC],
|
||||||
[define([enable_static_default], ifelse($1, no, no, yes))dnl
|
[define([enable_static_default], ifelse($1, no, no, yes))dnl
|
||||||
AC_ARG_ENABLE([static],
|
AC_ARG_ENABLE([static],
|
||||||
AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],[build static libraries @<:@default=enable_static_default@:>@]),
|
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],[build static libraries @<:@default=enable_static_default@:>@])],
|
||||||
[p=${PACKAGE-default}
|
[p=${PACKAGE-default}
|
||||||
case $enableval in
|
case $enableval in
|
||||||
yes) enable_static=yes ;;
|
yes) enable_static=yes ;;
|
||||||
@@ -1981,7 +1981,7 @@ AC_ENABLE_STATIC(no)
|
|||||||
AC_DEFUN([AC_ENABLE_FAST_INSTALL],
|
AC_DEFUN([AC_ENABLE_FAST_INSTALL],
|
||||||
[define([enable_Fast_install_default], ifelse($1, no, no, yes))dnl
|
[define([enable_Fast_install_default], ifelse($1, no, no, yes))dnl
|
||||||
AC_ARG_ENABLE([fast-install],
|
AC_ARG_ENABLE([fast-install],
|
||||||
AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],[optimize for fast installation @<:@default=enable_Fast_install_default@:>@]),
|
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],[optimize for fast installation @<:@default=enable_Fast_install_default@:>@])],
|
||||||
[p=${PACKAGE-default}
|
[p=${PACKAGE-default}
|
||||||
case $enableval in
|
case $enableval in
|
||||||
yes) enable_fast_install=yes ;;
|
yes) enable_fast_install=yes ;;
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
#
|
|
||||||
# Determine if the compiler accepts -fvisibility-inlines-hidden
|
|
||||||
#
|
|
||||||
# This macro is specific to LLVM.
|
|
||||||
#
|
|
||||||
AC_DEFUN([AC_CXX_USE_VISIBILITY_INLINES_HIDDEN],
|
|
||||||
[AC_CACHE_CHECK([for compiler -fvisibility-inlines-hidden option],
|
|
||||||
[llvm_cv_cxx_visibility_inlines_hidden],
|
|
||||||
[ AC_LANG_PUSH([C++])
|
|
||||||
oldcxxflags="$CXXFLAGS"
|
|
||||||
CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
|
|
||||||
[llvm_cv_cxx_visibility_inlines_hidden=yes],[llvm_cv_cxx_visibility_inlines_hidden=no])
|
|
||||||
CXXFLAGS="$oldcxxflags"
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
])
|
|
||||||
if test "$llvm_cv_cxx_visibility_inlines_hidden" = yes ; then
|
|
||||||
AC_SUBST([ENABLE_VISIBILITY_INLINES_HIDDEN],[1])
|
|
||||||
else
|
|
||||||
AC_SUBST([ENABLE_VISIBILITY_INLINES_HIDDEN],[0])
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
##===- bindings/Makefile -----------------------------------*- Makefile -*-===##
|
|
||||||
#
|
|
||||||
# The LLVM Compiler Infrastructure
|
|
||||||
#
|
|
||||||
# This file is distributed under the University of Illinois Open Source
|
|
||||||
# License. See LICENSE.TXT for details.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
LEVEL := ..
|
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.config
|
|
||||||
|
|
||||||
PARALLEL_DIRS = $(BINDINGS_TO_BUILD)
|
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.common
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
This directory contains bindings for the LLVM compiler infrastructure to allow
|
|
||||||
programs written in languages other than C or C++ to take advantage of the LLVM
|
|
||||||
infrastructure--for instance, a self-hosted compiler front-end.
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
##===- bindings/ocaml/Makefile -----------------------------*- Makefile -*-===##
|
|
||||||
#
|
|
||||||
# The LLVM Compiler Infrastructure
|
|
||||||
#
|
|
||||||
# This file is distributed under the University of Illinois Open Source
|
|
||||||
# License. See LICENSE.TXT for details.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
LEVEL := ../..
|
|
||||||
DIRS = llvm bitreader bitwriter analysis target executionengine transforms
|
|
||||||
ExtraMakefiles = $(PROJ_OBJ_DIR)/Makefile.ocaml
|
|
||||||
|
|
||||||
ocamldoc:
|
|
||||||
$(Verb) for i in $(DIRS) ; do \
|
|
||||||
$(MAKE) -C $$i ocamldoc; \
|
|
||||||
done
|
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.common
|
|
||||||
@@ -1,338 +0,0 @@
|
|||||||
##===- tools/ml/Makefile -----------------------------------*- Makefile -*-===##
|
|
||||||
#
|
|
||||||
# The LLVM Compiler Infrastructure
|
|
||||||
#
|
|
||||||
# This file is distributed under the University of Illinois Open Source
|
|
||||||
# License. See LICENSE.TXT for details.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
#
|
|
||||||
# An ocaml library is a unique project type in the context of LLVM, so rules are
|
|
||||||
# here rather than in Makefile.rules.
|
|
||||||
#
|
|
||||||
# Reference materials on installing ocaml libraries:
|
|
||||||
#
|
|
||||||
# https://fedoraproject.org/wiki/Packaging/OCaml
|
|
||||||
# http://pkg-ocaml-maint.alioth.debian.org/ocaml_packaging_policy.txt
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.config
|
|
||||||
|
|
||||||
# CFLAGS needs to be set before Makefile.rules is included.
|
|
||||||
CXX.Flags += -I"$(shell $(OCAMLC) -where)"
|
|
||||||
C.Flags += -I"$(shell $(OCAMLC) -where)"
|
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.common
|
|
||||||
|
|
||||||
# Intentionally ignore PROJ_prefix here. We want the ocaml stdlib. However, the
|
|
||||||
# user can override this with OCAML_LIBDIR or configure --with-ocaml-libdir=.
|
|
||||||
PROJ_libocamldir := $(DESTDIR)$(OCAML_LIBDIR)
|
|
||||||
OcamlDir := $(LibDir)/ocaml
|
|
||||||
|
|
||||||
# Info from llvm-config and similar
|
|
||||||
ifdef UsedComponents
|
|
||||||
UsedLibs = $(shell $(LLVM_CONFIG) --libs $(UsedComponents))
|
|
||||||
UsedLibNames = $(shell $(LLVM_CONFIG) --libnames $(UsedComponents))
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Tools
|
|
||||||
OCAMLCFLAGS += -I $(OcamlDir) -I $(ObjDir)
|
|
||||||
ifneq ($(ObjectsO),)
|
|
||||||
OCAMLAFLAGS += $(patsubst %,-cclib %, \
|
|
||||||
$(filter-out -L$(LibDir),-l$(LIBRARYNAME) \
|
|
||||||
$(shell $(LLVM_CONFIG) --ldflags)) \
|
|
||||||
$(UsedLibs))
|
|
||||||
else
|
|
||||||
OCAMLAFLAGS += $(patsubst %,-cclib %, \
|
|
||||||
$(filter-out -L$(LibDir),$(shell $(LLVM_CONFIG) --ldflags)) \
|
|
||||||
$(UsedLibs))
|
|
||||||
endif
|
|
||||||
|
|
||||||
# -g was introduced in 3.10.0.
|
|
||||||
#ifneq ($(ENABLE_OPTIMIZED),1)
|
|
||||||
# OCAMLDEBUGFLAG := -g
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Compile.CMI := $(strip $(OCAMLC) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
|
|
||||||
Compile.CMO := $(strip $(OCAMLC) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
|
|
||||||
Archive.CMA := $(strip $(OCAMLC) -a -custom $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \
|
|
||||||
-o)
|
|
||||||
|
|
||||||
Compile.CMX := $(strip $(OCAMLOPT) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
|
|
||||||
Archive.CMXA := $(strip $(OCAMLOPT) -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o)
|
|
||||||
|
|
||||||
# Source files
|
|
||||||
OcamlSources1 := $(sort $(wildcard $(PROJ_SRC_DIR)/*.ml))
|
|
||||||
OcamlHeaders1 := $(OcamlSources1:.ml=.mli)
|
|
||||||
|
|
||||||
OcamlSources := $(OcamlSources1:$(PROJ_SRC_DIR)/%=$(ObjDir)/%)
|
|
||||||
OcamlHeaders := $(OcamlHeaders1:$(PROJ_SRC_DIR)/%=$(ObjDir)/%)
|
|
||||||
|
|
||||||
# Intermediate files
|
|
||||||
LibraryCMA := $(ObjDir)/$(LIBRARYNAME).cma
|
|
||||||
LibraryCMXA := $(ObjDir)/$(LIBRARYNAME).cmxa
|
|
||||||
ObjectsCMI := $(OcamlSources:%.ml=%.cmi)
|
|
||||||
ObjectsCMO := $(OcamlSources:%.ml=%.cmo)
|
|
||||||
ObjectsCMX := $(OcamlSources:%.ml=%.cmx)
|
|
||||||
|
|
||||||
# Output files
|
|
||||||
# The .cmo files are the only intermediates; all others are to be installed.
|
|
||||||
LibraryA := $(OcamlDir)/lib$(LIBRARYNAME).a
|
|
||||||
OutputCMA := $(LibraryCMA:$(ObjDir)/%.cma=$(OcamlDir)/%.cma)
|
|
||||||
OutputCMXA := $(LibraryCMXA:$(ObjDir)/%.cmxa=$(OcamlDir)/%.cmxa)
|
|
||||||
OutputsCMI := $(ObjectsCMI:$(ObjDir)/%.cmi=$(OcamlDir)/%.cmi)
|
|
||||||
OutputsCMX := $(ObjectsCMX:$(ObjDir)/%.cmx=$(OcamlDir)/%.cmx)
|
|
||||||
OutputLibs := $(UsedLibNames:%=$(OcamlDir)/%)
|
|
||||||
|
|
||||||
# Installation targets
|
|
||||||
DestA := $(PROJ_libocamldir)/lib$(LIBRARYNAME).a
|
|
||||||
DestCMA := $(PROJ_libocamldir)/$(LIBRARYNAME).cma
|
|
||||||
DestCMXA := $(PROJ_libocamldir)/$(LIBRARYNAME).cmxa
|
|
||||||
DestLibs := $(UsedLibNames:%=$(PROJ_libocamldir)/%)
|
|
||||||
|
|
||||||
|
|
||||||
##===- Dependencies -------------------------------------------------------===##
|
|
||||||
# Copy the sources into the intermediate directory because older ocamlc doesn't
|
|
||||||
# support -o except when linking (outputs are placed next to inputs).
|
|
||||||
|
|
||||||
$(ObjDir)/%.mli: $(PROJ_SRC_DIR)/%.mli $(ObjDir)/.dir
|
|
||||||
$(Verb) $(CP) -f $< $@
|
|
||||||
|
|
||||||
$(ObjDir)/%.ml: $(PROJ_SRC_DIR)/%.ml $(ObjDir)/.dir
|
|
||||||
$(Verb) $(CP) -f $< $@
|
|
||||||
|
|
||||||
$(ObjDir)/$(LIBRARYNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) \
|
|
||||||
$(OcamlDir)/.dir $(ObjDir)/.dir
|
|
||||||
$(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeaders) > $@
|
|
||||||
|
|
||||||
$(ObjectsCMI): $(UsedOcamlInterfaces:%=$(OcamlDir)/%.cmi)
|
|
||||||
|
|
||||||
-include $(ObjDir)/$(LIBRARYNAME).ocamldep
|
|
||||||
|
|
||||||
|
|
||||||
##===- Build static library from C sources --------------------------------===##
|
|
||||||
|
|
||||||
ifneq ($(ObjectsO),)
|
|
||||||
all-local:: $(LibraryA)
|
|
||||||
clean-local:: clean-a
|
|
||||||
install-local:: install-a
|
|
||||||
uninstall-local:: uninstall-a
|
|
||||||
|
|
||||||
$(LibraryA): $(ObjectsO) $(OcamlDir)/.dir
|
|
||||||
$(Echo) "Building $(BuildMode) $(notdir $@)"
|
|
||||||
-$(Verb) $(RM) -f $@
|
|
||||||
$(Verb) $(Archive) $@ $(ObjectsO)
|
|
||||||
$(Verb) $(Ranlib) $@
|
|
||||||
|
|
||||||
clean-a::
|
|
||||||
-$(Verb) $(RM) -f $(LibraryA)
|
|
||||||
|
|
||||||
install-a:: $(LibraryA)
|
|
||||||
$(Echo) "Installing $(BuildMode) $(DestA)"
|
|
||||||
$(Verb) $(MKDIR) $(PROJ_libocamldir)
|
|
||||||
$(Verb) $(LTInstall) $(LibraryA) $(DestA)
|
|
||||||
$(Verb)
|
|
||||||
|
|
||||||
uninstall-a::
|
|
||||||
$(Echo) "Uninstalling $(DestA)"
|
|
||||||
-$(Verb) $(RM) -f $(DestA)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
##===- Deposit dependent libraries adjacent to Ocaml libs -----------------===##
|
|
||||||
|
|
||||||
all-local:: build-deplibs
|
|
||||||
clean-local:: clean-deplibs
|
|
||||||
install-local:: install-deplibs
|
|
||||||
uninstall-local:: uninstall-deplibs
|
|
||||||
|
|
||||||
build-deplibs: $(OutputLibs)
|
|
||||||
|
|
||||||
$(OcamlDir)/%.a: $(LibDir)/%.a
|
|
||||||
$(Verb) ln -sf $< $@
|
|
||||||
|
|
||||||
$(OcamlDir)/%.o: $(LibDir)/%.o
|
|
||||||
$(Verb) ln -sf $< $@
|
|
||||||
|
|
||||||
clean-deplibs:
|
|
||||||
$(Verb) rm -f $(OutputLibs)
|
|
||||||
|
|
||||||
install-deplibs:
|
|
||||||
$(Verb) for i in $(DestLibs:$(PROJ_libocamldir)/%=%); do \
|
|
||||||
ln -sf "$(PROJ_libdir)/$$i" "$(PROJ_libocamldir)/$$i"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
uninstall-deplibs:
|
|
||||||
$(Verb) rm -f $(DestLibs)
|
|
||||||
|
|
||||||
|
|
||||||
##===- Build ocaml interfaces (.mli's -> .cmi's) --------------------------===##
|
|
||||||
|
|
||||||
all-local:: build-cmis
|
|
||||||
clean-local:: clean-cmis
|
|
||||||
install-local:: install-cmis
|
|
||||||
uninstall-local:: uninstall-cmis
|
|
||||||
|
|
||||||
build-cmis: $(OutputsCMI)
|
|
||||||
|
|
||||||
$(OcamlDir)/%.cmi: $(ObjDir)/%.cmi $(OcamlDir)/.dir
|
|
||||||
$(Verb) $(CP) -f $< $@
|
|
||||||
|
|
||||||
$(ObjDir)/%.cmi: $(ObjDir)/%.mli $(ObjDir)/.dir
|
|
||||||
$(Echo) "Compiling $(notdir $<) for $(BuildMode) build"
|
|
||||||
$(Verb) $(Compile.CMI) $@ $<
|
|
||||||
|
|
||||||
clean-cmis::
|
|
||||||
-$(Verb) $(RM) -f $(OutputsCMI)
|
|
||||||
|
|
||||||
# Also install the .mli's (headers) as documentation.
|
|
||||||
install-cmis: $(OutputsCMI) $(OcamlHeaders)
|
|
||||||
$(Verb) $(MKDIR) $(PROJ_libocamldir)
|
|
||||||
$(Verb) for i in $(OutputsCMI:$(OcamlDir)/%=%); do \
|
|
||||||
$(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \
|
|
||||||
$(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \
|
|
||||||
done
|
|
||||||
$(Verb) for i in $(OcamlHeaders:$(ObjDir)/%=%); do \
|
|
||||||
$(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \
|
|
||||||
$(DataInstall) $(ObjDir)/$$i "$(PROJ_libocamldir)/$$i"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
uninstall-cmis::
|
|
||||||
$(Verb) for i in $(OutputsCMI:$(OcamlDir)/%=%); do \
|
|
||||||
$(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \
|
|
||||||
$(RM) -f "$(PROJ_libocamldir)/$$i"; \
|
|
||||||
done
|
|
||||||
$(Verb) for i in $(OcamlHeaders:$(ObjDir)/%=%); do \
|
|
||||||
$(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \
|
|
||||||
$(RM) -f "$(PROJ_libocamldir)/$$i"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
##===- Build ocaml bytecode archive (.ml's -> .cmo's -> .cma) -------------===##
|
|
||||||
|
|
||||||
all-local:: $(OutputCMA)
|
|
||||||
clean-local:: clean-cma
|
|
||||||
install-local:: install-cma
|
|
||||||
uninstall-local:: uninstall-cma
|
|
||||||
|
|
||||||
$(OutputCMA): $(LibraryCMA) $(OcamlDir)/.dir
|
|
||||||
$(Verb) $(CP) -f $< $@
|
|
||||||
|
|
||||||
$(LibraryCMA): $(ObjectsCMO) $(OcamlDir)/.dir
|
|
||||||
$(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
|
|
||||||
$(Verb) $(Archive.CMA) $@ $(ObjectsCMO)
|
|
||||||
|
|
||||||
$(ObjDir)/%.cmo: $(ObjDir)/%.ml
|
|
||||||
$(Echo) "Compiling $(notdir $<) for $(BuildMode) build"
|
|
||||||
$(Verb) $(Compile.CMO) $@ $<
|
|
||||||
|
|
||||||
clean-cma::
|
|
||||||
$(Verb) $(RM) -f $(OutputCMA) $(UsedLibNames:%=$(OcamlDir)/%)
|
|
||||||
|
|
||||||
install-cma:: $(OutputCMA)
|
|
||||||
$(Echo) "Installing $(BuildMode) $(DestCMA)"
|
|
||||||
$(Verb) $(MKDIR) $(PROJ_libocamldir)
|
|
||||||
$(Verb) $(DataInstall) $(OutputCMA) "$(DestCMA)"
|
|
||||||
|
|
||||||
uninstall-cma::
|
|
||||||
$(Echo) "Uninstalling $(DestCMA)"
|
|
||||||
-$(Verb) $(RM) -f $(DestCMA)
|
|
||||||
|
|
||||||
|
|
||||||
##===- Build optimized ocaml archive (.ml's -> .cmx's -> .cmxa, .a) -------===##
|
|
||||||
|
|
||||||
# The ocamlopt compiler is supported on a set of targets disjoint from LLVM's.
|
|
||||||
# If unavailable, 'configure' will not define OCAMLOPT in Makefile.config.
|
|
||||||
ifdef OCAMLOPT
|
|
||||||
|
|
||||||
all-local:: $(OutputCMXA) $(OutputsCMX)
|
|
||||||
clean-local:: clean-cmxa
|
|
||||||
install-local:: install-cmxa
|
|
||||||
uninstall-local:: uninstall-cmxa
|
|
||||||
|
|
||||||
$(OutputCMXA): $(LibraryCMXA)
|
|
||||||
$(Verb) $(CP) -f $< $@
|
|
||||||
$(Verb) $(CP) -f $(<:.cmxa=.a) $(@:.cmxa=.a)
|
|
||||||
|
|
||||||
$(OcamlDir)/%.cmx: $(ObjDir)/%.cmx
|
|
||||||
$(Verb) $(CP) -f $< $@
|
|
||||||
|
|
||||||
$(LibraryCMXA): $(ObjectsCMX)
|
|
||||||
$(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
|
|
||||||
$(Verb) $(Archive.CMXA) $@ $(ObjectsCMX)
|
|
||||||
$(Verb) $(RM) -f $(@:.cmxa=.o)
|
|
||||||
|
|
||||||
$(ObjDir)/%.cmx: $(ObjDir)/%.ml
|
|
||||||
$(Echo) "Compiling optimized $(notdir $<) for $(BuildMode) build"
|
|
||||||
$(Verb) $(Compile.CMX) $@ $<
|
|
||||||
|
|
||||||
clean-cmxa::
|
|
||||||
$(Verb) $(RM) -f $(OutputCMXA) $(OutputCMXA:.cmxa=.a) $(OutputsCMX)
|
|
||||||
|
|
||||||
install-cmxa:: $(OutputCMXA) $(OutputsCMX)
|
|
||||||
$(Verb) $(MKDIR) $(PROJ_libocamldir)
|
|
||||||
$(Echo) "Installing $(BuildMode) $(DestCMXA)"
|
|
||||||
$(Verb) $(DataInstall) $(OutputCMXA) $(DestCMXA)
|
|
||||||
$(Echo) "Installing $(BuildMode) $(DestCMXA:.cmxa=.a)"
|
|
||||||
$(Verb) $(DataInstall) $(OutputCMXA:.cmxa=.a) $(DestCMXA:.cmxa=.a)
|
|
||||||
$(Verb) for i in $(OutputsCMX:$(OcamlDir)/%=%); do \
|
|
||||||
$(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \
|
|
||||||
$(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
uninstall-cmxa::
|
|
||||||
$(Echo) "Uninstalling $(DestCMXA)"
|
|
||||||
$(Verb) $(RM) -f $(DestCMXA)
|
|
||||||
$(Echo) "Uninstalling $(DestCMXA:.cmxa=.a)"
|
|
||||||
$(Verb) $(RM) -f $(DestCMXA:.cmxa=.a)
|
|
||||||
$(Verb) for i in $(OutputsCMX:$(OcamlDir)/%=%); do \
|
|
||||||
$(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \
|
|
||||||
$(RM) -f $(PROJ_libocamldir)/$$i; \
|
|
||||||
done
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
##===- Generate documentation ---------------------------------------------===##
|
|
||||||
|
|
||||||
$(ObjDir)/$(LIBRARYNAME).odoc: $(ObjectsCMI)
|
|
||||||
$(Echo) "Documenting $(notdir $@)"
|
|
||||||
$(Verb) $(OCAMLDOC) -I $(OcamlDir) -I $(ObjDir) -dump $@ $(OcamlHeaders)
|
|
||||||
|
|
||||||
ocamldoc: $(ObjDir)/$(LIBRARYNAME).odoc
|
|
||||||
|
|
||||||
##===- Debugging gunk -----------------------------------------------------===##
|
|
||||||
printvars:: printcamlvars
|
|
||||||
|
|
||||||
printcamlvars::
|
|
||||||
$(Echo) "LLVM_CONFIG : " '$(LLVM_CONFIG)'
|
|
||||||
$(Echo) "OCAMLCFLAGS : " '$(OCAMLCFLAGS)'
|
|
||||||
$(Echo) "OCAMLAFLAGS : " '$(OCAMLAFLAGS)'
|
|
||||||
$(Echo) "OCAMLC : " '$(OCAMLC)'
|
|
||||||
$(Echo) "OCAMLOPT : " '$(OCAMLOPT)'
|
|
||||||
$(Echo) "OCAMLDEP : " '$(OCAMLDEP)'
|
|
||||||
$(Echo) "Compile.CMI : " '$(Compile.CMI)'
|
|
||||||
$(Echo) "Compile.CMO : " '$(Compile.CMO)'
|
|
||||||
$(Echo) "Archive.CMA : " '$(Archive.CMA)'
|
|
||||||
$(Echo) "Compile.CMX : " '$(Compile.CMX)'
|
|
||||||
$(Echo) "Archive.CMXA : " '$(Archive.CMXA)'
|
|
||||||
$(Echo) "CAML_LIBDIR : " '$(CAML_LIBDIR)'
|
|
||||||
$(Echo) "LibraryCMA : " '$(LibraryCMA)'
|
|
||||||
$(Echo) "LibraryCMXA : " '$(LibraryCMXA)'
|
|
||||||
$(Echo) "OcamlSources1: " '$(OcamlSources1)'
|
|
||||||
$(Echo) "OcamlSources : " '$(OcamlSources)'
|
|
||||||
$(Echo) "OcamlHeaders : " '$(OcamlHeaders)'
|
|
||||||
$(Echo) "ObjectsCMI : " '$(ObjectsCMI)'
|
|
||||||
$(Echo) "ObjectsCMO : " '$(ObjectsCMO)'
|
|
||||||
$(Echo) "ObjectsCMX : " '$(ObjectsCMX)'
|
|
||||||
$(Echo) "OCAML_LIBDIR : " '$(OCAML_LIBDIR)'
|
|
||||||
$(Echo) "DestA : " '$(DestA)'
|
|
||||||
$(Echo) "DestCMA : " '$(DestCMA)'
|
|
||||||
$(Echo) "DestCMXA : " '$(DestCMXA)'
|
|
||||||
$(Echo) "UsedLibs : " '$(UsedLibs)'
|
|
||||||
$(Echo) "UsedLibNames : " '$(UsedLibNames)'
|
|
||||||
|
|
||||||
.PHONY: printcamlvars build-cmis \
|
|
||||||
clean-a clean-cmis clean-cma clean-cmxa \
|
|
||||||
install-a install-cmis install-cma install-cmxa \
|
|
||||||
uninstall-a uninstall-cmis uninstall-cma uninstall-cmxa
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
##===- bindings/ocaml/analysis/Makefile --------------------*- Makefile -*-===##
|
|
||||||
#
|
|
||||||
# The LLVM Compiler Infrastructure
|
|
||||||
#
|
|
||||||
# This file is distributed under the University of Illinois Open Source
|
|
||||||
# License. See LICENSE.TXT for details.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
#
|
|
||||||
# This is the makefile for the Objective Caml Llvm_analysis interface.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
LEVEL := ../../..
|
|
||||||
LIBRARYNAME := llvm_analysis
|
|
||||||
DONT_BUILD_RELINKED := 1
|
|
||||||
UsedComponents := analysis
|
|
||||||
UsedOcamlInterfaces := llvm
|
|
||||||
|
|
||||||
include ../Makefile.ocaml
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
/*===-- analysis_ocaml.c - LLVM Ocaml Glue ----------------------*- C++ -*-===*\
|
|
||||||
|* *|
|
|
||||||
|* The LLVM Compiler Infrastructure *|
|
|
||||||
|* *|
|
|
||||||
|* This file is distributed under the University of Illinois Open Source *|
|
|
||||||
|* License. See LICENSE.TXT for details. *|
|
|
||||||
|* *|
|
|
||||||
|*===----------------------------------------------------------------------===*|
|
|
||||||
|* *|
|
|
||||||
|* This file glues LLVM's ocaml interface to its C interface. These functions *|
|
|
||||||
|* are by and large transparent wrappers to the corresponding C functions. *|
|
|
||||||
|* *|
|
|
||||||
|* Note that these functions intentionally take liberties with the CAMLparamX *|
|
|
||||||
|* macros, since most of the parameters are not GC heap objects. *|
|
|
||||||
|* *|
|
|
||||||
\*===----------------------------------------------------------------------===*/
|
|
||||||
|
|
||||||
#include "llvm-c/Analysis.h"
|
|
||||||
#include "caml/alloc.h"
|
|
||||||
#include "caml/mlvalues.h"
|
|
||||||
#include "caml/memory.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* Llvm.llmodule -> string option */
|
|
||||||
CAMLprim value llvm_verify_module(LLVMModuleRef M) {
|
|
||||||
CAMLparam0();
|
|
||||||
CAMLlocal2(String, Option);
|
|
||||||
|
|
||||||
char *Message;
|
|
||||||
int Result = LLVMVerifyModule(M, LLVMReturnStatusAction, &Message);
|
|
||||||
|
|
||||||
if (0 == Result) {
|
|
||||||
Option = Val_int(0);
|
|
||||||
} else {
|
|
||||||
Option = alloc(1, 0);
|
|
||||||
String = copy_string(Message);
|
|
||||||
Store_field(Option, 0, String);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLVMDisposeMessage(Message);
|
|
||||||
|
|
||||||
CAMLreturn(Option);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Llvm.llvalue -> bool */
|
|
||||||
CAMLprim value llvm_verify_function(LLVMValueRef Fn) {
|
|
||||||
return Val_bool(LLVMVerifyFunction(Fn, LLVMReturnStatusAction) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Llvm.llmodule -> unit */
|
|
||||||
CAMLprim value llvm_assert_valid_module(LLVMModuleRef M) {
|
|
||||||
LLVMVerifyModule(M, LLVMAbortProcessAction, 0);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Llvm.llvalue -> unit */
|
|
||||||
CAMLprim value llvm_assert_valid_function(LLVMValueRef Fn) {
|
|
||||||
LLVMVerifyFunction(Fn, LLVMAbortProcessAction);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Llvm.llvalue -> unit */
|
|
||||||
CAMLprim value llvm_view_function_cfg(LLVMValueRef Fn) {
|
|
||||||
LLVMViewFunctionCFG(Fn);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Llvm.llvalue -> unit */
|
|
||||||
CAMLprim value llvm_view_function_cfg_only(LLVMValueRef Fn) {
|
|
||||||
LLVMViewFunctionCFGOnly(Fn);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
(*===-- llvm_analysis.ml - LLVM Ocaml Interface -----------------*- C++ -*-===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
|
|
||||||
external verify_module : Llvm.llmodule -> string option = "llvm_verify_module"
|
|
||||||
|
|
||||||
external verify_function : Llvm.llvalue -> bool = "llvm_verify_function"
|
|
||||||
|
|
||||||
external assert_valid_module : Llvm.llmodule -> unit
|
|
||||||
= "llvm_assert_valid_module"
|
|
||||||
|
|
||||||
external assert_valid_function : Llvm.llvalue -> unit
|
|
||||||
= "llvm_assert_valid_function"
|
|
||||||
external view_function_cfg : Llvm.llvalue -> unit = "llvm_view_function_cfg"
|
|
||||||
external view_function_cfg_only : Llvm.llvalue -> unit
|
|
||||||
= "llvm_view_function_cfg_only"
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
(*===-- llvm_analysis.mli - LLVM Ocaml Interface ----------------*- C++ -*-===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
(** Intermediate representation analysis.
|
|
||||||
|
|
||||||
This interface provides an ocaml API for LLVM IR analyses, the classes in
|
|
||||||
the Analysis library. *)
|
|
||||||
|
|
||||||
(** [verify_module m] returns [None] if the module [m] is valid, and
|
|
||||||
[Some reason] if it is invalid. [reason] is a string containing a
|
|
||||||
human-readable validation report. See [llvm::verifyModule]. *)
|
|
||||||
external verify_module : Llvm.llmodule -> string option = "llvm_verify_module"
|
|
||||||
|
|
||||||
(** [verify_function f] returns [None] if the function [f] is valid, and
|
|
||||||
[Some reason] if it is invalid. [reason] is a string containing a
|
|
||||||
human-readable validation report. See [llvm::verifyFunction]. *)
|
|
||||||
external verify_function : Llvm.llvalue -> bool = "llvm_verify_function"
|
|
||||||
|
|
||||||
(** [verify_module m] returns if the module [m] is valid, but prints a
|
|
||||||
validation report to [stderr] and aborts the program if it is invalid. See
|
|
||||||
[llvm::verifyModule]. *)
|
|
||||||
external assert_valid_module : Llvm.llmodule -> unit
|
|
||||||
= "llvm_assert_valid_module"
|
|
||||||
|
|
||||||
(** [verify_function f] returns if the function [f] is valid, but prints a
|
|
||||||
validation report to [stderr] and aborts the program if it is invalid. See
|
|
||||||
[llvm::verifyFunction]. *)
|
|
||||||
external assert_valid_function : Llvm.llvalue -> unit
|
|
||||||
= "llvm_assert_valid_function"
|
|
||||||
|
|
||||||
(** [view_function_cfg f] opens up a ghostscript window displaying the CFG of
|
|
||||||
the current function with the code for each basic block inside.
|
|
||||||
See [llvm::Function::viewCFG]. *)
|
|
||||||
external view_function_cfg : Llvm.llvalue -> unit = "llvm_view_function_cfg"
|
|
||||||
|
|
||||||
(** [view_function_cfg_only f] works just like [view_function_cfg], but does not
|
|
||||||
include the contents of basic blocks into the nodes.
|
|
||||||
See [llvm::Function::viewCFGOnly]. *)
|
|
||||||
external view_function_cfg_only : Llvm.llvalue -> unit
|
|
||||||
= "llvm_view_function_cfg_only"
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
##===- bindings/ocaml/bitreader/Makefile -------------------*- Makefile -*-===##
|
|
||||||
#
|
|
||||||
# The LLVM Compiler Infrastructure
|
|
||||||
#
|
|
||||||
# This file is distributed under the University of Illinois Open Source
|
|
||||||
# License. See LICENSE.TXT for details.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
#
|
|
||||||
# This is the makefile for the Objective Caml Llvm_bitreader interface.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
LEVEL := ../../..
|
|
||||||
LIBRARYNAME := llvm_bitreader
|
|
||||||
DONT_BUILD_RELINKED := 1
|
|
||||||
UsedComponents := bitreader
|
|
||||||
UsedOcamlInterfaces := llvm
|
|
||||||
|
|
||||||
include ../Makefile.ocaml
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
/*===-- bitwriter_ocaml.c - LLVM Ocaml Glue ---------------------*- C++ -*-===*\
|
|
||||||
|* *|
|
|
||||||
|* The LLVM Compiler Infrastructure *|
|
|
||||||
|* *|
|
|
||||||
|* This file is distributed under the University of Illinois Open Source *|
|
|
||||||
|* License. See LICENSE.TXT for details. *|
|
|
||||||
|* *|
|
|
||||||
|*===----------------------------------------------------------------------===*|
|
|
||||||
|* *|
|
|
||||||
|* This file glues LLVM's ocaml interface to its C interface. These functions *|
|
|
||||||
|* are by and large transparent wrappers to the corresponding C functions. *|
|
|
||||||
|* *|
|
|
||||||
\*===----------------------------------------------------------------------===*/
|
|
||||||
|
|
||||||
#include "llvm-c/BitReader.h"
|
|
||||||
#include "caml/alloc.h"
|
|
||||||
#include "caml/fail.h"
|
|
||||||
#include "caml/memory.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* Can't use the recommended caml_named_value mechanism for backwards
|
|
||||||
compatibility reasons. This is largely equivalent. */
|
|
||||||
static value llvm_bitreader_error_exn;
|
|
||||||
|
|
||||||
CAMLprim value llvm_register_bitreader_exns(value Error) {
|
|
||||||
llvm_bitreader_error_exn = Field(Error, 0);
|
|
||||||
register_global_root(&llvm_bitreader_error_exn);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void llvm_raise(value Prototype, char *Message) {
|
|
||||||
CAMLparam1(Prototype);
|
|
||||||
CAMLlocal1(CamlMessage);
|
|
||||||
|
|
||||||
CamlMessage = copy_string(Message);
|
|
||||||
LLVMDisposeMessage(Message);
|
|
||||||
|
|
||||||
raise_with_arg(Prototype, CamlMessage);
|
|
||||||
abort(); /* NOTREACHED */
|
|
||||||
#ifdef CAMLnoreturn
|
|
||||||
CAMLnoreturn; /* Silences warnings, but is missing in some versions. */
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*===-- Modules -----------------------------------------------------------===*/
|
|
||||||
|
|
||||||
/* Llvm.llmemorybuffer -> Llvm.module */
|
|
||||||
CAMLprim value llvm_get_module_provider(LLVMMemoryBufferRef MemBuf) {
|
|
||||||
CAMLparam0();
|
|
||||||
CAMLlocal2(Variant, MessageVal);
|
|
||||||
char *Message;
|
|
||||||
|
|
||||||
LLVMModuleProviderRef MP;
|
|
||||||
if (LLVMGetBitcodeModuleProvider(MemBuf, &MP, &Message))
|
|
||||||
llvm_raise(llvm_bitreader_error_exn, Message);
|
|
||||||
|
|
||||||
CAMLreturn((value) MemBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Llvm.llmemorybuffer -> Llvm.llmodule */
|
|
||||||
CAMLprim value llvm_parse_bitcode(LLVMMemoryBufferRef MemBuf) {
|
|
||||||
CAMLparam0();
|
|
||||||
CAMLlocal2(Variant, MessageVal);
|
|
||||||
LLVMModuleRef M;
|
|
||||||
char *Message;
|
|
||||||
|
|
||||||
if (LLVMParseBitcode(MemBuf, &M, &Message))
|
|
||||||
llvm_raise(llvm_bitreader_error_exn, Message);
|
|
||||||
|
|
||||||
CAMLreturn((value) M);
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
(*===-- llvm_bitreader.ml - LLVM Ocaml Interface ----------------*- C++ -*-===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
|
|
||||||
exception Error of string
|
|
||||||
|
|
||||||
external register_exns : exn -> unit = "llvm_register_bitreader_exns"
|
|
||||||
let _ = register_exns (Error "")
|
|
||||||
|
|
||||||
external get_module_provider : Llvm.llmemorybuffer -> Llvm.llmoduleprovider
|
|
||||||
= "llvm_get_module_provider"
|
|
||||||
external parse_bitcode : Llvm.llmemorybuffer -> Llvm.llmodule
|
|
||||||
= "llvm_parse_bitcode"
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
(*===-- llvm_bitreader.mli - LLVM Ocaml Interface ---------------*- C++ -*-===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
(** Bitcode reader.
|
|
||||||
|
|
||||||
This interface provides an ocaml API for the LLVM bitcode reader, the
|
|
||||||
classes in the Bitreader library. *)
|
|
||||||
|
|
||||||
exception Error of string
|
|
||||||
|
|
||||||
(** [read_bitcode_file path] reads the bitcode for a new module [m] from the
|
|
||||||
file at [path]. Returns [Success m] if successful, and [Failure msg]
|
|
||||||
otherwise, where [msg] is a description of the error encountered.
|
|
||||||
See the function [llvm::getBitcodeModuleProvider]. *)
|
|
||||||
external get_module_provider : Llvm.llmemorybuffer -> Llvm.llmoduleprovider
|
|
||||||
= "llvm_get_module_provider"
|
|
||||||
|
|
||||||
(** [parse_bitcode mb] parses the bitcode for a new module [m] from the memory
|
|
||||||
buffer [mb]. Returns [Success m] if successful, and [Failure msg] otherwise,
|
|
||||||
where [msg] is a description of the error encountered.
|
|
||||||
See the function [llvm::ParseBitcodeFile]. *)
|
|
||||||
external parse_bitcode : Llvm.llmemorybuffer -> Llvm.llmodule
|
|
||||||
= "llvm_parse_bitcode"
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
##===- bindings/ocaml/bitwriter/Makefile -------------------*- Makefile -*-===##
|
|
||||||
#
|
|
||||||
# The LLVM Compiler Infrastructure
|
|
||||||
#
|
|
||||||
# This file is distributed under the University of Illinois Open Source
|
|
||||||
# License. See LICENSE.TXT for details.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
#
|
|
||||||
# This is the makefile for the Objective Caml Llvm_bitwriter interface.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
LEVEL := ../../..
|
|
||||||
LIBRARYNAME := llvm_bitwriter
|
|
||||||
DONT_BUILD_RELINKED := 1
|
|
||||||
UsedComponents := bitwriter
|
|
||||||
UsedOcamlInterfaces := llvm
|
|
||||||
|
|
||||||
include ../Makefile.ocaml
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*===-- bitwriter_ocaml.c - LLVM Ocaml Glue ---------------------*- C++ -*-===*\
|
|
||||||
|* *|
|
|
||||||
|* The LLVM Compiler Infrastructure *|
|
|
||||||
|* *|
|
|
||||||
|* This file is distributed under the University of Illinois Open Source *|
|
|
||||||
|* License. See LICENSE.TXT for details. *|
|
|
||||||
|* *|
|
|
||||||
|*===----------------------------------------------------------------------===*|
|
|
||||||
|* *|
|
|
||||||
|* This file glues LLVM's ocaml interface to its C interface. These functions *|
|
|
||||||
|* are by and large transparent wrappers to the corresponding C functions. *|
|
|
||||||
|* *|
|
|
||||||
|* Note that these functions intentionally take liberties with the CAMLparamX *|
|
|
||||||
|* macros, since most of the parameters are not GC heap objects. *|
|
|
||||||
|* *|
|
|
||||||
\*===----------------------------------------------------------------------===*/
|
|
||||||
|
|
||||||
#include "llvm-c/BitWriter.h"
|
|
||||||
#include "llvm-c/Core.h"
|
|
||||||
#include "caml/alloc.h"
|
|
||||||
#include "caml/mlvalues.h"
|
|
||||||
#include "caml/memory.h"
|
|
||||||
|
|
||||||
/*===-- Modules -----------------------------------------------------------===*/
|
|
||||||
|
|
||||||
/* Llvm.llmodule -> string -> bool */
|
|
||||||
CAMLprim value llvm_write_bitcode_file(value M, value Path) {
|
|
||||||
int res = LLVMWriteBitcodeToFile((LLVMModuleRef) M, String_val(Path));
|
|
||||||
return Val_bool(res == 0);
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
(*===-- llvm_bitwriter.ml - LLVM Ocaml Interface ----------------*- C++ -*-===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===
|
|
||||||
*
|
|
||||||
* This interface provides an ocaml API for the LLVM intermediate
|
|
||||||
* representation, the classes in the VMCore library.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
|
|
||||||
(* Writes the bitcode for module the given path. Returns true if successful. *)
|
|
||||||
external write_bitcode_file : Llvm.llmodule -> string -> bool
|
|
||||||
= "llvm_write_bitcode_file"
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
(*===-- llvm_bitwriter.mli - LLVM Ocaml Interface ---------------*- C++ -*-===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
(** Bitcode writer.
|
|
||||||
|
|
||||||
This interface provides an ocaml API for the LLVM bitcode writer, the
|
|
||||||
classes in the Bitwriter library. *)
|
|
||||||
|
|
||||||
(** [write_bitcode_file m path] writes the bitcode for module [m] to the file at
|
|
||||||
[path]. Returns [true] if successful, [false] otherwise. *)
|
|
||||||
external write_bitcode_file : Llvm.llmodule -> string -> bool
|
|
||||||
= "llvm_write_bitcode_file"
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
##===- bindings/ocaml/executionengine/Makefile --------------*- Makefile -*-===##
|
|
||||||
#
|
|
||||||
# The LLVM Compiler Infrastructure
|
|
||||||
#
|
|
||||||
# This file is distributed under the University of Illinois Open Source
|
|
||||||
# License. See LICENSE.TXT for details.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
#
|
|
||||||
# This is the makefile for the Objective Caml Llvm_executionengine interface.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
LEVEL := ../../..
|
|
||||||
LIBRARYNAME := llvm_executionengine
|
|
||||||
DONT_BUILD_RELINKED := 1
|
|
||||||
UsedComponents := executionengine jit interpreter native
|
|
||||||
UsedOcamlInterfaces := llvm llvm_target
|
|
||||||
|
|
||||||
include ../Makefile.ocaml
|
|
||||||
@@ -1,323 +0,0 @@
|
|||||||
/*===-- executionengine_ocaml.c - LLVM Ocaml Glue ---------------*- C++ -*-===*\
|
|
||||||
|* *|
|
|
||||||
|* The LLVM Compiler Infrastructure *|
|
|
||||||
|* *|
|
|
||||||
|* This file is distributed under the University of Illinois Open Source *|
|
|
||||||
|* License. See LICENSE.TXT for details. *|
|
|
||||||
|* *|
|
|
||||||
|*===----------------------------------------------------------------------===*|
|
|
||||||
|* *|
|
|
||||||
|* This file glues LLVM's ocaml interface to its C interface. These functions *|
|
|
||||||
|* are by and large transparent wrappers to the corresponding C functions. *|
|
|
||||||
|* *|
|
|
||||||
|* Note that these functions intentionally take liberties with the CAMLparamX *|
|
|
||||||
|* macros, since most of the parameters are not GC heap objects. *|
|
|
||||||
|* *|
|
|
||||||
\*===----------------------------------------------------------------------===*/
|
|
||||||
|
|
||||||
#include "llvm-c/ExecutionEngine.h"
|
|
||||||
#include "caml/alloc.h"
|
|
||||||
#include "caml/custom.h"
|
|
||||||
#include "caml/fail.h"
|
|
||||||
#include "caml/memory.h"
|
|
||||||
#include <string.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* Can't use the recommended caml_named_value mechanism for backwards
|
|
||||||
compatibility reasons. This is largely equivalent. */
|
|
||||||
static value llvm_ee_error_exn;
|
|
||||||
|
|
||||||
CAMLprim value llvm_register_ee_exns(value Error) {
|
|
||||||
llvm_ee_error_exn = Field(Error, 0);
|
|
||||||
register_global_root(&llvm_ee_error_exn);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void llvm_raise(value Prototype, char *Message) {
|
|
||||||
CAMLparam1(Prototype);
|
|
||||||
CAMLlocal1(CamlMessage);
|
|
||||||
|
|
||||||
CamlMessage = copy_string(Message);
|
|
||||||
LLVMDisposeMessage(Message);
|
|
||||||
|
|
||||||
raise_with_arg(Prototype, CamlMessage);
|
|
||||||
abort(); /* NOTREACHED */
|
|
||||||
#ifdef CAMLnoreturn
|
|
||||||
CAMLnoreturn; /* Silences warnings, but is missing in some versions. */
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*--... Operations on generic values .......................................--*/
|
|
||||||
|
|
||||||
#define Genericvalue_val(v) (*(LLVMGenericValueRef *)(Data_custom_val(v)))
|
|
||||||
|
|
||||||
static void llvm_finalize_generic_value(value GenVal) {
|
|
||||||
LLVMDisposeGenericValue(Genericvalue_val(GenVal));
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct custom_operations generic_value_ops = {
|
|
||||||
(char *) "LLVMGenericValue",
|
|
||||||
llvm_finalize_generic_value,
|
|
||||||
custom_compare_default,
|
|
||||||
custom_hash_default,
|
|
||||||
custom_serialize_default,
|
|
||||||
custom_deserialize_default
|
|
||||||
};
|
|
||||||
|
|
||||||
static value alloc_generic_value(LLVMGenericValueRef Ref) {
|
|
||||||
value Val = alloc_custom(&generic_value_ops, sizeof(LLVMGenericValueRef), 0, 1);
|
|
||||||
Genericvalue_val(Val) = Ref;
|
|
||||||
return Val;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Llvm.lltype -> float -> t */
|
|
||||||
CAMLprim value llvm_genericvalue_of_float(LLVMTypeRef Ty, value N) {
|
|
||||||
CAMLparam1(N);
|
|
||||||
CAMLreturn(alloc_generic_value(
|
|
||||||
LLVMCreateGenericValueOfFloat(Ty, Double_val(N))));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 'a -> t */
|
|
||||||
CAMLprim value llvm_genericvalue_of_value(value V) {
|
|
||||||
CAMLparam1(V);
|
|
||||||
CAMLreturn(alloc_generic_value(LLVMCreateGenericValueOfPointer(Op_val(V))));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Llvm.lltype -> int -> t */
|
|
||||||
CAMLprim value llvm_genericvalue_of_int(LLVMTypeRef Ty, value Int) {
|
|
||||||
return alloc_generic_value(LLVMCreateGenericValueOfInt(Ty, Int_val(Int), 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Llvm.lltype -> int32 -> t */
|
|
||||||
CAMLprim value llvm_genericvalue_of_int32(LLVMTypeRef Ty, value Int32) {
|
|
||||||
CAMLparam1(Int32);
|
|
||||||
CAMLreturn(alloc_generic_value(
|
|
||||||
LLVMCreateGenericValueOfInt(Ty, Int32_val(Int32), 1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Llvm.lltype -> nativeint -> t */
|
|
||||||
CAMLprim value llvm_genericvalue_of_nativeint(LLVMTypeRef Ty, value NatInt) {
|
|
||||||
CAMLparam1(NatInt);
|
|
||||||
CAMLreturn(alloc_generic_value(
|
|
||||||
LLVMCreateGenericValueOfInt(Ty, Nativeint_val(NatInt), 1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Llvm.lltype -> int64 -> t */
|
|
||||||
CAMLprim value llvm_genericvalue_of_int64(LLVMTypeRef Ty, value Int64) {
|
|
||||||
CAMLparam1(Int64);
|
|
||||||
CAMLreturn(alloc_generic_value(
|
|
||||||
LLVMCreateGenericValueOfInt(Ty, Int64_val(Int64), 1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Llvm.lltype -> t -> float */
|
|
||||||
CAMLprim value llvm_genericvalue_as_float(LLVMTypeRef Ty, value GenVal) {
|
|
||||||
CAMLparam1(GenVal);
|
|
||||||
CAMLreturn(copy_double(
|
|
||||||
LLVMGenericValueToFloat(Ty, Genericvalue_val(GenVal))));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* t -> 'a */
|
|
||||||
CAMLprim value llvm_genericvalue_as_value(value GenVal) {
|
|
||||||
return Val_op(LLVMGenericValueToPointer(Genericvalue_val(GenVal)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* t -> int */
|
|
||||||
CAMLprim value llvm_genericvalue_as_int(value GenVal) {
|
|
||||||
assert(LLVMGenericValueIntWidth(Genericvalue_val(GenVal)) <= 8 * sizeof(value)
|
|
||||||
&& "Generic value too wide to treat as an int!");
|
|
||||||
return Val_int(LLVMGenericValueToInt(Genericvalue_val(GenVal), 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* t -> int32 */
|
|
||||||
CAMLprim value llvm_genericvalue_as_int32(value GenVal) {
|
|
||||||
CAMLparam1(GenVal);
|
|
||||||
assert(LLVMGenericValueIntWidth(Genericvalue_val(GenVal)) <= 32
|
|
||||||
&& "Generic value too wide to treat as an int32!");
|
|
||||||
CAMLreturn(copy_int32(LLVMGenericValueToInt(Genericvalue_val(GenVal), 1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* t -> int64 */
|
|
||||||
CAMLprim value llvm_genericvalue_as_int64(value GenVal) {
|
|
||||||
CAMLparam1(GenVal);
|
|
||||||
assert(LLVMGenericValueIntWidth(Genericvalue_val(GenVal)) <= 64
|
|
||||||
&& "Generic value too wide to treat as an int64!");
|
|
||||||
CAMLreturn(copy_int64(LLVMGenericValueToInt(Genericvalue_val(GenVal), 1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* t -> nativeint */
|
|
||||||
CAMLprim value llvm_genericvalue_as_nativeint(value GenVal) {
|
|
||||||
CAMLparam1(GenVal);
|
|
||||||
assert(LLVMGenericValueIntWidth(Genericvalue_val(GenVal)) <= 8 * sizeof(value)
|
|
||||||
&& "Generic value too wide to treat as a nativeint!");
|
|
||||||
CAMLreturn(copy_nativeint(LLVMGenericValueToInt(Genericvalue_val(GenVal),1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*--... Operations on execution engines ....................................--*/
|
|
||||||
|
|
||||||
/* llmoduleprovider -> ExecutionEngine.t */
|
|
||||||
CAMLprim LLVMExecutionEngineRef llvm_ee_create(LLVMModuleProviderRef MP) {
|
|
||||||
LLVMExecutionEngineRef Interp;
|
|
||||||
char *Error;
|
|
||||||
if (LLVMCreateExecutionEngine(&Interp, MP, &Error))
|
|
||||||
llvm_raise(llvm_ee_error_exn, Error);
|
|
||||||
return Interp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* llmoduleprovider -> ExecutionEngine.t */
|
|
||||||
CAMLprim LLVMExecutionEngineRef
|
|
||||||
llvm_ee_create_interpreter(LLVMModuleProviderRef MP) {
|
|
||||||
LLVMExecutionEngineRef Interp;
|
|
||||||
char *Error;
|
|
||||||
if (LLVMCreateInterpreter(&Interp, MP, &Error))
|
|
||||||
llvm_raise(llvm_ee_error_exn, Error);
|
|
||||||
return Interp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* llmoduleprovider -> ExecutionEngine.t */
|
|
||||||
CAMLprim LLVMExecutionEngineRef
|
|
||||||
llvm_ee_create_jit(LLVMModuleProviderRef MP) {
|
|
||||||
LLVMExecutionEngineRef JIT;
|
|
||||||
char *Error;
|
|
||||||
if (LLVMCreateJITCompiler(&JIT, MP, 0, &Error))
|
|
||||||
llvm_raise(llvm_ee_error_exn, Error);
|
|
||||||
return JIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* llmoduleprovider -> ExecutionEngine.t */
|
|
||||||
CAMLprim LLVMExecutionEngineRef
|
|
||||||
llvm_ee_create_fast_jit(LLVMModuleProviderRef MP) {
|
|
||||||
LLVMExecutionEngineRef JIT;
|
|
||||||
char *Error;
|
|
||||||
if (LLVMCreateJITCompiler(&JIT, MP, 1, &Error))
|
|
||||||
llvm_raise(llvm_ee_error_exn, Error);
|
|
||||||
return JIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ExecutionEngine.t -> unit */
|
|
||||||
CAMLprim value llvm_ee_dispose(LLVMExecutionEngineRef EE) {
|
|
||||||
LLVMDisposeExecutionEngine(EE);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* llmoduleprovider -> ExecutionEngine.t -> unit */
|
|
||||||
CAMLprim value llvm_ee_add_mp(LLVMModuleProviderRef MP,
|
|
||||||
LLVMExecutionEngineRef EE) {
|
|
||||||
LLVMAddModuleProvider(EE, MP);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* llmoduleprovider -> ExecutionEngine.t -> llmodule */
|
|
||||||
CAMLprim LLVMModuleRef llvm_ee_remove_mp(LLVMModuleProviderRef MP,
|
|
||||||
LLVMExecutionEngineRef EE) {
|
|
||||||
LLVMModuleRef RemovedModule;
|
|
||||||
char *Error;
|
|
||||||
if (LLVMRemoveModuleProvider(EE, MP, &RemovedModule, &Error))
|
|
||||||
llvm_raise(llvm_ee_error_exn, Error);
|
|
||||||
return RemovedModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* string -> ExecutionEngine.t -> llvalue option */
|
|
||||||
CAMLprim value llvm_ee_find_function(value Name, LLVMExecutionEngineRef EE) {
|
|
||||||
CAMLparam1(Name);
|
|
||||||
CAMLlocal1(Option);
|
|
||||||
LLVMValueRef Found;
|
|
||||||
if (LLVMFindFunction(EE, String_val(Name), &Found))
|
|
||||||
CAMLreturn(Val_unit);
|
|
||||||
Option = alloc(1, 1);
|
|
||||||
Field(Option, 0) = Val_op(Found);
|
|
||||||
CAMLreturn(Option);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* llvalue -> GenericValue.t array -> ExecutionEngine.t -> GenericValue.t */
|
|
||||||
CAMLprim value llvm_ee_run_function(LLVMValueRef F, value Args,
|
|
||||||
LLVMExecutionEngineRef EE) {
|
|
||||||
unsigned NumArgs;
|
|
||||||
LLVMGenericValueRef Result, *GVArgs;
|
|
||||||
unsigned I;
|
|
||||||
|
|
||||||
NumArgs = Wosize_val(Args);
|
|
||||||
GVArgs = (LLVMGenericValueRef*) malloc(NumArgs * sizeof(LLVMGenericValueRef));
|
|
||||||
for (I = 0; I != NumArgs; ++I)
|
|
||||||
GVArgs[I] = Genericvalue_val(Field(Args, I));
|
|
||||||
|
|
||||||
Result = LLVMRunFunction(EE, F, NumArgs, GVArgs);
|
|
||||||
|
|
||||||
free(GVArgs);
|
|
||||||
return alloc_generic_value(Result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ExecutionEngine.t -> unit */
|
|
||||||
CAMLprim value llvm_ee_run_static_ctors(LLVMExecutionEngineRef EE) {
|
|
||||||
LLVMRunStaticConstructors(EE);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ExecutionEngine.t -> unit */
|
|
||||||
CAMLprim value llvm_ee_run_static_dtors(LLVMExecutionEngineRef EE) {
|
|
||||||
LLVMRunStaticDestructors(EE);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* llvalue -> string array -> (string * string) array -> ExecutionEngine.t ->
|
|
||||||
int */
|
|
||||||
CAMLprim value llvm_ee_run_function_as_main(LLVMValueRef F,
|
|
||||||
value Args, value Env,
|
|
||||||
LLVMExecutionEngineRef EE) {
|
|
||||||
CAMLparam2(Args, Env);
|
|
||||||
int I, NumArgs, NumEnv, EnvSize, Result;
|
|
||||||
const char **CArgs, **CEnv;
|
|
||||||
char *CEnvBuf, *Pos;
|
|
||||||
|
|
||||||
NumArgs = Wosize_val(Args);
|
|
||||||
NumEnv = Wosize_val(Env);
|
|
||||||
|
|
||||||
/* Build the environment. */
|
|
||||||
CArgs = (const char **) malloc(NumArgs * sizeof(char*));
|
|
||||||
for (I = 0; I != NumArgs; ++I)
|
|
||||||
CArgs[I] = String_val(Field(Args, I));
|
|
||||||
|
|
||||||
/* Compute the size of the environment string buffer. */
|
|
||||||
for (I = 0, EnvSize = 0; I != NumEnv; ++I) {
|
|
||||||
EnvSize += strlen(String_val(Field(Field(Env, I), 0))) + 1;
|
|
||||||
EnvSize += strlen(String_val(Field(Field(Env, I), 1))) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Build the environment. */
|
|
||||||
CEnv = (const char **) malloc((NumEnv + 1) * sizeof(char*));
|
|
||||||
CEnvBuf = (char*) malloc(EnvSize);
|
|
||||||
Pos = CEnvBuf;
|
|
||||||
for (I = 0; I != NumEnv; ++I) {
|
|
||||||
char *Name = String_val(Field(Field(Env, I), 0)),
|
|
||||||
*Value = String_val(Field(Field(Env, I), 1));
|
|
||||||
int NameLen = strlen(Name),
|
|
||||||
ValueLen = strlen(Value);
|
|
||||||
|
|
||||||
CEnv[I] = Pos;
|
|
||||||
memcpy(Pos, Name, NameLen);
|
|
||||||
Pos += NameLen;
|
|
||||||
*Pos++ = '=';
|
|
||||||
memcpy(Pos, Value, ValueLen);
|
|
||||||
Pos += ValueLen;
|
|
||||||
*Pos++ = '\0';
|
|
||||||
}
|
|
||||||
CEnv[NumEnv] = NULL;
|
|
||||||
|
|
||||||
Result = LLVMRunFunctionAsMain(EE, F, NumArgs, CArgs, CEnv);
|
|
||||||
|
|
||||||
free(CArgs);
|
|
||||||
free(CEnv);
|
|
||||||
free(CEnvBuf);
|
|
||||||
|
|
||||||
CAMLreturn(Val_int(Result));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* llvalue -> ExecutionEngine.t -> unit */
|
|
||||||
CAMLprim value llvm_ee_free_machine_code(LLVMValueRef F,
|
|
||||||
LLVMExecutionEngineRef EE) {
|
|
||||||
LLVMFreeMachineCodeForFunction(EE, F);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
(*===-- llvm_executionengine.ml - LLVM Ocaml Interface ----------*- C++ -*-===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
|
|
||||||
exception Error of string
|
|
||||||
|
|
||||||
external register_exns: exn -> unit
|
|
||||||
= "llvm_register_ee_exns"
|
|
||||||
|
|
||||||
|
|
||||||
module GenericValue = struct
|
|
||||||
type t
|
|
||||||
|
|
||||||
external of_float: Llvm.lltype -> float -> t
|
|
||||||
= "llvm_genericvalue_of_float"
|
|
||||||
external of_pointer: 'a -> t
|
|
||||||
= "llvm_genericvalue_of_value"
|
|
||||||
external of_int32: Llvm.lltype -> int32 -> t
|
|
||||||
= "llvm_genericvalue_of_int32"
|
|
||||||
external of_int: Llvm.lltype -> int -> t
|
|
||||||
= "llvm_genericvalue_of_int"
|
|
||||||
external of_nativeint: Llvm.lltype -> nativeint -> t
|
|
||||||
= "llvm_genericvalue_of_nativeint"
|
|
||||||
external of_int64: Llvm.lltype -> int64 -> t
|
|
||||||
= "llvm_genericvalue_of_int64"
|
|
||||||
|
|
||||||
external as_float: Llvm.lltype -> t -> float
|
|
||||||
= "llvm_genericvalue_as_float"
|
|
||||||
external as_pointer: t -> 'a
|
|
||||||
= "llvm_genericvalue_as_value"
|
|
||||||
external as_int32: t -> int32
|
|
||||||
= "llvm_genericvalue_as_int32"
|
|
||||||
external as_int: t -> int
|
|
||||||
= "llvm_genericvalue_as_int"
|
|
||||||
external as_nativeint: t -> nativeint
|
|
||||||
= "llvm_genericvalue_as_nativeint"
|
|
||||||
external as_int64: t -> int64
|
|
||||||
= "llvm_genericvalue_as_int64"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
module ExecutionEngine = struct
|
|
||||||
type t
|
|
||||||
|
|
||||||
(* FIXME: Ocaml is not running this setup code unless we use 'val' in the
|
|
||||||
interface, which causes the emission of a stub for each function;
|
|
||||||
using 'external' in the module allows direct calls into
|
|
||||||
ocaml_executionengine.c. This is hardly fatal, but it is unnecessary
|
|
||||||
overhead on top of the two stubs that are already invoked for each
|
|
||||||
call into LLVM. *)
|
|
||||||
let _ = register_exns (Error "")
|
|
||||||
|
|
||||||
external create: Llvm.llmoduleprovider -> t
|
|
||||||
= "llvm_ee_create"
|
|
||||||
external create_interpreter: Llvm.llmoduleprovider -> t
|
|
||||||
= "llvm_ee_create_interpreter"
|
|
||||||
external create_jit: Llvm.llmoduleprovider -> t
|
|
||||||
= "llvm_ee_create_jit"
|
|
||||||
external create_fast_jit: Llvm.llmoduleprovider -> t
|
|
||||||
= "llvm_ee_create_fast_jit"
|
|
||||||
external dispose: t -> unit
|
|
||||||
= "llvm_ee_dispose"
|
|
||||||
external add_module_provider: Llvm.llmoduleprovider -> t -> unit
|
|
||||||
= "llvm_ee_add_mp"
|
|
||||||
external remove_module_provider: Llvm.llmoduleprovider -> t -> Llvm.llmodule
|
|
||||||
= "llvm_ee_remove_mp"
|
|
||||||
external find_function: string -> t -> Llvm.llvalue option
|
|
||||||
= "llvm_ee_find_function"
|
|
||||||
external run_function: Llvm.llvalue -> GenericValue.t array -> t ->
|
|
||||||
GenericValue.t
|
|
||||||
= "llvm_ee_run_function"
|
|
||||||
external run_static_ctors: t -> unit
|
|
||||||
= "llvm_ee_run_static_ctors"
|
|
||||||
external run_static_dtors: t -> unit
|
|
||||||
= "llvm_ee_run_static_dtors"
|
|
||||||
external run_function_as_main: Llvm.llvalue -> string array ->
|
|
||||||
(string * string) array -> t -> int
|
|
||||||
= "llvm_ee_run_function_as_main"
|
|
||||||
external free_machine_code: Llvm.llvalue -> t -> unit
|
|
||||||
= "llvm_ee_free_machine_code"
|
|
||||||
|
|
||||||
external target_data: t -> Llvm_target.TargetData.t
|
|
||||||
= "LLVMGetExecutionEngineTargetData"
|
|
||||||
|
|
||||||
(* The following are not bound. Patches are welcome.
|
|
||||||
|
|
||||||
get_target_data: t -> lltargetdata
|
|
||||||
add_global_mapping: llvalue -> llgenericvalue -> t -> unit
|
|
||||||
clear_all_global_mappings: t -> unit
|
|
||||||
update_global_mapping: llvalue -> llgenericvalue -> t -> unit
|
|
||||||
get_pointer_to_global_if_available: llvalue -> t -> llgenericvalue
|
|
||||||
get_pointer_to_global: llvalue -> t -> llgenericvalue
|
|
||||||
get_pointer_to_function: llvalue -> t -> llgenericvalue
|
|
||||||
get_pointer_to_function_or_stub: llvalue -> t -> llgenericvalue
|
|
||||||
get_global_value_at_address: llgenericvalue -> t -> llvalue option
|
|
||||||
store_value_to_memory: llgenericvalue -> llgenericvalue -> lltype -> unit
|
|
||||||
initialize_memory: llvalue -> llgenericvalue -> t -> unit
|
|
||||||
recompile_and_relink_function: llvalue -> t -> llgenericvalue
|
|
||||||
get_or_emit_global_variable: llvalue -> t -> llgenericvalue
|
|
||||||
disable_lazy_compilation: t -> unit
|
|
||||||
lazy_compilation_enabled: t -> bool
|
|
||||||
install_lazy_function_creator: (string -> llgenericvalue) -> t -> unit
|
|
||||||
|
|
||||||
*)
|
|
||||||
end
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
(*===-- llvm_executionengine.mli - LLVM Ocaml Interface ---------*- C++ -*-===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
(** JIT Interpreter.
|
|
||||||
|
|
||||||
This interface provides an ocaml API for LLVM execution engine (JIT/
|
|
||||||
interpreter), the classes in the ExecutionEngine library. *)
|
|
||||||
|
|
||||||
exception Error of string
|
|
||||||
|
|
||||||
module GenericValue: sig
|
|
||||||
(** [GenericValue.t] is a boxed union type used to portably pass arguments to
|
|
||||||
and receive values from the execution engine. It supports only a limited
|
|
||||||
selection of types; for more complex argument types, it is necessary to
|
|
||||||
generate a stub function by hand or to pass parameters by reference.
|
|
||||||
See the struct [llvm::GenericValue]. *)
|
|
||||||
type t
|
|
||||||
|
|
||||||
(** [of_float fpty n] boxes the float [n] in a float-valued generic value
|
|
||||||
according to the floating point type [fpty]. See the fields
|
|
||||||
[llvm::GenericValue::DoubleVal] and [llvm::GenericValue::FloatVal]. *)
|
|
||||||
val of_float: Llvm.lltype -> float -> t
|
|
||||||
|
|
||||||
(** [of_pointer v] boxes the pointer value [v] in a generic value. See the
|
|
||||||
field [llvm::GenericValue::PointerVal]. *)
|
|
||||||
val of_pointer: 'a -> t
|
|
||||||
|
|
||||||
(** [of_int32 n w] boxes the int32 [i] in a generic value with the bitwidth
|
|
||||||
[w]. See the field [llvm::GenericValue::IntVal]. *)
|
|
||||||
val of_int32: Llvm.lltype -> int32 -> t
|
|
||||||
|
|
||||||
(** [of_int n w] boxes the int [i] in a generic value with the bitwidth
|
|
||||||
[w]. See the field [llvm::GenericValue::IntVal]. *)
|
|
||||||
val of_int: Llvm.lltype -> int -> t
|
|
||||||
|
|
||||||
(** [of_natint n w] boxes the native int [i] in a generic value with the
|
|
||||||
bitwidth [w]. See the field [llvm::GenericValue::IntVal]. *)
|
|
||||||
val of_nativeint: Llvm.lltype -> nativeint -> t
|
|
||||||
|
|
||||||
(** [of_int64 n w] boxes the int64 [i] in a generic value with the bitwidth
|
|
||||||
[w]. See the field [llvm::GenericValue::IntVal]. *)
|
|
||||||
val of_int64: Llvm.lltype -> int64 -> t
|
|
||||||
|
|
||||||
(** [as_float fpty gv] unboxes the floating point-valued generic value [gv] of
|
|
||||||
floating point type [fpty]. See the fields [llvm::GenericValue::DoubleVal]
|
|
||||||
and [llvm::GenericValue::FloatVal]. *)
|
|
||||||
val as_float: Llvm.lltype -> t -> float
|
|
||||||
|
|
||||||
(** [as_pointer gv] unboxes the pointer-valued generic value [gv]. See the
|
|
||||||
field [llvm::GenericValue::PointerVal]. *)
|
|
||||||
val as_pointer: t -> 'a
|
|
||||||
|
|
||||||
(** [as_int32 gv] unboxes the integer-valued generic value [gv] as an [int32].
|
|
||||||
Is invalid if [gv] has a bitwidth greater than 32 bits. See the field
|
|
||||||
[llvm::GenericValue::IntVal]. *)
|
|
||||||
val as_int32: t -> int32
|
|
||||||
|
|
||||||
(** [as_int gv] unboxes the integer-valued generic value [gv] as an [int].
|
|
||||||
Is invalid if [gv] has a bitwidth greater than the host bit width (but the
|
|
||||||
most significant bit may be lost). See the field
|
|
||||||
[llvm::GenericValue::IntVal]. *)
|
|
||||||
val as_int: t -> int
|
|
||||||
|
|
||||||
(** [as_natint gv] unboxes the integer-valued generic value [gv] as a
|
|
||||||
[nativeint]. Is invalid if [gv] has a bitwidth greater than
|
|
||||||
[nativeint]. See the field [llvm::GenericValue::IntVal]. *)
|
|
||||||
val as_nativeint: t -> nativeint
|
|
||||||
|
|
||||||
(** [as_int64 gv] returns the integer-valued generic value [gv] as an [int64].
|
|
||||||
Is invalid if [gv] has a bitwidth greater than [int64]. See the field
|
|
||||||
[llvm::GenericValue::IntVal]. *)
|
|
||||||
val as_int64: t -> int64
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
module ExecutionEngine: sig
|
|
||||||
(** An execution engine is either a JIT compiler or an interpreter, capable of
|
|
||||||
directly loading an LLVM module and executing its functions without first
|
|
||||||
invoking a static compiler and generating a native executable. *)
|
|
||||||
type t
|
|
||||||
|
|
||||||
(** [create mp] creates a new execution engine, taking ownership of the
|
|
||||||
module provider [mp] if successful. Creates a JIT if possible, else falls
|
|
||||||
back to an interpreter. Raises [Error msg] if an error occurrs. The
|
|
||||||
execution engine is not garbage collected and must be destroyed with
|
|
||||||
[dispose ee]. See the function [llvm::ExecutionEngine::create]. *)
|
|
||||||
val create: Llvm.llmoduleprovider -> t
|
|
||||||
|
|
||||||
(** [create_interpreter mp] creates a new interpreter, taking ownership of the
|
|
||||||
module provider [mp] if successful. Raises [Error msg] if an error
|
|
||||||
occurrs. The execution engine is not garbage collected and must be
|
|
||||||
destroyed with [dispose ee].
|
|
||||||
See the function [llvm::ExecutionEngine::create]. *)
|
|
||||||
val create_interpreter: Llvm.llmoduleprovider -> t
|
|
||||||
|
|
||||||
(** [create_jit mp] creates a new JIT (just-in-time compiler), taking
|
|
||||||
ownership of the module provider [mp] if successful. This function creates
|
|
||||||
a JIT which favors code quality over compilation speed. Raises [Error msg]
|
|
||||||
if an error occurrs. The execution engine is not garbage collected and
|
|
||||||
must be destroyed with [dispose ee].
|
|
||||||
See the function [llvm::ExecutionEngine::create]. *)
|
|
||||||
val create_jit: Llvm.llmoduleprovider -> t
|
|
||||||
|
|
||||||
(** [create_fast_jit mp] creates a new JIT (just-in-time compiler) which
|
|
||||||
favors compilation speed over code quality. It takes ownership of the
|
|
||||||
module provider [mp] if successful. Raises [Error msg] if an error
|
|
||||||
occurrs. The execution engine is not garbage collected and must be
|
|
||||||
destroyed with [dispose ee].
|
|
||||||
See the function [llvm::ExecutionEngine::create]. *)
|
|
||||||
val create_fast_jit: Llvm.llmoduleprovider -> t
|
|
||||||
|
|
||||||
(** [dispose ee] releases the memory used by the execution engine and must be
|
|
||||||
invoked to avoid memory leaks. *)
|
|
||||||
val dispose: t -> unit
|
|
||||||
|
|
||||||
(** [add_module_provider mp ee] adds the module provider [mp] to the execution
|
|
||||||
engine [ee]. *)
|
|
||||||
val add_module_provider: Llvm.llmoduleprovider -> t -> unit
|
|
||||||
|
|
||||||
(** [remove_module_provider mp ee] removes the module provider [mp] from the
|
|
||||||
execution engine [ee], disposing of [mp] and the module referenced by
|
|
||||||
[mp]. Raises [Error msg] if an error occurs. *)
|
|
||||||
val remove_module_provider: Llvm.llmoduleprovider -> t -> Llvm.llmodule
|
|
||||||
|
|
||||||
(** [find_function n ee] finds the function named [n] defined in any of the
|
|
||||||
modules owned by the execution engine [ee]. Returns [None] if the function
|
|
||||||
is not found and [Some f] otherwise. *)
|
|
||||||
val find_function: string -> t -> Llvm.llvalue option
|
|
||||||
|
|
||||||
(** [run_function f args ee] synchronously executes the function [f] with the
|
|
||||||
arguments [args], which must be compatible with the parameter types. *)
|
|
||||||
val run_function: Llvm.llvalue -> GenericValue.t array -> t ->
|
|
||||||
GenericValue.t
|
|
||||||
|
|
||||||
(** [run_static_ctors ee] executes the static constructors of each module in
|
|
||||||
the execution engine [ee]. *)
|
|
||||||
val run_static_ctors: t -> unit
|
|
||||||
|
|
||||||
(** [run_static_dtors ee] executes the static destructors of each module in
|
|
||||||
the execution engine [ee]. *)
|
|
||||||
val run_static_dtors: t -> unit
|
|
||||||
|
|
||||||
(** [run_function_as_main f args env ee] executes the function [f] as a main
|
|
||||||
function, passing it [argv] and [argc] according to the string array
|
|
||||||
[args], and [envp] as specified by the array [env]. Returns the integer
|
|
||||||
return value of the function. *)
|
|
||||||
val run_function_as_main: Llvm.llvalue -> string array ->
|
|
||||||
(string * string) array -> t -> int
|
|
||||||
|
|
||||||
(** [free_machine_code f ee] releases the memory in the execution engine [ee]
|
|
||||||
used to store the machine code for the function [f]. *)
|
|
||||||
val free_machine_code: Llvm.llvalue -> t -> unit
|
|
||||||
|
|
||||||
(** [target_data ee] is the target data owned by the execution engine
|
|
||||||
[ee]. *)
|
|
||||||
val target_data: t -> Llvm_target.TargetData.t
|
|
||||||
end
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
##===- bindings/ocaml/bitwriter/Makefile -------------------*- Makefile -*-===##
|
|
||||||
#
|
|
||||||
# The LLVM Compiler Infrastructure
|
|
||||||
#
|
|
||||||
# This file is distributed under the University of Illinois Open Source
|
|
||||||
# License. See LICENSE.TXT for details.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
#
|
|
||||||
# This is the makefile for the Objective Caml Llvm interface.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
LEVEL := ../../..
|
|
||||||
LIBRARYNAME := llvm
|
|
||||||
DONT_BUILD_RELINKED := 1
|
|
||||||
UsedComponents := core
|
|
||||||
UsedOcamLibs := llvm
|
|
||||||
|
|
||||||
include ../Makefile.ocaml
|
|
||||||
@@ -1,811 +0,0 @@
|
|||||||
(*===-- llvm/llvm.ml - LLVM Ocaml Interface --------------------------------===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
|
|
||||||
type llmodule
|
|
||||||
type lltype
|
|
||||||
type lltypehandle
|
|
||||||
type llvalue
|
|
||||||
type llbasicblock
|
|
||||||
type llbuilder
|
|
||||||
type llmoduleprovider
|
|
||||||
type llmemorybuffer
|
|
||||||
|
|
||||||
module TypeKind = struct
|
|
||||||
type t =
|
|
||||||
| Void
|
|
||||||
| Float
|
|
||||||
| Double
|
|
||||||
| X86fp80
|
|
||||||
| Fp128
|
|
||||||
| Ppc_fp128
|
|
||||||
| Label
|
|
||||||
| Integer
|
|
||||||
| Function
|
|
||||||
| Struct
|
|
||||||
| Array
|
|
||||||
| Pointer
|
|
||||||
| Opaque
|
|
||||||
| Vector
|
|
||||||
end
|
|
||||||
|
|
||||||
module Linkage = struct
|
|
||||||
type t =
|
|
||||||
| External
|
|
||||||
| Link_once
|
|
||||||
| Weak
|
|
||||||
| Appending
|
|
||||||
| Internal
|
|
||||||
| Dllimport
|
|
||||||
| Dllexport
|
|
||||||
| External_weak
|
|
||||||
| Ghost
|
|
||||||
end
|
|
||||||
|
|
||||||
module Visibility = struct
|
|
||||||
type t =
|
|
||||||
| Default
|
|
||||||
| Hidden
|
|
||||||
| Protected
|
|
||||||
end
|
|
||||||
|
|
||||||
module CallConv = struct
|
|
||||||
let c = 0
|
|
||||||
let fast = 8
|
|
||||||
let cold = 9
|
|
||||||
let x86_stdcall = 64
|
|
||||||
let x86_fastcall = 65
|
|
||||||
end
|
|
||||||
|
|
||||||
module Icmp = struct
|
|
||||||
type t =
|
|
||||||
| Eq
|
|
||||||
| Ne
|
|
||||||
| Ugt
|
|
||||||
| Uge
|
|
||||||
| Ult
|
|
||||||
| Ule
|
|
||||||
| Sgt
|
|
||||||
| Sge
|
|
||||||
| Slt
|
|
||||||
| Sle
|
|
||||||
end
|
|
||||||
|
|
||||||
module Fcmp = struct
|
|
||||||
type t =
|
|
||||||
| False
|
|
||||||
| Oeq
|
|
||||||
| Ogt
|
|
||||||
| Oge
|
|
||||||
| Olt
|
|
||||||
| Ole
|
|
||||||
| One
|
|
||||||
| Ord
|
|
||||||
| Uno
|
|
||||||
| Ueq
|
|
||||||
| Ugt
|
|
||||||
| Uge
|
|
||||||
| Ult
|
|
||||||
| Ule
|
|
||||||
| Une
|
|
||||||
| True
|
|
||||||
end
|
|
||||||
|
|
||||||
exception IoError of string
|
|
||||||
|
|
||||||
external register_exns : exn -> unit = "llvm_register_core_exns"
|
|
||||||
let _ = register_exns (IoError "")
|
|
||||||
|
|
||||||
type ('a, 'b) llpos =
|
|
||||||
| At_end of 'a
|
|
||||||
| Before of 'b
|
|
||||||
|
|
||||||
type ('a, 'b) llrev_pos =
|
|
||||||
| At_start of 'a
|
|
||||||
| After of 'b
|
|
||||||
|
|
||||||
|
|
||||||
(*===-- Modules -----------------------------------------------------------===*)
|
|
||||||
|
|
||||||
external create_module : string -> llmodule = "llvm_create_module"
|
|
||||||
external dispose_module : llmodule -> unit = "llvm_dispose_module"
|
|
||||||
external target_triple: llmodule -> string
|
|
||||||
= "llvm_target_triple"
|
|
||||||
external set_target_triple: string -> llmodule -> unit
|
|
||||||
= "llvm_set_target_triple"
|
|
||||||
external data_layout: llmodule -> string
|
|
||||||
= "llvm_data_layout"
|
|
||||||
external set_data_layout: string -> llmodule -> unit
|
|
||||||
= "llvm_set_data_layout"
|
|
||||||
external define_type_name : string -> lltype -> llmodule -> bool
|
|
||||||
= "llvm_add_type_name"
|
|
||||||
external delete_type_name : string -> llmodule -> unit
|
|
||||||
= "llvm_delete_type_name"
|
|
||||||
external dump_module : llmodule -> unit = "llvm_dump_module"
|
|
||||||
|
|
||||||
(*===-- Types -------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
external classify_type : lltype -> TypeKind.t = "llvm_classify_type"
|
|
||||||
|
|
||||||
(*--... Operations on integer types ........................................--*)
|
|
||||||
external _i1_type : unit -> lltype = "llvm_i1_type"
|
|
||||||
external _i8_type : unit -> lltype = "llvm_i8_type"
|
|
||||||
external _i16_type : unit -> lltype = "llvm_i16_type"
|
|
||||||
external _i32_type : unit -> lltype = "llvm_i32_type"
|
|
||||||
external _i64_type : unit -> lltype = "llvm_i64_type"
|
|
||||||
|
|
||||||
let i1_type = _i1_type ()
|
|
||||||
let i8_type = _i8_type ()
|
|
||||||
let i16_type = _i16_type ()
|
|
||||||
let i32_type = _i32_type ()
|
|
||||||
let i64_type = _i64_type ()
|
|
||||||
|
|
||||||
external integer_type : int -> lltype = "llvm_integer_type"
|
|
||||||
external integer_bitwidth : lltype -> int = "llvm_integer_bitwidth"
|
|
||||||
|
|
||||||
(*--... Operations on real types ...........................................--*)
|
|
||||||
external _float_type : unit -> lltype = "llvm_float_type"
|
|
||||||
external _double_type : unit -> lltype = "llvm_double_type"
|
|
||||||
external _x86fp80_type : unit -> lltype = "llvm_x86fp80_type"
|
|
||||||
external _fp128_type : unit -> lltype = "llvm_fp128_type"
|
|
||||||
external _ppc_fp128_type : unit -> lltype = "llvm_ppc_fp128_type"
|
|
||||||
|
|
||||||
let float_type = _float_type ()
|
|
||||||
let double_type = _double_type ()
|
|
||||||
let x86fp80_type = _x86fp80_type ()
|
|
||||||
let fp128_type = _fp128_type ()
|
|
||||||
let ppc_fp128_type = _ppc_fp128_type ()
|
|
||||||
|
|
||||||
(*--... Operations on function types .......................................--*)
|
|
||||||
external function_type : lltype -> lltype array -> lltype = "llvm_function_type"
|
|
||||||
external var_arg_function_type : lltype -> lltype array -> lltype
|
|
||||||
= "llvm_var_arg_function_type"
|
|
||||||
external is_var_arg : lltype -> bool = "llvm_is_var_arg"
|
|
||||||
external return_type : lltype -> lltype = "LLVMGetReturnType"
|
|
||||||
external param_types : lltype -> lltype array = "llvm_param_types"
|
|
||||||
|
|
||||||
(*--... Operations on struct types .........................................--*)
|
|
||||||
external struct_type : lltype array -> lltype = "llvm_struct_type"
|
|
||||||
external packed_struct_type : lltype array -> lltype = "llvm_packed_struct_type"
|
|
||||||
external element_types : lltype -> lltype array = "llvm_element_types"
|
|
||||||
external is_packed : lltype -> bool = "llvm_is_packed"
|
|
||||||
|
|
||||||
(*--... Operations on pointer, vector, and array types .....................--*)
|
|
||||||
external array_type : lltype -> int -> lltype = "llvm_array_type"
|
|
||||||
external pointer_type : lltype -> lltype = "llvm_pointer_type"
|
|
||||||
external qualified_pointer_type : lltype -> int -> lltype
|
|
||||||
= "llvm_qualified_pointer_type"
|
|
||||||
external vector_type : lltype -> int -> lltype = "llvm_vector_type"
|
|
||||||
|
|
||||||
external element_type : lltype -> lltype = "LLVMGetElementType"
|
|
||||||
external array_length : lltype -> int = "llvm_array_length"
|
|
||||||
external address_space : lltype -> int = "llvm_address_space"
|
|
||||||
external vector_size : lltype -> int = "llvm_vector_size"
|
|
||||||
|
|
||||||
(*--... Operations on other types ..........................................--*)
|
|
||||||
external opaque_type : unit -> lltype = "llvm_opaque_type"
|
|
||||||
external _void_type : unit -> lltype = "llvm_void_type"
|
|
||||||
external _label_type : unit -> lltype = "llvm_label_type"
|
|
||||||
|
|
||||||
let void_type = _void_type ()
|
|
||||||
let label_type = _label_type ()
|
|
||||||
|
|
||||||
(*--... Operations on type handles .........................................--*)
|
|
||||||
external handle_to_type : lltype -> lltypehandle = "llvm_handle_to_type"
|
|
||||||
external type_of_handle : lltypehandle -> lltype = "llvm_type_of_handle"
|
|
||||||
external refine_type : lltype -> lltype -> unit = "llvm_refine_type"
|
|
||||||
|
|
||||||
|
|
||||||
(*===-- Values ------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
external type_of : llvalue -> lltype = "llvm_type_of"
|
|
||||||
external value_name : llvalue -> string = "llvm_value_name"
|
|
||||||
external set_value_name : string -> llvalue -> unit = "llvm_set_value_name"
|
|
||||||
external dump_value : llvalue -> unit = "llvm_dump_value"
|
|
||||||
|
|
||||||
(*--... Operations on constants of (mostly) any type .......................--*)
|
|
||||||
external is_constant : llvalue -> bool = "llvm_is_constant"
|
|
||||||
external const_null : lltype -> llvalue = "LLVMConstNull"
|
|
||||||
external const_all_ones : (*int|vec*)lltype -> llvalue = "LLVMConstAllOnes"
|
|
||||||
external undef : lltype -> llvalue = "LLVMGetUndef"
|
|
||||||
external is_null : llvalue -> bool = "llvm_is_null"
|
|
||||||
external is_undef : llvalue -> bool = "llvm_is_undef"
|
|
||||||
|
|
||||||
(*--... Operations on scalar constants .....................................--*)
|
|
||||||
external const_int : lltype -> int -> llvalue = "llvm_const_int"
|
|
||||||
external const_of_int64 : lltype -> Int64.t -> bool -> llvalue
|
|
||||||
= "llvm_const_of_int64"
|
|
||||||
external const_float : lltype -> float -> llvalue = "llvm_const_float"
|
|
||||||
|
|
||||||
(*--... Operations on composite constants ..................................--*)
|
|
||||||
external const_string : string -> llvalue = "llvm_const_string"
|
|
||||||
external const_stringz : string -> llvalue = "llvm_const_stringz"
|
|
||||||
external const_array : lltype -> llvalue array -> llvalue = "llvm_const_array"
|
|
||||||
external const_struct : llvalue array -> llvalue = "llvm_const_struct"
|
|
||||||
external const_packed_struct : llvalue array -> llvalue
|
|
||||||
= "llvm_const_packed_struct"
|
|
||||||
external const_vector : llvalue array -> llvalue = "llvm_const_vector"
|
|
||||||
|
|
||||||
(*--... Constant expressions ...............................................--*)
|
|
||||||
external size_of : lltype -> llvalue = "LLVMSizeOf"
|
|
||||||
external const_neg : llvalue -> llvalue = "LLVMConstNeg"
|
|
||||||
external const_not : llvalue -> llvalue = "LLVMConstNot"
|
|
||||||
external const_add : llvalue -> llvalue -> llvalue = "LLVMConstAdd"
|
|
||||||
external const_sub : llvalue -> llvalue -> llvalue = "LLVMConstSub"
|
|
||||||
external const_mul : llvalue -> llvalue -> llvalue = "LLVMConstMul"
|
|
||||||
external const_udiv : llvalue -> llvalue -> llvalue = "LLVMConstUDiv"
|
|
||||||
external const_sdiv : llvalue -> llvalue -> llvalue = "LLVMConstSDiv"
|
|
||||||
external const_fdiv : llvalue -> llvalue -> llvalue = "LLVMConstFDiv"
|
|
||||||
external const_urem : llvalue -> llvalue -> llvalue = "LLVMConstURem"
|
|
||||||
external const_srem : llvalue -> llvalue -> llvalue = "LLVMConstSRem"
|
|
||||||
external const_frem : llvalue -> llvalue -> llvalue = "LLVMConstFRem"
|
|
||||||
external const_and : llvalue -> llvalue -> llvalue = "LLVMConstAnd"
|
|
||||||
external const_or : llvalue -> llvalue -> llvalue = "LLVMConstOr"
|
|
||||||
external const_xor : llvalue -> llvalue -> llvalue = "LLVMConstXor"
|
|
||||||
external const_icmp : Icmp.t -> llvalue -> llvalue -> llvalue
|
|
||||||
= "llvm_const_icmp"
|
|
||||||
external const_fcmp : Fcmp.t -> llvalue -> llvalue -> llvalue
|
|
||||||
= "llvm_const_fcmp"
|
|
||||||
external const_shl : llvalue -> llvalue -> llvalue = "LLVMConstShl"
|
|
||||||
external const_lshr : llvalue -> llvalue -> llvalue = "LLVMConstLShr"
|
|
||||||
external const_ashr : llvalue -> llvalue -> llvalue = "LLVMConstAShr"
|
|
||||||
external const_gep : llvalue -> llvalue array -> llvalue = "llvm_const_gep"
|
|
||||||
external const_trunc : llvalue -> lltype -> llvalue = "LLVMConstTrunc"
|
|
||||||
external const_sext : llvalue -> lltype -> llvalue = "LLVMConstSExt"
|
|
||||||
external const_zext : llvalue -> lltype -> llvalue = "LLVMConstZExt"
|
|
||||||
external const_fptrunc : llvalue -> lltype -> llvalue = "LLVMConstFPTrunc"
|
|
||||||
external const_fpext : llvalue -> lltype -> llvalue = "LLVMConstFPExt"
|
|
||||||
external const_uitofp : llvalue -> lltype -> llvalue = "LLVMConstUIToFP"
|
|
||||||
external const_sitofp : llvalue -> lltype -> llvalue = "LLVMConstSIToFP"
|
|
||||||
external const_fptoui : llvalue -> lltype -> llvalue = "LLVMConstFPToUI"
|
|
||||||
external const_fptosi : llvalue -> lltype -> llvalue = "LLVMConstFPToSI"
|
|
||||||
external const_ptrtoint : llvalue -> lltype -> llvalue = "LLVMConstPtrToInt"
|
|
||||||
external const_inttoptr : llvalue -> lltype -> llvalue = "LLVMConstIntToPtr"
|
|
||||||
external const_bitcast : llvalue -> lltype -> llvalue = "LLVMConstBitCast"
|
|
||||||
external const_select : llvalue -> llvalue -> llvalue -> llvalue
|
|
||||||
= "LLVMConstSelect"
|
|
||||||
external const_extractelement : llvalue -> llvalue -> llvalue
|
|
||||||
= "LLVMConstExtractElement"
|
|
||||||
external const_insertelement : llvalue -> llvalue -> llvalue -> llvalue
|
|
||||||
= "LLVMConstInsertElement"
|
|
||||||
external const_shufflevector : llvalue -> llvalue -> llvalue -> llvalue
|
|
||||||
= "LLVMConstShuffleVector"
|
|
||||||
|
|
||||||
(*--... Operations on global variables, functions, and aliases (globals) ...--*)
|
|
||||||
external global_parent : llvalue -> llmodule = "LLVMGetGlobalParent"
|
|
||||||
external is_declaration : llvalue -> bool = "llvm_is_declaration"
|
|
||||||
external linkage : llvalue -> Linkage.t = "llvm_linkage"
|
|
||||||
external set_linkage : Linkage.t -> llvalue -> unit = "llvm_set_linkage"
|
|
||||||
external section : llvalue -> string = "llvm_section"
|
|
||||||
external set_section : string -> llvalue -> unit = "llvm_set_section"
|
|
||||||
external visibility : llvalue -> Visibility.t = "llvm_visibility"
|
|
||||||
external set_visibility : Visibility.t -> llvalue -> unit = "llvm_set_visibility"
|
|
||||||
external alignment : llvalue -> int = "llvm_alignment"
|
|
||||||
external set_alignment : int -> llvalue -> unit = "llvm_set_alignment"
|
|
||||||
external is_global_constant : llvalue -> bool = "llvm_is_global_constant"
|
|
||||||
external set_global_constant : bool -> llvalue -> unit
|
|
||||||
= "llvm_set_global_constant"
|
|
||||||
|
|
||||||
(*--... Operations on global variables .....................................--*)
|
|
||||||
external declare_global : lltype -> string -> llmodule -> llvalue
|
|
||||||
= "llvm_declare_global"
|
|
||||||
external define_global : string -> llvalue -> llmodule -> llvalue
|
|
||||||
= "llvm_define_global"
|
|
||||||
external lookup_global : string -> llmodule -> llvalue option
|
|
||||||
= "llvm_lookup_global"
|
|
||||||
external delete_global : llvalue -> unit = "llvm_delete_global"
|
|
||||||
external global_initializer : llvalue -> llvalue = "LLVMGetInitializer"
|
|
||||||
external set_initializer : llvalue -> llvalue -> unit = "llvm_set_initializer"
|
|
||||||
external remove_initializer : llvalue -> unit = "llvm_remove_initializer"
|
|
||||||
external is_thread_local : llvalue -> bool = "llvm_is_thread_local"
|
|
||||||
external set_thread_local : bool -> llvalue -> unit = "llvm_set_thread_local"
|
|
||||||
external global_begin : llmodule -> (llmodule, llvalue) llpos
|
|
||||||
= "llvm_global_begin"
|
|
||||||
external global_succ : llvalue -> (llmodule, llvalue) llpos
|
|
||||||
= "llvm_global_succ"
|
|
||||||
external global_end : llmodule -> (llmodule, llvalue) llrev_pos
|
|
||||||
= "llvm_global_end"
|
|
||||||
external global_pred : llvalue -> (llmodule, llvalue) llrev_pos
|
|
||||||
= "llvm_global_pred"
|
|
||||||
|
|
||||||
let rec iter_global_range f i e =
|
|
||||||
if i = e then () else
|
|
||||||
match i with
|
|
||||||
| At_end _ -> raise (Invalid_argument "Invalid global variable range.")
|
|
||||||
| Before bb ->
|
|
||||||
f bb;
|
|
||||||
iter_global_range f (global_succ bb) e
|
|
||||||
|
|
||||||
let iter_globals f m =
|
|
||||||
iter_global_range f (global_begin m) (At_end m)
|
|
||||||
|
|
||||||
let rec fold_left_global_range f init i e =
|
|
||||||
if i = e then init else
|
|
||||||
match i with
|
|
||||||
| At_end _ -> raise (Invalid_argument "Invalid global variable range.")
|
|
||||||
| Before bb -> fold_left_global_range f (f init bb) (global_succ bb) e
|
|
||||||
|
|
||||||
let fold_left_globals f init m =
|
|
||||||
fold_left_global_range f init (global_begin m) (At_end m)
|
|
||||||
|
|
||||||
let rec rev_iter_global_range f i e =
|
|
||||||
if i = e then () else
|
|
||||||
match i with
|
|
||||||
| At_start _ -> raise (Invalid_argument "Invalid global variable range.")
|
|
||||||
| After bb ->
|
|
||||||
f bb;
|
|
||||||
rev_iter_global_range f (global_pred bb) e
|
|
||||||
|
|
||||||
let rev_iter_globals f m =
|
|
||||||
rev_iter_global_range f (global_end m) (At_start m)
|
|
||||||
|
|
||||||
let rec fold_right_global_range f i e init =
|
|
||||||
if i = e then init else
|
|
||||||
match i with
|
|
||||||
| At_start _ -> raise (Invalid_argument "Invalid global variable range.")
|
|
||||||
| After bb -> fold_right_global_range f (global_pred bb) e (f bb init)
|
|
||||||
|
|
||||||
let fold_right_globals f m init =
|
|
||||||
fold_right_global_range f (global_end m) (At_start m) init
|
|
||||||
|
|
||||||
(*--... Operations on functions ............................................--*)
|
|
||||||
external declare_function : string -> lltype -> llmodule -> llvalue
|
|
||||||
= "llvm_declare_function"
|
|
||||||
external define_function : string -> lltype -> llmodule -> llvalue
|
|
||||||
= "llvm_define_function"
|
|
||||||
external lookup_function : string -> llmodule -> llvalue option
|
|
||||||
= "llvm_lookup_function"
|
|
||||||
external delete_function : llvalue -> unit = "llvm_delete_function"
|
|
||||||
external is_intrinsic : llvalue -> bool = "llvm_is_intrinsic"
|
|
||||||
external function_call_conv : llvalue -> int = "llvm_function_call_conv"
|
|
||||||
external set_function_call_conv : int -> llvalue -> unit
|
|
||||||
= "llvm_set_function_call_conv"
|
|
||||||
external gc : llvalue -> string option = "llvm_gc"
|
|
||||||
external set_gc : string option -> llvalue -> unit = "llvm_set_gc"
|
|
||||||
external function_begin : llmodule -> (llmodule, llvalue) llpos
|
|
||||||
= "llvm_function_begin"
|
|
||||||
external function_succ : llvalue -> (llmodule, llvalue) llpos
|
|
||||||
= "llvm_function_succ"
|
|
||||||
external function_end : llmodule -> (llmodule, llvalue) llrev_pos
|
|
||||||
= "llvm_function_end"
|
|
||||||
external function_pred : llvalue -> (llmodule, llvalue) llrev_pos
|
|
||||||
= "llvm_function_pred"
|
|
||||||
|
|
||||||
let rec iter_function_range f i e =
|
|
||||||
if i = e then () else
|
|
||||||
match i with
|
|
||||||
| At_end _ -> raise (Invalid_argument "Invalid function range.")
|
|
||||||
| Before fn ->
|
|
||||||
f fn;
|
|
||||||
iter_function_range f (function_succ fn) e
|
|
||||||
|
|
||||||
let iter_functions f m =
|
|
||||||
iter_function_range f (function_begin m) (At_end m)
|
|
||||||
|
|
||||||
let rec fold_left_function_range f init i e =
|
|
||||||
if i = e then init else
|
|
||||||
match i with
|
|
||||||
| At_end _ -> raise (Invalid_argument "Invalid function range.")
|
|
||||||
| Before fn -> fold_left_function_range f (f init fn) (function_succ fn) e
|
|
||||||
|
|
||||||
let fold_left_functions f init m =
|
|
||||||
fold_left_function_range f init (function_begin m) (At_end m)
|
|
||||||
|
|
||||||
let rec rev_iter_function_range f i e =
|
|
||||||
if i = e then () else
|
|
||||||
match i with
|
|
||||||
| At_start _ -> raise (Invalid_argument "Invalid function range.")
|
|
||||||
| After fn ->
|
|
||||||
f fn;
|
|
||||||
rev_iter_function_range f (function_pred fn) e
|
|
||||||
|
|
||||||
let rev_iter_functions f m =
|
|
||||||
rev_iter_function_range f (function_end m) (At_start m)
|
|
||||||
|
|
||||||
let rec fold_right_function_range f i e init =
|
|
||||||
if i = e then init else
|
|
||||||
match i with
|
|
||||||
| At_start _ -> raise (Invalid_argument "Invalid function range.")
|
|
||||||
| After fn -> fold_right_function_range f (function_pred fn) e (f fn init)
|
|
||||||
|
|
||||||
let fold_right_functions f m init =
|
|
||||||
fold_right_function_range f (function_end m) (At_start m) init
|
|
||||||
|
|
||||||
(* TODO: param attrs *)
|
|
||||||
|
|
||||||
(*--... Operations on params ...............................................--*)
|
|
||||||
external params : llvalue -> llvalue array = "llvm_params"
|
|
||||||
external param : llvalue -> int -> llvalue = "llvm_param"
|
|
||||||
external param_parent : llvalue -> llvalue = "LLVMGetParamParent"
|
|
||||||
external param_begin : llvalue -> (llvalue, llvalue) llpos = "llvm_param_begin"
|
|
||||||
external param_succ : llvalue -> (llvalue, llvalue) llpos = "llvm_param_succ"
|
|
||||||
external param_end : llvalue -> (llvalue, llvalue) llrev_pos = "llvm_param_end"
|
|
||||||
external param_pred : llvalue -> (llvalue, llvalue) llrev_pos ="llvm_param_pred"
|
|
||||||
|
|
||||||
let rec iter_param_range f i e =
|
|
||||||
if i = e then () else
|
|
||||||
match i with
|
|
||||||
| At_end _ -> raise (Invalid_argument "Invalid parameter range.")
|
|
||||||
| Before p ->
|
|
||||||
f p;
|
|
||||||
iter_param_range f (param_succ p) e
|
|
||||||
|
|
||||||
let iter_params f fn =
|
|
||||||
iter_param_range f (param_begin fn) (At_end fn)
|
|
||||||
|
|
||||||
let rec fold_left_param_range f init i e =
|
|
||||||
if i = e then init else
|
|
||||||
match i with
|
|
||||||
| At_end _ -> raise (Invalid_argument "Invalid parameter range.")
|
|
||||||
| Before p -> fold_left_param_range f (f init p) (param_succ p) e
|
|
||||||
|
|
||||||
let fold_left_params f init fn =
|
|
||||||
fold_left_param_range f init (param_begin fn) (At_end fn)
|
|
||||||
|
|
||||||
let rec rev_iter_param_range f i e =
|
|
||||||
if i = e then () else
|
|
||||||
match i with
|
|
||||||
| At_start _ -> raise (Invalid_argument "Invalid parameter range.")
|
|
||||||
| After p ->
|
|
||||||
f p;
|
|
||||||
rev_iter_param_range f (param_pred p) e
|
|
||||||
|
|
||||||
let rev_iter_params f fn =
|
|
||||||
rev_iter_param_range f (param_end fn) (At_start fn)
|
|
||||||
|
|
||||||
let rec fold_right_param_range f init i e =
|
|
||||||
if i = e then init else
|
|
||||||
match i with
|
|
||||||
| At_start _ -> raise (Invalid_argument "Invalid parameter range.")
|
|
||||||
| After p -> fold_right_param_range f (f p init) (param_pred p) e
|
|
||||||
|
|
||||||
let fold_right_params f fn init =
|
|
||||||
fold_right_param_range f init (param_end fn) (At_start fn)
|
|
||||||
|
|
||||||
(*--... Operations on basic blocks .........................................--*)
|
|
||||||
external value_of_block : llbasicblock -> llvalue = "LLVMBasicBlockAsValue"
|
|
||||||
external value_is_block : llvalue -> bool = "llvm_value_is_block"
|
|
||||||
external block_of_value : llvalue -> llbasicblock = "LLVMValueAsBasicBlock"
|
|
||||||
external block_parent : llbasicblock -> llvalue = "LLVMGetBasicBlockParent"
|
|
||||||
external basic_blocks : llvalue -> llbasicblock array = "llvm_basic_blocks"
|
|
||||||
external entry_block : llvalue -> llbasicblock = "LLVMGetEntryBasicBlock"
|
|
||||||
external delete_block : llbasicblock -> unit = "llvm_delete_block"
|
|
||||||
external append_block : string -> llvalue -> llbasicblock = "llvm_append_block"
|
|
||||||
external insert_block : string -> llbasicblock -> llbasicblock
|
|
||||||
= "llvm_insert_block"
|
|
||||||
external block_begin : llvalue -> (llvalue, llbasicblock) llpos
|
|
||||||
= "llvm_block_begin"
|
|
||||||
external block_succ : llbasicblock -> (llvalue, llbasicblock) llpos
|
|
||||||
= "llvm_block_succ"
|
|
||||||
external block_end : llvalue -> (llvalue, llbasicblock) llrev_pos
|
|
||||||
= "llvm_block_end"
|
|
||||||
external block_pred : llbasicblock -> (llvalue, llbasicblock) llrev_pos
|
|
||||||
= "llvm_block_pred"
|
|
||||||
|
|
||||||
let rec iter_block_range f i e =
|
|
||||||
if i = e then () else
|
|
||||||
match i with
|
|
||||||
| At_end _ -> raise (Invalid_argument "Invalid block range.")
|
|
||||||
| Before bb ->
|
|
||||||
f bb;
|
|
||||||
iter_block_range f (block_succ bb) e
|
|
||||||
|
|
||||||
let iter_blocks f fn =
|
|
||||||
iter_block_range f (block_begin fn) (At_end fn)
|
|
||||||
|
|
||||||
let rec fold_left_block_range f init i e =
|
|
||||||
if i = e then init else
|
|
||||||
match i with
|
|
||||||
| At_end _ -> raise (Invalid_argument "Invalid block range.")
|
|
||||||
| Before bb -> fold_left_block_range f (f init bb) (block_succ bb) e
|
|
||||||
|
|
||||||
let fold_left_blocks f init fn =
|
|
||||||
fold_left_block_range f init (block_begin fn) (At_end fn)
|
|
||||||
|
|
||||||
let rec rev_iter_block_range f i e =
|
|
||||||
if i = e then () else
|
|
||||||
match i with
|
|
||||||
| At_start _ -> raise (Invalid_argument "Invalid block range.")
|
|
||||||
| After bb ->
|
|
||||||
f bb;
|
|
||||||
rev_iter_block_range f (block_pred bb) e
|
|
||||||
|
|
||||||
let rev_iter_blocks f fn =
|
|
||||||
rev_iter_block_range f (block_end fn) (At_start fn)
|
|
||||||
|
|
||||||
let rec fold_right_block_range f init i e =
|
|
||||||
if i = e then init else
|
|
||||||
match i with
|
|
||||||
| At_start _ -> raise (Invalid_argument "Invalid block range.")
|
|
||||||
| After bb -> fold_right_block_range f (f bb init) (block_pred bb) e
|
|
||||||
|
|
||||||
let fold_right_blocks f fn init =
|
|
||||||
fold_right_block_range f init (block_end fn) (At_start fn)
|
|
||||||
|
|
||||||
(*--... Operations on instructions .........................................--*)
|
|
||||||
external instr_parent : llvalue -> llbasicblock = "LLVMGetInstructionParent"
|
|
||||||
external instr_begin : llbasicblock -> (llbasicblock, llvalue) llpos
|
|
||||||
= "llvm_instr_begin"
|
|
||||||
external instr_succ : llvalue -> (llbasicblock, llvalue) llpos
|
|
||||||
= "llvm_instr_succ"
|
|
||||||
external instr_end : llbasicblock -> (llbasicblock, llvalue) llrev_pos
|
|
||||||
= "llvm_instr_end"
|
|
||||||
external instr_pred : llvalue -> (llbasicblock, llvalue) llrev_pos
|
|
||||||
= "llvm_instr_pred"
|
|
||||||
|
|
||||||
let rec iter_instrs_range f i e =
|
|
||||||
if i = e then () else
|
|
||||||
match i with
|
|
||||||
| At_end _ -> raise (Invalid_argument "Invalid instruction range.")
|
|
||||||
| Before i ->
|
|
||||||
f i;
|
|
||||||
iter_instrs_range f (instr_succ i) e
|
|
||||||
|
|
||||||
let iter_instrs f bb =
|
|
||||||
iter_instrs_range f (instr_begin bb) (At_end bb)
|
|
||||||
|
|
||||||
let rec fold_left_instrs_range f init i e =
|
|
||||||
if i = e then init else
|
|
||||||
match i with
|
|
||||||
| At_end _ -> raise (Invalid_argument "Invalid instruction range.")
|
|
||||||
| Before i -> fold_left_instrs_range f (f init i) (instr_succ i) e
|
|
||||||
|
|
||||||
let fold_left_instrs f init bb =
|
|
||||||
fold_left_instrs_range f init (instr_begin bb) (At_end bb)
|
|
||||||
|
|
||||||
let rec rev_iter_instrs_range f i e =
|
|
||||||
if i = e then () else
|
|
||||||
match i with
|
|
||||||
| At_start _ -> raise (Invalid_argument "Invalid instruction range.")
|
|
||||||
| After i ->
|
|
||||||
f i;
|
|
||||||
rev_iter_instrs_range f (instr_pred i) e
|
|
||||||
|
|
||||||
let rev_iter_instrs f bb =
|
|
||||||
rev_iter_instrs_range f (instr_end bb) (At_start bb)
|
|
||||||
|
|
||||||
let rec fold_right_instr_range f i e init =
|
|
||||||
if i = e then init else
|
|
||||||
match i with
|
|
||||||
| At_start _ -> raise (Invalid_argument "Invalid instruction range.")
|
|
||||||
| After i -> fold_right_instr_range f (instr_pred i) e (f i init)
|
|
||||||
|
|
||||||
let fold_right_instrs f bb init =
|
|
||||||
fold_right_instr_range f (instr_end bb) (At_start bb) init
|
|
||||||
|
|
||||||
|
|
||||||
(*--... Operations on call sites ...........................................--*)
|
|
||||||
external instruction_call_conv: llvalue -> int
|
|
||||||
= "llvm_instruction_call_conv"
|
|
||||||
external set_instruction_call_conv: int -> llvalue -> unit
|
|
||||||
= "llvm_set_instruction_call_conv"
|
|
||||||
|
|
||||||
(*--... Operations on call instructions (only) .............................--*)
|
|
||||||
external is_tail_call : llvalue -> bool = "llvm_is_tail_call"
|
|
||||||
external set_tail_call : bool -> llvalue -> unit = "llvm_set_tail_call"
|
|
||||||
|
|
||||||
(*--... Operations on phi nodes ............................................--*)
|
|
||||||
external add_incoming : (llvalue * llbasicblock) -> llvalue -> unit
|
|
||||||
= "llvm_add_incoming"
|
|
||||||
external incoming : llvalue -> (llvalue * llbasicblock) list = "llvm_incoming"
|
|
||||||
|
|
||||||
|
|
||||||
(*===-- Instruction builders ----------------------------------------------===*)
|
|
||||||
external builder : unit -> llbuilder = "llvm_builder"
|
|
||||||
external position_builder : (llbasicblock, llvalue) llpos -> llbuilder -> unit
|
|
||||||
= "llvm_position_builder"
|
|
||||||
external insertion_block : llbuilder -> llbasicblock = "llvm_insertion_block"
|
|
||||||
|
|
||||||
let builder_at ip =
|
|
||||||
let b = builder () in
|
|
||||||
position_builder ip b;
|
|
||||||
b
|
|
||||||
|
|
||||||
let builder_before i = builder_at (Before i)
|
|
||||||
let builder_at_end bb = builder_at (At_end bb)
|
|
||||||
|
|
||||||
let position_before i = position_builder (Before i)
|
|
||||||
let position_at_end bb = position_builder (At_end bb)
|
|
||||||
|
|
||||||
|
|
||||||
(*--... Terminators ........................................................--*)
|
|
||||||
external build_ret_void : llbuilder -> llvalue = "llvm_build_ret_void"
|
|
||||||
external build_ret : llvalue -> llbuilder -> llvalue = "llvm_build_ret"
|
|
||||||
external build_br : llbasicblock -> llbuilder -> llvalue = "llvm_build_br"
|
|
||||||
external build_cond_br : llvalue -> llbasicblock -> llbasicblock -> llbuilder ->
|
|
||||||
llvalue = "llvm_build_cond_br"
|
|
||||||
external build_switch : llvalue -> llbasicblock -> int -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_switch"
|
|
||||||
external add_case : llvalue -> llvalue -> llbasicblock -> unit
|
|
||||||
= "llvm_add_case"
|
|
||||||
external build_invoke : llvalue -> llvalue array -> llbasicblock ->
|
|
||||||
llbasicblock -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_invoke_bc" "llvm_build_invoke_nat"
|
|
||||||
external build_unwind : llbuilder -> llvalue = "llvm_build_unwind"
|
|
||||||
external build_unreachable : llbuilder -> llvalue = "llvm_build_unreachable"
|
|
||||||
|
|
||||||
(*--... Arithmetic .........................................................--*)
|
|
||||||
external build_add : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_add"
|
|
||||||
external build_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_sub"
|
|
||||||
external build_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_mul"
|
|
||||||
external build_udiv : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_udiv"
|
|
||||||
external build_sdiv : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_sdiv"
|
|
||||||
external build_fdiv : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_fdiv"
|
|
||||||
external build_urem : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_urem"
|
|
||||||
external build_srem : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_srem"
|
|
||||||
external build_frem : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_frem"
|
|
||||||
external build_shl : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_shl"
|
|
||||||
external build_lshr : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_lshr"
|
|
||||||
external build_ashr : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_ashr"
|
|
||||||
external build_and : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_and"
|
|
||||||
external build_or : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_or"
|
|
||||||
external build_xor : llvalue -> llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_xor"
|
|
||||||
external build_neg : llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_neg"
|
|
||||||
external build_not : llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_not"
|
|
||||||
|
|
||||||
(*--... Memory .............................................................--*)
|
|
||||||
external build_malloc : lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_malloc"
|
|
||||||
external build_array_malloc : lltype -> llvalue -> string -> llbuilder ->
|
|
||||||
llvalue = "llvm_build_array_malloc"
|
|
||||||
external build_alloca : lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_alloca"
|
|
||||||
external build_array_alloca : lltype -> llvalue -> string -> llbuilder ->
|
|
||||||
llvalue = "llvm_build_array_alloca"
|
|
||||||
external build_free : llvalue -> llbuilder -> llvalue = "llvm_build_free"
|
|
||||||
external build_load : llvalue -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_load"
|
|
||||||
external build_store : llvalue -> llvalue -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_store"
|
|
||||||
external build_gep : llvalue -> llvalue array -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_gep"
|
|
||||||
|
|
||||||
(*--... Casts ..............................................................--*)
|
|
||||||
external build_trunc : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_trunc"
|
|
||||||
external build_zext : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_zext"
|
|
||||||
external build_sext : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_sext"
|
|
||||||
external build_fptoui : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_fptoui"
|
|
||||||
external build_fptosi : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_fptosi"
|
|
||||||
external build_uitofp : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_uitofp"
|
|
||||||
external build_sitofp : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_sitofp"
|
|
||||||
external build_fptrunc : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_fptrunc"
|
|
||||||
external build_fpext : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_fpext"
|
|
||||||
external build_ptrtoint : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_prttoint"
|
|
||||||
external build_inttoptr : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_inttoptr"
|
|
||||||
external build_bitcast : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_bitcast"
|
|
||||||
|
|
||||||
(*--... Comparisons ........................................................--*)
|
|
||||||
external build_icmp : Icmp.t -> llvalue -> llvalue -> string ->
|
|
||||||
llbuilder -> llvalue = "llvm_build_icmp"
|
|
||||||
external build_fcmp : Fcmp.t -> llvalue -> llvalue -> string ->
|
|
||||||
llbuilder -> llvalue = "llvm_build_fcmp"
|
|
||||||
|
|
||||||
(*--... Miscellaneous instructions .........................................--*)
|
|
||||||
external build_phi : (llvalue * llbasicblock) list -> string -> llbuilder ->
|
|
||||||
llvalue = "llvm_build_phi"
|
|
||||||
external build_call : llvalue -> llvalue array -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_call"
|
|
||||||
external build_select : llvalue -> llvalue -> llvalue -> string -> llbuilder ->
|
|
||||||
llvalue = "llvm_build_select"
|
|
||||||
external build_va_arg : llvalue -> lltype -> string -> llbuilder -> llvalue
|
|
||||||
= "llvm_build_va_arg"
|
|
||||||
external build_extractelement : llvalue -> llvalue -> string -> llbuilder ->
|
|
||||||
llvalue = "llvm_build_extractelement"
|
|
||||||
external build_insertelement : llvalue -> llvalue -> llvalue -> string ->
|
|
||||||
llbuilder -> llvalue = "llvm_build_insertelement"
|
|
||||||
external build_shufflevector : llvalue -> llvalue -> llvalue -> string ->
|
|
||||||
llbuilder -> llvalue = "llvm_build_shufflevector"
|
|
||||||
|
|
||||||
|
|
||||||
(*===-- Module providers --------------------------------------------------===*)
|
|
||||||
|
|
||||||
module ModuleProvider = struct
|
|
||||||
external create : llmodule -> llmoduleprovider
|
|
||||||
= "LLVMCreateModuleProviderForExistingModule"
|
|
||||||
external dispose : llmoduleprovider -> unit = "llvm_dispose_module_provider"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
(*===-- Memory buffers ----------------------------------------------------===*)
|
|
||||||
|
|
||||||
module MemoryBuffer = struct
|
|
||||||
external of_file : string -> llmemorybuffer = "llvm_memorybuffer_of_file"
|
|
||||||
external of_stdin : unit -> llmemorybuffer = "llvm_memorybuffer_of_stdin"
|
|
||||||
external dispose : llmemorybuffer -> unit = "llvm_memorybuffer_dispose"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
(*===-- Pass Manager ------------------------------------------------------===*)
|
|
||||||
|
|
||||||
module PassManager = struct
|
|
||||||
type 'a t
|
|
||||||
type any = [ `Module | `Function ]
|
|
||||||
external create : unit -> [ `Module ] t = "llvm_passmanager_create"
|
|
||||||
external create_function : llmoduleprovider -> [ `Function ] t
|
|
||||||
= "LLVMCreateFunctionPassManager"
|
|
||||||
external run_module : llmodule -> [ `Module ] t -> bool
|
|
||||||
= "llvm_passmanager_run_module"
|
|
||||||
external initialize : [ `Function ] t -> bool = "llvm_passmanager_initialize"
|
|
||||||
external run_function : llvalue -> [ `Function ] t -> bool
|
|
||||||
= "llvm_passmanager_run_function"
|
|
||||||
external finalize : [ `Function ] t -> bool = "llvm_passmanager_finalize"
|
|
||||||
external dispose : [< any ] t -> unit = "llvm_passmanager_dispose"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
(*===-- Non-Externs -------------------------------------------------------===*)
|
|
||||||
(* These functions are built using the externals, so must be declared late. *)
|
|
||||||
|
|
||||||
let concat2 sep arr =
|
|
||||||
let s = ref "" in
|
|
||||||
if 0 < Array.length arr then begin
|
|
||||||
s := !s ^ arr.(0);
|
|
||||||
for i = 1 to (Array.length arr) - 1 do
|
|
||||||
s := !s ^ sep ^ arr.(i)
|
|
||||||
done
|
|
||||||
end;
|
|
||||||
!s
|
|
||||||
|
|
||||||
let rec string_of_lltype ty =
|
|
||||||
(* FIXME: stop infinite recursion! :) *)
|
|
||||||
match classify_type ty with
|
|
||||||
TypeKind.Integer -> "i" ^ string_of_int (integer_bitwidth ty)
|
|
||||||
| TypeKind.Pointer -> (string_of_lltype (element_type ty)) ^ "*"
|
|
||||||
| TypeKind.Struct ->
|
|
||||||
let s = "{ " ^ (concat2 ", " (
|
|
||||||
Array.map string_of_lltype (element_types ty)
|
|
||||||
)) ^ " }" in
|
|
||||||
if is_packed ty
|
|
||||||
then "<" ^ s ^ ">"
|
|
||||||
else s
|
|
||||||
| TypeKind.Array -> "[" ^ (string_of_int (array_length ty)) ^
|
|
||||||
" x " ^ (string_of_lltype (element_type ty)) ^ "]"
|
|
||||||
| TypeKind.Vector -> "<" ^ (string_of_int (vector_size ty)) ^
|
|
||||||
" x " ^ (string_of_lltype (element_type ty)) ^ ">"
|
|
||||||
| TypeKind.Opaque -> "opaque"
|
|
||||||
| TypeKind.Function -> string_of_lltype (return_type ty) ^
|
|
||||||
" (" ^ (concat2 ", " (
|
|
||||||
Array.map string_of_lltype (param_types ty)
|
|
||||||
)) ^ ")"
|
|
||||||
| TypeKind.Label -> "label"
|
|
||||||
| TypeKind.Ppc_fp128 -> "ppc_fp128"
|
|
||||||
| TypeKind.Fp128 -> "fp128"
|
|
||||||
| TypeKind.X86fp80 -> "x86_fp80"
|
|
||||||
| TypeKind.Double -> "double"
|
|
||||||
| TypeKind.Float -> "float"
|
|
||||||
| TypeKind.Void -> "void"
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,20 +0,0 @@
|
|||||||
##===- bindings/ocaml/target/Makefile ----------------------*- Makefile -*-===##
|
|
||||||
#
|
|
||||||
# The LLVM Compiler Infrastructure
|
|
||||||
#
|
|
||||||
# This file is distributed under the University of Illinois Open Source
|
|
||||||
# License. See LICENSE.TXT for details.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
#
|
|
||||||
# This is the makefile for the Objective Caml Llvm_target interface.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
LEVEL := ../../..
|
|
||||||
LIBRARYNAME := llvm_target
|
|
||||||
DONT_BUILD_RELINKED := 1
|
|
||||||
UsedComponents := target
|
|
||||||
UsedOcamlInterfaces := llvm
|
|
||||||
|
|
||||||
include ../Makefile.ocaml
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
(*===-- llvm_target.ml - LLVM Ocaml Interface ------------------*- OCaml -*-===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
module Endian = struct
|
|
||||||
type t =
|
|
||||||
| Big
|
|
||||||
| Little
|
|
||||||
end
|
|
||||||
|
|
||||||
module TargetData = struct
|
|
||||||
type t
|
|
||||||
|
|
||||||
external create : string -> t = "llvm_targetdata_create"
|
|
||||||
external add : t -> [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
|
|
||||||
= "llvm_targetdata_add"
|
|
||||||
external as_string : t -> string = "llvm_targetdata_as_string"
|
|
||||||
external invalidate_struct_layout : t -> Llvm.lltype -> unit
|
|
||||||
= "llvm_targetdata_invalidate_struct_layout"
|
|
||||||
external dispose : t -> unit = "llvm_targetdata_dispose"
|
|
||||||
end
|
|
||||||
|
|
||||||
external byte_order : TargetData.t -> Endian.t = "llvm_byte_order"
|
|
||||||
external pointer_size : TargetData.t -> int = "llvm_pointer_size"
|
|
||||||
external intptr_type : TargetData.t -> Llvm.lltype = "LLVMIntPtrType"
|
|
||||||
external size_in_bits : TargetData.t -> Llvm.lltype -> Int64.t
|
|
||||||
= "llvm_size_in_bits"
|
|
||||||
external store_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
|
|
||||||
external abi_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_abi_size"
|
|
||||||
external abi_align : TargetData.t -> Llvm.lltype -> int = "llvm_abi_align"
|
|
||||||
external stack_align : TargetData.t -> Llvm.lltype -> int = "llvm_stack_align"
|
|
||||||
external preferred_align : TargetData.t -> Llvm.lltype -> int
|
|
||||||
= "llvm_preferred_align"
|
|
||||||
external preferred_align_of_global : TargetData.t -> Llvm.llvalue -> int
|
|
||||||
= "llvm_preferred_align_of_global"
|
|
||||||
external element_at_offset : TargetData.t -> Llvm.lltype -> Int64.t -> int
|
|
||||||
= "llvm_element_at_offset"
|
|
||||||
external offset_of_element : TargetData.t -> Llvm.lltype -> int -> Int64.t
|
|
||||||
= "llvm_offset_of_element"
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
(*===-- llvm_target.mli - LLVM Ocaml Interface -----------------*- OCaml -*-===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
(** Target Information.
|
|
||||||
|
|
||||||
This interface provides an ocaml API for LLVM target information,
|
|
||||||
the classes in the Target library. *)
|
|
||||||
|
|
||||||
module Endian : sig
|
|
||||||
type t =
|
|
||||||
| Big
|
|
||||||
| Little
|
|
||||||
end
|
|
||||||
|
|
||||||
module TargetData : sig
|
|
||||||
type t
|
|
||||||
|
|
||||||
(** [TargetData.create rep] parses the target data string representation [rep].
|
|
||||||
See the constructor llvm::TargetData::TargetData. *)
|
|
||||||
external create : string -> t = "llvm_targetdata_create"
|
|
||||||
|
|
||||||
(** [add_target_data td pm] adds the target data [td] to the pass manager [pm].
|
|
||||||
Does not take ownership of the target data.
|
|
||||||
See the method llvm::PassManagerBase::add. *)
|
|
||||||
external add : t -> [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
|
|
||||||
= "llvm_targetdata_add"
|
|
||||||
|
|
||||||
(** [as_string td] is the string representation of the target data [td].
|
|
||||||
See the constructor llvm::TargetData::TargetData. *)
|
|
||||||
external as_string : t -> string = "llvm_targetdata_as_string"
|
|
||||||
|
|
||||||
(** Struct layouts are speculatively cached. If a TargetDataRef is alive when
|
|
||||||
types are being refined and removed, this method must be called whenever a
|
|
||||||
struct type is removed to avoid a dangling pointer in this cache.
|
|
||||||
See the method llvm::TargetData::InvalidateStructLayoutInfo. *)
|
|
||||||
external invalidate_struct_layout : t -> Llvm.lltype -> unit
|
|
||||||
= "llvm_targetdata_invalidate_struct_layout"
|
|
||||||
|
|
||||||
(** Deallocates a TargetData.
|
|
||||||
See the destructor llvm::TargetData::~TargetData. *)
|
|
||||||
external dispose : t -> unit = "llvm_targetdata_dispose"
|
|
||||||
end
|
|
||||||
|
|
||||||
(** Returns the byte order of a target, either LLVMBigEndian or
|
|
||||||
LLVMLittleEndian.
|
|
||||||
See the method llvm::TargetData::isLittleEndian. *)
|
|
||||||
external byte_order : TargetData.t -> Endian.t = "llvm_byte_order"
|
|
||||||
|
|
||||||
(** Returns the pointer size in bytes for a target.
|
|
||||||
See the method llvm::TargetData::getPointerSize. *)
|
|
||||||
external pointer_size : TargetData.t -> int = "llvm_pointer_size"
|
|
||||||
|
|
||||||
(** Returns the integer type that is the same size as a pointer on a target.
|
|
||||||
See the method llvm::TargetData::getIntPtrType. *)
|
|
||||||
external intptr_type : TargetData.t -> Llvm.lltype = "LLVMIntPtrType"
|
|
||||||
|
|
||||||
(** Computes the size of a type in bytes for a target.
|
|
||||||
See the method llvm::TargetData::getTypeSizeInBits. *)
|
|
||||||
external size_in_bits : TargetData.t -> Llvm.lltype -> Int64.t
|
|
||||||
= "llvm_size_in_bits"
|
|
||||||
|
|
||||||
(** Computes the storage size of a type in bytes for a target.
|
|
||||||
See the method llvm::TargetData::getTypeStoreSize. *)
|
|
||||||
external store_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
|
|
||||||
|
|
||||||
(** Computes the ABI size of a type in bytes for a target.
|
|
||||||
See the method llvm::TargetData::getTypePaddedSize. *)
|
|
||||||
external abi_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_abi_size"
|
|
||||||
|
|
||||||
(** Computes the ABI alignment of a type in bytes for a target.
|
|
||||||
See the method llvm::TargetData::getTypeABISize. *)
|
|
||||||
external abi_align : TargetData.t -> Llvm.lltype -> int = "llvm_abi_align"
|
|
||||||
|
|
||||||
(** Computes the call frame alignment of a type in bytes for a target.
|
|
||||||
See the method llvm::TargetData::getTypeABISize. *)
|
|
||||||
external stack_align : TargetData.t -> Llvm.lltype -> int = "llvm_stack_align"
|
|
||||||
|
|
||||||
(** Computes the preferred alignment of a type in bytes for a target.
|
|
||||||
See the method llvm::TargetData::getTypeABISize. *)
|
|
||||||
external preferred_align : TargetData.t -> Llvm.lltype -> int
|
|
||||||
= "llvm_preferred_align"
|
|
||||||
|
|
||||||
(** Computes the preferred alignment of a global variable in bytes for a target.
|
|
||||||
See the method llvm::TargetData::getPreferredAlignment. *)
|
|
||||||
external preferred_align_of_global : TargetData.t -> Llvm.llvalue -> int
|
|
||||||
= "llvm_preferred_align_of_global"
|
|
||||||
|
|
||||||
(** Computes the structure element that contains the byte offset for a target.
|
|
||||||
See the method llvm::StructLayout::getElementContainingOffset. *)
|
|
||||||
external element_at_offset : TargetData.t -> Llvm.lltype -> Int64.t -> int
|
|
||||||
= "llvm_element_at_offset"
|
|
||||||
|
|
||||||
(** Computes the byte offset of the indexed struct element for a target.
|
|
||||||
See the method llvm::StructLayout::getElementContainingOffset. *)
|
|
||||||
external offset_of_element : TargetData.t -> Llvm.lltype -> int -> Int64.t
|
|
||||||
= "llvm_offset_of_element"
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
/*===-- target_ocaml.c - LLVM Ocaml Glue ------------------------*- C++ -*-===*\
|
|
||||||
|* *|
|
|
||||||
|* The LLVM Compiler Infrastructure *|
|
|
||||||
|* *|
|
|
||||||
|* This file is distributed under the University of Illinois Open Source *|
|
|
||||||
|* License. See LICENSE.TXT for details. *|
|
|
||||||
|* *|
|
|
||||||
|*===----------------------------------------------------------------------===*|
|
|
||||||
|* *|
|
|
||||||
|* This file glues LLVM's ocaml interface to its C interface. These functions *|
|
|
||||||
|* are by and large transparent wrappers to the corresponding C functions. *|
|
|
||||||
|* *|
|
|
||||||
|* Note that these functions intentionally take liberties with the CAMLparamX *|
|
|
||||||
|* macros, since most of the parameters are not GC heap objects. *|
|
|
||||||
|* *|
|
|
||||||
\*===----------------------------------------------------------------------===*/
|
|
||||||
|
|
||||||
#include "llvm-c/Target.h"
|
|
||||||
#include "caml/alloc.h"
|
|
||||||
|
|
||||||
/* string -> TargetData.t */
|
|
||||||
CAMLprim LLVMTargetDataRef llvm_targetdata_create(value StringRep) {
|
|
||||||
return LLVMCreateTargetData(String_val(StringRep));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
|
|
||||||
CAMLprim value llvm_targetdata_add(LLVMTargetDataRef TD, LLVMPassManagerRef PM){
|
|
||||||
LLVMAddTargetData(TD, PM);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> string */
|
|
||||||
CAMLprim value llvm_targetdata_as_string(LLVMTargetDataRef TD) {
|
|
||||||
char *StringRep = LLVMCopyStringRepOfTargetData(TD);
|
|
||||||
value Copy = copy_string(StringRep);
|
|
||||||
LLVMDisposeMessage(StringRep);
|
|
||||||
return Copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> unit */
|
|
||||||
CAMLprim value llvm_targetdata_invalidate_struct_layout(LLVMTargetDataRef TD,
|
|
||||||
LLVMTypeRef Ty) {
|
|
||||||
LLVMInvalidateStructLayout(TD, Ty);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> unit */
|
|
||||||
CAMLprim value llvm_targetdata_dispose(LLVMTargetDataRef TD) {
|
|
||||||
LLVMDisposeTargetData(TD);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> Endian.t */
|
|
||||||
CAMLprim value llvm_byte_order(LLVMTargetDataRef TD) {
|
|
||||||
return Val_int(LLVMByteOrder(TD));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> int */
|
|
||||||
CAMLprim value llvm_pointer_size(LLVMTargetDataRef TD) {
|
|
||||||
return Val_int(LLVMPointerSize(TD));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> Int64.t */
|
|
||||||
CAMLprim value llvm_size_in_bits(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
|
|
||||||
return caml_copy_int64(LLVMSizeOfTypeInBits(TD, Ty));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> Int64.t */
|
|
||||||
CAMLprim value llvm_store_size(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
|
|
||||||
return caml_copy_int64(LLVMStoreSizeOfType(TD, Ty));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> Int64.t */
|
|
||||||
CAMLprim value llvm_abi_size(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
|
|
||||||
return caml_copy_int64(LLVMABISizeOfType(TD, Ty));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> int */
|
|
||||||
CAMLprim value llvm_abi_align(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
|
|
||||||
return Val_int(LLVMABIAlignmentOfType(TD, Ty));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> int */
|
|
||||||
CAMLprim value llvm_stack_align(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
|
|
||||||
return Val_int(LLVMCallFrameAlignmentOfType(TD, Ty));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> int */
|
|
||||||
CAMLprim value llvm_preferred_align(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
|
|
||||||
return Val_int(LLVMPreferredAlignmentOfType(TD, Ty));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.llvalue -> int */
|
|
||||||
CAMLprim value llvm_preferred_align_of_global(LLVMTargetDataRef TD,
|
|
||||||
LLVMValueRef GlobalVar) {
|
|
||||||
return Val_int(LLVMPreferredAlignmentOfGlobal(TD, GlobalVar));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> Int64.t -> int */
|
|
||||||
CAMLprim value llvm_element_at_offset(LLVMTargetDataRef TD, LLVMTypeRef Ty,
|
|
||||||
value Offset) {
|
|
||||||
return Val_int(LLVMElementAtOffset(TD, Ty, Int_val(Offset)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> int -> Int64.t */
|
|
||||||
CAMLprim value llvm_offset_of_element(LLVMTargetDataRef TD, LLVMTypeRef Ty,
|
|
||||||
value Index) {
|
|
||||||
return caml_copy_int64(LLVMOffsetOfElement(TD, Ty, Int_val(Index)));
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
##===- bindings/ocaml/transforms/Makefile ------------------*- Makefile -*-===##
|
|
||||||
#
|
|
||||||
# The LLVM Compiler Infrastructure
|
|
||||||
#
|
|
||||||
# This file is distributed under the University of Illinois Open Source
|
|
||||||
# License. See LICENSE.TXT for details.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
LEVEL := ../../..
|
|
||||||
DIRS = scalar
|
|
||||||
|
|
||||||
ocamldoc:
|
|
||||||
$(Verb) for i in $(DIRS) ; do \
|
|
||||||
$(MAKE) -C $$i ocamldoc; \
|
|
||||||
done
|
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.common
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
##===- bindings/ocaml/transforms/scalar/Makefile -----------*- Makefile -*-===##
|
|
||||||
#
|
|
||||||
# The LLVM Compiler Infrastructure
|
|
||||||
#
|
|
||||||
# This file is distributed under the University of Illinois Open Source
|
|
||||||
# License. See LICENSE.TXT for details.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
#
|
|
||||||
# This is the makefile for the Objective Caml Llvm_scalar_opts interface.
|
|
||||||
#
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
LEVEL := ../../../..
|
|
||||||
LIBRARYNAME := llvm_scalar_opts
|
|
||||||
DONT_BUILD_RELINKED := 1
|
|
||||||
UsedComponents := scalaropts
|
|
||||||
UsedOcamlInterfaces := llvm
|
|
||||||
|
|
||||||
include ../../Makefile.ocaml
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
(*===-- llvm_scalar_opts.ml - LLVM Ocaml Interface -------------*- OCaml -*-===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
external add_constant_propagation : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_constant_propagation"
|
|
||||||
external add_instruction_combining : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_instruction_combining"
|
|
||||||
external
|
|
||||||
add_memory_to_register_promotion : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_memory_to_register_promotion"
|
|
||||||
external
|
|
||||||
add_memory_to_register_demotion : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_memory_to_register_demotion"
|
|
||||||
external add_reassociation : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_reassociation"
|
|
||||||
external add_gvn : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_gvn"
|
|
||||||
external add_cfg_simplification : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_cfg_simplification"
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
(*===-- llvm_scalar_opts.mli - LLVM Ocaml Interface ------------*- OCaml -*-===*
|
|
||||||
*
|
|
||||||
* The LLVM Compiler Infrastructure
|
|
||||||
*
|
|
||||||
* This file is distributed under the University of Illinois Open Source
|
|
||||||
* License. See LICENSE.TXT for details.
|
|
||||||
*
|
|
||||||
*===----------------------------------------------------------------------===*)
|
|
||||||
|
|
||||||
(** Scalar Transforms.
|
|
||||||
|
|
||||||
This interface provides an ocaml API for LLVM scalar transforms, the
|
|
||||||
classes in the [LLVMScalarOpts] library. *)
|
|
||||||
|
|
||||||
(** See the [llvm::createConstantPropogationPass] function. *)
|
|
||||||
external add_constant_propagation : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_constant_propagation"
|
|
||||||
|
|
||||||
(** See the [llvm::createInstructionCombiningPass] function. *)
|
|
||||||
external add_instruction_combining : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_instruction_combining"
|
|
||||||
|
|
||||||
(** See the [llvm::createPromoteMemoryToRegisterPass] function. *)
|
|
||||||
external
|
|
||||||
add_memory_to_register_promotion : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_memory_to_register_promotion"
|
|
||||||
|
|
||||||
(** See the [llvm::createDemoteMemoryToRegisterPass] function. *)
|
|
||||||
external
|
|
||||||
add_memory_to_register_demotion : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_memory_to_register_demotion"
|
|
||||||
|
|
||||||
(** See the [llvm::createReassociatePass] function. *)
|
|
||||||
external add_reassociation : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_reassociation"
|
|
||||||
|
|
||||||
(** See the [llvm::createGVNPass] function. *)
|
|
||||||
external add_gvn : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_gvn"
|
|
||||||
|
|
||||||
(** See the [llvm::createCFGSimplificationPass] function. *)
|
|
||||||
external add_cfg_simplification : [<Llvm.PassManager.any] Llvm.PassManager.t
|
|
||||||
-> unit
|
|
||||||
= "llvm_add_cfg_simplification"
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
/*===-- scalar_opts_ocaml.c - LLVM Ocaml Glue -------------------*- C++ -*-===*\
|
|
||||||
|* *|
|
|
||||||
|* The LLVM Compiler Infrastructure *|
|
|
||||||
|* *|
|
|
||||||
|* This file is distributed under the University of Illinois Open Source *|
|
|
||||||
|* License. See LICENSE.TXT for details. *|
|
|
||||||
|* *|
|
|
||||||
|*===----------------------------------------------------------------------===*|
|
|
||||||
|* *|
|
|
||||||
|* This file glues LLVM's ocaml interface to its C interface. These functions *|
|
|
||||||
|* are by and large transparent wrappers to the corresponding C functions. *|
|
|
||||||
|* *|
|
|
||||||
|* Note that these functions intentionally take liberties with the CAMLparamX *|
|
|
||||||
|* macros, since most of the parameters are not GC heap objects. *|
|
|
||||||
|* *|
|
|
||||||
\*===----------------------------------------------------------------------===*/
|
|
||||||
|
|
||||||
#include "llvm-c/Transforms/Scalar.h"
|
|
||||||
#include "caml/mlvalues.h"
|
|
||||||
#include "caml/misc.h"
|
|
||||||
|
|
||||||
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
|
|
||||||
CAMLprim value llvm_add_constant_propagation(LLVMPassManagerRef PM) {
|
|
||||||
LLVMAddConstantPropagationPass(PM);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
|
|
||||||
CAMLprim value llvm_add_instruction_combining(LLVMPassManagerRef PM) {
|
|
||||||
LLVMAddInstructionCombiningPass(PM);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
|
|
||||||
CAMLprim value llvm_add_memory_to_register_promotion(LLVMPassManagerRef PM) {
|
|
||||||
LLVMAddPromoteMemoryToRegisterPass(PM);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
|
|
||||||
CAMLprim value llvm_add_memory_to_register_demotion(LLVMPassManagerRef PM) {
|
|
||||||
LLVMAddDemoteMemoryToRegisterPass(PM);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
|
|
||||||
CAMLprim value llvm_add_reassociation(LLVMPassManagerRef PM) {
|
|
||||||
LLVMAddReassociatePass(PM);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
|
|
||||||
CAMLprim value llvm_add_gvn(LLVMPassManagerRef PM) {
|
|
||||||
LLVMAddGVNPass(PM);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
|
|
||||||
CAMLprim value llvm_add_cfg_simplification(LLVMPassManagerRef PM) {
|
|
||||||
LLVMAddCFGSimplificationPass(PM);
|
|
||||||
return Val_unit;
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# This includes the Bourne shell library from llvm-top. Since this file is
|
|
||||||
# generally only used when building from llvm-top, it is safe to assume that
|
|
||||||
# llvm is checked out into llvm-top in which case .. just works.
|
|
||||||
. ../library.sh
|
|
||||||
|
|
||||||
# Process the options passed in to us by the build script into standard
|
|
||||||
# variables.
|
|
||||||
process_arguments "$@"
|
|
||||||
|
|
||||||
# First, see if the build directory is there. If not, create it.
|
|
||||||
build_dir="$LLVM_TOP/build.llvm"
|
|
||||||
if test ! -d "$build_dir" ; then
|
|
||||||
mkdir -p "$build_dir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# See if we have previously been configured by sensing the presence
|
|
||||||
# of the config.status scripts
|
|
||||||
config_status="$build_dir/config.status"
|
|
||||||
if test ! -f "$config_status" -o "$config_status" -ot "$0" ; then
|
|
||||||
# We must configure so build a list of configure options
|
|
||||||
config_options="--prefix=$PREFIX --with-llvmgccdir=$PREFIX"
|
|
||||||
if test "$OPTIMIZED" -eq 1 ; then
|
|
||||||
config_options="$config_options --enable-optimized"
|
|
||||||
else
|
|
||||||
config_options="$config_options --disable-optimized"
|
|
||||||
fi
|
|
||||||
if test "$DEBUG" -eq 1 ; then
|
|
||||||
config_options="$config_options --enable-debug"
|
|
||||||
else
|
|
||||||
config_options="$config_options --disable-debug"
|
|
||||||
fi
|
|
||||||
if test "$ASSERTIONS" -eq 1 ; then
|
|
||||||
config_options="$config_options --enable-assertions"
|
|
||||||
else
|
|
||||||
config_options="$config_options --disable-assertions"
|
|
||||||
fi
|
|
||||||
if test "$CHECKING" -eq 1 ; then
|
|
||||||
config_options="$config_options --enable-expensive-checks"
|
|
||||||
else
|
|
||||||
config_options="$config_options --disable-expensive-checks"
|
|
||||||
fi
|
|
||||||
if test "$DOXYGEN" -eq 1 ; then
|
|
||||||
config_options="$config_options --enable-doxygen"
|
|
||||||
else
|
|
||||||
config_options="$config_options --disable-doxygen"
|
|
||||||
fi
|
|
||||||
if test "$THREADS" -eq 1 ; then
|
|
||||||
config_options="$config_options --enable-threads"
|
|
||||||
else
|
|
||||||
config_options="$config_options --disable-threads"
|
|
||||||
fi
|
|
||||||
config_options="$config_options $OPTIONS_DASH $OPTIONS_DASH_DASH"
|
|
||||||
src_dir=`pwd`
|
|
||||||
cd "$build_dir"
|
|
||||||
msg 0 Configuring $module with:
|
|
||||||
msg 0 " $src_dir/configure" $config_options
|
|
||||||
$src_dir/configure $config_options || \
|
|
||||||
die $? "Configuring $module module failed"
|
|
||||||
else
|
|
||||||
msg 0 Module $module already configured, ignoring configure options.
|
|
||||||
cd "$build_dir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
msg 0 Building $module with:
|
|
||||||
msg 0 " make" $OPTIONS_ASSIGN tools-only
|
|
||||||
make $OPTIONS_ASSIGN tools-only
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
|
|
||||||
# include checks
|
|
||||||
include(CheckIncludeFile)
|
|
||||||
check_include_file(argz.h HAVE_ARGZ_H)
|
|
||||||
check_include_file(assert.h HAVE_ASSERT_H)
|
|
||||||
check_include_file(dirent.h HAVE_DIRENT_H)
|
|
||||||
check_include_file(dl.h HAVE_DL_H)
|
|
||||||
check_include_file(dld.h HAVE_DLD_H)
|
|
||||||
check_include_file(dlfcn.h HAVE_DLFCN_H)
|
|
||||||
check_include_file(errno.h HAVE_ERRNO_H)
|
|
||||||
check_include_file(execinfo.h HAVE_EXECINFO_H)
|
|
||||||
check_include_file(fcntl.h HAVE_FCNTL_H)
|
|
||||||
check_include_file(inttypes.h HAVE_INTTYPES_H)
|
|
||||||
check_include_file(limits.h HAVE_LIMITS_H)
|
|
||||||
check_include_file(link.h HAVE_LINK_H)
|
|
||||||
check_include_file(malloc.h HAVE_MALLOC_H)
|
|
||||||
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
|
|
||||||
check_include_file(memory.h HAVE_MEMORY_H)
|
|
||||||
check_include_file(ndir.h HAVE_NDIR_H)
|
|
||||||
check_include_file(pthread.h HAVE_PTHREAD_H)
|
|
||||||
check_include_file(setjmp.h HAVE_SETJMP_H)
|
|
||||||
check_include_file(signal.h HAVE_SIGNAL_H)
|
|
||||||
check_include_file(stdint.h HAVE_STDINT_H)
|
|
||||||
check_include_file(stdio.h HAVE_STDIO_H)
|
|
||||||
check_include_file(stdlib.h HAVE_STDLIB_H)
|
|
||||||
check_include_file(string.h HAVE_STRING_H)
|
|
||||||
check_include_file(sys/dir.h HAVE_SYS_DIR_H)
|
|
||||||
check_include_file(sys/dl.h HAVE_SYS_DL_H)
|
|
||||||
check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
|
|
||||||
check_include_file(sys/ndir.h HAVE_SYS_NDIR_H)
|
|
||||||
check_include_file(sys/param.h HAVE_SYS_PARAM_H)
|
|
||||||
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
|
|
||||||
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
|
|
||||||
check_include_file(sys/time.h HAVE_SYS_TIME_H)
|
|
||||||
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
|
||||||
check_include_file(unistd.h HAVE_UNISTD_H)
|
|
||||||
check_include_file(utime.h HAVE_UTIME_H)
|
|
||||||
check_include_file(windows.h HAVE_WINDOWS_H)
|
|
||||||
|
|
||||||
# function checks
|
|
||||||
include(CheckSymbolExists)
|
|
||||||
check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE)
|
|
||||||
check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)
|
|
||||||
check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT)
|
|
||||||
check_symbol_exists(isinf cmath HAVE_ISINF_IN_CMATH)
|
|
||||||
check_symbol_exists(isinf math.h HAVE_ISINF_IN_MATH_H)
|
|
||||||
check_symbol_exists(isnan cmath HAVE_ISNAN_IN_CMATH)
|
|
||||||
check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H)
|
|
||||||
check_symbol_exists(ceilf math.h HAVE_CEILF)
|
|
||||||
check_symbol_exists(floorf math.h HAVE_FLOORF)
|
|
||||||
check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
|
|
||||||
check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
|
|
||||||
check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
|
|
||||||
|
|
||||||
include(CheckCXXCompilerFlag)
|
|
||||||
check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG)
|
|
||||||
|
|
||||||
include(GetTargetTriple)
|
|
||||||
get_target_triple(LLVM_HOSTTRIPLE)
|
|
||||||
message(STATUS "LLVM_HOSTTRIPLE: ${LLVM_HOSTTRIPLE}")
|
|
||||||
|
|
||||||
if( MINGW )
|
|
||||||
set(HAVE_LIBIMAGEHLP 1)
|
|
||||||
set(HAVE_LIBPSAPI 1)
|
|
||||||
# TODO: Check existence of libraries.
|
|
||||||
# include(CheckLibraryExists)
|
|
||||||
# CHECK_LIBRARY_EXISTS(imagehlp ??? . HAVE_LIBIMAGEHLP)
|
|
||||||
endif( MINGW )
|
|
||||||
|
|
||||||
if( MSVC )
|
|
||||||
set(error_t int)
|
|
||||||
set(LTDL_SHLIBPATH_VAR "PATH")
|
|
||||||
set(LTDL_SYSSEARCHPATH "")
|
|
||||||
set(LTDL_DLOPEN_DEPLIBS 1)
|
|
||||||
set(SHLIBEXT ".lib")
|
|
||||||
set(LTDL_OBJDIR "_libs")
|
|
||||||
set(HAVE_STRTOLL 1)
|
|
||||||
set(strtoll "_strtoi64")
|
|
||||||
set(strtoull "_strtoui64")
|
|
||||||
set(stricmp "_stricmp")
|
|
||||||
set(strdup "_strdup")
|
|
||||||
else( MSVC )
|
|
||||||
set(LTDL_SHLIBPATH_VAR "LD_LIBRARY_PATH")
|
|
||||||
set(LTDL_SYSSEARCHPATH "") # TODO
|
|
||||||
set(LTDL_DLOPEN_DEPLIBS 0) # TODO
|
|
||||||
endif( MSVC )
|
|
||||||
|
|
||||||
if( NOT MSVC )
|
|
||||||
# hash_map.h.in and hash_set.h.in contain a special case for MSVC
|
|
||||||
include(CheckCxxHashmap)
|
|
||||||
include(CheckCxxHashset)
|
|
||||||
check_hashmap()
|
|
||||||
check_hashset()
|
|
||||||
endif( NOT MSVC )
|
|
||||||
|
|
||||||
# FIXME: Signal handler return type, currently hardcoded to 'void'
|
|
||||||
set(RETSIGTYPE void)
|
|
||||||
|
|
||||||
if( LLVM_ENABLE_THREADS )
|
|
||||||
if( HAVE_PTHREAD_H OR WIN32 )
|
|
||||||
set(ENABLE_THREADS 1)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if( ENABLE_THREADS )
|
|
||||||
message(STATUS "Threads enabled.")
|
|
||||||
else( ENABLE_THREADS )
|
|
||||||
message(STATUS "Threads disabled.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
configure_file(
|
|
||||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake
|
|
||||||
${LLVM_BINARY_DIR}/include/llvm/Config/config.h
|
|
||||||
)
|
|
||||||
|
|
||||||
configure_file(
|
|
||||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT/iterator.cmake
|
|
||||||
${LLVM_BINARY_DIR}/include/llvm/ADT/iterator.h
|
|
||||||
)
|
|
||||||
|
|
||||||
configure_file(
|
|
||||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake
|
|
||||||
${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h
|
|
||||||
)
|
|
||||||
|
|
||||||
configure_file(
|
|
||||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT/hash_map.cmake
|
|
||||||
${LLVM_BINARY_DIR}/include/llvm/ADT/hash_map.h
|
|
||||||
)
|
|
||||||
|
|
||||||
configure_file(
|
|
||||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT/hash_set.cmake
|
|
||||||
${LLVM_BINARY_DIR}/include/llvm/ADT/hash_set.h
|
|
||||||
)
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
include(LLVMProcessSources)
|
|
||||||
include(LLVMConfig)
|
|
||||||
|
|
||||||
macro(add_llvm_library name)
|
|
||||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
|
||||||
add_library( ${name} ${ALL_FILES} )
|
|
||||||
set( llvm_libs ${llvm_libs} ${name} PARENT_SCOPE)
|
|
||||||
set( llvm_lib_targets ${llvm_lib_targets} ${name} PARENT_SCOPE )
|
|
||||||
if( LLVM_COMMON_DEPENDS )
|
|
||||||
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
|
|
||||||
endif( LLVM_COMMON_DEPENDS )
|
|
||||||
install(TARGETS ${name}
|
|
||||||
LIBRARY DESTINATION lib
|
|
||||||
ARCHIVE DESTINATION lib)
|
|
||||||
endmacro(add_llvm_library name)
|
|
||||||
|
|
||||||
|
|
||||||
macro(add_llvm_executable name)
|
|
||||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
|
||||||
add_executable(${name} ${ALL_FILES})
|
|
||||||
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 )
|
|
||||||
if( MSVC )
|
|
||||||
target_link_libraries(${name} ${llvm_libs})
|
|
||||||
else( MSVC )
|
|
||||||
add_dependencies(${name} llvm-config.target)
|
|
||||||
if( MINGW )
|
|
||||||
target_link_libraries(${name} imagehlp psapi)
|
|
||||||
elseif( CMAKE_HOST_UNIX )
|
|
||||||
target_link_libraries(${name} dl)
|
|
||||||
endif( MINGW )
|
|
||||||
endif( MSVC )
|
|
||||||
endmacro(add_llvm_executable name)
|
|
||||||
|
|
||||||
|
|
||||||
macro(add_llvm_tool name)
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})
|
|
||||||
add_llvm_executable(${name} ${ARGN})
|
|
||||||
install(TARGETS ${name}
|
|
||||||
RUNTIME DESTINATION bin)
|
|
||||||
endmacro(add_llvm_tool name)
|
|
||||||
|
|
||||||
|
|
||||||
macro(add_llvm_example name)
|
|
||||||
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_EXAMPLES_BINARY_DIR})
|
|
||||||
add_llvm_executable(${name} ${ARGN})
|
|
||||||
install(TARGETS ${name}
|
|
||||||
RUNTIME DESTINATION examples)
|
|
||||||
endmacro(add_llvm_example name)
|
|
||||||
|
|
||||||
|
|
||||||
macro(add_llvm_target target_name)
|
|
||||||
if( TABLEGEN_OUTPUT )
|
|
||||||
add_custom_target(${target_name}Table_gen
|
|
||||||
DEPENDS ${TABLEGEN_OUTPUT})
|
|
||||||
add_dependencies(${target_name}Table_gen ${LLVM_COMMON_DEPENDS})
|
|
||||||
endif( TABLEGEN_OUTPUT )
|
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
add_partially_linked_object(LLVM${target_name} ${ARGN})
|
|
||||||
if( TABLEGEN_OUTPUT )
|
|
||||||
add_dependencies(LLVM${target_name} ${target_name}Table_gen)
|
|
||||||
endif( TABLEGEN_OUTPUT )
|
|
||||||
endmacro(add_llvm_target)
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
include(LLVMProcessSources)
|
|
||||||
|
|
||||||
macro(target_name_of_partially_linked_object lib var)
|
|
||||||
if( MSVC )
|
|
||||||
set(${var} ${lib})
|
|
||||||
else( MSVC )
|
|
||||||
set(${var} ${lib}_pll)
|
|
||||||
endif( MSVC )
|
|
||||||
endmacro(target_name_of_partially_linked_object lib var)
|
|
||||||
|
|
||||||
|
|
||||||
macro(add_partially_linked_object lib)
|
|
||||||
if( MSVC )
|
|
||||||
add_llvm_library( ${lib} ${ARGN})
|
|
||||||
else( MSVC )
|
|
||||||
set(pll ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${lib}.o)
|
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
|
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
|
|
||||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
|
||||||
if( BUILD_SHARED_LIBS AND SUPPORTS_FPIC_FLAG )
|
|
||||||
add_definitions(-fPIC)
|
|
||||||
endif()
|
|
||||||
add_library( ${lib} STATIC ${ALL_FILES})
|
|
||||||
if( LLVM_COMMON_DEPENDS )
|
|
||||||
add_dependencies( ${lib} ${LLVM_COMMON_DEPENDS} )
|
|
||||||
endif( LLVM_COMMON_DEPENDS )
|
|
||||||
add_custom_command(OUTPUT ${pll}
|
|
||||||
COMMENT "Building ${lib}.o..."
|
|
||||||
DEPENDS ${lib}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib
|
|
||||||
COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
||||||
COMMAND ${CMAKE_LINKER} "${LLVM_PLO_FLAGS}" -r "*${CMAKE_CXX_OUTPUT_EXTENSION}" -o ${pll}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove -f *${CMAKE_CXX_OUTPUT_EXTENSION}
|
|
||||||
)
|
|
||||||
target_name_of_partially_linked_object(${lib} tnplo)
|
|
||||||
add_custom_target(${tnplo} ALL DEPENDS ${pll})
|
|
||||||
set( llvm_libs ${llvm_libs} ${pll} PARENT_SCOPE)
|
|
||||||
set( llvm_lib_targets ${llvm_lib_targets} ${tnplo} PARENT_SCOPE )
|
|
||||||
endif( MSVC )
|
|
||||||
install(FILES ${pll}
|
|
||||||
DESTINATION lib)
|
|
||||||
endmacro(add_partially_linked_object lib)
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
# - Check if for hash_map.
|
|
||||||
# CHECK_HASHMAP ()
|
|
||||||
#
|
|
||||||
|
|
||||||
include(CheckCXXSourceCompiles)
|
|
||||||
|
|
||||||
macro(CHECK_HASHMAP)
|
|
||||||
message(STATUS "Checking for C++ hash_map implementation...")
|
|
||||||
check_cxx_source_compiles("
|
|
||||||
#include <ext/hash_map>
|
|
||||||
int main() {
|
|
||||||
__gnu_cxx::hash_map<int, int> t;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
HAVE_GNU_EXT_HASH_MAP
|
|
||||||
)
|
|
||||||
if(HAVE_GNU_EXT_HASH_MAP)
|
|
||||||
message(STATUS "C++ hash_map found in 'ext' dir in namespace __gnu_cxx::")
|
|
||||||
endif(HAVE_GNU_EXT_HASH_MAP)
|
|
||||||
|
|
||||||
check_cxx_source_compiles("
|
|
||||||
#include <ext/hash_map>
|
|
||||||
int main() {
|
|
||||||
std::hash_map<int, int> t;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
HAVE_STD_EXT_HASH_MAP
|
|
||||||
)
|
|
||||||
if(HAVE_STD_EXT_HASH_MAP)
|
|
||||||
message(STATUS "C++ hash_map found in 'ext' dir in namespace std::")
|
|
||||||
endif(HAVE_STD_EXT_HASH_MAP)
|
|
||||||
|
|
||||||
check_cxx_source_compiles("
|
|
||||||
#include <hash_map>
|
|
||||||
int main() {
|
|
||||||
hash_map<int, int> t;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
HAVE_GLOBAL_HASH_MAP
|
|
||||||
)
|
|
||||||
if(HAVE_GLOBAL_HASH_MAP)
|
|
||||||
message(STATUS "C++ hash_map found in global namespace")
|
|
||||||
endif(HAVE_GLOBAL_HASH_MAP)
|
|
||||||
|
|
||||||
if(NOT HAVE_GNU_EXT_HASH_MAP)
|
|
||||||
if(NOT HAVE_STD_EXT_HASH_MAP)
|
|
||||||
if(NOT HAVE_GLOBAL_HASH_MAP)
|
|
||||||
message(STATUS "C++ hash_map not found")
|
|
||||||
endif(NOT HAVE_GLOBAL_HASH_MAP)
|
|
||||||
endif(NOT HAVE_STD_EXT_HASH_MAP)
|
|
||||||
endif(NOT HAVE_GNU_EXT_HASH_MAP)
|
|
||||||
|
|
||||||
endmacro(CHECK_HASHMAP)
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
# - Check if for hash_set.
|
|
||||||
# CHECK_HASHSET ()
|
|
||||||
#
|
|
||||||
|
|
||||||
include(CheckCXXSourceCompiles)
|
|
||||||
|
|
||||||
macro(CHECK_HASHSET)
|
|
||||||
message(STATUS "Checking for C++ hash_set implementation...")
|
|
||||||
check_cxx_source_compiles("
|
|
||||||
#include <ext/hash_set>
|
|
||||||
int main() {
|
|
||||||
__gnu_cxx::hash_set<int> t;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
HAVE_GNU_EXT_HASH_SET
|
|
||||||
)
|
|
||||||
if(HAVE_GNU_EXT_HASH_SET)
|
|
||||||
message(STATUS "C++ hash_set found in 'ext' dir in namespace __gnu_cxx::")
|
|
||||||
endif(HAVE_GNU_EXT_HASH_SET)
|
|
||||||
|
|
||||||
check_cxx_source_compiles("
|
|
||||||
#include <ext/hash_set>
|
|
||||||
int main() {
|
|
||||||
std::hash_set<int> t;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
HAVE_STD_EXT_HASH_SET
|
|
||||||
)
|
|
||||||
if(HAVE_STD_EXT_HASH_SET)
|
|
||||||
message(STATUS "C++ hash_set found in 'ext' dir in namespace std::")
|
|
||||||
endif(HAVE_STD_EXT_HASH_SET)
|
|
||||||
|
|
||||||
check_cxx_source_compiles("
|
|
||||||
#include <hash_set>
|
|
||||||
int main() {
|
|
||||||
hash_set<int> t;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
HAVE_GLOBAL_HASH_SET
|
|
||||||
)
|
|
||||||
if(HAVE_GLOBAL_HASH_SET)
|
|
||||||
message(STATUS "C++ hash_set found in global namespace")
|
|
||||||
endif(HAVE_GLOBAL_HASH_SET)
|
|
||||||
|
|
||||||
if(NOT HAVE_GNU_EXT_HASH_SET)
|
|
||||||
if(NOT HAVE_STD_EXT_HASH_SET)
|
|
||||||
if(NOT HAVE_GLOBAL_HASH_SET)
|
|
||||||
message(STATUS "C++ hash_set not found")
|
|
||||||
endif(NOT HAVE_GLOBAL_HASH_SET)
|
|
||||||
endif(NOT HAVE_STD_EXT_HASH_SET)
|
|
||||||
endif(NOT HAVE_GNU_EXT_HASH_SET)
|
|
||||||
endmacro(CHECK_HASHSET)
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
|
|
||||||
if( ${LLVM_TABLEGEN} STREQUAL "tblgen" )
|
|
||||||
set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native")
|
|
||||||
set(LLVM_TABLEGEN "${CX_NATIVE_TG_DIR}/bin/tblgen")
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR}
|
|
||||||
COMMENT "Creating ${CX_NATIVE_TG_DIR}...")
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt
|
|
||||||
COMMAND ${CMAKE_COMMAND} -UMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
|
|
||||||
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}
|
|
||||||
DEPENDS ${CX_NATIVE_TG_DIR}
|
|
||||||
COMMENT "Configuring native TableGen...")
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${LLVM_TABLEGEN}
|
|
||||||
COMMAND ${CMAKE_BUILD_TOOL}
|
|
||||||
DEPENDS ${CX_NATIVE_TG_DIR}/CMakeCache.txt
|
|
||||||
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}/utils/TableGen
|
|
||||||
COMMENT "Building native TableGen...")
|
|
||||||
add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN})
|
|
||||||
|
|
||||||
add_dependencies(tblgen NativeTableGen)
|
|
||||||
|
|
||||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CX_NATIVE_TG_DIR})
|
|
||||||
endif()
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
# - Try to find Bison
|
|
||||||
# Once done this will define
|
|
||||||
#
|
|
||||||
# BISON_FOUND - system has Bison
|
|
||||||
# BISON_EXECUTABLE - path of the bison executable
|
|
||||||
# BISON_VERSION - the version string, like "2.5.31"
|
|
||||||
#
|
|
||||||
|
|
||||||
MACRO(FIND_BISON)
|
|
||||||
FIND_PROGRAM(BISON_EXECUTABLE NAMES bison)
|
|
||||||
|
|
||||||
IF(BISON_EXECUTABLE)
|
|
||||||
SET(BISON_FOUND TRUE)
|
|
||||||
|
|
||||||
EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version
|
|
||||||
OUTPUT_VARIABLE _BISON_VERSION
|
|
||||||
)
|
|
||||||
string (REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" BISON_VERSION "${_bison_VERSION}")
|
|
||||||
ENDIF(BISON_EXECUTABLE)
|
|
||||||
|
|
||||||
IF(BISON_FOUND)
|
|
||||||
IF(NOT Bison_FIND_QUIETLY)
|
|
||||||
MESSAGE(STATUS "Found Bison: ${BISON_EXECUTABLE}")
|
|
||||||
ENDIF(NOT Bison_FIND_QUIETLY)
|
|
||||||
ELSE(BISON_FOUND)
|
|
||||||
IF(Bison_FIND_REQUIRED)
|
|
||||||
MESSAGE(FATAL_ERROR "Could not find Bison")
|
|
||||||
ENDIF(Bison_FIND_REQUIRED)
|
|
||||||
ENDIF(BISON_FOUND)
|
|
||||||
ENDMACRO(FIND_BISON)
|
|
||||||
|
|
||||||
MACRO(BISON_GENERATOR _PREFIX _Y_INPUT _H_OUTPUT _CPP_OUTPUT)
|
|
||||||
IF(BISON_EXECUTABLE)
|
|
||||||
GET_FILENAME_COMPONENT(_Y_DIR ${_Y_INPUT} PATH)
|
|
||||||
ADD_CUSTOM_COMMAND(
|
|
||||||
OUTPUT ${_CPP_OUTPUT}
|
|
||||||
OUTPUT ${_H_OUTPUT}
|
|
||||||
DEPENDS ${_Y_INPUT}
|
|
||||||
COMMAND ${BISON_EXECUTABLE}
|
|
||||||
ARGS
|
|
||||||
-p ${_PREFIX} -o"${_CPP_OUTPUT}"
|
|
||||||
--defines="${_H_OUTPUT}" ${_Y_INPUT}
|
|
||||||
WORKING_DIRECTORY ${_Y_DIR}
|
|
||||||
)
|
|
||||||
SET_SOURCE_FILES_PROPERTIES(
|
|
||||||
${_CPP_OUTPUT} ${_H_OUTPUT}
|
|
||||||
GENERATED
|
|
||||||
)
|
|
||||||
ELSE(BISON_EXECUTABLE)
|
|
||||||
MESSAGE(SEND_ERROR "Can't find bison program, and it's required")
|
|
||||||
ENDIF(BISON_EXECUTABLE)
|
|
||||||
ENDMACRO(BISON_GENERATOR)
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# Returns the host triple.
|
|
||||||
# Invokes config.guess
|
|
||||||
|
|
||||||
function( get_target_triple var )
|
|
||||||
if( MSVC )
|
|
||||||
set( ${var} "i686-pc-win32" PARENT_SCOPE )
|
|
||||||
else( MSVC )
|
|
||||||
set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess)
|
|
||||||
execute_process(COMMAND sh ${config_guess}
|
|
||||||
RESULT_VARIABLE TT_RV
|
|
||||||
OUTPUT_VARIABLE TT_OUT
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
if( NOT TT_RV EQUAL 0 )
|
|
||||||
message(FATAL_ERROR "Failed to execute ${config_guess}")
|
|
||||||
endif( NOT TT_RV EQUAL 0 )
|
|
||||||
set( ${var} ${TT_OUT} PARENT_SCOPE )
|
|
||||||
message(STATUS "Target triple: ${${var}}")
|
|
||||||
endif( MSVC )
|
|
||||||
endfunction( get_target_triple var )
|
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
include(FindPerl)
|
|
||||||
|
|
||||||
macro(llvm_config executable)
|
|
||||||
# extra args is the list of link components.
|
|
||||||
if( MSVC )
|
|
||||||
msvc_llvm_config(${executable} ${ARGN})
|
|
||||||
else( MSVC )
|
|
||||||
nix_llvm_config(${executable} ${ARGN})
|
|
||||||
endif( MSVC )
|
|
||||||
endmacro(llvm_config)
|
|
||||||
|
|
||||||
|
|
||||||
function(msvc_llvm_config executable)
|
|
||||||
set( link_components ${ARGN} )
|
|
||||||
if( CMAKE_CL_64 )
|
|
||||||
set(include_lflag "/INCLUDE:")
|
|
||||||
else( CMAKE_CL_64 )
|
|
||||||
set(include_lflag "/INCLUDE:_")
|
|
||||||
endif()
|
|
||||||
foreach(c ${link_components})
|
|
||||||
if( c STREQUAL "jit" )
|
|
||||||
set(lfgs "${lfgs} ${include_lflag}X86TargetMachineModule")
|
|
||||||
endif( c STREQUAL "jit" )
|
|
||||||
list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
|
|
||||||
if( NOT idx LESS 0 )
|
|
||||||
set(lfgs "${lfgs} ${include_lflag}${c}TargetMachineModule")
|
|
||||||
list(FIND LLVM_ASMPRINTERS_FORCE_LINK ${c} idx)
|
|
||||||
if( NOT idx LESS 0 )
|
|
||||||
set(lfgs "${lfgs} ${include_lflag}${c}AsmPrinterForceLink")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endforeach(c)
|
|
||||||
|
|
||||||
msvc_map_components_to_libraries(LIBRARIES ${link_components})
|
|
||||||
target_link_libraries(${executable} ${LIBRARIES})
|
|
||||||
|
|
||||||
if( lfgs )
|
|
||||||
set_target_properties(${executable}
|
|
||||||
PROPERTIES
|
|
||||||
LINK_FLAGS ${lfgs})
|
|
||||||
endif()
|
|
||||||
endfunction(msvc_llvm_config)
|
|
||||||
|
|
||||||
|
|
||||||
function(msvc_map_components_to_libraries out_libs)
|
|
||||||
set( link_components ${ARGN} )
|
|
||||||
foreach(c ${link_components})
|
|
||||||
# add codegen/asmprinter
|
|
||||||
list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
|
|
||||||
if( NOT idx LESS 0 )
|
|
||||||
list(FIND llvm_libs "LLVM${c}CodeGen" idx)
|
|
||||||
if( NOT idx LESS 0 )
|
|
||||||
list(APPEND expanded_components "LLVM${c}CodeGen")
|
|
||||||
else()
|
|
||||||
list(FIND llvm_libs "LLVM${c}" idx)
|
|
||||||
if( NOT idx LESS 0 )
|
|
||||||
list(APPEND expanded_components "LLVM${c}")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Target ${c} is not in the set of libraries.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
list(FIND llvm_libs "LLVM${c}AsmPrinter" asmidx)
|
|
||||||
if( NOT asmidx LESS 0 )
|
|
||||||
list(APPEND expanded_components "LLVM${c}AsmPrinter")
|
|
||||||
endif()
|
|
||||||
elseif( c STREQUAL "native" )
|
|
||||||
# TODO: we assume ARCH is X86. In this case, we must use nativecodegen
|
|
||||||
# component instead. Do nothing, as in llvm-config script.
|
|
||||||
elseif( c STREQUAL "nativecodegen" )
|
|
||||||
# TODO: we assume ARCH is X86.
|
|
||||||
list(APPEND expanded_components "LLVMX86CodeGen")
|
|
||||||
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")
|
|
||||||
elseif( c STREQUAL "all" )
|
|
||||||
list(APPEND expanded_components ${llvm_libs})
|
|
||||||
else( NOT idx LESS 0 )
|
|
||||||
list(APPEND expanded_components LLVM${c})
|
|
||||||
endif( NOT idx LESS 0 )
|
|
||||||
endforeach(c)
|
|
||||||
# We must match capitalization.
|
|
||||||
string(TOUPPER "${llvm_libs}" capitalized_libs)
|
|
||||||
list(REMOVE_DUPLICATES expanded_components)
|
|
||||||
set(curr_idx 0)
|
|
||||||
list(LENGTH expanded_components lst_size)
|
|
||||||
while( ${curr_idx} LESS ${lst_size} )
|
|
||||||
list(GET expanded_components ${curr_idx} c)
|
|
||||||
string(TOUPPER "${c}" capitalized)
|
|
||||||
list(FIND capitalized_libs ${capitalized} idx)
|
|
||||||
if( idx LESS 0 )
|
|
||||||
message(FATAL_ERROR "Library ${c} not found in list of llvm libraries.")
|
|
||||||
endif( idx LESS 0 )
|
|
||||||
list(GET llvm_libs ${idx} canonical_lib)
|
|
||||||
list(APPEND result ${canonical_lib})
|
|
||||||
list(APPEND result ${MSVC_LIB_DEPS_${canonical_lib}})
|
|
||||||
list(APPEND expanded_components ${MSVC_LIB_DEPS_${canonical_lib}})
|
|
||||||
list(REMOVE_DUPLICATES expanded_components)
|
|
||||||
list(LENGTH expanded_components lst_size)
|
|
||||||
math(EXPR curr_idx "${curr_idx} + 1")
|
|
||||||
endwhile( ${curr_idx} LESS ${lst_size} )
|
|
||||||
list(REMOVE_DUPLICATES result)
|
|
||||||
set(${out_libs} ${result} PARENT_SCOPE)
|
|
||||||
endfunction(msvc_map_components_to_libraries)
|
|
||||||
|
|
||||||
|
|
||||||
macro(nix_llvm_config executable)
|
|
||||||
set(lc "")
|
|
||||||
foreach(c ${ARGN})
|
|
||||||
set(lc "${lc} ${c}")
|
|
||||||
endforeach(c)
|
|
||||||
if( NOT HAVE_LLVM_CONFIG )
|
|
||||||
target_link_libraries(${executable}
|
|
||||||
"`${LLVM_TOOLS_BINARY_DIR}/llvm-config --libs ${lc}`")
|
|
||||||
else( NOT HAVE_LLVM_CONFIG )
|
|
||||||
# tbi: Error handling.
|
|
||||||
if( NOT PERL_EXECUTABLE )
|
|
||||||
message(FATAL_ERROR "Perl required but not found!")
|
|
||||||
endif( NOT PERL_EXECUTABLE )
|
|
||||||
execute_process(
|
|
||||||
COMMAND sh -c "${PERL_EXECUTABLE} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/llvm-config --libs ${lc}"
|
|
||||||
RESULT_VARIABLE rv
|
|
||||||
OUTPUT_VARIABLE libs
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
if(NOT rv EQUAL 0)
|
|
||||||
message(FATAL_ERROR "llvm-config failed for executable ${executable}")
|
|
||||||
endif(NOT rv EQUAL 0)
|
|
||||||
string(REPLACE " " ";" libs ${libs})
|
|
||||||
foreach(c ${libs})
|
|
||||||
if(c MATCHES ".*\\.o")
|
|
||||||
get_filename_component(fn ${c} NAME)
|
|
||||||
target_link_libraries(${executable}
|
|
||||||
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${fn})
|
|
||||||
else(c MATCHES ".*\\.o")
|
|
||||||
string(REPLACE "-l" "" fn ${c})
|
|
||||||
target_link_libraries(${executable} ${fn})
|
|
||||||
endif(c MATCHES ".*\\.o")
|
|
||||||
endforeach(c)
|
|
||||||
endif( NOT HAVE_LLVM_CONFIG )
|
|
||||||
endmacro(nix_llvm_config)
|
|
||||||
|
|
||||||
|
|
||||||
# This data is used on MSVC for stablishing executable/library
|
|
||||||
# dependencies. Comes from the llvm-config script, which is built and
|
|
||||||
# installed on the bin directory for MinGW or Linux. At the end of the
|
|
||||||
# script, you'll see lines like this:
|
|
||||||
|
|
||||||
# LLVMARMAsmPrinter.o: LLVMARMCodeGen.o libLLVMAsmPrinter.a libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMTarget.a
|
|
||||||
|
|
||||||
# This is translated to:
|
|
||||||
|
|
||||||
# set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget)
|
|
||||||
|
|
||||||
# It is necessary to remove the `lib' prefix, the `.a' and `.o'
|
|
||||||
# suffixes. Watch out for this line:
|
|
||||||
|
|
||||||
# LLVMExecutionEngine.o LLVMJIT.o: libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMSystem.a libLLVMTarget.a
|
|
||||||
|
|
||||||
# See how there are two elements before the colon. This must be
|
|
||||||
# translated as if it were:
|
|
||||||
|
|
||||||
# LLVMExecutionEngine.o: libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMSystem.a libLLVMTarget.a
|
|
||||||
# LLVMJIT.o: libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMSystem.a libLLVMTarget.a
|
|
||||||
|
|
||||||
# TODO: do this transformations on cmake.
|
|
||||||
|
|
||||||
# It is very important that the LLVM built for extracting this data
|
|
||||||
# must contain all targets, not just X86.
|
|
||||||
|
|
||||||
|
|
||||||
set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMARMCodeGen LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMAlphaAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMAlphaCodeGen LLVMAlphaAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMCBackend LLVMAnalysis LLVMCodeGen LLVMCore LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMCellSPUAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMCellSPUCodeGen LLVMCellSPUAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMCppBackend LLVMCore LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMJIT LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMIA64 LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMInterpreter LLVMExecutionEngine LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMMSIL LLVMAnalysis LLVMCodeGen LLVMCore LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMMips LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMPIC16 LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMPowerPCCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMPowerPCCodeGen LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMSparcAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMSparcCodeGen LLVMSparcAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMX86AsmPrinter LLVMX86CodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMXCore LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSelectionDAG LLVMSupport LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMArchive LLVMBitReader LLVMCore LLVMSupport LLVMSystem)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMAsmParser LLVMCore LLVMSupport)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMBitReader LLVMCore LLVMSupport)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMBitWriter LLVMCore LLVMSupport LLVMSystem)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMCodeGen LLVMAnalysis LLVMCore LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMCore LLVMSupport LLVMSystem)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMDebugger LLVMAnalysis LLVMBitReader LLVMCore LLVMSupport LLVMSystem)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMHello LLVMCore LLVMSupport)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMCore LLVMScalarOpts LLVMSupport LLVMTransformUtils)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMLinker LLVMArchive LLVMBitReader LLVMCore LLVMSupport LLVMSystem)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMScalarOpts LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMTransformUtils)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMSelectionDAG LLVMAnalysis LLVMCodeGen LLVMCore LLVMSupport LLVMSystem LLVMTarget)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMSupport LLVMSystem)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMSystem )
|
|
||||||
set(MSVC_LIB_DEPS_LLVMTarget LLVMCore LLVMSupport)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMTransformUtils LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMipa)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport)
|
|
||||||
set(MSVC_LIB_DEPS_LLVMipo LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa)
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
include(AddFileDependencies)
|
|
||||||
|
|
||||||
|
|
||||||
macro(add_td_sources srcs)
|
|
||||||
file(GLOB tds *.td)
|
|
||||||
if( tds )
|
|
||||||
source_group("TableGen descriptions" FILES ${tds})
|
|
||||||
set_source_files_properties(${tds} PROPERTIES HEADER_FILE_ONLY ON)
|
|
||||||
list(APPEND ${srcs} ${tds})
|
|
||||||
endif()
|
|
||||||
endmacro(add_td_sources)
|
|
||||||
|
|
||||||
|
|
||||||
macro(add_header_files srcs)
|
|
||||||
file(GLOB hds *.h)
|
|
||||||
if( hds )
|
|
||||||
set_source_files_properties(${hds} PROPERTIES HEADER_FILE_ONLY ON)
|
|
||||||
list(APPEND ${srcs} ${hds})
|
|
||||||
endif()
|
|
||||||
endmacro(add_header_files)
|
|
||||||
|
|
||||||
|
|
||||||
function(llvm_process_sources OUT_VAR)
|
|
||||||
set( sources ${ARGN} )
|
|
||||||
# Create file dependencies on the tablegenned files, if any. Seems
|
|
||||||
# that this is not strictly needed, as dependencies of the .cpp
|
|
||||||
# sources on the tablegenned .inc files are detected and handled,
|
|
||||||
# but just in case...
|
|
||||||
foreach( s ${sources} )
|
|
||||||
set( f ${CMAKE_CURRENT_SOURCE_DIR}/${s} )
|
|
||||||
add_file_dependencies( ${f} ${TABLEGEN_OUTPUT} )
|
|
||||||
endforeach(s)
|
|
||||||
if( MSVC_IDE )
|
|
||||||
# This adds .td and .h files to the Visual Studio solution:
|
|
||||||
add_td_sources(sources)
|
|
||||||
add_header_files(sources)
|
|
||||||
endif()
|
|
||||||
set( ${OUT_VAR} ${sources} PARENT_SCOPE )
|
|
||||||
endfunction(llvm_process_sources)
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# LLVM_TARGET_DEFINITIONS must contain the name of the .td file to process.
|
|
||||||
# Extra parameters for `tblgen' may come after `ofn' parameter.
|
|
||||||
# Adds the name of the generated file to TABLEGEN_OUTPUT.
|
|
||||||
|
|
||||||
macro(tablegen ofn)
|
|
||||||
file(GLOB all_tds "*.td")
|
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
|
|
||||||
COMMAND ${LLVM_TABLEGEN} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
-I ${LLVM_MAIN_SRC_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS} -o ${ofn}.tmp
|
|
||||||
DEPENDS ${LLVM_TABLEGEN} ${all_tds}
|
|
||||||
COMMENT "Building ${ofn}.tmp..."
|
|
||||||
)
|
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ofn}.tmp ${ofn}
|
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
|
|
||||||
COMMENT "Building ${ofn}..."
|
|
||||||
)
|
|
||||||
set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})
|
|
||||||
endmacro(tablegen)
|
|
||||||
1452
llvm/configure
vendored
1452
llvm/configure
vendored
File diff suppressed because it is too large
Load Diff
4
llvm/docs/.cvsignore
Normal file
4
llvm/docs/.cvsignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
doxygen.cfg
|
||||||
|
doxygen
|
||||||
|
doxygen.out
|
||||||
|
*.tar.gz
|
||||||
@@ -50,7 +50,6 @@
|
|||||||
implementations</a></li>
|
implementations</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#memdep">Memory Dependence Analysis</a></li>
|
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<div class="doc_author">
|
<div class="doc_author">
|
||||||
@@ -191,20 +190,16 @@ and returns MustAlias, MayAlias, or NoAlias as appropriate.
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
<p>The NoAlias response is used when the two pointers refer to distinct objects,
|
|
||||||
regardless of whether the pointers compare equal. For example, freed pointers
|
|
||||||
don't alias any pointers that were allocated afterwards. As a degenerate case,
|
|
||||||
pointers returned by malloc(0) have no bytes for an object, and are considered
|
|
||||||
NoAlias even when malloc returns the same pointer. The same rule applies to
|
|
||||||
NULL pointers.</p>
|
|
||||||
|
|
||||||
<p>The MayAlias response is used whenever the two pointers might refer to the
|
<p>An Alias Analysis implementation can return one of three responses:
|
||||||
same object. If the two memory objects overlap, but do not start at the same
|
MustAlias, MayAlias, and NoAlias. The No and May alias results are obvious: if
|
||||||
location, return MayAlias.</p>
|
the two pointers can never equal each other, return NoAlias, if they might,
|
||||||
|
return MayAlias.</p>
|
||||||
|
|
||||||
<p>The MustAlias response may only be returned if the two memory objects are
|
<p>The MustAlias response is trickier though. In LLVM, the Must Alias response
|
||||||
guaranteed to always start at exactly the same location. A MustAlias response
|
may only be returned if the two memory objects are guaranteed to always start at
|
||||||
implies that the pointers compare equal.</p>
|
exactly the same location. If two memory objects overlap, but do not start at
|
||||||
|
the same location, return MayAlias.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -760,9 +755,6 @@ field-<b>sensitive</b>" version of Steensgaard's algorithm using the Data
|
|||||||
Structure Analysis framework. This gives it substantially more precision than
|
Structure Analysis framework. This gives it substantially more precision than
|
||||||
the standard algorithm while maintaining excellent analysis scalability.</p>
|
the standard algorithm while maintaining excellent analysis scalability.</p>
|
||||||
|
|
||||||
<p>Note that <tt>-steens-aa</tt> is available in the optional "poolalloc"
|
|
||||||
module, it is not part of the LLVM core.</p>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- _______________________________________________________________________ -->
|
<!-- _______________________________________________________________________ -->
|
||||||
@@ -783,9 +775,6 @@ queries, and can provide context-sensitive mod/ref information as well. The
|
|||||||
only major facility not implemented so far is support for must-alias
|
only major facility not implemented so far is support for must-alias
|
||||||
information.</p>
|
information.</p>
|
||||||
|
|
||||||
<p>Note that <tt>-ds-aa</tt> is available in the optional "poolalloc"
|
|
||||||
module, it is not part of the LLVM core.</p>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -952,32 +941,14 @@ algorithm will have a lower number of may aliases).</p>
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
<div class="doc_section">
|
|
||||||
<a name="memdep">Memory Dependence Analysis</a>
|
|
||||||
</div>
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<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,
|
|
||||||
caching layer on top of alias analysis that is able to answer the question of
|
|
||||||
what preceding memory operations a given instruction depends on, either at an
|
|
||||||
intra- or inter-block level. Because of its laziness and caching
|
|
||||||
policy, using MemDep can be a significant performance win over accessing alias
|
|
||||||
analysis directly.</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
<!-- *********************************************************************** -->
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<address>
|
<address>
|
||||||
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
<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" alt="Valid CSS!"></a>
|
||||||
<a href="http://validator.w3.org/check/referer"><img
|
<a href="http://validator.w3.org/check/referer"><img
|
||||||
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
|
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="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
<li><a href="#stdblocks">Standard Blocks</a></li>
|
<li><a href="#stdblocks">Standard Blocks</a></li>
|
||||||
</ol>
|
</ol>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#wrapper">Bitcode Wrapper Format</a>
|
|
||||||
</li>
|
|
||||||
<li><a href="#llvmir">LLVM IR Encoding</a>
|
<li><a href="#llvmir">LLVM IR Encoding</a>
|
||||||
<ol>
|
<ol>
|
||||||
<li><a href="#basics">Basics</a></li>
|
<li><a href="#basics">Basics</a></li>
|
||||||
@@ -31,8 +29,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
<div class="doc_author">
|
<div class="doc_author">
|
||||||
<p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>
|
<p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>.
|
||||||
and <a href="http://www.reverberate.org">Joshua Haberman</a>.
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -67,12 +64,8 @@ Unlike XML, the bitstream format is a binary encoding, and unlike XML it
|
|||||||
provides a mechanism for the file to self-describe "abbreviations", which are
|
provides a mechanism for the file to self-describe "abbreviations", which are
|
||||||
effectively size optimizations for the content.</p>
|
effectively size optimizations for the content.</p>
|
||||||
|
|
||||||
<p>LLVM IR files may be optionally embedded into a <a
|
<p>This document first describes the LLVM bitstream format, then describes the
|
||||||
href="#wrapper">wrapper</a> structure that makes it easy to embed extra data
|
record structure used by LLVM IR files.
|
||||||
along with LLVM IR files.</p>
|
|
||||||
|
|
||||||
<p>This document first describes the LLVM bitstream format, describes the
|
|
||||||
wrapper format, then describes the record structure used by LLVM IR files.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -112,10 +105,8 @@ understanding the encoding.</p>
|
|||||||
|
|
||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
|
|
||||||
<p>The first two bytes of a bitcode file are 'BC' (0x42, 0x43).
|
<p>The first four bytes of the stream identify the encoding of the file. This
|
||||||
The second two bytes are an application-specific magic number. Generic
|
is used by a reader to know what is contained in the file.</p>
|
||||||
bitcode tools can look at only the first two bytes to verify the file is
|
|
||||||
bitcode, while application-specific programs will want to look at all four.</p>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -126,8 +117,7 @@ bitcode, while application-specific programs will want to look at all four.</p>
|
|||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
A bitstream literally consists of a stream of bits, which are read in order
|
A bitstream literally consists of a stream of bits. This stream is made up of a
|
||||||
starting with the least significant bit of each byte. The stream is made up of a
|
|
||||||
number of primitive values that encode a stream of unsigned integer values.
|
number of primitive values that encode a stream of unsigned integer values.
|
||||||
These
|
These
|
||||||
integers are are encoded in two ways: either as <a href="#fixedwidth">Fixed
|
integers are are encoded in two ways: either as <a href="#fixedwidth">Fixed
|
||||||
@@ -182,8 +172,8 @@ represent the following characters with the following 6-bit values:</p>
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>'a' .. 'z' - 0 .. 25</li>
|
<li>'a' .. 'z' - 0 .. 25</li>
|
||||||
<li>'A' .. 'Z' - 26 .. 51</li>
|
<li>'A' .. 'Z' - 26 .. 52</li>
|
||||||
<li>'0' .. '9' - 52 .. 61</li>
|
<li>'0' .. '9' - 53 .. 61</li>
|
||||||
<li>'.' - 62</li>
|
<li>'.' - 62</li>
|
||||||
<li>'_' - 63</li>
|
<li>'_' - 63</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -250,9 +240,7 @@ an <a href="#abbrev_records">abbreviated record encoding</a>.</p>
|
|||||||
<p>
|
<p>
|
||||||
Blocks in a bitstream denote nested regions of the stream, and are identified by
|
Blocks in a bitstream denote nested regions of the stream, and are identified by
|
||||||
a content-specific id number (for example, LLVM IR uses an ID of 12 to represent
|
a content-specific id number (for example, LLVM IR uses an ID of 12 to represent
|
||||||
function bodies). Block IDs 0-7 are reserved for <a href="#stdblocks">standard blocks</a>
|
function bodies). Nested blocks capture the hierachical structure of the data
|
||||||
whose meaning is defined by Bitcode; block IDs 8 and greater are
|
|
||||||
application specific. Nested blocks capture the hierachical structure of the data
|
|
||||||
encoded in it, and various properties are associated with blocks as the file is
|
encoded in it, and various properties are associated with blocks as the file is
|
||||||
parsed. Block definitions allow the reader to efficiently skip blocks
|
parsed. Block definitions allow the reader to efficiently skip blocks
|
||||||
in constant time if the reader wants a summary of blocks, or if it wants to
|
in constant time if the reader wants a summary of blocks, or if it wants to
|
||||||
@@ -270,11 +258,8 @@ block. In particular, each block maintains:
|
|||||||
block record is entered. The block entry specifies the abbrev id width for
|
block record is entered. The block entry specifies the abbrev id width for
|
||||||
the body of the block.</li>
|
the body of the block.</li>
|
||||||
|
|
||||||
<li>A set of abbreviations. Abbreviations may be defined within a block, in
|
<li>A set of abbreviations. Abbreviations may be defined within a block, or
|
||||||
which case they are only defined in that block (neither subblocks nor
|
they may be associated with all blocks of a particular ID.
|
||||||
enclosing blocks see the abbreviation). Abbreviations can also be defined
|
|
||||||
inside a <a href="#BLOCKINFO">BLOCKINFO</a> block, in which case they are
|
|
||||||
defined in all blocks that match the ID that the BLOCKINFO block is describing.
|
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
@@ -296,8 +281,7 @@ Encoding</a></div>
|
|||||||
<p>
|
<p>
|
||||||
The ENTER_SUBBLOCK abbreviation ID specifies the start of a new block record.
|
The ENTER_SUBBLOCK abbreviation ID specifies the start of a new block record.
|
||||||
The <tt>blockid</tt> value is encoded as a 8-bit VBR identifier, and indicates
|
The <tt>blockid</tt> value is encoded as a 8-bit VBR identifier, and indicates
|
||||||
the type of block being entered (which can be a <a href="#stdblocks">standard
|
the type of block being entered (which is application specific). The
|
||||||
block</a> or an application-specific block). The
|
|
||||||
<tt>newabbrevlen</tt> value is a 4-bit VBR which specifies the
|
<tt>newabbrevlen</tt> value is a 4-bit VBR which specifies the
|
||||||
abbrev id width for the sub-block. The <tt>blocklen</tt> is a 32-bit aligned
|
abbrev id width for the sub-block. The <tt>blocklen</tt> is a 32-bit aligned
|
||||||
value that specifies the size of the subblock, in 32-bit words. This value
|
value that specifies the size of the subblock, in 32-bit words. This value
|
||||||
@@ -413,17 +397,6 @@ operators, the abbreviation does not need to be emitted.
|
|||||||
<p><tt>[DEFINE_ABBREV, numabbrevops<sub>vbr5</sub>, abbrevop0, abbrevop1,
|
<p><tt>[DEFINE_ABBREV, numabbrevops<sub>vbr5</sub>, abbrevop0, abbrevop1,
|
||||||
...]</tt></p>
|
...]</tt></p>
|
||||||
|
|
||||||
<p>A DEFINE_ABBREV record adds an abbreviation to the list of currently
|
|
||||||
defined abbreviations in the scope of this block. This definition only
|
|
||||||
exists inside this immediate block -- it is not visible in subblocks or
|
|
||||||
enclosing blocks.
|
|
||||||
Abbreviations are implicitly assigned IDs
|
|
||||||
sequentially starting from 4 (the first application-defined abbreviation ID).
|
|
||||||
Any abbreviations defined in a BLOCKINFO record receive IDs first, in order,
|
|
||||||
followed by any abbreviations defined within the block itself.
|
|
||||||
Abbreviated data records reference this ID to indicate what abbreviation
|
|
||||||
they are invoking.</p>
|
|
||||||
|
|
||||||
<p>An abbreviation definition consists of the DEFINE_ABBREV abbrevid followed
|
<p>An abbreviation definition consists of the DEFINE_ABBREV abbrevid followed
|
||||||
by a VBR that specifies the number of abbrev operands, then the abbrev
|
by a VBR that specifies the number of abbrev operands, then the abbrev
|
||||||
operands themselves. Abbreviation operands come in three forms. They all start
|
operands themselves. Abbreviation operands come in three forms. They all start
|
||||||
@@ -449,19 +422,14 @@ emitted as their code, followed by the extra data.
|
|||||||
<ul>
|
<ul>
|
||||||
<li>1 - Fixed - The field should be emitted as a <a
|
<li>1 - Fixed - The field should be emitted as a <a
|
||||||
href="#fixedwidth">fixed-width value</a>, whose width
|
href="#fixedwidth">fixed-width value</a>, whose width
|
||||||
is specified by the operand's extra data.</li>
|
is specified by the encoding operand.</li>
|
||||||
<li>2 - VBR - The field should be emitted as a <a
|
<li>2 - VBR - The field should be emitted as a <a
|
||||||
href="#variablewidth">variable-width value</a>, whose width
|
href="#variablewidth">variable-width value</a>, whose width
|
||||||
is specified by the operand's extra data.</li>
|
is specified by the encoding operand.</li>
|
||||||
<li>3 - Array - This field is an array of values. The array operand has no
|
<li>3 - Array - This field is an array of values. The element type of the array
|
||||||
extra data, but expects another operand to follow it which indicates the
|
is specified by the next encoding operand.</li>
|
||||||
element type of the array. When reading an array in an abbreviated record,
|
|
||||||
the first integer is a vbr6 that indicates the array length, followed by
|
|
||||||
the encoded elements of the array. An array may only occur as the last
|
|
||||||
operand of an abbreviation (except for the one final operand that gives
|
|
||||||
the array's type).</li>
|
|
||||||
<li>4 - Char6 - This field should be emitted as a <a href="#char6">char6-encoded
|
<li>4 - Char6 - This field should be emitted as a <a href="#char6">char6-encoded
|
||||||
value</a>. This operand type takes no extra data.</li>
|
value</a>.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>For example, target triples in LLVM modules are encoded as a record of the
|
<p>For example, target triples in LLVM modules are encoded as a record of the
|
||||||
@@ -508,7 +476,7 @@ any other string value.
|
|||||||
In addition to the basic block structure and record encodings, the bitstream
|
In addition to the basic block structure and record encodings, the bitstream
|
||||||
also defines specific builtin block types. These block types specify how the
|
also defines specific builtin block types. These block types specify how the
|
||||||
stream is to be decoded or other metadata. In the future, new standard blocks
|
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.
|
may be added.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -528,58 +496,14 @@ Block</a></div>
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The SETBID record indicates which block ID is being described. SETBID
|
The SETBID record indicates which block ID is being described. The standard
|
||||||
records can occur multiple times throughout the block to change which
|
DEFINE_ABBREV record specifies an abbreviation. The abbreviation is associated
|
||||||
block ID is being described. There must be a SETBID record prior to
|
with the record ID, and any records with matching ID automatically get the
|
||||||
any other records.
|
abbreviation.
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Standard DEFINE_ABBREV records can occur inside BLOCKINFO blocks, but unlike
|
|
||||||
their occurrence in normal blocks, the abbreviation is defined for blocks
|
|
||||||
matching the block ID we are describing, <i>not</i> the BLOCKINFO block itself.
|
|
||||||
The abbreviations defined in BLOCKINFO blocks receive abbreviation ids
|
|
||||||
as described in <a href="#DEFINE_ABBREV">DEFINE_ABBREV</a>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Note that although the data in BLOCKINFO blocks is described as "metadata," the
|
|
||||||
abbreviations they contain are essential for parsing records from the
|
|
||||||
corresponding blocks. It is not safe to skip them.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
<div class="doc_section"> <a name="wrapper">Bitcode Wrapper Format</a></div>
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p>Bitcode files for LLVM IR may optionally be wrapped in a simple wrapper
|
|
||||||
structure. This structure contains a simple header that indicates the offset
|
|
||||||
and size of the embedded BC file. This allows additional information to be
|
|
||||||
stored alongside the BC file. The structure of this file header is:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<pre>
|
|
||||||
[Magic<sub>32</sub>,
|
|
||||||
Version<sub>32</sub>,
|
|
||||||
Offset<sub>32</sub>,
|
|
||||||
Size<sub>32</sub>,
|
|
||||||
CPUType<sub>32</sub>]
|
|
||||||
</pre></p>
|
|
||||||
|
|
||||||
<p>Each of the fields are 32-bit fields stored in little endian form (as with
|
|
||||||
the rest of the bitcode file fields). The Magic number is always
|
|
||||||
<tt>0x0B17C0DE</tt> and the version is currently always <tt>0</tt>. The Offset
|
|
||||||
field is the offset in bytes to the start of the bitcode stream in the file, and
|
|
||||||
the Size field is a size in bytes of the stream. CPUType is a target-specific
|
|
||||||
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>
|
<div class="doc_section"> <a name="llvmir">LLVM IR Encoding</a></div>
|
||||||
<!-- *********************************************************************** -->
|
<!-- *********************************************************************** -->
|
||||||
@@ -608,9 +532,10 @@ reader is not allowed to build in any knowledge of this.</p>
|
|||||||
The magic number for LLVM IR files is:
|
The magic number for LLVM IR files is:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p><tt>[0x0<sub>4</sub>, 0xC<sub>4</sub>, 0xE<sub>4</sub>, 0xD<sub>4</sub>]</tt></p>
|
<p><tt>['B'<sub>8</sub>, 'C'<sub>8</sub>, 0x0<sub>4</sub>, 0xC<sub>4</sub>,
|
||||||
|
0xE<sub>4</sub>, 0xD<sub>4</sub>]</tt></p>
|
||||||
|
|
||||||
<p>When combined with the bitcode magic number and viewed as bytes, this is "BC 0xC0DE".</p>
|
<p>When viewed as bytes, this is "BC 0xC0DE".</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -678,9 +603,9 @@ LLVM IR is defined with the following blocks:
|
|||||||
<!-- *********************************************************************** -->
|
<!-- *********************************************************************** -->
|
||||||
<hr>
|
<hr>
|
||||||
<address> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
<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" alt="Valid CSS!"></a>
|
||||||
<a href="http://validator.w3.org/check/referer"><img
|
<a href="http://validator.w3.org/check/referer"><img
|
||||||
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
|
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="mailto:sabre@nondot.org">Chris Lattner</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$
|
Last modified: $Date$
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ functions has been reduced, it attempts to delete various edges in the control
|
|||||||
flow graph, to reduce the size of the function as much as possible. Finally,
|
flow graph, to reduce the size of the function as much as possible. Finally,
|
||||||
<tt>bugpoint</tt> deletes any individual LLVM instructions whose absence does
|
<tt>bugpoint</tt> deletes any individual LLVM instructions whose absence does
|
||||||
not eliminate the failure. At the end, <tt>bugpoint</tt> should tell you what
|
not eliminate the failure. At the end, <tt>bugpoint</tt> should tell you what
|
||||||
passes crash, give you a bitcode file, and give you instructions on how to
|
passes crash, give you a bytecode file, and give you instructions on how to
|
||||||
reproduce the failure with <tt>opt</tt> or <tt>llc</tt>.</p>
|
reproduce the failure with <tt>opt</tt> or <tt>llc</tt>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -141,7 +141,7 @@ test program and partitions it into two pieces: one piece which it compiles
|
|||||||
with the C backend (into a shared object), and one piece which it runs with
|
with the C backend (into a shared object), and one piece which it runs with
|
||||||
either the JIT or the static LLC compiler. It uses several techniques to
|
either the JIT or the static LLC compiler. It uses several techniques to
|
||||||
reduce the amount of code pushed through the LLVM code generator, to reduce the
|
reduce the amount of code pushed through the LLVM code generator, to reduce the
|
||||||
potential scope of the problem. After it is finished, it emits two bitcode
|
potential scope of the problem. After it is finished, it emits two bytecode
|
||||||
files (called "test" [to be compiled with the code generator] and "safe" [to be
|
files (called "test" [to be compiled with the code generator] and "safe" [to be
|
||||||
compiled with the C backend], respectively), and instructions for reproducing
|
compiled with the C backend], respectively), and instructions for reproducing
|
||||||
the problem. The code generator debugger assumes that the C backend produces
|
the problem. The code generator debugger assumes that the C backend produces
|
||||||
@@ -211,6 +211,11 @@ non-obvious ways. Here are some hints and tips:<p>
|
|||||||
you might try <tt>llvm-link -v</tt> on the same set of input files. If
|
you might try <tt>llvm-link -v</tt> on the same set of input files. If
|
||||||
that also crashes, you may be experiencing a linker bug.
|
that also crashes, you may be experiencing a linker bug.
|
||||||
|
|
||||||
|
<li>If your program is <b>supposed</b> to crash, <tt>bugpoint</tt> will be
|
||||||
|
confused. One way to deal with this is to cause bugpoint to ignore the exit
|
||||||
|
code from your program, by giving it the <tt>-check-exit-code=false</tt>
|
||||||
|
option.
|
||||||
|
|
||||||
<li><tt>bugpoint</tt> is useful for proactively finding bugs in LLVM.
|
<li><tt>bugpoint</tt> is useful for proactively finding bugs in LLVM.
|
||||||
Invoking <tt>bugpoint</tt> with the <tt>-find-bugs</tt> option will cause
|
Invoking <tt>bugpoint</tt> with the <tt>-find-bugs</tt> option will cause
|
||||||
the list of specified optimizations to be randomized and applied to the
|
the list of specified optimizations to be randomized and applied to the
|
||||||
@@ -226,9 +231,9 @@ non-obvious ways. Here are some hints and tips:<p>
|
|||||||
<hr>
|
<hr>
|
||||||
<address>
|
<address>
|
||||||
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
<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" alt="Valid CSS!"></a>
|
||||||
<a href="http://validator.w3.org/check/referer"><img
|
<a href="http://validator.w3.org/check/referer"><img
|
||||||
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
|
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="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||||
|
|||||||
@@ -5,11 +5,79 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link rel="stylesheet" href="llvm.css" type="text/css" media="screen">
|
<link rel="stylesheet" href="llvm.css" type="text/css" media="screen">
|
||||||
<title>Building the LLVM C/C++ Front-End</title>
|
<title>Building the LLVM C/C++ Front-End</title>
|
||||||
<meta HTTP-EQUIV="REFRESH" CONTENT="3; URL=GCCFEBuildInstrs.html">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="doc_title">
|
<div class="doc_title">
|
||||||
This page has moved <a href="GCCFEBuildInstrs.html">here</A>.
|
Building the LLVM C/C++ Front-End
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li><a href="#instructions">Building llvm-gcc 4 from Source</a></li>
|
||||||
|
<li><a href="#license">License Information</a></li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<div class="doc_author">
|
||||||
|
<p>Written by the LLVM Team</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- *********************************************************************** -->
|
||||||
|
<div class="doc_section">
|
||||||
|
<a name="instructions">Building llvm-gcc 4 from Source</a>
|
||||||
|
</div>
|
||||||
|
<!-- *********************************************************************** -->
|
||||||
|
|
||||||
|
<div class="doc_text">
|
||||||
|
|
||||||
|
<p>This section describes how to aquire and build llvm-gcc4, which is based on
|
||||||
|
the GCC 4.0.1 front-end. This front-end supports C, C++, Objective-C, and
|
||||||
|
Objective-C++. Note that the instructions for building this front-end are
|
||||||
|
completely different (and much easier!) than those for building llvm-gcc3 in
|
||||||
|
the past.</p>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li><p>Retrieve the appropriate llvm-gcc4-x.y.source.tar.gz archive from the
|
||||||
|
<a href="http://llvm.org/releases/">llvm web site</a>.</p>
|
||||||
|
|
||||||
|
<p>It is also possible to download the sources of the llvm-gcc4 front end
|
||||||
|
from a read-only mirror using subversion. To check out the code the
|
||||||
|
first time use:</p>
|
||||||
|
|
||||||
|
<div class="doc_code">
|
||||||
|
<pre>
|
||||||
|
svn co svn://anonsvn.opensource.apple.com/svn/llvm/trunk <i>dst-directory</i>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>After that, the code can be be updated in the destination directory
|
||||||
|
using:</p>
|
||||||
|
|
||||||
|
<div class="doc_code">
|
||||||
|
<pre>svn update</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>The mirror is brought up to date every evening.</p></li>
|
||||||
|
|
||||||
|
<li>Follow the directions in the top-level <tt>README.LLVM</tt> file for
|
||||||
|
up-to-date instructions on how to build llvm-gcc4.</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- *********************************************************************** -->
|
||||||
|
<div class="doc_section">
|
||||||
|
<a name="license">License Information</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="doc_text">
|
||||||
|
<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
|
||||||
|
COPYING.LIB for more details.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
More information is <a href="FAQ.html#license">available in the FAQ</a>.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
<!-- *********************************************************************** -->
|
||||||
@@ -17,12 +85,12 @@ This page has moved <a href="GCCFEBuildInstrs.html">here</A>.
|
|||||||
<hr>
|
<hr>
|
||||||
<address>
|
<address>
|
||||||
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
<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" alt="Valid CSS!"></a>
|
||||||
<a href="http://validator.w3.org/check/referer"><img
|
<a href="http://validator.w3.org/check/referer"><img
|
||||||
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
|
src="http://www.w3.org/Icons/valid-html401" 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) $
|
Last modified: $Date$
|
||||||
</address>
|
</address>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,360 +0,0 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
||||||
"http://www.w3.org/TR/html4/strict.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Building LLVM with CMake</title>
|
|
||||||
<link rel="stylesheet" href="llvm.css" type="text/css">
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<div class="doc_title">
|
|
||||||
Building LLVM with CMake
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><a href="#intro">Introduction</a></li>
|
|
||||||
<li><a href="#quickstart">Quick start</a></li>
|
|
||||||
<li><a href="#usage">Basic CMake usage</a>
|
|
||||||
<li><a href="#options">Options and variables</a>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#freccmake">Frequently-used CMake variables</a></li>
|
|
||||||
<li><a href="#llvmvars">LLVM-specific variables</a></li>
|
|
||||||
</ul></li>
|
|
||||||
<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>
|
|
||||||
<li><a href="#specifics">Compiler/Platform specific topics</a>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#msvc">Microsoft Visual C++</a></li>
|
|
||||||
</ul></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="doc_author">
|
|
||||||
<p>Written by <a href="mailto:ofv@wanadoo.es">Oscar Fuentes</a></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
<div class="doc_section">
|
|
||||||
<a name="intro">Introduction</a>
|
|
||||||
</div>
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p><a href="http://www.cmake.org/">CMake</a> is a cross-platform
|
|
||||||
build-generator tool. CMake does not build the project, it generates
|
|
||||||
the files needed by your build tool (GNU make, Visual Studio, etc) for
|
|
||||||
building LLVM.</p>
|
|
||||||
|
|
||||||
<p>If you are really anxious about getting a functional LLVM build,
|
|
||||||
go to the <a href="#quickstart">Quick start</a> section. If you
|
|
||||||
are a CMake novice, start on <a href="#usage">Basic CMake
|
|
||||||
usage</a> and then go back to the <a href="#quickstart">Quick
|
|
||||||
start</a> once you know what you are
|
|
||||||
doing. The <a href="#options">Options and variables</a> section
|
|
||||||
is a reference for customizing your build. If you already have
|
|
||||||
experience with CMake, this is the recommended starting point.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
<div class="doc_section">
|
|
||||||
<a name="quickstart">Quick start</a>
|
|
||||||
</div>
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p> We use here the command-line, non-interactive CMake interface </p>
|
|
||||||
|
|
||||||
<ol>
|
|
||||||
|
|
||||||
<li><p><a href=http://www.cmake.org/cmake/resources/software.html>Download</a>
|
|
||||||
and install CMake. Version 2.6.2 is the minimum required.</p>
|
|
||||||
|
|
||||||
<li><p>Open a shell. Your development tools must be reachable from this
|
|
||||||
shell through the PATH environment variable.</p>
|
|
||||||
|
|
||||||
<li><p>Create a directory for containing the build. It is not
|
|
||||||
supported to build LLVM on the source directory. cd to this
|
|
||||||
directory:</p>
|
|
||||||
<div class="doc_code">
|
|
||||||
<p><tt>mkdir mybuilddir</tt></p>
|
|
||||||
<p><tt>cd mybuilddir</tt></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<li><p>Execute this command on the shell
|
|
||||||
replacing <i>path/to/llvm/source/root</i> with the path to the
|
|
||||||
root of your LLVM source tree:</p>
|
|
||||||
<div class="doc_code">
|
|
||||||
<p><tt>cmake path/to/llvm/source/root</tt></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>CMake will detect your development environment, perform a
|
|
||||||
series of test and generate the files required for building
|
|
||||||
LLVM. CMake will use default values for all build
|
|
||||||
parameters. See the <a href="#options">Options and variables</a>
|
|
||||||
section for fine-tuning your build</p>
|
|
||||||
|
|
||||||
<p>This can fail if CMake can't detect your toolset, or if it
|
|
||||||
thinks that the environment is not sane enough. On this case
|
|
||||||
make sure that the toolset that you intend to use is the only
|
|
||||||
one reachable from the shell and that the shell itself is the
|
|
||||||
correct one for you development environment. CMake will refuse
|
|
||||||
to build MinGW makefiles if you have a POSIX shell reachable
|
|
||||||
through the PATH environment variable, for instance. You can
|
|
||||||
force CMake to use a given build tool, see
|
|
||||||
the <a href="#usage">Usage</a> section.</p>
|
|
||||||
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
<div class="doc_section">
|
|
||||||
<a name="usage">Basic CMake usage</a>
|
|
||||||
</div>
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p>This section explains basic aspects of CMake, mostly for
|
|
||||||
explaining those options which you may need on your day-to-day
|
|
||||||
usage.</p>
|
|
||||||
|
|
||||||
<p>CMake comes with extensive documentation in the form of html
|
|
||||||
files and on the cmake executable itself. Execute <i>cmake
|
|
||||||
--help</i> for further help options.</p>
|
|
||||||
|
|
||||||
<p>CMake requires to know for which build tool it shall generate
|
|
||||||
files (GNU make, Visual Studio, Xcode, etc). If not specified on
|
|
||||||
the command line, it tries to guess it based on you
|
|
||||||
environment. Once identified the build tool, CMake uses the
|
|
||||||
corresponding <i>Generator</i> for creating files for your build
|
|
||||||
tool. You can explicitly specify the generator with the command
|
|
||||||
line option <i>-G "Name of the generator"</i>. For knowing the
|
|
||||||
available generators on your platform, execute</p>
|
|
||||||
|
|
||||||
<div class="doc_code">
|
|
||||||
<p><tt>cmake --help</tt></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>This will list the generator's names at the end of the help
|
|
||||||
text. Generator's names are case-sensitive. Example:</p>
|
|
||||||
|
|
||||||
<div class="doc_code">
|
|
||||||
<p><tt>cmake -G "Visual Studio 8 2005" path/to/llvm/source/root</tt></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>For a given development platform there can be more than one
|
|
||||||
adequate generator. If you use Visual Studio "NMake Makefiles"
|
|
||||||
is a generator you can use for building with NMake. By default,
|
|
||||||
CMake chooses the more specific generator supported by your
|
|
||||||
development environment. If you want an alternative generator,
|
|
||||||
you must tell this to CMake with the <i>-G</i> option.</p>
|
|
||||||
|
|
||||||
<p>TODO: explain variables and cache. Move explanation here from
|
|
||||||
#options section.</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
<div class="doc_section">
|
|
||||||
<a name="options">Options and variables</a>
|
|
||||||
</div>
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p>Variables customize how the build will be generated. Options are
|
|
||||||
boolean variables, with possible values ON/OFF. Options and
|
|
||||||
variables are defined on the CMake command line like this:</p>
|
|
||||||
|
|
||||||
<div class="doc_code">
|
|
||||||
<p><tt>cmake -DVARIABLE=value path/to/llvm/source</tt></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>You can set a variable after the initial CMake invocation for
|
|
||||||
changing its value. You can also undefine a variable:</p>
|
|
||||||
|
|
||||||
<div class="doc_code">
|
|
||||||
<p><tt>cmake -UVARIABLE path/to/llvm/source</tt></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>Variables are stored on the CMake cache. This is a file
|
|
||||||
named <it>CMakeCache.txt</it> on the root of the build
|
|
||||||
directory. Do not hand-edit it.</p>
|
|
||||||
|
|
||||||
<p>Variables are listed here appending its type after a colon. It is
|
|
||||||
correct to write the variable and the type on the CMake command
|
|
||||||
line:</p>
|
|
||||||
|
|
||||||
<div class="doc_code">
|
|
||||||
<p><tt>cmake -DVARIABLE:TYPE=value path/to/llvm/source</tt></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- ======================================================================= -->
|
|
||||||
<div class="doc_subsection">
|
|
||||||
<a name="freccmake">Frequently-used CMake variables</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p>Here are listed some of the CMake variables that are used often,
|
|
||||||
along with a brief explanation and LLVM-specific notes. For full
|
|
||||||
documentation, check the CMake docs or execute <i>cmake
|
|
||||||
--help-variable VARIABLE_NAME</i>.</p>
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt><b>CMAKE_BUILD_TYPE</b>:STRING</dt>
|
|
||||||
|
|
||||||
<dd>Sets the build type for <i>make</i> based generators. Possible
|
|
||||||
values are Release, Debug, RelWithDebInfo and MiniSizeRel. On
|
|
||||||
systems like Visual Studio the user sets the build type with the IDE
|
|
||||||
settings.</dd>
|
|
||||||
|
|
||||||
<dt><b>CMAKE_INSTALL_PREFIX</b>:PATH</dt>
|
|
||||||
<dd>Path where LLVM will be installed if "make install" is invoked
|
|
||||||
or the "INSTALL" target is built.</dd>
|
|
||||||
|
|
||||||
<dt><b>CMAKE_C_FLAGS</b>:STRING</dt>
|
|
||||||
<dd>Extra flags to use when compiling C source files.</dd>
|
|
||||||
|
|
||||||
<dt><b>CMAKE_CXX_FLAGS</b>:STRING</dt>
|
|
||||||
<dd>Extra flags to use when compiling C++ source files.</dd>
|
|
||||||
|
|
||||||
<dt><b>BUILD_SHARED_LIBS</b>:BOOL</dt>
|
|
||||||
<dd>Flag indicating is shared libraries will be built. Its default
|
|
||||||
value is OFF. Shared libraries are not supported on Windows and
|
|
||||||
not recommended in the other OSes.</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- ======================================================================= -->
|
|
||||||
<div class="doc_subsection">
|
|
||||||
<a name="llvmvars">LLVM-specific variables</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt><b>LLVM_TARGETS_TO_BUILD</b>:STRING</dt>
|
|
||||||
<dd>Semicolon-separated list of targets to build, or <i>all</i> for
|
|
||||||
building all targets. Case-sensitive. For Visual C++ defaults
|
|
||||||
to <i>X86</i>. On the other cases defaults to <i>all</i>. Example:
|
|
||||||
<i>-DLLVM_TARGETS_TO_BUILD="X86;PowerPC;Alpha"</i>.</dd>
|
|
||||||
|
|
||||||
<dt><b>LLVM_ENABLE_THREADS</b>:BOOL</dt>
|
|
||||||
<dd>Build with threads support, if available. Defaults to ON.</dd>
|
|
||||||
|
|
||||||
<dt><b>LLVM_ENABLE_PIC</b>:BOOL</dt>
|
|
||||||
<dd>Add the <i>-fPIC</i> flag to the compiler command-line, if the
|
|
||||||
compiler supports this flag. Some systems, like Windows, does not
|
|
||||||
need this flag. Defaults to OFF.</dd>
|
|
||||||
|
|
||||||
<dt><b>LLVM_BUILD_32_BITS</b>:BOOL</dt>
|
|
||||||
<dd>Build 32-bits executables and libraries on 64-bits systems. This
|
|
||||||
option is available only on some 64-bits unix systems. Defaults to
|
|
||||||
OFF.</dd>
|
|
||||||
|
|
||||||
<dt><b>LLVM_PLO_FLAGS</b>:STRING</dt>
|
|
||||||
<dd>Extra flags for creating partially linked objects. Visual C++
|
|
||||||
does not use this.</dd>
|
|
||||||
|
|
||||||
<dt><b>LLVM_TABLEGEN</b>:STRING</dt>
|
|
||||||
<dd>Full path to a native TableGen executable (usually
|
|
||||||
named <i>tblgen</i>). This is intented for cross-compiling: if the
|
|
||||||
user sets this variable, no native TableGen will be created.</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
<div class="doc_section">
|
|
||||||
<a name="testing">Executing the test suite</a>
|
|
||||||
</div>
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p>LLVM testing is not supported on Visual Studio.</p>
|
|
||||||
|
|
||||||
<p>TODO</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
<div class="doc_section">
|
|
||||||
<a name="cross">Cross compiling</a>
|
|
||||||
</div>
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p>TODO</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
<div class="doc_section">
|
|
||||||
<a name="embedding">Embedding LLVM in your project</a>
|
|
||||||
</div>
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p>TODO</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
<div class="doc_section">
|
|
||||||
<a name="specifics">Compiler/Platform specific topics</a>
|
|
||||||
</div>
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p>Notes for specific compilers and/or platforms.</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- ======================================================================= -->
|
|
||||||
<div class="doc_subsection">
|
|
||||||
<a name="msvc">Microsoft Visual C++</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p>For linking the JIT into your executable, add</p>
|
|
||||||
|
|
||||||
<div class="doc_code">
|
|
||||||
<p><tt>/INCLUDE:_X86TargetMachineModule</tt></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>to your linker options. This is required for adding the relevant
|
|
||||||
LLVM object code to the executable. Not doing this will result on
|
|
||||||
some methods returning NULL (<i>ExecutionEngine::create</i>, for
|
|
||||||
instance).</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<address>
|
|
||||||
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
|
||||||
src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
|
|
||||||
<a href="http://validator.w3.org/check/referer"><img
|
|
||||||
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
|
|
||||||
|
|
||||||
<a href="mailto:ofv@wanadoo.es">Oscar Fuentes</a><br>
|
|
||||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
|
||||||
Last modified: $Date: 2008-12-31 03:59:36 +0100 (Wed, 31 Dec 2008) $
|
|
||||||
</address>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<li><a href="#targetmachine">The <tt>TargetMachine</tt> class</a></li>
|
<li><a href="#targetmachine">The <tt>TargetMachine</tt> class</a></li>
|
||||||
<li><a href="#targetdata">The <tt>TargetData</tt> class</a></li>
|
<li><a href="#targetdata">The <tt>TargetData</tt> class</a></li>
|
||||||
<li><a href="#targetlowering">The <tt>TargetLowering</tt> class</a></li>
|
<li><a href="#targetlowering">The <tt>TargetLowering</tt> class</a></li>
|
||||||
<li><a href="#targetregisterinfo">The <tt>TargetRegisterInfo</tt> class</a></li>
|
<li><a href="#mregisterinfo">The <tt>MRegisterInfo</tt> class</a></li>
|
||||||
<li><a href="#targetinstrinfo">The <tt>TargetInstrInfo</tt> class</a></li>
|
<li><a href="#targetinstrinfo">The <tt>TargetInstrInfo</tt> class</a></li>
|
||||||
<li><a href="#targetframeinfo">The <tt>TargetFrameInfo</tt> class</a></li>
|
<li><a href="#targetframeinfo">The <tt>TargetFrameInfo</tt> class</a></li>
|
||||||
<li><a href="#targetsubtarget">The <tt>TargetSubtarget</tt> class</a></li>
|
<li><a href="#targetsubtarget">The <tt>TargetSubtarget</tt> class</a></li>
|
||||||
@@ -50,7 +50,6 @@
|
|||||||
Process</a></li>
|
Process</a></li>
|
||||||
<li><a href="#selectiondag_build">Initial SelectionDAG
|
<li><a href="#selectiondag_build">Initial SelectionDAG
|
||||||
Construction</a></li>
|
Construction</a></li>
|
||||||
<li><a href="#selectiondag_legalize_types">SelectionDAG LegalizeTypes Phase</a></li>
|
|
||||||
<li><a href="#selectiondag_legalize">SelectionDAG Legalize Phase</a></li>
|
<li><a href="#selectiondag_legalize">SelectionDAG Legalize Phase</a></li>
|
||||||
<li><a href="#selectiondag_optimize">SelectionDAG Optimization
|
<li><a href="#selectiondag_optimize">SelectionDAG Optimization
|
||||||
Phase: the DAG Combiner</a></li>
|
Phase: the DAG Combiner</a></li>
|
||||||
@@ -85,7 +84,6 @@
|
|||||||
</li>
|
</li>
|
||||||
<li><a href="#targetimpls">Target-specific Implementation Notes</a>
|
<li><a href="#targetimpls">Target-specific Implementation Notes</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#tailcallopt">Tail call optimization</a></li>
|
|
||||||
<li><a href="#x86">The X86 backend</a></li>
|
<li><a href="#x86">The X86 backend</a></li>
|
||||||
<li><a href="#ppc">The PowerPC backend</a>
|
<li><a href="#ppc">The PowerPC backend</a>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -390,13 +388,14 @@ operations. Among other things, this class indicates:</p>
|
|||||||
|
|
||||||
<!-- ======================================================================= -->
|
<!-- ======================================================================= -->
|
||||||
<div class="doc_subsection">
|
<div class="doc_subsection">
|
||||||
<a name="targetregisterinfo">The <tt>TargetRegisterInfo</tt> class</a>
|
<a name="mregisterinfo">The <tt>MRegisterInfo</tt> class</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
|
|
||||||
<p>The <tt>TargetRegisterInfo</tt> class is used to describe the register
|
<p>The <tt>MRegisterInfo</tt> class (which will eventually be renamed to
|
||||||
file of the target and any interactions between the registers.</p>
|
<tt>TargetRegisterInfo</tt>) is used to describe the register file of the
|
||||||
|
target and any interactions between the registers.</p>
|
||||||
|
|
||||||
<p>Registers in the code generator are represented in the code generator by
|
<p>Registers in the code generator are represented in the code generator by
|
||||||
unsigned integers. Physical registers (those that actually exist in the target
|
unsigned integers. Physical registers (those that actually exist in the target
|
||||||
@@ -409,8 +408,8 @@ register (used for assembly output and debugging dumps) and a set of aliases
|
|||||||
(used to indicate whether one register overlaps with another).
|
(used to indicate whether one register overlaps with another).
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>In addition to the per-register description, the <tt>TargetRegisterInfo</tt>
|
<p>In addition to the per-register description, the <tt>MRegisterInfo</tt> class
|
||||||
class exposes a set of processor specific register classes (instances of the
|
exposes a set of processor specific register classes (instances of the
|
||||||
<tt>TargetRegisterClass</tt> class). Each register class contains sets of
|
<tt>TargetRegisterClass</tt> class). Each register class contains sets of
|
||||||
registers that have the same properties (for example, they are all 32-bit
|
registers that have the same properties (for example, they are all 32-bit
|
||||||
integer registers). Each SSA virtual register created by the instruction
|
integer registers). Each SSA virtual register created by the instruction
|
||||||
@@ -622,9 +621,9 @@ copies a virtual register into or out of a physical register when needed.</p>
|
|||||||
|
|
||||||
<div class="doc_code">
|
<div class="doc_code">
|
||||||
<pre>
|
<pre>
|
||||||
define i32 @test(i32 %X, i32 %Y) {
|
int %test(int %X, int %Y) {
|
||||||
%Z = udiv i32 %X, %Y
|
%Z = div int %X, %Y
|
||||||
ret i32 %Z
|
ret int %Z
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
@@ -720,7 +719,8 @@ comes from.</p>
|
|||||||
corresponds one-to-one with the LLVM function input to the instruction selector.
|
corresponds one-to-one with the LLVM function input to the instruction selector.
|
||||||
In addition to a list of basic blocks, the <tt>MachineFunction</tt> contains a
|
In addition to a list of basic blocks, the <tt>MachineFunction</tt> contains a
|
||||||
a <tt>MachineConstantPool</tt>, a <tt>MachineFrameInfo</tt>, a
|
a <tt>MachineConstantPool</tt>, a <tt>MachineFrameInfo</tt>, a
|
||||||
<tt>MachineFunctionInfo</tt>, and a <tt>MachineRegisterInfo</tt>. See
|
<tt>MachineFunctionInfo</tt>, a <tt>SSARegMap</tt>, and a set of live in and
|
||||||
|
live out registers for the function. See
|
||||||
<tt>include/llvm/CodeGen/MachineFunction.h</tt> for more information.</p>
|
<tt>include/llvm/CodeGen/MachineFunction.h</tt> for more information.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -748,14 +748,16 @@ explains how they work and some of the rationale behind their design.</p>
|
|||||||
<p>
|
<p>
|
||||||
Instruction Selection is the process of translating LLVM code presented to the
|
Instruction Selection is the process of translating LLVM code presented to the
|
||||||
code generator into target-specific machine instructions. There are several
|
code generator into target-specific machine instructions. There are several
|
||||||
well-known ways to do this in the literature. LLVM uses a SelectionDAG based
|
well-known ways to do this in the literature. In LLVM there are two main forms:
|
||||||
instruction selector.
|
the SelectionDAG based instruction selector framework and an old-style 'simple'
|
||||||
|
instruction selector, which effectively peephole selects each LLVM instruction
|
||||||
|
into a series of machine instructions. We recommend that all targets use the
|
||||||
|
SelectionDAG infrastructure.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>Portions of the DAG instruction selector are generated from the target
|
<p>Portions of the DAG instruction selector are generated from the target
|
||||||
description (<tt>*.td</tt>) files. Our goal is for the entire instruction
|
description (<tt>*.td</tt>) files. Our goal is for the entire instruction
|
||||||
selector to be generated from these <tt>.td</tt> files, though currently
|
selector to be generated from these <tt>.td</tt> files.</p>
|
||||||
there are still things that require custom C++ code.</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- _______________________________________________________________________ -->
|
<!-- _______________________________________________________________________ -->
|
||||||
@@ -788,11 +790,10 @@ define multiple values. For example, a combined div/rem operation will define
|
|||||||
both the dividend and the remainder. Many other situations require multiple
|
both the dividend and the remainder. Many other situations require multiple
|
||||||
values as well. Each node also has some number of operands, which are edges
|
values as well. Each node also has some number of operands, which are edges
|
||||||
to the node defining the used value. Because nodes may define multiple values,
|
to the node defining the used value. Because nodes may define multiple values,
|
||||||
edges are represented by instances of the <tt>SDValue</tt> class, which is
|
edges are represented by instances of the <tt>SDOperand</tt> class, which is
|
||||||
a <tt><SDNode, unsigned></tt> pair, indicating the node and result
|
a <tt><SDNode, unsigned></tt> pair, indicating the node and result
|
||||||
value being used, respectively. Each value produced by an <tt>SDNode</tt> has
|
value being used, respectively. Each value produced by an <tt>SDNode</tt> has
|
||||||
an associated <tt>MVT</tt> (Machine Value Type) indicating what the type of the
|
an associated <tt>MVT::ValueType</tt> indicating what type the value is.</p>
|
||||||
value is.</p>
|
|
||||||
|
|
||||||
<p>SelectionDAGs contain two different kinds of values: those that represent
|
<p>SelectionDAGs contain two different kinds of values: those that represent
|
||||||
data flow and those that represent control flow dependencies. Data values are
|
data flow and those that represent control flow dependencies. Data values are
|
||||||
@@ -814,9 +815,8 @@ basic block function it would be the return node.</p>
|
|||||||
operations and supported types. On a 32-bit PowerPC, for example, a DAG with
|
operations and supported types. On a 32-bit PowerPC, for example, a DAG with
|
||||||
a value of type i1, i8, i16, or i64 would be illegal, as would a DAG that uses a
|
a value of type i1, i8, i16, or i64 would be illegal, as would a DAG that uses a
|
||||||
SREM or UREM operation. The
|
SREM or UREM operation. The
|
||||||
<a href="#selectinodag_legalize_types">legalize types</a> and
|
<a href="#selectiondag_legalize">legalize</a> phase is responsible for turning
|
||||||
<a href="#selectiondag_legalize">legalize operations</a> phases are
|
an illegal DAG into a legal DAG.</p>
|
||||||
responsible for turning an illegal DAG into a legal DAG.</p>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -839,18 +839,12 @@ responsible for turning an illegal DAG into a legal DAG.</p>
|
|||||||
pairs) for targets that support these meta operations. This makes the
|
pairs) for targets that support these meta operations. This makes the
|
||||||
resultant code more efficient and the <a href="#selectiondag_select">select
|
resultant code more efficient and the <a href="#selectiondag_select">select
|
||||||
instructions from DAG</a> phase (below) simpler.</li>
|
instructions from DAG</a> phase (below) simpler.</li>
|
||||||
<li><a href="#selectiondag_legalize_types">Legalize SelectionDAG Types</a> - This
|
<li><a href="#selectiondag_legalize">Legalize SelectionDAG</a> - This stage
|
||||||
stage transforms SelectionDAG nodes to eliminate any types that are
|
converts the illegal SelectionDAG to a legal SelectionDAG by eliminating
|
||||||
unsupported on the target.</li>
|
unsupported operations and data types.</li>
|
||||||
<li><a href="#selectiondag_optimize">Optimize SelectionDAG</a> - The
|
<li><a href="#selectiondag_optimize">Optimize SelectionDAG (#2)</a> - This
|
||||||
SelectionDAG optimizer is run to clean up redundancies exposed
|
second run of the SelectionDAG optimizes the newly legalized DAG to
|
||||||
by type legalization.</li>
|
eliminate inefficiencies introduced by legalization.</li>
|
||||||
<li><a href="#selectiondag_legalize">Legalize SelectionDAG Types</a> - This
|
|
||||||
stage transforms SelectionDAG nodes to eliminate any types that are
|
|
||||||
unsupported on the target.</li>
|
|
||||||
<li><a href="#selectiondag_optimize">Optimize SelectionDAG</a> - The
|
|
||||||
SelectionDAG optimizer is run to eliminate inefficiencies introduced
|
|
||||||
by operation legalization.</li>
|
|
||||||
<li><a href="#selectiondag_select">Select instructions from DAG</a> - Finally,
|
<li><a href="#selectiondag_select">Select instructions from DAG</a> - Finally,
|
||||||
the target instruction selector matches the DAG operations to target
|
the target instruction selector matches the DAG operations to target
|
||||||
instructions. This process translates the target-independent input DAG into
|
instructions. This process translates the target-independent input DAG into
|
||||||
@@ -865,28 +859,13 @@ responsible for turning an illegal DAG into a legal DAG.</p>
|
|||||||
rest of the code generation passes are run.</p>
|
rest of the code generation passes are run.</p>
|
||||||
|
|
||||||
<p>One great way to visualize what is going on here is to take advantage of a
|
<p>One great way to visualize what is going on here is to take advantage of a
|
||||||
few LLC command line options. The following options pop up a window displaying
|
few LLC command line options. In particular, the <tt>-view-isel-dags</tt>
|
||||||
the SelectionDAG at specific times (if you only get errors printed to the console
|
option pops up a window with the SelectionDAG input to the Select phase for all
|
||||||
while using this, you probably
|
of the code compiled (if you only get errors printed to the console while using
|
||||||
<a href="ProgrammersManual.html#ViewGraph">need to configure your system</a> to
|
this, you probably <a href="ProgrammersManual.html#ViewGraph">need to configure
|
||||||
add support for it).</p>
|
your system</a> to add support for it). The <tt>-view-sched-dags</tt> option
|
||||||
|
views the SelectionDAG output from the Select phase and input to the Scheduler
|
||||||
<ul>
|
phase.</p>
|
||||||
<li><tt>-view-dag-combine1-dags</tt> displays the DAG after being built, before
|
|
||||||
the first optimization pass.</li>
|
|
||||||
<li><tt>-view-legalize-dags</tt> displays the DAG before Legalization.</li>
|
|
||||||
<li><tt>-view-dag-combine2-dags</tt> displays the DAG before the second
|
|
||||||
optimization pass.</li>
|
|
||||||
<li><tt>-view-isel-dags</tt> displays the DAG before the Select phase.</li>
|
|
||||||
<li><tt>-view-sched-dags</tt> displays the DAG before Scheduling.</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p>The <tt>-view-sunit-dags</tt> displays the Scheduler's dependency graph.
|
|
||||||
This graph is based on the final SelectionDAG, with nodes that must be
|
|
||||||
scheduled together bundled into a single scheduling-unit node, and with
|
|
||||||
immediate operands and other nodes that aren't relevant for scheduling
|
|
||||||
omitted.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -902,47 +881,13 @@ input by the <tt>SelectionDAGLowering</tt> class in the
|
|||||||
<tt>lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp</tt> file. The intent of this
|
<tt>lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp</tt> file. The intent of this
|
||||||
pass is to expose as much low-level, target-specific details to the SelectionDAG
|
pass is to expose as much low-level, target-specific details to the SelectionDAG
|
||||||
as possible. This pass is mostly hard-coded (e.g. an LLVM <tt>add</tt> turns
|
as possible. This pass is mostly hard-coded (e.g. an LLVM <tt>add</tt> turns
|
||||||
into an <tt>SDNode add</tt> while a <tt>getelementptr</tt> is expanded into the
|
into an <tt>SDNode add</tt> while a <tt>geteelementptr</tt> is expanded into the
|
||||||
obvious arithmetic). This pass requires target-specific hooks to lower calls,
|
obvious arithmetic). This pass requires target-specific hooks to lower calls,
|
||||||
returns, varargs, etc. For these features, the
|
returns, varargs, etc. For these features, the
|
||||||
<tt><a href="#targetlowering">TargetLowering</a></tt> interface is used.</p>
|
<tt><a href="#targetlowering">TargetLowering</a></tt> interface is used.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- _______________________________________________________________________ -->
|
|
||||||
<div class="doc_subsubsection">
|
|
||||||
<a name="selectiondag_legalize_types">SelectionDAG LegalizeTypes Phase</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p>The Legalize phase is in charge of converting a DAG to only use the types
|
|
||||||
that are natively supported by the target.</p>
|
|
||||||
|
|
||||||
<p>There are two main ways of converting values of unsupported scalar types
|
|
||||||
to values of supported types: converting small types to
|
|
||||||
larger types ("promoting"), and breaking up large integer types
|
|
||||||
into smaller ones ("expanding"). For example, a target might require
|
|
||||||
that all f32 values are promoted to f64 and that all i1/i8/i16 values
|
|
||||||
are promoted to i32. The same target might require that all i64 values
|
|
||||||
be expanded into pairs of i32 values. These changes can insert sign and
|
|
||||||
zero extensions as needed to make sure that the final code has the same
|
|
||||||
behavior as the input.</p>
|
|
||||||
|
|
||||||
<p>There are two main ways of converting values of unsupported vector types
|
|
||||||
to value of supported types: splitting vector types, multiple times if
|
|
||||||
necessary, until a legal type is found, and extending vector types by
|
|
||||||
adding elements to the end to round them out to legal types ("widening").
|
|
||||||
If a vector gets split all the way down to single-element parts with
|
|
||||||
no supported vector type being found, the elements are converted to
|
|
||||||
scalars ("scalarizing").</p>
|
|
||||||
|
|
||||||
<p>A target implementation tells the legalizer which types are supported
|
|
||||||
(and which register class to use for them) by calling the
|
|
||||||
<tt>addRegisterClass</tt> method in its TargetLowering constructor.</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- _______________________________________________________________________ -->
|
<!-- _______________________________________________________________________ -->
|
||||||
<div class="doc_subsubsection">
|
<div class="doc_subsubsection">
|
||||||
<a name="selectiondag_legalize">SelectionDAG Legalize Phase</a>
|
<a name="selectiondag_legalize">SelectionDAG Legalize Phase</a>
|
||||||
@@ -950,10 +895,27 @@ that are natively supported by the target.</p>
|
|||||||
|
|
||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
|
|
||||||
<p>The Legalize phase is in charge of converting a DAG to only use the
|
<p>The Legalize phase is in charge of converting a DAG to only use the types and
|
||||||
operations that are natively supported by the target.</p>
|
operations that are natively supported by the target. This involves two major
|
||||||
|
tasks:</p>
|
||||||
|
|
||||||
<p>Targets often have weird constraints, such as not supporting every
|
<ol>
|
||||||
|
<li><p>Convert values of unsupported types to values of supported types.</p>
|
||||||
|
<p>There are two main ways of doing this: converting small types to
|
||||||
|
larger types ("promoting"), and breaking up large integer types
|
||||||
|
into smaller ones ("expanding"). For example, a target might require
|
||||||
|
that all f32 values are promoted to f64 and that all i1/i8/i16 values
|
||||||
|
are promoted to i32. The same target might require that all i64 values
|
||||||
|
be expanded into i32 values. These changes can insert sign and zero
|
||||||
|
extensions as needed to make sure that the final code has the same
|
||||||
|
behavior as the input.</p>
|
||||||
|
<p>A target implementation tells the legalizer which types are supported
|
||||||
|
(and which register class to use for them) by calling the
|
||||||
|
<tt>addRegisterClass</tt> method in its TargetLowering constructor.</p>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li><p>Eliminate operations that are not supported by the target.</p>
|
||||||
|
<p>Targets often have weird constraints, such as not supporting every
|
||||||
operation on every supported datatype (e.g. X86 does not support byte
|
operation on every supported datatype (e.g. X86 does not support byte
|
||||||
conditional moves and PowerPC does not support sign-extending loads from
|
conditional moves and PowerPC does not support sign-extending loads from
|
||||||
a 16-bit memory location). Legalize takes care of this by open-coding
|
a 16-bit memory location). Legalize takes care of this by open-coding
|
||||||
@@ -961,17 +923,18 @@ operations that are natively supported by the target.</p>
|
|||||||
promoting one type to a larger type that supports the operation
|
promoting one type to a larger type that supports the operation
|
||||||
("promotion"), or by using a target-specific hook to implement the
|
("promotion"), or by using a target-specific hook to implement the
|
||||||
legalization ("custom").</p>
|
legalization ("custom").</p>
|
||||||
|
<p>A target implementation tells the legalizer which operations are not
|
||||||
<p>A target implementation tells the legalizer which operations are not
|
|
||||||
supported (and which of the above three actions to take) by calling the
|
supported (and which of the above three actions to take) by calling the
|
||||||
<tt>setOperationAction</tt> method in its <tt>TargetLowering</tt>
|
<tt>setOperationAction</tt> method in its <tt>TargetLowering</tt>
|
||||||
constructor.</p>
|
constructor.</p>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
<p>Prior to the existence of the Legalize passes, we required that every target
|
<p>Prior to the existance of the Legalize pass, we required that every target
|
||||||
<a href="#selectiondag_optimize">selector</a> supported and handled every
|
<a href="#selectiondag_optimize">selector</a> supported and handled every
|
||||||
operator and type even if they are not natively supported. The introduction of
|
operator and type even if they are not natively supported. The introduction of
|
||||||
the Legalize phases allows all of the canonicalization patterns to be shared
|
the Legalize phase allows all of the cannonicalization patterns to be shared
|
||||||
across targets, and makes it very easy to optimize the canonicalized code
|
across targets, and makes it very easy to optimize the cannonicalized code
|
||||||
because it is still in the form of a DAG.</p>
|
because it is still in the form of a DAG.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -984,12 +947,12 @@ because it is still in the form of a DAG.</p>
|
|||||||
|
|
||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
|
|
||||||
<p>The SelectionDAG optimization phase is run multiple times for code generation,
|
<p>The SelectionDAG optimization phase is run twice for code generation: once
|
||||||
immediately after the DAG is built and once after each legalization. The first
|
immediately after the DAG is built and once after legalization. The first run
|
||||||
run of the pass allows the initial code to be cleaned up (e.g. performing
|
of the pass allows the initial code to be cleaned up (e.g. performing
|
||||||
optimizations that depend on knowing that the operators have restricted type
|
optimizations that depend on knowing that the operators have restricted type
|
||||||
inputs). Subsequent runs of the pass clean up the messy code generated by the
|
inputs). The second run of the pass cleans up the messy code generated by the
|
||||||
Legalize passes, which allows Legalize to be very simple (it can focus on making
|
Legalize pass, which allows Legalize to be very simple (it can focus on making
|
||||||
code legal instead of focusing on generating <em>good</em> and legal code).</p>
|
code legal instead of focusing on generating <em>good</em> and legal code).</p>
|
||||||
|
|
||||||
<p>One important class of optimizations performed is optimizing inserted sign
|
<p>One important class of optimizations performed is optimizing inserted sign
|
||||||
@@ -1077,7 +1040,7 @@ def FADDS : AForm_2<59, 21,
|
|||||||
<p>The portion of the instruction definition in bold indicates the pattern used
|
<p>The portion of the instruction definition in bold indicates the pattern used
|
||||||
to match the instruction. The DAG operators (like <tt>fmul</tt>/<tt>fadd</tt>)
|
to match the instruction. The DAG operators (like <tt>fmul</tt>/<tt>fadd</tt>)
|
||||||
are defined in the <tt>lib/Target/TargetSelectionDAG.td</tt> file.
|
are defined in the <tt>lib/Target/TargetSelectionDAG.td</tt> file.
|
||||||
"<tt>F4RC</tt>" is the register class of the input and result values.</p>
|
"<tt>F4RC</tt>" is the register class of the input and result values.<p>
|
||||||
|
|
||||||
<p>The TableGen DAG instruction selector generator reads the instruction
|
<p>The TableGen DAG instruction selector generator reads the instruction
|
||||||
patterns in the <tt>.td</tt> file and automatically builds parts of the pattern
|
patterns in the <tt>.td</tt> file and automatically builds parts of the pattern
|
||||||
@@ -1148,8 +1111,7 @@ primarily because it is a work in progress and is not yet finished:</p>
|
|||||||
<li>There is no great way to support matching complex addressing modes yet. In
|
<li>There is no great way to support matching complex addressing modes yet. In
|
||||||
the future, we will extend pattern fragments to allow them to define
|
the future, we will extend pattern fragments to allow them to define
|
||||||
multiple values (e.g. the four operands of the <a href="#x86_memory">X86
|
multiple values (e.g. the four operands of the <a href="#x86_memory">X86
|
||||||
addressing mode</a>, which are currently matched with custom C++ code).
|
addressing mode</a>). In addition, we'll extend fragments so that a
|
||||||
In addition, we'll extend fragments so that a
|
|
||||||
fragment can match multiple different patterns.</li>
|
fragment can match multiple different patterns.</li>
|
||||||
<li>We don't automatically infer flags like isStore/isLoad yet.</li>
|
<li>We don't automatically infer flags like isStore/isLoad yet.</li>
|
||||||
<li>We don't automatically generate the set of supported registers and
|
<li>We don't automatically generate the set of supported registers and
|
||||||
@@ -1252,7 +1214,7 @@ values in the function.</p>
|
|||||||
<p><tt>PHI</tt> nodes need to be handled specially, because the calculation
|
<p><tt>PHI</tt> nodes need to be handled specially, because the calculation
|
||||||
of the live variable information from a depth first traversal of the CFG of
|
of the live variable information from a depth first traversal of the CFG of
|
||||||
the function won't guarantee that a virtual register used by the <tt>PHI</tt>
|
the function won't guarantee that a virtual register used by the <tt>PHI</tt>
|
||||||
node is defined before it's used. When a <tt>PHI</tt> node is encountered, only
|
node is defined before it's used. When a <tt>PHI</tt> node is encounted, only
|
||||||
the definition is handled, because the uses will be handled in other basic
|
the definition is handled, because the uses will be handled in other basic
|
||||||
blocks.</p>
|
blocks.</p>
|
||||||
|
|
||||||
@@ -1279,7 +1241,7 @@ blocks and machine instructions. We then handle the "live-in" values. These
|
|||||||
are in physical registers, so the physical register is assumed to be killed by
|
are in physical registers, so the physical register is assumed to be killed by
|
||||||
the end of the basic block. Live intervals for virtual registers are computed
|
the end of the basic block. Live intervals for virtual registers are computed
|
||||||
for some ordering of the machine instructions <tt>[1, N]</tt>. A live interval
|
for some ordering of the machine instructions <tt>[1, N]</tt>. A live interval
|
||||||
is an interval <tt>[i, j)</tt>, where <tt>1 <= i <= j < N</tt>, for which a
|
is an interval <tt>[i, j)</tt>, where <tt>1 <= i <= j < N</tt>, for which a
|
||||||
variable is live.</p>
|
variable is live.</p>
|
||||||
|
|
||||||
<p><i><b>More to come...</b></i></p>
|
<p><i><b>More to come...</b></i></p>
|
||||||
@@ -1328,7 +1290,7 @@ X86 architecture, the registers <tt>EAX</tt>, <tt>AX</tt> and
|
|||||||
marked as <i>aliased</i> in LLVM. Given a particular architecture, you
|
marked as <i>aliased</i> in LLVM. Given a particular architecture, you
|
||||||
can check which registers are aliased by inspecting its
|
can check which registers are aliased by inspecting its
|
||||||
<tt>RegisterInfo.td</tt> file. Moreover, the method
|
<tt>RegisterInfo.td</tt> file. Moreover, the method
|
||||||
<tt>TargetRegisterInfo::getAliasSet(p_reg)</tt> returns an array containing
|
<tt>MRegisterInfo::getAliasSet(p_reg)</tt> returns an array containing
|
||||||
all the physical registers aliased to the register <tt>p_reg</tt>.</p>
|
all the physical registers aliased to the register <tt>p_reg</tt>.</p>
|
||||||
|
|
||||||
<p>Physical registers, in LLVM, are grouped in <i>Register Classes</i>.
|
<p>Physical registers, in LLVM, are grouped in <i>Register Classes</i>.
|
||||||
@@ -1346,10 +1308,10 @@ this code can be used:
|
|||||||
bool RegMapping_Fer::compatible_class(MachineFunction &mf,
|
bool RegMapping_Fer::compatible_class(MachineFunction &mf,
|
||||||
unsigned v_reg,
|
unsigned v_reg,
|
||||||
unsigned p_reg) {
|
unsigned p_reg) {
|
||||||
assert(TargetRegisterInfo::isPhysicalRegister(p_reg) &&
|
assert(MRegisterInfo::isPhysicalRegister(p_reg) &&
|
||||||
"Target register must be physical");
|
"Target register must be physical");
|
||||||
const TargetRegisterClass *trc = mf.getRegInfo().getRegClass(v_reg);
|
const TargetRegisterClass *trc = mf.getSSARegMap()->getRegClass(v_reg);
|
||||||
return trc->contains(p_reg);
|
return trc->contains(p_reg);
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
@@ -1371,14 +1333,14 @@ physical registers, different virtual registers never share the same
|
|||||||
number. The smallest virtual register is normally assigned the number
|
number. The smallest virtual register is normally assigned the number
|
||||||
1024. This may change, so, in order to know which is the first virtual
|
1024. This may change, so, in order to know which is the first virtual
|
||||||
register, you should access
|
register, you should access
|
||||||
<tt>TargetRegisterInfo::FirstVirtualRegister</tt>. Any register whose
|
<tt>MRegisterInfo::FirstVirtualRegister</tt>. Any register whose
|
||||||
number is greater than or equal to
|
number is greater than or equal to
|
||||||
<tt>TargetRegisterInfo::FirstVirtualRegister</tt> is considered a virtual
|
<tt>MRegisterInfo::FirstVirtualRegister</tt> is considered a virtual
|
||||||
register. Whereas physical registers are statically defined in a
|
register. Whereas physical registers are statically defined in a
|
||||||
<tt>TargetRegisterInfo.td</tt> file and cannot be created by the
|
<tt>TargetRegisterInfo.td</tt> file and cannot be created by the
|
||||||
application developer, that is not the case with virtual registers.
|
application developer, that is not the case with virtual registers.
|
||||||
In order to create new virtual registers, use the method
|
In order to create new virtual registers, use the method
|
||||||
<tt>MachineRegisterInfo::createVirtualRegister()</tt>. This method will return a
|
<tt>SSARegMap::createVirtualRegister()</tt>. This method will return a
|
||||||
virtual register with the highest code.
|
virtual register with the highest code.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -1395,7 +1357,7 @@ if that register is being used by the instruction. The method
|
|||||||
<tt>MachineOperand::isDef()</tt> informs if that registers is being
|
<tt>MachineOperand::isDef()</tt> informs if that registers is being
|
||||||
defined.</p>
|
defined.</p>
|
||||||
|
|
||||||
<p>We will call physical registers present in the LLVM bitcode before
|
<p>We will call physical registers present in the LLVM bytecode before
|
||||||
register allocation <i>pre-colored registers</i>. Pre-colored
|
register allocation <i>pre-colored registers</i>. Pre-colored
|
||||||
registers are used in many different situations, for instance, to pass
|
registers are used in many different situations, for instance, to pass
|
||||||
parameters of functions calls, and to store results of particular
|
parameters of functions calls, and to store results of particular
|
||||||
@@ -1430,7 +1392,7 @@ overwritten by the values of virtual registers while still alive.</p>
|
|||||||
|
|
||||||
<p>There are two ways to map virtual registers to physical registers (or to
|
<p>There are two ways to map virtual registers to physical registers (or to
|
||||||
memory slots). The first way, that we will call <i>direct mapping</i>,
|
memory slots). The first way, that we will call <i>direct mapping</i>,
|
||||||
is based on the use of methods of the classes <tt>TargetRegisterInfo</tt>,
|
is based on the use of methods of the classes <tt>MRegisterInfo</tt>,
|
||||||
and <tt>MachineOperand</tt>. The second way, that we will call
|
and <tt>MachineOperand</tt>. The second way, that we will call
|
||||||
<i>indirect mapping</i>, relies on the <tt>VirtRegMap</tt> class in
|
<i>indirect mapping</i>, relies on the <tt>VirtRegMap</tt> class in
|
||||||
order to insert loads and stores sending and getting values to and from
|
order to insert loads and stores sending and getting values to and from
|
||||||
@@ -1444,8 +1406,8 @@ target function being compiled in order to get and store values in
|
|||||||
memory. To assign a physical register to a virtual register present in
|
memory. To assign a physical register to a virtual register present in
|
||||||
a given operand, use <tt>MachineOperand::setReg(p_reg)</tt>. To insert
|
a given operand, use <tt>MachineOperand::setReg(p_reg)</tt>. To insert
|
||||||
a store instruction, use
|
a store instruction, use
|
||||||
<tt>TargetRegisterInfo::storeRegToStackSlot(...)</tt>, and to insert a load
|
<tt>MRegisterInfo::storeRegToStackSlot(...)</tt>, and to insert a load
|
||||||
instruction, use <tt>TargetRegisterInfo::loadRegFromStackSlot</tt>.</p>
|
instruction, use <tt>MRegisterInfo::loadRegFromStackSlot</tt>.</p>
|
||||||
|
|
||||||
<p>The indirect mapping shields the application developer from the
|
<p>The indirect mapping shields the application developer from the
|
||||||
complexities of inserting load and store instructions. In order to map
|
complexities of inserting load and store instructions. In order to map
|
||||||
@@ -1503,12 +1465,12 @@ instance, in situations where an instruction such as <tt>%a = ADD %b
|
|||||||
<div class="doc_code">
|
<div class="doc_code">
|
||||||
<pre>
|
<pre>
|
||||||
%a = MOVE %b
|
%a = MOVE %b
|
||||||
%a = ADD %a %c
|
%a = ADD %a %b
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Notice that, internally, the second instruction is represented as
|
<p>Notice that, internally, the second instruction is represented as
|
||||||
<tt>ADD %a[def/use] %c</tt>. I.e., the register operand <tt>%a</tt> is
|
<tt>ADD %a[def/use] %b</tt>. I.e., the register operand <tt>%a</tt> is
|
||||||
both used and defined by the instruction.</p>
|
both used and defined by the instruction.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -1532,7 +1494,7 @@ semantics.</p>
|
|||||||
from the target code. The most traditional PHI deconstruction
|
from the target code. The most traditional PHI deconstruction
|
||||||
algorithm replaces PHI instructions with copy instructions. That is
|
algorithm replaces PHI instructions with copy instructions. That is
|
||||||
the strategy adopted by LLVM. The SSA deconstruction algorithm is
|
the strategy adopted by LLVM. The SSA deconstruction algorithm is
|
||||||
implemented in <tt>lib/CodeGen/PHIElimination.cpp</tt>. In order to
|
implemented in n<tt>lib/CodeGen/>PHIElimination.cpp</tt>. In order to
|
||||||
invoke this pass, the identifier <tt>PHIEliminationID</tt> must be
|
invoke this pass, the identifier <tt>PHIEliminationID</tt> must be
|
||||||
marked as required in the code of the register allocator.</p>
|
marked as required in the code of the register allocator.</p>
|
||||||
|
|
||||||
@@ -1556,7 +1518,7 @@ instance, a sequence of instructions such as:</p>
|
|||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>can be safely substituted by the single instruction:</p>
|
<p>can be safely substituted by the single instruction:
|
||||||
|
|
||||||
<div class="doc_code">
|
<div class="doc_code">
|
||||||
<pre>
|
<pre>
|
||||||
@@ -1565,7 +1527,7 @@ instance, a sequence of instructions such as:</p>
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Instructions can be folded with the
|
<p>Instructions can be folded with the
|
||||||
<tt>TargetRegisterInfo::foldMemoryOperand(...)</tt> method. Care must be
|
<tt>MRegisterInfo::foldMemoryOperand(...)</tt> method. Care must be
|
||||||
taken when folding instructions; a folded instruction can be quite
|
taken when folding instructions; a folded instruction can be quite
|
||||||
different from the original instruction. See
|
different from the original instruction. See
|
||||||
<tt>LiveIntervals::addIntervalsForSpills</tt> in
|
<tt>LiveIntervals::addIntervalsForSpills</tt> in
|
||||||
@@ -1657,51 +1619,7 @@ are specific to the code generator for a particular target.</p>
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- ======================================================================= -->
|
|
||||||
<div class="doc_subsection">
|
|
||||||
<a name="tailcallopt">Tail call optimization</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
<p>Tail call optimization, callee reusing the stack of the caller, is currently supported on x86/x86-64 and PowerPC. It is performed if:
|
|
||||||
<ul>
|
|
||||||
<li>Caller and callee have the calling convention <tt>fastcc</tt>.</li>
|
|
||||||
<li>The call is a tail call - in tail position (ret immediately follows call and ret uses value of call or is void).</li>
|
|
||||||
<li>Option <tt>-tailcallopt</tt> is enabled.</li>
|
|
||||||
<li>Platform specific constraints are met.</li>
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>x86/x86-64 constraints:
|
|
||||||
<ul>
|
|
||||||
<li>No variable argument lists are used.</li>
|
|
||||||
<li>On x86-64 when generating GOT/PIC code only module-local calls (visibility = hidden or protected) are supported.</li>
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
<p>PowerPC constraints:
|
|
||||||
<ul>
|
|
||||||
<li>No variable argument lists are used.</li>
|
|
||||||
<li>No byval parameters are used.</li>
|
|
||||||
<li>On ppc32/64 GOT/PIC only module-local calls (visibility = hidden or protected) are supported.</li>
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
<p>Example:</p>
|
|
||||||
<p>Call as <tt>llc -tailcallopt test.ll</tt>.
|
|
||||||
<div class="doc_code">
|
|
||||||
<pre>
|
|
||||||
declare fastcc i32 @tailcallee(i32 inreg %a1, i32 inreg %a2, i32 %a3, i32 %a4)
|
|
||||||
|
|
||||||
define fastcc i32 @tailcaller(i32 %in1, i32 %in2) {
|
|
||||||
%l1 = add i32 %in1, %in2
|
|
||||||
%tmp = tail call fastcc i32 @tailcallee(i32 %in1 inreg, i32 %in2 inreg, i32 %in1, i32 %l1)
|
|
||||||
ret i32 %tmp
|
|
||||||
}</pre>
|
|
||||||
</div>
|
|
||||||
</p>
|
|
||||||
<p>Implications of <tt>-tailcallopt</tt>:</p>
|
|
||||||
<p>To support tail call optimization in situations where the callee has more arguments than the caller a 'callee pops arguments' convention is used. This currently causes each <tt>fastcc</tt> call that is not tail call optimized (because one or more of above constraints are not met) to be followed by a readjustment of the stack. So performance might be worse in such cases.</p>
|
|
||||||
<p>On x86 and x86-64 one register is reserved for indirect tail calls (e.g via a function pointer). So there is one less register for integer argument passing. For x86 this means 2 registers (if <tt>inreg</tt> parameter attribute is used) and for x86-64 this means 5 register are used.</p>
|
|
||||||
</div>
|
|
||||||
<!-- ======================================================================= -->
|
<!-- ======================================================================= -->
|
||||||
<div class="doc_subsection">
|
<div class="doc_subsection">
|
||||||
<a name="x86">The X86 backend</a>
|
<a name="x86">The X86 backend</a>
|
||||||
@@ -1710,15 +1628,17 @@ define fastcc i32 @tailcaller(i32 %in1, i32 %in2) {
|
|||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
|
|
||||||
<p>The X86 code generator lives in the <tt>lib/Target/X86</tt> directory. This
|
<p>The X86 code generator lives in the <tt>lib/Target/X86</tt> directory. This
|
||||||
code generator is capable of targeting a variety of x86-32 and x86-64
|
code generator currently targets a generic P6-like processor. As such, it
|
||||||
processors, and includes support for ISA extensions such as MMX and SSE.
|
produces a few P6-and-above instructions (like conditional moves), but it does
|
||||||
</p>
|
not make use of newer features like MMX or SSE. In the future, the X86 backend
|
||||||
|
will have sub-target support added for specific processor families and
|
||||||
|
implementations.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- _______________________________________________________________________ -->
|
<!-- _______________________________________________________________________ -->
|
||||||
<div class="doc_subsubsection">
|
<div class="doc_subsubsection">
|
||||||
<a name="x86_tt">X86 Target Triples supported</a>
|
<a name="x86_tt">X86 Target Triples Supported</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
@@ -1746,7 +1666,7 @@ that people test.</p>
|
|||||||
|
|
||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
|
|
||||||
<p>The following target-specific calling conventions are known to backend:</p>
|
<p>The folowing target-specific calling conventions are known to backend:</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>x86_StdCall</b> - stdcall calling convention seen on Microsoft Windows
|
<li><b>x86_StdCall</b> - stdcall calling convention seen on Microsoft Windows
|
||||||
@@ -1789,27 +1709,6 @@ same way and in the same order.</p>
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- _______________________________________________________________________ -->
|
|
||||||
<div class="doc_subsubsection">
|
|
||||||
<a name="x86_memory">X86 address spaces supported</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="doc_text">
|
|
||||||
|
|
||||||
<p>x86 has the ability to perform loads and stores to different address spaces
|
|
||||||
via the x86 segment registers. A segment override prefix byte on an instruction
|
|
||||||
causes the instruction's memory access to go to the specified segment. LLVM
|
|
||||||
address space 0 is the default address space, which includes the stack, and
|
|
||||||
any unqualified memory accesses in a program. Address spaces 1-255 are
|
|
||||||
currently reserved for user-defined code. The GS-segment is represented by
|
|
||||||
address space 256. Other x86 segments have yet to be allocated address space
|
|
||||||
numbers.
|
|
||||||
|
|
||||||
<p>Some operating systems use the GS-segment to implement TLS, so care should be
|
|
||||||
taken when reading and writing to address space 256 on these platforms.
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- _______________________________________________________________________ -->
|
<!-- _______________________________________________________________________ -->
|
||||||
<div class="doc_subsubsection">
|
<div class="doc_subsubsection">
|
||||||
<a name="x86_names">Instruction naming</a>
|
<a name="x86_names">Instruction naming</a>
|
||||||
@@ -1874,7 +1773,7 @@ pointer is free to grow or shrink. A base pointer is also used if llvm-gcc is
|
|||||||
not passed the -fomit-frame-pointer flag. The stack pointer is always aligned to
|
not passed the -fomit-frame-pointer flag. The stack pointer is always aligned to
|
||||||
16 bytes, so that space allocated for altivec vectors will be properly
|
16 bytes, so that space allocated for altivec vectors will be properly
|
||||||
aligned.</p>
|
aligned.</p>
|
||||||
<p>An invocation frame is laid out as follows (low memory at top);</p>
|
<p>An invocation frame is layed out as follows (low memory at top);</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
@@ -1983,7 +1882,7 @@ passed in registers, with the space in the parameter area unused. However, if
|
|||||||
there are not enough registers or the callee is a thunk or vararg function,
|
there are not enough registers or the callee is a thunk or vararg function,
|
||||||
these register arguments can be spilled into the parameter area. Thus, the
|
these register arguments can be spilled into the parameter area. Thus, the
|
||||||
parameter area must be large enough to store all the parameters for the largest
|
parameter area must be large enough to store all the parameters for the largest
|
||||||
call sequence made by the caller. The size must also be minimally large enough
|
call sequence made by the caller. The size must also be mimimally large enough
|
||||||
to spill registers r3-r10. This allows callees blind to the call signature,
|
to spill registers r3-r10. This allows callees blind to the call signature,
|
||||||
such as thunks and vararg functions, enough space to cache the argument
|
such as thunks and vararg functions, enough space to cache the argument
|
||||||
registers. Therefore, the parameter area is minimally 32 bytes (64 bytes in 64
|
registers. Therefore, the parameter area is minimally 32 bytes (64 bytes in 64
|
||||||
@@ -2005,7 +1904,7 @@ shifted to top of stack, and the new space is available immediately below the
|
|||||||
linkage and parameter areas. The cost of shifting the linkage and parameter
|
linkage and parameter areas. The cost of shifting the linkage and parameter
|
||||||
areas is minor since only the link value needs to be copied. The link value can
|
areas is minor since only the link value needs to be copied. The link value can
|
||||||
be easily fetched by adding the original frame size to the base pointer. Note
|
be easily fetched by adding the original frame size to the base pointer. Note
|
||||||
that allocations in the dynamic space need to observe 16 byte alignment.</p>
|
that allocations in the dynamic space need to observe 16 byte aligment.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
@@ -2050,9 +1949,9 @@ makes it convenient to locate programatically and during debugging.</p>
|
|||||||
<hr>
|
<hr>
|
||||||
<address>
|
<address>
|
||||||
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
<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" alt="Valid CSS!"></a>
|
||||||
<a href="http://validator.w3.org/check/referer"><img
|
<a href="http://validator.w3.org/check/referer"><img
|
||||||
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
|
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="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="llvm.css" type="text/css">
|
<link rel="stylesheet" href="llvm.css" type="text/css">
|
||||||
<title>LLVM Coding Standards</title>
|
<title>A Few Coding Standards</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="doc_title">
|
<div class="doc_title">
|
||||||
LLVM Coding Standards
|
A Few Coding Standards
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
@@ -122,9 +122,9 @@ documentation is very useful:</p>
|
|||||||
|
|
||||||
<b>File Headers</b>
|
<b>File Headers</b>
|
||||||
|
|
||||||
<p>Every source file should have a header on it that describes the basic
|
<p>Every source file should have a header on it that
|
||||||
purpose of the file. If a file does not have a header, it should not be
|
describes the basic purpose of the file. If a file does not have a header, it
|
||||||
checked into Subversion. Most source trees will probably have a standard
|
should not be checked into CVS. Most source trees will probably have a standard
|
||||||
file header format. The standard format for the LLVM source tree looks like
|
file header format. The standard format for the LLVM source tree looks like
|
||||||
this:</p>
|
this:</p>
|
||||||
|
|
||||||
@@ -134,8 +134,8 @@ this:</p>
|
|||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
// This file is distributed under the University of Illinois Open Source
|
// This file was developed by <whoever started the file> and is distributed under
|
||||||
// License. See LICENSE.TXT for details.
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
@@ -146,7 +146,9 @@ this:</p>
|
|||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>A few things to note about this particular format: The "<tt>-*- C++
|
<p>A few things to note about this particular format: The 'developed by' line
|
||||||
|
should be the name of the person or organization who initially contributed the
|
||||||
|
file. The "<tt>-*- C++
|
||||||
-*-</tt>" string on the first line is there to tell Emacs that the source file
|
-*-</tt>" string on the first line is there to tell Emacs that the source file
|
||||||
is a C++ file, not a C file (Emacs assumes .h files are C files by default).
|
is a C++ file, not a C file (Emacs assumes .h files are C files by default).
|
||||||
Note that this tag is not necessary in .cpp files. The name of the file is also
|
Note that this tag is not necessary in .cpp files. The name of the file is also
|
||||||
@@ -154,9 +156,9 @@ on the first line, along with a very short description of the purpose of the
|
|||||||
file. This is important when printing out code and flipping though lots of
|
file. This is important when printing out code and flipping though lots of
|
||||||
pages.</p>
|
pages.</p>
|
||||||
|
|
||||||
<p>The next section in the file is a concise note that defines the license
|
<p>The next section in the file is a concise note that defines the license that
|
||||||
that the file is released under. This makes it perfectly clear what terms the
|
the file is released under. This makes it perfectly clear what terms the source
|
||||||
source code can be distributed under and should not be modified in any way.</p>
|
code can be distributed under.</p>
|
||||||
|
|
||||||
<p>The main body of the description does not have to be very long in most cases.
|
<p>The main body of the description does not have to be very long in most cases.
|
||||||
Here it's only two lines. If an algorithm is being implemented or something
|
Here it's only two lines. If an algorithm is being implemented or something
|
||||||
@@ -238,7 +240,7 @@ order:</p>
|
|||||||
<li>System <tt>#includes</tt></li>
|
<li>System <tt>#includes</tt></li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<p>... and each category should be sorted by name.</p>
|
<p>... and each catagory should be sorted by name.</p>
|
||||||
|
|
||||||
<p><a name="mmheader">The "Main Module Header"</a> file applies to .cpp file
|
<p><a name="mmheader">The "Main Module Header"</a> file applies to .cpp file
|
||||||
which implement an interface defined by a .h file. This <tt>#include</tt>
|
which implement an interface defined by a .h file. This <tt>#include</tt>
|
||||||
@@ -262,18 +264,6 @@ implements are defined.</p>
|
|||||||
like to print out code and look at your code in an xterm without resizing
|
like to print out code and look at your code in an xterm without resizing
|
||||||
it.</p>
|
it.</p>
|
||||||
|
|
||||||
<p>The longer answer is that there must be some limit to the width of the code
|
|
||||||
in order to reasonably allow developers to have multiple files side-by-side in
|
|
||||||
windows on a modest display. If you are going to pick a width limit, it is
|
|
||||||
somewhat arbitrary but you might as well pick something standard. Going with
|
|
||||||
90 columns (for example) instead of 80 columns wouldn't add any significant
|
|
||||||
value and would be detrimental to printing out code. Also many other projects
|
|
||||||
have standardized on 80 columns, so some people have already configured their
|
|
||||||
editors for it (vs something else, like 90 columns).</p>
|
|
||||||
|
|
||||||
<p>This is one of many contentious issues in coding standards, but is not up
|
|
||||||
for debate.</p>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- _______________________________________________________________________ -->
|
<!-- _______________________________________________________________________ -->
|
||||||
@@ -515,18 +505,14 @@ library. There are two problems with this:</p>
|
|||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>The time to run the static c'tors impacts startup time of
|
<li>The time to run the static c'tors impacts startup time of
|
||||||
applications—a critical time for GUI apps.</li>
|
applications—a critical time for gui apps.</li>
|
||||||
<li>The static c'tors cause the app to pull many extra pages of memory off the
|
<li>The static c'tors cause the app to pull many extra pages of memory off the
|
||||||
disk: both the code for the static c'tors in each <tt>.o</tt> file and the
|
disk: both the code for the static c'tors in each .o file and the small
|
||||||
small amount of data that gets touched. In addition, touched/dirty pages
|
amount of data that gets touched. In addition, touched/dirty pages put
|
||||||
put more pressure on the VM system on low-memory machines.</li>
|
more pressure on the VM system on low-memory machines.</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<p>Note that using the other stream headers (<tt><sstream></tt> for
|
<table align="center">
|
||||||
example) is allowed normally, it is just <tt><iostream></tt> that is
|
|
||||||
causing problems.</p>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Old Way</th>
|
<th>Old Way</th>
|
||||||
@@ -540,7 +526,7 @@ causing problems.</p>
|
|||||||
<td align="left"><pre>DEBUG(std::cerr << ...);
|
<td align="left"><pre>DEBUG(std::cerr << ...);
|
||||||
DEBUG(dump(std::cerr));</pre></td>
|
DEBUG(dump(std::cerr));</pre></td>
|
||||||
<td align="left"><pre>DOUT << ...;
|
<td align="left"><pre>DOUT << ...;
|
||||||
DEBUG(dump(DOUT));</pre></td>
|
dump(DOUT);</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left"><pre>std::cerr << "Hello world\n";</pre></td>
|
<td align="left"><pre>std::cerr << "Hello world\n";</pre></td>
|
||||||
@@ -567,27 +553,20 @@ DEBUG(dump(DOUT));</pre></td>
|
|||||||
<td align="left"><pre>llvm::StringStream</pre></td>
|
<td align="left"><pre>llvm::StringStream</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left"><pre>void print(std::ostream &Out);
|
<td align="left"><pre>void print(std::ostream &Out);
|
||||||
// ...
|
// ...
|
||||||
print(std::cerr);</pre></td>
|
print(std::cerr);</pre></td>
|
||||||
<td align="left"><tt>void print(llvm::OStream Out);<sup><a href="#sn_1">1</a></sup><br>
|
<td align="left"><pre>void print(std::ostream &Out);
|
||||||
// ...<br>
|
void print(std::ostream *Out) { if (Out) print(*Out) }
|
||||||
print(llvm::cerr);</tt>
|
// ...
|
||||||
</td>
|
print(llvm::cerr);</pre>
|
||||||
</tr>
|
|
||||||
|
<ul><i>N.B.</i> The second <tt>print</tt> method is called by the <tt>print</tt>
|
||||||
|
expression. It prevents the execution of the first <tt>print</tt> method if the
|
||||||
|
stream is <tt>cnull</tt>.</ul></td>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p><b>Notes:</b></p>
|
|
||||||
|
|
||||||
<div class="doc_notes">
|
|
||||||
<ol>
|
|
||||||
<li><a name="sn_1"><tt>llvm::OStream</tt></a> is a light-weight class so it
|
|
||||||
should never be passed by reference. This is important because in some
|
|
||||||
configurations, <tt>DOUT</tt> is an rvalue.</li>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -643,29 +622,6 @@ assert(isa<PHINode>(Succ->front()) && "Only works on PHId BBs!"
|
|||||||
|
|
||||||
<p>You get the idea...</p>
|
<p>You get the idea...</p>
|
||||||
|
|
||||||
<p>Please be aware when adding assert statements that not all compilers are aware of
|
|
||||||
the semantics of the assert. In some places, asserts are used to indicate a piece of
|
|
||||||
code that should not be reached. These are typically of the form:</p>
|
|
||||||
|
|
||||||
<div class="doc_code">
|
|
||||||
<pre>
|
|
||||||
assert(0 && "Some helpful error message");
|
|
||||||
</pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>When used in a function that returns a value, they should be followed with a return
|
|
||||||
statement and a comment indicating that this line is never reached. This will prevent
|
|
||||||
a compiler which is unable to deduce that the assert statement never returns from
|
|
||||||
generating a warning.</p>
|
|
||||||
|
|
||||||
<div class="doc_code">
|
|
||||||
<pre>
|
|
||||||
assert(0 && "Some helpful error message");
|
|
||||||
// Not reached
|
|
||||||
return 0;
|
|
||||||
</pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- _______________________________________________________________________ -->
|
<!-- _______________________________________________________________________ -->
|
||||||
@@ -679,8 +635,8 @@ namespace with an "<tt>std::</tt>" prefix, rather than rely on
|
|||||||
"<tt>using namespace std;</tt>".</p>
|
"<tt>using namespace std;</tt>".</p>
|
||||||
|
|
||||||
<p> In header files, adding a '<tt>using namespace XXX</tt>' directive pollutes
|
<p> In header files, adding a '<tt>using namespace XXX</tt>' directive pollutes
|
||||||
the namespace of any source file that <tt>#include</tt>s the header. This is
|
the namespace of any source file that includes the header. This is clearly a
|
||||||
clearly a bad thing.</p>
|
bad thing.</p>
|
||||||
|
|
||||||
<p>In implementation files (e.g. .cpp files), the rule is more of a stylistic
|
<p>In implementation files (e.g. .cpp files), the rule is more of a stylistic
|
||||||
rule, but is still important. Basically, using explicit namespace prefixes
|
rule, but is still important. Basically, using explicit namespace prefixes
|
||||||
@@ -714,9 +670,9 @@ others.</p>
|
|||||||
<p>If a class is defined in a header file and has a v-table (either it has
|
<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
|
virtual methods or it derives from classes with virtual methods), it must
|
||||||
always have at least one out-of-line virtual method in the class. Without
|
always have at least one out-of-line virtual method in the class. Without
|
||||||
this, the compiler will copy the vtable and RTTI into every <tt>.o</tt> file
|
this, the compiler will copy the vtable and RTTI into every .o file that
|
||||||
that <tt>#include</tt>s the header, bloating <tt>.o</tt> file sizes and
|
#includes the header, bloating .o file sizes and increasing link times.
|
||||||
increasing link times.</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -778,12 +734,15 @@ sources. Two particularly important books for our work are:</p>
|
|||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<li><a href="http://www.amazon.com/Effective-Specific-Addison-Wesley-Professional-Computing/dp/0321334876">Effective
|
<li><a href="http://www.aw-bc.com/catalog/academic/product/0,1144,0201310155,00.html">Effective
|
||||||
C++</a> by Scott Meyers. Also
|
C++</a> by Scott Meyers. There is an online version of the book (only some
|
||||||
|
chapters though) <a
|
||||||
|
href="http://www.awlonline.com/cseng/meyerscddemo/">available as well</a>. Also
|
||||||
interesting and useful are "More Effective C++" and "Effective STL" by the same
|
interesting and useful are "More Effective C++" and "Effective STL" by the same
|
||||||
author.</li>
|
author.</li>
|
||||||
|
|
||||||
<li>Large-Scale C++ Software Design by John Lakos</li>
|
<li><a href="http://cseng.aw.com/book/0,3828,0201633620,00.html">Large-Scale C++
|
||||||
|
Software Design</a> by John Lakos</li>
|
||||||
|
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
@@ -797,9 +756,9 @@ something.</p>
|
|||||||
<hr>
|
<hr>
|
||||||
<address>
|
<address>
|
||||||
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
<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" alt="Valid CSS!"></a>
|
||||||
<a href="http://validator.w3.org/check/referer"><img
|
<a href="http://validator.w3.org/check/referer"><img
|
||||||
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
|
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="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||||
|
|||||||
4
llvm/docs/CommandGuide/.cvsignore
Normal file
4
llvm/docs/CommandGuide/.cvsignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
pod2htm?.tmp
|
||||||
|
*.html
|
||||||
|
*.1
|
||||||
|
*.ps
|
||||||
@@ -2,72 +2,74 @@
|
|||||||
#
|
#
|
||||||
# The LLVM Compiler Infrastructure
|
# The LLVM Compiler Infrastructure
|
||||||
#
|
#
|
||||||
# This file is distributed under the University of Illinois Open Source
|
# This file was developed by the LLVM research group and is distributed under
|
||||||
# License. See LICENSE.TXT for details.
|
# the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||||
#
|
#
|
||||||
##===----------------------------------------------------------------------===##
|
##===----------------------------------------------------------------------===##
|
||||||
|
|
||||||
ifdef BUILD_FOR_WEBSITE
|
ifdef BUILD_FOR_WEBSITE
|
||||||
|
|
||||||
# This special case is for keeping the CommandGuide on the LLVM web site
|
# This special case is for keeping the CommandGuide on the LLVM web site
|
||||||
# up to date automatically as the documents are checked in. It must build
|
# up to date automatically as the documents are checked in. It must build
|
||||||
# the POD files to HTML only and keep them in the src directories. It must also
|
# the POD files to HTML only and keep them in the src directories. It must also
|
||||||
# build in an unconfigured tree, hence the ifdef. To use this, run
|
# build in an unconfigured tree, hence the ifdef. To use this, run
|
||||||
# make -s BUILD_FOR_WEBSITE=1 inside the cvs commit script.
|
# make -s BUILD_FOR_WEBSITE=1 inside the cvs commit script.
|
||||||
SRC_DOC_DIR=
|
|
||||||
DST_HTML_DIR=html/
|
|
||||||
DST_MAN_DIR=man/man1/
|
|
||||||
DST_PS_DIR=ps/
|
|
||||||
|
|
||||||
# If we are in BUILD_FOR_WEBSITE mode, default to the all target.
|
POD := $(wildcard *.pod)
|
||||||
all:: html man ps
|
HTML := $(patsubst %.pod, html/%.html, $(POD))
|
||||||
|
MAN := $(patsubst %.pod, man/man1/%.1, $(POD))
|
||||||
|
PS := $(patsubst %.pod, ps/%.ps, $(POD))
|
||||||
|
|
||||||
clean:
|
all: $(HTML) $(MAN) $(PS)
|
||||||
rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
|
|
||||||
|
|
||||||
# To create other directories, as needed, and timestamp their creation
|
|
||||||
%/.dir:
|
|
||||||
-mkdir $* > /dev/null
|
|
||||||
date > $@
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
# Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.
|
|
||||||
LEVEL := ../..
|
|
||||||
include $(LEVEL)/Makefile.common
|
|
||||||
|
|
||||||
SRC_DOC_DIR=$(PROJ_SRC_DIR)/
|
|
||||||
DST_HTML_DIR=$(PROJ_OBJ_DIR)/
|
|
||||||
DST_MAN_DIR=$(PROJ_OBJ_DIR)/
|
|
||||||
DST_PS_DIR=$(PROJ_OBJ_DIR)/
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
POD := $(wildcard $(SRC_DOC_DIR)*.pod)
|
|
||||||
HTML := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_HTML_DIR)%.html, $(POD))
|
|
||||||
MAN := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_MAN_DIR)%.1, $(POD))
|
|
||||||
PS := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_PS_DIR)%.ps, $(POD))
|
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .html .pod .1 .ps
|
.SUFFIXES: .html .pod .1 .ps
|
||||||
|
|
||||||
$(DST_HTML_DIR)%.html: %.pod $(DST_HTML_DIR)/.dir
|
html/%.html: %.pod
|
||||||
pod2html --css=manpage.css --htmlroot=. \
|
pod2html --css=manpage.css --htmlroot=. \
|
||||||
--podpath=. --noindex --infile=$< --outfile=$@ --title=$*
|
--podpath=. --noindex --infile=$< --outfile=$@ --title=$*
|
||||||
|
|
||||||
$(DST_MAN_DIR)%.1: %.pod $(DST_MAN_DIR)/.dir
|
man/man1/%.1: %.pod
|
||||||
pod2man --release=CVS --center="LLVM Command Guide" $< $@
|
pod2man --release=CVS --center="LLVM Command Guide" $< $@
|
||||||
|
|
||||||
$(DST_PS_DIR)%.ps: $(DST_MAN_DIR)%.1 $(DST_PS_DIR)/.dir
|
ps/%.ps: man/man1/%.1
|
||||||
groff -Tps -man $< > $@
|
groff -Tps -man $< > $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
|
||||||
|
|
||||||
html: $(HTML)
|
else
|
||||||
man: $(MAN)
|
|
||||||
ps: $(PS)
|
LEVEL := ../..
|
||||||
|
|
||||||
|
include $(LEVEL)/Makefile.common
|
||||||
|
|
||||||
|
POD := $(wildcard $(PROJ_SRC_DIR)/*.pod)
|
||||||
|
|
||||||
EXTRA_DIST := $(POD) index.html
|
EXTRA_DIST := $(POD) index.html
|
||||||
|
|
||||||
|
HTML = $(patsubst $(PROJ_SRC_DIR)/%.pod, $(PROJ_OBJ_DIR)/%.html, $(POD))
|
||||||
|
MAN = $(patsubst $(PROJ_SRC_DIR)/%.pod, $(PROJ_OBJ_DIR)/%.1, $(POD))
|
||||||
|
PS = $(patsubst $(PROJ_SRC_DIR)/%.pod, $(PROJ_OBJ_DIR)/%.ps, $(POD))
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .html .pod .1 .ps
|
||||||
|
|
||||||
|
$(HTML) : html/.dir man/.dir man/man1/.dir ps/.dir
|
||||||
|
|
||||||
|
html: $(HTML)
|
||||||
|
|
||||||
|
$(PROJ_OBJ_DIR)/%.html: %.pod
|
||||||
|
$(POD2HTML) --css=manpage.css --htmlroot=. --podpath=. \
|
||||||
|
--noindex --infile=$< --outfile=$@ --title=$*
|
||||||
|
|
||||||
|
$(PROJ_OBJ_DIR)/%.1: %.pod
|
||||||
|
$(POD2MAN) --release=$(LLVMVersion) \
|
||||||
|
--center="LLVM Command Guide" $< $@
|
||||||
|
|
||||||
|
$(PROJ_OBJ_DIR)/%.ps: $(PROJ_OBJ_DIR)/%.1
|
||||||
|
$(GROFF) -Tps -man $< > $@
|
||||||
|
|
||||||
clean-local::
|
clean-local::
|
||||||
$(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
|
$(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
|
||||||
|
|
||||||
@@ -89,9 +91,11 @@ install-local:: $(HTML) $(MAN) $(PS)
|
|||||||
$(Verb) $(DataInstall) $(PS) $(PS_DIR)
|
$(Verb) $(DataInstall) $(PS) $(PS_DIR)
|
||||||
|
|
||||||
uninstall-local::
|
uninstall-local::
|
||||||
$(Echo) Uninstalling CommandGuide Documentation
|
$(Echo) Uninstalling Documentation
|
||||||
$(Verb) $(RM) -rf $(HTML_DIR) $(MAN_DIR) $(PS_DIR)
|
$(Verb) $(RM) -rf $(LLVM_DOCSDIR)
|
||||||
|
|
||||||
printvars::
|
printvars::
|
||||||
$(Echo) "POD : " '$(POD)'
|
$(Echo) "POD : " '$(POD)'
|
||||||
$(Echo) "HTML : " '$(HTML)'
|
$(Echo) "HTML : " '$(HTML)'
|
||||||
|
|
||||||
|
endif
|
||||||
|
|||||||
@@ -29,11 +29,6 @@ Load the dynamic shared object F<library> into the test program whenever it is
|
|||||||
run. This is useful if you are debugging programs which depend on non-LLVM
|
run. This is useful if you are debugging programs which depend on non-LLVM
|
||||||
libraries (such as the X or curses libraries) to run.
|
libraries (such as the X or curses libraries) to run.
|
||||||
|
|
||||||
=item B<--append-exit-code>=I<{true,false}>
|
|
||||||
|
|
||||||
Append the test programs exit code to the output file so that a change in exit
|
|
||||||
code is considered a test failure. Defaults to false.
|
|
||||||
|
|
||||||
=item B<--args> I<program args>
|
=item B<--args> I<program args>
|
||||||
|
|
||||||
Pass all arguments specified after -args to the test program whenever it runs.
|
Pass all arguments specified after -args to the test program whenever it runs.
|
||||||
@@ -57,10 +52,10 @@ The "--" right after the B<--tool-args> option tells B<bugpoint> to consider any
|
|||||||
options starting with C<-> to be part of the B<--tool-args> option, not as
|
options starting with C<-> to be part of the B<--tool-args> option, not as
|
||||||
options to B<bugpoint> itself. (See B<--args>, above.)
|
options to B<bugpoint> itself. (See B<--args>, above.)
|
||||||
|
|
||||||
=item B<--safe-tool-args> I<tool args>
|
=item B<--check-exit-code>=I<{true,false}>
|
||||||
|
|
||||||
Pass all arguments specified after --safe-tool-args to the "safe" execution
|
Assume a non-zero exit code or core dump from the test program is a failure.
|
||||||
tool.
|
Defaults to true.
|
||||||
|
|
||||||
=item B<--disable-{dce,simplifycfg}>
|
=item B<--disable-{dce,simplifycfg}>
|
||||||
|
|
||||||
@@ -69,12 +64,6 @@ program. By default, B<bugpoint> uses these passes internally when attempting to
|
|||||||
reduce test programs. If you're trying to find a bug in one of these passes,
|
reduce test programs. If you're trying to find a bug in one of these passes,
|
||||||
B<bugpoint> may crash.
|
B<bugpoint> may crash.
|
||||||
|
|
||||||
=item B<--enable-valgrind>
|
|
||||||
|
|
||||||
Use valgrind to find faults in the optimization phase. This will allow
|
|
||||||
bugpoint to find otherwise asymptomatic problems caused by memory
|
|
||||||
mis-management.
|
|
||||||
|
|
||||||
=item B<-find-bugs>
|
=item B<-find-bugs>
|
||||||
|
|
||||||
Continually randomize the specified passes and run them on the test program
|
Continually randomize the specified passes and run them on the test program
|
||||||
@@ -98,51 +87,29 @@ optimizations, use the B<--help> and B<--load> options together; for example:
|
|||||||
|
|
||||||
bugpoint --load myNewPass.so --help
|
bugpoint --load myNewPass.so --help
|
||||||
|
|
||||||
=item B<--mlimit> F<megabytes>
|
|
||||||
|
|
||||||
Specifies an upper limit on memory usage of the optimization and codegen. Set
|
|
||||||
to zero to disable the limit.
|
|
||||||
|
|
||||||
=item B<--output> F<filename>
|
=item B<--output> F<filename>
|
||||||
|
|
||||||
Whenever the test program produces output on its standard output stream, it
|
Whenever the test program produces output on its standard output stream, it
|
||||||
should match the contents of F<filename> (the "reference output"). If you
|
should match the contents of F<filename> (the "reference output"). If you
|
||||||
do not use this option, B<bugpoint> will attempt to generate a reference output
|
do not use this option, B<bugpoint> will attempt to generate a reference output
|
||||||
by compiling the program with the "safe" backend and running it.
|
by compiling the program with the C backend and running it.
|
||||||
|
|
||||||
=item B<--profile-info-file> F<filename>
|
=item B<--profile-info-file> F<filename>
|
||||||
|
|
||||||
Profile file loaded by B<--profile-loader>.
|
Profile file loaded by B<--profile-loader>.
|
||||||
|
|
||||||
=item B<--run-{int,jit,llc,cbe,custom}>
|
=item B<--run-{int,jit,llc,cbe}>
|
||||||
|
|
||||||
Whenever the test program is compiled, B<bugpoint> should generate code for it
|
Whenever the test program is compiled, B<bugpoint> should generate code for it
|
||||||
using the specified code generator. These options allow you to choose the
|
using the specified code generator. These options allow you to choose the
|
||||||
interpreter, the JIT compiler, the static native code compiler, the C
|
interpreter, the JIT compiler, the static native code compiler, or the C
|
||||||
backend, or a custom command (see B<--exec-command>) respectively.
|
backend, respectively.
|
||||||
|
|
||||||
=item B<--safe-{llc,cbe,custom}>
|
=item B<--enable-valgrind>
|
||||||
|
|
||||||
When debugging a code generator, B<bugpoint> should use the specified code
|
Use valgrind to find faults in the optimization phase. This will allow
|
||||||
generator as the "safe" code generator. This is a known-good code generator
|
bugpoint to find otherwise asymptomatic problems caused by memory
|
||||||
used to generate the "reference output" if it has not been provided, and to
|
mis-management.
|
||||||
compile portions of the program that as they are excluded from the testcase.
|
|
||||||
These options allow you to choose the
|
|
||||||
static native code compiler, the C backend, or a custom command,
|
|
||||||
(see B<--exec-command>) respectively. The interpreter and the JIT backends
|
|
||||||
cannot currently be used as the "safe" backends.
|
|
||||||
|
|
||||||
=item B<--exec-command> I<command>
|
|
||||||
|
|
||||||
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<--safe-path> I<path>
|
|
||||||
|
|
||||||
This option defines the path to the command to execute with the
|
|
||||||
B<--safe-{int,jit,llc,cbe,custom}>
|
|
||||||
option.
|
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
|||||||
2
llvm/docs/CommandGuide/html/.cvsignore
Normal file
2
llvm/docs/CommandGuide/html/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*html
|
||||||
|
.dir
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>LLVM Command Guide</title>
|
<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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -32,65 +32,74 @@ options) arguments to the tool you are interested in.</p>
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li><a href="/cmds/llvm-as.html"><b>llvm-as</b></a> -
|
<li><a href="html/llvm-as.html"><b>llvm-as</b></a> -
|
||||||
assemble a human-readable .ll file into bytecode</li>
|
assemble a human-readable .ll file into bytecode</li>
|
||||||
|
|
||||||
<li><a href="/cmds/llvm-dis.html"><b>llvm-dis</b></a> -
|
<li><a href="html/llvm-dis.html"><b>llvm-dis</b></a> -
|
||||||
disassemble a bytecode file into a human-readable .ll file</li>
|
disassemble a bytecode file into a human-readable .ll file</li>
|
||||||
|
|
||||||
<li><a href="/cmds/opt.html"><b>opt</b></a> -
|
<li><a href="html/llvm-upgrade.html"><b>llvm-upgrade</b></a> -
|
||||||
|
upgrade LLVM assembly from previous version</li>
|
||||||
|
|
||||||
|
<li><a href="html/opt.html"><b>opt</b></a> -
|
||||||
run a series of LLVM-to-LLVM optimizations on a bytecode file</li>
|
run a series of LLVM-to-LLVM optimizations on a bytecode file</li>
|
||||||
|
|
||||||
<li><a href="/cmds/llc.html"><b>llc</b></a> -
|
<li><a href="html/llc.html"><b>llc</b></a> -
|
||||||
generate native machine code for a bytecode file</li>
|
generate native machine code for a bytecode file</li>
|
||||||
|
|
||||||
<li><a href="/cmds/lli.html"><b>lli</b></a> -
|
<li><a href="html/lli.html"><b>lli</b></a> -
|
||||||
directly run a program compiled to bytecode using a JIT compiler or
|
directly run a program compiled to bytecode using a JIT compiler or
|
||||||
interpreter</li>
|
interpreter</li>
|
||||||
|
|
||||||
<li><a href="/cmds/llvm-link.html"><b>llvm-link</b></a> -
|
<li><a href="html/llvm-link.html"><b>llvm-link</b></a> -
|
||||||
link several bytecode files into one</li>
|
link several bytecode files into one</li>
|
||||||
|
|
||||||
<li><a href="/cmds/llvm-ar.html"><b>llvm-ar</b></a> -
|
<li><a href="html/llvm-ar.html"><b>llvm-ar</b></a> -
|
||||||
archive bytecode files</li>
|
archive bytecode files</li>
|
||||||
|
|
||||||
<li><a href="/cmds/llvm-ranlib.html"><b>llvm-ranlib</b></a> -
|
<li><a href="html/llvm-ranlib.html"><b>llvm-ranlib</b></a> -
|
||||||
create an index for archives made with llvm-ar</li>
|
create an index for archives made with llvm-ar</li>
|
||||||
|
|
||||||
<li><a href="/cmds/llvm-nm.html"><b>llvm-nm</b></a> -
|
<li><a href="html/llvm-nm.html"><b>llvm-nm</b></a> -
|
||||||
print out the names and types of symbols in a bytecode file</li>
|
print out the names and types of symbols in a bytecode file</li>
|
||||||
|
|
||||||
<li><a href="/cmds/llvm-prof.html"><b>llvm-prof</b></a> -
|
<li><a href="html/llvm-prof.html"><b>llvm-prof</b></a> -
|
||||||
format raw `<tt>llvmprof.out</tt>' data into a human-readable report</li>
|
format raw `<tt>llvmprof.out</tt>' data into a human-readable report</li>
|
||||||
|
|
||||||
<li><a href="/cmds/llvm-ld.html"><b>llvm-ld</b></a> -
|
<li><a href="html/llvmc.html"><b>llvmc</b></a> -
|
||||||
|
generic and configurable compiler driver</li>
|
||||||
|
|
||||||
|
<li><a href="html/llvm-ld.html"><b>llvm-ld</b></a> -
|
||||||
general purpose linker with loadable runtime optimization support</li>
|
general purpose linker with loadable runtime optimization support</li>
|
||||||
|
|
||||||
<li><a href="/cmds/llvm-config.html"><b>llvm-config</b></a> -
|
<li><a href="html/llvm-config.html"><b>llvm-config</b></a> -
|
||||||
print out LLVM compilation options, libraries, etc. as configured</li>
|
print out LLVM compilation options, libraries, etc. as configured.</li>
|
||||||
|
|
||||||
<li><a href="/cmds/llvmc.html"><b>llvmc</b></a> -
|
|
||||||
a generic customizable compiler driver</li>
|
|
||||||
|
|
||||||
|
<li><a href="html/llvm2cpp.html"><b>llvm2cpp</b></a> - convert LLVM assembly
|
||||||
|
into the corresponding LLVM C++ API calls to produce it</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- *********************************************************************** -->
|
<!-- *********************************************************************** -->
|
||||||
<div class="doc_section">
|
<div class="doc_section">
|
||||||
<a name="frontend">C and C++ Front-end Commands</a>
|
<a name="frontend">C, C++, and Stacker Front-end Commands</a>
|
||||||
</div>
|
</div>
|
||||||
<!-- *********************************************************************** -->
|
<!-- *********************************************************************** -->
|
||||||
|
|
||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li><a href="/cmds/llvmgcc.html"><b>llvm-gcc</b></a> -
|
<li><a href="html/llvmgcc.html"><b>llvmgcc</b></a> -
|
||||||
GCC-based C front-end for LLVM
|
GCC-based C front-end for LLVM
|
||||||
|
|
||||||
<li><a href="/cmds/llvmgxx.html"><b>llvm-g++</b></a> -
|
<li><a href="html/llvmgxx.html"><b>llvmg++</b></a> -
|
||||||
GCC-based C++ front-end for LLVM</li>
|
GCC-based C++ front-end for LLVM</li>
|
||||||
|
|
||||||
|
<li><a href="html/stkrc.html"><b>stkrc</b></a> -
|
||||||
|
front-end compiler for the <a href="../Stacker.html">Stacker</a>
|
||||||
|
language</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -106,13 +115,13 @@ options) arguments to the tool you are interested in.</p>
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li><a href="/cmds/bugpoint.html"><b>bugpoint</b></a> -
|
<li><a href="html/bugpoint.html"><b>bugpoint</b></a> -
|
||||||
automatic test-case reducer</li>
|
automatic test-case reducer</li>
|
||||||
|
|
||||||
<li><a href="/cmds/llvm-extract.html"><b>llvm-extract</b></a> -
|
<li><a href="html/llvm-extract.html"><b>llvm-extract</b></a> -
|
||||||
extract a function from an LLVM bytecode file</li>
|
extract a function from an LLVM bytecode file</li>
|
||||||
|
|
||||||
<li><a href="/cmds/llvm-bcanalyzer.html"><b>llvm-bcanalyzer</b></a> -
|
<li><a href="html/llvm-bcanalyzer.html"><b>llvm-bcanalyzer</b></a> -
|
||||||
bytecode analyzer (analyzes the binary encoding itself, not the program it
|
bytecode analyzer (analyzes the binary encoding itself, not the program it
|
||||||
represents)</li>
|
represents)</li>
|
||||||
|
|
||||||
@@ -128,7 +137,7 @@ options) arguments to the tool you are interested in.</p>
|
|||||||
<div class="doc_text">
|
<div class="doc_text">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li><a href="/cmds/tblgen.html"><b>tblgen</b></a> -
|
<li><a href="html/tblgen.html"><b>tblgen</b></a> -
|
||||||
target description reader and generator</li>
|
target description reader and generator</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
@@ -139,9 +148,9 @@ options) arguments to the tool you are interested in.</p>
|
|||||||
<hr>
|
<hr>
|
||||||
<address>
|
<address>
|
||||||
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
<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" alt="Valid CSS!"></a>
|
||||||
<a href="http://validator.w3.org/check/referer"><img
|
<a href="http://validator.w3.org/check/referer"><img
|
||||||
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
|
src="http://www.w3.org/Icons/valid-html401" 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$
|
Last modified: $Date$
|
||||||
|
|||||||
@@ -10,18 +10,18 @@ B<llc> [I<options>] [I<filename>]
|
|||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
The B<llc> command compiles LLVM bitcode into assembly language for a
|
The B<llc> command compiles LLVM bytecode into assembly language for a
|
||||||
specified architecture. The assembly language output can then be passed through
|
specified architecture. The assembly language output can then be passed through
|
||||||
a native assembler and linker to generate a native executable.
|
a native assembler and linker to generate a native executable.
|
||||||
|
|
||||||
The choice of architecture for the output assembly code is automatically
|
The choice of architecture for the output assembly code is automatically
|
||||||
determined from the input bitcode file, unless the B<-march> option is used to
|
determined from the input bytecode file, unless the B<-march> option is used to
|
||||||
override the default.
|
override the default.
|
||||||
|
|
||||||
=head1 OPTIONS
|
=head1 OPTIONS
|
||||||
|
|
||||||
If I<filename> is - or omitted, B<llc> reads LLVM bitcode from standard input.
|
If I<filename> is - or omitted, B<llc> reads LLVM bytecode from standard input.
|
||||||
Otherwise, it will read LLVM bitcode from I<filename>.
|
Otherwise, it will read LLVM bytecode from I<filename>.
|
||||||
|
|
||||||
If the B<-o> option is omitted, then B<llc> will send its output to standard
|
If the B<-o> option is omitted, then B<llc> will send its output to standard
|
||||||
output if the input is from standard input. If the B<-o> option specifies -,
|
output if the input is from standard input. If the B<-o> option specifies -,
|
||||||
@@ -48,13 +48,13 @@ an output file which already exists.
|
|||||||
|
|
||||||
=item B<-mtriple>=I<target triple>
|
=item B<-mtriple>=I<target triple>
|
||||||
|
|
||||||
Override the target triple specified in the input bitcode file with the
|
Override the target triple specified in the input bytecode file with the
|
||||||
specified string.
|
specified string.
|
||||||
|
|
||||||
=item B<-march>=I<arch>
|
=item B<-march>=I<arch>
|
||||||
|
|
||||||
Specify the architecture for which to generate assembly, overriding the target
|
Specify the architecture for which to generate assembly, overriding the target
|
||||||
encoded in the bitcode file. See the output of B<llc --help> for a list of
|
encoded in the bytecode file. See the output of B<llc --help> for a list of
|
||||||
valid architectures. By default this is inferred from the target triple or
|
valid architectures. By default this is inferred from the target triple or
|
||||||
autodetected to the current architecture.
|
autodetected to the current architecture.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
lli - directly execute programs from LLVM bitcode
|
lli - directly execute programs from LLVM bytecode
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
@@ -10,40 +10,26 @@ B<lli> [I<options>] [I<filename>] [I<program args>]
|
|||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
B<lli> directly executes programs in LLVM bitcode format. It takes a program
|
B<lli> directly executes programs in LLVM bytecode format. It takes a program
|
||||||
in LLVM bitcode format and executes it using a just-in-time compiler, if one is
|
in LLVM bytecode format and executes it using a just-in-time compiler, if one is
|
||||||
available for the current architecture, or an interpreter. B<lli> takes all of
|
available for the current architecture, or an interpreter. B<lli> takes all of
|
||||||
the same code generator options as L<llc|llc>, but they are only effective when
|
the same code generator options as L<llc|llc>, but they are only effective when
|
||||||
B<lli> is using the just-in-time compiler.
|
B<lli> is using the just-in-time compiler.
|
||||||
|
|
||||||
If I<filename> is not specified, then B<lli> reads the LLVM bitcode for the
|
If I<filename> is not specified, then B<lli> reads the LLVM bytecode for the
|
||||||
program from standard input.
|
program from standard input.
|
||||||
|
|
||||||
The optional I<args> specified on the command line are passed to the program as
|
The optional I<args> specified on the command line are passed to the program as
|
||||||
arguments.
|
arguments.
|
||||||
|
|
||||||
=head1 GENERAL OPTIONS
|
=head1 OPTIONS
|
||||||
|
|
||||||
=over
|
=over
|
||||||
|
|
||||||
=item B<-fake-argv0>=I<executable>
|
|
||||||
|
|
||||||
Override the C<argv[0]> value passed into the executing program.
|
|
||||||
|
|
||||||
=item B<-force-interpreter>=I<{false,true}>
|
|
||||||
|
|
||||||
If set to true, use the interpreter even if a just-in-time compiler is available
|
|
||||||
for this architecture. Defaults to false.
|
|
||||||
|
|
||||||
=item B<-help>
|
=item B<-help>
|
||||||
|
|
||||||
Print a summary of command line options.
|
Print a summary of command line options.
|
||||||
|
|
||||||
=item B<-load>=I<puginfilename>
|
|
||||||
|
|
||||||
Causes B<lli> to load the plugin (shared object) named I<pluginfilename> and use
|
|
||||||
it for optimization.
|
|
||||||
|
|
||||||
=item B<-stats>
|
=item B<-stats>
|
||||||
|
|
||||||
Print statistics from the code-generation passes. This is only meaningful for
|
Print statistics from the code-generation passes. This is only meaningful for
|
||||||
@@ -54,26 +40,16 @@ the just-in-time compiler, at present.
|
|||||||
Record the amount of time needed for each code-generation pass and print it to
|
Record the amount of time needed for each code-generation pass and print it to
|
||||||
standard error.
|
standard error.
|
||||||
|
|
||||||
=item B<-version>
|
|
||||||
|
|
||||||
Print out the version of B<lli> and exit without doing anything else.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head1 TARGET OPTIONS
|
|
||||||
|
|
||||||
=over
|
|
||||||
|
|
||||||
=item B<-mtriple>=I<target triple>
|
=item B<-mtriple>=I<target triple>
|
||||||
|
|
||||||
Override the target triple specified in the input bitcode file with the
|
Override the target triple specified in the input bytecode file with the
|
||||||
specified string. This may result in a crash if you pick an
|
specified string. This may result in a crash if you pick an
|
||||||
architecture which is not compatible with the current system.
|
architecture which is not compatible with the current system.
|
||||||
|
|
||||||
=item B<-march>=I<arch>
|
=item B<-march>=I<arch>
|
||||||
|
|
||||||
Specify the architecture for which to generate assembly, overriding the target
|
Specify the architecture for which to generate assembly, overriding the target
|
||||||
encoded in the bitcode file. See the output of B<llc --help> for a list of
|
encoded in the bytecode file. See the output of B<llc --help> for a list of
|
||||||
valid architectures. By default this is inferred from the target triple or
|
valid architectures. By default this is inferred from the target triple or
|
||||||
autodetected to the current architecture.
|
autodetected to the current architecture.
|
||||||
|
|
||||||
@@ -91,112 +67,17 @@ operations are enabled or not. The default set of attributes is set by the
|
|||||||
current CPU. For a list of available attributes, use:
|
current CPU. For a list of available attributes, use:
|
||||||
B<llvm-as E<lt> /dev/null | llc -march=xyz -mattr=help>
|
B<llvm-as E<lt> /dev/null | llc -march=xyz -mattr=help>
|
||||||
|
|
||||||
=back
|
=item B<-force-interpreter>=I<{false,true}>
|
||||||
|
|
||||||
|
If set to true, use the interpreter even if a just-in-time compiler is available
|
||||||
|
for this architecture. Defaults to false.
|
||||||
|
|
||||||
=head1 FLOATING POINT OPTIONS
|
=item B<-f>=I<name>
|
||||||
|
|
||||||
=over
|
Call the function named I<name> to start the program. Note: The
|
||||||
|
function is assumed to have the C signature C<int> I<name> C<(int,
|
||||||
=item B<-disable-excess-fp-precision>
|
char **, char **)>. If you try to use this option to call a function of
|
||||||
|
incompatible type, undefined behavior may result. Defaults to C<main>.
|
||||||
Disable optimizations that may increase floating point precision.
|
|
||||||
|
|
||||||
=item B<-enable-finite-only-fp-math>
|
|
||||||
|
|
||||||
Enable optimizations that assumes only finite floating point math. That is,
|
|
||||||
there is no NAN or Inf values.
|
|
||||||
|
|
||||||
=item B<-enable-unsafe-fp-math>
|
|
||||||
|
|
||||||
Causes B<lli> to enable optimizations that may decrease floating point
|
|
||||||
precision.
|
|
||||||
|
|
||||||
=item B<-soft-float>
|
|
||||||
|
|
||||||
Causes B<lli> to generate software floating point library calls instead of
|
|
||||||
equivalent hardware instructions.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head1 CODE GENERATION OPTIONS
|
|
||||||
|
|
||||||
=over
|
|
||||||
|
|
||||||
=item B<-code-model>=I<model>
|
|
||||||
|
|
||||||
Choose the code model from:
|
|
||||||
|
|
||||||
default: Target default code model
|
|
||||||
small: Small code model
|
|
||||||
kernel: Kernel code model
|
|
||||||
medium: Medium code model
|
|
||||||
large: Large code model
|
|
||||||
|
|
||||||
=item B<-disable-post-RA-scheduler>
|
|
||||||
|
|
||||||
Disable scheduling after register allocation.
|
|
||||||
|
|
||||||
=item B<-disable-spill-fusing>
|
|
||||||
|
|
||||||
Disable fusing of spill code into instructions.
|
|
||||||
|
|
||||||
=item B<-enable-correct-eh-support>
|
|
||||||
|
|
||||||
Make the -lowerinvoke pass insert expensive, but correct, EH code.
|
|
||||||
|
|
||||||
=item B<-enable-eh>
|
|
||||||
|
|
||||||
Exception handling should be emitted.
|
|
||||||
|
|
||||||
=item B<-join-liveintervals>
|
|
||||||
|
|
||||||
Coalesce copies (default=true).
|
|
||||||
|
|
||||||
=item B<-nozero-initialized-in-bss>
|
|
||||||
Don't place zero-initialized symbols into the BSS section.
|
|
||||||
|
|
||||||
=item B<-pre-RA-sched>=I<scheduler>
|
|
||||||
|
|
||||||
Instruction schedulers available (before register allocation):
|
|
||||||
|
|
||||||
=default: Best scheduler for the target
|
|
||||||
=none: No scheduling: breadth first sequencing
|
|
||||||
=simple: Simple two pass scheduling: minimize critical path and maximize processor utilization
|
|
||||||
=simple-noitin: Simple two pass scheduling: Same as simple except using generic latency
|
|
||||||
=list-burr: Bottom-up register reduction list scheduling
|
|
||||||
=list-tdrr: Top-down register reduction list scheduling
|
|
||||||
=list-td: Top-down list scheduler -print-machineinstrs - Print generated machine code
|
|
||||||
|
|
||||||
=item B<-regalloc>=I<allocator>
|
|
||||||
|
|
||||||
Register allocator to use: (default = linearscan)
|
|
||||||
|
|
||||||
=bigblock: Big-block register allocator
|
|
||||||
=linearscan: linear scan register allocator =local - local register allocator
|
|
||||||
=simple: simple register allocator
|
|
||||||
|
|
||||||
=item B<-relocation-model>=I<model>
|
|
||||||
|
|
||||||
Choose relocation model from:
|
|
||||||
|
|
||||||
=default: Target default relocation model
|
|
||||||
=static: Non-relocatable code =pic - Fully relocatable, position independent code
|
|
||||||
=dynamic-no-pic: Relocatable external references, non-relocatable code
|
|
||||||
|
|
||||||
=item B<-spiller>
|
|
||||||
|
|
||||||
Spiller to use: (default: local)
|
|
||||||
|
|
||||||
=simple: simple spiller
|
|
||||||
=local: local spiller
|
|
||||||
|
|
||||||
=item B<-x86-asm-syntax>=I<syntax>
|
|
||||||
|
|
||||||
Choose style of code to emit from X86 backend:
|
|
||||||
|
|
||||||
=att: Emit AT&T-style assembly
|
|
||||||
=intel: Emit Intel-style assembly
|
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ B<llvm-ar> [-]{dmpqrtx}[Rabfikouz] [relpos] [count] <archive> [files...]
|
|||||||
|
|
||||||
The B<llvm-ar> command is similar to the common Unix utility, C<ar>. It
|
The B<llvm-ar> command is similar to the common Unix utility, C<ar>. It
|
||||||
archives several files together into a single file. The intent for this is
|
archives several files together into a single file. The intent for this is
|
||||||
to produce archive libraries by LLVM bitcode that can be linked into an
|
to produce archive libraries by LLVM bytecode that can be linked into an
|
||||||
LLVM program. However, the archive can contain any kind of file. By default,
|
LLVM program. However, the archive can contain any kind of file. By default,
|
||||||
B<llvm-ar> generates a symbol table that makes linking faster because
|
B<llvm-ar> generates a symbol table that makes linking faster because
|
||||||
only the symbol table needs to be consulted, not each individual file member
|
only the symbol table needs to be consulted, not each individual file member
|
||||||
@@ -44,7 +44,7 @@ Here's where B<llvm-ar> departs from previous C<ar> implementations:
|
|||||||
|
|
||||||
=item I<Symbol Table>
|
=item I<Symbol Table>
|
||||||
|
|
||||||
Since B<llvm-ar> is intended to archive bitcode files, the symbol table
|
Since B<llvm-ar> is intended to archive bytecode files, the symbol table
|
||||||
won't make much sense to anything but LLVM. Consequently, the symbol table's
|
won't make much sense to anything but LLVM. Consequently, the symbol table's
|
||||||
format has been simplified. It consists simply of a sequence of pairs
|
format has been simplified. It consists simply of a sequence of pairs
|
||||||
of a file member index number as an LSB 4byte integer and a null-terminated
|
of a file member index number as an LSB 4byte integer and a null-terminated
|
||||||
@@ -78,7 +78,7 @@ add all the files under a directory, if requested.
|
|||||||
When B<llvm-ar> prints out the verbose table of contents (C<tv> option), it
|
When B<llvm-ar> prints out the verbose table of contents (C<tv> option), it
|
||||||
precedes the usual output with a character indicating the basic kind of
|
precedes the usual output with a character indicating the basic kind of
|
||||||
content in the file. A blank means the file is a regular file. A 'Z' means
|
content in the file. A blank means the file is a regular file. A 'Z' means
|
||||||
the file is compressed. A 'B' means the file is an LLVM bitcode file. An
|
the file is compressed. A 'B' means the file is an LLVM bytecode file. An
|
||||||
'S' means the file is the symbol table.
|
'S' means the file is the symbol table.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
@@ -123,7 +123,7 @@ archive is not modified.
|
|||||||
Print files to the standard output. The F<k> modifier applies to this
|
Print files to the standard output. The F<k> modifier applies to this
|
||||||
operation. This operation simply prints the F<files> indicated to the
|
operation. This operation simply prints the F<files> indicated to the
|
||||||
standard output. If no F<files> are specified, the entire archive is printed.
|
standard output. If no F<files> are specified, the entire archive is printed.
|
||||||
Printing bitcode files is ill-advised as they might confuse your terminal
|
Printing bytecode files is ill-advised as they might confuse your terminal
|
||||||
settings. The F<p> operation never modifies the archive.
|
settings. The F<p> operation never modifies the archive.
|
||||||
|
|
||||||
=item q[Rfz]
|
=item q[Rfz]
|
||||||
@@ -146,7 +146,7 @@ F<files> are specified, the archive is not modified.
|
|||||||
|
|
||||||
Print the table of contents. Without any modifiers, this operation just prints
|
Print the table of contents. Without any modifiers, this operation just prints
|
||||||
the names of the members to the standard output. With the F<v> modifier,
|
the names of the members to the standard output. With the F<v> modifier,
|
||||||
B<llvm-ar> also prints out the file type (B=bitcode, Z=compressed, S=symbol
|
B<llvm-ar> also prints out the file type (B=bytecode, Z=compressed, S=symbol
|
||||||
table, blank=regular file), the permission mode, the owner and group, the
|
table, blank=regular file), the permission mode, the owner and group, the
|
||||||
size, and the date. If any F<files> are specified, the listing is only for
|
size, and the date. If any F<files> are specified, the listing is only for
|
||||||
those files. If no F<files> are specified, the table of contents for the
|
those files. If no F<files> are specified, the table of contents for the
|
||||||
@@ -196,9 +196,9 @@ A synonym for the F<b> option.
|
|||||||
|
|
||||||
=item [k]
|
=item [k]
|
||||||
|
|
||||||
Normally, B<llvm-ar> will not print the contents of bitcode files when the
|
Normally, B<llvm-ar> will not print the contents of bytecode files when the
|
||||||
F<p> operation is used. This modifier defeats the default and allows the
|
F<p> operation is used. This modifier defeats the default and allows the
|
||||||
bitcode members to be printed.
|
bytecode members to be printed.
|
||||||
|
|
||||||
=item [N]
|
=item [N]
|
||||||
|
|
||||||
@@ -230,8 +230,8 @@ a time stamp than the time stamp of the member in the archive.
|
|||||||
|
|
||||||
When inserting or replacing any file in the archive, compress the file first.
|
When inserting or replacing any file in the archive, compress the file first.
|
||||||
This
|
This
|
||||||
modifier is safe to use when (previously) compressed bitcode files are added to
|
modifier is safe to use when (previously) compressed bytecode files are added to
|
||||||
the archive; the compressed bitcode files will not be doubly compressed.
|
the archive; the compressed bytecode files will not be doubly compressed.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ archive is being created. Using this modifier turns off that warning.
|
|||||||
This modifier requests that an archive index (or symbol table) be added to the
|
This modifier requests that an archive index (or symbol table) be added to the
|
||||||
archive. This is the default mode of operation. The symbol table will contain
|
archive. This is the default mode of operation. The symbol table will contain
|
||||||
all the externally visible functions and global variables defined by all the
|
all the externally visible functions and global variables defined by all the
|
||||||
bitcode files in the archive. Using this modifier is more efficient that using
|
bytecode files in the archive. Using this modifier is more efficient that using
|
||||||
L<llvm-ranlib|llvm-ranlib> which also creates the symbol table.
|
L<llvm-ranlib|llvm-ranlib> which also creates the symbol table.
|
||||||
|
|
||||||
=item [S]
|
=item [S]
|
||||||
@@ -363,7 +363,7 @@ the details on each of these items:
|
|||||||
|
|
||||||
=item offset - vbr encoded 32-bit integer
|
=item offset - vbr encoded 32-bit integer
|
||||||
|
|
||||||
The offset item provides the offset into the archive file where the bitcode
|
The offset item provides the offset into the archive file where the bytecode
|
||||||
member is stored that is associated with the symbol. The offset value is 0
|
member is stored that is associated with the symbol. The offset value is 0
|
||||||
based at the start of the first "normal" file member. To derive the actual
|
based at the start of the first "normal" file member. To derive the actual
|
||||||
file offset of the member, you must add the number of bytes occupied by the file
|
file offset of the member, you must add the number of bytes occupied by the file
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ B<llvm-as> [I<options>] [I<filename>]
|
|||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
B<llvm-as> is the LLVM assembler. It reads a file containing human-readable
|
B<llvm-as> is the LLVM assembler. It reads a file containing human-readable
|
||||||
LLVM assembly language, translates it to LLVM bitcode, and writes the result
|
LLVM assembly language, translates it to LLVM bytecode, and writes the result
|
||||||
into a file or to standard output.
|
into a file or to standard output.
|
||||||
|
|
||||||
If F<filename> is omitted or is C<->, then B<llvm-as> reads its input from
|
If F<filename> is omitted or is C<->, then B<llvm-as> reads its input from
|
||||||
@@ -48,7 +48,7 @@ suffix is appended.
|
|||||||
|
|
||||||
Force overwrite. Normally, B<llvm-as> will refuse to overwrite an
|
Force overwrite. Normally, B<llvm-as> will refuse to overwrite an
|
||||||
output file that already exists. With this option, B<llvm-as>
|
output file that already exists. With this option, B<llvm-as>
|
||||||
will overwrite the output file and replace it with new bitcode.
|
will overwrite the output file and replace it with new bytecode.
|
||||||
|
|
||||||
=item B<--help>
|
=item B<--help>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
llvm-bcanalyzer - LLVM bitcode analyzer
|
llvm-bcanalyzer - LLVM bytecode analyzer
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
@@ -10,12 +10,12 @@ B<llvm-bcanalyzer> [I<options>] [F<filename>]
|
|||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
The B<llvm-bcanalyzer> command is a small utility for analyzing bitcode files.
|
The B<llvm-bcanalyzer> command is a small utility for analyzing bytecode files.
|
||||||
The tool reads a bitcode file (such as generated with the B<llvm-as> tool) and
|
The tool reads a bytecode file (such as generated with the B<llvm-as> tool) and
|
||||||
produces a statistical report on the contents of the bitcode file. The tool
|
produces a statistical report on the contents of the byteocde file. The tool
|
||||||
can also dump a low level but human readable version of the bitcode file.
|
can also dump a low level but human readable version of the bytecode file.
|
||||||
This tool is probably not of much interest or utility except for those working
|
This tool is probably not of much interest or utility except for those working
|
||||||
directly with the bitcode file format. Most LLVM users can just ignore
|
directly with the bytecode file format. Most LLVM users can just ignore
|
||||||
this tool.
|
this tool.
|
||||||
|
|
||||||
If F<filename> is omitted or is C<->, then B<llvm-bcanalyzer> reads its input
|
If F<filename> is omitted or is C<->, then B<llvm-bcanalyzer> reads its input
|
||||||
@@ -33,14 +33,14 @@ level summary. The details for individual functions are not displayed.
|
|||||||
|
|
||||||
=item B<-dump>
|
=item B<-dump>
|
||||||
|
|
||||||
Causes B<llvm-bcanalyzer> to dump the bitcode in a human readable format. This
|
Causes B<llvm-bcanalyzer> to dump the bytecode in a human readable format. This
|
||||||
format is significantly different from LLVM assembly and provides details about
|
format is significantly different from LLVM assembly and provides details about
|
||||||
the encoding of the bitcode file.
|
the encoding of the bytecode file.
|
||||||
|
|
||||||
=item B<-verify>
|
=item B<-verify>
|
||||||
|
|
||||||
Causes B<llvm-bcanalyzer> to verify the module produced by reading the
|
Causes B<llvm-bcanalyzer> to verify the module produced by reading the
|
||||||
bitcode. This ensures that the statistics generated are based on a consistent
|
bytecode. This ensures that the statistics generated are based on a consistent
|
||||||
module.
|
module.
|
||||||
|
|
||||||
=item B<--help>
|
=item B<--help>
|
||||||
@@ -61,18 +61,18 @@ summary output.
|
|||||||
|
|
||||||
=over
|
=over
|
||||||
|
|
||||||
=item B<Bitcode Analysis Of Module>
|
=item B<Bytecode Analysis Of Module>
|
||||||
|
|
||||||
This just provides the name of the module for which bitcode analysis is being
|
This just provides the name of the module for which bytecode analysis is being
|
||||||
generated.
|
generated.
|
||||||
|
|
||||||
=item B<Bitcode Version Number>
|
=item B<Bytecode Version Number>
|
||||||
|
|
||||||
The bitcode version (not LLVM version) of the file read by the analyzer.
|
The bytecode version (not LLVM version) of the file read by the analyzer.
|
||||||
|
|
||||||
=item B<File Size>
|
=item B<File Size>
|
||||||
|
|
||||||
The size, in bytes, of the entire bitcode file.
|
The size, in bytes, of the entire bytecode file.
|
||||||
|
|
||||||
=item B<Module Bytes>
|
=item B<Module Bytes>
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ Size.
|
|||||||
=item B<Global Types Bytes>
|
=item B<Global Types Bytes>
|
||||||
|
|
||||||
The size, in bytes, of the Global Types Pool. Percentage is relative to File
|
The size, in bytes, of the Global Types Pool. Percentage is relative to File
|
||||||
Size. This is the size of the definitions of all types in the bitcode file.
|
Size. This is the size of the definitions of all types in the bytecode file.
|
||||||
|
|
||||||
=item B<Constant Pool Bytes>
|
=item B<Constant Pool Bytes>
|
||||||
|
|
||||||
@@ -122,13 +122,13 @@ The size, in bytes, of the list of dependent libraries in the module. Percentage
|
|||||||
is relative to File Size. Note that this value is also included in the Module
|
is relative to File Size. Note that this value is also included in the Module
|
||||||
Global Bytes.
|
Global Bytes.
|
||||||
|
|
||||||
=item B<Number Of Bitcode Blocks>
|
=item B<Number Of Bytecode Blocks>
|
||||||
|
|
||||||
The total number of blocks of any kind in the bitcode file.
|
The total number of blocks of any kind in the bytecode file.
|
||||||
|
|
||||||
=item B<Number Of Functions>
|
=item B<Number Of Functions>
|
||||||
|
|
||||||
The total number of function definitions in the bitcode file.
|
The total number of function definitions in the bytecode file.
|
||||||
|
|
||||||
=item B<Number Of Types>
|
=item B<Number Of Types>
|
||||||
|
|
||||||
@@ -140,42 +140,42 @@ The total number of constants (of any type) defined in the Constant Pool.
|
|||||||
|
|
||||||
=item B<Number Of Basic Blocks>
|
=item B<Number Of Basic Blocks>
|
||||||
|
|
||||||
The total number of basic blocks defined in all functions in the bitcode file.
|
The total number of basic blocks defined in all functions in the bytecode file.
|
||||||
|
|
||||||
=item B<Number Of Instructions>
|
=item B<Number Of Instructions>
|
||||||
|
|
||||||
The total number of instructions defined in all functions in the bitcode file.
|
The total number of instructions defined in all functions in the bytecode file.
|
||||||
|
|
||||||
=item B<Number Of Long Instructions>
|
=item B<Number Of Long Instructions>
|
||||||
|
|
||||||
The total number of long instructions defined in all functions in the bitcode
|
The total number of long instructions defined in all functions in the bytecode
|
||||||
file. Long instructions are those taking greater than 4 bytes. Typically long
|
file. Long instructions are those taking greater than 4 bytes. Typically long
|
||||||
instructions are GetElementPtr with several indices, PHI nodes, and calls to
|
instructions are GetElementPtr with several indices, PHI nodes, and calls to
|
||||||
functions with large numbers of arguments.
|
functions with large numbers of arguments.
|
||||||
|
|
||||||
=item B<Number Of Operands>
|
=item B<Number Of Operands>
|
||||||
|
|
||||||
The total number of operands used in all instructions in the bitcode file.
|
The total number of operands used in all instructions in the bytecode file.
|
||||||
|
|
||||||
=item B<Number Of Compaction Tables>
|
=item B<Number Of Compaction Tables>
|
||||||
|
|
||||||
The total number of compaction tables in all functions in the bitcode file.
|
The total number of compaction tables in all functions in the bytecode file.
|
||||||
|
|
||||||
=item B<Number Of Symbol Tables>
|
=item B<Number Of Symbol Tables>
|
||||||
|
|
||||||
The total number of symbol tables in all functions in the bitcode file.
|
The total number of symbol tables in all functions in the bytecode file.
|
||||||
|
|
||||||
=item B<Number Of Dependent Libs>
|
=item B<Number Of Dependent Libs>
|
||||||
|
|
||||||
The total number of dependent libraries found in the bitcode file.
|
The total number of dependent libraries found in the bytecode file.
|
||||||
|
|
||||||
=item B<Total Instruction Size>
|
=item B<Total Instruction Size>
|
||||||
|
|
||||||
The total size of the instructions in all functions in the bitcode file.
|
The total size of the instructions in all functions in the bytecode file.
|
||||||
|
|
||||||
=item B<Average Instruction Size>
|
=item B<Average Instruction Size>
|
||||||
|
|
||||||
The average number of bytes per instruction across all functions in the bitcode
|
The average number of bytes per instruction across all functions in the bytecode
|
||||||
file. This value is computed by dividing Total Instruction Size by Number Of
|
file. This value is computed by dividing Total Instruction Size by Number Of
|
||||||
Instructions.
|
Instructions.
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes.
|
|||||||
|
|
||||||
=head1 SEE ALSO
|
=head1 SEE ALSO
|
||||||
|
|
||||||
L<llvm-dis|llvm-dis>, L<http://llvm.org/docs/BitcodeFormat.html>
|
L<llvm-dis|llvm-dis>, L<http://llvm.org/docs/BytecodeFormat.html>
|
||||||
|
|
||||||
=head1 AUTHORS
|
=head1 AUTHORS
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ Includes either a native backend or the C backend.
|
|||||||
|
|
||||||
=item B<engine>
|
=item B<engine>
|
||||||
|
|
||||||
Includes either a native JIT or the bitcode interpreter.
|
Includes either a native JIT or the bytecode interpreter.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ B<llvm-dis> [I<options>] [I<filename>]
|
|||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
The B<llvm-dis> command is the LLVM disassembler. It takes an LLVM
|
The B<llvm-dis> command is the LLVM disassembler. It takes an LLVM
|
||||||
bitcode file and converts it into human-readable LLVM assembly language.
|
bytecode file and converts it into human-readable LLVM assembly language.
|
||||||
|
|
||||||
If filename is omitted or specified as C<->, B<llvm-dis> reads its
|
If filename is omitted or specified as C<->, B<llvm-dis> reads its
|
||||||
input from standard input.
|
input from standard input.
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ B<llvm-extract> [I<options>] B<--func> I<function-name> [I<filename>]
|
|||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
The B<llvm-extract> command takes the name of a function and extracts it from
|
The B<llvm-extract> command takes the name of a function and extracts it from
|
||||||
the specified LLVM bitcode file. It is primarily used as a debugging tool to
|
the specified LLVM bytecode file. It is primarily used as a debugging tool to
|
||||||
reduce test cases from larger programs that are triggering a bug.
|
reduce test cases from larger programs that are triggering a bug.
|
||||||
|
|
||||||
In addition to extracting the bitcode of the specified function,
|
In addition to extracting the bytecode of the specified function,
|
||||||
B<llvm-extract> will also remove unreachable global variables, prototypes, and
|
B<llvm-extract> will also remove unreachable global variables, prototypes, and
|
||||||
unused types.
|
unused types.
|
||||||
|
|
||||||
@@ -30,11 +30,11 @@ unless the B<-o> option is specified (see below).
|
|||||||
|
|
||||||
Force overwrite. Normally, B<llvm-extract> will refuse to overwrite an
|
Force overwrite. Normally, B<llvm-extract> will refuse to overwrite an
|
||||||
output file that already exists. With this option, B<llvm-extract>
|
output file that already exists. With this option, B<llvm-extract>
|
||||||
will overwrite the output file and replace it with new bitcode.
|
will overwrite the output file and replace it with new bytecode.
|
||||||
|
|
||||||
=item B<--func> I<function-name>
|
=item B<--func> I<function-name>
|
||||||
|
|
||||||
Extract the function named I<function-name> from the LLVM bitcode.
|
Extract the function named I<function-name> from the LLVM bytecode.
|
||||||
|
|
||||||
=item B<--help>
|
=item B<--help>
|
||||||
|
|
||||||
|
|||||||
@@ -10,16 +10,16 @@ B<llvm-ld> <options> <files>
|
|||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
The B<llvm-ld> tool takes a set of LLVM bitcode files and links them
|
The B<llvm-ld> tool takes a set of LLVM bytecode files and links them
|
||||||
together into a single LLVM bitcode file. The output bitcode file can be
|
together into a single LLVM bytecode file. The output bytecode file can be
|
||||||
another bitcode file or an executable bitcode program. Using additional
|
another bytecode file or an executable bytecode program. Using additional
|
||||||
options, B<llvm-ld> is able to produce native code executables.
|
options, B<llvm-ld> is able to produce native code executables.
|
||||||
|
|
||||||
The B<llvm-ld> tool is the main linker for LLVM. It is used to link together
|
The B<llvm-ld> tool is the main linker for LLVM. It is used to link together
|
||||||
the output of LLVM front-end compilers and run "link time" optimizations (mostly
|
the output of LLVM front-end compilers and run "link time" optimizations (mostly
|
||||||
the inter-procedural kind).
|
the inter-procedural kind).
|
||||||
|
|
||||||
The B<llvm-ld> tools attempts to mimic the interface provided by the default
|
The B<llvm-ld> tools attemps to mimic the interface provided by the default
|
||||||
system linker so that it can act as a I<drop-in> replacement.
|
system linker so that it can act as a I<drop-in> replacement.
|
||||||
|
|
||||||
=head2 Search Order
|
=head2 Search Order
|
||||||
@@ -47,13 +47,13 @@ and is applied to all libraries, preceding or succeeding, in the command line.
|
|||||||
|
|
||||||
=head2 Link order
|
=head2 Link order
|
||||||
|
|
||||||
All object and bitcode files are linked first in the order they were
|
All object and bytecode files are linked first in the order they were
|
||||||
specified on the command line. All library files are linked next.
|
specified on the command line. All library files are linked next.
|
||||||
Some libraries may not be linked into the object program; see below.
|
Some libraries may not be linked into the object program; see below.
|
||||||
|
|
||||||
=head2 Library Linkage
|
=head2 Library Linkage
|
||||||
|
|
||||||
Object files and static bitcode objects are always linked into the output
|
Object files and static bytecode objects are always linked into the output
|
||||||
file. Library archives (.a files) load only the objects within the archive
|
file. Library archives (.a files) load only the objects within the archive
|
||||||
that define symbols needed by the output file. Hence, libraries should be
|
that define symbols needed by the output file. Hence, libraries should be
|
||||||
listed after the object files and libraries which need them; otherwise, the
|
listed after the object files and libraries which need them; otherwise, the
|
||||||
@@ -64,7 +64,7 @@ undefined symbols defined.
|
|||||||
|
|
||||||
The B<llvm-ld> program has limited support for native code generation, when
|
The B<llvm-ld> program has limited support for native code generation, when
|
||||||
using the B<-native> or B<-native-cbe> options. Native code generation is
|
using the B<-native> or B<-native-cbe> options. Native code generation is
|
||||||
performed by converting the linked bitcode into native assembly (.s) or C code
|
perfomed by converting the linked bytecode into native assembly (.s) or C code
|
||||||
and running the system compiler (typically gcc) on the result.
|
and running the system compiler (typically gcc) on the result.
|
||||||
|
|
||||||
=head1 OPTIONS
|
=head1 OPTIONS
|
||||||
@@ -121,25 +121,29 @@ will not search the paths given by the B<-L> options following it.
|
|||||||
|
|
||||||
=item B<-link-as-library>
|
=item B<-link-as-library>
|
||||||
|
|
||||||
Link the bitcode files together as a library, not an executable. In this mode,
|
Link the bytecode files together as a library, not an executable. In this mode,
|
||||||
undefined symbols will be permitted.
|
undefined symbols will be permitted.
|
||||||
|
|
||||||
=item B<-r>
|
=item B<-r>
|
||||||
|
|
||||||
An alias for -link-as-library.
|
An alias for -link-as-library.
|
||||||
|
|
||||||
|
=item B<-march=>C<target>
|
||||||
|
|
||||||
|
Specifies the kind of machine for which code or assembly should be generated.
|
||||||
|
|
||||||
=item B<-native>
|
=item B<-native>
|
||||||
|
|
||||||
Generate a native machine code executable.
|
Generate a native machine code executable.
|
||||||
|
|
||||||
When generating native executables, B<llvm-ld> first checks for a bitcode
|
When generating native executables, B<llvm-ld> first checks for a bytecode
|
||||||
version of the library and links it in, if necessary. If the library is
|
version of the library and links it in, if necessary. If the library is
|
||||||
missing, B<llvm-ld> skips it. Then, B<llvm-ld> links in the same
|
missing, B<llvm-ld> skips it. Then, B<llvm-ld> links in the same
|
||||||
libraries as native code.
|
libraries as native code.
|
||||||
|
|
||||||
In this way, B<llvm-ld> should be able to link in optimized bitcode
|
In this way, B<llvm-ld> should be able to link in optimized bytecode
|
||||||
subsets of common libraries and then link in any part of the library that
|
subsets of common libraries and then link in any part of the library that
|
||||||
hasn't been converted to bitcode.
|
hasn't been converted to bytecode.
|
||||||
|
|
||||||
=item B<-native-cbe>
|
=item B<-native-cbe>
|
||||||
|
|
||||||
@@ -155,6 +159,34 @@ code generator.
|
|||||||
|
|
||||||
=over
|
=over
|
||||||
|
|
||||||
|
=item B<-O0>
|
||||||
|
|
||||||
|
An alias for the -O1 option.
|
||||||
|
|
||||||
|
=item B<-O1>
|
||||||
|
|
||||||
|
Optimize for linking speed, not execution speed. The optimizer will attempt to
|
||||||
|
reduce the size of the linked program to reduce I/O but will not otherwise
|
||||||
|
perform any link-time optimizations.
|
||||||
|
|
||||||
|
=item B<-O2>
|
||||||
|
|
||||||
|
Perform only the minimal or required set of scalar optimizations.
|
||||||
|
|
||||||
|
=item B<-03>
|
||||||
|
|
||||||
|
An alias for the -O2 option.
|
||||||
|
|
||||||
|
=item B<-04>
|
||||||
|
|
||||||
|
Perform the standard link time inter-procedural optimizations. This will
|
||||||
|
attempt to optimize the program taking the entire program into consideration.
|
||||||
|
|
||||||
|
=item B<-O5>
|
||||||
|
|
||||||
|
Perform aggressive link time optimizations. This is the same as -O4 but works
|
||||||
|
more aggressively to optimize the program.
|
||||||
|
|
||||||
=item B<-disable-inlining>
|
=item B<-disable-inlining>
|
||||||
|
|
||||||
Do not run the inlining pass. Functions will not be inlined into other
|
Do not run the inlining pass. Functions will not be inlined into other
|
||||||
@@ -162,7 +194,8 @@ functions.
|
|||||||
|
|
||||||
=item B<-disable-opt>
|
=item B<-disable-opt>
|
||||||
|
|
||||||
Completely disable optimization.
|
Completely disable optimization. The various B<-On> options will be ignored and
|
||||||
|
no link time optimization passes will be run.
|
||||||
|
|
||||||
=item B<-disable-internalize>
|
=item B<-disable-internalize>
|
||||||
|
|
||||||
@@ -193,9 +226,17 @@ An alias for B<-strip-debug>.
|
|||||||
|
|
||||||
An alias for B<-disable-internalize>
|
An alias for B<-disable-internalize>
|
||||||
|
|
||||||
|
=item B<-load> F<module>
|
||||||
|
|
||||||
|
Load an optimization module, F<module>, which is expected to be a dynamic
|
||||||
|
library that provides the function name C<RunOptimizations>. This function will
|
||||||
|
be passed the PassManager, and the optimization level (values 0-5 based on the
|
||||||
|
B<-On> option). This function may add passes to the PassManager that should be
|
||||||
|
run. This feature allows the optimization passes of B<llvm-ld> to be extended.
|
||||||
|
|
||||||
=item B<-post-link-opt>F<Path>
|
=item B<-post-link-opt>F<Path>
|
||||||
|
|
||||||
Run post-link optimization program. After linking is completed a bitcode file
|
Run post-link optimization program. After linking is completed a bytecode file
|
||||||
will be generated. It will be passed to the program specified by F<Path> as the
|
will be generated. It will be passed to the program specified by F<Path> as the
|
||||||
first argument. The second argument to the program will be the name of a
|
first argument. The second argument to the program will be the name of a
|
||||||
temporary file into which the program should place its optimized output. For
|
temporary file into which the program should place its optimized output. For
|
||||||
@@ -213,7 +254,7 @@ it will exit with a non-zero return code.
|
|||||||
|
|
||||||
=head1 ENVIRONMENT
|
=head1 ENVIRONMENT
|
||||||
|
|
||||||
The C<LLVM_LIB_SEARCH_PATH> environment variable is used to find bitcode
|
The C<LLVM_LIB_SEARCH_PATH> environment variable is used to find bytecode
|
||||||
libraries. Any paths specified in this variable will be searched after the C<-L>
|
libraries. Any paths specified in this variable will be searched after the C<-L>
|
||||||
options.
|
options.
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ B<llvm-link> [I<options>] I<filename ...>
|
|||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
B<llvm-link> takes several LLVM bitcode files and links them together into a
|
B<llvm-link> takes several LLVM bytecode files and links them together into a
|
||||||
single LLVM bitcode file. It writes the output file to standard output, unless
|
single LLVM bytecode file. It writes the output file to standard output, unless
|
||||||
the B<-o> option is used to specify a filename.
|
the B<-o> option is used to specify a filename.
|
||||||
|
|
||||||
B<llvm-link> attempts to load the input files from the current directory. If
|
B<llvm-link> attempts to load the input files from the current directory. If
|
||||||
@@ -27,14 +27,14 @@ in the order they were specified on the command line.
|
|||||||
=item B<-L> F<directory>
|
=item B<-L> F<directory>
|
||||||
|
|
||||||
Add the specified F<directory> to the library search path. When looking for
|
Add the specified F<directory> to the library search path. When looking for
|
||||||
libraries, B<llvm-link> will look in path name for libraries. This option can be
|
libraries, B<llvm-link> will look in pathname for libraries. This option can be
|
||||||
specified multiple times; B<llvm-link> will search inside these directories in
|
specified multiple times; B<llvm-link> will search inside these directories in
|
||||||
the order in which they were specified on the command line.
|
the order in which they were specified on the command line.
|
||||||
|
|
||||||
=item B<-f>
|
=item B<-f>
|
||||||
|
|
||||||
Overwrite output files. By default, B<llvm-link> will not overwrite an output
|
Overwrite output files. By default, B<llvm-link> will not overwrite an output
|
||||||
file if it already exists.
|
file if it alreadys exists.
|
||||||
|
|
||||||
=item B<-o> F<filename>
|
=item B<-o> F<filename>
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ write its output to standard output.
|
|||||||
=item B<-d>
|
=item B<-d>
|
||||||
|
|
||||||
If specified, B<llvm-link> prints a human-readable version of the output
|
If specified, B<llvm-link> prints a human-readable version of the output
|
||||||
bitcode file to standard error.
|
bytecode file to standard error.
|
||||||
|
|
||||||
=item B<--help>
|
=item B<--help>
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ Print a summary of command line options.
|
|||||||
=item B<-v>
|
=item B<-v>
|
||||||
|
|
||||||
Verbose mode. Print information about what B<llvm-link> is doing. This
|
Verbose mode. Print information about what B<llvm-link> is doing. This
|
||||||
typically includes a message for each bitcode file linked in and for each
|
typically includes a message for each bytecode file linked in and for each
|
||||||
library found.
|
library found.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
llvm-nm - list LLVM bitcode file's symbol table
|
llvm-nm - list LLVM bytecode file's symbol table
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
@@ -10,11 +10,11 @@ B<llvm-nm> [I<options>] [I<filenames...>]
|
|||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
The B<llvm-nm> utility lists the names of symbols from the LLVM bitcode files,
|
The B<llvm-nm> utility lists the names of symbols from the LLVM bytecode files,
|
||||||
or B<ar> archives containing LLVM bitcode files, named on the command line.
|
or B<ar> archives containing LLVM bytecode files, named on the command line.
|
||||||
Each symbol is listed along with some simple information about its provenance.
|
Each symbol is listed along with some simple information about its provenance.
|
||||||
If no file name is specified, or I<-> is used as a file name, B<llvm-nm> will
|
If no filename is specified, or I<-> is used as a filename, B<llvm-nm> will
|
||||||
process a bitcode file on its standard input stream.
|
process a bytecode file on its standard input stream.
|
||||||
|
|
||||||
B<llvm-nm>'s default output format is the traditional BSD B<nm> output format.
|
B<llvm-nm>'s default output format is the traditional BSD B<nm> output format.
|
||||||
Each such output record consists of an (optional) 8-digit hexadecimal address,
|
Each such output record consists of an (optional) 8-digit hexadecimal address,
|
||||||
@@ -28,15 +28,15 @@ Type code characters currently supported, and their meanings, are as follows:
|
|||||||
|
|
||||||
=item U
|
=item U
|
||||||
|
|
||||||
Named object is referenced but undefined in this bitcode file
|
Named object is referenced but undefined in this bytecode file
|
||||||
|
|
||||||
=item C
|
=item C
|
||||||
|
|
||||||
Common (multiple definitions link together into one def)
|
Common (multiple defs link together into one def)
|
||||||
|
|
||||||
=item W
|
=item W
|
||||||
|
|
||||||
Weak reference (multiple definitions link together into zero or one definitions)
|
Weak reference (multiple defs link together into zero or one defs)
|
||||||
|
|
||||||
=item t
|
=item t
|
||||||
|
|
||||||
@@ -60,10 +60,10 @@ Something unrecognizable
|
|||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
Because LLVM bitcode files typically contain objects that are not considered to
|
Because LLVM bytecode files typically contain objects that are not considered to
|
||||||
have addresses until they are linked into an executable image or dynamically
|
have addresses until they are linked into an executable image or dynamically
|
||||||
compiled "just-in-time", B<llvm-nm> does not print an address for any symbol,
|
compiled "just-in-time", B<llvm-nm> does not print an address for any symbol,
|
||||||
even symbols which are defined in the bitcode file.
|
even symbols which are defined in the bytecode file.
|
||||||
|
|
||||||
=head1 OPTIONS
|
=head1 OPTIONS
|
||||||
|
|
||||||
@@ -83,18 +83,18 @@ Print a summary of command-line options and their meanings.
|
|||||||
|
|
||||||
=item B<--defined-only>
|
=item B<--defined-only>
|
||||||
|
|
||||||
Print only symbols defined in this bitcode file (as opposed to
|
Print only symbols defined in this bytecode file (as opposed to
|
||||||
symbols which may be referenced by objects in this file, but not
|
symbols which may be referenced by objects in this file, but not
|
||||||
defined in this file.)
|
defined in this file.)
|
||||||
|
|
||||||
=item B<--extern-only>, B<-g>
|
=item B<--extern-only>, B<-g>
|
||||||
|
|
||||||
Print only symbols whose definitions are external; that is, accessible
|
Print only symbols whose definitions are external; that is, accessible
|
||||||
from other bitcode files.
|
from other bytecode files.
|
||||||
|
|
||||||
=item B<--undefined-only>, B<-u>
|
=item B<--undefined-only>, B<-u>
|
||||||
|
|
||||||
Print only symbols referenced but not defined in this bitcode file.
|
Print only symbols referenced but not defined in this bytecode file.
|
||||||
|
|
||||||
=item B<--format=>I<fmt>, B<-f>
|
=item B<--format=>I<fmt>, B<-f>
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ llvm-prof - print execution profile of LLVM program
|
|||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
B<llvm-prof> [I<options>] [I<bitcode file>] [I<llvmprof.out>]
|
B<llvm-prof> [I<options>] [I<bytecode file>] [I<llvmprof.out>]
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
The B<llvm-prof> tool reads in an F<llvmprof.out> file (which can
|
The B<llvm-prof> tool reads in an F<llvmprof.out> file (which can
|
||||||
optionally use a specific file with the third program argument), a bitcode file
|
optionally use a specific file with the third program argument), a bytecode file
|
||||||
for the program, and produces a human readable report, suitable for determining
|
for the program, and produces a human readable report, suitable for determining
|
||||||
where the program hotspots are.
|
where the program hotspots are.
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ error.
|
|||||||
|
|
||||||
=head1 EXIT STATUS
|
=head1 EXIT STATUS
|
||||||
|
|
||||||
B<llvm-prof> returns 1 if it cannot load the bitcode file or the profile
|
B<llvm-prof> returns 1 if it cannot load the bytecode file or the profile
|
||||||
information. Otherwise, it exits with zero.
|
information. Otherwise, it exits with zero.
|
||||||
|
|
||||||
=head1 AUTHOR
|
=head1 AUTHOR
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ The B<llvm-ranlib> command is similar to the common Unix utility, C<ranlib>. It
|
|||||||
adds or updates the symbol table in an LLVM archive file. Note that using the
|
adds or updates the symbol table in an LLVM archive file. Note that using the
|
||||||
B<llvm-ar> modifier F<s> is usually more efficient than running B<llvm-ranlib>
|
B<llvm-ar> modifier F<s> is usually more efficient than running B<llvm-ranlib>
|
||||||
which is only provided only for completness and compatibility. Unlike other
|
which is only provided only for completness and compatibility. Unlike other
|
||||||
implementations of C<ranlib>, B<llvm-ranlib> indexes LLVM bitcode files, not
|
implementations of C<ranlib>, B<llvm-ranlib> indexes LLVM bytecode files, not
|
||||||
native object modules. You can list the contents of the symbol table with the
|
native object modules. You can list the contents of the symbol table with the
|
||||||
C<llvm-nm -s> command.
|
C<llvm-nm -s> command.
|
||||||
|
|
||||||
|
|||||||
66
llvm/docs/CommandGuide/llvm-upgrade.pod
Normal file
66
llvm/docs/CommandGuide/llvm-upgrade.pod
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
=pod
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
llvm-upgrade - LLVM assembly upgrader
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
B<llvm-upgrade> [I<options>] [I<filename>]
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
B<llvm-upgrade> is the LLVM assembly upgrader. It reads a file containing
|
||||||
|
human-readable LLVM assembly language, and upgrades that assembly to the current
|
||||||
|
version of LLVM. If the input is in the form currently accepted by LLVM, then
|
||||||
|
no upgrades are performed.
|
||||||
|
|
||||||
|
The expected usage of this tool is as a filter, like this:
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
B<llvm-1.9/bin/llvm-dis < 1.9.bc | llvm-upgrade | llvm-2.0/bin/llvm-as -o 2.0.bc>
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
If F<filename> is omitted or is C<->, then B<llvm-upgrade> reads its input from
|
||||||
|
standard input.
|
||||||
|
|
||||||
|
If an output file is not specified with the B<-o> option, then
|
||||||
|
B<llvm-upgrade> sends its output to standard output.
|
||||||
|
|
||||||
|
=head1 OPTIONS
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<-f>
|
||||||
|
|
||||||
|
Force overwrite. Normally, B<llvm-upgrade> will refuse to overwrite an
|
||||||
|
output file that already exists. With this option, B<llvm-upgrade>
|
||||||
|
will overwrite the output file.
|
||||||
|
|
||||||
|
=item B<--help>
|
||||||
|
|
||||||
|
Print a summary of command line options.
|
||||||
|
|
||||||
|
=item B<-o> F<filename>
|
||||||
|
|
||||||
|
Specify the output file name. If F<filename> is C<->, then B<llvm-upgrade>
|
||||||
|
sends its output to standard output.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 EXIT STATUS
|
||||||
|
|
||||||
|
If B<llvm-upgrade> succeeds, it will exit with 0. Otherwise, if an error
|
||||||
|
occurs, it will exit with a non-zero value.
|
||||||
|
|
||||||
|
=head1 SEE ALSO
|
||||||
|
|
||||||
|
L<llvm-as|llvm-as>, L<llvm-dis|llvm-dis>
|
||||||
|
|
||||||
|
=head1 AUTHORS
|
||||||
|
|
||||||
|
Maintained by the LLVM Team (L<http://llvm.org>).
|
||||||
|
|
||||||
|
=cut
|
||||||
209
llvm/docs/CommandGuide/llvm2cpp.pod
Normal file
209
llvm/docs/CommandGuide/llvm2cpp.pod
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
=pod
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
llvm2xpp - LLVM bytecode to LLVM C++ IR translator
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
B<llvm2cpp> [I<options>] [I<filename>]
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
B<llvm2cpp> translates from LLVM bytecode (.bc files) to a
|
||||||
|
corresponding C++ source file that will make calls against the LLVM C++ API to
|
||||||
|
build the same module as the input. By default, the C++ output is a complete
|
||||||
|
program that builds the module, verifies it and then emits the module as
|
||||||
|
LLVM assembly. This technique assists with testing because the input to
|
||||||
|
B<llvm2cpp> and the output of the generated C++ program should be identical.
|
||||||
|
|
||||||
|
If F<filename> is omitted or is C<->, then B<llvm2cpp> reads its input from
|
||||||
|
standard input.
|
||||||
|
|
||||||
|
If an output file is not specified with the B<-o> option, then
|
||||||
|
B<llvm2cpp> sends its output to a file or standard output by following
|
||||||
|
these rules:
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item *
|
||||||
|
|
||||||
|
If the input is standard input, then the output is standard output.
|
||||||
|
|
||||||
|
=item *
|
||||||
|
|
||||||
|
If the input is a file that ends with C<.bc>, then the output file is of
|
||||||
|
the same name, except that the suffix is changed to C<.cpp>.
|
||||||
|
|
||||||
|
=item *
|
||||||
|
|
||||||
|
If the input is a file that does not end with the C<.bc> suffix, then the
|
||||||
|
output file has the same name as the input file, except that the C<.cpp>
|
||||||
|
suffix is appended.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 OPTIONS
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<-f>
|
||||||
|
|
||||||
|
Force overwrite. Normally, B<llvm2cpp> will refuse to overwrite an
|
||||||
|
output file that already exists. With this option, B<llvm2cpp>
|
||||||
|
will overwrite the output file and replace it with new C++ source code.
|
||||||
|
|
||||||
|
=item B<--help>
|
||||||
|
|
||||||
|
Print a summary of command line options.
|
||||||
|
|
||||||
|
=item B<-f>
|
||||||
|
|
||||||
|
Normally, B<llvm2cpp> will not overwrite an existing output file. With this
|
||||||
|
option, that default behavior is changed and the program will overwrite existing
|
||||||
|
output files.
|
||||||
|
|
||||||
|
=item B<-o> F<filename>
|
||||||
|
|
||||||
|
Specify the output file name. If F<filename> is C<->, then B<llvm2cpp>
|
||||||
|
sends its output to standard output.
|
||||||
|
|
||||||
|
=item B<-funcname> F<functionName>
|
||||||
|
|
||||||
|
Specify the name of the function to be generated. The generated code contains a
|
||||||
|
single function that produces the input module. By default its name is
|
||||||
|
I<makeLLVMModule>. The B<-funcname> option overrides this default and allows
|
||||||
|
you to control the name of the generated function. This is handy in conjunction
|
||||||
|
with the B<-fragment> option when you only want B<llvm2cpp> to generate a
|
||||||
|
single function that produces the module. With both options, such generated code
|
||||||
|
could be I<#included> into another program.
|
||||||
|
|
||||||
|
=item B<-for>
|
||||||
|
|
||||||
|
Specify the name of the thing for which C++ code should be generated. By default
|
||||||
|
the entire input module is re-generated. However, use of the various B<-gen-*>
|
||||||
|
options can restrict what is produced. This option indicates what that
|
||||||
|
restriction is.
|
||||||
|
|
||||||
|
=item B<-gen-program>
|
||||||
|
|
||||||
|
Specify that the output should be a complete program. Such program will recreate
|
||||||
|
B<llvm2cpp>'s input as an LLVM module, verify that module, and then write out
|
||||||
|
the module in LLVM assembly format. This is useful for doing identity tests
|
||||||
|
where the output of the generated program is identical to the input to
|
||||||
|
B<llvm2cpp>. The LLVM DejaGnu test suite can make use of this fact. This is the
|
||||||
|
default form of generated output.
|
||||||
|
|
||||||
|
If the B<-for> option is given with this option, it specifies the module
|
||||||
|
identifier to use for the module created.
|
||||||
|
|
||||||
|
=item B<-gen-module>
|
||||||
|
|
||||||
|
Specify that the output should be a function that regenerates the module. It is
|
||||||
|
assumed that this output will be #included into another program that has already
|
||||||
|
arranged for the correct header files to be #included. The function generated
|
||||||
|
takes no arguments and returns a I<Module*>.
|
||||||
|
|
||||||
|
If the B<-for> option is given with this option, it specifies the module
|
||||||
|
identifier to use in creating the module returned by the generated function.
|
||||||
|
|
||||||
|
=item B<-gen-contents>
|
||||||
|
|
||||||
|
Specify that the output should be a function that adds the contents of the input
|
||||||
|
module to another module. It is assumed that the output will be #included into
|
||||||
|
another program that has already arranged for the correct header files to be
|
||||||
|
#included. The function generated takes a single argument of type I<Module*> and
|
||||||
|
returns that argument. Note that Module level attributes such as endianess,
|
||||||
|
pointer size, target triple and inline asm are not passed on from the input
|
||||||
|
module to the destination module. Only the sub-elements of the module (types,
|
||||||
|
constants, functions, global variables) will be added to the input module.
|
||||||
|
|
||||||
|
If the B<-for> option is given with this option, it specifies the module
|
||||||
|
identifier to set in the input module by the generated function.
|
||||||
|
|
||||||
|
=item B<-gen-function>
|
||||||
|
|
||||||
|
Specify that the output should be a function that produces the definitions
|
||||||
|
necessary for a specific function to be added to a module. It is assumed that
|
||||||
|
the output will be #included into another program that has already arranged
|
||||||
|
for the correct header files to be #included. The function generated takes a
|
||||||
|
single argument of type I<Module*> and returns the I<Function*> that it added to
|
||||||
|
the module. Note that only those things (types, constants, etc.) directly
|
||||||
|
needed in the definition of the function will be placed in the generated
|
||||||
|
function.
|
||||||
|
|
||||||
|
The B<-for> option must be given with this option or an error will be produced.
|
||||||
|
The value of the option must be the name of a function in the input module for
|
||||||
|
which code should be generated. If the named function does not exist an error
|
||||||
|
will be produced.
|
||||||
|
|
||||||
|
=item B<-gen-inline>
|
||||||
|
|
||||||
|
This option is very analagous to B<-gen-function> except that the generated
|
||||||
|
function will not re-produce the target function's definition. Instead, the body
|
||||||
|
of the target function is inserted into some other function passed as an
|
||||||
|
argument to the generated function. Similarly any arguments to the function must
|
||||||
|
be passed to the generated function. The result of the generated function is the
|
||||||
|
first basic block of the target function.
|
||||||
|
|
||||||
|
The B<-for> option works the same way as it does for B<-gen-function>.
|
||||||
|
|
||||||
|
=item B<-gen-variable>
|
||||||
|
|
||||||
|
Specify that the output should be a function that produces the definitions
|
||||||
|
necessary for a specific global variable to be added to a module. It is assumed
|
||||||
|
that the output will be #included into another program that has already arranged
|
||||||
|
for the correct header files to be #included. The function generated takes a
|
||||||
|
single argument of type I<Module*> and returns the I<GlobalVariable*> that it
|
||||||
|
added to the module. Note that only those things (types, constants, etc.)
|
||||||
|
directly needed in the definition of the global variable will be placed in the
|
||||||
|
generated function.
|
||||||
|
|
||||||
|
The B<-for> option must be given with this option or an error will be produced.
|
||||||
|
THe value of the option must be the name of a global variable in the input
|
||||||
|
module for which code should be generated. If the named global variable does not
|
||||||
|
exist an error will be produced.
|
||||||
|
|
||||||
|
=item B<-gen-type>
|
||||||
|
|
||||||
|
Specify that the output should be a function that produces the definitions
|
||||||
|
necessary for specific type to be added to a module. It is assumed that the
|
||||||
|
otuput will be #included into another program that has already arranged for the
|
||||||
|
correct header files to be #included. The function generated take a single
|
||||||
|
argument of type I<Module*> and returns the I<Type*> that it added to the
|
||||||
|
module. Note that the generated function will only add the necessary type
|
||||||
|
definitions to (possibly recursively) define the requested type.
|
||||||
|
|
||||||
|
The B<-for> option must be given with this option or an error will be produced.
|
||||||
|
The value of the option must be the name of a global type in the input module
|
||||||
|
for which code should be generated. If the named type does not exist an error
|
||||||
|
will be produced.
|
||||||
|
|
||||||
|
=item B<-stats>
|
||||||
|
|
||||||
|
Show pass statistics (not interesting in this program).
|
||||||
|
|
||||||
|
=item B<-time-passes>
|
||||||
|
|
||||||
|
Show pass timing statistics (not interesting in this program).
|
||||||
|
|
||||||
|
=item B<-version>
|
||||||
|
|
||||||
|
Show the version number of this program.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 EXIT STATUS
|
||||||
|
|
||||||
|
If B<llvm2cpp> succeeds, it will exit with 0. Otherwise, if an error
|
||||||
|
occurs, it will exit with a non-zero value.
|
||||||
|
|
||||||
|
=head1 SEE ALSO
|
||||||
|
|
||||||
|
L<llvm-as|llvm-as> L<tblgen|tblgen>
|
||||||
|
|
||||||
|
=head1 AUTHORS
|
||||||
|
|
||||||
|
Written by Reid Spencer (L<http://hlvm.org>).
|
||||||
|
|
||||||
|
=cut
|
||||||
@@ -2,162 +2,427 @@
|
|||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
llvmc - The LLVM Compiler Driver (WIP)
|
llvmc - The LLVM Compiler Driver (experimental)
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
B<llvmc> [I<options>] I<filenames...>
|
B<llvmc> [I<options>] [I<filenames>...]
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
B<llvmc> is a configurable driver for invoking other LLVM (and non-LLVM) tools
|
B<llvmc> is a configurable driver for invoking other LLVM (and non-LLVM) tools
|
||||||
in order to compile, optimize and link software for multiple languages. For
|
in order to compile, optimize and link software for multiple languages. For
|
||||||
those familiar with FSF's B<gcc> tool, it is very similar. Please note that
|
those familiar with FSF's B<gcc> tool, it is very similar. Please note that
|
||||||
B<llvmc> is considered an experimental tool.
|
B<llvmc> is considered an experimental tool. B<llvmc> has the following goals:
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item * provide a single point of access to the LLVM tool set,
|
||||||
|
|
||||||
|
=item * hide the complexities of the LLVM tools through a single interface,
|
||||||
|
|
||||||
|
=item * make integration of existing non-LLVM tools simple,
|
||||||
|
|
||||||
|
=item * extend the capabilities of minimal front ends, and
|
||||||
|
|
||||||
|
=item * make the interface for compiling consistent for all languages.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
The tool itself does nothing with a user's program. It merely invokes other
|
||||||
|
tools to get the compilation tasks done.
|
||||||
|
|
||||||
|
The options supported by B<llvmc> generalize the compilation process and
|
||||||
|
provide a consistent and simple interface for multiple programming languages.
|
||||||
|
This makes it easier for developers to get their software compiled with LLVM.
|
||||||
|
Without B<llvmc>, developers would need to understand how to invoke the
|
||||||
|
front-end compiler, optimizer, assembler, and linker in order to compile their
|
||||||
|
programs. B<llvmc>'s sole mission is to trivialize that process.
|
||||||
|
|
||||||
|
=head2 Basic Operation
|
||||||
|
|
||||||
|
B<llvmc> always takes the following basic actions:
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item * Command line options and filenames are collected.
|
||||||
|
|
||||||
|
The command line options provide the marching orders to B<llvmc> on what actions
|
||||||
|
it should perform. This is the I<request> the user is making of B<llvmc> and it
|
||||||
|
is interpreted first.
|
||||||
|
|
||||||
|
=item * Configuration files are read.
|
||||||
|
|
||||||
|
Based on the options and the suffixes of the filenames presented, a set of
|
||||||
|
configuration files are read to configure the actions B<llvmc> will take.
|
||||||
|
Configuration files are provided by either LLVM or the front end compiler tools
|
||||||
|
that B<llvmc> invokes. Users generally don't need to be concerned with the
|
||||||
|
contents of the configuration files.
|
||||||
|
|
||||||
|
=item * Determine actions to take.
|
||||||
|
|
||||||
|
The tool chain needed to complete the task is determined. This is the primary
|
||||||
|
work of B<llvmc>. It breaks the request specified by the command line options
|
||||||
|
into a set of basic actions to be done:
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item * Pre-processing: gathering/filtering compiler input (optional).
|
||||||
|
|
||||||
|
=item * Translation: source language to bytecode conversion.
|
||||||
|
|
||||||
|
=item * Assembly: bytecode to native code conversion.
|
||||||
|
|
||||||
|
=item * Optimization: conversion of bytecode to something that runs faster.
|
||||||
|
|
||||||
|
=item * Linking: combining multiple bytecodes to produce executable program.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=item * Execute actions.
|
||||||
|
|
||||||
|
The actions determined previously are executed sequentially and then
|
||||||
|
B<llvmc> terminates.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
=head1 OPTIONS
|
=head1 OPTIONS
|
||||||
|
|
||||||
=head2 Built-in Options
|
=head2 Control Options
|
||||||
|
|
||||||
LLVMC has some built-in options that can't be overridden in the
|
Control options tell B<llvmc> what to do at a high level. The
|
||||||
configuration libraries.
|
following control options are defined:
|
||||||
|
|
||||||
=over
|
=over
|
||||||
|
|
||||||
=item B<-o> I<filename>
|
=item B<-c> or B<--compile>
|
||||||
|
|
||||||
Output file name.
|
This option specifies that the linking phase is not to be run. All
|
||||||
|
previous phases, if applicable will run. This is generally how a given
|
||||||
|
bytecode file is compiled and optimized for a source language module.
|
||||||
|
|
||||||
=item B<-x> I<language>
|
=item B<-k> or B<--link> or default
|
||||||
|
|
||||||
Specify the language of the following input files until the next B<-x>
|
This option (or the lack of any control option) specifies that all stages
|
||||||
option.
|
of compilation, optimization, and linking should be attempted. Source files
|
||||||
|
specified on the command line will be compiled and linked with objects and
|
||||||
|
libraries also specified.
|
||||||
|
|
||||||
=item B<-load> I<plugin_name>
|
=item B<-S>
|
||||||
|
|
||||||
Load the specified plugin DLL. Example:
|
This option specifies that compilation should end in the creation of
|
||||||
S<-load $LLVM_DIR/Release/lib/LLVMCSimple.so>.
|
an LLVM assembly file that can be later converted to an LLVM object
|
||||||
|
file.
|
||||||
|
|
||||||
|
=item B<-E>
|
||||||
|
|
||||||
|
This option specifies that no compilation or linking should be
|
||||||
|
performed. Only pre-processing, if applicable to the language being
|
||||||
|
compiled, is performed. For languages that support it, this will
|
||||||
|
result in the output containing the raw input to the compiler.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head2 Optimization Options
|
||||||
|
|
||||||
|
Optimization with B<llvmc> is based on goals and specified with
|
||||||
|
the following -O options. The specific details of which
|
||||||
|
optimizations run is controlled by the configuration files because
|
||||||
|
each source language will have different needs.
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<-O1> or B<-O0> (default, fast compilation)
|
||||||
|
|
||||||
|
Only those optimizations that will hasten the compilation (mostly by reducing
|
||||||
|
the output) are applied. In general these are extremely fast and simple
|
||||||
|
optimizations that reduce emitted code size. The goal here is not to make the
|
||||||
|
resulting program fast but to make the compilation fast. If not specified,
|
||||||
|
this is the default level of optimization.
|
||||||
|
|
||||||
|
=item B<-O2> (basic optimization)
|
||||||
|
|
||||||
|
This level of optimization specifies a balance between generating good code
|
||||||
|
that will execute reasonably quickly and not spending too much time optimizing
|
||||||
|
the code to get there. For example, this level of optimization may include
|
||||||
|
things like global common subexpression elimination, aggressive dead code
|
||||||
|
elimination, and scalar replication.
|
||||||
|
|
||||||
|
=item B<-O3> (aggressive optimization)
|
||||||
|
|
||||||
|
This level of optimization aggressively optimizes each set of files compiled
|
||||||
|
together. However, no link-time inter-procedural optimization is performed.
|
||||||
|
This level implies all the optimizations of the B<-O1> and B<-O2> optimization
|
||||||
|
levels, and should also provide loop optimizations and compile time
|
||||||
|
inter-procedural optimizations. Essentially, this level tries to do as much
|
||||||
|
as it can with the input it is given but doesn't do any link time IPO.
|
||||||
|
|
||||||
|
=item B<-O4> (link time optimization)
|
||||||
|
|
||||||
|
In addition to the previous three levels of optimization, this level of
|
||||||
|
optimization aggressively optimizes each program at link time. It employs
|
||||||
|
basic analysis and basic link-time inter-procedural optimizations,
|
||||||
|
considering the program as a whole.
|
||||||
|
|
||||||
|
=item B<-O5> (aggressive link time optimization)
|
||||||
|
|
||||||
|
This is the same as B<-O4> except it employs aggressive analyses and
|
||||||
|
aggressive inter-procedural optimization.
|
||||||
|
|
||||||
|
=item B<-O6> (profile guided optimization: not implemented)
|
||||||
|
|
||||||
|
This is the same as B<-O5> except that it employs profile-guided
|
||||||
|
re-optimization of the program after it has executed. Note that this implies
|
||||||
|
a single level of re-optimization based on runtime profile analysis. Once
|
||||||
|
the re-optimization has completed, the profiling instrumentation is
|
||||||
|
removed and final optimizations are employed.
|
||||||
|
|
||||||
|
=item B<-O7> (lifelong optimization: not implemented)
|
||||||
|
|
||||||
|
This is the same as B<-O5> and similar to B<-O6> except that re-optimization
|
||||||
|
is performed through the life of the program. That is, each run will update
|
||||||
|
the profile by which future re-optimizations are directed.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head2 Input Options
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<-l> I<LIBRARY>
|
||||||
|
|
||||||
|
This option instructs B<llvmc> to locate a library named I<LIBRARY> and search
|
||||||
|
it for unresolved symbols when linking the program.
|
||||||
|
|
||||||
|
=item B<-L> F<path>
|
||||||
|
|
||||||
|
This option instructs B<llvmc> to add F<path> to the list of places in which
|
||||||
|
the linker will
|
||||||
|
|
||||||
|
=item B<-x> I<LANGUAGE>
|
||||||
|
|
||||||
|
This option instructs B<llvmc> to regard the following input files as
|
||||||
|
containing programs in the language I<LANGUAGE>. Normally, input file languages
|
||||||
|
are identified by their suffix but this option will override that default
|
||||||
|
behavior. The B<-x> option stays in effect until the end of the options or
|
||||||
|
a new B<-x> option is encountered.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head2 Output Options
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<-m>I<arch>
|
||||||
|
|
||||||
|
This option selects the back end code generator to use. The I<arch> portion
|
||||||
|
of the option names the back end to use.
|
||||||
|
|
||||||
|
=item B<--native>
|
||||||
|
|
||||||
|
Normally, B<llvmc> produces bytecode files at most stages of compilation.
|
||||||
|
With this option, B<llvmc> will arrange for native object files to be
|
||||||
|
generated with the B<-c> option, native assembly files to be generated
|
||||||
|
with the B<-S> option, and native executables to be generated with the
|
||||||
|
B<--link> option. In the case of the B<-E> option, the output will not
|
||||||
|
differ as there is no I<native> version of pre-processed output.
|
||||||
|
|
||||||
|
=item B<-o> F<filename>
|
||||||
|
|
||||||
|
Specify the output file name. The contents of the file depend on other
|
||||||
|
options.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head2 Information Options
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<-n> or B<--no-op>
|
||||||
|
|
||||||
|
This option tells B<llvmc> to do everything but actually execute the
|
||||||
|
resulting tools. In combination with the B<-v> option, this causes B<llvmc>
|
||||||
|
to merely print out what it would have done.
|
||||||
|
|
||||||
=item B<-v> or B<--verbose>
|
=item B<-v> or B<--verbose>
|
||||||
|
|
||||||
Enable verbose mode, i.e. print out all executed commands.
|
This option will cause B<llvmc> to print out (on standard output) each of the
|
||||||
|
actions it takes to accomplish the objective. The output will immediately
|
||||||
|
precede the invocation of other tools.
|
||||||
|
|
||||||
=item B<--check-graph>
|
=item B<--stats>
|
||||||
|
|
||||||
Check the compilation for common errors like mismatched output/input
|
Print all statistics gathered during the compilation to the standard error.
|
||||||
language names, multiple default edges and cycles. Hidden option,
|
Note that this option is merely passed through to the sub-tools to do with
|
||||||
useful for debugging.
|
as they please.
|
||||||
|
|
||||||
=item B<--view-graph>
|
=item B<--time-passes>
|
||||||
|
|
||||||
Show a graphical representation of the compilation graph. Requires
|
Record the amount of time needed for each optimization pass and print it
|
||||||
that you have I<dot> and I<gv> programs installed. Hidden option,
|
to standard error. Like B<--stats> this option is just passed through to
|
||||||
useful for debugging.
|
the sub-tools to do with as they please.
|
||||||
|
|
||||||
=item B<--write-graph>
|
=item B<--time-programs>
|
||||||
|
|
||||||
Write a I<compilation-graph.dot> file in the current directory with
|
|
||||||
the compilation graph description in the Graphviz format. Hidden
|
|
||||||
option, useful for debugging.
|
|
||||||
|
|
||||||
=item B<--save-temps>
|
|
||||||
|
|
||||||
Write temporary files to the current directory and do not delete them
|
|
||||||
on exit. Hidden option, useful for debugging.
|
|
||||||
|
|
||||||
=item B<--help>
|
|
||||||
|
|
||||||
Print a summary of command-line options and exit.
|
|
||||||
|
|
||||||
=item B<--help-hidden>
|
|
||||||
|
|
||||||
Print a summary of command-line options and exit. Print help even for
|
|
||||||
options intended for developers.
|
|
||||||
|
|
||||||
=item B<--version>
|
|
||||||
|
|
||||||
Print version information and exit.
|
|
||||||
|
|
||||||
=item B<@>I<file>
|
|
||||||
|
|
||||||
Read command-line options from I<file>. The options read are inserted
|
|
||||||
in place of the original @I<file> option. If I<file> does not exist, or
|
|
||||||
cannot be read, then the option will be treated literally, and not
|
|
||||||
removed.
|
|
||||||
|
|
||||||
Options in I<file> are separated by whitespace. A whitespace character
|
|
||||||
may be included in an option by surrounding the entire option in
|
|
||||||
either single or double quotes. Any character (including a backslash)
|
|
||||||
may be included by prefixing the character to be included with a
|
|
||||||
backslash. The file may itself contain additional @I<file> options;
|
|
||||||
any such options will be processed recursively.
|
|
||||||
|
|
||||||
|
Record the amount of time each program (compilation tool) takes and print
|
||||||
|
it to the standard error.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
=head2 Language Specific Options
|
||||||
=head2 Control Options
|
|
||||||
|
|
||||||
By default, LLVMC is built with some standard configuration libraries
|
|
||||||
that define the following options:
|
|
||||||
|
|
||||||
=over
|
=over
|
||||||
|
|
||||||
=item B<-clang>
|
=item B<-T,pre>=I<options>
|
||||||
|
|
||||||
Use Clang instead of llvm-gcc.
|
Pass an arbitrary option to the pre-processor.
|
||||||
|
|
||||||
=item B<-opt>
|
=item B<-T,opt>=I<options>
|
||||||
|
|
||||||
Enable optimization with B<opt>.
|
Pass an arbitrary option to the optimizer.
|
||||||
|
|
||||||
=item B<-I> I<directory>
|
=item B<-T,lnk>=I<options>
|
||||||
|
|
||||||
Add a directory to the header file search path. This option can be
|
Pass an arbitrary option to the linker.
|
||||||
repeated.
|
|
||||||
|
|
||||||
=item B<-L> I<directory>
|
=item B<-T,asm>=I<options>
|
||||||
|
|
||||||
Add I<directory> to the library search path. This option can be
|
Pass an arbitrary option to the code generator.
|
||||||
repeated.
|
|
||||||
|
|
||||||
=item B<-l>I<name>
|
|
||||||
|
|
||||||
Link in the library libI<name>.[bc | a | so]. This library should
|
|
||||||
be a bitcode library.
|
|
||||||
|
|
||||||
=item B<-emit-llvm>
|
|
||||||
|
|
||||||
Make the output be LLVM bitcode (with B<-c>) or assembly (with B<-S>) instead
|
|
||||||
of native object (or assembly). If B<-emit-llvm> is given without either B<-c>
|
|
||||||
or B<-S> it has no effect.
|
|
||||||
|
|
||||||
=item B<-Wa>
|
|
||||||
|
|
||||||
Pass options to assembler.
|
|
||||||
|
|
||||||
=item B<-Wl>
|
|
||||||
|
|
||||||
Pass options to linker.
|
|
||||||
|
|
||||||
=item B<-Wo>
|
|
||||||
|
|
||||||
Pass options to opt.
|
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
=head2 C/C++ Specific Options
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<-I>F<path>
|
||||||
|
|
||||||
|
This option is just passed through to a C or C++ front end compiler to tell it
|
||||||
|
where include files can be found.
|
||||||
|
|
||||||
|
=item B<-D>F<symbol>
|
||||||
|
|
||||||
|
This option is just passed through to a C or C++ front end compiler to tell it
|
||||||
|
to define a symbol.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head2 Miscellaneous Options
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<--help>
|
||||||
|
|
||||||
|
Print a summary of command line options.
|
||||||
|
|
||||||
|
=item B<--version>
|
||||||
|
|
||||||
|
This option will cause B<llvmc> to print out its version number and terminate.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head2 Advanced Options
|
||||||
|
|
||||||
|
You better know what you're doing if you use these options. Improper use
|
||||||
|
of these options can produce drastically wrong results.
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<--config-dir> F<dirname>
|
||||||
|
|
||||||
|
This option tells B<llvmc> to read configuration data from the I<directory>
|
||||||
|
named F<dirname>. Data from such directories will be read in the order
|
||||||
|
specified on the command line after all other standard configuration files have
|
||||||
|
been read. This allows users or groups of users to conveniently create
|
||||||
|
their own configuration directories in addition to the standard ones to which
|
||||||
|
they may not have write access.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
|
||||||
|
=head2 Unimplemented Options
|
||||||
|
|
||||||
|
The options below are not currently implemented in B<llvmc> but will be
|
||||||
|
eventually. They are documented here as "future design".
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<--show-config> I<[suffixes...]>
|
||||||
|
|
||||||
|
When this option is given, the only action taken by B<llvmc> is to show its
|
||||||
|
final configuration state in the form of a configuration file. No compilation
|
||||||
|
tasks will be conducted when this option is given; processing will stop once
|
||||||
|
the configuration has been printed. The optional (comma separated) list of
|
||||||
|
suffixes controls what is printed. Without any suffixes, the configuration
|
||||||
|
for all languages is printed. With suffixes, only the languages pertaining
|
||||||
|
to those file suffixes will be printed. The configuration information is
|
||||||
|
printed after all command line options and configuration files have been
|
||||||
|
read and processed. This allows the user to verify that the correct
|
||||||
|
configuration data has been read by B<llvmc>.
|
||||||
|
|
||||||
|
=item B<--config> :I<section>:I<name>=I<value>
|
||||||
|
|
||||||
|
This option instructs B<llvmc> to accept I<value> as the value for configuration
|
||||||
|
item I<name> in the section named I<section>. This is a quick way to override
|
||||||
|
a configuration item on the command line without resorting to changing the
|
||||||
|
configuration files.
|
||||||
|
|
||||||
|
=item B<--config-only-from> F<dirname>
|
||||||
|
|
||||||
|
This option tells B<llvmc> to skip the normal processing of configuration
|
||||||
|
files and only configure from the contents of the F<dirname> directory. Multiple
|
||||||
|
B<--config-only-from> options may be given in which case the directories are
|
||||||
|
read in the order given on the command line.
|
||||||
|
|
||||||
|
=item B<--emit-raw-code>
|
||||||
|
|
||||||
|
No optimization is done whatsoever. The compilers invoked by B<llvmc> with
|
||||||
|
this option given will be instructed to produce raw, unoptimized code. This
|
||||||
|
option is useful only to front end language developers and therefore does not
|
||||||
|
participate in the list of B<-O> options. This is distinctly different from
|
||||||
|
the B<-O0> option (a synonym for B<-O1>) because those optimizations will
|
||||||
|
reduce code size to make compilation faster. With B<--emit-raw-code>, only
|
||||||
|
the full raw code produced by the compiler will be generated.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
|
||||||
=head1 EXIT STATUS
|
=head1 EXIT STATUS
|
||||||
|
|
||||||
If B<llvmc> succeeds, it will exit with code 0. Otherwise, if an
|
If B<llvmc> succeeds, it will exit with 0. Otherwise, if an error
|
||||||
error occurs, it will exit with a non-zero value. If one of the
|
occurs, it will exit with a non-zero value and no compilation actions
|
||||||
compilation tools returns a non-zero status, pending actions will be
|
will be taken. If one of the compilation tools returns a non-zero
|
||||||
discarded and B<llvmc> will return the same result code as the failing
|
status, pending actions will be discarded and B<llvmc> will return the
|
||||||
compilation tool.
|
same result code as the failing compilation tool.
|
||||||
|
|
||||||
|
=head1 DEFICIENCIES
|
||||||
|
|
||||||
|
B<llvmc> is considered an experimental LLVM tool because it has these
|
||||||
|
deficiencies:
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item Insufficient support for native linking
|
||||||
|
|
||||||
|
Because B<llvm-ld> doesn't handle native linking, neither can B<llvmc>
|
||||||
|
|
||||||
|
=item Poor configuration support
|
||||||
|
|
||||||
|
The support for configuring new languages, etc. is weak. There are many
|
||||||
|
command line configurations that cannot be achieved with the current
|
||||||
|
support. Furthermore the grammar is cumbersome for configuration files.
|
||||||
|
Please see L<http://llvm.org/PR686> for further details.
|
||||||
|
|
||||||
|
=item Does not handle target specific configurations
|
||||||
|
|
||||||
|
This is one of the major deficiencies, also addressed in
|
||||||
|
L<http://llvm.org/PR686>
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
=head1 SEE ALSO
|
=head1 SEE ALSO
|
||||||
|
|
||||||
L<llvm-gcc|llvmgcc>, L<llvm-g++|llvmgxx>, L<llvm-as|llvm-as>,
|
L<llvm-as|llvm-as>, L<llvm-dis|llvm-dis>, L<llc|llc>, L<llvm-link|llvm-link>
|
||||||
L<llvm-dis|llvm-dis>, L<llc|llc>, L<llvm-link|llvm-link>
|
|
||||||
|
|
||||||
=head1 AUTHORS
|
=head1 AUTHORS
|
||||||
|
|
||||||
|
|||||||
@@ -12,17 +12,15 @@ B<llvm-gcc> [I<options>] I<filename>
|
|||||||
|
|
||||||
The B<llvm-gcc> command is the LLVM C front end. It is a modified
|
The B<llvm-gcc> command is the LLVM C front end. It is a modified
|
||||||
version of gcc that compiles C/ObjC programs into native objects, LLVM
|
version of gcc that compiles C/ObjC programs into native objects, LLVM
|
||||||
bitcode or LLVM assembly language, depending upon the options.
|
bytecode or LLVM assembly language, depending upon the options.
|
||||||
|
|
||||||
By default, B<llvm-gcc> compiles to native objects just like GCC does. If the
|
By default, B<llvm-gcc> compiles to native objects just like GCC does. If the
|
||||||
B<-emit-llvm> and B<-c> options are given then it will generate LLVM bitcode files
|
B<-emit-llvm> option is given then it will generate LLVM bytecode files instead.
|
||||||
instead. If B<-emit-llvm> and B<-S> are given, then it will generate LLVM
|
If B<-S> (assembly) is also given, then it will generate LLVM assembly.
|
||||||
assembly.
|
|
||||||
|
|
||||||
Being derived from the GNU Compiler Collection, B<llvm-gcc> has many
|
Being derived from the GNU Compiler Collection, B<llvm-gcc> has many
|
||||||
of gcc's features and accepts most of gcc's options. It handles a
|
of gcc's features and accepts most of gcc's options. It handles a
|
||||||
number of gcc's extensions to the C programming language. See the gcc
|
number of gcc's extensions to the C programming language.
|
||||||
documentation for details.
|
|
||||||
|
|
||||||
=head1 OPTIONS
|
=head1 OPTIONS
|
||||||
|
|
||||||
@@ -32,6 +30,18 @@ documentation for details.
|
|||||||
|
|
||||||
Print a summary of command line options.
|
Print a summary of command line options.
|
||||||
|
|
||||||
|
=item B<-S>
|
||||||
|
|
||||||
|
Do not generate an LLVM bytecode file. Rather, compile the source
|
||||||
|
file into an LLVM assembly language file.
|
||||||
|
|
||||||
|
=item B<-c>
|
||||||
|
|
||||||
|
Do not generate a linked executable. Rather, compile the source
|
||||||
|
file into an LLVM bytecode file. This bytecode file can then be
|
||||||
|
linked with other bytecode files later on to generate a full LLVM
|
||||||
|
executable.
|
||||||
|
|
||||||
=item B<-o> I<filename>
|
=item B<-o> I<filename>
|
||||||
|
|
||||||
Specify the output file to be I<filename>.
|
Specify the output file to be I<filename>.
|
||||||
@@ -49,13 +59,12 @@ repeated.
|
|||||||
=item B<-l>I<name>
|
=item B<-l>I<name>
|
||||||
|
|
||||||
Link in the library libI<name>.[bc | a | so]. This library should
|
Link in the library libI<name>.[bc | a | so]. This library should
|
||||||
be a bitcode library.
|
be a bytecode library.
|
||||||
|
|
||||||
=item B<-emit-llvm>
|
=item B<-emit-llvm>
|
||||||
|
|
||||||
Make the output be LLVM bitcode (with B<-c>) or assembly (with B<-s>) instead
|
Make the output be LLVM bytecode (or assembly) instead of native object (or
|
||||||
of native object (or assembly). If B<-emit-llvm> is given without either B<-c>
|
assembly).
|
||||||
or B<-S> it has no effect.
|
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ B<llvm-g++> [I<options>] I<filename>
|
|||||||
|
|
||||||
The B<llvm-g++> command is the LLVM C++ front end. It is a modified
|
The B<llvm-g++> command is the LLVM C++ front end. It is a modified
|
||||||
version of g++ that compiles C++/ObjC++ programs into native code,
|
version of g++ that compiles C++/ObjC++ programs into native code,
|
||||||
LLVM bitcode or assembly language, depending upon the options.
|
LLVM bytecode or assembly language, depending upon the options.
|
||||||
|
|
||||||
By default, B<llvm-g++> compiles to native objects just like GCC does. If the
|
By default, B<llvm-g++> compiles to native objects just like GCC does. If the
|
||||||
B<-emit-llvm> option is given then it will generate LLVM bitcode files instead.
|
B<-emit-llvm> option is given then it will generate LLVM bytecode files instead.
|
||||||
If B<-S> (assembly) is also given, then it will generate LLVM assembly.
|
If B<-S> (assembly) is also given, then it will generate LLVM assembly.
|
||||||
|
|
||||||
Being derived from the GNU Compiler Collection, B<llvm-g++> has many
|
Being derived from the GNU Compiler Collection, B<llvm-g++> has many
|
||||||
@@ -32,14 +32,14 @@ Print a summary of command line options.
|
|||||||
|
|
||||||
=item B<-S>
|
=item B<-S>
|
||||||
|
|
||||||
Do not generate an LLVM bitcode file. Rather, compile the source
|
Do not generate an LLVM bytecode file. Rather, compile the source
|
||||||
file into an LLVM assembly language file.
|
file into an LLVM assembly language file.
|
||||||
|
|
||||||
=item B<-c>
|
=item B<-c>
|
||||||
|
|
||||||
Do not generate a linked executable. Rather, compile the source
|
Do not generate a linked executable. Rather, compile the source
|
||||||
file into an LLVM bitcode file. This bitcode file can then be
|
file into an LLVM bytecode file. This bytecode file can then be
|
||||||
linked with other bitcode files later on to generate a full LLVM
|
linked with other bytecode files later on to generate a full LLVM
|
||||||
executable.
|
executable.
|
||||||
|
|
||||||
=item B<-o> I<filename>
|
=item B<-o> I<filename>
|
||||||
@@ -59,11 +59,11 @@ repeated.
|
|||||||
=item B<-l>I<name>
|
=item B<-l>I<name>
|
||||||
|
|
||||||
Link in the library libI<name>.[bc | a | so]. This library should
|
Link in the library libI<name>.[bc | a | so]. This library should
|
||||||
be a bitcode library.
|
be a bytecode library.
|
||||||
|
|
||||||
=item B<-emit-llvm>
|
=item B<-emit-llvm>
|
||||||
|
|
||||||
Make the output be LLVM bitcode (or assembly) instead of native object (or
|
Make the output be LLVM bytecode (or assembly) instead of native object (or
|
||||||
assembly).
|
assembly).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|||||||
1
llvm/docs/CommandGuide/man/.cvsignore
Normal file
1
llvm/docs/CommandGuide/man/.cvsignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.dir
|
||||||
2
llvm/docs/CommandGuide/man/man1/.cvsignore
Normal file
2
llvm/docs/CommandGuide/man/man1/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*.1
|
||||||
|
.dir
|
||||||
240
llvm/docs/CommandGuide/man/man1/bugpoint.1
Normal file
240
llvm/docs/CommandGuide/man/man1/bugpoint.1
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
|
||||||
|
.\"
|
||||||
|
.\" Standard preamble:
|
||||||
|
.\" ========================================================================
|
||||||
|
.de Sh \" Subsection heading
|
||||||
|
.br
|
||||||
|
.if t .Sp
|
||||||
|
.ne 5
|
||||||
|
.PP
|
||||||
|
\fB\\$1\fR
|
||||||
|
.PP
|
||||||
|
..
|
||||||
|
.de Sp \" Vertical space (when we can't use .PP)
|
||||||
|
.if t .sp .5v
|
||||||
|
.if n .sp
|
||||||
|
..
|
||||||
|
.de Vb \" Begin verbatim text
|
||||||
|
.ft CW
|
||||||
|
.nf
|
||||||
|
.ne \\$1
|
||||||
|
..
|
||||||
|
.de Ve \" End verbatim text
|
||||||
|
.ft R
|
||||||
|
.fi
|
||||||
|
..
|
||||||
|
.\" Set up some character translations and predefined strings. \*(-- will
|
||||||
|
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
||||||
|
.\" double quote, and \*(R" will give a right double quote. | will give a
|
||||||
|
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
|
||||||
|
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
|
||||||
|
.\" expand to `' in nroff, nothing in troff, for use with C<>.
|
||||||
|
.tr \(*W-|\(bv\*(Tr
|
||||||
|
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
||||||
|
.ie n \{\
|
||||||
|
. ds -- \(*W-
|
||||||
|
. ds PI pi
|
||||||
|
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
||||||
|
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
||||||
|
. ds L" ""
|
||||||
|
. ds R" ""
|
||||||
|
. ds C` ""
|
||||||
|
. ds C' ""
|
||||||
|
'br\}
|
||||||
|
.el\{\
|
||||||
|
. ds -- \|\(em\|
|
||||||
|
. ds PI \(*p
|
||||||
|
. ds L" ``
|
||||||
|
. ds R" ''
|
||||||
|
'br\}
|
||||||
|
.\"
|
||||||
|
.\" If the F register is turned on, we'll generate index entries on stderr for
|
||||||
|
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
|
||||||
|
.\" entries marked with X<> in POD. Of course, you'll have to process the
|
||||||
|
.\" output yourself in some meaningful fashion.
|
||||||
|
.if \nF \{\
|
||||||
|
. de IX
|
||||||
|
. tm Index:\\$1\t\\n%\t"\\$2"
|
||||||
|
..
|
||||||
|
. nr % 0
|
||||||
|
. rr F
|
||||||
|
.\}
|
||||||
|
.\"
|
||||||
|
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
||||||
|
.\" way too many mistakes in technical documents.
|
||||||
|
.hy 0
|
||||||
|
.if n .na
|
||||||
|
.\"
|
||||||
|
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
||||||
|
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
||||||
|
. \" fudge factors for nroff and troff
|
||||||
|
.if n \{\
|
||||||
|
. ds #H 0
|
||||||
|
. ds #V .8m
|
||||||
|
. ds #F .3m
|
||||||
|
. ds #[ \f1
|
||||||
|
. ds #] \fP
|
||||||
|
.\}
|
||||||
|
.if t \{\
|
||||||
|
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
||||||
|
. ds #V .6m
|
||||||
|
. ds #F 0
|
||||||
|
. ds #[ \&
|
||||||
|
. ds #] \&
|
||||||
|
.\}
|
||||||
|
. \" simple accents for nroff and troff
|
||||||
|
.if n \{\
|
||||||
|
. ds ' \&
|
||||||
|
. ds ` \&
|
||||||
|
. ds ^ \&
|
||||||
|
. ds , \&
|
||||||
|
. ds ~ ~
|
||||||
|
. ds /
|
||||||
|
.\}
|
||||||
|
.if t \{\
|
||||||
|
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
||||||
|
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
||||||
|
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
||||||
|
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
||||||
|
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
||||||
|
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
||||||
|
.\}
|
||||||
|
. \" troff and (daisy-wheel) nroff accents
|
||||||
|
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
||||||
|
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
||||||
|
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
||||||
|
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
||||||
|
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
||||||
|
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
||||||
|
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
||||||
|
.ds ae a\h'-(\w'a'u*4/10)'e
|
||||||
|
.ds Ae A\h'-(\w'A'u*4/10)'E
|
||||||
|
. \" corrections for vroff
|
||||||
|
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
||||||
|
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
||||||
|
. \" for low resolution devices (crt and lpr)
|
||||||
|
.if \n(.H>23 .if \n(.V>19 \
|
||||||
|
\{\
|
||||||
|
. ds : e
|
||||||
|
. ds 8 ss
|
||||||
|
. ds o a
|
||||||
|
. ds d- d\h'-1'\(ga
|
||||||
|
. ds D- D\h'-1'\(hy
|
||||||
|
. ds th \o'bp'
|
||||||
|
. ds Th \o'LP'
|
||||||
|
. ds ae ae
|
||||||
|
. ds Ae AE
|
||||||
|
.\}
|
||||||
|
.rm #[ #] #H #V #F C
|
||||||
|
.\" ========================================================================
|
||||||
|
.\"
|
||||||
|
.IX Title "BUGPOINT 1"
|
||||||
|
.TH BUGPOINT 1 "2006-09-13" "CVS" "LLVM Command Guide"
|
||||||
|
.SH "NAME"
|
||||||
|
bugpoint \- automatic test case reduction tool
|
||||||
|
.SH "SYNOPSIS"
|
||||||
|
.IX Header "SYNOPSIS"
|
||||||
|
\&\fBbugpoint\fR [\fIoptions\fR] [\fIinput \s-1LLVM\s0 ll/bc files\fR] [\fI\s-1LLVM\s0 passes\fR] \fB\-\-args\fR
|
||||||
|
\&\fIprogram arguments\fR
|
||||||
|
.SH "DESCRIPTION"
|
||||||
|
.IX Header "DESCRIPTION"
|
||||||
|
\&\fBbugpoint\fR narrows down the source of problems in \s-1LLVM\s0 tools and passes. It
|
||||||
|
can be used to debug three types of failures: optimizer crashes, miscompilations
|
||||||
|
by optimizers, or bad native code generation (including problems in the static
|
||||||
|
and \s-1JIT\s0 compilers). It aims to reduce large test cases to small, useful ones.
|
||||||
|
For more information on the design and inner workings of \fBbugpoint\fR, as well as
|
||||||
|
advice for using bugpoint, see \fIllvm/docs/Bugpoint.html\fR in the \s-1LLVM\s0
|
||||||
|
distribution.
|
||||||
|
.SH "OPTIONS"
|
||||||
|
.IX Header "OPTIONS"
|
||||||
|
.IP "\fB\-\-additional\-so\fR \fIlibrary\fR" 4
|
||||||
|
.IX Item "--additional-so library"
|
||||||
|
Load the dynamic shared object \fIlibrary\fR into the test program whenever it is
|
||||||
|
run. This is useful if you are debugging programs which depend on non-LLVM
|
||||||
|
libraries (such as the X or curses libraries) to run.
|
||||||
|
.IP "\fB\-\-args\fR \fIprogram args\fR" 4
|
||||||
|
.IX Item "--args program args"
|
||||||
|
Pass all arguments specified after \-args to the test program whenever it runs.
|
||||||
|
Note that if any of the \fIprogram args\fR start with a '\-', you should use:
|
||||||
|
.Sp
|
||||||
|
.Vb 1
|
||||||
|
\& bugpoint [bugpoint args] --args -- [program args]
|
||||||
|
.Ve
|
||||||
|
.Sp
|
||||||
|
The \*(L"\-\-\*(R" right after the \fB\-\-args\fR option tells \fBbugpoint\fR to consider any
|
||||||
|
options starting with \f(CW\*(C`\-\*(C'\fR to be part of the \fB\-\-args\fR option, not as options to
|
||||||
|
\&\fBbugpoint\fR itself.
|
||||||
|
.IP "\fB\-\-tool\-args\fR \fItool args\fR" 4
|
||||||
|
.IX Item "--tool-args tool args"
|
||||||
|
Pass all arguments specified after \-\-tool\-args to the \s-1LLVM\s0 tool under test
|
||||||
|
(\fBllc\fR, \fBlli\fR, etc.) whenever it runs. You should use this option in the
|
||||||
|
following way:
|
||||||
|
.Sp
|
||||||
|
.Vb 1
|
||||||
|
\& bugpoint [bugpoint args] --tool-args -- [tool args]
|
||||||
|
.Ve
|
||||||
|
.Sp
|
||||||
|
The \*(L"\-\-\*(R" right after the \fB\-\-tool\-args\fR option tells \fBbugpoint\fR to consider any
|
||||||
|
options starting with \f(CW\*(C`\-\*(C'\fR to be part of the \fB\-\-tool\-args\fR option, not as
|
||||||
|
options to \fBbugpoint\fR itself. (See \fB\-\-args\fR, above.)
|
||||||
|
.IP "\fB\-\-check\-exit\-code\fR=\fI{true,false}\fR" 4
|
||||||
|
.IX Item "--check-exit-code={true,false}"
|
||||||
|
Assume a non-zero exit code or core dump from the test program is a failure.
|
||||||
|
Defaults to true.
|
||||||
|
.IP "\fB\-\-disable\-{dce,simplifycfg}\fR" 4
|
||||||
|
.IX Item "--disable-{dce,simplifycfg}"
|
||||||
|
Do not run the specified passes to clean up and reduce the size of the test
|
||||||
|
program. By default, \fBbugpoint\fR uses these passes internally when attempting to
|
||||||
|
reduce test programs. If you're trying to find a bug in one of these passes,
|
||||||
|
\&\fBbugpoint\fR may crash.
|
||||||
|
.IP "\fB\-find\-bugs\fR" 4
|
||||||
|
.IX Item "-find-bugs"
|
||||||
|
Continually randomize the specified passes and run them on the test program
|
||||||
|
until a bug is found or the user kills \fBbugpoint\fR.
|
||||||
|
.IP "\fB\-\-help\fR" 4
|
||||||
|
.IX Item "--help"
|
||||||
|
Print a summary of command line options.
|
||||||
|
.IP "\fB\-\-input\fR \fIfilename\fR" 4
|
||||||
|
.IX Item "--input filename"
|
||||||
|
Open \fIfilename\fR and redirect the standard input of the test program, whenever
|
||||||
|
it runs, to come from that file.
|
||||||
|
.IP "\fB\-\-load\fR \fIplugin\fR" 4
|
||||||
|
.IX Item "--load plugin"
|
||||||
|
Load the dynamic object \fIplugin\fR into \fBbugpoint\fR itself. This object should
|
||||||
|
register new optimization passes. Once loaded, the object will add new command
|
||||||
|
line options to enable various optimizations. To see the new complete list of
|
||||||
|
optimizations, use the \fB\-\-help\fR and \fB\-\-load\fR options together; for example:
|
||||||
|
.Sp
|
||||||
|
.Vb 1
|
||||||
|
\& bugpoint --load myNewPass.so --help
|
||||||
|
.Ve
|
||||||
|
.IP "\fB\-\-output\fR \fIfilename\fR" 4
|
||||||
|
.IX Item "--output filename"
|
||||||
|
Whenever the test program produces output on its standard output stream, it
|
||||||
|
should match the contents of \fIfilename\fR (the \*(L"reference output\*(R"). If you
|
||||||
|
do not use this option, \fBbugpoint\fR will attempt to generate a reference output
|
||||||
|
by compiling the program with the C backend and running it.
|
||||||
|
.IP "\fB\-\-profile\-info\-file\fR \fIfilename\fR" 4
|
||||||
|
.IX Item "--profile-info-file filename"
|
||||||
|
Profile file loaded by \fB\-\-profile\-loader\fR.
|
||||||
|
.IP "\fB\-\-run\-{int,jit,llc,cbe}\fR" 4
|
||||||
|
.IX Item "--run-{int,jit,llc,cbe}"
|
||||||
|
Whenever the test program is compiled, \fBbugpoint\fR should generate code for it
|
||||||
|
using the specified code generator. These options allow you to choose the
|
||||||
|
interpreter, the \s-1JIT\s0 compiler, the static native code compiler, or the C
|
||||||
|
backend, respectively.
|
||||||
|
.IP "\fB\-\-enable\-valgrind\fR" 4
|
||||||
|
.IX Item "--enable-valgrind"
|
||||||
|
Use valgrind to find faults in the optimization phase. This will allow
|
||||||
|
bugpoint to find otherwise asymptomatic problems caused by memory
|
||||||
|
mis\-management.
|
||||||
|
.SH "EXIT STATUS"
|
||||||
|
.IX Header "EXIT STATUS"
|
||||||
|
If \fBbugpoint\fR succeeds in finding a problem, it will exit with 0. Otherwise,
|
||||||
|
if an error occurs, it will exit with a non-zero value.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.IX Header "SEE ALSO"
|
||||||
|
opt
|
||||||
|
.SH "AUTHOR"
|
||||||
|
.IX Header "AUTHOR"
|
||||||
|
Maintained by the \s-1LLVM\s0 Team (<http://llvm.org>).
|
||||||
277
llvm/docs/CommandGuide/man/man1/llc.1
Normal file
277
llvm/docs/CommandGuide/man/man1/llc.1
Normal file
@@ -0,0 +1,277 @@
|
|||||||
|
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
|
||||||
|
.\"
|
||||||
|
.\" Standard preamble:
|
||||||
|
.\" ========================================================================
|
||||||
|
.de Sh \" Subsection heading
|
||||||
|
.br
|
||||||
|
.if t .Sp
|
||||||
|
.ne 5
|
||||||
|
.PP
|
||||||
|
\fB\\$1\fR
|
||||||
|
.PP
|
||||||
|
..
|
||||||
|
.de Sp \" Vertical space (when we can't use .PP)
|
||||||
|
.if t .sp .5v
|
||||||
|
.if n .sp
|
||||||
|
..
|
||||||
|
.de Vb \" Begin verbatim text
|
||||||
|
.ft CW
|
||||||
|
.nf
|
||||||
|
.ne \\$1
|
||||||
|
..
|
||||||
|
.de Ve \" End verbatim text
|
||||||
|
.ft R
|
||||||
|
.fi
|
||||||
|
..
|
||||||
|
.\" Set up some character translations and predefined strings. \*(-- will
|
||||||
|
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
||||||
|
.\" double quote, and \*(R" will give a right double quote. | will give a
|
||||||
|
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
|
||||||
|
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
|
||||||
|
.\" expand to `' in nroff, nothing in troff, for use with C<>.
|
||||||
|
.tr \(*W-|\(bv\*(Tr
|
||||||
|
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
||||||
|
.ie n \{\
|
||||||
|
. ds -- \(*W-
|
||||||
|
. ds PI pi
|
||||||
|
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
||||||
|
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
||||||
|
. ds L" ""
|
||||||
|
. ds R" ""
|
||||||
|
. ds C` ""
|
||||||
|
. ds C' ""
|
||||||
|
'br\}
|
||||||
|
.el\{\
|
||||||
|
. ds -- \|\(em\|
|
||||||
|
. ds PI \(*p
|
||||||
|
. ds L" ``
|
||||||
|
. ds R" ''
|
||||||
|
'br\}
|
||||||
|
.\"
|
||||||
|
.\" If the F register is turned on, we'll generate index entries on stderr for
|
||||||
|
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
|
||||||
|
.\" entries marked with X<> in POD. Of course, you'll have to process the
|
||||||
|
.\" output yourself in some meaningful fashion.
|
||||||
|
.if \nF \{\
|
||||||
|
. de IX
|
||||||
|
. tm Index:\\$1\t\\n%\t"\\$2"
|
||||||
|
..
|
||||||
|
. nr % 0
|
||||||
|
. rr F
|
||||||
|
.\}
|
||||||
|
.\"
|
||||||
|
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
||||||
|
.\" way too many mistakes in technical documents.
|
||||||
|
.hy 0
|
||||||
|
.if n .na
|
||||||
|
.\"
|
||||||
|
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
||||||
|
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
||||||
|
. \" fudge factors for nroff and troff
|
||||||
|
.if n \{\
|
||||||
|
. ds #H 0
|
||||||
|
. ds #V .8m
|
||||||
|
. ds #F .3m
|
||||||
|
. ds #[ \f1
|
||||||
|
. ds #] \fP
|
||||||
|
.\}
|
||||||
|
.if t \{\
|
||||||
|
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
||||||
|
. ds #V .6m
|
||||||
|
. ds #F 0
|
||||||
|
. ds #[ \&
|
||||||
|
. ds #] \&
|
||||||
|
.\}
|
||||||
|
. \" simple accents for nroff and troff
|
||||||
|
.if n \{\
|
||||||
|
. ds ' \&
|
||||||
|
. ds ` \&
|
||||||
|
. ds ^ \&
|
||||||
|
. ds , \&
|
||||||
|
. ds ~ ~
|
||||||
|
. ds /
|
||||||
|
.\}
|
||||||
|
.if t \{\
|
||||||
|
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
||||||
|
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
||||||
|
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
||||||
|
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
||||||
|
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
||||||
|
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
||||||
|
.\}
|
||||||
|
. \" troff and (daisy-wheel) nroff accents
|
||||||
|
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
||||||
|
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
||||||
|
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
||||||
|
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
||||||
|
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
||||||
|
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
||||||
|
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
||||||
|
.ds ae a\h'-(\w'a'u*4/10)'e
|
||||||
|
.ds Ae A\h'-(\w'A'u*4/10)'E
|
||||||
|
. \" corrections for vroff
|
||||||
|
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
||||||
|
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
||||||
|
. \" for low resolution devices (crt and lpr)
|
||||||
|
.if \n(.H>23 .if \n(.V>19 \
|
||||||
|
\{\
|
||||||
|
. ds : e
|
||||||
|
. ds 8 ss
|
||||||
|
. ds o a
|
||||||
|
. ds d- d\h'-1'\(ga
|
||||||
|
. ds D- D\h'-1'\(hy
|
||||||
|
. ds th \o'bp'
|
||||||
|
. ds Th \o'LP'
|
||||||
|
. ds ae ae
|
||||||
|
. ds Ae AE
|
||||||
|
.\}
|
||||||
|
.rm #[ #] #H #V #F C
|
||||||
|
.\" ========================================================================
|
||||||
|
.\"
|
||||||
|
.IX Title "LLC 1"
|
||||||
|
.TH LLC 1 "2006-03-13" "CVS" "LLVM Command Guide"
|
||||||
|
.SH "NAME"
|
||||||
|
llc \- LLVM static compiler
|
||||||
|
.SH "SYNOPSIS"
|
||||||
|
.IX Header "SYNOPSIS"
|
||||||
|
\&\fBllc\fR [\fIoptions\fR] [\fIfilename\fR]
|
||||||
|
.SH "DESCRIPTION"
|
||||||
|
.IX Header "DESCRIPTION"
|
||||||
|
The \fBllc\fR command compiles \s-1LLVM\s0 bytecode into assembly language for a
|
||||||
|
specified architecture. The assembly language output can then be passed through
|
||||||
|
a native assembler and linker to generate a native executable.
|
||||||
|
.PP
|
||||||
|
The choice of architecture for the output assembly code is automatically
|
||||||
|
determined from the input bytecode file, unless the \fB\-march\fR option is used to
|
||||||
|
override the default.
|
||||||
|
.SH "OPTIONS"
|
||||||
|
.IX Header "OPTIONS"
|
||||||
|
If \fIfilename\fR is \- or omitted, \fBllc\fR reads \s-1LLVM\s0 bytecode from standard input.
|
||||||
|
Otherwise, it will read \s-1LLVM\s0 bytecode from \fIfilename\fR.
|
||||||
|
.PP
|
||||||
|
If the \fB\-o\fR option is omitted, then \fBllc\fR will send its output to standard
|
||||||
|
output if the input is from standard input. If the \fB\-o\fR option specifies \-,
|
||||||
|
then the output will also be sent to standard output.
|
||||||
|
.PP
|
||||||
|
If no \fB\-o\fR option is specified and an input file other than \- is specified,
|
||||||
|
then \fBllc\fR creates the output filename by taking the input filename,
|
||||||
|
removing any existing \fI.bc\fR extension, and adding a \fI.s\fR suffix.
|
||||||
|
.PP
|
||||||
|
Other \fBllc\fR options are as follows:
|
||||||
|
.Sh "End-user Options"
|
||||||
|
.IX Subsection "End-user Options"
|
||||||
|
.IP "\fB\-\-help\fR" 4
|
||||||
|
.IX Item "--help"
|
||||||
|
Print a summary of command line options.
|
||||||
|
.IP "\fB\-f\fR" 4
|
||||||
|
.IX Item "-f"
|
||||||
|
Overwrite output files. By default, \fBllc\fR will refuse to overwrite
|
||||||
|
an output file which already exists.
|
||||||
|
.IP "\fB\-mtriple\fR=\fItarget triple\fR" 4
|
||||||
|
.IX Item "-mtriple=target triple"
|
||||||
|
Override the target triple specified in the input bytecode file with the
|
||||||
|
specified string.
|
||||||
|
.IP "\fB\-march\fR=\fIarch\fR" 4
|
||||||
|
.IX Item "-march=arch"
|
||||||
|
Specify the architecture for which to generate assembly, overriding the target
|
||||||
|
encoded in the bytecode file. See the output of \fBllc \-\-help\fR for a list of
|
||||||
|
valid architectures. By default this is inferred from the target triple or
|
||||||
|
autodetected to the current architecture.
|
||||||
|
.IP "\fB\-mcpu\fR=\fIcpuname\fR" 4
|
||||||
|
.IX Item "-mcpu=cpuname"
|
||||||
|
Specify a specific chip in the current architecture to generate code for.
|
||||||
|
By default this is inferred from the target triple and autodetected to
|
||||||
|
the current architecture. For a list of available CPUs, use:
|
||||||
|
\&\fBllvm-as < /dev/null | llc \-march=xyz \-mcpu=help\fR
|
||||||
|
.IP "\fB\-mattr\fR=\fIa1,+a2,\-a3,...\fR" 4
|
||||||
|
.IX Item "-mattr=a1,+a2,-a3,..."
|
||||||
|
Override or control specific attributes of the target, such as whether \s-1SIMD\s0
|
||||||
|
operations are enabled or not. The default set of attributes is set by the
|
||||||
|
current \s-1CPU\s0. For a list of available attributes, use:
|
||||||
|
\&\fBllvm-as < /dev/null | llc \-march=xyz \-mattr=help\fR
|
||||||
|
.IP "\fB\-\-disable\-fp\-elim\fR" 4
|
||||||
|
.IX Item "--disable-fp-elim"
|
||||||
|
Disable frame pointer elimination optimization.
|
||||||
|
.IP "\fB\-\-disable\-excess\-fp\-precision\fR" 4
|
||||||
|
.IX Item "--disable-excess-fp-precision"
|
||||||
|
Disable optimizations that may produce excess precision for floating point.
|
||||||
|
Note that this option can dramatically slow down code on some systems
|
||||||
|
(e.g. X86).
|
||||||
|
.IP "\fB\-\-enable\-unsafe\-fp\-math\fR" 4
|
||||||
|
.IX Item "--enable-unsafe-fp-math"
|
||||||
|
Enable optimizations that make unsafe assumptions about \s-1IEEE\s0 math (e.g. that
|
||||||
|
addition is associative) or may not work for all input ranges. These
|
||||||
|
optimizations allow the code generator to make use of some instructions which
|
||||||
|
would otherwise not be usable (such as fsin on X86).
|
||||||
|
.IP "\fB\-\-enable\-correct\-eh\-support\fR" 4
|
||||||
|
.IX Item "--enable-correct-eh-support"
|
||||||
|
Instruct the \fBlowerinvoke\fR pass to insert code for correct exception handling
|
||||||
|
support. This is expensive and is by default omitted for efficiency.
|
||||||
|
.IP "\fB\-\-stats\fR" 4
|
||||||
|
.IX Item "--stats"
|
||||||
|
Print statistics recorded by code-generation passes.
|
||||||
|
.IP "\fB\-\-time\-passes\fR" 4
|
||||||
|
.IX Item "--time-passes"
|
||||||
|
Record the amount of time needed for each pass and print a report to standard
|
||||||
|
error.
|
||||||
|
.IP "\fB\-\-load\fR=\fIdso_path\fR" 4
|
||||||
|
.IX Item "--load=dso_path"
|
||||||
|
Dynamically load \fIdso_path\fR (a path to a dynamically shared object) that
|
||||||
|
implements an \s-1LLVM\s0 target. This will permit the target name to be used with the
|
||||||
|
\&\fB\-march\fR option so that code can be generated for that target.
|
||||||
|
.Sh "Tuning/Configuration Options"
|
||||||
|
.IX Subsection "Tuning/Configuration Options"
|
||||||
|
.IP "\fB\-\-print\-machineinstrs\fR" 4
|
||||||
|
.IX Item "--print-machineinstrs"
|
||||||
|
Print generated machine code between compilation phases (useful for debugging).
|
||||||
|
.IP "\fB\-\-regalloc\fR=\fIallocator\fR" 4
|
||||||
|
.IX Item "--regalloc=allocator"
|
||||||
|
Specify the register allocator to use. The default \fIallocator\fR is \fIlocal\fR.
|
||||||
|
Valid register allocators are:
|
||||||
|
.RS 4
|
||||||
|
.IP "\fIsimple\fR" 4
|
||||||
|
.IX Item "simple"
|
||||||
|
Very simple \*(L"always spill\*(R" register allocator
|
||||||
|
.IP "\fIlocal\fR" 4
|
||||||
|
.IX Item "local"
|
||||||
|
Local register allocator
|
||||||
|
.IP "\fIlinearscan\fR" 4
|
||||||
|
.IX Item "linearscan"
|
||||||
|
Linear scan global register allocator
|
||||||
|
.IP "\fIiterativescan\fR" 4
|
||||||
|
.IX Item "iterativescan"
|
||||||
|
Iterative scan global register allocator
|
||||||
|
.RE
|
||||||
|
.RS 4
|
||||||
|
.RE
|
||||||
|
.IP "\fB\-\-spiller\fR=\fIspiller\fR" 4
|
||||||
|
.IX Item "--spiller=spiller"
|
||||||
|
Specify the spiller to use for register allocators that support it. Currently
|
||||||
|
this option is used only by the linear scan register allocator. The default
|
||||||
|
\&\fIspiller\fR is \fIlocal\fR. Valid spillers are:
|
||||||
|
.RS 4
|
||||||
|
.IP "\fIsimple\fR" 4
|
||||||
|
.IX Item "simple"
|
||||||
|
Simple spiller
|
||||||
|
.IP "\fIlocal\fR" 4
|
||||||
|
.IX Item "local"
|
||||||
|
Local spiller
|
||||||
|
.RE
|
||||||
|
.RS 4
|
||||||
|
.RE
|
||||||
|
.Sh "Intel IA\-32\-specific Options"
|
||||||
|
.IX Subsection "Intel IA-32-specific Options"
|
||||||
|
.IP "\fB\-\-x86\-asm\-syntax=att|intel\fR" 4
|
||||||
|
.IX Item "--x86-asm-syntax=att|intel"
|
||||||
|
Specify whether to emit assembly code in \s-1AT&T\s0 syntax (the default) or intel
|
||||||
|
syntax.
|
||||||
|
.SH "EXIT STATUS"
|
||||||
|
.IX Header "EXIT STATUS"
|
||||||
|
If \fBllc\fR succeeds, it will exit with 0. Otherwise, if an error occurs,
|
||||||
|
it will exit with a non-zero value.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.IX Header "SEE ALSO"
|
||||||
|
lli
|
||||||
|
.SH "AUTHORS"
|
||||||
|
.IX Header "AUTHORS"
|
||||||
|
Maintained by the \s-1LLVM\s0 Team (<http://llvm.org>).
|
||||||
206
llvm/docs/CommandGuide/man/man1/lli.1
Normal file
206
llvm/docs/CommandGuide/man/man1/lli.1
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
|
||||||
|
.\"
|
||||||
|
.\" Standard preamble:
|
||||||
|
.\" ========================================================================
|
||||||
|
.de Sh \" Subsection heading
|
||||||
|
.br
|
||||||
|
.if t .Sp
|
||||||
|
.ne 5
|
||||||
|
.PP
|
||||||
|
\fB\\$1\fR
|
||||||
|
.PP
|
||||||
|
..
|
||||||
|
.de Sp \" Vertical space (when we can't use .PP)
|
||||||
|
.if t .sp .5v
|
||||||
|
.if n .sp
|
||||||
|
..
|
||||||
|
.de Vb \" Begin verbatim text
|
||||||
|
.ft CW
|
||||||
|
.nf
|
||||||
|
.ne \\$1
|
||||||
|
..
|
||||||
|
.de Ve \" End verbatim text
|
||||||
|
.ft R
|
||||||
|
.fi
|
||||||
|
..
|
||||||
|
.\" Set up some character translations and predefined strings. \*(-- will
|
||||||
|
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
||||||
|
.\" double quote, and \*(R" will give a right double quote. | will give a
|
||||||
|
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
|
||||||
|
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
|
||||||
|
.\" expand to `' in nroff, nothing in troff, for use with C<>.
|
||||||
|
.tr \(*W-|\(bv\*(Tr
|
||||||
|
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
||||||
|
.ie n \{\
|
||||||
|
. ds -- \(*W-
|
||||||
|
. ds PI pi
|
||||||
|
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
||||||
|
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
||||||
|
. ds L" ""
|
||||||
|
. ds R" ""
|
||||||
|
. ds C` ""
|
||||||
|
. ds C' ""
|
||||||
|
'br\}
|
||||||
|
.el\{\
|
||||||
|
. ds -- \|\(em\|
|
||||||
|
. ds PI \(*p
|
||||||
|
. ds L" ``
|
||||||
|
. ds R" ''
|
||||||
|
'br\}
|
||||||
|
.\"
|
||||||
|
.\" If the F register is turned on, we'll generate index entries on stderr for
|
||||||
|
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
|
||||||
|
.\" entries marked with X<> in POD. Of course, you'll have to process the
|
||||||
|
.\" output yourself in some meaningful fashion.
|
||||||
|
.if \nF \{\
|
||||||
|
. de IX
|
||||||
|
. tm Index:\\$1\t\\n%\t"\\$2"
|
||||||
|
..
|
||||||
|
. nr % 0
|
||||||
|
. rr F
|
||||||
|
.\}
|
||||||
|
.\"
|
||||||
|
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
||||||
|
.\" way too many mistakes in technical documents.
|
||||||
|
.hy 0
|
||||||
|
.if n .na
|
||||||
|
.\"
|
||||||
|
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
||||||
|
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
||||||
|
. \" fudge factors for nroff and troff
|
||||||
|
.if n \{\
|
||||||
|
. ds #H 0
|
||||||
|
. ds #V .8m
|
||||||
|
. ds #F .3m
|
||||||
|
. ds #[ \f1
|
||||||
|
. ds #] \fP
|
||||||
|
.\}
|
||||||
|
.if t \{\
|
||||||
|
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
||||||
|
. ds #V .6m
|
||||||
|
. ds #F 0
|
||||||
|
. ds #[ \&
|
||||||
|
. ds #] \&
|
||||||
|
.\}
|
||||||
|
. \" simple accents for nroff and troff
|
||||||
|
.if n \{\
|
||||||
|
. ds ' \&
|
||||||
|
. ds ` \&
|
||||||
|
. ds ^ \&
|
||||||
|
. ds , \&
|
||||||
|
. ds ~ ~
|
||||||
|
. ds /
|
||||||
|
.\}
|
||||||
|
.if t \{\
|
||||||
|
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
||||||
|
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
||||||
|
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
||||||
|
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
||||||
|
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
||||||
|
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
||||||
|
.\}
|
||||||
|
. \" troff and (daisy-wheel) nroff accents
|
||||||
|
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
||||||
|
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
||||||
|
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
||||||
|
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
||||||
|
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
||||||
|
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
||||||
|
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
||||||
|
.ds ae a\h'-(\w'a'u*4/10)'e
|
||||||
|
.ds Ae A\h'-(\w'A'u*4/10)'E
|
||||||
|
. \" corrections for vroff
|
||||||
|
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
||||||
|
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
||||||
|
. \" for low resolution devices (crt and lpr)
|
||||||
|
.if \n(.H>23 .if \n(.V>19 \
|
||||||
|
\{\
|
||||||
|
. ds : e
|
||||||
|
. ds 8 ss
|
||||||
|
. ds o a
|
||||||
|
. ds d- d\h'-1'\(ga
|
||||||
|
. ds D- D\h'-1'\(hy
|
||||||
|
. ds th \o'bp'
|
||||||
|
. ds Th \o'LP'
|
||||||
|
. ds ae ae
|
||||||
|
. ds Ae AE
|
||||||
|
.\}
|
||||||
|
.rm #[ #] #H #V #F C
|
||||||
|
.\" ========================================================================
|
||||||
|
.\"
|
||||||
|
.IX Title "LLI 1"
|
||||||
|
.TH LLI 1 "2006-03-13" "CVS" "LLVM Command Guide"
|
||||||
|
.SH "NAME"
|
||||||
|
lli \- directly execute programs from LLVM bytecode
|
||||||
|
.SH "SYNOPSIS"
|
||||||
|
.IX Header "SYNOPSIS"
|
||||||
|
\&\fBlli\fR [\fIoptions\fR] [\fIfilename\fR] [\fIprogram args\fR]
|
||||||
|
.SH "DESCRIPTION"
|
||||||
|
.IX Header "DESCRIPTION"
|
||||||
|
\&\fBlli\fR directly executes programs in \s-1LLVM\s0 bytecode format. It takes a program
|
||||||
|
in \s-1LLVM\s0 bytecode format and executes it using a just-in-time compiler, if one is
|
||||||
|
available for the current architecture, or an interpreter. \fBlli\fR takes all of
|
||||||
|
the same code generator options as llc, but they are only effective when
|
||||||
|
\&\fBlli\fR is using the just-in-time compiler.
|
||||||
|
.PP
|
||||||
|
If \fIfilename\fR is not specified, then \fBlli\fR reads the \s-1LLVM\s0 bytecode for the
|
||||||
|
program from standard input.
|
||||||
|
.PP
|
||||||
|
The optional \fIargs\fR specified on the command line are passed to the program as
|
||||||
|
arguments.
|
||||||
|
.SH "OPTIONS"
|
||||||
|
.IX Header "OPTIONS"
|
||||||
|
.IP "\fB\-help\fR" 4
|
||||||
|
.IX Item "-help"
|
||||||
|
Print a summary of command line options.
|
||||||
|
.IP "\fB\-stats\fR" 4
|
||||||
|
.IX Item "-stats"
|
||||||
|
Print statistics from the code-generation passes. This is only meaningful for
|
||||||
|
the just-in-time compiler, at present.
|
||||||
|
.IP "\fB\-time\-passes\fR" 4
|
||||||
|
.IX Item "-time-passes"
|
||||||
|
Record the amount of time needed for each code-generation pass and print it to
|
||||||
|
standard error.
|
||||||
|
.IP "\fB\-mtriple\fR=\fItarget triple\fR" 4
|
||||||
|
.IX Item "-mtriple=target triple"
|
||||||
|
Override the target triple specified in the input bytecode file with the
|
||||||
|
specified string. This may result in a crash if you pick an
|
||||||
|
architecture which is not compatible with the current system.
|
||||||
|
.IP "\fB\-march\fR=\fIarch\fR" 4
|
||||||
|
.IX Item "-march=arch"
|
||||||
|
Specify the architecture for which to generate assembly, overriding the target
|
||||||
|
encoded in the bytecode file. See the output of \fBllc \-\-help\fR for a list of
|
||||||
|
valid architectures. By default this is inferred from the target triple or
|
||||||
|
autodetected to the current architecture.
|
||||||
|
.IP "\fB\-mcpu\fR=\fIcpuname\fR" 4
|
||||||
|
.IX Item "-mcpu=cpuname"
|
||||||
|
Specify a specific chip in the current architecture to generate code for.
|
||||||
|
By default this is inferred from the target triple and autodetected to
|
||||||
|
the current architecture. For a list of available CPUs, use:
|
||||||
|
\&\fBllvm-as < /dev/null | llc \-march=xyz \-mcpu=help\fR
|
||||||
|
.IP "\fB\-mattr\fR=\fIa1,+a2,\-a3,...\fR" 4
|
||||||
|
.IX Item "-mattr=a1,+a2,-a3,..."
|
||||||
|
Override or control specific attributes of the target, such as whether \s-1SIMD\s0
|
||||||
|
operations are enabled or not. The default set of attributes is set by the
|
||||||
|
current \s-1CPU\s0. For a list of available attributes, use:
|
||||||
|
\&\fBllvm-as < /dev/null | llc \-march=xyz \-mattr=help\fR
|
||||||
|
.IP "\fB\-force\-interpreter\fR=\fI{false,true}\fR" 4
|
||||||
|
.IX Item "-force-interpreter={false,true}"
|
||||||
|
If set to true, use the interpreter even if a just-in-time compiler is available
|
||||||
|
for this architecture. Defaults to false.
|
||||||
|
.IP "\fB\-f\fR=\fIname\fR" 4
|
||||||
|
.IX Item "-f=name"
|
||||||
|
Call the function named \fIname\fR to start the program. Note: The
|
||||||
|
function is assumed to have the C signature \f(CW\*(C`int\*(C'\fR \fIname\fR \f(CW\*(C`(int,
|
||||||
|
char **, char **)\*(C'\fR. If you try to use this option to call a function of
|
||||||
|
incompatible type, undefined behavior may result. Defaults to \f(CW\*(C`main\*(C'\fR.
|
||||||
|
.SH "EXIT STATUS"
|
||||||
|
.IX Header "EXIT STATUS"
|
||||||
|
If \fBlli\fR fails to load the program, it will exit with an exit code of 1.
|
||||||
|
Otherwise, it will return the exit code of the program it executes.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.IX Header "SEE ALSO"
|
||||||
|
llc
|
||||||
|
.SH "AUTHOR"
|
||||||
|
.IX Header "AUTHOR"
|
||||||
|
Maintained by the \s-1LLVM\s0 Team (<http://llvm.org>).
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user