Compare commits
20 Commits
llvmorg-2.
...
llvmorg-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52a52a9911 | ||
|
|
2eed6e9122 | ||
|
|
44008a16b7 | ||
|
|
6e518e6326 | ||
|
|
f924987081 | ||
|
|
4452c27c9a | ||
|
|
02e054d107 | ||
|
|
9096e27509 | ||
|
|
42260d7716 | ||
|
|
faa1d1f04d | ||
|
|
0d6d28b38f | ||
|
|
4a0f8ad6f1 | ||
|
|
ccb2261ec3 | ||
|
|
b93e94b748 | ||
|
|
8b83d1b419 | ||
|
|
188c951004 | ||
|
|
cf7c329798 | ||
|
|
3d2a2eb218 | ||
|
|
6935fa4016 | ||
|
|
f37a450b62 |
5
llvm/.cvsignore
Normal file
5
llvm/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
mklib
|
||||
Makefile.config
|
||||
config.log
|
||||
config.status
|
||||
cvs.out
|
||||
234
llvm/CREDITS.TXT
234
llvm/CREDITS.TXT
@@ -1,7 +1,6 @@
|
||||
This file is a partial list of people who have contributed to the LLVM
|
||||
project. If you have contributed a patch or made some other contribution to
|
||||
LLVM, please submit a patch to this file to add yourself, and it will be
|
||||
done!
|
||||
Inspired by the CREDITS file from the Linux source tree, this file is,
|
||||
likewise, at least a partial list of people who have contributed to the LLVM
|
||||
project. The format and the next paragraph are stolen directly from that file.
|
||||
|
||||
The list is sorted by name and formatted to allow easy grepping and
|
||||
beautification by scripts. The fields are: name (N), email (E), web-address
|
||||
@@ -13,256 +12,47 @@ E: vadve@cs.uiuc.edu
|
||||
W: http://www.cs.uiuc.edu/~vadve/
|
||||
D: The Sparc64 backend, provider of much wisdom, and motivator for LLVM
|
||||
|
||||
N: Owen Anderson
|
||||
E: resistor@mac.com
|
||||
D: LCSSA pass and related LoopUnswitch work
|
||||
D: GVNPRE pass, TargetData refactoring, random improvements
|
||||
|
||||
N: Henrik Bach
|
||||
D: MingW Win32 API portability layer
|
||||
|
||||
N: Nate Begeman
|
||||
E: natebegeman@mac.com
|
||||
D: PowerPC backend developer
|
||||
D: Target-independent code generator and analysis improvements
|
||||
|
||||
N: Daniel Berlin
|
||||
E: dberlin@dberlin.org
|
||||
D: ET-Forest implementation.
|
||||
D: Sparse bitmap
|
||||
|
||||
N: Neil Booth
|
||||
E: neil@daikokuya.co.uk
|
||||
D: APFloat implementation.
|
||||
N: Tanya Brethour
|
||||
E: tonic@nondot.org
|
||||
W: http://nondot.org/~tonic/
|
||||
D: The llvm-ar tool
|
||||
|
||||
N: Misha Brukman
|
||||
E: brukman+llvm@uiuc.edu
|
||||
W: http://misha.brukman.net
|
||||
D: Portions of X86 and Sparc JIT compilers, PowerPC backend
|
||||
D: Incremental bytecode loader
|
||||
D: Portions of X86 and Sparc JIT compilers, incremental bytecode loader
|
||||
|
||||
N: Cameron Buschardt
|
||||
E: buschard@uiuc.edu
|
||||
D: The `mem2reg' pass - promotes values stored in memory to registers
|
||||
|
||||
N: Chandler Carruth
|
||||
E: chandlerc@gmail.com
|
||||
D: LinkTimeOptimizer for Linux, via binutils integration, and C API
|
||||
|
||||
N: Casey Carter
|
||||
E: ccarter@uiuc.edu
|
||||
D: Fixes to the Reassociation pass, various improvement patches
|
||||
|
||||
N: Evan Cheng
|
||||
E: evan.cheng@apple.com
|
||||
D: ARM and X86 backends
|
||||
D: Instruction scheduler improvements
|
||||
D: Register allocator improvements
|
||||
D: Loop optimizer improvements
|
||||
D: Target-independent code generator improvements
|
||||
|
||||
N: Jeff Cohen
|
||||
E: jeffc@jolt-lang.org
|
||||
W: http://jolt-lang.org
|
||||
D: Native Win32 API portability layer
|
||||
|
||||
N: John T. Criswell
|
||||
E: criswell@uiuc.edu
|
||||
D: Original Autoconf support, documentation improvements, bug fixes
|
||||
|
||||
N: Rafael Avila de Espindola
|
||||
E: rafael.espindola@gmail.com
|
||||
D: The ARM backend
|
||||
|
||||
N: Alkis Evlogimenos
|
||||
E: alkis@evlogimenos.com
|
||||
D: Linear scan register allocator, many codegen improvements, Java frontend
|
||||
D: Autoconf support, QMTest database, documentation improvements
|
||||
|
||||
N: Brian Gaeke
|
||||
E: gaeke@uiuc.edu
|
||||
W: http://www.students.uiuc.edu/~gaeke/
|
||||
D: Portions of X86 static and JIT compilers; initial SparcV8 backend
|
||||
D: Dynamic trace optimizer
|
||||
D: Portions of X86 static and JIT compilers, reoptimizer framework cleanups
|
||||
D: FreeBSD/X86 compatibility fixes, the llvm-nm tool
|
||||
|
||||
N: Nicolas Geoffray
|
||||
E: nicolas.geoffray@lip6.fr
|
||||
W: http://www-src.lip6.fr/homepages/Nicolas.Geoffray/
|
||||
D: PPC backend fixes for Linux
|
||||
|
||||
N: Louis Gerbarg
|
||||
D: Portions of the PowerPC backend
|
||||
|
||||
N: Saem Ghani
|
||||
E: saemghani@gmail.com
|
||||
D: Callgraph class cleanups
|
||||
|
||||
N: Mikhail Glushenkov
|
||||
E: foldr@codedgers.com
|
||||
D: Author of llvmc2
|
||||
|
||||
N: Dan Gohman
|
||||
E: djg@cray.com
|
||||
D: Miscellaneous bug fixes
|
||||
|
||||
N: David Greene
|
||||
E: greened@obbligato.org
|
||||
D: Miscellaneous bug fixes
|
||||
D: Register allocation refactoring
|
||||
|
||||
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
|
||||
E: arathorn@fastwebnet.it
|
||||
D: Visual C++ compatibility fixes
|
||||
|
||||
N: Patrick Jenkins
|
||||
E: patjenk@wam.umd.edu
|
||||
D: Nightly Tester
|
||||
|
||||
N: Brad Jones
|
||||
E: kungfoomaster@nondot.org
|
||||
D: Support for packed types
|
||||
|
||||
N: Dale Johannesen
|
||||
E: dalej@apple.com
|
||||
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
|
||||
W: http://randomhacks.net/
|
||||
D: llvm-config script
|
||||
|
||||
N: Anton Korobeynikov
|
||||
E: asl@math.spbu.ru
|
||||
D: Mingw32 fixes, cross-compiling support, stdcall/fastcall calling conv.
|
||||
D: x86/linux PIC codegen, aliases, regparm/visibility attributes
|
||||
D: Switch lowering refactoring
|
||||
|
||||
N: Sumant Kowshik
|
||||
E: kowshik@uiuc.edu
|
||||
D: Author of the original C backend
|
||||
|
||||
N: Christopher Lamb
|
||||
E: christopher.lamb@gmail.com
|
||||
D: aligned load/store support, parts of noalias and restrict support
|
||||
D: vreg subreg infrastructure, X86 codegen improvements based on subregs
|
||||
D: address spaces
|
||||
|
||||
N: Jim Laskey
|
||||
E: jlaskey@apple.com
|
||||
D: Improvements to the PPC backend, instruction scheduling
|
||||
D: Debug and Dwarf implementation
|
||||
D: Auto upgrade mangler
|
||||
D: llvm-gcc4 svn wrangler
|
||||
|
||||
N: Chris Lattner
|
||||
E: sabre@nondot.org
|
||||
W: http://nondot.org/~sabre/
|
||||
D: Primary architect of LLVM
|
||||
|
||||
N: Tanya Lattner (Tanya Brethour)
|
||||
E: tonic@nondot.org
|
||||
W: http://nondot.org/~tonic/
|
||||
D: The initial llvm-ar tool, converted regression testsuite to dejagnu
|
||||
D: Modulo scheduling in the SparcV9 backend
|
||||
D: Release manager (1.7+)
|
||||
|
||||
N: Andrew Lenharth
|
||||
E: alenhar2@cs.uiuc.edu
|
||||
W: http://www.lenharth.org/~andrewl/
|
||||
D: Alpha backend
|
||||
D: Sampling based profiling
|
||||
|
||||
N: Nick Lewycky
|
||||
E: nicholas@mxc.ca
|
||||
D: PredicateSimplifier pass
|
||||
|
||||
N: Bruno Cardoso Lopes
|
||||
E: bruno.cardoso@gmail.com
|
||||
W: http://www.brunocardoso.org
|
||||
D: The Mips backend
|
||||
|
||||
N: Duraid Madina
|
||||
E: duraid@octopus.com.au
|
||||
W: http://kinoko.c.u-tokyo.ac.jp/~duraid/
|
||||
D: IA64 backend, BigBlock register allocator
|
||||
|
||||
N: Michael McCracken
|
||||
E: michael.mccracken@gmail.com
|
||||
D: Line number support for llvmgcc
|
||||
|
||||
N: Vladimir Merzliakov
|
||||
E: wanderer@rsu.ru
|
||||
D: Test suite fixes for FreeBSD
|
||||
|
||||
N: Scott Michel
|
||||
E: scottm@aero.org
|
||||
D: Added STI Cell SPU backend.
|
||||
|
||||
N: Morten Ofstad
|
||||
E: morten@hue.no
|
||||
D: Visual C++ compatibility fixes
|
||||
|
||||
N: Devang Patel
|
||||
E: dpatel@apple.com
|
||||
D: LTO tool, PassManager rewrite, Loop Pass Manager, Loop Rotate
|
||||
D: GCC PCH Integration (llvm-gcc), llvm-gcc improvements
|
||||
D: Optimizer improvements, Loop Index Split
|
||||
|
||||
N: Vladimir Prus
|
||||
W: http://vladimir_prus.blogspot.com
|
||||
E: ghost@cs.msu.su
|
||||
D: Made inst_iterator behave like a proper iterator, LowerConstantExprs pass
|
||||
|
||||
N: Roman Samoilov
|
||||
E: roman@codedgers.com
|
||||
D: MSIL backend
|
||||
|
||||
N: Duncan Sands
|
||||
E: baldrick@free.fr
|
||||
D: Ada front-end, exception handling improvements
|
||||
|
||||
N: Ruchira Sasanka
|
||||
E: sasanka@uiuc.edu
|
||||
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
|
||||
E: ashukla@cs.uiuc.edu
|
||||
D: The `paths' pass
|
||||
|
||||
N: Reid Spencer
|
||||
E: rspencer@reidspencer.com
|
||||
W: http://reidspencer.com/
|
||||
D: Lots of stuff, see: http://wiki.llvm.org/index.php/User:Reid
|
||||
|
||||
N: Adam Treat
|
||||
E: manyoso@yahoo.com
|
||||
D: C++ bugs filed, and C++ front-end bug fixes.
|
||||
|
||||
N: Lauro Ramos Venancio
|
||||
E: lauro.venancio@indt.org.br
|
||||
D: ARM backend improvements
|
||||
D: Thread Local Storage implementation
|
||||
|
||||
N: Bill Wendling
|
||||
E: isanbard@gmail.com
|
||||
W: http://web.mac.com/bwendling/
|
||||
D: Darwin exception handling
|
||||
D: MMX & SSSE3 instructions
|
||||
D: SPEC2006 support
|
||||
E: wendling@isanbard.org
|
||||
D: The `Lower Setjmp/Longjmp' pass, improvements to the -lowerswitch pass.
|
||||
|
||||
@@ -4,8 +4,8 @@ LLVM Release License
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.
|
||||
All rights reserved.
|
||||
Copyright (c) 2003, University of Illinois at Urbana-Champaign. All rights
|
||||
reserved.
|
||||
|
||||
Developed by:
|
||||
|
||||
@@ -13,7 +13,7 @@ Developed by:
|
||||
|
||||
University of Illinois at Urbana-Champaign
|
||||
|
||||
http://llvm.org
|
||||
http://llvm.cs.uiuc.edu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
@@ -49,23 +49,3 @@ The LLVM software contains code written by third parties. Such software will
|
||||
have its own individual LICENSE.TXT file in the directory in which it appears.
|
||||
This file will describe the copyrights, license, and restrictions which apply
|
||||
to that code.
|
||||
|
||||
The disclaimer of warranty in the University of Illinois Open Source License
|
||||
applies to all code in the LLVM Distribution, and nothing in any of the
|
||||
other licenses gives permission to use the names of the LLVM Team or the
|
||||
University of Illinois to endorse or promote products derived from this
|
||||
Software.
|
||||
|
||||
The following pieces of software have additional or alternate copyrights,
|
||||
licenses, and/or restrictions:
|
||||
|
||||
Program Directory
|
||||
------- ---------
|
||||
System Library llvm/lib/System
|
||||
Compiler Driver llvm/tools/llvmc
|
||||
Autoconf llvm/autoconf
|
||||
llvm/projects/ModuleMaker/autoconf
|
||||
llvm/projects/sample/autoconf
|
||||
CellSPU backend llvm/lib/Target/CellSPU/README.txt
|
||||
|
||||
|
||||
|
||||
175
llvm/Makefile
175
llvm/Makefile
@@ -1,163 +1,36 @@
|
||||
#===- ./Makefile -------------------------------------------*- Makefile -*--===#
|
||||
##===- ./Makefile ------------------------------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
# This file was developed by the LLVM research group and is distributed under
|
||||
# the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
#
|
||||
#===------------------------------------------------------------------------===#
|
||||
##===----------------------------------------------------------------------===##
|
||||
LEVEL = .
|
||||
DIRS = lib/Support utils lib tools runtime
|
||||
OPTIONAL_DIRS = projects
|
||||
|
||||
LEVEL := .
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
# Top-Level LLVM Build Stages:
|
||||
# 1. Build lib/System and lib/Support, which are used by utils (tblgen).
|
||||
# 2. Build utils, which is used by VMCore.
|
||||
# 3. Build VMCore, which builds the Intrinsics.inc file used by libs.
|
||||
# 4. Build libs, which are needed by llvm-config.
|
||||
# 5. Build llvm-config, which determines inter-lib dependencies for tools.
|
||||
# 6. Build tools, runtime, docs.
|
||||
#
|
||||
DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
|
||||
tools runtime docs
|
||||
test :: all
|
||||
cd test; $(MAKE)
|
||||
|
||||
OPTIONAL_DIRS := examples projects bindings
|
||||
EXTRA_DIST := test llvm.spec include win32 Xcode
|
||||
distclean:: clean
|
||||
$(VERB) $(RM) -rf $(LEVEL)/Makefile.config \
|
||||
$(LEVEL)/include/Config/config.h \
|
||||
$(LEVEL)/autoconf/autom4te.cache \
|
||||
$(LEVEL)/config.log \
|
||||
$(LEVEL)/TAGS
|
||||
|
||||
include $(LEVEL)/Makefile.config
|
||||
tools-only:
|
||||
@for dir in lib/Support utils lib tools; do $(MAKE) -C $$dir; done
|
||||
|
||||
# llvm-gcc4 doesn't need runtime libs. llvm-gcc4 is the only supported one.
|
||||
# FIXME: Remove runtime entirely once we have an understanding of where
|
||||
# libprofile etc should go.
|
||||
#ifeq ($(LLVMGCC_MAJVERS),4)
|
||||
DIRS := $(filter-out runtime, $(DIRS))
|
||||
#endif
|
||||
AUTOCONF = autoconf
|
||||
AUTOHEADER = autoheader
|
||||
|
||||
ifeq ($(MAKECMDGOALS),libs-only)
|
||||
DIRS := $(filter-out tools runtime docs, $(DIRS))
|
||||
OPTIONAL_DIRS :=
|
||||
endif
|
||||
configure: autoconf/configure.ac autoconf/aclocal.m4
|
||||
cd autoconf && $(AUTOCONF) -o ../configure configure.ac
|
||||
|
||||
ifeq ($(MAKECMDGOALS),install-libs)
|
||||
DIRS := $(filter-out tools runtime docs, $(DIRS))
|
||||
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
|
||||
endif
|
||||
|
||||
ifeq ($(MAKECMDGOALS),tools-only)
|
||||
DIRS := $(filter-out runtime docs, $(DIRS))
|
||||
OPTIONAL_DIRS :=
|
||||
endif
|
||||
|
||||
# Don't install utils, examples, or projects they are only used to
|
||||
# build LLVM.
|
||||
ifeq ($(MAKECMDGOALS),install)
|
||||
DIRS := $(filter-out utils, $(DIRS))
|
||||
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
|
||||
endif
|
||||
|
||||
# Include the main makefile machinery.
|
||||
include $(LLVM_SRC_ROOT)/Makefile.rules
|
||||
|
||||
# Specify options to pass to configure script when we're
|
||||
# running the dist-check target
|
||||
DIST_CHECK_CONFIG_OPTIONS = --with-llvmgccdir=$(LLVMGCCDIR)
|
||||
|
||||
.PHONY: debug-opt-prof
|
||||
debug-opt-prof:
|
||||
$(Echo) Building Debug Version
|
||||
$(Verb) $(MAKE)
|
||||
$(Echo)
|
||||
$(Echo) Building Optimized Version
|
||||
$(Echo)
|
||||
$(Verb) $(MAKE) ENABLE_OPTIMIZED=1
|
||||
$(Echo)
|
||||
$(Echo) Building Profiling Version
|
||||
$(Echo)
|
||||
$(Verb) $(MAKE) ENABLE_PROFILING=1
|
||||
|
||||
dist-hook::
|
||||
$(Echo) Eliminating files constructed by configure
|
||||
$(Verb) $(RM) -f \
|
||||
$(TopDistDir)/include/llvm/ADT/hash_map \
|
||||
$(TopDistDir)/include/llvm/ADT/hash_set \
|
||||
$(TopDistDir)/include/llvm/ADT/iterator \
|
||||
$(TopDistDir)/include/llvm/Config/config.h \
|
||||
$(TopDistDir)/include/llvm/Support/DataTypes.h \
|
||||
$(TopDistDir)/include/llvm/Support/ThreadSupport.h
|
||||
|
||||
tools-only: all
|
||||
libs-only: all
|
||||
install-libs: install
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Make sure the generated headers are up-to-date. This must be kept in
|
||||
# sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
|
||||
#------------------------------------------------------------------------
|
||||
FilesToConfig := \
|
||||
include/llvm/Config/config.h \
|
||||
include/llvm/Support/DataTypes.h \
|
||||
include/llvm/ADT/hash_map \
|
||||
include/llvm/ADT/hash_set \
|
||||
include/llvm/ADT/iterator
|
||||
FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
|
||||
|
||||
all-local:: $(FilesToConfigPATH)
|
||||
$(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in
|
||||
$(Echo) Regenerating $*
|
||||
$(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
|
||||
.PRECIOUS: $(FilesToConfigPATH)
|
||||
|
||||
# NOTE: This needs to remain as the last target definition in this file so
|
||||
# that it gets executed last.
|
||||
all::
|
||||
$(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
|
||||
ifeq ($(BuildMode),Debug)
|
||||
$(Echo) '*****' Note: Debug build can be 10 times slower than an
|
||||
$(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
|
||||
$(Echo) '*****' make an optimized build. Alternatively you can
|
||||
$(Echo) '*****' configure with --enable-optimized.
|
||||
endif
|
||||
|
||||
check-llvm2cpp:
|
||||
$(Verb)$(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
|
||||
|
||||
check-one:
|
||||
$(Verb)$(MAKE) -C test check-one TESTONE=$(TESTONE)
|
||||
|
||||
srpm: $(LLVM_OBJ_ROOT)/llvm.spec
|
||||
rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
|
||||
|
||||
rpm: $(LLVM_OBJ_ROOT)/llvm.spec
|
||||
rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
|
||||
|
||||
show-footprint:
|
||||
$(Verb) du -sk $(LibDir)
|
||||
$(Verb) du -sk $(ToolDir)
|
||||
$(Verb) du -sk $(ExmplDir)
|
||||
$(Verb) du -sk $(ObjDir)
|
||||
|
||||
build-for-llvm-top:
|
||||
$(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
|
||||
|
||||
.PHONY: srpm rpm update happiness
|
||||
|
||||
# declare all targets at this level to be serial:
|
||||
|
||||
.NOTPARALLEL:
|
||||
include/Config/config.h.in: autoconf/configure.ac autoconf/aclocal.m4
|
||||
$(AUTOHEADER) -I autoconf autoconf/configure.ac
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#===-- Makefile.common - Common make rules for LLVM --------*- Makefile -*--===#
|
||||
#===-- Makefile.common - Common make rules for LLVM -------*- makefile -*--====
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
# This file was developed by the LLVM research group and is distributed under
|
||||
# the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
#
|
||||
#===------------------------------------------------------------------------===#
|
||||
##===----------------------------------------------------------------------===##
|
||||
#
|
||||
# This file is included by all of the LLVM makefiles. This file defines common
|
||||
# rules to do things like compile a .cpp file or generate dependency info.
|
||||
@@ -16,7 +16,7 @@
|
||||
# The variable $(LEVEL) *must* be set:
|
||||
#
|
||||
# 1. LEVEL - The level of the current subdirectory from the top of the
|
||||
# source directory. This level should be expressed as a path, for
|
||||
# MagicStats view. This level should be expressed as a path, for
|
||||
# example, ../.. for two levels deep.
|
||||
#
|
||||
# 2. DIRS - A list of subdirectories to be built. Fake targets are set up
|
||||
@@ -39,29 +39,25 @@
|
||||
#
|
||||
# 6. LLVM_SRC_ROOT - If specified, points to the top of the LLVM source tree.
|
||||
#
|
||||
# 8. PROJ_SRC_DIR - The directory which contains the current set of Makefiles
|
||||
# 8. BUILD_SRC_DIR - The directory which contains the current set of Makefiles
|
||||
# and usually the source code too (unless SourceDir is set).
|
||||
#
|
||||
# 9. PROJ_SRC_ROOT - The root directory of the source code being compiled.
|
||||
# 9. BUILD_SRC_ROOT - The root directory of the source code being compiled.
|
||||
#
|
||||
# 10. PROJ_OBJ_DIR - The directory where object code should be placed.
|
||||
# 10. BUILD_OBJ_DIR - The directory where object code should be placed.
|
||||
#
|
||||
# 11. PROJ_OBJ_ROOT - The root directory for where object code should be
|
||||
# 11. BUILD_OBJ_ROOT - The root directory for where object code should be
|
||||
# placed.
|
||||
#
|
||||
# For building,
|
||||
# LLVM, LLVM_SRC_ROOT = PROJ_SRC_ROOT
|
||||
# LLVM, LLVM_SRC_ROOT = BUILD_SRC_ROOT
|
||||
#
|
||||
#===-----------------------------------------------------------------------====
|
||||
|
||||
#
|
||||
# Configuration file to set paths specific to local installation of LLVM
|
||||
#
|
||||
ifndef LLVM_OBJ_ROOT
|
||||
include $(LEVEL)/Makefile.config
|
||||
else
|
||||
include $(LLVM_OBJ_ROOT)/Makefile.config
|
||||
endif
|
||||
|
||||
#
|
||||
# Include all of the build rules used for making LLVM
|
||||
|
||||
@@ -1,21 +1,174 @@
|
||||
#===-- Makefile.config - Local configuration for LLVM ------*- Makefile -*--===#
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
#===------------------------------------------------------------------------===#
|
||||
#===-- Makefile.config - Local configuration for LLVM ------*- makefile -*--====
|
||||
#
|
||||
# This file is included by Makefile.common. It defines paths and other
|
||||
# values specific to a particular installation of LLVM.
|
||||
#
|
||||
#===------------------------------------------------------------------------===#
|
||||
#===-----------------------------------------------------------------------====
|
||||
|
||||
# Define LLVM specific info and directories based on the autoconf variables
|
||||
LLVMPackageName := @PACKAGE_NAME@
|
||||
LLVMVersion := @PACKAGE_VERSION@
|
||||
LLVM_CONFIGTIME := @LLVM_CONFIGTIME@
|
||||
#
|
||||
# Target operating system for which LLVM will be compiled.
|
||||
#
|
||||
OS=@OS@
|
||||
|
||||
#
|
||||
# Target hardware architecture
|
||||
#
|
||||
ARCH=@ARCH@
|
||||
|
||||
# Path to the C++ compiler to use. This is an optional setting, which defaults
|
||||
# to whatever your gmake defaults to.
|
||||
#
|
||||
# Under Linux, for some reason the compiler driver wants to search the PATH to
|
||||
# find the system assembler, which breaks if the LLVM assembler is in our path.
|
||||
# Hack it to use the assembler in /usr/bin directly.
|
||||
#
|
||||
CXX = @CXX@
|
||||
|
||||
# We have the same problem with the CC binary, which use used by testcases for
|
||||
# native builds.
|
||||
#
|
||||
CC := @CC@
|
||||
|
||||
#
|
||||
# Compilation flags for the C and C++ compilers.
|
||||
#
|
||||
|
||||
#
|
||||
# Removing the compiler flags for now. They interfere with the test suite
|
||||
# (which has its own autoconf stuff), and we don't use -DHAVE_CONFIG_H anyway.
|
||||
#
|
||||
#CPPFLAGS+=@DEFS@
|
||||
#CCFLAGS+=@DEFS@
|
||||
LDFLAGS+=@LDFLAGS@
|
||||
|
||||
#
|
||||
# Removed since it prevents the tests from working properly.
|
||||
#
|
||||
#LIBS+=@LIBS@
|
||||
|
||||
#
|
||||
# Libraries needed by tools
|
||||
#
|
||||
TOOLLINKOPTS=@LIBS@
|
||||
|
||||
#
|
||||
# Path to the archiver program.
|
||||
#
|
||||
AR_PATH = @AR@
|
||||
|
||||
#
|
||||
# The pathnames of the Flex and Bison programs, respectively.
|
||||
#
|
||||
BISON = @YACC@
|
||||
FLEX = @LEX@
|
||||
|
||||
#
|
||||
# Paths to miscellaneous programs.
|
||||
#
|
||||
RPWD = @RPWD@
|
||||
SED = @SED@
|
||||
RM = @RM@
|
||||
ECHO = @ECHO@
|
||||
MKDIR = @abs_top_srcdir@/autoconf/mkinstalldirs
|
||||
DATE = @DATE@
|
||||
MV = @MV@
|
||||
INSTALL = @INSTALL@
|
||||
DOT = @DOT@
|
||||
ETAGS = @ETAGS@
|
||||
|
||||
#
|
||||
# Determine the target for which LLVM should generate code.
|
||||
#
|
||||
LLVMGCCARCH := @target@/3.4-llvm
|
||||
|
||||
# Path to directory where object files should be stored during a build.
|
||||
# Set OBJ_ROOT to "." if you do not want to use a separate place for
|
||||
# object files.
|
||||
#
|
||||
#OBJ_ROOT = .
|
||||
OBJ_ROOT := .
|
||||
|
||||
# Path to location for LLVM front-end this should only be specified here if you
|
||||
# want to override the value set in Makefile.$(uname)
|
||||
#
|
||||
LLVMGCCDIR := @LLVMGCCDIR@
|
||||
|
||||
# When this setting is set to true, programs in the llvm/test/Programs hierarchy
|
||||
# are not recompiled from source code. Instead, the bytecode for the file is
|
||||
# pulled from the BYTECODE_REPOSITORY directory. This can be useful when disk
|
||||
# space is limited or when you just don't want to spend time running the C
|
||||
# frontend.
|
||||
#
|
||||
#USE_PRECOMPILED_BYTECODE := 1
|
||||
@UPB@
|
||||
|
||||
# This path specifies the cannonical location of bytecode files for compiled
|
||||
# versions of the test/Programs/* programs. This is used as the bytecode source
|
||||
# when USE_PRECOMPILED_BYTECODE is specified or when source code is not
|
||||
# available for the program (such as SPEC).
|
||||
#
|
||||
BYTECODE_REPOSITORY := @BCR@
|
||||
|
||||
# Path to location for purify, this is only needed if you build with
|
||||
# ENABLE_PURIFY=1
|
||||
#
|
||||
PURIFY = @PURIFY@
|
||||
|
||||
#
|
||||
# SPEC benchmarks:
|
||||
# Set the USE_SPEC variable to enable the use of the SPEC benchmarks.
|
||||
# You must provide the SPEC benchmarks on your own.
|
||||
#
|
||||
@USE_SPEC@
|
||||
|
||||
#
|
||||
# Path to the SPEC benchmarks. If you have the SPEC benchmarks, place the
|
||||
# path here.
|
||||
#
|
||||
#SPEC_ROOT := /home/vadve/shared/benchmarks/speccpu2000/benchspec
|
||||
SPEC_ROOT := @SPEC_ROOT@
|
||||
|
||||
#
|
||||
# Path to the PAPI code. This is used by the reoptimizer only.
|
||||
#
|
||||
#PAPIDIR := /home/vadve/shared/papi-2.3.4.1
|
||||
PAPIDIR := @PAPIDIR@
|
||||
|
||||
# These are options that can either be enabled here, or can be enabled on the
|
||||
# make command line (ie, make ENABLE_PROFILING=1)
|
||||
#
|
||||
|
||||
# When ENABLE_OPTIMIZED is enabled, Release builds of all of the LLVM code are
|
||||
# turned on, and Debug builds are turned off.
|
||||
#
|
||||
#ENABLE_OPTIMIZED = 1
|
||||
@ENABLE_OPTIMIZED@
|
||||
|
||||
# When ENABLE_PROFILING is enabled, the llvm source base is built with profile
|
||||
# information to allow gprof to be used to get execution frequencies.
|
||||
#
|
||||
#ENABLE_PROFILING = 1
|
||||
|
||||
#
|
||||
# This option tells the Makefiles to produce verbose output.
|
||||
# It essentially prints the commands that make is executing
|
||||
#
|
||||
#VERBOSE = 1
|
||||
|
||||
# When ENABLE_PURIFY is set to 1, the LLVM tools are linked with purify (which
|
||||
# must be locally installed) to allow for some automated memory error debugging.
|
||||
#
|
||||
#ENABLE_PURIFY = 1
|
||||
@ENABLE_PURIFY@
|
||||
|
||||
#
|
||||
# Enable JIT for this platform
|
||||
#
|
||||
@JIT@
|
||||
|
||||
#
|
||||
# Disable LLC diffs for testing.
|
||||
#
|
||||
@DISABLE_LLC_DIFFS@
|
||||
|
||||
###########################################################################
|
||||
# Directory Configuration
|
||||
@@ -25,252 +178,65 @@ LLVM_CONFIGTIME := @LLVM_CONFIGTIME@
|
||||
# o LLVM_SRC_ROOT : The root directory of the LLVM source code.
|
||||
# o LLVM_OBJ_ROOT : The root directory containing the built LLVM code.
|
||||
#
|
||||
# o PROJ_SRC_DIR : The directory containing the code to build.
|
||||
# o PROJ_SRC_ROOT : The root directory of the code to build.
|
||||
# o BUILD_SRC_DIR : The directory containing the code to build.
|
||||
# o BUILD_SRC_ROOT : The root directory of the code to build.
|
||||
#
|
||||
# o PROJ_OBJ_DIR : The directory in which compiled code will be placed.
|
||||
# o PROJ_OBJ_ROOT : The root directory in which compiled code is placed.
|
||||
# o BUILD_OBJ_DIR : The directory in which compiled code will be placed.
|
||||
# o BUILD_OBJ_ROOT : The root directory in which compiled code is placed.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
PWD := @BINPWD@
|
||||
# Set the project name to LLVM if its not defined
|
||||
ifndef PROJECT_NAME
|
||||
PROJECT_NAME := $(LLVMPackageName)
|
||||
#
|
||||
# Set the object build directory. By default, it is the current directory.
|
||||
#
|
||||
ifndef BUILD_OBJ_DIR
|
||||
BUILD_OBJ_DIR := $(subst //,/,$(shell $(RPWD)))
|
||||
endif
|
||||
|
||||
PROJ_OBJ_DIR := $(shell $(PWD))
|
||||
PROJ_OBJ_ROOT := $(shell cd $(PROJ_OBJ_DIR)/$(LEVEL); $(PWD))
|
||||
#
|
||||
# Set the root of the object directory.
|
||||
#
|
||||
ifndef BUILD_OBJ_ROOT
|
||||
BUILD_OBJ_ROOT := $(subst //,/,$(shell cd $(BUILD_OBJ_DIR)/$(LEVEL); $(RPWD)))
|
||||
endif
|
||||
|
||||
ifeq ($(PROJECT_NAME),llvm)
|
||||
LLVM_SRC_ROOT := $(shell cd @abs_top_srcdir@; $(PWD))
|
||||
LLVM_OBJ_ROOT := $(shell cd @abs_top_builddir@; $(PWD))
|
||||
PROJ_SRC_ROOT := $(shell cd $(LLVM_SRC_ROOT); $(PWD))
|
||||
PROJ_SRC_DIR := $(shell cd $(LLVM_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD))
|
||||
prefix := @prefix@
|
||||
PROJ_prefix := $(prefix)
|
||||
PROJ_VERSION := $(LLVMVersion)
|
||||
else
|
||||
ifndef PROJ_SRC_ROOT
|
||||
$(error Projects must define PROJ_SRC_ROOT)
|
||||
#
|
||||
# Set the source build directory. That is almost always the current directory.
|
||||
#
|
||||
ifndef BUILD_SRC_DIR
|
||||
BUILD_SRC_DIR := $(subst //,/,@abs_top_srcdir@/$(patsubst $(BUILD_OBJ_ROOT)%,%,$(BUILD_OBJ_DIR)))
|
||||
endif
|
||||
ifndef PROJ_OBJ_ROOT
|
||||
$(error Projects must define PROJ_OBJ_ROOT)
|
||||
endif
|
||||
ifndef PROJ_INSTALL_ROOT
|
||||
$(error Projects must define PROJ_INSTALL_ROOT)
|
||||
endif
|
||||
ifndef LLVM_SRC_ROOT
|
||||
$(error Projects must define LLVM_SRC_ROOT)
|
||||
|
||||
#
|
||||
# Set the source root directory.
|
||||
#
|
||||
ifndef BUILD_SRC_ROOT
|
||||
BUILD_SRC_ROOT := $(subst //,/,@abs_top_srcdir@)
|
||||
endif
|
||||
|
||||
#
|
||||
# Set the LLVM object directory.
|
||||
#
|
||||
ifndef LLVM_OBJ_ROOT
|
||||
$(error Projects must define LLVM_OBJ_ROOT)
|
||||
endif
|
||||
PROJ_SRC_DIR := $(shell cd $(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD))
|
||||
prefix := $(PROJ_INSTALL_ROOT)
|
||||
PROJ_prefix := $(prefix)
|
||||
ifndef PROJ_VERSION
|
||||
PROJ_VERSION := 1.0
|
||||
endif
|
||||
endif
|
||||
|
||||
LLVMMAKE := $(LLVM_SRC_ROOT)/make
|
||||
|
||||
PROJ_bindir := $(DESTDIR)$(PROJ_prefix)/bin
|
||||
PROJ_libdir := $(DESTDIR)$(PROJ_prefix)/lib
|
||||
PROJ_datadir := $(DESTDIR)$(PROJ_prefix)/share
|
||||
PROJ_docsdir := $(DESTDIR)$(PROJ_prefix)/docs/llvm
|
||||
PROJ_etcdir := $(DESTDIR)$(PROJ_prefix)/etc/llvm
|
||||
PROJ_includedir := $(DESTDIR)$(PROJ_prefix)/include
|
||||
PROJ_infodir := $(DESTDIR)$(PROJ_prefix)/info
|
||||
PROJ_mandir := $(DESTDIR)$(PROJ_prefix)/share/man
|
||||
|
||||
# Determine if we're on a unix type operating system
|
||||
LLVM_ON_UNIX:=@LLVM_ON_UNIX@
|
||||
LLVM_ON_WIN32:=@LLVM_ON_WIN32@
|
||||
|
||||
# Target operating system for which LLVM will be compiled.
|
||||
OS=@OS@
|
||||
|
||||
# Target hardware architecture
|
||||
ARCH=@ARCH@
|
||||
|
||||
# Indicates, whether we're cross-compiling LLVM or not
|
||||
LLVM_CROSS_COMPILING=@LLVM_CROSS_COMPILING@
|
||||
|
||||
# Executable file extension for build platform (mainly for
|
||||
# tablegen call if we're cross-compiling).
|
||||
BUILD_EXEEXT=@BUILD_EXEEXT@
|
||||
|
||||
# Target triple (cpu-vendor-os) for which we should generate code
|
||||
TARGET_TRIPLE=@target@
|
||||
|
||||
# Extra options to compile LLVM with
|
||||
EXTRA_OPTIONS=@EXTRA_OPTIONS@
|
||||
|
||||
# Endian-ness of the target
|
||||
ENDIAN=@ENDIAN@
|
||||
|
||||
# Path to the C++ compiler to use. This is an optional setting, which defaults
|
||||
# to whatever your gmake defaults to.
|
||||
CXX = @CXX@
|
||||
|
||||
# Path to the CC binary, which use used by testcases for native builds.
|
||||
CC := @CC@
|
||||
|
||||
# Linker flags.
|
||||
LDFLAGS+=@LDFLAGS@
|
||||
|
||||
# Path to the library archiver program.
|
||||
AR_PATH = @AR@
|
||||
|
||||
# Path to the nm program
|
||||
NM_PATH = @NM@
|
||||
|
||||
# The pathnames of the programs we require to build
|
||||
BISON := @BISON@
|
||||
CMP := @CMP@
|
||||
CP := @CP@
|
||||
DATE := @DATE@
|
||||
FIND := @FIND@
|
||||
FLEX := @LEX@
|
||||
GREP := @GREP@
|
||||
INSTALL := @INSTALL@
|
||||
MKDIR := $(LLVM_SRC_ROOT)/autoconf/mkinstalldirs
|
||||
MV := @MV@
|
||||
RANLIB := @RANLIB@
|
||||
RM := @RM@
|
||||
SED := @SED@
|
||||
TAR := @TAR@
|
||||
YACC := @YACC@
|
||||
|
||||
# Paths to miscellaneous programs we hope are present but might not be
|
||||
PERL := @PERL@
|
||||
BZIP2 := @BZIP2@
|
||||
DOT := @DOT@
|
||||
DOXYGEN := @DOXYGEN@
|
||||
GROFF := @GROFF@
|
||||
GZIP := @GZIP@
|
||||
OCAMLC := @OCAMLC@
|
||||
OCAMLOPT := @OCAMLOPT@
|
||||
OCAMLDEP := @OCAMLDEP@
|
||||
OCAMLDOC := @OCAMLDOC@
|
||||
POD2HTML := @POD2HTML@
|
||||
POD2MAN := @POD2MAN@
|
||||
RUNTEST := @RUNTEST@
|
||||
TCLSH := @TCLSH@
|
||||
ZIP := @ZIP@
|
||||
|
||||
HAVE_PERL := @HAVE_PERL@
|
||||
HAVE_PTHREAD := @HAVE_PTHREAD@
|
||||
|
||||
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
|
||||
# want to override the value set by configure.
|
||||
LLVMGCCDIR := @LLVMGCCDIR@
|
||||
|
||||
# Determine the target for which LLVM should generate code.
|
||||
ifeq (@LLVMGCC_MAJVERS@,3)
|
||||
LLVMGCCARCH := @target@/3.4-llvm
|
||||
ifdef LLVM_SRC_ROOT
|
||||
LLVM_OBJ_ROOT := $(shell cd $(LLVM_SRC_ROOT); $(RPWD))
|
||||
else
|
||||
LLVMGCCARCH := @target@/@LLVMGCC_VERSION@
|
||||
LLVM_OBJ_ROOT := $(BUILD_OBJ_ROOT)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Determine the path where the library executables are
|
||||
LLVMGCCLIBEXEC := @LLVMGCCLIBEXEC@
|
||||
|
||||
# Full pathnames of LLVM C/C++ front-end 'cc1' and 'cc1plus' binaries:
|
||||
LLVMGCC := @LLVMGCC@
|
||||
LLVMGXX := @LLVMGXX@
|
||||
LLVMCC1 := @LLVMCC1@
|
||||
LLVMCC1PLUS := @LLVMCC1PLUS@
|
||||
LLVMGCC_VERSION := @LLVMGCC_VERSION@
|
||||
LLVMGCC_MAJVERS := @LLVMGCC_MAJVERS@
|
||||
LLVMGCC_LANGS := @LLVMGCC_LANGS@
|
||||
|
||||
# Path to directory where object files should be stored during a build.
|
||||
# Set OBJ_ROOT to "." if you do not want to use a separate place for
|
||||
# object files.
|
||||
OBJ_ROOT := .
|
||||
|
||||
# These are options that can either be enabled here, or can be enabled on the
|
||||
# make command line (ie, make ENABLE_PROFILING=1):
|
||||
|
||||
# When ENABLE_OPTIMIZED is enabled, LLVM code is optimized and output is put
|
||||
# into the "Release" directories. Otherwise, LLVM code is not optimized and
|
||||
# output is put in the "Debug" directories.
|
||||
#ENABLE_OPTIMIZED = 1
|
||||
@ENABLE_OPTIMIZED@
|
||||
|
||||
# When DISABLE_ASSERTIONS is enabled, builds of all of the LLVM code will
|
||||
# exclude assertion checks, otherwise they are included.
|
||||
#DISABLE_ASSERTIONS = 1
|
||||
@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
|
||||
# symbols.
|
||||
#DEBUG_RUNTIME = 1
|
||||
@DEBUG_RUNTIME@
|
||||
|
||||
# When ENABLE_PROFILING is enabled, the llvm source base is built with profile
|
||||
# information to allow gprof to be used to get execution frequencies.
|
||||
#ENABLE_PROFILING = 1
|
||||
|
||||
# When ENABLE_DOXYGEN is enabled, the doxygen documentation will be built
|
||||
ENABLE_DOXYGEN = @ENABLE_DOXYGEN@
|
||||
|
||||
# Do we want to enable threads?
|
||||
ENABLE_THREADS := @ENABLE_THREADS@
|
||||
|
||||
# Do we want to build with position independent code?
|
||||
ENABLE_PIC := @ENABLE_PIC@
|
||||
|
||||
# This option tells the Makefiles to produce verbose output.
|
||||
# It essentially prints the commands that make is executing
|
||||
#VERBOSE = 1
|
||||
|
||||
# Enable JIT for this platform
|
||||
TARGET_HAS_JIT = @TARGET_HAS_JIT@
|
||||
|
||||
# Shared library extension for host platform.
|
||||
SHLIBEXT = @SHLIBEXT@
|
||||
|
||||
# Executable file extension for host platform.
|
||||
EXEEXT = @EXEEXT@
|
||||
|
||||
# Things we just assume are "there"
|
||||
ECHO := echo
|
||||
|
||||
# Get the options for causing archives to link all their content instead of
|
||||
# just missing symbols, and the inverse of that. This is used for certain LLVM
|
||||
# tools that permit loadable modules. It ensures that the LLVM symbols will be
|
||||
# available to those loadable modules.
|
||||
LINKALL := @LINKALL@
|
||||
NOLINKALL := @NOLINKALL@
|
||||
|
||||
# Get the value of HUGE_VAL_SANITY which will be either "yes" or "no" depending
|
||||
# on the check.
|
||||
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)
|
||||
#
|
||||
# Set the LLVM source directory.
|
||||
# It is typically the root directory of what we're compiling now.
|
||||
#
|
||||
ifndef LLVM_SRC_ROOT
|
||||
LLVM_SRC_ROOT := $(BUILD_SRC_ROOT)
|
||||
endif
|
||||
|
||||
#
|
||||
# Set SourceDir for backwards compatbility.
|
||||
#
|
||||
ifndef SourceDir
|
||||
SourceDir=$(BUILD_SRC_DIR)
|
||||
endif
|
||||
|
||||
|
||||
2324
llvm/Makefile.rules
2324
llvm/Makefile.rules
File diff suppressed because it is too large
Load Diff
@@ -1,4 +0,0 @@
|
||||
DepModule:
|
||||
BuildCmd: ./build-for-llvm-top.sh
|
||||
CleanCmd: make clean
|
||||
InstallCmd: make install
|
||||
134
llvm/README.txt
134
llvm/README.txt
@@ -1,13 +1,129 @@
|
||||
Low Level Virtual Machine (LLVM)
|
||||
================================
|
||||
The LLVM Compiler Infrastructure
|
||||
http://llvm.cs.uiuc.edu
|
||||
|
||||
This directory and its subdirectories contain source code for the Low Level
|
||||
Virtual Machine, a toolkit for the construction of highly optimized compilers,
|
||||
optimizers, and runtime environments.
|
||||
Welcome to LLVM!
|
||||
-----------------
|
||||
This file is intended to do four things:
|
||||
(1) help you get started using LLVM;
|
||||
(2) tell you how to get questions about LLVM answered;
|
||||
(3) tell you where to find documentation for different kinds of questions; and
|
||||
(4) tell you about three LLVM-related mailing lists.
|
||||
|
||||
LLVM is open source software. You may freely distribute it under the terms of
|
||||
the license agreement found in LICENSE.txt.
|
||||
|
||||
Please see the HTML documentation provided in docs/index.html for further
|
||||
assistance with LLVM.
|
||||
Getting Started with LLVM
|
||||
-------------------------
|
||||
|
||||
(1) For license information:
|
||||
llvm/LICENSE.txt
|
||||
|
||||
(2) Installing and compiling LLVM:
|
||||
llvm/docs/GettingStarted.html
|
||||
|
||||
(3) Learn about features and limitations of this release:
|
||||
llvm/docs/ReleaseNotes.html
|
||||
|
||||
(4) Learn how to write a pass within the LLVM system:
|
||||
llvm/docs/WritingAnLLVMPass.html
|
||||
|
||||
(5) Learn how to start a new development project using LLVM, where your
|
||||
new source code can live anywhere (outside or inside the LLVM tree),
|
||||
while using LLVM header files and libraries:
|
||||
llvm/docs/Projects.html
|
||||
|
||||
|
||||
Getting Help with LLVM
|
||||
----------------------
|
||||
|
||||
(1) If you have questions or development problems not answered in the
|
||||
documentation, send e-mail to llvmdev@cs.uiuc.edu. This mailing list is
|
||||
monitored by all the people in the LLVM group at Illinois, and you should
|
||||
expect prompt first responses.
|
||||
|
||||
(2) To report a bug, submit a bug report as described in the document:
|
||||
http://llvm.cs.uiuc.edu/docs/HowToSubmitABug.html
|
||||
|
||||
(3) We now use Bugzilla to track bugs, so you can check the status of
|
||||
previous bugs at:
|
||||
http://llvm.cs.uiuc.edu/bugs/query.cgi
|
||||
|
||||
|
||||
LLVM Documentation
|
||||
------------------
|
||||
|
||||
All the documents mentioned below except the design overview tech report
|
||||
are included as part of the LLVM release (in llvm/docs/*):
|
||||
|
||||
LLVM Design Overview:
|
||||
LLVM : A Compilation Framework for Lifelong Program Analysis
|
||||
and Transformation:
|
||||
http://llvm.cs.uiuc.edu/pubs/2003-09-30-LifelongOptimizationTR.html
|
||||
|
||||
LLVM User Guides:
|
||||
|
||||
Download and Installation Instructions:
|
||||
llvm/docs/GettingStarted.html
|
||||
|
||||
LLVM Command Guide:
|
||||
llvm/docs/CommandGuide/index.html
|
||||
|
||||
LLVM Assembly Language:
|
||||
llvm/docs/LangRef.html
|
||||
|
||||
LLVM Test Suite Guide:
|
||||
llvm/docs/TestingGuide.html
|
||||
|
||||
LLVM Programming Documentation:
|
||||
|
||||
LLVM Programmers Manual:
|
||||
llvm/docs/ProgrammersManual.html
|
||||
|
||||
Writing an LLVM Pass:
|
||||
llvm/docs/WritingAnLLVMPass.html
|
||||
|
||||
Alias Analysis in LLVM:
|
||||
llvm/docs/AliasAnalysis.html
|
||||
|
||||
Command Line Library:
|
||||
llvm/docs/CommandLine.html
|
||||
|
||||
Coding Standards:
|
||||
llvm/docs/CodingStandards.html
|
||||
|
||||
Other LLVM Resources:
|
||||
|
||||
Submitting a Bug:
|
||||
http://llvm.cs.uiuc.edu/docs/HowToSubmitABug.html
|
||||
|
||||
Open Projects:
|
||||
llvm/docs/OpenProjects.html
|
||||
|
||||
Creating a new LLVM Project:
|
||||
llvm/docs/Projects.html
|
||||
|
||||
Mailing Lists
|
||||
--------------
|
||||
There are three mailing lists for providing LLVM users with information:
|
||||
|
||||
(1) LLVM Announcements List:
|
||||
http://mail.cs.uiuc.edu/mailman/listinfo/llvm-announce
|
||||
|
||||
This is a low volume list that provides important announcements regarding
|
||||
LLVM. It is primarily intended to announce new releases, major updates to
|
||||
the software, etc. This list is highly recommended for anyone that uses
|
||||
LLVM.
|
||||
|
||||
(2) LLVM Developers List:
|
||||
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
|
||||
|
||||
This list is for people who want to be included in technical discussions
|
||||
of LLVM. People post to this list when they have questions about writing
|
||||
code for or using the LLVM tools. It is relatively low volume.
|
||||
|
||||
(3) LLVM Commits List
|
||||
http://mail.cs.uiuc.edu/mailman/listinfo/llvm-commits
|
||||
|
||||
This list contains all commit messages that are made when LLVM developers
|
||||
commit code changes to the CVS archive. It is useful for those who want to
|
||||
stay on the bleeding edge of LLVM development. This list is very high
|
||||
volume.
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
Xcode project files for LLVM, for Xcode 2.1
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/bin/sh
|
||||
die () {
|
||||
echo "$@" 1>&2
|
||||
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
|
||||
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 -f $configfile || die "Can't find 'autoconf' dir; please cd into it first"
|
||||
autoconf --version | grep $want_autoconf_version > /dev/null
|
||||
test $? -eq 0 || die "Your autoconf was not detected as being $want_autoconf_version_clean"
|
||||
aclocal --version | grep '^aclocal.*1\.9\.6' > /dev/null
|
||||
test $? -eq 0 || die "Your aclocal was not detected as being 1.9.6"
|
||||
autoheader --version | grep '^autoheader.*'$want_autoheader_version > /dev/null
|
||||
test $? -eq 0 || die "Your autoheader was not detected as being $want_autoheader_version_clean"
|
||||
libtool --version | grep '1\.5\.22' > /dev/null
|
||||
test $? -eq 0 || die "Your libtool was not detected as being 1.5.22"
|
||||
echo ""
|
||||
echo "### NOTE: ############################################################"
|
||||
echo "### If you get *any* warnings from autoconf below you MUST fix the"
|
||||
echo "### scripts in the m4 directory because there are future forward"
|
||||
echo "### compatibility or platform support issues at risk. Please do NOT"
|
||||
echo "### commit any configure script that was generated with warnings"
|
||||
echo "### present. You should get just three 'Regenerating..' lines."
|
||||
echo "######################################################################"
|
||||
echo ""
|
||||
echo "Regenerating aclocal.m4 with aclocal 1.9.6"
|
||||
cwd=`pwd`
|
||||
aclocal --force -I $cwd/m4 || die "aclocal failed"
|
||||
echo "Regenerating configure with autoconf $want_autoconf_version_clean"
|
||||
autoconf --force --warnings=all -o ../$outfile $configfile || die "autoconf failed"
|
||||
cd ..
|
||||
echo "Regenerating config.h.in with autoheader $want_autoheader_version_clean"
|
||||
autoheader --warnings=all -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed"
|
||||
exit 0
|
||||
@@ -1,49 +0,0 @@
|
||||
Upgrading Libtool
|
||||
===============================================================================
|
||||
|
||||
If you are in the mood to upgrade libtool, you must do the following:
|
||||
|
||||
1. Get the new version of libtool and put it in <SRC>
|
||||
2. configure/build/install libtool with --prefix=<PFX>
|
||||
3. Copy <SRC>/ltdl.m4 to llvm/autoconf/m4
|
||||
4. Copy <PFX>/share/aclocal/libtool.m4 to llvm/autoconf/m4/libtool.m4
|
||||
5. Copy <PFX>/share/libtool/ltmain.sh to llvm/autoconf/ltmain.sh
|
||||
6. Copy <PFX>/share/libtool/libltdl/ltdl.c to llvm/lib/System
|
||||
7. Copy <PFX>/share/libtool/libltdl/ltdl.h to llvm/lib/System
|
||||
8. Edit the ltdl.h file to #include "llvm/Config/config.h" at the very top. You
|
||||
might also need to resolve some compiler warnings (typically about
|
||||
comparison of signed vs. unsigned values). But, you won't find out about
|
||||
those until you build LLVM (step 13).
|
||||
9. Edit the llvm/autoconf/m4/libtool.m4 file so that:
|
||||
a) in AC_PROB_LIBTOOL macro, the value of LIBTOOL is set to
|
||||
$(top_builddir)/mklib, not $(top_builddir)/libtool
|
||||
b) in AC_LIBTOOL_SETUP macro, the variable default_ofile is set to
|
||||
"mklib" instead of "libtool"
|
||||
c) s/AC_ENABLE_SHARED_DEFAULT/enable_shared_default/g
|
||||
d) s/AC_ENABLE_STATIC_DEFAULT/enable_static_default/g
|
||||
e) s/AC_ENABLE_FAST_INSTALL_DEFAULT/enable_fast_install_default/g
|
||||
10. Run "autoupdate libtool.m4 ltdl.m4" in the llvm/autoconf/m4 directory.
|
||||
This should correctly update the macro definitions in the libtool m4
|
||||
files to match the version of autoconf that LLVM uses. This converts
|
||||
AC_HELP_STRING to AS_HELP_STRING and AC_TRY_LINK to AC_LINK_IFELSE, amongst
|
||||
other things. You may need to manually adjust the files.
|
||||
11. Run AutoRegen.sh to get the new macros into configure script
|
||||
12. If there are any warnings from AutoRegen.sh, go to step 9.
|
||||
13. Rebuild LLVM, making sure it reconfigures
|
||||
14. Test the JIT which uses libltdl
|
||||
15. If it all works, only THEN commit the changes.
|
||||
|
||||
Upgrading autoconf
|
||||
===============================================================================
|
||||
|
||||
If you are in the mood to upgrade autoconf, you should:
|
||||
|
||||
1. Consider not upgrading.
|
||||
2. No really, this is a hassle, you don't want to do it.
|
||||
3. Get the new version of autoconf and put it in <SRC>
|
||||
4. configure/build/install autoconf with --prefix=<PFX>
|
||||
5. Run autoupdate on all the m4 macros in llvm/autoconf/m4
|
||||
6. Run autoupdate on llvm/autoconf/configure.ac
|
||||
7. Regenerate configure script with AutoRegen.sh
|
||||
8. If there are any warnings from AutoRegen.sh, fix them and go to step 7.
|
||||
9. Test, test, test.
|
||||
6198
llvm/autoconf/aclocal.m4
vendored
Normal file
6198
llvm/autoconf/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
129
llvm/autoconf/config.guess
vendored
129
llvm/autoconf/config.guess
vendored
@@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2004-09-07'
|
||||
timestamp='2003-02-22'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@@ -53,7 +53,7 @@ version="\
|
||||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
@@ -106,7 +106,6 @@ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
|
||||
: ${TMPDIR=/tmp} ;
|
||||
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
|
||||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
|
||||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
|
||||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
|
||||
dummy=$tmp/dummy ;
|
||||
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
|
||||
@@ -197,21 +196,15 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||
echo "${machine}-${os}${release}"
|
||||
exit 0 ;;
|
||||
amd64:OpenBSD:*:*)
|
||||
echo x86_64-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
cats:OpenBSD:*:*)
|
||||
echo arm-unknown-openbsd${UNAME_RELEASE}
|
||||
arc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
luna88k:OpenBSD:*:*)
|
||||
echo m88k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@@ -227,33 +220,25 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
mvmeppc:OpenBSD:*:*)
|
||||
echo powerpc-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pmax:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sgi:OpenBSD:*:*)
|
||||
echo mips64-unknown-openbsd${UNAME_RELEASE}
|
||||
echo mipseb-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:ekkoBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
macppc:MirBSD:*:*)
|
||||
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:MirBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
alpha:OSF1:*:*)
|
||||
case $UNAME_RELEASE in
|
||||
*4.0)
|
||||
if test $UNAME_RELEASE = "V4.0"; then
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
;;
|
||||
*5.*)
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# According to Compaq, /usr/sbin/psrinfo has been available on
|
||||
# OSF/1 and Tru64 systems produced since 1995. I hope that
|
||||
# covers most systems running today. This code pipes the CPU
|
||||
@@ -291,12 +276,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
"EV7.9 (21364A)")
|
||||
UNAME_MACHINE="alphaev79" ;;
|
||||
esac
|
||||
# A Pn.n version is a patched version.
|
||||
# A Vn.n version is a released version.
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
exit 0 ;;
|
||||
Alpha\ *:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
@@ -319,9 +303,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:OS/390:*:*)
|
||||
echo i370-ibm-openedition
|
||||
exit 0 ;;
|
||||
*:OS400:*:*)
|
||||
echo powerpc-ibm-os400
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
@@ -339,9 +320,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
NILE*:*:*:dcosx)
|
||||
echo pyramid-pyramid-svr4
|
||||
exit 0 ;;
|
||||
DRS?6000:unix:4.0:6*)
|
||||
echo sparc-icl-nx6
|
||||
exit 0 ;;
|
||||
DRS?6000:UNIX_SV:4.2*:7*)
|
||||
case `/usr/bin/uname -p` in
|
||||
sparc) echo sparc-icl-nx7 && exit 0 ;;
|
||||
@@ -414,9 +392,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
m68k:machten:*:*)
|
||||
echo m68k-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
powerpc:machten:*:*)
|
||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@@ -752,7 +727,7 @@ EOF
|
||||
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
*:UNICOS/mp:*:*)
|
||||
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
@@ -760,11 +735,6 @@ EOF
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
5000:UNIX_System_V:4.*:*)
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@@ -775,7 +745,18 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
# Determine whether the default compiler uses glibc.
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#include <features.h>
|
||||
#if __GLIBC__ >= 2
|
||||
LIBC=gnu
|
||||
#else
|
||||
LIBC=
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
@@ -786,8 +767,8 @@ EOF
|
||||
i*:PW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-pw32
|
||||
exit 0 ;;
|
||||
x86:Interix*:[34]*)
|
||||
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
|
||||
x86:Interix*:3*)
|
||||
echo i586-pc-interix3
|
||||
exit 0 ;;
|
||||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||
echo i${UNAME_MACHINE}-pc-mks
|
||||
@@ -808,34 +789,17 @@ EOF
|
||||
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
*:GNU:*:*)
|
||||
# the GNU system
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:GNU/*:*:*)
|
||||
# other systems with GNU libc and userland
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
|
||||
exit 0 ;;
|
||||
i*86:Minix:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-minix
|
||||
exit 0 ;;
|
||||
arm*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
cris:Linux:*:*)
|
||||
echo cris-axis-linux-gnu
|
||||
exit 0 ;;
|
||||
crisv32:Linux:*:*)
|
||||
echo crisv32-axis-linux-gnu
|
||||
exit 0 ;;
|
||||
frv:Linux:*:*)
|
||||
echo frv-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
m32r*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
@@ -911,9 +875,6 @@ EOF
|
||||
s390:Linux:*:* | s390x:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-ibm-linux
|
||||
exit 0 ;;
|
||||
sh64*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
sh*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
@@ -971,9 +932,6 @@ EOF
|
||||
LIBC=gnuaout
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __dietlibc__
|
||||
LIBC=dietlibc
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
|
||||
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
|
||||
@@ -1004,9 +962,6 @@ EOF
|
||||
i*86:atheos:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-atheos
|
||||
exit 0 ;;
|
||||
i*86:syllable:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-syllable
|
||||
exit 0 ;;
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@@ -1076,9 +1031,9 @@ EOF
|
||||
M680?0:D-NIX:5.3:*)
|
||||
echo m68k-diab-dnix
|
||||
exit 0 ;;
|
||||
M68*:*:R3V[5678]*:*)
|
||||
M68*:*:R3V[567]*:*)
|
||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
|
||||
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0)
|
||||
OS_REL=''
|
||||
test -r /etc/.relid \
|
||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||
@@ -1176,10 +1131,9 @@ EOF
|
||||
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:Darwin:*:*)
|
||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||
case $UNAME_PROCESSOR in
|
||||
case `uname -p` in
|
||||
*86) UNAME_PROCESSOR=i686 ;;
|
||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||
powerpc) UNAME_PROCESSOR=powerpc ;;
|
||||
esac
|
||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@@ -1194,7 +1148,7 @@ EOF
|
||||
*:QNX:*:4*)
|
||||
echo i386-pc-qnx
|
||||
exit 0 ;;
|
||||
NSR-?:NONSTOP_KERNEL:*:*)
|
||||
NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
|
||||
echo nsr-tandem-nsk${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:NonStop-UX:*:*)
|
||||
@@ -1235,19 +1189,6 @@ EOF
|
||||
*:ITS:*:*)
|
||||
echo pdp10-unknown-its
|
||||
exit 0 ;;
|
||||
SEI:*:*:SEIUX)
|
||||
echo mips-sei-seiux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:DragonFly:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
*:*VMS:*:*)
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
case "${UNAME_MACHINE}" in
|
||||
A*) echo alpha-dec-vms && exit 0 ;;
|
||||
I*) echo ia64-dec-vms && exit 0 ;;
|
||||
V*) echo vax-dec-vms && exit 0 ;;
|
||||
esac
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
|
||||
134
llvm/autoconf/config.sub
vendored
134
llvm/autoconf/config.sub
vendored
@@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2004-08-29'
|
||||
timestamp='2003-02-22'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@@ -70,7 +70,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
@@ -118,8 +118,7 @@ esac
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
|
||||
kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@@ -145,7 +144,7 @@ case $os in
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis | -knuth | -cray)
|
||||
-apple | -axis)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
@@ -229,15 +228,14 @@ case $basic_machine in
|
||||
| a29k \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||
| c4x | clipper \
|
||||
| clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| m32r | m32rle | m68000 | m68k | m88k | mcore \
|
||||
| ip2k \
|
||||
| m32r | m68000 | m68k | m88k | mcore \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
@@ -249,7 +247,6 @@ case $basic_machine in
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipstx39 | mipstx39el \
|
||||
@@ -262,9 +259,9 @@ case $basic_machine in
|
||||
| pyramid \
|
||||
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
|
||||
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
|
||||
| strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| tahoe | thumb | tic80 | tron \
|
||||
| v850 | v850e \
|
||||
| we32k \
|
||||
| x86 | xscale | xstormy16 | xtensa \
|
||||
@@ -300,15 +297,15 @@ case $basic_machine in
|
||||
| avr-* \
|
||||
| bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| clipper-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| m32r-* | m32rle-* \
|
||||
| ip2k-* \
|
||||
| m32r-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | mcore-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
@@ -322,13 +319,11 @@ case $basic_machine in
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| mmix-* \
|
||||
| msp430-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
@@ -337,7 +332,7 @@ case $basic_machine in
|
||||
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tron-* \
|
||||
@@ -364,9 +359,6 @@ case $basic_machine in
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
abacus)
|
||||
basic_machine=abacus-unknown
|
||||
;;
|
||||
adobe68k)
|
||||
basic_machine=m68010-adobe
|
||||
os=-scout
|
||||
@@ -381,12 +373,6 @@ case $basic_machine in
|
||||
basic_machine=a29k-none
|
||||
os=-bsd
|
||||
;;
|
||||
amd64)
|
||||
basic_machine=x86_64-pc
|
||||
;;
|
||||
amd64-*)
|
||||
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
@@ -446,27 +432,12 @@ case $basic_machine in
|
||||
basic_machine=j90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
craynv)
|
||||
basic_machine=craynv-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
cr16c)
|
||||
basic_machine=cr16c-unknown
|
||||
os=-elf
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
crisv32 | crisv32-* | etraxfs*)
|
||||
basic_machine=crisv32-axis
|
||||
;;
|
||||
cris | cris-* | etrax*)
|
||||
basic_machine=cris-axis
|
||||
;;
|
||||
crx)
|
||||
basic_machine=crx-unknown
|
||||
os=-elf
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
@@ -667,6 +638,10 @@ case $basic_machine in
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
mmix*)
|
||||
basic_machine=mmix-knuth
|
||||
os=-mmixware
|
||||
;;
|
||||
monitor)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
@@ -747,6 +722,10 @@ case $basic_machine in
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
nv1)
|
||||
basic_machine=nv1-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
@@ -758,10 +737,6 @@ case $basic_machine in
|
||||
basic_machine=or32-unknown
|
||||
os=-coff
|
||||
;;
|
||||
os400)
|
||||
basic_machine=powerpc-ibm
|
||||
os=-os400
|
||||
;;
|
||||
OSE68000 | ose68000)
|
||||
basic_machine=m68000-ericsson
|
||||
os=-ose
|
||||
@@ -793,24 +768,18 @@ case $basic_machine in
|
||||
pentiumpro | p6 | 6x86 | athlon | athlon_*)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentiumii | pentium2 | pentiumiii | pentium3)
|
||||
pentiumii | pentium2)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentium4)
|
||||
basic_machine=i786-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-* | 6x86-* | athlon-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
|
||||
pentiumii-* | pentium2-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentium4-*)
|
||||
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
@@ -869,10 +838,6 @@ case $basic_machine in
|
||||
sb1el)
|
||||
basic_machine=mipsisa64sb1el-unknown
|
||||
;;
|
||||
sei)
|
||||
basic_machine=mips-sei
|
||||
os=-seiux
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
@@ -880,9 +845,6 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
sparclite-wrs | simso-wrs)
|
||||
basic_machine=sparclite-wrs
|
||||
os=-vxworks
|
||||
@@ -957,6 +919,10 @@ case $basic_machine in
|
||||
basic_machine=t90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic4x | c4x*)
|
||||
basic_machine=tic4x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
basic_machine=tic54x-unknown
|
||||
os=-coff
|
||||
@@ -982,10 +948,6 @@ case $basic_machine in
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
tpf)
|
||||
basic_machine=s390x-ibm
|
||||
os=-tpf
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
@@ -1059,9 +1021,6 @@ case $basic_machine in
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
mmix)
|
||||
basic_machine=mmix-knuth
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
@@ -1084,7 +1043,7 @@ case $basic_machine in
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
sparc | sparcv8 | sparcv9 | sparcv9b)
|
||||
sparc | sparcv9 | sparcv9b)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
@@ -1157,20 +1116,19 @@ case $os in
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
|
||||
| -powermax* | -dnix*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@@ -1194,9 +1152,6 @@ case $os in
|
||||
-mac*)
|
||||
os=`echo $os | sed -e 's|mac|macos|'`
|
||||
;;
|
||||
-linux-dietlibc)
|
||||
os=-linux-dietlibc
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
@@ -1209,9 +1164,6 @@ case $os in
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-os400*)
|
||||
os=-os400
|
||||
;;
|
||||
-wince*)
|
||||
os=-wince
|
||||
;;
|
||||
@@ -1233,9 +1185,6 @@ case $os in
|
||||
-atheos*)
|
||||
os=-atheos
|
||||
;;
|
||||
-syllable*)
|
||||
os=-syllable
|
||||
;;
|
||||
-386bsd)
|
||||
os=-bsd
|
||||
;;
|
||||
@@ -1258,9 +1207,6 @@ case $os in
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-tpf*)
|
||||
os=-tpf
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
@@ -1328,9 +1274,6 @@ case $basic_machine in
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
os=-tops20
|
||||
@@ -1377,9 +1320,6 @@ case $basic_machine in
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-knuth)
|
||||
os=-mmixware
|
||||
;;
|
||||
*-wec)
|
||||
os=-proelf
|
||||
;;
|
||||
@@ -1512,15 +1452,9 @@ case $basic_machine in
|
||||
-mvs* | -opened*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-os400*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-tpf*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-vxsim* | -vxworks* | -windiss*)
|
||||
vendor=wrs
|
||||
;;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,522 +0,0 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2004-05-31.23
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit 0
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> $depfile
|
||||
echo >> $depfile
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> $depfile
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
|
||||
tmpdepfile="$stripped.u"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test -f "$tmpdepfile"; then :
|
||||
else
|
||||
stripped=`echo "$stripped" | sed 's,^.*/,,'`
|
||||
tmpdepfile="$stripped.u"
|
||||
fi
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile"; then
|
||||
outname="$stripped.o"
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Dependencies are output in .lo.d with libtool 1.4.
|
||||
# With libtool 1.5 they are output both in $dir.libs/$base.o.d
|
||||
# and in $dir.libs/$base.o.d and $dir$base.o.d. We process the
|
||||
# latter, because the former will be cleaned when $dir.libs is
|
||||
# erased.
|
||||
tmpdepfile1="$dir.libs/$base.lo.d"
|
||||
tmpdepfile2="$dir$base.o.d"
|
||||
tmpdepfile3="$dir.libs/$base.d"
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1="$dir$base.o.d"
|
||||
tmpdepfile2="$dir$base.d"
|
||||
tmpdepfile3="$dir$base.d"
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile1"; then
|
||||
tmpdepfile="$tmpdepfile1"
|
||||
elif test -f "$tmpdepfile2"; then
|
||||
tmpdepfile="$tmpdepfile2"
|
||||
else
|
||||
tmpdepfile="$tmpdepfile3"
|
||||
fi
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no
|
||||
for arg in "$@"; do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
"$@" || exit $?
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
@@ -1,38 +1,19 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2004-09-10.20
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
@@ -42,11 +23,13 @@ scriptversion=2004-09-10.20
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
@@ -58,265 +41,211 @@ stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=
|
||||
chgrpcmd=
|
||||
stripcmd=
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dstarg=
|
||||
no_target_directory=
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
Options:
|
||||
-c (ignored)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
|
||||
"
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
while test -n "$1"; do
|
||||
case $1 in
|
||||
-c) shift
|
||||
continue;;
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
--help) echo "$usage"; exit 0;;
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd=$stripprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t) dstarg=$2
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-T) no_target_directory=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit 0;;
|
||||
|
||||
*) # When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
test -n "$dir_arg$dstarg" && break
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dstarg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dstarg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dstarg=$arg
|
||||
done
|
||||
break;;
|
||||
esac
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test -z "$1"; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src ;;
|
||||
esac
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
src=
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if test -d "$dst"; then
|
||||
mkdircmd=:
|
||||
chmodcmd=
|
||||
else
|
||||
mkdircmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
:
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
if test -z "$dstarg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
dst=$dstarg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst ;;
|
||||
esac
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
:
|
||||
fi
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dstarg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst/`basename "$src"`
|
||||
fi
|
||||
fi
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# This sed command emulates the dirname command.
|
||||
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if test ! -d "$dstdir"; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-$defaultIFS}"
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
oIFS=$IFS
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS=$oIFS
|
||||
pathcomp=''
|
||||
|
||||
pathcomp=
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
while test $# -ne 0 ; do
|
||||
pathcomp=$pathcomp$1
|
||||
shift
|
||||
if test ! -d "$pathcomp"; then
|
||||
$mkdirprog "$pathcomp"
|
||||
# mkdir can fail with a `File exist' error in case several
|
||||
# install-sh are creating the directory concurrently. This
|
||||
# is OK.
|
||||
test -d "$pathcomp" || exit
|
||||
fi
|
||||
pathcomp=$pathcomp/
|
||||
done
|
||||
fi
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
$doit $mkdircmd "$dst" \
|
||||
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
|
||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
|
||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
|
||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
|
||||
|
||||
else
|
||||
dstfile=`basename "$dst"`
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
$doit $cpprog "$src" "$dsttmp" &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
|
||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
|
||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
|
||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|
||||
|| {
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
if test -f "$dstdir/$dstfile"; then
|
||||
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|
||||
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|
||||
|| {
|
||||
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
||||
(exit 1); exit
|
||||
}
|
||||
else
|
||||
:
|
||||
fi
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
||||
}
|
||||
}
|
||||
fi || { (exit 1); exit; }
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
# The final little trick to "correctly" pass the exit status to the exit trap.
|
||||
{
|
||||
(exit 0); exit
|
||||
}
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,15 +0,0 @@
|
||||
#
|
||||
# Check for Bison.
|
||||
#
|
||||
# This macro verifies that Bison is installed. If successful, then
|
||||
# 1) YACC is set to bison -y (to emulate YACC calls)
|
||||
# 2) BISON is set to bison
|
||||
#
|
||||
AC_DEFUN([AC_PROG_BISON],
|
||||
[AC_CACHE_CHECK([],[llvm_cv_has_bison],[AC_PROG_YACC()])
|
||||
if test "$YACC" != "bison -y"; then
|
||||
AC_SUBST(BISON,[])
|
||||
AC_MSG_WARN([bison not found, can't rebuild grammars])
|
||||
else
|
||||
AC_SUBST(BISON,[bison])
|
||||
fi])
|
||||
@@ -1,42 +0,0 @@
|
||||
# Check for the extension used for executables on build platform.
|
||||
# This is necessary for cross-compiling where the build platform
|
||||
# may differ from the host platform.
|
||||
AC_DEFUN([AC_BUILD_EXEEXT],
|
||||
[
|
||||
AC_MSG_CHECKING([for executable suffix on build platform])
|
||||
AC_CACHE_VAL(ac_cv_build_exeext,
|
||||
[if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
|
||||
ac_cv_build_exeext=.exe
|
||||
else
|
||||
ac_build_prefix=${build_alias}-
|
||||
|
||||
AC_CHECK_PROG(BUILD_CC, ${ac_build_prefix}gcc, ${ac_build_prefix}gcc)
|
||||
if test -z "$BUILD_CC"; then
|
||||
AC_CHECK_PROG(BUILD_CC, gcc, gcc)
|
||||
if test -z "$BUILD_CC"; then
|
||||
AC_CHECK_PROG(BUILD_CC, cc, cc, , , /usr/ucb/cc)
|
||||
fi
|
||||
fi
|
||||
test -z "$BUILD_CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
|
||||
ac_build_link='${BUILD_CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AS_MESSAGE_LOG_FD'
|
||||
rm -f conftest*
|
||||
echo 'int main () { return 0; }' > conftest.$ac_ext
|
||||
ac_cv_build_exeext=
|
||||
if AC_TRY_EVAL(ac_build_link); then
|
||||
for file in conftest.*; do
|
||||
case $file in
|
||||
*.c | *.o | *.obj) ;;
|
||||
*) ac_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.])
|
||||
fi
|
||||
rm -f conftest*
|
||||
test x"${ac_cv_build_exeext}" = x && ac_cv_build_exeext=blank
|
||||
fi])
|
||||
BUILD_EXEEXT=""
|
||||
test x"${ac_cv_build_exeext}" != xblank && BUILD_EXEEXT=${ac_cv_build_exeext}
|
||||
AC_MSG_RESULT(${ac_cv_build_exeext})
|
||||
ac_build_exeext=$BUILD_EXEEXT
|
||||
AC_SUBST(BUILD_EXEEXT)])
|
||||
@@ -1,31 +0,0 @@
|
||||
#
|
||||
# Determine if the printf() functions have the %a format character.
|
||||
# This is modified from:
|
||||
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html
|
||||
AC_DEFUN([AC_C_PRINTF_A],
|
||||
[AC_CACHE_CHECK([if printf has the %a format character],[llvm_cv_c_printf_a],
|
||||
[AC_LANG_PUSH([C])
|
||||
AC_RUN_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
]],[[
|
||||
volatile double A, B;
|
||||
char Buffer[100];
|
||||
A = 1;
|
||||
A /= 10.0;
|
||||
sprintf(Buffer, "%a", A);
|
||||
B = atof(Buffer);
|
||||
if (A != B)
|
||||
return (1);
|
||||
if (A != 0x1.999999999999ap-4)
|
||||
return (1);
|
||||
return (0);]])],
|
||||
llvm_cv_c_printf_a=yes,
|
||||
llvmac_cv_c_printf_a=no,
|
||||
llvmac_cv_c_printf_a=no)
|
||||
AC_LANG_POP([C])])
|
||||
if test "$llvm_cv_c_printf_a" = "yes"; then
|
||||
AC_DEFINE([HAVE_PRINTF_A],[1],[Define to have the %a format string])
|
||||
fi
|
||||
])
|
||||
@@ -1,26 +0,0 @@
|
||||
#
|
||||
# Check for GNU Make. This is originally from
|
||||
# http://www.gnu.org/software/ac-archive/htmldoc/check_gnu_make.html
|
||||
#
|
||||
AC_DEFUN([AC_CHECK_GNU_MAKE],
|
||||
[AC_CACHE_CHECK([for GNU make],[llvm_cv_gnu_make_command],
|
||||
dnl Search all the common names for GNU make
|
||||
[llvm_cv_gnu_make_command=''
|
||||
for a in "$MAKE" make gmake gnumake ; do
|
||||
if test -z "$a" ; then continue ; fi ;
|
||||
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null )
|
||||
then
|
||||
llvm_cv_gnu_make_command=$a ;
|
||||
break;
|
||||
fi
|
||||
done])
|
||||
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string,
|
||||
dnl '#' otherwise
|
||||
if test "x$llvm_cv_gnu_make_command" != "x" ; then
|
||||
ifGNUmake='' ;
|
||||
else
|
||||
ifGNUmake='#' ;
|
||||
AC_MSG_RESULT("Not found");
|
||||
fi
|
||||
AC_SUBST(ifGNUmake)
|
||||
])
|
||||
@@ -1,9 +0,0 @@
|
||||
#
|
||||
# Configure a Makefile without clobbering it if it exists and is not out of
|
||||
# date. This macro is unique to LLVM.
|
||||
#
|
||||
AC_DEFUN([AC_CONFIG_MAKEFILE],
|
||||
[AC_CONFIG_COMMANDS($1,
|
||||
[${llvm_src}/autoconf/mkinstalldirs `dirname $1`
|
||||
${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/$1 $1])
|
||||
])
|
||||
@@ -1,14 +0,0 @@
|
||||
#
|
||||
# Provide the arguments and other processing needed for an LLVM project
|
||||
#
|
||||
AC_DEFUN([LLVM_CONFIG_PROJECT],
|
||||
[AC_ARG_WITH([llvmsrc],
|
||||
AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),
|
||||
[llvm_src="$withval"],[llvm_src="]$1["])
|
||||
AC_SUBST(LLVM_SRC,$llvm_src)
|
||||
AC_ARG_WITH([llvmobj],
|
||||
AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),
|
||||
[llvm_obj="$withval"],[llvm_obj="]$2["])
|
||||
AC_SUBST(LLVM_OBJ,$llvm_obj)
|
||||
AC_CONFIG_COMMANDS([setup],,[llvm_src="${LLVM_SRC}"])
|
||||
])
|
||||
@@ -1,22 +0,0 @@
|
||||
#
|
||||
# Check for bidirectional iterator extension. This is modified from
|
||||
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html
|
||||
#
|
||||
AC_DEFUN([AC_CXX_HAVE_BI_ITERATOR],
|
||||
[AC_CACHE_CHECK(whether the compiler has the bidirectional iterator,
|
||||
ac_cv_cxx_have_bi_iterator,
|
||||
[AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <iterator>
|
||||
#ifdef HAVE_NAMESPACES
|
||||
using namespace std;
|
||||
#endif]], [[bidirectional_iterator<int,int> t; return 0;]])],[ac_cv_cxx_have_bi_iterator=yes],[ac_cv_cxx_have_bi_iterator=no])
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
if test "$ac_cv_cxx_have_bi_iterator" = yes
|
||||
then
|
||||
AC_DEFINE(HAVE_BI_ITERATOR,1,[Have bi-directional iterator])
|
||||
else
|
||||
AC_DEFINE(HAVE_BI_ITERATOR,0,[Does not have bi-directional iterator])
|
||||
fi
|
||||
])
|
||||
@@ -1,22 +0,0 @@
|
||||
# Check for forward iterator extension. This is modified from
|
||||
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html
|
||||
AC_DEFUN([AC_CXX_HAVE_FWD_ITERATOR],
|
||||
[AC_CACHE_CHECK(whether the compiler has forward iterators,
|
||||
ac_cv_cxx_have_fwd_iterator,
|
||||
[AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <iterator>
|
||||
#ifdef HAVE_NAMESPACES
|
||||
using namespace std;
|
||||
#endif]], [[forward_iterator<int,int> t; return 0;]])],[ac_cv_cxx_have_fwd_iterator=yes],[ac_cv_cxx_have_fwd_iterator=no])
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
if test "$ac_cv_cxx_have_fwd_iterator" = yes
|
||||
then
|
||||
AC_DEFINE(HAVE_FWD_ITERATOR,1,[Have forward iterator])
|
||||
else
|
||||
AC_DEFINE(HAVE_FWD_ITERATOR,0,[Does not have forward iterator])
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
# Check for hash_map extension. This is from
|
||||
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_map.html
|
||||
AC_DEFUN([AC_CXX_HAVE_STD_EXT_HASH_MAP],
|
||||
[AC_CACHE_CHECK([whether the compiler has <ext/hash_map> defining template class std::hash_map],
|
||||
ac_cv_cxx_have_std_ext_hash_map,
|
||||
[AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ext/hash_map>
|
||||
#ifdef HAVE_NAMESPACES
|
||||
using namespace std;
|
||||
#endif]], [[hash_map<int, int> t;]])],[ac_cv_cxx_have_std_ext_hash_map=yes],[ac_cv_cxx_have_std_ext_hash_map=no])
|
||||
AC_LANG_POP([C++])])
|
||||
if test "$ac_cv_cxx_have_std_ext_hash_map" = yes
|
||||
then
|
||||
AC_DEFINE(HAVE_STD_EXT_HASH_MAP,1,[Have ext/hash_map>])
|
||||
else
|
||||
AC_DEFINE(HAVE_STD_EXT_HASH_MAP,0,[Does not have ext/hash_map>])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_CXX_HAVE_GNU_EXT_HASH_MAP],
|
||||
[AC_CACHE_CHECK([whether the compiler has <ext/hash_map> defining template class __gnu_cxx::hash_map],
|
||||
ac_cv_cxx_have_gnu_ext_hash_map,
|
||||
[AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ext/hash_map>
|
||||
#ifdef HAVE_NAMESPACES
|
||||
using namespace __gnu_cxx;
|
||||
#endif]], [[hash_map<int,int> t; ]])],[ac_cv_cxx_have_gnu_ext_hash_map=yes],[ac_cv_cxx_have_gnu_ext_hash_map=no])
|
||||
AC_LANG_POP([C++])])
|
||||
if test "$ac_cv_cxx_have_gnu_ext_hash_map" = yes
|
||||
then
|
||||
AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,1,[Have ext/hash_map])
|
||||
else
|
||||
AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,0,[Does not have ext/hash_map])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_CXX_HAVE_GLOBAL_HASH_MAP],
|
||||
[AC_CACHE_CHECK([whether the compiler has <hash_map> defining template class ::hash_map],
|
||||
ac_cv_cxx_have_global_hash_map,
|
||||
[AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <hash_map>]], [[hash_map<int,int> t; ]])],[ac_cv_cxx_have_global_hash_map=yes],[ac_cv_cxx_have_global_hash_map=no])
|
||||
AC_LANG_POP([C++])])
|
||||
if test "$ac_cv_cxx_have_global_hash_map" = yes
|
||||
then
|
||||
AC_DEFINE(HAVE_GLOBAL_HASH_MAP,1,[Have <hash_map>])
|
||||
else
|
||||
AC_DEFINE(HAVE_GLOBAL_HASH_MAP,0,[Does not have <hash_map>])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_CXX_HAVE_HASH_MAP],
|
||||
[AC_CXX_HAVE_STD_EXT_HASH_MAP
|
||||
AC_CXX_HAVE_GNU_EXT_HASH_MAP
|
||||
AC_CXX_HAVE_GLOBAL_HASH_MAP])
|
||||
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
# Check for hash_set extension. This is modified from
|
||||
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html
|
||||
AC_DEFUN([AC_CXX_HAVE_STD_EXT_HASH_SET],
|
||||
[AC_CACHE_CHECK([whether the compiler has <ext/hash_set> defining template class std::hash_set],
|
||||
ac_cv_cxx_have_std_ext_hash_set,
|
||||
[AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ext/hash_set>
|
||||
#ifdef HAVE_NAMESPACES
|
||||
using namespace std;
|
||||
#endif]], [[hash_set<int> t; ]])],[ac_cv_cxx_have_std_ext_hash_set=yes],[ac_cv_cxx_have_std_ext_hash_set=no])
|
||||
AC_LANG_POP([C++])])
|
||||
if test "$ac_cv_cxx_have_std_ext_hash_set" = yes
|
||||
then
|
||||
AC_DEFINE(HAVE_STD_EXT_HASH_SET,1,[Have hash_set in std namespace])
|
||||
else
|
||||
AC_DEFINE(HAVE_STD_EXT_HASH_SET,0,[Does not have hash_set in std namespace])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_CXX_HAVE_GNU_EXT_HASH_SET],
|
||||
[AC_CACHE_CHECK(
|
||||
[whether the compiler has <ext/hash_set> defining template class __gnu_cxx::hash_set],
|
||||
ac_cv_cxx_have_gnu_ext_hash_set,
|
||||
[AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ext/hash_set>
|
||||
#ifdef HAVE_NAMESPACES
|
||||
using namespace __gnu_cxx;
|
||||
#endif]], [[hash_set<int> t; ]])],[ac_cv_cxx_have_gnu_ext_hash_set=yes],[ac_cv_cxx_have_gnu_ext_hash_set=no])
|
||||
AC_LANG_POP([C++])])
|
||||
if test "$ac_cv_cxx_have_gnu_ext_hash_set" = yes
|
||||
then
|
||||
AC_DEFINE(HAVE_GNU_EXT_HASH_SET,1,[Have hash_set in gnu namespace])
|
||||
else
|
||||
AC_DEFINE(HAVE_GNU_EXT_HASH_SET,0,[Does not have hash_set in gnu namespace])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_CXX_HAVE_GLOBAL_HASH_SET],
|
||||
[AC_CACHE_CHECK([whether the compiler has <hash_set> defining template class ::hash_set],
|
||||
ac_cv_cxx_have_global_hash_set,
|
||||
[AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <hash_set>]], [[hash_set<int> t; return 0;]])],[ac_cv_cxx_have_global_hash_set=yes],[ac_cv_cxx_have_global_hash_set=no])
|
||||
AC_LANG_POP([C++])])
|
||||
if test "$ac_cv_cxx_have_global_hash_set" = yes
|
||||
then
|
||||
AC_DEFINE(HAVE_GLOBAL_HASH_SET,1,[Have hash_set in global namespace])
|
||||
else
|
||||
AC_DEFINE(HAVE_GLOBAL_HASH_SET,0,[Does not have hash_set in global namespace])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_CXX_HAVE_HASH_SET],
|
||||
[AC_CXX_HAVE_STD_EXT_HASH_SET
|
||||
AC_CXX_HAVE_GNU_EXT_HASH_SET
|
||||
AC_CXX_HAVE_GLOBAL_HASH_SET])
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# Check for C++ namespace support. This is from
|
||||
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html
|
||||
#
|
||||
AC_DEFUN([AC_CXX_NAMESPACES],
|
||||
[AC_CACHE_CHECK(whether the compiler implements namespaces,
|
||||
ac_cv_cxx_namespaces,
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[[namespace Outer { namespace Inner { int i = 0; }}]],
|
||||
[[using namespace Outer::Inner; return i;]])],
|
||||
ac_cv_cxx_namespaces=yes,
|
||||
ac_cv_cxx_namespaces=no)
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
if test "$ac_cv_cxx_namespaces" = yes; then
|
||||
AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces])
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
# Check for standard iterator extension. This is modified from
|
||||
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html
|
||||
AC_DEFUN([AC_CXX_HAVE_STD_ITERATOR],
|
||||
[AC_CACHE_CHECK(whether the compiler has the standard iterator,
|
||||
ac_cv_cxx_have_std_iterator,
|
||||
[AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[[#include <iterator>
|
||||
#ifdef HAVE_NAMESPACES
|
||||
using namespace std;
|
||||
#endif]],
|
||||
[[iterator<int,int,int> t; return 0;]])],
|
||||
ac_cv_cxx_have_std_iterator=yes,
|
||||
ac_cv_cxx_have_std_iterator=no)
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
if test "$ac_cv_cxx_have_std_iterator" = yes
|
||||
then
|
||||
AC_DEFINE(HAVE_STD_ITERATOR,1,[Have std namespace iterator])
|
||||
else
|
||||
AC_DEFINE(HAVE_STD_ITERATOR,0,[Does not have std namespace iterator])
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
dnl Check for a standard program that has a bin, include and lib directory
|
||||
dnl
|
||||
dnl Parameters:
|
||||
dnl $1 - prefix directory to check
|
||||
dnl $2 - program name to check
|
||||
dnl $3 - header file to check
|
||||
dnl $4 - library file to check
|
||||
AC_DEFUN([CHECK_STD_PROGRAM],
|
||||
[m4_define([allcapsname],translit($2,a-z,A-Z))
|
||||
if test -n "$1" -a -d "$1" -a -n "$2" -a -d "$1/bin" -a -x "$1/bin/$2" ; then
|
||||
AC_SUBST([USE_]allcapsname(),["USE_]allcapsname()[ = 1"])
|
||||
AC_SUBST(allcapsname(),[$1/bin/$2])
|
||||
AC_SUBST(allcapsname()[_BIN],[$1/bin])
|
||||
AC_SUBST(allcapsname()[_DIR],[$1])
|
||||
if test -n "$3" -a -d "$1/include" -a -f "$1/include/$3" ; then
|
||||
AC_SUBST(allcapsname()[_INC],[$1/include])
|
||||
fi
|
||||
if test -n "$4" -a -d "$1/lib" -a -f "$1/lib/$4" ; then
|
||||
AC_SUBST(allcapsname()[_LIB],[$1/lib])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Find a program via --with options, in the path, or well known places
|
||||
dnl
|
||||
dnl Parameters:
|
||||
dnl $1 - program's executable name
|
||||
dnl $2 - header file name to check (optional)
|
||||
dnl $3 - library file name to check (optional)
|
||||
dnl $4 - alternate (long) name for the program
|
||||
AC_DEFUN([FIND_STD_PROGRAM],
|
||||
[m4_define([allcapsname],translit($1,a-z,A-Z))
|
||||
m4_define([stdprog_long_name],ifelse($4,,translit($1,[ !@#$%^&*()-+={}[]:;"',./?],[-]),translit($4,[ !@#$%^&*()-+={}[]:;"',./?],[-])))
|
||||
AC_MSG_CHECKING([for ]stdprog_long_name()[ bin/lib/include locations])
|
||||
AC_ARG_WITH($1,
|
||||
AS_HELP_STRING([--with-]stdprog_long_name()[=DIR],
|
||||
[Specify that the ]stdprog_long_name()[ install prefix is DIR]),
|
||||
$1[pfxdir=$withval],$1[pfxdir=nada])
|
||||
AC_ARG_WITH($1[-bin],
|
||||
AS_HELP_STRING([--with-]stdprog_long_name()[-bin=DIR],
|
||||
[Specify that the ]stdprog_long_name()[ binary is in DIR]),
|
||||
$1[bindir=$withval],$1[bindir=nada])
|
||||
AC_ARG_WITH($1[-lib],
|
||||
AS_HELP_STRING([--with-]stdprog_long_name()[-lib=DIR],
|
||||
[Specify that ]stdprog_long_name()[ libraries are in DIR]),
|
||||
$1[libdir=$withval],$1[libdir=nada])
|
||||
AC_ARG_WITH($1[-inc],
|
||||
AS_HELP_STRING([--with-]stdprog_long_name()[-inc=DIR],
|
||||
[Specify that the ]stdprog_long_name()[ includes are in DIR]),
|
||||
$1[incdir=$withval],$1[incdir=nada])
|
||||
eval pfxval=\$\{$1pfxdir\}
|
||||
eval binval=\$\{$1bindir\}
|
||||
eval incval=\$\{$1incdir\}
|
||||
eval libval=\$\{$1libdir\}
|
||||
if test "${pfxval}" != "nada" ; then
|
||||
CHECK_STD_PROGRAM(${pfxval},$1,$2,$3)
|
||||
elif test "${binval}" != "nada" ; then
|
||||
if test "${libval}" != "nada" ; then
|
||||
if test "${incval}" != "nada" ; then
|
||||
if test -d "${binval}" ; then
|
||||
if test -d "${incval}" ; then
|
||||
if test -d "${libval}" ; then
|
||||
AC_SUBST(allcapsname(),${binval}/$1)
|
||||
AC_SUBST(allcapsname()[_BIN],${binval})
|
||||
AC_SUBST(allcapsname()[_INC],${incval})
|
||||
AC_SUBST(allcapsname()[_LIB],${libval})
|
||||
AC_SUBST([USE_]allcapsname(),["USE_]allcapsname()[ = 1"])
|
||||
AC_MSG_RESULT([found via --with options])
|
||||
else
|
||||
AC_MSG_RESULT([failed])
|
||||
AC_MSG_ERROR([The --with-]$1[-libdir value must be a directory])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([failed])
|
||||
AC_MSG_ERROR([The --with-]$1[-incdir value must be a directory])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([failed])
|
||||
AC_MSG_ERROR([The --with-]$1[-bindir value must be a directory])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([failed])
|
||||
AC_MSG_ERROR([The --with-]$1[-incdir option must be specified])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([failed])
|
||||
AC_MSG_ERROR([The --with-]$1[-libdir option must be specified])
|
||||
fi
|
||||
else
|
||||
tmppfxdir=`which $1 2>&1`
|
||||
if test -n "$tmppfxdir" -a -d "${tmppfxdir%*$1}" -a \
|
||||
-d "${tmppfxdir%*$1}/.." ; then
|
||||
tmppfxdir=`cd "${tmppfxdir%*$1}/.." ; pwd`
|
||||
CHECK_STD_PROGRAM($tmppfxdir,$1,$2,$3)
|
||||
AC_MSG_RESULT([found in PATH at ]$tmppfxdir)
|
||||
else
|
||||
checkresult="yes"
|
||||
eval checkval=\$\{"USE_"allcapsname()\}
|
||||
CHECK_STD_PROGRAM([/usr],$1,$2,$3)
|
||||
if test -z "${checkval}" ; then
|
||||
CHECK_STD_PROGRAM([/usr/local],$1,$2,$3)
|
||||
if test -z "${checkval}" ; then
|
||||
CHECK_STD_PROGRAM([/sw],$1,$2,$3)
|
||||
if test -z "${checkval}" ; then
|
||||
CHECK_STD_PROGRAM([/opt],$1,$2,$3)
|
||||
if test -z "${checkval}" ; then
|
||||
CHECK_STD_PROGRAM([/],$1,$2,$3)
|
||||
if test -z "${checkval}" ; then
|
||||
checkresult="no"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT($checkresult)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
@@ -1,17 +0,0 @@
|
||||
#
|
||||
# Check for FLEX.
|
||||
#
|
||||
# This macro verifies that flex is installed. If successful, then
|
||||
# 1) $LEX is set to "flex" (to emulate lex calls)
|
||||
# 2) BISON is set to bison
|
||||
AC_DEFUN([AC_PROG_FLEX],
|
||||
[AC_CACHE_CHECK(,
|
||||
ac_cv_has_flex,
|
||||
[AC_PROG_LEX()
|
||||
])
|
||||
if test "$LEX" != "flex"; then
|
||||
AC_MSG_ERROR([flex not found but required])
|
||||
else
|
||||
AC_SUBST(FLEX,[flex],[location of flex])
|
||||
fi
|
||||
])
|
||||
@@ -1,36 +0,0 @@
|
||||
#
|
||||
# This function determins if the the isinf function isavailable on this
|
||||
# platform.
|
||||
#
|
||||
AC_DEFUN([AC_FUNC_ISINF],[
|
||||
AC_SINGLE_CXX_CHECK([ac_cv_func_isinf_in_math_h],
|
||||
[isinf], [<math.h>],
|
||||
[float f; isinf(f);])
|
||||
if test "$ac_cv_func_isinf_in_math_h" = "yes" ; then
|
||||
AC_DEFINE([HAVE_ISINF_IN_MATH_H],1,[Set to 1 if the isinf function is found in <math.h>])
|
||||
fi
|
||||
|
||||
AC_SINGLE_CXX_CHECK([ac_cv_func_isinf_in_cmath],
|
||||
[isinf], [<cmath>],
|
||||
[float f; isinf(f);])
|
||||
if test "$ac_cv_func_isinf_in_cmath" = "yes" ; then
|
||||
AC_DEFINE([HAVE_ISINF_IN_CMATH],1,[Set to 1 if the isinf function is found in <cmath>])
|
||||
fi
|
||||
|
||||
AC_SINGLE_CXX_CHECK([ac_cv_func_std_isinf_in_cmath],
|
||||
[std::isinf], [<cmath>],
|
||||
[float f; std::isinf(f)}])
|
||||
if test "$ac_cv_func_std_isinf_in_cmath" = "yes" ; then
|
||||
AC_DEFINE([HAVE_STD_ISINF_IN_CMATH],1,[Set to 1 if the std::isinf function is found in <cmath>])
|
||||
fi
|
||||
|
||||
AC_SINGLE_CXX_CHECK([ac_cv_func_finite_in_ieeefp_h],
|
||||
[finite], [<ieeefp.h>],
|
||||
[float f; finite(f);])
|
||||
if test "$ac_cv_func_finite_in_ieeefp_h" = "yes" ; then
|
||||
AC_DEFINE([HAVE_FINITE_IN_IEEEFP_H],1,[Set to 1 if the finite function is found in <ieeefp.h>])
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#
|
||||
# This function determines if the isnan function is available on this
|
||||
# platform.
|
||||
#
|
||||
AC_DEFUN([AC_FUNC_ISNAN],[
|
||||
AC_SINGLE_CXX_CHECK([ac_cv_func_isnan_in_math_h],
|
||||
[isnan], [<math.h>],
|
||||
[float f; isnan(f);])
|
||||
|
||||
if test "$ac_cv_func_isnan_in_math_h" = "yes" ; then
|
||||
AC_DEFINE([HAVE_ISNAN_IN_MATH_H],1,[Set to 1 if the isnan function is found in <math.h>])
|
||||
fi
|
||||
|
||||
AC_SINGLE_CXX_CHECK([ac_cv_func_isnan_in_cmath],
|
||||
[isnan], [<cmath>],
|
||||
[float f; isnan(f);])
|
||||
if test "$ac_cv_func_isnan_in_cmath" = "yes" ; then
|
||||
AC_DEFINE([HAVE_ISNAN_IN_CMATH],1,[Set to 1 if the isnan function is found in <cmath>])
|
||||
fi
|
||||
|
||||
AC_SINGLE_CXX_CHECK([ac_cv_func_std_isnan_in_cmath],
|
||||
[std::isnan], [<cmath>],
|
||||
[float f; std::isnan(f);])
|
||||
if test "$ac_cv_func_std_isnan_in_cmath" = "yes" ; then
|
||||
AC_DEFINE([HAVE_STD_ISNAN_IN_CMATH],1,[Set to 1 if the std::isnan function is found in <cmath>])
|
||||
fi
|
||||
])
|
||||
@@ -1,26 +0,0 @@
|
||||
#
|
||||
# Check for the ability to mmap a file.
|
||||
#
|
||||
AC_DEFUN([AC_FUNC_MMAP_FILE],
|
||||
[AC_CACHE_CHECK(for mmap of files,
|
||||
ac_cv_func_mmap_file,
|
||||
[ AC_LANG_PUSH([C])
|
||||
AC_RUN_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
]],[[
|
||||
int fd;
|
||||
fd = creat ("foo",0777);
|
||||
fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0);
|
||||
unlink ("foo");
|
||||
return (fd != (int) MAP_FAILED);]])],
|
||||
[ac_cv_func_mmap_file=yes],[ac_cv_func_mmap_file=no],[ac_cv_func_mmap_file=no])
|
||||
AC_LANG_POP([C])
|
||||
])
|
||||
if test "$ac_cv_func_mmap_file" = yes; then
|
||||
AC_DEFINE([HAVE_MMAP_FILE],[],[Define if mmap() can map files into memory])
|
||||
AC_SUBST(MMAP_FILE,[yes])
|
||||
fi
|
||||
])
|
||||
@@ -1,21 +0,0 @@
|
||||
#
|
||||
# Check for anonymous mmap macros. This is modified from
|
||||
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html
|
||||
#
|
||||
AC_DEFUN([AC_HEADER_MMAP_ANONYMOUS],
|
||||
[AC_CACHE_CHECK(for MAP_ANONYMOUS vs. MAP_ANON,
|
||||
ac_cv_header_mmap_anon,
|
||||
[ AC_LANG_PUSH([C])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[[#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>]],
|
||||
[[mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0);]])],
|
||||
ac_cv_header_mmap_anon=yes,
|
||||
ac_cv_header_mmap_anon=no)
|
||||
AC_LANG_POP([C])
|
||||
])
|
||||
if test "$ac_cv_header_mmap_anon" = yes; then
|
||||
AC_DEFINE([HAVE_MMAP_ANONYMOUS],[1],[Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if it uses MAP_ANON])
|
||||
fi
|
||||
])
|
||||
@@ -1,18 +0,0 @@
|
||||
#
|
||||
# This function determins if the the HUGE_VAL macro is compilable with the
|
||||
# -pedantic switch or not. XCode < 2.4.1 doesn't get it right.
|
||||
#
|
||||
AC_DEFUN([AC_HUGE_VAL_CHECK],[
|
||||
AC_CACHE_CHECK([for HUGE_VAL sanity], [ac_cv_huge_val_sanity],[
|
||||
AC_LANG_PUSH([C++])
|
||||
CXXFLAGS=-pedantic
|
||||
AC_RUN_IFELSE(
|
||||
AC_LANG_PROGRAM(
|
||||
[#include <math.h>],
|
||||
[double x = HUGE_VAL; return x != x; ]),
|
||||
[ac_cv_huge_val_sanity=yes],[ac_cv_huge_val_sanity=no],
|
||||
[ac_cv_huge_val_sanity=yes])
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
AC_SUBST(HUGE_VAL_SANITY,$ac_cv_huge_val_sanity)
|
||||
])
|
||||
6389
llvm/autoconf/m4/libtool.m4
vendored
6389
llvm/autoconf/m4/libtool.m4
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,19 +0,0 @@
|
||||
#
|
||||
# Determine if the system can handle the -R option being passed to the linker.
|
||||
#
|
||||
# This macro is specific to LLVM.
|
||||
#
|
||||
AC_DEFUN([AC_LINK_USE_R],
|
||||
[AC_CACHE_CHECK([for compiler -Wl,-R<path> option],[llvm_cv_link_use_r],
|
||||
[ AC_LANG_PUSH([C])
|
||||
oldcflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wl,-R."
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
|
||||
[llvm_cv_link_use_r=yes],[llvm_cv_link_use_r=no])
|
||||
CFLAGS="$oldcflags"
|
||||
AC_LANG_POP([C])
|
||||
])
|
||||
if test "$llvm_cv_link_use_r" = yes ; then
|
||||
AC_DEFINE([HAVE_LINK_R],[1],[Define if you can use -Wl,-R. to pass -R. to the linker, in order to add the current directory to the dynamic linker search path.])
|
||||
fi
|
||||
])
|
||||
@@ -1,418 +0,0 @@
|
||||
## ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*-
|
||||
## Copyright (C) 1999-2000 Free Software Foundation, Inc.
|
||||
##
|
||||
## This file is free software; the Free Software Foundation gives
|
||||
## unlimited permission to copy and/or distribute it, with or without
|
||||
## modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 7 AC_LIB_LTDL
|
||||
|
||||
# AC_WITH_LTDL
|
||||
# ------------
|
||||
# Clients of libltdl can use this macro to allow the installer to
|
||||
# choose between a shipped copy of the ltdl sources or a preinstalled
|
||||
# version of the library.
|
||||
AC_DEFUN([AC_WITH_LTDL],
|
||||
[AC_REQUIRE([AC_LIB_LTDL])
|
||||
AC_SUBST([LIBLTDL])
|
||||
AC_SUBST([INCLTDL])
|
||||
|
||||
# Unless the user asks us to check, assume no installed ltdl exists.
|
||||
use_installed_libltdl=no
|
||||
|
||||
AC_ARG_WITH([included_ltdl],
|
||||
[ --with-included-ltdl use the GNU ltdl sources included here])
|
||||
|
||||
if test "x$with_included_ltdl" != xyes; then
|
||||
# We are not being forced to use the included libltdl sources, so
|
||||
# decide whether there is a useful installed version we can use.
|
||||
AC_CHECK_HEADER([ltdl.h],
|
||||
[AC_CHECK_LIB([ltdl], [lt_dlcaller_register],
|
||||
[with_included_ltdl=no],
|
||||
[with_included_ltdl=yes])
|
||||
])
|
||||
fi
|
||||
|
||||
if test "x$enable_ltdl_install" != xyes; then
|
||||
# If the user did not specify an installable libltdl, then default
|
||||
# to a convenience lib.
|
||||
AC_LIBLTDL_CONVENIENCE
|
||||
fi
|
||||
|
||||
if test "x$with_included_ltdl" = xno; then
|
||||
# If the included ltdl is not to be used. then Use the
|
||||
# preinstalled libltdl we found.
|
||||
AC_DEFINE([HAVE_LTDL], [1],
|
||||
[Define this if a modern libltdl is already installed])
|
||||
LIBLTDL=-lltdl
|
||||
fi
|
||||
|
||||
# Report our decision...
|
||||
AC_MSG_CHECKING([whether to use included libltdl])
|
||||
AC_MSG_RESULT([$with_included_ltdl])
|
||||
|
||||
AC_CONFIG_SUBDIRS([libltdl])
|
||||
])# AC_WITH_LTDL
|
||||
|
||||
|
||||
# AC_LIB_LTDL
|
||||
# -----------
|
||||
# Perform all the checks necessary for compilation of the ltdl objects
|
||||
# -- including compiler checks and header checks.
|
||||
AC_DEFUN([AC_LIB_LTDL],
|
||||
[AC_PREREQ(2.60)
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_C_CONST])
|
||||
AC_REQUIRE([AC_HEADER_STDC])
|
||||
AC_REQUIRE([AC_HEADER_DIRENT])
|
||||
AC_REQUIRE([_LT_AC_CHECK_DLFCN])
|
||||
AC_REQUIRE([AC_LTDL_ENABLE_INSTALL])
|
||||
AC_REQUIRE([AC_LTDL_SHLIBEXT])
|
||||
AC_REQUIRE([AC_LTDL_SHLIBPATH])
|
||||
AC_REQUIRE([AC_LTDL_SYSSEARCHPATH])
|
||||
AC_REQUIRE([AC_LTDL_OBJDIR])
|
||||
AC_REQUIRE([AC_LTDL_DLPREOPEN])
|
||||
AC_REQUIRE([AC_LTDL_DLLIB])
|
||||
AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])
|
||||
AC_REQUIRE([AC_LTDL_DLSYM_USCORE])
|
||||
AC_REQUIRE([AC_LTDL_SYS_DLOPEN_DEPLIBS])
|
||||
AC_REQUIRE([AC_LTDL_FUNC_ARGZ])
|
||||
|
||||
AC_CHECK_HEADERS([assert.h ctype.h errno.h malloc.h memory.h stdlib.h \
|
||||
stdio.h unistd.h])
|
||||
AC_CHECK_HEADERS([dl.h sys/dl.h dld.h mach-o/dyld.h])
|
||||
AC_CHECK_HEADERS([string.h strings.h], [break])
|
||||
|
||||
AC_CHECK_FUNCS([strchr index], [break])
|
||||
AC_CHECK_FUNCS([strrchr rindex], [break])
|
||||
AC_CHECK_FUNCS([memcpy bcopy], [break])
|
||||
AC_CHECK_FUNCS([memmove strcmp])
|
||||
AC_CHECK_FUNCS([closedir opendir readdir])
|
||||
])# AC_LIB_LTDL
|
||||
|
||||
|
||||
# AC_LTDL_ENABLE_INSTALL
|
||||
# ----------------------
|
||||
AC_DEFUN([AC_LTDL_ENABLE_INSTALL],
|
||||
[AC_ARG_ENABLE([ltdl-install],
|
||||
[AS_HELP_STRING([--enable-ltdl-install],[install libltdl])])
|
||||
|
||||
AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno)
|
||||
AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)
|
||||
])# AC_LTDL_ENABLE_INSTALL
|
||||
|
||||
|
||||
# AC_LTDL_SYS_DLOPEN_DEPLIBS
|
||||
# --------------------------
|
||||
AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
|
||||
[libltdl_cv_sys_dlopen_deplibs],
|
||||
[# PORTME does your system automatically load deplibs for dlopen?
|
||||
# or its logical equivalent (e.g. shl_load for HP-UX < 11)
|
||||
# For now, we just catch OSes we know something about -- in the
|
||||
# future, we'll try test this programmatically.
|
||||
libltdl_cv_sys_dlopen_deplibs=unknown
|
||||
case "$host_os" in
|
||||
aix3*|aix4.1.*|aix4.2.*)
|
||||
# Unknown whether this is true for these versions of AIX, but
|
||||
# we want this `case' here to explicitly catch those versions.
|
||||
libltdl_cv_sys_dlopen_deplibs=unknown
|
||||
;;
|
||||
aix[[45]]*)
|
||||
libltdl_cv_sys_dlopen_deplibs=yes
|
||||
;;
|
||||
darwin*)
|
||||
# Assuming the user has installed a libdl from somewhere, this is true
|
||||
# If you are looking for one http://www.opendarwin.org/projects/dlcompat
|
||||
libltdl_cv_sys_dlopen_deplibs=yes
|
||||
;;
|
||||
gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
|
||||
# GNU and its variants, using gnu ld.so (Glibc)
|
||||
libltdl_cv_sys_dlopen_deplibs=yes
|
||||
;;
|
||||
hpux10*|hpux11*)
|
||||
libltdl_cv_sys_dlopen_deplibs=yes
|
||||
;;
|
||||
interix*)
|
||||
libltdl_cv_sys_dlopen_deplibs=yes
|
||||
;;
|
||||
irix[[12345]]*|irix6.[[01]]*)
|
||||
# Catch all versions of IRIX before 6.2, and indicate that we don't
|
||||
# know how it worked for any of those versions.
|
||||
libltdl_cv_sys_dlopen_deplibs=unknown
|
||||
;;
|
||||
irix*)
|
||||
# The case above catches anything before 6.2, and it's known that
|
||||
# at 6.2 and later dlopen does load deplibs.
|
||||
libltdl_cv_sys_dlopen_deplibs=yes
|
||||
;;
|
||||
netbsd*)
|
||||
libltdl_cv_sys_dlopen_deplibs=yes
|
||||
;;
|
||||
openbsd*)
|
||||
libltdl_cv_sys_dlopen_deplibs=yes
|
||||
;;
|
||||
osf[[1234]]*)
|
||||
# dlopen did load deplibs (at least at 4.x), but until the 5.x series,
|
||||
# it did *not* use an RPATH in a shared library to find objects the
|
||||
# library depends on, so we explictly say `no'.
|
||||
libltdl_cv_sys_dlopen_deplibs=no
|
||||
;;
|
||||
osf5.0|osf5.0a|osf5.1)
|
||||
# dlopen *does* load deplibs and with the right loader patch applied
|
||||
# it even uses RPATH in a shared library to search for shared objects
|
||||
# that the library depends on, but there's no easy way to know if that
|
||||
# patch is installed. Since this is the case, all we can really
|
||||
# say is unknown -- it depends on the patch being installed. If
|
||||
# it is, this changes to `yes'. Without it, it would be `no'.
|
||||
libltdl_cv_sys_dlopen_deplibs=unknown
|
||||
;;
|
||||
osf*)
|
||||
# the two cases above should catch all versions of osf <= 5.1. Read
|
||||
# the comments above for what we know about them.
|
||||
# At > 5.1, deplibs are loaded *and* any RPATH in a shared library
|
||||
# is used to find them so we can finally say `yes'.
|
||||
libltdl_cv_sys_dlopen_deplibs=yes
|
||||
;;
|
||||
solaris*)
|
||||
libltdl_cv_sys_dlopen_deplibs=yes
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
|
||||
libltdl_cv_sys_dlopen_deplibs=yes
|
||||
;;
|
||||
esac
|
||||
])
|
||||
if test "$libltdl_cv_sys_dlopen_deplibs" != yes; then
|
||||
AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1],
|
||||
[Define if the OS needs help to load dependent libraries for dlopen().])
|
||||
fi
|
||||
])# AC_LTDL_SYS_DLOPEN_DEPLIBS
|
||||
|
||||
|
||||
# AC_LTDL_SHLIBEXT
|
||||
# ----------------
|
||||
AC_DEFUN([AC_LTDL_SHLIBEXT],
|
||||
[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
|
||||
AC_CACHE_CHECK([which extension is used for loadable modules],
|
||||
[libltdl_cv_shlibext],
|
||||
[
|
||||
module=yes
|
||||
eval libltdl_cv_shlibext=$shrext_cmds
|
||||
])
|
||||
if test -n "$libltdl_cv_shlibext"; then
|
||||
AC_DEFINE_UNQUOTED([LTDL_SHLIB_EXT], ["$libltdl_cv_shlibext"],
|
||||
[Define to the extension used for shared libraries, say, ".so".])
|
||||
fi
|
||||
])# AC_LTDL_SHLIBEXT
|
||||
|
||||
|
||||
# AC_LTDL_SHLIBPATH
|
||||
# -----------------
|
||||
AC_DEFUN([AC_LTDL_SHLIBPATH],
|
||||
[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
|
||||
AC_CACHE_CHECK([which variable specifies run-time library path],
|
||||
[libltdl_cv_shlibpath_var], [libltdl_cv_shlibpath_var="$shlibpath_var"])
|
||||
if test -n "$libltdl_cv_shlibpath_var"; then
|
||||
AC_DEFINE_UNQUOTED([LTDL_SHLIBPATH_VAR], ["$libltdl_cv_shlibpath_var"],
|
||||
[Define to the name of the environment variable that determines the dynamic library search path.])
|
||||
fi
|
||||
])# AC_LTDL_SHLIBPATH
|
||||
|
||||
|
||||
# AC_LTDL_SYSSEARCHPATH
|
||||
# ---------------------
|
||||
AC_DEFUN([AC_LTDL_SYSSEARCHPATH],
|
||||
[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
|
||||
AC_CACHE_CHECK([for the default library search path],
|
||||
[libltdl_cv_sys_search_path],
|
||||
[libltdl_cv_sys_search_path="$sys_lib_dlsearch_path_spec"])
|
||||
if test -n "$libltdl_cv_sys_search_path"; then
|
||||
sys_search_path=
|
||||
for dir in $libltdl_cv_sys_search_path; do
|
||||
if test -z "$sys_search_path"; then
|
||||
sys_search_path="$dir"
|
||||
else
|
||||
sys_search_path="$sys_search_path$PATH_SEPARATOR$dir"
|
||||
fi
|
||||
done
|
||||
AC_DEFINE_UNQUOTED([LTDL_SYSSEARCHPATH], ["$sys_search_path"],
|
||||
[Define to the system default library search path.])
|
||||
fi
|
||||
])# AC_LTDL_SYSSEARCHPATH
|
||||
|
||||
|
||||
# AC_LTDL_OBJDIR
|
||||
# --------------
|
||||
AC_DEFUN([AC_LTDL_OBJDIR],
|
||||
[AC_CACHE_CHECK([for objdir],
|
||||
[libltdl_cv_objdir],
|
||||
[libltdl_cv_objdir="$objdir"
|
||||
if test -n "$objdir"; then
|
||||
:
|
||||
else
|
||||
rm -f .libs 2>/dev/null
|
||||
mkdir .libs 2>/dev/null
|
||||
if test -d .libs; then
|
||||
libltdl_cv_objdir=.libs
|
||||
else
|
||||
# MS-DOS does not allow filenames that begin with a dot.
|
||||
libltdl_cv_objdir=_libs
|
||||
fi
|
||||
rmdir .libs 2>/dev/null
|
||||
fi
|
||||
])
|
||||
AC_DEFINE_UNQUOTED([LTDL_OBJDIR], ["$libltdl_cv_objdir/"],
|
||||
[Define to the sub-directory in which libtool stores uninstalled libraries.])
|
||||
])# AC_LTDL_OBJDIR
|
||||
|
||||
|
||||
# AC_LTDL_DLPREOPEN
|
||||
# -----------------
|
||||
AC_DEFUN([AC_LTDL_DLPREOPEN],
|
||||
[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])
|
||||
AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
|
||||
[libltdl_cv_preloaded_symbols],
|
||||
[if test -n "$lt_cv_sys_global_symbol_pipe"; then
|
||||
libltdl_cv_preloaded_symbols=yes
|
||||
else
|
||||
libltdl_cv_preloaded_symbols=no
|
||||
fi
|
||||
])
|
||||
if test x"$libltdl_cv_preloaded_symbols" = xyes; then
|
||||
AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1],
|
||||
[Define if libtool can extract symbol lists from object files.])
|
||||
fi
|
||||
])# AC_LTDL_DLPREOPEN
|
||||
|
||||
|
||||
# AC_LTDL_DLLIB
|
||||
# -------------
|
||||
AC_DEFUN([AC_LTDL_DLLIB],
|
||||
[LIBADD_DL=
|
||||
AC_SUBST(LIBADD_DL)
|
||||
AC_LANG_PUSH([C])
|
||||
|
||||
AC_CHECK_FUNC([shl_load],
|
||||
[AC_DEFINE([HAVE_SHL_LOAD], [1],
|
||||
[Define if you have the shl_load function.])],
|
||||
[AC_CHECK_LIB([dld], [shl_load],
|
||||
[AC_DEFINE([HAVE_SHL_LOAD], [1],
|
||||
[Define if you have the shl_load function.])
|
||||
LIBADD_DL="$LIBADD_DL -ldld"],
|
||||
[AC_CHECK_LIB([dl], [dlopen],
|
||||
[AC_DEFINE([HAVE_LIBDL], [1],
|
||||
[Define if you have the libdl library or equivalent.])
|
||||
LIBADD_DL="-ldl" libltdl_cv_lib_dl_dlopen="yes"],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
]], [[dlopen(0, 0);]])],[AC_DEFINE([HAVE_LIBDL], [1],
|
||||
[Define if you have the libdl library or equivalent.]) libltdl_cv_func_dlopen="yes"],[AC_CHECK_LIB([svld], [dlopen],
|
||||
[AC_DEFINE([HAVE_LIBDL], [1],
|
||||
[Define if you have the libdl library or equivalent.])
|
||||
LIBADD_DL="-lsvld" libltdl_cv_func_dlopen="yes"],
|
||||
[AC_CHECK_LIB([dld], [dld_link],
|
||||
[AC_DEFINE([HAVE_DLD], [1],
|
||||
[Define if you have the GNU dld library.])
|
||||
LIBADD_DL="$LIBADD_DL -ldld"],
|
||||
[AC_CHECK_FUNC([_dyld_func_lookup],
|
||||
[AC_DEFINE([HAVE_DYLD], [1],
|
||||
[Define if you have the _dyld_func_lookup function.])])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes
|
||||
then
|
||||
lt_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBADD_DL"
|
||||
AC_CHECK_FUNCS([dlerror])
|
||||
LIBS="$lt_save_LIBS"
|
||||
fi
|
||||
AC_LANG_POP
|
||||
])# AC_LTDL_DLLIB
|
||||
|
||||
|
||||
# AC_LTDL_SYMBOL_USCORE
|
||||
# ---------------------
|
||||
# does the compiler prefix global symbols with an underscore?
|
||||
AC_DEFUN([AC_LTDL_SYMBOL_USCORE],
|
||||
[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])
|
||||
AC_CACHE_CHECK([for _ prefix in compiled symbols],
|
||||
[ac_cv_sys_symbol_underscore],
|
||||
[ac_cv_sys_symbol_underscore=no
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
void nm_test_func(){}
|
||||
int main(){nm_test_func;return 0;}
|
||||
EOF
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
# Now try to grab the symbols.
|
||||
ac_nlist=conftest.nm
|
||||
if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
|
||||
# See whether the symbols have a leading underscore.
|
||||
if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
|
||||
ac_cv_sys_symbol_underscore=yes
|
||||
else
|
||||
if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
|
||||
:
|
||||
else
|
||||
echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
|
||||
fi
|
||||
else
|
||||
echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
|
||||
cat conftest.c >&AS_MESSAGE_LOG_FD
|
||||
fi
|
||||
rm -rf conftest*
|
||||
])
|
||||
])# AC_LTDL_SYMBOL_USCORE
|
||||
|
||||
|
||||
# AC_LTDL_DLSYM_USCORE
|
||||
# --------------------
|
||||
AC_DEFUN([AC_LTDL_DLSYM_USCORE],
|
||||
[AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])
|
||||
if test x"$ac_cv_sys_symbol_underscore" = xyes; then
|
||||
if test x"$libltdl_cv_func_dlopen" = xyes ||
|
||||
test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then
|
||||
AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
|
||||
[libltdl_cv_need_uscore],
|
||||
[libltdl_cv_need_uscore=unknown
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBADD_DL"
|
||||
_LT_AC_TRY_DLOPEN_SELF(
|
||||
[libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes],
|
||||
[], [libltdl_cv_need_uscore=cross])
|
||||
LIBS="$save_LIBS"
|
||||
])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x"$libltdl_cv_need_uscore" = xyes; then
|
||||
AC_DEFINE([NEED_USCORE], [1],
|
||||
[Define if dlsym() requires a leading underscore in symbol names.])
|
||||
fi
|
||||
])# AC_LTDL_DLSYM_USCORE
|
||||
|
||||
# AC_LTDL_FUNC_ARGZ
|
||||
# -----------------
|
||||
AC_DEFUN([AC_LTDL_FUNC_ARGZ],
|
||||
[AC_CHECK_HEADERS([argz.h])
|
||||
|
||||
AC_CHECK_TYPES([error_t],
|
||||
[],
|
||||
[AC_DEFINE([error_t], [int],
|
||||
[Define to a type to use for `error_t' if it is not otherwise available.])],
|
||||
[#if HAVE_ARGZ_H
|
||||
# include <argz.h>
|
||||
#endif])
|
||||
|
||||
AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next argz_stringify])
|
||||
])# AC_LTDL_FUNC_ARGZ
|
||||
@@ -1,17 +0,0 @@
|
||||
#
|
||||
# When allocating RWX memory, check whether we need to use /dev/zero
|
||||
# as the file descriptor or not.
|
||||
#
|
||||
AC_DEFUN([AC_NEED_DEV_ZERO_FOR_MMAP],
|
||||
[AC_CACHE_CHECK([if /dev/zero is needed for mmap],
|
||||
ac_cv_need_dev_zero_for_mmap,
|
||||
[if test "$llvm_cv_os_type" = "Interix" ; then
|
||||
ac_cv_need_dev_zero_for_mmap=yes
|
||||
else
|
||||
ac_cv_need_dev_zero_for_mmap=no
|
||||
fi
|
||||
])
|
||||
if test "$ac_cv_need_dev_zero_for_mmap" = yes; then
|
||||
AC_DEFINE([NEED_DEV_ZERO_FOR_MMAP],[1],
|
||||
[Define if /dev/zero should be used when mapping RWX memory, or undefine if its not necessary])
|
||||
fi])
|
||||
@@ -1,16 +0,0 @@
|
||||
dnl Check for a reasonable version of Perl.
|
||||
dnl $1 - Minimum Perl version. Typically 5.006.
|
||||
dnl
|
||||
AC_DEFUN([LLVM_PROG_PERL], [
|
||||
AC_PATH_PROG(PERL, [perl], [none])
|
||||
if test "$PERL" != "none"; then
|
||||
AC_MSG_CHECKING(for Perl $1 or newer)
|
||||
if $PERL -e 'use $1;' 2>&1 > /dev/null; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
PERL=none
|
||||
AC_MSG_RESULT(not found)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
dnl This macro checks for tclsh which is required to run dejagnu. On some
|
||||
dnl platforms (notably FreeBSD), tclsh is named tclshX.Y - this handles
|
||||
dnl that for us so we can get the latest installed tclsh version.
|
||||
dnl
|
||||
AC_DEFUN([DJ_AC_PATH_TCLSH], [
|
||||
no_itcl=true
|
||||
AC_MSG_CHECKING(for the tclsh program in tclinclude directory)
|
||||
AC_ARG_WITH(tclinclude,
|
||||
AS_HELP_STRING([--with-tclinclude],
|
||||
[directory where tcl headers are]),
|
||||
[with_tclinclude=${withval}],[with_tclinclude=''])
|
||||
AC_CACHE_VAL(ac_cv_path_tclsh,[
|
||||
dnl first check to see if --with-itclinclude was specified
|
||||
if test x"${with_tclinclude}" != x ; then
|
||||
if test -f ${with_tclinclude}/tclsh ; then
|
||||
ac_cv_path_tclsh=`(cd ${with_tclinclude}; pwd)`
|
||||
elif test -f ${with_tclinclude}/src/tclsh ; then
|
||||
ac_cv_path_tclsh=`(cd ${with_tclinclude}/src; pwd)`
|
||||
else
|
||||
AC_MSG_ERROR([${with_tclinclude} directory doesn't contain tclsh])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl see if one is installed
|
||||
if test x"${ac_cv_path_tclsh}" = x ; then
|
||||
AC_MSG_RESULT(none)
|
||||
AC_PATH_PROGS([TCLSH],[tclsh8.4 tclsh8.4.8 tclsh8.4.7 tclsh8.4.6 tclsh8.4.5 tclsh8.4.4 tclsh8.4.3 tclsh8.4.2 tclsh8.4.1 tclsh8.4.0 tclsh8.3 tclsh8.3.5 tclsh8.3.4 tclsh8.3.3 tclsh8.3.2 tclsh8.3.1 tclsh8.3.0 tclsh])
|
||||
if test x"${TCLSH}" = x ; then
|
||||
ac_cv_path_tclsh='';
|
||||
else
|
||||
ac_cv_path_tclsh="${TCLSH}";
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(${ac_cv_path_tclsh})
|
||||
TCLSH="${ac_cv_path_tclsh}"
|
||||
AC_SUBST(TCLSH)
|
||||
fi
|
||||
])])
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#
|
||||
# This function determins if the the srand48,drand48,lrand48 functions are
|
||||
# available on this platform.
|
||||
#
|
||||
AC_DEFUN([AC_FUNC_RAND48],[
|
||||
AC_SINGLE_CXX_CHECK([ac_cv_func_rand48],
|
||||
[srand48/lrand48/drand48], [<stdlib.h>],
|
||||
[srand48(0);lrand48();drand48();])
|
||||
if test "$ac_cv_func_rand48" = "yes" ; then
|
||||
AC_DEFINE([HAVE_RAND48],1,[Define to 1 if srand48/lrand48/drand48 exist in <stdlib.h>])
|
||||
fi
|
||||
])
|
||||
@@ -1,31 +0,0 @@
|
||||
dnl Check a program for version sanity. The test runs a program, passes it an
|
||||
dnl argument to make it print out some identification string, and filters that
|
||||
dnl output with a regular expression. If the output is non-empty, the program
|
||||
dnl passes the sanity check.
|
||||
dnl $1 - Name or full path of the program to run
|
||||
dnl $2 - Argument to pass to print out identification string
|
||||
dnl $3 - grep RE to match identification string
|
||||
dnl $4 - set to 1 to make errors only a warning
|
||||
AC_DEFUN([CHECK_PROGRAM_SANITY],
|
||||
[
|
||||
AC_MSG_CHECKING([sanity for program ]$1)
|
||||
sanity="0"
|
||||
sanity_path=`which $1 2>/dev/null`
|
||||
if test "$?" -eq 0 -a -x "$sanity_path" ; then
|
||||
sanity=`$1 $2 2>&1 | grep "$3"`
|
||||
if test -z "$sanity" ; then
|
||||
AC_MSG_RESULT([no])
|
||||
sanity="0"
|
||||
if test "$4" -eq 1 ; then
|
||||
AC_MSG_WARN([Program ]$1[ failed to pass sanity check.])
|
||||
else
|
||||
AC_MSG_ERROR([Program ]$1[ failed to pass sanity check.])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
sanity="1"
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([not found])
|
||||
fi
|
||||
])
|
||||
@@ -1,10 +0,0 @@
|
||||
dnl AC_SINGLE_CXX_CHECK(CACHEVAR, FUNCTION, HEADER, PROGRAM)
|
||||
dnl $1, $2, $3, $4,
|
||||
dnl
|
||||
AC_DEFUN([AC_SINGLE_CXX_CHECK],
|
||||
[AC_CACHE_CHECK([for $2 in $3], [$1],
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include $3],[$4]),[$1=yes],[$1=no])
|
||||
AC_LANG_POP([C++])])
|
||||
])
|
||||
|
||||
@@ -1,353 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
|
||||
scriptversion=2004-09-07.08
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004
|
||||
# Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case "$1" in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit 0
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit 0
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Now exit if we have it, but it failed. Also exit now if we
|
||||
# don't have it and --version was passed (most likely to detect
|
||||
# the program).
|
||||
case "$1" in
|
||||
lex|yacc)
|
||||
# Not GNU programs, they don't have --version.
|
||||
;;
|
||||
|
||||
tar)
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
# Could not run --version or --help. This is probably someone
|
||||
# running `$TOOL --version' or `$TOOL --help' to check whether
|
||||
# $TOOL exists and not knowing $TOOL uses missing.
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case "$1" in
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case "$f" in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
|
||||
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' $msg. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
|
||||
fi
|
||||
if [ -f "$file" ]; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case "$firstarg" in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case "$firstarg" in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
@@ -1,56 +1,31 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
|
||||
scriptversion=2004-02-15.20
|
||||
|
||||
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain.
|
||||
#
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
# Public domain
|
||||
|
||||
# $Id$
|
||||
|
||||
errstatus=0
|
||||
dirmode=""
|
||||
|
||||
usage="\
|
||||
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
|
||||
|
||||
Create each directory DIR (with mode MODE, if specified), including all
|
||||
leading file name components.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>."
|
||||
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
|
||||
|
||||
# process command line arguments
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
-h | --help | --h*) # -h for help
|
||||
echo "$usage"
|
||||
exit 0
|
||||
;;
|
||||
-m) # -m PERM arg
|
||||
shift
|
||||
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
|
||||
dirmode=$1
|
||||
shift
|
||||
;;
|
||||
--version)
|
||||
echo "$0 $scriptversion"
|
||||
exit 0
|
||||
;;
|
||||
--) # stop option processing
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*) # unknown option
|
||||
echo "$usage" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*) # first non-opt arg
|
||||
break
|
||||
;;
|
||||
esac
|
||||
case "${1}" in
|
||||
-h | --help | --h* ) # -h for help
|
||||
echo "${usage}" 1>&2; exit 0 ;;
|
||||
-m ) # -m PERM arg
|
||||
shift
|
||||
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
|
||||
dirmode="${1}"
|
||||
shift ;;
|
||||
-- ) shift; break ;; # stop option processing
|
||||
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
|
||||
* ) break ;; # first non-opt arg
|
||||
esac
|
||||
done
|
||||
|
||||
for file
|
||||
@@ -63,88 +38,64 @@ do
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) exit 0 ;;
|
||||
0) exit 0 ;;
|
||||
esac
|
||||
|
||||
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
|
||||
# mkdir -p a/c at the same time, both will detect that a is missing,
|
||||
# one will create a, then the other will try to create a and die with
|
||||
# a "File exists" error. This is a problem when calling mkinstalldirs
|
||||
# from a parallel make. We use --version in the probe to restrict
|
||||
# ourselves to GNU mkdir, which is thread-safe.
|
||||
case $dirmode in
|
||||
'')
|
||||
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
|
||||
# echo "mkdir -p -- $*"
|
||||
exec mkdir -p -- "$@"
|
||||
else
|
||||
# On NextStep and OpenStep, the `mkdir' command does not
|
||||
# recognize any option. It will interpret all options as
|
||||
# directories to create, and then abort because `.' already
|
||||
# exists.
|
||||
test -d ./-p && rmdir ./-p
|
||||
test -d ./--version && rmdir ./--version
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
|
||||
test ! -d ./--version; then
|
||||
# echo "mkdir -m $dirmode -p -- $*"
|
||||
exec mkdir -m "$dirmode" -p -- "$@"
|
||||
else
|
||||
# Clean up after NextStep and OpenStep mkdir.
|
||||
for d in ./-m ./-p ./--version "./$dirmode";
|
||||
do
|
||||
test -d $d && rmdir $d
|
||||
done
|
||||
fi
|
||||
;;
|
||||
'')
|
||||
if mkdir -p -- . 2>/dev/null; then
|
||||
echo "mkdir -p -- $*"
|
||||
exec mkdir -p -- "$@"
|
||||
fi ;;
|
||||
*)
|
||||
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
|
||||
echo "mkdir -m $dirmode -p -- $*"
|
||||
exec mkdir -m "$dirmode" -p -- "$@"
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case $pathcomp in
|
||||
-*) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
# echo "mkdir $pathcomp"
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
else
|
||||
if test ! -z "$dirmode"; then
|
||||
# echo "chmod $dirmode $pathcomp"
|
||||
lasterr=""
|
||||
chmod "$dirmode" "$pathcomp" || lasterr=$?
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
else
|
||||
if test ! -z "$dirmode"; then
|
||||
echo "chmod $dirmode $pathcomp"
|
||||
|
||||
if test ! -z "$lasterr"; then
|
||||
errstatus=$lasterr
|
||||
lasterr=""
|
||||
chmod "$dirmode" "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -z "$lasterr"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# sh-indentation: 3
|
||||
# End:
|
||||
# mkinstalldirs ends here
|
||||
|
||||
@@ -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,313 +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, &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,109 +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 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,154 +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. 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
|
||||
|
||||
(** [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,806 +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 has_initializer : llvalue -> bool = "llvm_has_initializer"
|
||||
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 collector : llvalue -> string option = "llvm_collector"
|
||||
external set_collector : string option -> llvalue -> unit = "llvm_set_collector"
|
||||
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 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 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::getABITypeSize. *)
|
||||
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,58 +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 "$@"
|
||||
|
||||
# See if we have previously been configured by sensing the presence
|
||||
# of the config.status scripts
|
||||
if test ! -x "config.status" ; 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"
|
||||
msg 0 Configuring $module with:
|
||||
msg 0 " ./configure" $config_options
|
||||
$LLVM_TOP/llvm/configure $config_options || \
|
||||
die $? "Configuring llvm module failed"
|
||||
else
|
||||
msg 0 Module $module already configured, ignoring configure options.
|
||||
fi
|
||||
|
||||
msg 0 Building $module with:
|
||||
msg 0 " make" $OPTIONS_ASSIGN tools-only
|
||||
make $OPTIONS_ASSIGN tools-only
|
||||
32020
llvm/configure
vendored
32020
llvm/configure
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,653 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>LLVM Bitcode File Format</title>
|
||||
<link rel="stylesheet" href="llvm.css" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="doc_title"> LLVM Bitcode File Format </div>
|
||||
<ol>
|
||||
<li><a href="#abstract">Abstract</a></li>
|
||||
<li><a href="#overview">Overview</a></li>
|
||||
<li><a href="#bitstream">Bitstream Format</a>
|
||||
<ol>
|
||||
<li><a href="#magic">Magic Numbers</a></li>
|
||||
<li><a href="#primitives">Primitives</a></li>
|
||||
<li><a href="#abbrevid">Abbreviation IDs</a></li>
|
||||
<li><a href="#blocks">Blocks</a></li>
|
||||
<li><a href="#datarecord">Data Records</a></li>
|
||||
<li><a href="#abbreviations">Abbreviations</a></li>
|
||||
<li><a href="#stdblocks">Standard Blocks</a></li>
|
||||
</ol>
|
||||
</li>
|
||||
<li><a href="#llvmir">LLVM IR Encoding</a>
|
||||
<ol>
|
||||
<li><a href="#basics">Basics</a></li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="doc_author">
|
||||
<p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>
|
||||
and <a href="http://www.reverberate.org">Joshua Haberman</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section"> <a name="abstract">Abstract</a></div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>This document describes the LLVM bitstream file format and the encoding of
|
||||
the LLVM IR into it.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section"> <a name="overview">Overview</a></div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
What is commonly known as the LLVM bitcode file format (also, sometimes
|
||||
anachronistically known as bytecode) is actually two things: a <a
|
||||
href="#bitstream">bitstream container format</a>
|
||||
and an <a href="#llvmir">encoding of LLVM IR</a> into the container format.</p>
|
||||
|
||||
<p>
|
||||
The bitstream format is an abstract encoding of structured data, very
|
||||
similar to XML in some ways. Like XML, bitstream files contain tags, and nested
|
||||
structures, and you can parse the file without having to understand the tags.
|
||||
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
|
||||
effectively size optimizations for the content.</p>
|
||||
|
||||
<p>This document first describes the LLVM bitstream format, then describes the
|
||||
record structure used by LLVM IR files.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section"> <a name="bitstream">Bitstream Format</a></div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
The bitstream format is literally a stream of bits, with a very simple
|
||||
structure. This structure consists of the following concepts:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>A "<a href="#magic">magic number</a>" that identifies the contents of
|
||||
the stream.</li>
|
||||
<li>Encoding <a href="#primitives">primitives</a> like variable bit-rate
|
||||
integers.</li>
|
||||
<li><a href="#blocks">Blocks</a>, which define nested content.</li>
|
||||
<li><a href="#datarecord">Data Records</a>, which describe entities within the
|
||||
file.</li>
|
||||
<li>Abbreviations, which specify compression optimizations for the file.</li>
|
||||
</ul>
|
||||
|
||||
<p>Note that the <a
|
||||
href="CommandGuide/html/llvm-bcanalyzer.html">llvm-bcanalyzer</a> tool can be
|
||||
used to dump and inspect arbitrary bitstreams, which is very useful for
|
||||
understanding the encoding.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection"><a name="magic">Magic Numbers</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The first two bytes of a bitcode file are 'BC' (0x42, 0x43).
|
||||
The second two bytes are an application-specific magic number. Generic
|
||||
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 class="doc_subsection"><a name="primitives">Primitives</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
A bitstream literally consists of a stream of bits, which are read in order
|
||||
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.
|
||||
These
|
||||
integers are are encoded in two ways: either as <a href="#fixedwidth">Fixed
|
||||
Width Integers</a> or as <a href="#variablewidth">Variable Width
|
||||
Integers</a>.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"> <a name="fixedwidth">Fixed Width Integers</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Fixed-width integer values have their low bits emitted directly to the file.
|
||||
For example, a 3-bit integer value encodes 1 as 001. Fixed width integers
|
||||
are used when there are a well-known number of options for a field. For
|
||||
example, boolean values are usually encoded with a 1-bit wide integer.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"> <a name="variablewidth">Variable Width
|
||||
Integers</a></div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Variable-width integer (VBR) values encode values of arbitrary size,
|
||||
optimizing for the case where the values are small. Given a 4-bit VBR field,
|
||||
any 3-bit value (0 through 7) is encoded directly, with the high bit set to
|
||||
zero. Values larger than N-1 bits emit their bits in a series of N-1 bit
|
||||
chunks, where all but the last set the high bit.</p>
|
||||
|
||||
<p>For example, the value 27 (0x1B) is encoded as 1011 0011 when emitted as a
|
||||
vbr4 value. The first set of four bits indicates the value 3 (011) with a
|
||||
continuation piece (indicated by a high bit of 1). The next word indicates a
|
||||
value of 24 (011 << 3) with no continuation. The sum (3+24) yields the value
|
||||
27.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"> <a name="char6">6-bit characters</a></div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>6-bit characters encode common characters into a fixed 6-bit field. They
|
||||
represent the following characters with the following 6-bit values:</p>
|
||||
|
||||
<ul>
|
||||
<li>'a' .. 'z' - 0 .. 25</li>
|
||||
<li>'A' .. 'Z' - 26 .. 51</li>
|
||||
<li>'0' .. '9' - 52 .. 61</li>
|
||||
<li>'.' - 62</li>
|
||||
<li>'_' - 63</li>
|
||||
</ul>
|
||||
|
||||
<p>This encoding is only suitable for encoding characters and strings that
|
||||
consist only of the above characters. It is completely incapable of encoding
|
||||
characters not in the set.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"> <a name="wordalign">Word Alignment</a></div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>Occasionally, it is useful to emit zero bits until the bitstream is a
|
||||
multiple of 32 bits. This ensures that the bit position in the stream can be
|
||||
represented as a multiple of 32-bit words.</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection"><a name="abbrevid">Abbreviation IDs</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
A bitstream is a sequential series of <a href="#blocks">Blocks</a> and
|
||||
<a href="#datarecord">Data Records</a>. Both of these start with an
|
||||
abbreviation ID encoded as a fixed-bitwidth field. The width is specified by
|
||||
the current block, as described below. The value of the abbreviation ID
|
||||
specifies either a builtin ID (which have special meanings, defined below) or
|
||||
one of the abbreviation IDs defined by the stream itself.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The set of builtin abbrev IDs is:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>0 - <a href="#END_BLOCK">END_BLOCK</a> - This abbrev ID marks the end of the
|
||||
current block.</li>
|
||||
<li>1 - <a href="#ENTER_SUBBLOCK">ENTER_SUBBLOCK</a> - This abbrev ID marks the
|
||||
beginning of a new block.</li>
|
||||
<li>2 - <a href="#DEFINE_ABBREV">DEFINE_ABBREV</a> - This defines a new
|
||||
abbreviation.</li>
|
||||
<li>3 - <a href="#UNABBREV_RECORD">UNABBREV_RECORD</a> - This ID specifies the
|
||||
definition of an unabbreviated record.</li>
|
||||
</ul>
|
||||
|
||||
<p>Abbreviation IDs 4 and above are defined by the stream itself, and specify
|
||||
an <a href="#abbrev_records">abbreviated record encoding</a>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection"><a name="blocks">Blocks</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
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
|
||||
function bodies). Block IDs 0-7 are reserved for <a href="#stdblocks">standard blocks</a>
|
||||
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
|
||||
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
|
||||
efficiently skip data they do not understand. The LLVM IR reader uses this
|
||||
mechanism to skip function bodies, lazily reading them on demand.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When reading and encoding the stream, several properties are maintained for the
|
||||
block. In particular, each block maintains:
|
||||
</p>
|
||||
|
||||
<ol>
|
||||
<li>A current abbrev id width. This value starts at 2, and is set every time a
|
||||
block record is entered. The block entry specifies the abbrev id width for
|
||||
the body of the block.</li>
|
||||
|
||||
<li>A set of abbreviations. Abbreviations may be defined within a block, in
|
||||
which case they are only defined in that block (neither subblocks nor
|
||||
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>
|
||||
</ol>
|
||||
|
||||
<p>As sub blocks are entered, these properties are saved and the new sub-block
|
||||
has its own set of abbreviations, and its own abbrev id width. When a sub-block
|
||||
is popped, the saved values are restored.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"> <a name="ENTER_SUBBLOCK">ENTER_SUBBLOCK
|
||||
Encoding</a></div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p><tt>[ENTER_SUBBLOCK, blockid<sub>vbr8</sub>, newabbrevlen<sub>vbr4</sub>,
|
||||
<align32bits>, blocklen<sub>32</sub>]</tt></p>
|
||||
|
||||
<p>
|
||||
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 type of block being entered (which can be a <a href="#stdblocks">standard
|
||||
block</a> or an application-specific block). 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
|
||||
value that specifies the size of the subblock, in 32-bit words. This value
|
||||
allows the reader to skip over the entire block in one jump.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"> <a name="END_BLOCK">END_BLOCK
|
||||
Encoding</a></div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p><tt>[END_BLOCK, <align32bits>]</tt></p>
|
||||
|
||||
<p>
|
||||
The END_BLOCK abbreviation ID specifies the end of the current block record.
|
||||
Its end is aligned to 32-bits to ensure that the size of the block is an even
|
||||
multiple of 32-bits.</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection"><a name="datarecord">Data Records</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
<p>
|
||||
Data records consist of a record code and a number of (up to) 64-bit integer
|
||||
values. The interpretation of the code and values is application specific and
|
||||
there are multiple different ways to encode a record (with an unabbrev record
|
||||
or with an abbreviation). In the LLVM IR format, for example, there is a record
|
||||
which encodes the target triple of a module. The code is MODULE_CODE_TRIPLE,
|
||||
and the values of the record are the ascii codes for the characters in the
|
||||
string.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"> <a name="UNABBREV_RECORD">UNABBREV_RECORD
|
||||
Encoding</a></div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p><tt>[UNABBREV_RECORD, code<sub>vbr6</sub>, numops<sub>vbr6</sub>,
|
||||
op0<sub>vbr6</sub>, op1<sub>vbr6</sub>, ...]</tt></p>
|
||||
|
||||
<p>An UNABBREV_RECORD provides a default fallback encoding, which is both
|
||||
completely general and also extremely inefficient. It can describe an arbitrary
|
||||
record, by emitting the code and operands as vbrs.</p>
|
||||
|
||||
<p>For example, emitting an LLVM IR target triple as an unabbreviated record
|
||||
requires emitting the UNABBREV_RECORD abbrevid, a vbr6 for the
|
||||
MODULE_CODE_TRIPLE code, a vbr6 for the length of the string (which is equal to
|
||||
the number of operands), and a vbr6 for each character. Since there are no
|
||||
letters with value less than 32, each letter would need to be emitted as at
|
||||
least a two-part VBR, which means that each letter would require at least 12
|
||||
bits. This is not an efficient encoding, but it is fully general.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"> <a name="abbrev_records">Abbreviated Record
|
||||
Encoding</a></div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p><tt>[<abbrevid>, fields...]</tt></p>
|
||||
|
||||
<p>An abbreviated record is a abbreviation id followed by a set of fields that
|
||||
are encoded according to the <a href="#abbreviations">abbreviation
|
||||
definition</a>. This allows records to be encoded significantly more densely
|
||||
than records encoded with the <a href="#UNABBREV_RECORD">UNABBREV_RECORD</a>
|
||||
type, and allows the abbreviation types to be specified in the stream itself,
|
||||
which allows the files to be completely self describing. The actual encoding
|
||||
of abbreviations is defined below.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection"><a name="abbreviations">Abbreviations</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
<p>
|
||||
Abbreviations are an important form of compression for bitstreams. The idea is
|
||||
to specify a dense encoding for a class of records once, then use that encoding
|
||||
to emit many records. It takes space to emit the encoding into the file, but
|
||||
the space is recouped (hopefully plus some) when the records that use it are
|
||||
emitted.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Abbreviations can be determined dynamically per client, per file. Since the
|
||||
abbreviations are stored in the bitstream itself, different streams of the same
|
||||
format can contain different sets of abbreviations if the specific stream does
|
||||
not need it. As a concrete example, LLVM IR files usually emit an abbreviation
|
||||
for binary operators. If a specific LLVM module contained no or few binary
|
||||
operators, the abbreviation does not need to be emitted.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"><a name="DEFINE_ABBREV">DEFINE_ABBREV
|
||||
Encoding</a></div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p><tt>[DEFINE_ABBREV, numabbrevops<sub>vbr5</sub>, abbrevop0, abbrevop1,
|
||||
...]</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
|
||||
by a VBR that specifies the number of abbrev operands, then the abbrev
|
||||
operands themselves. Abbreviation operands come in three forms. They all start
|
||||
with a single bit that indicates whether the abbrev operand is a literal operand
|
||||
(when the bit is 1) or an encoding operand (when the bit is 0).</p>
|
||||
|
||||
<ol>
|
||||
<li>Literal operands - <tt>[1<sub>1</sub>, litvalue<sub>vbr8</sub>]</tt> -
|
||||
Literal operands specify that the value in the result
|
||||
is always a single specific value. This specific value is emitted as a vbr8
|
||||
after the bit indicating that it is a literal operand.</li>
|
||||
<li>Encoding info without data - <tt>[0<sub>1</sub>, encoding<sub>3</sub>]</tt>
|
||||
- Operand encodings that do not have extra data are just emitted as their code.
|
||||
</li>
|
||||
<li>Encoding info with data - <tt>[0<sub>1</sub>, encoding<sub>3</sub>,
|
||||
value<sub>vbr5</sub>]</tt> - Operand encodings that do have extra data are
|
||||
emitted as their code, followed by the extra data.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>The possible operand encodings are:</p>
|
||||
|
||||
<ul>
|
||||
<li>1 - Fixed - The field should be emitted as a <a
|
||||
href="#fixedwidth">fixed-width value</a>, whose width
|
||||
is specified by the operand's extra data.</li>
|
||||
<li>2 - VBR - The field should be emitted as a <a
|
||||
href="#variablewidth">variable-width value</a>, whose width
|
||||
is specified by the operand's extra data.</li>
|
||||
<li>3 - Array - This field is an array of values. The array operand has no
|
||||
extra data, but expects another operand to follow it which indicates the
|
||||
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
|
||||
value</a>. This operand type takes no extra data.</li>
|
||||
</ul>
|
||||
|
||||
<p>For example, target triples in LLVM modules are encoded as a record of the
|
||||
form <tt>[TRIPLE, 'a', 'b', 'c', 'd']</tt>. Consider if the bitstream emitted
|
||||
the following abbrev entry:</p>
|
||||
|
||||
<ul>
|
||||
<li><tt>[0, Fixed, 4]</tt></li>
|
||||
<li><tt>[0, Array]</tt></li>
|
||||
<li><tt>[0, Char6]</tt></li>
|
||||
</ul>
|
||||
|
||||
<p>When emitting a record with this abbreviation, the above entry would be
|
||||
emitted as:</p>
|
||||
|
||||
<p><tt>[4<sub>abbrevwidth</sub>, 2<sub>4</sub>, 4<sub>vbr6</sub>,
|
||||
0<sub>6</sub>, 1<sub>6</sub>, 2<sub>6</sub>, 3<sub>6</sub>]</tt></p>
|
||||
|
||||
<p>These values are:</p>
|
||||
|
||||
<ol>
|
||||
<li>The first value, 4, is the abbreviation ID for this abbreviation.</li>
|
||||
<li>The second value, 2, is the code for TRIPLE in LLVM IR files.</li>
|
||||
<li>The third value, 4, is the length of the array.</li>
|
||||
<li>The rest of the values are the char6 encoded values for "abcd".</li>
|
||||
</ol>
|
||||
|
||||
<p>With this abbreviation, the triple is emitted with only 37 bits (assuming a
|
||||
abbrev id width of 3). Without the abbreviation, significantly more space would
|
||||
be required to emit the target triple. Also, since the TRIPLE value is not
|
||||
emitted as a literal in the abbreviation, the abbreviation can also be used for
|
||||
any other string value.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection"><a name="stdblocks">Standard Blocks</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
In addition to the basic block structure and record encodings, the bitstream
|
||||
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
|
||||
may be added. Block IDs 0-7 are reserved for standard blocks.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"><a name="BLOCKINFO">#0 - BLOCKINFO
|
||||
Block</a></div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The BLOCKINFO block allows the description of metadata for other blocks. The
|
||||
currently specified records are:</p>
|
||||
|
||||
<ul>
|
||||
<li><tt>[SETBID (#1), blockid]</tt></li>
|
||||
<li><tt>[DEFINE_ABBREV, ...]</tt></li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
The SETBID record indicates which block ID is being described. SETBID
|
||||
records can occur multiple times throughout the block to change which
|
||||
block ID is being described. There must be a SETBID record prior to
|
||||
any other records.
|
||||
</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>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section"> <a name="llvmir">LLVM IR Encoding</a></div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>LLVM IR is encoded into a bitstream by defining blocks and records. It uses
|
||||
blocks for things like constant pools, functions, symbol tables, etc. It uses
|
||||
records for things like instructions, global variable descriptors, type
|
||||
descriptions, etc. This document does not describe the set of abbreviations
|
||||
that the writer uses, as these are fully self-described in the file, and the
|
||||
reader is not allowed to build in any knowledge of this.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection"><a name="basics">Basics</a>
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"><a name="ir_magic">LLVM IR Magic Number</a></div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
The magic number for LLVM IR files is:
|
||||
</p>
|
||||
|
||||
<p><tt>[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>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"><a name="ir_signed_vbr">Signed VBRs</a></div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
<a href="#variablewidth">Variable Width Integers</a> are an efficient way to
|
||||
encode arbitrary sized unsigned values, but is an extremely inefficient way to
|
||||
encode signed values (as signed values are otherwise treated as maximally large
|
||||
unsigned values).</p>
|
||||
|
||||
<p>As such, signed vbr values of a specific width are emitted as follows:</p>
|
||||
|
||||
<ul>
|
||||
<li>Positive values are emitted as vbrs of the specified width, but with their
|
||||
value shifted left by one.</li>
|
||||
<li>Negative values are emitted as vbrs of the specified width, but the negated
|
||||
value is shifted left by one, and the low bit is set.</li>
|
||||
</ul>
|
||||
|
||||
<p>With this encoding, small positive and small negative values can both be
|
||||
emitted efficiently.</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- _______________________________________________________________________ -->
|
||||
<div class="doc_subsubsection"><a name="ir_blocks">LLVM IR Blocks</a></div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
LLVM IR is defined with the following blocks:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>8 - MODULE_BLOCK - This is the top-level block that contains the
|
||||
entire module, and describes a variety of per-module information.</li>
|
||||
<li>9 - PARAMATTR_BLOCK - This enumerates the parameter attributes.</li>
|
||||
<li>10 - TYPE_BLOCK - This describes all of the types in the module.</li>
|
||||
<li>11 - CONSTANTS_BLOCK - This describes constants for a module or
|
||||
function.</li>
|
||||
<li>12 - FUNCTION_BLOCK - This describes a function body.</li>
|
||||
<li>13 - TYPE_SYMTAB_BLOCK - This describes the type symbol table.</li>
|
||||
<li>14 - VALUE_SYMTAB_BLOCK - This describes a value symbol table.</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection"><a name="MODULE_BLOCK">MODULE_BLOCK Contents</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<hr>
|
||||
<address> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
||||
src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
|
||||
<a href="http://validator.w3.org/check/referer"><img
|
||||
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date$
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,244 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>LLVM bugpoint tool: design and usage</title>
|
||||
<link rel="stylesheet" href="llvm.css" type="text/css">
|
||||
</head>
|
||||
|
||||
<div class="doc_title">
|
||||
LLVM bugpoint tool: design and usage
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li><a href="#desc">Description</a></li>
|
||||
<li><a href="#design">Design Philosophy</a>
|
||||
<ul>
|
||||
<li><a href="#autoselect">Automatic Debugger Selection</a></li>
|
||||
<li><a href="#crashdebug">Crash debugger</a></li>
|
||||
<li><a href="#codegendebug">Code generator debugger</a></li>
|
||||
<li><a href="#miscompilationdebug">Miscompilation debugger</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#advice">Advice for using <tt>bugpoint</tt></a></li>
|
||||
</ul>
|
||||
|
||||
<div class="doc_author">
|
||||
<p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a></p>
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
<a name="desc">Description</a>
|
||||
</div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p><tt>bugpoint</tt> narrows down the source of problems in LLVM tools and
|
||||
passes. It can be used to debug three types of failures: optimizer crashes,
|
||||
miscompilations by optimizers, or bad native code generation (including problems
|
||||
in the static and JIT compilers). It aims to reduce large test cases to small,
|
||||
useful ones. For example, if <tt>opt</tt> crashes while optimizing a
|
||||
file, it will identify the optimization (or combination of optimizations) that
|
||||
causes the crash, and reduce the file down to a small example which triggers the
|
||||
crash.</p>
|
||||
|
||||
<p>For detailed case scenarios, such as debugging <tt>opt</tt>,
|
||||
<tt>llvm-ld</tt>, or one of the LLVM code generators, see <a
|
||||
href="HowToSubmitABug.html">How To Submit a Bug Report document</a>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
<a name="design">Design Philosophy</a>
|
||||
</div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p><tt>bugpoint</tt> is designed to be a useful tool without requiring any
|
||||
hooks into the LLVM infrastructure at all. It works with any and all LLVM
|
||||
passes and code generators, and does not need to "know" how they work. Because
|
||||
of this, it may appear to do stupid things or miss obvious
|
||||
simplifications. <tt>bugpoint</tt> is also designed to trade off programmer
|
||||
time for computer time in the compiler-debugging process; consequently, it may
|
||||
take a long period of (unattended) time to reduce a test case, but we feel it
|
||||
is still worth it. Note that <tt>bugpoint</tt> is generally very quick unless
|
||||
debugging a miscompilation where each test of the program (which requires
|
||||
executing it) takes a long time.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="autoselect">Automatic Debugger Selection</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p><tt>bugpoint</tt> reads each <tt>.bc</tt> or <tt>.ll</tt> file specified on
|
||||
the command line and links them together into a single module, called the test
|
||||
program. If any LLVM passes are specified on the command line, it runs these
|
||||
passes on the test program. If any of the passes crash, or if they produce
|
||||
malformed output (which causes the verifier to abort), <tt>bugpoint</tt> starts
|
||||
the <a href="#crashdebug">crash debugger</a>.</p>
|
||||
|
||||
<p>Otherwise, if the <tt>-output</tt> option was not specified,
|
||||
<tt>bugpoint</tt> runs the test program with the C backend (which is assumed to
|
||||
generate good code) to generate a reference output. Once <tt>bugpoint</tt> has
|
||||
a reference output for the test program, it tries executing it with the
|
||||
selected code generator. If the selected code generator crashes,
|
||||
<tt>bugpoint</tt> starts the <a href="#crashdebug">crash debugger</a> on the
|
||||
code generator. Otherwise, if the resulting output differs from the reference
|
||||
output, it assumes the difference resulted from a code generator failure, and
|
||||
starts the <a href="#codegendebug">code generator debugger</a>.</p>
|
||||
|
||||
<p>Finally, if the output of the selected code generator matches the reference
|
||||
output, <tt>bugpoint</tt> runs the test program after all of the LLVM passes
|
||||
have been applied to it. If its output differs from the reference output, it
|
||||
assumes the difference resulted from a failure in one of the LLVM passes, and
|
||||
enters the <a href="#miscompilationdebug">miscompilation debugger</a>.
|
||||
Otherwise, there is no problem <tt>bugpoint</tt> can debug.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="crashdebug">Crash debugger</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>If an optimizer or code generator crashes, <tt>bugpoint</tt> will try as hard
|
||||
as it can to reduce the list of passes (for optimizer crashes) and the size of
|
||||
the test program. First, <tt>bugpoint</tt> figures out which combination of
|
||||
optimizer passes triggers the bug. This is useful when debugging a problem
|
||||
exposed by <tt>opt</tt>, for example, because it runs over 38 passes.</p>
|
||||
|
||||
<p>Next, <tt>bugpoint</tt> tries removing functions from the test program, to
|
||||
reduce its size. Usually it is able to reduce a test program to a single
|
||||
function, when debugging intraprocedural optimizations. Once the number of
|
||||
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,
|
||||
<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
|
||||
passes crash, give you a bitcode file, and give you instructions on how to
|
||||
reproduce the failure with <tt>opt</tt> or <tt>llc</tt>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="codegendebug">Code generator debugger</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The code generator debugger attempts to narrow down the amount of code that
|
||||
is being miscompiled by the selected code generator. To do this, it takes the
|
||||
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
|
||||
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
|
||||
potential scope of the problem. After it is finished, it emits two bitcode
|
||||
files (called "test" [to be compiled with the code generator] and "safe" [to be
|
||||
compiled with the C backend], respectively), and instructions for reproducing
|
||||
the problem. The code generator debugger assumes that the C backend produces
|
||||
good code.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<div class="doc_subsection">
|
||||
<a name="miscompilationdebug">Miscompilation debugger</a>
|
||||
</div>
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<p>The miscompilation debugger works similarly to the code generator debugger.
|
||||
It works by splitting the test program into two pieces, running the
|
||||
optimizations specified on one piece, linking the two pieces back together, and
|
||||
then executing the result. It attempts to narrow down the list of passes to
|
||||
the one (or few) which are causing the miscompilation, then reduce the portion
|
||||
of the test program which is being miscompiled. The miscompilation debugger
|
||||
assumes that the selected code generator is working properly.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
<a name="advice">Advice for using bugpoint</a>
|
||||
</div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
|
||||
<tt>bugpoint</tt> can be a remarkably useful tool, but it sometimes works in
|
||||
non-obvious ways. Here are some hints and tips:<p>
|
||||
|
||||
<ol>
|
||||
<li>In the code generator and miscompilation debuggers, <tt>bugpoint</tt> only
|
||||
works with programs that have deterministic output. Thus, if the program
|
||||
outputs <tt>argv[0]</tt>, the date, time, or any other "random" data,
|
||||
<tt>bugpoint</tt> may misinterpret differences in these data, when output,
|
||||
as the result of a miscompilation. Programs should be temporarily modified
|
||||
to disable outputs that are likely to vary from run to run.
|
||||
|
||||
<li>In the code generator and miscompilation debuggers, debugging will go
|
||||
faster if you manually modify the program or its inputs to reduce the
|
||||
runtime, but still exhibit the problem.
|
||||
|
||||
<li><tt>bugpoint</tt> is extremely useful when working on a new optimization:
|
||||
it helps track down regressions quickly. To avoid having to relink
|
||||
<tt>bugpoint</tt> every time you change your optimization however, have
|
||||
<tt>bugpoint</tt> dynamically load your optimization with the
|
||||
<tt>-load</tt> option.
|
||||
|
||||
<li><p><tt>bugpoint</tt> can generate a lot of output and run for a long period
|
||||
of time. It is often useful to capture the output of the program to file.
|
||||
For example, in the C shell, you can run:</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<p><tt>bugpoint ... |& tee bugpoint.log</tt></p>
|
||||
</div>
|
||||
|
||||
<p>to get a copy of <tt>bugpoint</tt>'s output in the file
|
||||
<tt>bugpoint.log</tt>, as well as on your terminal.</p>
|
||||
|
||||
<li><tt>bugpoint</tt> cannot debug problems with the LLVM linker. If
|
||||
<tt>bugpoint</tt> crashes before you see its "All input ok" message,
|
||||
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.
|
||||
|
||||
<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.
|
||||
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
|
||||
program. This process will repeat until a bug is found or the user
|
||||
kills <tt>bugpoint</tt>.
|
||||
|
||||
</ol>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<hr>
|
||||
<address>
|
||||
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
||||
src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
|
||||
<a href="http://validator.w3.org/check/referer"><img
|
||||
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
|
||||
|
||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
|
||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date$
|
||||
</address>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,29 +1,166 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" href="llvm.css" type="text/css" media="screen">
|
||||
<title>Building the LLVM C/C++ Front-End</title>
|
||||
<meta HTTP-EQUIV="REFRESH" CONTENT="3; URL=GCCFEBuildInstrs.html">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="stylesheet" href="llvm.css" type="text/css" media="screen" />
|
||||
<title>Bootstrapping the C/C++ Front-End</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="doc_title">
|
||||
This page has moved <a href="GCCFEBuildInstrs.html">here</A>.
|
||||
Bootstrapping the C/C++ Front-End
|
||||
</div>
|
||||
|
||||
<p>This document is intended to explain the process of building the LLVM
|
||||
C/C++ front-end, based on GCC 3.4, from source.</p>
|
||||
|
||||
<p><b>NOTE:</b> This is currently a somewhat fragile, error-prone
|
||||
process, and you should only try to do it if
|
||||
<ul>
|
||||
<li>(A) you really, really, really can't use the binaries we distribute
|
||||
<li>(B) you need GCC to fix some of the header files on your system
|
||||
<li>(C) you are an elite GCC hacker.</p>
|
||||
</ul>
|
||||
|
||||
<p>We welcome patches to help make this process simpler.</p>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
<div class="doc_section">
|
||||
<a name="instructions">Instructions</a>
|
||||
</div>
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<div class="doc_text">
|
||||
<p>
|
||||
<ol>
|
||||
<li><p>Configure and build the LLVM libraries and tools using:</p>
|
||||
<pre>
|
||||
% cd llvm
|
||||
% ./configure [options...]
|
||||
% gmake tools-only
|
||||
</pre>
|
||||
<p>The use of the non-default target "tools-only" means that the
|
||||
LLVM tools and libraries will build, and the binaries will be
|
||||
deposited in llvm/tools/Debug, but the runtime (bytecode)
|
||||
libraries will not build.</p></li>
|
||||
|
||||
<li><p>Add the directory containing the tools to your PATH.</p>
|
||||
<pre>
|
||||
% set path = ( `cd llvm/tools/Debug && pwd` $path )
|
||||
</pre></li>
|
||||
|
||||
<li><p>Unpack the C/C++ front-end source into cfrontend/src.</p></li>
|
||||
|
||||
<li><p>Edit src/configure. Change the first line (starting w/ #!) to
|
||||
contain the correct full pathname of sh.</p></li>
|
||||
|
||||
<li><p>Make "build" and "install" directories as siblings of the "src"
|
||||
tree.</p>
|
||||
<pre>
|
||||
% pwd
|
||||
/usr/local/example/cfrontend/src
|
||||
% cd ..
|
||||
% mkdir build install
|
||||
% set CFEINSTALL = `pwd`/install
|
||||
</pre></li>
|
||||
|
||||
<li><p>Configure, build and install the C front-end:</p>
|
||||
<pre>
|
||||
% cd build
|
||||
% ../src/configure --prefix=$CFEINSTALL --disable-nls --disable-shared \
|
||||
--enable-languages=c,c++
|
||||
% gmake all-gcc
|
||||
% setenv LLVM_LIB_SEARCH_PATH `pwd`/gcc
|
||||
% gmake all; gmake install
|
||||
</pre>
|
||||
|
||||
<p><b>Common Problem:</b> You may get error messages regarding the fact
|
||||
that LLVM does not support inline assembly. Here are two common
|
||||
fixes:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><b>Fix 1:</b> If you have system header files that include
|
||||
inline assembly, you may have to modify them to remove the inline
|
||||
assembly, and install the modified versions in
|
||||
<code>$CFEINSTALL/<i>target-triplet</i>/sys-include</code>.</p></li>
|
||||
|
||||
<li><b>Fix 2:</b> If you are building the C++ front-end on a CPU we
|
||||
haven't tried yet, you will probably have to edit the appropriate
|
||||
version of atomicity.h under
|
||||
<code>src/libstdc++-v3/config/cpu/<i>name-of-cpu</i>/atomicity.h</code>
|
||||
and apply a patch so that it does not use inline assembly.</p></li>
|
||||
</ul>
|
||||
|
||||
<p><b>Porting to a new architecture:</b> If you are porting the new front-end
|
||||
to a new architecture, or compiling in a different configuration that we have
|
||||
previously, there are probably several changes you will have to make to the GCC
|
||||
target to get it to work correctly. These include:<p>
|
||||
|
||||
<ul>
|
||||
<li>Often targets include special or assembler linker flags which
|
||||
<tt>gccas</tt>/<tt>gccld</tt> does not understand. In general, these can
|
||||
just be removed.</li>
|
||||
<li>LLVM currently does not support any floating point values other than
|
||||
32-bit and 64-bit IEEE floating point. The primary effect of this is
|
||||
that you may have to map "long double" onto "double".</li>
|
||||
<li>The profiling hooks in GCC do not apply at all to the LLVM front-end.
|
||||
These may need to be disabled.</li>
|
||||
<li>No inline assembly for position independent code. At the LLVM level,
|
||||
everything is position independent.</li>
|
||||
<li>We handle <tt>.init</tt> and <tt>.fini</tt> differently.</li>
|
||||
<li>You may have to disable multilib support in your target. Using multilib
|
||||
support causes the GCC compiler driver to add a lot of "<tt>-L</tt>"
|
||||
options to the link line, which do not relate to LLVM and confuse
|
||||
<tt>gccld</tt>. To disable multilibs, delete any
|
||||
<tt>MULTILIB_OPTIONS</tt> lines from your target files.</li>
|
||||
<li>Did we mention that we don't support inline assembly? You'll probably
|
||||
have to add some fixinclude hacks to disable it in the system
|
||||
headers.</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><p>Go back into the LLVM source tree proper. Edit Makefile.config
|
||||
to redefine <code>LLVMGCCDIR</code> to the full pathname of the
|
||||
<code>$CFEINSTALL</code> directory, which is the directory you just
|
||||
installed the C front-end into. (The ./configure script is likely to
|
||||
have set this to a directory which does not exist on your system.)</p></li>
|
||||
|
||||
<li><p>If you edited header files during the C/C++ front-end build as
|
||||
described in "Fix 1" above, you must now copy those header files from
|
||||
<code>$CFEINSTALL/<i>target-triplet</i>/sys-include</code> to
|
||||
<code>$CFEINSTALL/lib/gcc/<i>target-triplet</i>/3.4-llvm/include</code>.
|
||||
(This should be the "include" directory in the same directory as the
|
||||
libgcc.a library, which you can find by running
|
||||
<code>$CFEINSTALL/bin/gcc --print-libgcc-file-name</code>.)</p></li>
|
||||
|
||||
<li><p>Build and install the runtime (bytecode) libraries by running:</p>
|
||||
<pre>
|
||||
% gmake -C runtime
|
||||
% mkdir $CFEINSTALL/bytecode-libs
|
||||
% gmake -C runtime install
|
||||
% setenv LLVM_LIB_SEARCH_PATH $CFEINSTALL/bytecode-libs
|
||||
</pre></li>
|
||||
|
||||
<li><p>Test the newly-installed C frontend by one or more of the
|
||||
following means:</p>
|
||||
<ul>
|
||||
<li> compiling and running a "hello, LLVM" program in C and C++.</li>
|
||||
<li> running the tests under <tt>test/Programs</tt> using <code>gmake -C
|
||||
test/Programs</code></li>
|
||||
</ul>
|
||||
</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<!-- *********************************************************************** -->
|
||||
|
||||
<hr>
|
||||
<address>
|
||||
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
|
||||
src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
|
||||
<a href="http://validator.w3.org/check/referer"><img
|
||||
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
|
||||
|
||||
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
|
||||
Last modified: $Date: 2008-02-13 17:46:10 +0100 (Wed, 13 Feb 2008) $
|
||||
</address>
|
||||
<hr><font size="-1">
|
||||
<address><a href="mailto:gaeke -at- uiuc.edu">Brian Gaeke</a></address>
|
||||
<a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a>
|
||||
<br>
|
||||
Last modified: $Date$
|
||||
</font>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
15
llvm/docs/ChrisNotes.txt
Normal file
15
llvm/docs/ChrisNotes.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
* Rewrite the llvm parser/lexer in http://www.antlr.org when time permits.
|
||||
They actually do C++. Imagine that.
|
||||
* Need a way to attach bytecode block info at various levels of asm code.
|
||||
* Recognize and save comments in assembly and bytecode format
|
||||
* Encode line number table in bytecode (like #line), optional table
|
||||
|
||||
* Encode negative relative offsets in the bytecode file
|
||||
|
||||
* Apparently bison has a %pure_parser option. Maybe useful for AsmParser
|
||||
|
||||
* Implement the following derived types:
|
||||
* "packed format", like this: [4 x sbyte]: Packed SIMD datatype
|
||||
* Bytecode reader should use extensions that may or may not be linked into the
|
||||
application to read blocks. Thus an easy way to ignore symbol table info
|
||||
would be to not link in that reader into the app.
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,97 +0,0 @@
|
||||
##===- docs/CommandGuide/Makefile --------------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
ifdef BUILD_FOR_WEBSITE
|
||||
# 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
|
||||
# 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
|
||||
# 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.
|
||||
all:: html man ps
|
||||
|
||||
clean:
|
||||
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: .html .pod .1 .ps
|
||||
|
||||
$(DST_HTML_DIR)%.html: %.pod $(DST_HTML_DIR)/.dir
|
||||
pod2html --css=manpage.css --htmlroot=. \
|
||||
--podpath=. --noindex --infile=$< --outfile=$@ --title=$*
|
||||
|
||||
$(DST_MAN_DIR)%.1: %.pod $(DST_MAN_DIR)/.dir
|
||||
pod2man --release=CVS --center="LLVM Command Guide" $< $@
|
||||
|
||||
$(DST_PS_DIR)%.ps: $(DST_MAN_DIR)%.1 $(DST_PS_DIR)/.dir
|
||||
groff -Tps -man $< > $@
|
||||
|
||||
|
||||
html: $(HTML)
|
||||
man: $(MAN)
|
||||
ps: $(PS)
|
||||
|
||||
EXTRA_DIST := $(POD) index.html
|
||||
|
||||
clean-local::
|
||||
$(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
|
||||
|
||||
HTML_DIR := $(PROJ_docsdir)/html/CommandGuide
|
||||
MAN_DIR := $(PROJ_mandir)/man1
|
||||
PS_DIR := $(PROJ_docsdir)/ps
|
||||
|
||||
install-local:: $(HTML) $(MAN) $(PS)
|
||||
$(Echo) Installing HTML CommandGuide Documentation
|
||||
$(Verb) $(MKDIR) $(HTML_DIR)
|
||||
$(Verb) $(DataInstall) $(HTML) $(HTML_DIR)
|
||||
$(Verb) $(DataInstall) $(PROJ_SRC_DIR)/index.html $(HTML_DIR)
|
||||
$(Verb) $(DataInstall) $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR)
|
||||
$(Echo) Installing MAN CommandGuide Documentation
|
||||
$(Verb) $(MKDIR) $(MAN_DIR)
|
||||
$(Verb) $(DataInstall) $(MAN) $(MAN_DIR)
|
||||
$(Echo) Installing PS CommandGuide Documentation
|
||||
$(Verb) $(MKDIR) $(PS_DIR)
|
||||
$(Verb) $(DataInstall) $(PS) $(PS_DIR)
|
||||
|
||||
uninstall-local::
|
||||
$(Echo) Uninstalling CommandGuide Documentation
|
||||
$(Verb) $(RM) -rf $(HTML_DIR) $(MAN_DIR) $(PS_DIR)
|
||||
|
||||
printvars::
|
||||
$(Echo) "POD : " '$(POD)'
|
||||
$(Echo) "HTML : " '$(HTML)'
|
||||
81
llvm/docs/CommandGuide/analyze.html
Normal file
81
llvm/docs/CommandGuide/analyze.html
Normal file
@@ -0,0 +1,81 @@
|
||||
<html>
|
||||
<title>
|
||||
LLVM: analyze tool
|
||||
</title>
|
||||
|
||||
<body bgcolor=white>
|
||||
|
||||
<center><h1>LLVM: <tt>analyze</tt> tool</h1></center>
|
||||
<HR>
|
||||
|
||||
<h3>NAME</h3>
|
||||
<tt>analyze</tt>
|
||||
|
||||
<h3>SYNOPSIS</h3>
|
||||
<tt>analyze [options] [filename]</tt>
|
||||
|
||||
<h3>DESCRIPTION</h3>
|
||||
|
||||
The <tt>analyze</tt> command performs various analysis of LLVM assembly code or
|
||||
bytecode. It will usually print the results on standard output, but in a few
|
||||
cases, it will print output to standard error or generate a file with the
|
||||
analysis output (which is usually done when the output is meant for another
|
||||
program).
|
||||
<p>
|
||||
If filename is omitted or is -, <tt>analyze</tt> reads its input from standard
|
||||
input. It first attempts to interpret its input as LLVM bytecode. If it
|
||||
encounters an error, it then attempts to parse the input as LLVM assembly
|
||||
language.
|
||||
|
||||
<h3>OPTIONS</h3>
|
||||
|
||||
<ul>
|
||||
<li> -help
|
||||
<br>
|
||||
Print a summary of command line options.
|
||||
<p>
|
||||
|
||||
<li> -stats
|
||||
<br>
|
||||
Print statistics.
|
||||
<p>
|
||||
|
||||
<li> -time-passes
|
||||
<br>
|
||||
Record the amount of time needed for each pass and print it to standard
|
||||
error.
|
||||
<p>
|
||||
|
||||
<li> -q
|
||||
<br>
|
||||
Quiet mode. With this option, analysis pass names are not printed.
|
||||
<p>
|
||||
|
||||
<li> -load <plugin.so>
|
||||
<br>
|
||||
Load the specified dynamic object with name plugin.so. This file
|
||||
should contain additional analysis passes that register themselves with
|
||||
the <tt>analyze</tt> program after being loaded.
|
||||
<p>
|
||||
|
||||
After being loaded, additional command line options are made available
|
||||
for running the passes made available by plugin.so. Use
|
||||
'<tt><tt>analyze</tt> -load <plugin.so> -help</tt>' to see the new
|
||||
list of available analysis passes.
|
||||
<p>
|
||||
</ul>
|
||||
|
||||
<h3>EXIT STATUS</h3>
|
||||
|
||||
If <tt>analyze</tt> succeeds, it will exit with 0. Otherwise, if an error
|
||||
occurs, it will exit with a non-zero value.
|
||||
|
||||
<h3>SEE ALSO</h3>
|
||||
|
||||
<a href="opt.html"><tt>opt</tt></a>
|
||||
|
||||
<HR>
|
||||
Maintained by the <a href="http://llvm.cs.uiuc.edu">LLVM Team</a>.
|
||||
</body>
|
||||
</html>
|
||||
|
||||
228
llvm/docs/CommandGuide/bugpoint.html
Normal file
228
llvm/docs/CommandGuide/bugpoint.html
Normal file
@@ -0,0 +1,228 @@
|
||||
<html>
|
||||
<title>LLVM: bugpoint tool</title>
|
||||
|
||||
<body bgcolor=white>
|
||||
|
||||
<center><h1>LLVM: <tt>bugpoint</tt> tool</h1></center>
|
||||
<HR>
|
||||
|
||||
<h3>NAME</h3>
|
||||
<tt>bugpoint</tt>
|
||||
|
||||
<h3>SYNOPSIS</h3>
|
||||
<tt>bugpoint [options] [input LLVM ll/bc files] [LLVM passes] --args <program arguments>...</tt>
|
||||
|
||||
<img src="../Debugging.gif" width=444 height=314 align=right>
|
||||
<h3>DESCRIPTION</h3>
|
||||
|
||||
The <tt>bugpoint</tt> tool narrows down the source of
|
||||
problems in LLVM tools and passes. It can be used to debug three types of
|
||||
failures: optimizer crashes, miscompilations by optimizers, or invalid native
|
||||
code generation. It aims to reduce large test cases to small, useful ones.
|
||||
For example,
|
||||
if <tt><a href="gccas.html">gccas</a></tt> crashes while optimizing a file, it
|
||||
will identify the optimization (or combination of optimizations) that causes the
|
||||
crash, and reduce the file down to a small example which triggers the crash.<p>
|
||||
|
||||
<a name="designphilosophy">
|
||||
<h4>Design Philosophy</h4>
|
||||
|
||||
<tt>bugpoint</tt> is designed to be a useful tool without requiring any
|
||||
hooks into the LLVM infrastructure at all. It works with any and all LLVM
|
||||
passes and code generators, and does not need to "know" how they work. Because
|
||||
of this, it may appear to do a lot of stupid things or miss obvious
|
||||
simplifications. <tt>bugpoint</tt> is also designed to trade off programmer
|
||||
time for computer time in the compiler-debugging process; consequently, it may
|
||||
take a long period of (unattended) time to reduce a test case, but we feel it
|
||||
is still worth it. :-) <p>
|
||||
|
||||
<a name="automaticdebuggerselection">
|
||||
<h4>Automatic Debugger Selection</h4>
|
||||
|
||||
<tt>bugpoint</tt> reads each <tt>.bc</tt> or <tt>.ll</tt> file
|
||||
specified on the command line and links them together into a single module,
|
||||
called the test program. If any LLVM passes are
|
||||
specified on the command line, it runs these passes on the test program. If
|
||||
any of the passes crash, or if they produce malformed output,
|
||||
<tt>bugpoint</tt> starts the <a href="#crashdebug">crash debugger</a>.<p>
|
||||
|
||||
Otherwise, if the <a href="#opt_output"><tt>-output</tt></a> option was not
|
||||
specified, <tt>bugpoint</tt> runs the test program with the C backend (which
|
||||
is assumed to generate good code) to generate a reference output. Once
|
||||
<tt>bugpoint</tt> has a reference output for the test program, it tries
|
||||
executing it
|
||||
with the <a href="#opt_run-">selected</a> code generator. If
|
||||
the resulting output differs from the reference output, it assumes the
|
||||
difference resulted from a code generator failure, and starts the
|
||||
<a href="#codegendebug">code generator debugger</a>.<p>
|
||||
|
||||
Otherwise, <tt>bugpoint</tt> runs the test program after all of the LLVM passes
|
||||
have been applied to it. If its output differs from the reference output,
|
||||
it assumes the difference resulted from a failure in one of the LLVM passes,
|
||||
and enters the
|
||||
<a href="#miscompilationdebug">miscompilation debugger</a>. Otherwise,
|
||||
there is no problem <tt>bugpoint</tt> can debug.<p>
|
||||
|
||||
<a name="crashdebug">
|
||||
<h4>Crash debugger</h4>
|
||||
|
||||
If an optimizer crashes, <tt>bugpoint</tt> will try as hard as it can to
|
||||
reduce the list of passes and the size of the test program. First,
|
||||
<tt>bugpoint</tt> figures out which combination of passes triggers the bug. This
|
||||
is useful when debugging a problem exposed by <tt>gccas</tt>, for example,
|
||||
because it runs over 25 optimizations.<p>
|
||||
|
||||
Next, <tt>bugpoint</tt> tries removing functions from the test program, to
|
||||
reduce its
|
||||
size. Usually it is able to reduce a test program
|
||||
to a single function, when debugging intraprocedural optimizations. Once the
|
||||
number of
|
||||
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,
|
||||
<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
|
||||
passes crash, give you a bytecode file, and give you instructions on how to
|
||||
reproduce the failure with <tt><a href="opt.html">opt</a></tt> or
|
||||
<tt><a href="analyze.html">analyze</a></tt>.<p>
|
||||
|
||||
<a name="codegendebug">
|
||||
<h4>Code generator debugger</h4>
|
||||
|
||||
The code generator debugger attempts to narrow down the amount of code that is
|
||||
being miscompiled by the <a href="#opt_run-">selected</a> code generator. To do
|
||||
this, it takes the 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 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 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 compiled with the C backend] respectively), and instructions for
|
||||
reproducing the problem. The code generator debugger assumes that the C
|
||||
backend produces good code.<p>
|
||||
|
||||
If you are using the code generator debugger and get an error message that
|
||||
says "UNSUPPORTED: external function used as a global initializer!", try using
|
||||
the <tt>-run-llc</tt> option instead of the <tt>-run-jit</tt> option. This is
|
||||
due to an unimplemented feature in the code generator debugger.<p>
|
||||
|
||||
<a name="miscompilationdebug">
|
||||
<h4>Miscompilation debugger</h4>
|
||||
|
||||
The miscompilation debugger works similarly to the code generator
|
||||
debugger. It works by splitting the test program into two pieces, running the
|
||||
optimizations specified on one piece, linking the two pieces back together,
|
||||
and then executing the result.
|
||||
It attempts to narrow down the list of passes to the one (or few) which are
|
||||
causing the miscompilation, then reduce the portion of the test program which is
|
||||
being miscompiled. The miscompilation debugger assumes that the selected
|
||||
code generator is working properly.<p>
|
||||
|
||||
<a name="bugpoint notes">
|
||||
<h4>Advice for using <tt>bugpoint</tt></h4>
|
||||
|
||||
<tt>bugpoint</tt> can be a remarkably useful tool, but it sometimes works in
|
||||
non-obvious ways. Here are some hints and tips:<p>
|
||||
|
||||
<ol>
|
||||
<li>In the code generator and miscompilation debuggers, <tt>bugpoint</tt> only
|
||||
works with programs that have deterministic output. Thus, if the program
|
||||
outputs the date, time, or any other "random" data, <tt>bugpoint</tt> may
|
||||
misinterpret differences in these data, when output, as the result of a
|
||||
miscompilation. Programs should be temporarily modified to disable
|
||||
outputs that are likely to vary from run to run.
|
||||
|
||||
<li>In the code generator and miscompilation debuggers, debugging will go
|
||||
faster if you manually modify the program or its inputs to reduce the
|
||||
runtime, but still exhibit the problem.
|
||||
|
||||
<li><tt>bugpoint</tt> is extremely useful when working on a new optimization:
|
||||
it helps track down regressions quickly. To avoid having to relink
|
||||
<tt>bugpoint</tt> every time you change your optimization however, have
|
||||
<tt>bugpoint</tt> dynamically load your optimization with the <a
|
||||
href="#opt_load"><tt>-load</tt></a> option.
|
||||
|
||||
<li><tt>bugpoint</tt> can generate a lot of output and run for a long period of
|
||||
time. It is often useful to capture the output of the program to file. For
|
||||
example, in the C shell, you can type:<br>
|
||||
<tt>bugpoint ..... |& tee bugpoint.log</tt>
|
||||
<br>to get a copy of <tt>bugpoint</tt>'s output in the file
|
||||
<tt>bugpoint.log</tt>, as well as on your terminal.
|
||||
|
||||
<li><tt>bugpoint</tt> cannot debug problems with the linker. If
|
||||
<tt>bugpoint</tt> crashes before you see its "All input ok" message,
|
||||
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.
|
||||
|
||||
</ol>
|
||||
|
||||
<h3>OPTIONS</h3>
|
||||
|
||||
<ul>
|
||||
<li><tt>-additional-so <library.so></tt><br>
|
||||
Load <tt><library.so></tt> 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.<p>
|
||||
|
||||
<li><tt>-args <program args></tt><br>
|
||||
Pass all arguments specified after <tt>-args</tt> to the
|
||||
test program whenever it runs. Note that if any of
|
||||
the <tt><program args></tt> start with a '-', you should use:
|
||||
<p>
|
||||
<tt>bugpoint <bugpoint args> -args -- <program args></tt>
|
||||
<p>
|
||||
The "<tt>--</tt>" right after the <tt>-args</tt> option tells
|
||||
<tt>bugpoint</tt> to consider any options starting with <tt>-</tt> to be
|
||||
part of the <tt>-args</tt> option, not as options to <tt>bugpoint</tt>
|
||||
itself.<p>
|
||||
|
||||
<li><tt>-disable-{adce,dce,final-cleanup,simplifycfg}</tt><br>
|
||||
Do not run the specified passes to clean up and reduce the size of the
|
||||
test program. By default, <tt>bugpoint</tt> uses these passes internally
|
||||
when attempting to reduce test programs. If you're trying to find
|
||||
a bug in one of these passes, <tt>bugpoint</tt> may crash.<p>
|
||||
|
||||
<li> <tt>-help</tt><br>
|
||||
Print a summary of command line options.<p>
|
||||
|
||||
<a name="opt_input"><li><tt>-input <filename></tt><br>
|
||||
Open <tt><filename></tt> and redirect the standard input of the
|
||||
test program, whenever it runs, to come from that file.
|
||||
<p>
|
||||
|
||||
<a name="opt_load"><li> <tt>-load <plugin.so></tt><br>
|
||||
Load the dynamic object <tt><plugin.so></tt> into <tt>bugpoint</tt>
|
||||
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 -help and -load options together:
|
||||
<p>
|
||||
<tt>bugpoint -load <plugin.so> -help</tt>
|
||||
<p>
|
||||
|
||||
<a name="opt_output"><li><tt>-output <filename></tt><br>
|
||||
Whenever the test program produces output on its standard output
|
||||
stream, it should match the contents of <tt><filename></tt>
|
||||
(the "reference output"). If you do not use this option,
|
||||
<tt>bugpoint</tt> will attempt to generate a reference output by
|
||||
compiling the program with the C backend and running it.<p>
|
||||
|
||||
<a name="opt_run-"><li><tt>-run-{int,jit,llc,cbe}</tt><br>
|
||||
Whenever the test program is compiled, <tt>bugpoint</tt> should generate
|
||||
code for it using the specified code generator. These options allow
|
||||
you to choose the interpreter, the JIT compiler, the static native
|
||||
code compiler, or the C backend, respectively.<p>
|
||||
</ul>
|
||||
|
||||
<h3>EXIT STATUS</h3>
|
||||
|
||||
If <tt>bugpoint</tt> succeeds in finding a problem, it will exit with 0.
|
||||
Otherwise, if an error occurs, it will exit with a non-zero value.
|
||||
|
||||
<h3>SEE ALSO</h3>
|
||||
<a href="opt.html"><tt>opt</tt></a>,
|
||||
<a href="analyze.html"><tt>analyze</tt></a>
|
||||
|
||||
<HR>
|
||||
Maintained by the <a href="http://llvm.cs.uiuc.edu">LLVM Team</a>.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,134 +0,0 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
bugpoint - automatic test case reduction tool
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<bugpoint> [I<options>] [I<input LLVM ll/bc files>] [I<LLVM passes>] B<--args>
|
||||
I<program arguments>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<bugpoint> narrows down the source of problems in LLVM 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 JIT compilers). It aims to reduce large test cases to small, useful ones.
|
||||
For more information on the design and inner workings of B<bugpoint>, as well as
|
||||
advice for using bugpoint, see F<llvm/docs/Bugpoint.html> in the LLVM
|
||||
distribution.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over
|
||||
|
||||
=item B<--additional-so> F<library>
|
||||
|
||||
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
|
||||
libraries (such as the X or curses libraries) to run.
|
||||
|
||||
=item B<--args> I<program args>
|
||||
|
||||
Pass all arguments specified after -args to the test program whenever it runs.
|
||||
Note that if any of the I<program args> start with a '-', you should use:
|
||||
|
||||
bugpoint [bugpoint args] --args -- [program args]
|
||||
|
||||
The "--" right after the B<--args> option tells B<bugpoint> to consider any
|
||||
options starting with C<-> to be part of the B<--args> option, not as options to
|
||||
B<bugpoint> itself.
|
||||
|
||||
=item B<--tool-args> I<tool args>
|
||||
|
||||
Pass all arguments specified after --tool-args to the LLVM tool under test
|
||||
(B<llc>, B<lli>, etc.) whenever it runs. You should use this option in the
|
||||
following way:
|
||||
|
||||
bugpoint [bugpoint args] --tool-args -- [tool args]
|
||||
|
||||
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 to B<bugpoint> itself. (See B<--args>, above.)
|
||||
|
||||
=item B<--check-exit-code>=I<{true,false}>
|
||||
|
||||
Assume a non-zero exit code or core dump from the test program is a failure.
|
||||
Defaults to true.
|
||||
|
||||
=item B<--disable-{dce,simplifycfg}>
|
||||
|
||||
Do not run the specified passes to clean up and reduce the size of the test
|
||||
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,
|
||||
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>
|
||||
|
||||
Continually randomize the specified passes and run them on the test program
|
||||
until a bug is found or the user kills B<bugpoint>.
|
||||
|
||||
=item B<--help>
|
||||
|
||||
Print a summary of command line options.
|
||||
|
||||
=item B<--input> F<filename>
|
||||
|
||||
Open F<filename> and redirect the standard input of the test program, whenever
|
||||
it runs, to come from that file.
|
||||
|
||||
=item B<--load> F<plugin>
|
||||
|
||||
Load the dynamic object F<plugin> into B<bugpoint> 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 B<--help> and B<--load> options together; for example:
|
||||
|
||||
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>
|
||||
|
||||
Whenever the test program produces output on its standard output stream, it
|
||||
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
|
||||
by compiling the program with the C backend and running it.
|
||||
|
||||
=item B<--profile-info-file> F<filename>
|
||||
|
||||
Profile file loaded by B<--profile-loader>.
|
||||
|
||||
=item B<--run-{int,jit,llc,cbe}>
|
||||
|
||||
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
|
||||
interpreter, the JIT compiler, the static native code compiler, or the C
|
||||
backend, respectively.
|
||||
|
||||
=back
|
||||
|
||||
=head1 EXIT STATUS
|
||||
|
||||
If B<bugpoint> succeeds in finding a problem, it will exit with 0. Otherwise,
|
||||
if an error occurs, it will exit with a non-zero value.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<opt|opt>
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Maintained by the LLVM Team (L<http://llvm.org>).
|
||||
|
||||
=cut
|
||||
70
llvm/docs/CommandGuide/extract.html
Normal file
70
llvm/docs/CommandGuide/extract.html
Normal file
@@ -0,0 +1,70 @@
|
||||
<html>
|
||||
<title>
|
||||
LLVM: extract tool
|
||||
</title>
|
||||
|
||||
<body bgcolor=white>
|
||||
|
||||
<center>
|
||||
<h1>LLVM: <tt>extract</tt> tool</h1>
|
||||
</center>
|
||||
<HR>
|
||||
|
||||
<h3>NAME</h3>
|
||||
<tt>extract</tt>
|
||||
|
||||
<h3>
|
||||
SYNOPSIS
|
||||
</h3>
|
||||
|
||||
<tt>extract [options] [filename]</tt>
|
||||
<h3>
|
||||
DESCRIPTION
|
||||
</h3>
|
||||
|
||||
The <tt>extract</tt> command takes the name of a function and extracts it from
|
||||
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.
|
||||
<p>
|
||||
|
||||
In addition to extracting the bytecode of the specified function,
|
||||
<tt>extract</tt> will also remove unreachable global variables, prototypes, and
|
||||
unused types.
|
||||
<p>
|
||||
|
||||
The <tt>extract</tt> command reads its input from standard input if filename is
|
||||
omitted or if filename is -. The output is always written to standard output.
|
||||
|
||||
<h3>
|
||||
OPTIONS
|
||||
</h3>
|
||||
|
||||
<ul>
|
||||
<li>-func <function>
|
||||
<br>
|
||||
Extract the specified function from the LLVM bytecode.
|
||||
<p>
|
||||
|
||||
<li> -help
|
||||
<br>
|
||||
Print a summary of command line options.
|
||||
<p>
|
||||
</ul>
|
||||
|
||||
<h3>
|
||||
EXIT STATUS
|
||||
</h3>
|
||||
|
||||
If <tt>extract</tt> succeeds, it will exit with 0. Otherwise, if an error
|
||||
occurs, it will exit with a non-zero value.
|
||||
|
||||
<h3>
|
||||
SEE ALSO
|
||||
</h3>
|
||||
<a href="bugpoint.html"><tt>bugpoint</tt></a>
|
||||
|
||||
<HR>
|
||||
Maintained by the <a href="http://llvm.cs.uiuc.edu">LLVM Team</a>.
|
||||
</body>
|
||||
</html>
|
||||
|
||||
79
llvm/docs/CommandGuide/gccas.html
Normal file
79
llvm/docs/CommandGuide/gccas.html
Normal file
@@ -0,0 +1,79 @@
|
||||
<html>
|
||||
<title>LLVM: gccas tool</title>
|
||||
|
||||
<body bgcolor=white>
|
||||
|
||||
<center>
|
||||
<h1>LLVM: <tt>gccas</tt> tool</h1>
|
||||
</center>
|
||||
<HR>
|
||||
|
||||
<h3>NAME</h3>
|
||||
<tt>gccas</tt>
|
||||
|
||||
<h3>SYNOPSIS</h3>
|
||||
<tt>gccas [options] < filename></tt>
|
||||
|
||||
<h3>DESCRIPTION</h3>
|
||||
|
||||
The <tt>gccas</tt> utility takes an LLVM assembly file generated by the <a
|
||||
href="llvmgcc.html">C</a> or <a href="llvmgxx.html">C++</a> frontends and
|
||||
converts it into an LLVM bytecode file. It is primarily used by the GCC front
|
||||
end, and as such, attempts to mimic the interface provided by the default system
|
||||
assembler so that it can act as a "drop-in" replacement.<p>
|
||||
|
||||
<tt>gccas</tt> performs a number of optimizations on the input program.<p>
|
||||
|
||||
<h3>
|
||||
OPTIONS
|
||||
</h3>
|
||||
|
||||
<ul>
|
||||
<li> -help
|
||||
<br>
|
||||
Print a summary of command line options.
|
||||
<p>
|
||||
|
||||
<li> -o <filename>
|
||||
<br>
|
||||
Specify the output filename which will hold the assembled bytecode.
|
||||
<p>
|
||||
|
||||
<li>-disable-inlining
|
||||
<br>
|
||||
Disable the inlining pass. By default, it is enabled.
|
||||
<p>
|
||||
|
||||
<li> -stats
|
||||
<br>
|
||||
Print statistics.
|
||||
<p>
|
||||
|
||||
<li> -time-passes
|
||||
<br>
|
||||
Record the amount of time needed for each pass and print it to standard
|
||||
error.
|
||||
<p>
|
||||
|
||||
<li> -verify
|
||||
<br>
|
||||
Verify each pass result.
|
||||
<p>
|
||||
</ul>
|
||||
|
||||
<h3>
|
||||
EXIT STATUS
|
||||
</h3>
|
||||
|
||||
If <tt>gccas</tt> succeeds, it will exit with 0. Otherwise, if an error occurs,
|
||||
it will exit with a non-zero value.
|
||||
|
||||
<h3>SEE ALSO</h3>
|
||||
<a href="llvm-as.html"><tt>llvm-as</tt></a>
|
||||
<a href="gccld.html"><tt>gccld</tt></a>
|
||||
|
||||
<HR>
|
||||
Maintained by the <a href="http://llvm.cs.uiuc.edu">LLVM Team</a>.
|
||||
</body>
|
||||
</html>
|
||||
|
||||
180
llvm/docs/CommandGuide/gccld.html
Normal file
180
llvm/docs/CommandGuide/gccld.html
Normal file
@@ -0,0 +1,180 @@
|
||||
<html>
|
||||
<title>LLVM: gccld tool</title>
|
||||
|
||||
<body bgcolor=white>
|
||||
|
||||
<center><h1>LLVM: <tt>gccld</tt> tool</h1></center>
|
||||
<HR>
|
||||
|
||||
<h3>NAME</h3>
|
||||
<tt>gccld</tt>
|
||||
|
||||
<h3>SYNOPSIS</h3>
|
||||
<tt>gccld [options] < filename> [ filename ...]</tt>
|
||||
|
||||
<h3>DESCRIPTION</h3>
|
||||
|
||||
The <tt>gccld</tt> utility takes a set of LLVM bytecode files and links them
|
||||
together into a single LLVM bytecode file. The output bytecode file can be
|
||||
another bytecode library or an executable bytecode program. Using additional
|
||||
options, <tt>gccld</tt> is able to produce native code executables.
|
||||
<p>
|
||||
|
||||
The <tt>gccld</tt> utility is primarily used by the <a href="llvmgcc.html">C</a>
|
||||
and <a href="llvmgxx.html">C++</a> front-ends, and as such, attempts to mimic
|
||||
the interface provided by the default system linker so that it can act as a
|
||||
"drop-in" replacement.
|
||||
<p>
|
||||
|
||||
The <tt>gccld</tt> tool performs a small set of interprocedural, post-link,
|
||||
optimizations on the program.
|
||||
|
||||
|
||||
<h4>Search Order</h4>
|
||||
|
||||
When looking for objects specified on the command line, <tt>gccld</tt> will
|
||||
search for the object first in the current directory and then in the directory
|
||||
specified by the <tt>LLVM_LIB_SEARCH_PATH</tt> environment variable. If it
|
||||
cannot find the object, it fails.
|
||||
<p>
|
||||
|
||||
When looking for a library specified with the -l option, <tt>gccld</tt> first
|
||||
attempts to load a file with that name from the current directory. If that
|
||||
fails, it looks for lib<library>.bc, lib<library>.a, or
|
||||
lib<library>.so, in that order, in each directory added to the library
|
||||
search path with the -L option. These directories are searched in order they
|
||||
were specified. If the library cannot be located, then <tt>gccld</tt> looks in
|
||||
the directory specified by the <tt>LLVM_LIB_SEARCH_PATH</tt> environment
|
||||
variable. If it does not find lib<library>.[bc | a | so] there, it fails.
|
||||
|
||||
The -L option is global. It does not matter where it is specified in the list
|
||||
of command line arguments; the directory is simply added to the search path and
|
||||
is applied to all libraries, preceding or succeeding, in the command line.
|
||||
|
||||
<h4>Link order</h4>
|
||||
|
||||
All object files are linked first in the order they were specified on the
|
||||
command line. All library files are linked next. Some libraries may not be
|
||||
linked into the object program; see below.
|
||||
|
||||
<h4>Library Linkage</h4>
|
||||
|
||||
Object files and static bytecode objects are always linked into the output
|
||||
file. Library archives (.a files) load only the objects within the archive
|
||||
that define symbols needed by the output file. Hence, libraries should be
|
||||
listed after the object files and libraries which need them; otherwise, the
|
||||
library may not be linked in, and the dependent library will not have its
|
||||
undefined symbols defined.
|
||||
|
||||
<h4>Native code generation</h4>
|
||||
|
||||
The <tt>gccld</tt> program has limited support for native code generation, when
|
||||
using the -native option.
|
||||
|
||||
|
||||
<h3>OPTIONS</h3>
|
||||
|
||||
<ul>
|
||||
<li> -help
|
||||
<br>
|
||||
Print a summary of command line options.
|
||||
<p>
|
||||
|
||||
<li> -o <filename>
|
||||
<br>
|
||||
Specify the output filename which will hold the linked bytecode.
|
||||
<p>
|
||||
|
||||
<li> -stats
|
||||
<br>
|
||||
Print statistics.
|
||||
<p>
|
||||
|
||||
<li> -time-passes
|
||||
<br>
|
||||
Record the amount of time needed for each pass and print it to standard
|
||||
error.
|
||||
<p>
|
||||
|
||||
<li> -verify
|
||||
<br>
|
||||
Verify each pass result.
|
||||
<p>
|
||||
|
||||
<li> -L=<directory>
|
||||
<br>
|
||||
Add directory to the list of directories to search when looking for
|
||||
libraries.
|
||||
<p>
|
||||
|
||||
<li> -disable-internalize
|
||||
<br>
|
||||
Do not mark all symbols as internal.
|
||||
<p>
|
||||
|
||||
<li> -internalize-public-api-file <filename>
|
||||
<br>
|
||||
Preserve the list of symbol names in the file filename.
|
||||
<p>
|
||||
|
||||
<li> -internalize-public-api-list <list>
|
||||
<br>
|
||||
Preserve the symbol names in list.
|
||||
<p>
|
||||
|
||||
<li> -l=<library>
|
||||
<br>
|
||||
Specify libraries to include when linking the output file. When
|
||||
linking, <tt>gccld</tt> will first attempt to load a file with the
|
||||
pathname library. If that fails, it will then attempt to load
|
||||
lib<library>.bc, lib<library>.a, and lib<library>.so,
|
||||
in that order.
|
||||
<p>
|
||||
|
||||
<li> -link-as-library
|
||||
<br>
|
||||
Link the .bc files together as a library, not an executable.
|
||||
<p>
|
||||
|
||||
<li> -native
|
||||
<br>
|
||||
Generate a native, machine code executable.
|
||||
<p>
|
||||
When generating native executables, <tt>gccld</tt> first checks for a bytecode
|
||||
version of the library and links it in, if necessary. If the library is
|
||||
missing, <tt>gccld</tt> skips it. Then, <tt>gccld</tt> links in the same
|
||||
libraries as native code.
|
||||
<p>
|
||||
In this way, <tt>gccld</tt> should be able to link in optimized bytecode
|
||||
subsets of common libraries and then link in any part of the library that
|
||||
hasn't been converted to bytecode.
|
||||
<p>
|
||||
|
||||
<li> -s
|
||||
<br>
|
||||
Strip symbol information from the generated executable.
|
||||
<p>
|
||||
|
||||
<li> -v
|
||||
<br>
|
||||
Print information about actions taken.
|
||||
</ul>
|
||||
|
||||
<h3>EXIT STATUS</h3>
|
||||
|
||||
If <tt>gccld</tt> succeeds, it will exit with 0. Otherwise, if an error occurs,
|
||||
it will exit with a non-zero value.
|
||||
|
||||
<h3>SEE ALSO</h3>
|
||||
<a href="llvm-link.html"><tt>llvm-link</tt></a>
|
||||
<a href="gccas.html"><tt>gccas</tt></a>
|
||||
|
||||
<h3>BUGS</h3>
|
||||
The -L option cannot be used for find native code libraries when using the
|
||||
-native option.
|
||||
|
||||
<HR>
|
||||
Maintained by the <a href="http://llvm.cs.uiuc.edu">LLVM Team</a>.
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,256 +0,0 @@
|
||||
/* Based on http://www.perldoc.com/css/perldoc.css */
|
||||
|
||||
@import url("../llvm.css");
|
||||
|
||||
body { font-family: Arial,Helvetica; }
|
||||
|
||||
blockquote { margin: 10pt; }
|
||||
|
||||
h1, a { color: #336699; }
|
||||
|
||||
|
||||
/*** Top menu style ****/
|
||||
.mmenuon {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #ff6600; font-size: 10pt;
|
||||
}
|
||||
.mmenuoff {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #ffffff; font-size: 10pt;
|
||||
}
|
||||
.cpyright {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #ffffff; font-size: xx-small;
|
||||
}
|
||||
.cpyrightText {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #ffffff; font-size: xx-small;
|
||||
}
|
||||
.sections {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #336699; font-size: 11pt;
|
||||
}
|
||||
.dsections {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #336699; font-size: 12pt;
|
||||
}
|
||||
.slink {
|
||||
font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
|
||||
color: #000000; font-size: 9pt;
|
||||
}
|
||||
|
||||
.slink2 { font-family: Arial,Helvetica; text-decoration: none; color: #336699; }
|
||||
|
||||
.maintitle {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #336699; font-size: 18pt;
|
||||
}
|
||||
.dblArrow {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #336699; font-size: small;
|
||||
}
|
||||
.menuSec {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #336699; font-size: small;
|
||||
}
|
||||
|
||||
.newstext {
|
||||
font-family: Arial,Helvetica; font-size: small;
|
||||
}
|
||||
|
||||
.linkmenu {
|
||||
font-family: Arial,Helvetica; color: #000000; font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
P {
|
||||
font-family: Arial,Helvetica;
|
||||
}
|
||||
|
||||
PRE {
|
||||
font-size: 10pt;
|
||||
}
|
||||
.quote {
|
||||
font-family: Times; text-decoration: none;
|
||||
color: #000000; font-size: 9pt; font-style: italic;
|
||||
}
|
||||
.smstd { font-family: Arial,Helvetica; color: #000000; font-size: x-small; }
|
||||
.std { font-family: Arial,Helvetica; color: #000000; }
|
||||
.meerkatTitle {
|
||||
font-family: sans-serif; font-size: x-small; color: black; }
|
||||
|
||||
.meerkatDescription { font-family: sans-serif; font-size: 10pt; color: black }
|
||||
.meerkatCategory {
|
||||
font-family: sans-serif; font-size: 9pt; font-weight: bold; font-style: italic;
|
||||
color: brown; }
|
||||
.meerkatChannel {
|
||||
font-family: sans-serif; font-size: 9pt; font-style: italic; color: brown; }
|
||||
.meerkatDate { font-family: sans-serif; font-size: xx-small; color: #336699; }
|
||||
|
||||
.tocTitle {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #333333; font-size: 10pt;
|
||||
}
|
||||
|
||||
.toc-item {
|
||||
font-family: Arial,Helvetica; font-weight: bold;
|
||||
color: #336699; font-size: 10pt; text-decoration: underline;
|
||||
}
|
||||
|
||||
.perlVersion {
|
||||
font-family: Arial,Helvetica; font-weight: bold;
|
||||
color: #336699; font-size: 10pt; text-decoration: none;
|
||||
}
|
||||
|
||||
.podTitle {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.docTitle {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #000000; font-size: 10pt;
|
||||
}
|
||||
.dotDot {
|
||||
font-family: Arial,Helvetica; font-weight: bold;
|
||||
color: #000000; font-size: 9pt;
|
||||
}
|
||||
|
||||
.docSec {
|
||||
font-family: Arial,Helvetica; font-weight: normal;
|
||||
color: #333333; font-size: 9pt;
|
||||
}
|
||||
.docVersion {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #336699; font-size: 10pt;
|
||||
}
|
||||
|
||||
.docSecs-on {
|
||||
font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
|
||||
color: #ff0000; font-size: 10pt;
|
||||
}
|
||||
.docSecs-off {
|
||||
font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
|
||||
color: #333333; font-size: 10pt;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #336699; font-size: medium;
|
||||
}
|
||||
h1 {
|
||||
font-family: Verdana,Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #336699; font-size: large;
|
||||
}
|
||||
|
||||
DL {
|
||||
font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
|
||||
color: #333333; font-size: 10pt;
|
||||
}
|
||||
|
||||
UL > LI > A {
|
||||
font-family: Arial,Helvetica; font-weight: bold;
|
||||
color: #336699; font-size: 10pt;
|
||||
}
|
||||
|
||||
.moduleInfo {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #333333; font-size: 11pt;
|
||||
}
|
||||
|
||||
.moduleInfoSec {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #336699; font-size: 10pt;
|
||||
}
|
||||
|
||||
.moduleInfoVal {
|
||||
font-family: Arial,Helvetica; font-weight: normal; text-decoration: underline;
|
||||
color: #000000; font-size: 10pt;
|
||||
}
|
||||
|
||||
.cpanNavTitle {
|
||||
font-family: Arial,Helvetica; font-weight: bold;
|
||||
color: #ffffff; font-size: 10pt;
|
||||
}
|
||||
.cpanNavLetter {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #333333; font-size: 9pt;
|
||||
}
|
||||
.cpanCat {
|
||||
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
|
||||
color: #336699; font-size: 9pt;
|
||||
}
|
||||
|
||||
.bttndrkblue-bkgd-top {
|
||||
background-color: #225688;
|
||||
background-image: url(/global/mvc_objects/images/bttndrkblue_bgtop.gif);
|
||||
}
|
||||
.bttndrkblue-bkgd-left {
|
||||
background-color: #225688;
|
||||
background-image: url(/global/mvc_objects/images/bttndrkblue_bgleft.gif);
|
||||
}
|
||||
.bttndrkblue-bkgd {
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-top: 0px;
|
||||
background-repeat: no-repeat;
|
||||
background-color: #225688;
|
||||
background-image: url(/global/mvc_objects/images/bttndrkblue_bgmiddle.gif);
|
||||
vertical-align: top;
|
||||
}
|
||||
.bttndrkblue-bkgd-right {
|
||||
background-color: #225688;
|
||||
background-image: url(/global/mvc_objects/images/bttndrkblue_bgright.gif);
|
||||
}
|
||||
.bttndrkblue-bkgd-bottom {
|
||||
background-color: #225688;
|
||||
background-image: url(/global/mvc_objects/images/bttndrkblue_bgbottom.gif);
|
||||
}
|
||||
.bttndrkblue-text a {
|
||||
color: #ffffff;
|
||||
text-decoration: none;
|
||||
}
|
||||
a.bttndrkblue-text:hover {
|
||||
color: #ffDD3C;
|
||||
text-decoration: none;
|
||||
}
|
||||
.bg-ltblue {
|
||||
background-color: #f0f5fa;
|
||||
}
|
||||
|
||||
.border-left-b {
|
||||
background: #f0f5fa url(/i/corner-leftline.gif) repeat-y;
|
||||
}
|
||||
|
||||
.border-right-b {
|
||||
background: #f0f5fa url(/i/corner-rightline.gif) repeat-y;
|
||||
}
|
||||
|
||||
.border-top-b {
|
||||
background: #f0f5fa url(/i/corner-topline.gif) repeat-x;
|
||||
}
|
||||
|
||||
.border-bottom-b {
|
||||
background: #f0f5fa url(/i/corner-botline.gif) repeat-x;
|
||||
}
|
||||
|
||||
.border-right-w {
|
||||
background: #ffffff url(/i/corner-rightline.gif) repeat-y;
|
||||
}
|
||||
|
||||
.border-top-w {
|
||||
background: #ffffff url(/i/corner-topline.gif) repeat-x;
|
||||
}
|
||||
|
||||
.border-bottom-w {
|
||||
background: #ffffff url(/i/corner-botline.gif) repeat-x;
|
||||
}
|
||||
|
||||
.bg-white {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.border-left-w {
|
||||
background: #ffffff url(/i/corner-leftline.gif) repeat-y;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user