Compare commits

..

24 Commits

Author SHA1 Message Date
John Criswell
32e813e486 Merged from mainline.
llvm-svn: 15723
2004-08-13 18:52:00 +00:00
John Criswell
b6a9b36e21 Setup the llvm-gcc tarball the way we have always done.
llvm-svn: 15687
2004-08-12 14:34:38 +00:00
John Criswell
0fe9bd9e6d Merged from mainline.
llvm-svn: 15686
2004-08-12 14:28:44 +00:00
John Criswell
322e13176f Merged from mainline. This should fix 176.gcc.
llvm-svn: 15685
2004-08-12 14:20:45 +00:00
John Criswell
ab686a51f1 Updated code sizes for LLVM.
llvm-svn: 15666
2004-08-11 19:48:12 +00:00
John Criswell
f2a68db009 Adding 2004-08-10-BoolSetCC.ll (written by Chris) as a new regression test.
Merged from mainline.

llvm-svn: 15641
2004-08-11 01:28:05 +00:00
John Criswell
ef095995c7 Merged in revision 1.239 from mainline.
llvm-svn: 15640
2004-08-11 01:23:22 +00:00
CVS to SVN Conversion
841e6949d7 This commit was manufactured by cvs2svn to create branch 'release_13'.
llvm-svn: 15638
2004-08-11 00:49:50 +00:00
John Criswell
a98c3d19a5 Merged from mainline on August 10, 2004.
llvm-svn: 15619
2004-08-10 18:33:39 +00:00
CVS to SVN Conversion
10b4a6323f This commit was manufactured by cvs2svn to create branch 'release_13'.
llvm-svn: 15618
2004-08-10 18:33:39 +00:00
John Criswell
7d4bacd1af Merged in mainline.
llvm-svn: 15617
2004-08-10 18:32:06 +00:00
John Criswell
f0958ae6eb Merged in changes to the instruction combining pass.
llvm-svn: 15598
2004-08-09 21:34:34 +00:00
John Criswell
7ee0099de5 Merged in new regression test.
llvm-svn: 15597
2004-08-09 21:33:52 +00:00
CVS to SVN Conversion
7aa6c01be2 This commit was manufactured by cvs2svn to create branch 'release_13'.
llvm-svn: 15596
2004-08-09 21:33:52 +00:00
John Criswell
1e34901d4d Fix capitalization of URL.
llvm-svn: 15595
2004-08-09 21:17:16 +00:00
John Criswell
362f4b3e5d Updated release notes from mainline.
llvm-svn: 15594
2004-08-09 21:15:20 +00:00
John Criswell
67dee05f54 Merged in changes Chris commited over the weekend. Merge done on August 9,
2004.

llvm-svn: 15576
2004-08-09 15:35:51 +00:00
John Criswell
0ccbe35d71 Added note about new PowerPC code generator.
Updated versions to 1.3.

llvm-svn: 15560
2004-08-06 21:26:30 +00:00
John Criswell
7f6d3e7317 Fixed the link to the Command Guide. The previous revision only worked
if the browser is getting the file from a web server that autocompletes
the URL.

llvm-svn: 15559
2004-08-06 21:12:44 +00:00
John Criswell
fb63a35c3c Created script to help automate part of the release process.
llvm-svn: 15558
2004-08-06 21:03:59 +00:00
John Criswell
6dbb267760 Merge in test for structures with more than 256 members, courtesy of Chris.
llvm-svn: 15557
2004-08-06 19:57:05 +00:00
CVS to SVN Conversion
50fe9297ba This commit was manufactured by cvs2svn to create branch 'release_13'.
llvm-svn: 15556
2004-08-06 19:57:05 +00:00
John Criswell
395900dcf5 Updated version.
llvm-svn: 15549
2004-08-06 16:21:48 +00:00
CVS to SVN Conversion
a27fe0174c This commit was manufactured by cvs2svn to create branch 'release_13'.
llvm-svn: 15548
2004-08-06 16:21:48 +00:00
4831 changed files with 301412 additions and 486816 deletions

5
llvm/.cvsignore Normal file
View File

@@ -0,0 +1,5 @@
mklib
Makefile.config
config.log
config.status
cvs.out

View File

@@ -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,27 +12,14 @@ 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
D: Portions of the PowerPC backend
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
@@ -45,178 +31,37 @@ 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: Portions of X86 static and JIT compilers.
D: Dynamic trace optimizer
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: 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: 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
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
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: 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
D: Test suite fixes for FreeBSD.
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
@@ -226,22 +71,11 @@ 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
E: rspencer@x10sys.com
W: http://extprosys.sourceforge.net/
D: 'llvm' namespacification, Stacker FE, VMCore cleanup (SymbolTable,
D: Value != Type, CPR removal, bytecode improvements, llvmcs).
N: Bill Wendling
E: isanbard@gmail.com
W: http://web.mac.com/bwendling/
D: MMX & SSSE3 instructions
D: SPEC2006 support
E: wendling@isanbard.org
D: The `Lower Setjmp/Longjmp' pass, improvements to the -lowerswitch pass.

View File

@@ -4,7 +4,7 @@ LLVM Release License
University of Illinois/NCSA
Open Source License
Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign.
Copyright (c) 2003, 2004 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
@@ -61,8 +61,41 @@ licenses, and/or restrictions:
Program Directory
------- ---------
System Library llvm/lib/System
Compiler Driver llvm/tools/llvmc
Autoconf llvm/autoconf
PowerPC Backend llvm/lib/Target/PowerPC
Autoconf: llvm/autoconf
llvm/projects/ModuleMaker/autoconf
llvm/projects/sample/autoconf
Burg: llvm/utils/Burg
llvm/test/Programs/MultiSource/Applications/Burg
Aha: llvm/test/Programs/MultiSource/Applications/aha
SGEFA: llvm/test/Programs/MultiSource/Applications/sgefa
SIOD: llvm/test/Programs/MultiSource/Applications/siod
Spiff: llvm/test/Programs/MultiSource/Applications/spiff
D: llvm/test/Programs/MultiSource/Applications/d
Lambda: llvm/test/Programs/MultiSource/Applications/lambda-0.1.3
hbd: llvm/test/Programs/MultiSource/Applications/hbd
treecc: llvm/test/Programs/MultiSource/Applications/treecc
kimwitu++: llvm/test/Programs/MultiSource/Applications/kimwitu++
obsequi: llvm/test/Programs/MultiSource/Applications/obsequi
Fhourstones: llvm/test/Programs/MultiSource/Benchmarks/Fhourstones
McCat: llvm/test/Programs/MultiSource/Benchmarks/McCat
Olden: llvm/test/Programs/MultiSource/Benchmarks/Olden
OptimizerEval: llvm/test/Programs/MultiSource/Benchmarks/OptimizerEval
Ptrdist: llvm/test/Programs/MultiSource/Benchmarks/Ptrdist
LLUBenchmark: llvm/test/Programs/MultiSource/Benchmarks/llubenchmark
SIM: llvm/test/Programs/MultiSource/Benchmarks/sim
cfrac: llvm/test/Programs/MultiSource/Benchmarks/MallocBench/cfrac
espresso: llvm/test/Programs/MultiSource/Benchmarks/MallocBench/espresso
gs: llvm/test/Programs/MultiSource/Benchmarks/MallocBench/gs
p2c: llvm/test/Programs/MultiSource/Benchmarks/MallocBench/p2c
gawk: llvm/test/Programs/MultiSource/Benchmarks/MallocBench/gawk
make: llvm/test/Programs/MultiSource/Benchmarks/MallocBench/make
perl: llvm/test/Programs/MultiSource/Benchmarks/MallocBench/perl
Dhrystone: llvm/test/Programs/SingleSource/Benchmarks/Dhrystone
SingleSource Tests: llvm/test/Programs/SingleSource/Benchmarks/Misc
llvm/test/Programs/SingleSource/CustomChecked
llvm/test/Programs/SingleSource/Gizmos
GNU Libc: llvm/runtime/GCCLibraries/libc
Zlib Library: llvm/runtime/zlib
PNG Library: llvm/runtime/libpng

View File

@@ -6,134 +6,47 @@
# the University of Illinois Open Source License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
LEVEL = .
DIRS = lib/Support utils lib tools
LEVEL := .
# 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
OPTIONAL_DIRS := examples projects
EXTRA_DIST := test llvm.spec include win32 Xcode
include $(LEVEL)/Makefile.config
# 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
ifeq ($(MAKECMDGOALS),libs-only)
DIRS := $(filter-out tools runtime docs, $(DIRS))
OPTIONAL_DIRS :=
ifneq ($(MAKECMDGOALS),tools-only)
DIRS += runtime
OPTIONAL_DIRS = projects
endif
ifeq ($(MAKECMDGOALS),tools-only)
DIRS := $(filter-out runtime docs, $(DIRS))
OPTIONAL_DIRS :=
endif
include $(LEVEL)/Makefile.common
# Don't install utils, examples, or projects they are only used to
# build LLVM.
ifeq ($(MAKECMDGOALS),install)
DIRS := $(filter-out utils, $(DIRS))
OPTIONAL_DIRS :=
endif
test :: all
cd test; $(MAKE)
# 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
distclean:: clean
$(VERB) $(RM) -rf $(LEVEL)/Makefile.config \
$(LEVEL)/include/Config/config.h \
$(LEVEL)/autoconf/autom4te.cache \
$(LEVEL)/config.log \
$(LEVEL)/TAGS
tools-only: all
libs-only: all
#------------------------------------------------------------------------
# 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))
# Install support for llvm include files:
.PHONY: install-includes
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.
install-includes:
$(MKDIR) $(DESTDIR)$(includedir)/llvm
cd include && find * -path '*/Internal' -prune -o '(' '!' '(' -name '*~' -o -name .cvsignore ')' -print ')' | grep -v CVS | pax -rwdvpe $(DESTDIR)$(includedir)/llvm
ifneq ($(BUILD_SRC_ROOT),$(BUILD_OBJ_ROOT))
cd $(BUILD_SRC_ROOT)/include && find * -path '*/Internal' -prune -o '(' '!' '(' -name '*~' -o -name .cvsignore ')' -print ')' | grep -v CVS | pax -rwdvpe $(DESTDIR)$(includedir)/llvm
endif
check-llvm2cpp:
$(Verb)$(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
install:: install-includes
check-one:
$(Verb)$(MAKE) -C test check-one TESTONE=$(TESTONE)
# Build tags database for Emacs/Xemacs:
.PHONY: tags
srpm: $(LLVM_OBJ_ROOT)/llvm.spec
rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
TAGS: tags
rpm: $(LLVM_OBJ_ROOT)/llvm.spec
rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
all::
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
.PHONY: srpm rpm
tags:
find $(wildcard $(SourceDir)/include $(SourceDir)/lib $(SourceDir)/tools) -name '*.cpp' -o -name '*.h' | $(ETAGS) $(ETAGSFLAGS) -

View File

@@ -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

View File

@@ -12,105 +12,12 @@
#
#===------------------------------------------------------------------------===#
# Define LLVM specific info and directories based on the autoconf variables
LLVMPackageName := @PACKAGE_NAME@
LLVMVersion := @PACKAGE_VERSION@
LLVM_CONFIGTIME := @LLVM_CONFIGTIME@
###########################################################################
# Directory Configuration
# This section of the Makefile determines what is where. To be
# specific, there are several locations that need to be defined:
#
# 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 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.
#
###########################################################################
PWD := @BINPWD@
# Set the project name to LLVM if its not defined
ifndef PROJECT_NAME
PROJECT_NAME := $(LLVMPackageName)
endif
PROJ_OBJ_DIR := $(shell $(PWD))
PROJ_OBJ_ROOT := $(shell cd $(PROJ_OBJ_DIR)/$(LEVEL); $(PWD))
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)
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)
endif
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@
# Targets that we should build
TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
# Extra options to compile LLVM with
EXTRA_OPTIONS=@EXTRA_OPTIONS@
# Endian-ness of the target
ENDIAN=@ENDIAN@
@@ -121,140 +28,185 @@ CXX = @CXX@
# Path to the CC binary, which use used by testcases for native builds.
CC := @CC@
# Path to the Python interpreter
PYTHON := @PYTHON@
# Linker flags.
LDFLAGS+=@LDFLAGS@
# Libraries needed by tools
TOOLLINKOPTS=@LIBS@
# Path to the library archiver program.
AR_PATH = @AR@
# Path to the nm program
NM_PATH = @NM@
# The pathnames of the Flex and Bison programs, respectively.
YACC = @YACC@
BISON = @BISON@
FLEX = @LEX@
# 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@
ETAGS := @ETAGS@
ETAGSFLAGS := @ETAGSFLAGS@
GROFF := @GROFF@
GZIP := @GZIP@
POD2HTML := @POD2HTML@
POD2MAN := @POD2MAN@
RUNTEST := @RUNTEST@
TCLSH := @TCLSH@
ZIP := @ZIP@
HAVE_PERL := @HAVE_PERL@
HAVE_PTHREAD := @HAVE_PTHREAD@
LIBS := @LIBS@
# 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@
# Paths to miscellaneous programs.
RPWD = pwd
SED = sed
RM = rm
ECHO = echo
MKDIR = @abs_top_srcdir@/autoconf/mkinstalldirs
DATE = date
MV = mv
INSTALL = @INSTALL@
DOT = @DOT@
ETAGS = @ETAGS@
ETAGSFLAGS = @ETAGSFLAGS@
# Determine the target for which LLVM should generate code.
ifeq (@LLVMGCC_MAJVERS@,3)
LLVMGCCARCH := @target@/3.4-llvm
else
LLVMGCCARCH := @target@/@LLVMGCC_VERSION@
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@
LCC1 = @LLVMCC1@
LCC1XX = @LLVMCC1PLUS@
# 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 := .
# 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@
# When this variable is set to 1, 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@
# SPEC benchmarks:
# If these are set then run the SPEC benchmarks.
# You must provide the SPEC benchmarks on your own.
@USE_SPEC2000@
@USE_SPEC95@
# Path to the SPEC benchmarks.
SPEC2000_ROOT := @SPEC2000_ROOT@
SPEC95_ROOT := @SPEC95_ROOT@
# Path to the Povray source code.
@USE_POVRAY@
POVRAY_ROOT := @POVRAY_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, 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.
# 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 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@
@JIT@
# Shared library extension for host platform.
# Disable LLC diffs for testing.
@DISABLE_LLC_DIFFS@
# Shared library extension for this platform.
SHLIBEXT = @SHLIBEXT@
# Executable file extension for host platform.
# Executable file extension for this platform.
EXEEXT = @EXEEXT@
# Things we just assume are "there"
ECHO := echo
###########################################################################
# Directory Configuration
# This section of the Makefile determines what is where. To be
# specific, there are several locations that need to be defined:
#
# 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 BUILD_SRC_DIR : The directory containing the code to build.
# o BUILD_SRC_ROOT : The root directory of the code to build.
#
# 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.
#
###########################################################################
# 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@
# Set the object build directory. By default, it is the current directory.
ifndef BUILD_OBJ_DIR
BUILD_OBJ_DIR := $(subst //,/,$(shell $(RPWD)))
endif
# Set the root of the object directory.
ifndef BUILD_OBJ_ROOT
BUILD_OBJ_ROOT := $(subst //,/,$(shell cd $(BUILD_OBJ_DIR)/$(LEVEL); $(RPWD)))
endif
# 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
# 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
ifdef LLVM_SRC_ROOT
LLVM_OBJ_ROOT := $(shell cd $(LLVM_SRC_ROOT); $(RPWD))
else
LLVM_OBJ_ROOT := $(BUILD_OBJ_ROOT)
endif
endif
# 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
# Installation directories, as provided by the configure script.
exec_prefix = @exec_prefix@
prefix = @prefix@
program_transform_name = @program_transform_name@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
bytecode_libdir = $(LLVMGCCDIR)/bytecode-libs
includedir = @includedir@
infodir = @infodir@
mandir = @mandir@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_DATA = @INSTALL_DATA@
# Get the value of HUGE_VAL_SANITY which will be either "yes" or "no" depending
# on the check.
HUGE_VAL_SANITY = @HUGE_VAL_SANITY@

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -1,13 +1 @@
Low Level Virtual Machine (LLVM)
================================
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.
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.
This file is a placeholder; see docs/index.html for documentation.

File diff suppressed because it is too large Load Diff

View File

@@ -1 +0,0 @@
Xcode project files for LLVM, for Xcode 2.1

View File

@@ -3,46 +3,19 @@ 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"
test -d autoconf && test -f autoconf/configure.ac && cd autoconf
[ -f configure.ac ] || die "Can't find 'autoconf' dir; please cd into it first"
echo "Regenerating aclocal.m4 with aclocal"
aclocal || die "aclocal failed"
autoconf --version | egrep '2\.5[0-9]' > /dev/null
if test $? -ne 0
then
die "Your autoconf was not detected as being 2.5x"
fi
echo "Note: Warnings about 'AC_CONFIG_SUBDIRS: you should use literals' are ok"
echo "Regenerating configure with autoconf 2.5x"
autoconf -o ../configure configure.ac || 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"
echo "Regenerating config.h.in with autoheader 2.5x"
autoheader -I autoconf autoconf/configure.ac || die "autoheader failed"
exit 0

View File

@@ -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.

6306
llvm/autoconf/acinclude.m4 Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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

View File

@@ -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:

View File

@@ -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,59 +41,29 @@ 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...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
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.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
while [ x"$1" != x ]; do
case $1 in
-c) shift
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit 0;;
-m) chmodcmd="$chmodprog $2"
shift
shift
@@ -121,202 +74,178 @@ while test -n "$1"; do
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-T) no_target_directory=true
-s) stripcmd="$stripprog"
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
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
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
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 test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# 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,^$,.,'`
# Make sure that the destination directory exists.
# 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
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
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
continue;;
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"; }
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
dstfile=`basename "$dst"`
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
# 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
}
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
:
fi
} &&
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=$mkdirprog
fi
else
# 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 [ -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 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
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
:
fi
fi
## 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
# Skip lots of stat calls in the usual case.
if [ ! -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}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
:
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
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 $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit
}
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
# 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:
fi &&
exit 0

File diff suppressed because it is too large Load Diff

View File

@@ -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])

View File

@@ -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)])

View File

@@ -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
])

View File

@@ -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)
])

View File

@@ -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])
])

View File

@@ -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}"])
])

View File

@@ -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
])

View File

@@ -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
])

View File

@@ -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])

View File

@@ -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])

View File

@@ -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
])

View File

@@ -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
])

View File

@@ -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
])

View File

@@ -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
])

View File

@@ -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
])

View File

@@ -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
])

View File

@@ -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
])

View File

@@ -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
])

View File

@@ -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)
])

File diff suppressed because it is too large Load Diff

View File

@@ -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
])

View File

@@ -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

View File

@@ -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])

View File

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

View File

@@ -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
])])

View File

@@ -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
])

View File

@@ -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
])

View File

@@ -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++])])
])

View File

@@ -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:

View File

@@ -1,55 +1,30 @@
#! /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
case "${1}" in
-h | --help | --h* ) # -h for help
echo "$usage"
exit 0
;;
echo "${usage}" 1>&2; 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
;;
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
@@ -66,39 +41,17 @@ case $# in
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 -- $*"
if mkdir -p -- . 2>/dev/null; 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
;;
fi ;;
*)
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
test ! -d ./--version; then
# echo "mkdir -m $dirmode -p -- $*"
if mkdir -m "$dirmode" -p -- . 2>/dev/null; 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
;;
fi ;;
esac
for file
@@ -110,12 +63,12 @@ do
for d
do
pathcomp="$pathcomp$d"
case $pathcomp in
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
# echo "mkdir $pathcomp"
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
@@ -123,7 +76,8 @@ do
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
# echo "chmod $dirmode $pathcomp"
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
@@ -142,9 +96,6 @@ 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

View File

@@ -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

31539
llvm/configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -70,12 +70,12 @@ memory. There are many different algorithms for alias analysis and many
different ways of classifying them: flow-sensitive vs flow-insensitive,
context-sensitive vs context-insensitive, field-sensitive vs field-insensitive,
unification-based vs subset-based, etc. Traditionally, alias analyses respond
to a query with a <a href="#MustMayNo">Must, May, or No</a> alias response,
to a query with a <a href="#MustNoMay">Must, May, or No</a> alias response,
indicating that two pointers always point to the same object, might point to the
same object, or are known to never point to the same object.</p>
<p>The LLVM <a
href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html"><tt>AliasAnalysis</tt></a>
href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1AliasAnalysis.html"><tt>AliasAnalysis</tt></a>
class is the primary interface used by clients and implementations of alias
analyses in the LLVM system. This class is the common interface between clients
of alias analysis information and the implementations providing it, and is
@@ -102,7 +102,7 @@ know</a>.</p>
<div class="doc_text">
<p>The <a
href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html"><tt>AliasAnalysis</tt></a>
href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1AliasAnalysis.html"><tt>AliasAnalysis</tt></a>
class defines the interface that the various alias analysis implementations
should support. This class exports two important enums: <tt>AliasResult</tt>
and <tt>ModRefResult</tt> which represent the result of an alias query or a
@@ -274,6 +274,7 @@ memory location to be modified.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="simplemodref">The <tt>doesNotAccessMemory</tt> and
@@ -303,6 +304,8 @@ functions that satisfy the <tt>doesNotAccessMemory</tt> method also satisfies
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="writingnew">Writing a new <tt>AliasAnalysis</tt> Implementation</a>
@@ -755,9 +758,6 @@ field-<b>sensitive</b>" version of Steensgaard's algorithm using the Data
Structure Analysis framework. This gives it substantially more precision than
the standard algorithm while maintaining excellent analysis scalability.</p>
<p>Note that <tt>-steens-aa</tt> is available in the optional "poolalloc"
module, it is not part of the LLVM core.</p>
</div>
<!-- _______________________________________________________________________ -->
@@ -778,9 +778,6 @@ queries, and can provide context-sensitive mod/ref information as well. The
only major facility not implemented so far is support for must-alias
information.</p>
<p>Note that <tt>-ds-aa</tt> is available in the optional "poolalloc"
module, it is not part of the LLVM core.</p>
</div>
@@ -895,15 +892,9 @@ implementations. You can use them with commands like '<tt>opt -anders-aa -ds-aa
<div class="doc_text">
<p>The <tt>-print-alias-sets</tt> pass is exposed as part of the
<tt>opt</tt> tool to print out the Alias Sets formed by the <a
<tt>analyze</tt> tool to print out the Alias Sets formed by the <a
href="#ast"><tt>AliasSetTracker</tt></a> class. This is useful if you're using
the <tt>AliasSetTracker</tt> class. To use it, use something like:</p>
<div class="doc_code">
<pre>
% opt -ds-aa -print-alias-sets -disable-output
</pre>
</div>
the <tt>AliasSetTracker</tt> class.</p>
</div>
@@ -957,7 +948,7 @@ algorithm will have a lower number of may aliases).</p>
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
<a href="http://llvm.cs.uiuc.edu">LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>

View File

@@ -1,614 +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>.
</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 four bytes of the stream identify the encoding of the file. This
is used by a reader to know what is contained in the file.</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. This 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 .. 52</li>
<li>'0' .. '9' - 53 .. 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). 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, or
they may be associated with all blocks of a particular ID.
</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>,
&lt;align32bits&gt;, 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 is application specific). 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, &lt;align32bits&gt;]</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>[&lt;abbrevid&gt;, 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>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 encoding operand.</li>
<li>2 - VBR - The field should be emitted as a <a
href="#variablewidth">variable-width value</a>, whose width
is specified by the encoding operand.</li>
<li>3 - Array - This field is an array of values. The element type of the array
is specified by the next encoding operand.</li>
<li>4 - Char6 - This field should be emitted as a <a href="#char6">char6-encoded
value</a>.</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.
</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. The standard
DEFINE_ABBREV record specifies an abbreviation. The abbreviation is associated
with the record ID, and any records with matching ID automatically get the
abbreviation.
</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>['B'<sub>8</sub>, 'C'<sub>8</sub>, 0x0<sub>4</sub>, 0xC<sub>4</sub>,
0xE<sub>4</sub>, 0xD<sub>4</sub>]</tt></p>
<p>When 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>

View File

@@ -1,63 +1,33 @@
<!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>
<title>LLVM: bugpoint tool</title>
<div class="doc_title">
LLVM bugpoint tool: design and usage
</div>
<body bgcolor=white>
<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>
<center><h1>LLVM: <tt>bugpoint</tt> tool</h1></center>
<HR>
<div class="doc_author">
<p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a></p>
</div>
<h3>NAME</h3>
<tt>bugpoint</tt>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="desc">Description</a>
</div>
<!-- *********************************************************************** -->
<h3>SYNOPSIS</h3>
<tt>bugpoint [options] [input LLVM ll/bc files] [LLVM passes] --args &lt;program arguments&gt;...</tt>
<div class="doc_text">
<img src="img/Debugging.gif" width=444 height=314 align=right>
<h3>DESCRIPTION</h3>
<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>
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 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><a href="CommandGuide/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>
<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>
<a name="designphilosophy">
<h4>Design Philosophy</h4>
</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
<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
@@ -66,113 +36,86 @@ 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>
executing it) takes a long time.<p>
</div>
<a name="automaticdebuggerselection">
<h4>Automatic Debugger Selection</h4>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="autoselect">Automatic Debugger Selection</a>
</div>
<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>
<div class="doc_text">
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
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><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
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>
enters the <a href="#miscompilationdebug">miscompilation
debugger</a>. Otherwise, there is no problem <tt>bugpoint</tt> can debug.<p>
</div>
<a name="crashdebug">
<h4>Crash debugger</h4>
<!-- ======================================================================= -->
<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
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>
exposed by <tt>gccas</tt>, for example, because it runs over 38 passes.<p>
<p>Next, <tt>bugpoint</tt> tries removing functions from the test program, to
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>
passes crash, give you a bytecode file, and give you instructions on how to
reproduce the failure with <tt><a href="CommandGuide/opt.html">opt</a></tt>, <tt><a
href="CommandGuide/analyze.html">analyze</a></tt>, or <tt><a href="CommandGuide/llc.html">llc</a></tt>.<p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="codegendebug">Code generator debugger</a>
</div>
<div class="doc_text">
<a name="codegendebug">
<h4>Code generator debugger</h4>
<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>
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>
</div>
<a name="miscompilationdebug">
<h4>Miscompilation debugger</h4>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="miscompilationdebug">Miscompilation debugger</a>
</div>
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 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">
<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>
@@ -180,10 +123,10 @@ 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.
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
@@ -192,19 +135,15 @@ non-obvious ways. Here are some hints and tips:<p>
<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.
<tt>bugpoint</tt> dynamically load your optimization with the <a
href="#opt_load"><tt>-load</tt></a> 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 ... |&amp; 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> 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 ..... |&amp; 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 LLVM linker. If
<tt>bugpoint</tt> crashes before you see its "All input ok" message,
@@ -216,29 +155,91 @@ non-obvious ways. Here are some hints and tips:<p>
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>
<h3>OPTIONS</h3>
<!-- *********************************************************************** -->
<ul>
<li><tt>-additional-so &lt;library&gt;</tt><br>
Load <tt>&lt;library&gt;</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>
<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>
<li><tt>-args &lt;program args&gt;</tt><br>
Pass all arguments specified after <tt>-args</tt> to the
test program whenever it runs. Note that if any of
the <tt>&lt;program args&gt;</tt> start with a '-', you should use:
<p>
<tt>bugpoint &lt;bugpoint args&gt; -args -- &lt;program args&gt;</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>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>
<li><tt>-tool-args &lt;tool args&gt;</tt><br>
Pass all arguments specified after <tt>-tool-args</tt> to the
LLVM tool under test (llc, lli, etc.) whenever it runs.
You should use this option in the following way:
<p>
<tt>bugpoint &lt;bugpoint args&gt; -tool-args -- &lt;tool args&gt;</tt>
<p>
The "<tt>--</tt>" right after the <tt>-tool-args</tt> option tells
<tt>bugpoint</tt> to consider any options starting with <tt>-</tt> to be
part of the <tt>-tool-args</tt> option, not as options to
<tt>bugpoint</tt> itself. (See <tt>-args</tt>, above.)<p>
<li><tt>-check-exit-code={true,false}</tt><br>
Assume a non-zero exit code or core dump from the test program is
a failure. Defaults to true.<p>
<li><tt>-disable-{dce,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 &lt;filename&gt;</tt><br>
Open <tt>&lt;filename&gt;</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 &lt;plugin&gt;</tt><br>
Load the dynamic object <tt>&lt;plugin&gt;</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 &lt;plugin&gt; -help</tt>
<p>
<a name="opt_output"><li><tt>-output &lt;filename&gt;</tt><br>
Whenever the test program produces output on its standard output
stream, it should match the contents of <tt>&lt;filename&gt;</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>
<li><tt>-profile-info-file &lt;filename&gt;</tt><br>
Profile file loaded by -profile-loader.<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.
<HR>
Maintained by the <a href="http://llvm.cs.uiuc.edu">LLVM Team</a>.
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -4,65 +4,232 @@
<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>
<title>Bootstrapping the LLVM C/C++ Front-End</title>
</head>
<body>
<div class="doc_title">
Building the LLVM C/C++ Front-End
Bootstrapping the LLVM C/C++ Front-End
</div>
<ol>
<li><a href="#instructions">Building llvm-gcc 4 from Source</a></li>
<li><a href="#cautionarynote">A Cautionary Note</a>
<ul>
<li><a href="#cygwin">Building under Cygwin</a></li>
</ul>
</li>
<li><a href="#instructions">Instructions</a></li>
<li><a href="#license">License Information</a></li>
</ol>
<div class="doc_author">
<p>Written by the LLVM Team</p>
<p>Written by Brian R. Gaeke and
<a href="http://nondot.org/sabre">Chris Lattner</a></p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="instructions">Building llvm-gcc 4 from Source</a>
<a name="cautionarynote">A Cautionary Note</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>This document is intended to explain the process of building the
LLVM C/C++ front-end, based on GCC 3.4, from its source code. You
would have to do this, for example, if you are porting LLVM to a new
architecture or operating system.</p>
<p>This section describes how to aquire and build llvm-gcc4, which is based on
the GCC 4.0.1 front-end. This front-end supports C, C++, Objective-C, and
Objective-C++. Note that the instructions for building this front-end are
completely different (and much easier!) than those for building llvm-gcc3 in
the past.</p>
<p><b>NOTE:</b> This is currently a somewhat fragile, error-prone
process, and you should <b>only</b> try to do it if:</p>
<ol>
<li><p>Retrieve the appropriate llvm-gcc4-x.y.source.tar.gz archive from the
<a href="http://llvm.org/releases/">llvm web site</a>.</p>
<p>It is also possible to download the sources of the llvm-gcc4 front end
from a read-only mirror using subversion. To check out the code the
first time use:</p>
<div class="doc_code">
<pre>
svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.0/trunk <i>dst-directory</i>
</pre>
</div>
<p>After that, the code can be be updated in the destination directory
using:</p>
<div class="doc_code">
<pre>svn update</pre>
</div>
<p>The mirror is brought up to date every evening.</p></li>
<li>Follow the directions in the top-level <tt>README.LLVM</tt> file for
up-to-date instructions on how to build llvm-gcc4.</li>
<li>you really, really, really can't use the binaries we distribute</li>
<li>you need GCC to fix some of the header files on your system</li>
<li>you are an elite GCC hacker.</li>
</ol>
<p>We welcome patches to help make this process simpler.</p>
</div>
<!--=========================================================================-->
<div class="doc_subsection">
<a name="cygwin">Building under Cygwin</a>
</div>
<!--=========================================================================-->
<div class="doc_text">
<p>If you are building LLVM and the C front-end under Cygwin, please note that
the LLVM and GCC makefiles do not correctly handle spaces in paths. To deal
with this issue, make sure that your LLVM and GCC source and build trees are
located in a top-level directory (like <tt>/cygdrive/c/llvm</tt> and
<tt>/cygdrive/c/llvm-cfrontend</tt>), not in a directory that contains a space
(which includes your "home directory", because it lives under the "Documents
and Settings" directory). We welcome patches to fix this issue.
</p>
</div>
<!-- *********************************************************************** -->
<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
</pre>
<p>This will build all of the LLVM tools and libraries, but you will see
warnings about missing the C front-end (certain runtime libraries can't
be built without it). Ignore these warnings for now.</p></li>
<li><p>Add the directory containing the tools to your PATH.</p>
<pre>
% set path = ( `cd llvm/tools/Debug &amp;&amp; pwd` $path )
</pre></li>
<li><p>Unpack the C/C++ front-end source into cfrontend/src.</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>
<p>
<b>Linux/x86:</b><br>
<b>MacOS X/PowerPC</b> (requires dlcompat library):
</p>
<pre>
% cd build
% ../src/configure --prefix=$CFEINSTALL --disable-threads --disable-nls --disable-shared \
--enable-languages=c,c++
% gmake
% setenv LLVM_LIB_SEARCH_PATH `pwd`/gcc
% gmake all; gmake install
</pre>
<p><b>Cygwin/x86:</b></p>
<pre>
% cd build
% ../src/configure --prefix=$CFEINSTALL --disable-threads --disable-nls --disable-shared \
--enable-languages=c,c++ --disable-c-mbchar
% gmake
% setenv LLVM_LIB_SEARCH_PATH `pwd`/gcc
% gmake all; gmake install
</pre>
<p><b>Solaris/SPARC:</b></p>
<p>
For Solaris/SPARC, LLVM only supports the SPARC V9. Therefore, the
configure command line should specify sparcv9, as shown below. Also,
note that Solaris has trouble with various wide (multibyte) character
functions from C as referenced from C++, so we typically configure with
--disable-c-mbchar (cf. <a href="http://llvm.cs.uiuc.edu/PR206">Bug 206</a>).
</p>
<pre>
% cd build
% ../src/configure --prefix=$CFEINSTALL --disable-threads --disable-nls \
--disable-shared --enable-languages=c,c++ --host=sparcv9-sun-solaris2.8 \
--disable-c-mbchar
% gmake
% 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>.</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.</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. Rerun configure, using
the <code>--with-llvmgccdir=$CFEINSTALL</code> option to specify the path
to the newly built C front-end.</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>Rebuild your CVS tree. This shouldn't cause the whole thing to be
rebuilt, but it should build the runtime libraries. After the tree is
built, install the runtime libraries into your C front-end build tree.
These are the commands you need.</p>
<pre>
% gmake
% mkdir $CFEINSTALL/bytecode-libs
% gmake -C runtime install-bytecode
% 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></li>
</ol>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="license">License Information</a>
@@ -76,8 +243,52 @@ COPYING.LIB for more details.
</p>
<p>
More information is <a href="FAQ.html#license">available in the FAQ</a>.
The software also has the following additional copyrights:
</p>
<pre>
Copyright (c) 2003, 2004 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
LLVM Team
University of Illinois at Urbana-Champaign
http://llvm.cs.uiuc.edu
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
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
Copyright (c) 1994
Hewlett-Packard Company
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. Hewlett-Packard Company makes no
representations about the suitability of this software for any
purpose. It is provided "as is" without express or implied warranty.
Copyright (c) 1996, 1997, 1998, 1999
Silicon Graphics Computer Systems, Inc.
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. Silicon Graphics makes no
representations about the suitability of this software for any
purpose. It is provided "as is" without express or implied warranty.
</pre>
</div>
<!-- *********************************************************************** -->
@@ -89,7 +300,8 @@ More information is <a href="FAQ.html#license">available in the FAQ</a>.
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
Brian Gaeke<br>
<a href="http://llvm.cs.uiuc.edu">LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>

File diff suppressed because it is too large Load Diff

View File

@@ -19,7 +19,7 @@
<ol>
<li><a href="#scf_commenting">Commenting</a></li>
<li><a href="#scf_commentformat">Comment Formatting</a></li>
<li><a href="#scf_includes"><tt>#include</tt> Style</a></li>
<li><a href="#scf_includes">#include Style</a></li>
<li><a href="#scf_codewidth">Source Code Width</a></li>
<li><a href="#scf_spacestabs">Use Spaces Instead of Tabs</a></li>
<li><a href="#scf_indentation">Indent Code Consistently</a></li>
@@ -29,7 +29,6 @@
<li><a href="#ci_warningerrors">Treat Compiler Warnings Like
Errors</a></li>
<li><a href="#ci_portable_code">Write Portable Code</a></li>
<li><a href="#ci_class_struct">Use of class/struct Keywords</a></li>
</ol></li>
</ol></li>
<li><a href="#styleissues">Style Issues</a>
@@ -41,25 +40,20 @@
<li><a href="#hl_dontinclude">#include as Little as Possible</a></li>
<li><a href="#hl_privateheaders">Keep "internal" Headers
Private</a></li>
<li><a href="#ll_iostream"><tt>#include &lt;iostream&gt;</tt> is
<em>forbidden</em></a></li>
</ol></li>
<li><a href="#micro">The Low Level Issues</a>
<ol>
<li><a href="#ll_assert">Assert Liberally</a></li>
<li><a href="#ll_ns_std">Do not use 'using namespace std'</a></li>
<li><a href="#ll_virtual_anch">Provide a virtual method anchor for
classes in headers</a></li>
<li><a href="#ll_preincrement">Prefer Preincrement</a></li>
<li><a href="#ll_avoidendl">Avoid <tt>std::endl</tt></a></li>
<li><a href="#hl_assert">Assert Liberally</a></li>
<li><a href="#hl_preincrement">Prefer Preincrement</a></li>
<li><a href="#hl_avoidendl">Avoid std::endl</a></li>
<li><a href="#hl_exploitcpp">Exploit C++ to its Fullest</a></li>
</ol></li>
</ol></li>
<li><a href="#seealso">See Also</a></li>
</ol>
<div class="doc_author">
<p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a> and
<a href="mailto:void@nondot.org">Bill Wendling</a></p>
<p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a></p>
</div>
@@ -116,15 +110,15 @@ href="mailto:sabre@nondot.org">Chris</a>.</p>
<div class="doc_text">
<p>Comments are one critical part of readability and maintainability. Everyone
knows they should comment, so should you. Although we all should probably
knows they should comment, so should you. :) Although we all should probably
comment our code more than we do, there are a few very critical places that
documentation is very useful:</p>
<b>File Headers</b>
<p>Every source file should have a header on it that describes the basic
purpose of the file. If a file does not have a header, it should not be
checked into Subversion. Most source trees will probably have a standard
<p>Every source file should have a header on it that
describes the basic purpose of the file. If a file does not have a header, it
should not be checked into CVS. Most source trees will probably have a standard
file header format. The standard format for the LLVM source tree looks like
this:</p>
@@ -134,7 +128,7 @@ this:</p>
//
// The LLVM Compiler Infrastructure
//
// This file was developed by &lt;whoever started the file&gt; and is distributed under
// 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.
//
//===----------------------------------------------------------------------===//
@@ -146,9 +140,7 @@ this:</p>
</pre>
</div>
<p>A few things to note about this particular format: The 'developed by' line
should be the name of the person or organization who initially contributed the
file. The "<tt>-*- C++
<p>A few things to note about this particular format: The "<tt>-*- C++
-*-</tt>" string on the first line is there to tell Emacs that the source file
is a C++ file, not a C file (Emacs assumes .h files are C files by default).
Note that this tag is not necessary in .cpp files. The name of the file is also
@@ -167,11 +159,11 @@ included, as well as any notes or "gotchas" in the code to watch out for.</p>
<b>Class overviews</b>
<p>Classes are one fundamental part of a good object oriented design. As such,
<p>Classes are one fundemental part of a good object oriented design. As such,
a class definition should have a comment block that explains what the class is
used for... if it's not obvious. If it's so completely obvious your grandma
could figure it out, it's probably safe to leave it out. Naming classes
something sane goes a long ways towards avoiding writing documentation.</p>
something sane goes a long ways towards avoiding writing documentation. :)</p>
<b>Method information</b>
@@ -201,9 +193,8 @@ when it is useful to use C style (<tt>/* */</tt>) comments however:</p>
<ol>
<li>When writing a C code: Obviously if you are writing C code, use C style
comments.</li>
<li>When writing a header file that may be <tt>#include</tt>d by a C source
file.</li>
comments. :)</li>
<li>When writing a header file that may be #included by a C source file.</li>
<li>When writing a source file that is used by a tool that only accepts C
style comments.</li>
</ol>
@@ -215,7 +206,7 @@ These nest properly and are better behaved in general than C style comments.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="scf_includes"><tt>#include</tt> Style</a>
<a name="scf_includes">#include Style</a>
</div>
<div class="doc_text">
@@ -243,13 +234,13 @@ order:</p>
<p>... and each catagory should be sorted by name.</p>
<p><a name="mmheader">The "Main Module Header"</a> file applies to .cpp file
which implement an interface defined by a .h file. This <tt>#include</tt>
should always be included <b>first</b> regardless of where it lives on the file
system. By including a header file first in the .cpp files that implement the
interfaces, we ensure that the header does not have any hidden dependencies
which are not explicitly #included in the header, but should be. It is also a
form of documentation in the .cpp file to indicate where the interfaces it
implements are defined.</p>
which implement an interface defined by a .h file. This #include should always
be included <b>first</b> regardless of where it lives on the file system. By
including a header file first in the .cpp files that implement the interfaces,
we ensure that the header does not have any hidden dependencies which are not
explicitly #included in the header, but should be. It is also a form of
documentation in the .cpp file to indicate where the interfaces it implements
are defined.</p>
</div>
@@ -375,26 +366,6 @@ to support it.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="ci_class_struct">Use of <tt>class</tt> and <tt>struct</tt> Keywords</a>
</div>
<div class="doc_text">
<p>In C++, the <tt>class</tt> and <tt>struct</tt> keywords can be used almost
interchangeably. The only difference is when they are used to declare a class:
<tt>class</tt> makes all members private by default while <tt>struct</tt> makes
all members public by default.</p>
<p>Unfortunately, not all compilers follow the rules and some will generate
different symbols based on whether <tt>class</tt> or <tt>struct</tt> was used to
declare the symbol. This can lead to problems at link time.</p>
<p>So, the rule for LLVM is to always use the <tt>class</tt> keyword, unless
<b>all</b> members are public, in which case <tt>struct</tt> is allowed.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="styleissues">Style Issues</a>
@@ -440,7 +411,7 @@ translation unit.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="hl_dontinclude"><tt>#include</tt> as Little as Possible</a>
<a name="hl_dontinclude">#include as Little as Possible</a>
</div>
<div class="doc_text">
@@ -449,17 +420,16 @@ translation unit.</p>
have to, especially in header files.</p>
<p>But wait, sometimes you need to have the definition of a class to use it, or
to inherit from it. In these cases go ahead and <tt>#include</tt> that header
file. Be aware however that there are many cases where you don't need to have
the full definition of a class. If you are using a pointer or reference to a
class, you don't need the header file. If you are simply returning a class
instance from a prototyped function or method, you don't need it. In fact, for
most cases, you simply don't need the definition of a class... and not
<tt>#include</tt>'ing speeds up compilation.</p>
to inherit from it. In these cases go ahead and #include that header file. Be
aware however that there are many cases where you don't need to have the full
definition of a class. If you are using a pointer or reference to a class, you
don't need the header file. If you are simply returning a class instance from a
prototyped function or method, you don't need it. In fact, for most cases, you
simply don't need the definition of a class... and not <tt>#include</tt>'ing
speeds up compilation.</p>
<p>It is easy to try to go too overboard on this recommendation, however. You
<b>must</b> include all of the header files that you are using -- you can
include them either directly
<b>must</b> include all of the header files that you are using, either directly
or indirectly (through another header file). To make sure that you don't
accidently forget to include a header file in your module header, make sure to
include your module header <b>first</b> in the implementation file (as mentioned
@@ -478,7 +448,7 @@ about later...</p>
<p>Many modules have a complex implementation that causes them to use more than
one implementation (<tt>.cpp</tt>) file. It is often tempting to put the
internal communication interface (helper classes, extra functions, etc) in the
public module header file. Don't do this.</p>
public module header file. Don't do this. :)</p>
<p>If you really need to do something like this, put a private header file in
the same directory as the source files, and include it locally. This ensures
@@ -489,87 +459,6 @@ class itself... just make them private (or protected), and all is well.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="ll_iostream"><tt>#include &lt;iostream&gt;</tt> is forbidden</a>
</div>
<div class="doc_text">
<p>The use of <tt>#include &lt;iostream&gt;</tt> in library files is
hereby <b><em>forbidden</em></b>. The primary reason for doing this is to
support clients using LLVM libraries as part of larger systems. In particular,
we statically link LLVM into some dynamic libraries. Even if LLVM isn't used,
the static c'tors are run whenever an application start up that uses the dynamic
library. There are two problems with this:</p>
<ol>
<li>The time to run the static c'tors impacts startup time of
applications&mdash;a critical time for gui apps.</li>
<li>The static c'tors cause the app to pull many extra pages of memory off the
disk: both the code for the static c'tors in each .o file and the small
amount of data that gets touched. In addition, touched/dirty pages put
more pressure on the VM system on low-memory machines.</li>
</ol>
<table align="center">
<tbody>
<tr>
<th>Old Way</th>
<th>New Way</th>
</tr>
<tr>
<td align="left"><pre>#include &lt;iostream&gt;</pre></td>
<td align="left"><pre>#include "llvm/Support/Streams.h"</pre></td>
</tr>
<tr>
<td align="left"><pre>DEBUG(std::cerr &lt;&lt; ...);
DEBUG(dump(std::cerr));</pre></td>
<td align="left"><pre>DOUT &lt;&lt; ...;
dump(DOUT);</pre></td>
</tr>
<tr>
<td align="left"><pre>std::cerr &lt;&lt; "Hello world\n";</pre></td>
<td align="left"><pre>llvm::cerr &lt;&lt; "Hello world\n";</pre></td>
</tr>
<tr>
<td align="left"><pre>std::cout &lt;&lt; "Hello world\n";</pre></td>
<td align="left"><pre>llvm::cout &lt;&lt; "Hello world\n";</pre></td>
</tr>
<tr>
<td align="left"><pre>std::cin &gt;&gt; Var;</pre></td>
<td align="left"><pre>llvm::cin &gt;&gt; Var;</pre></td>
</tr>
<tr>
<td align="left"><pre>std::ostream</pre></td>
<td align="left"><pre>llvm::OStream</pre></td>
</tr>
<tr>
<td align="left"><pre>std::istream</pre></td>
<td align="left"><pre>llvm::IStream</pre></td>
</tr>
<tr>
<td align="left"><pre>std::stringstream</pre></td>
<td align="left"><pre>llvm::StringStream</pre></td>
</tr>
<tr>
<td align="left"><pre>void print(std::ostream &Out);
// ...
print(std::cerr);</pre></td>
<td align="left"><pre>void print(std::ostream &Out);
void print(std::ostream *Out) { if (Out) print(*Out) }
// ...
print(llvm::cerr);</pre>
<ul><i>N.B.</i> The second <tt>print</tt> method is called by the <tt>print</tt>
expression. It prevents the execution of the first <tt>print</tt> method if the
stream is <tt>cnull</tt>.</ul></td>
</tbody>
</table>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="micro">The Low Level Issues</a>
@@ -578,7 +467,7 @@ stream is <tt>cnull</tt>.</ul></td>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="ll_assert">Assert Liberally</a>
<a name="hl_assert">Assert Liberally</a>
</div>
<div class="doc_text">
@@ -624,62 +513,10 @@ assert(isa&lt;PHINode&gt;(Succ-&gt;front()) &amp;&amp; "Only works on PHId BBs!"
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="ll_ns_std">Do not use '<tt>using namespace std</tt>'</a>
</div>
<div class="doc_text">
<p>In LLVM, we prefer to explicitly prefix all identifiers from the standard
namespace with an "<tt>std::</tt>" prefix, rather than rely on
"<tt>using namespace std;</tt>".</p>
<p> In header files, adding a '<tt>using namespace XXX</tt>' directive pollutes
the namespace of any source file that includes the header. This is clearly a
bad thing.</p>
<p>In implementation files (e.g. .cpp files), the rule is more of a stylistic
rule, but is still important. Basically, using explicit namespace prefixes
makes the code <b>clearer</b>, because it is immediately obvious what facilities
are being used and where they are coming from, and <b>more portable</b>, because
namespace clashes cannot occur between LLVM code and other namespaces. The
portability rule is important because different standard library implementations
expose different symbols (potentially ones they shouldn't), and future revisions
to the C++ standard will add more symbols to the <tt>std</tt> namespace. As
such, we never use '<tt>using namespace std;</tt>' in LLVM.</p>
<p>The exception to the general rule (i.e. it's not an exception for
the <tt>std</tt> namespace) is for implementation files. For example, all of
the code in the LLVM project implements code that lives in the 'llvm' namespace.
As such, it is ok, and actually clearer, for the .cpp files to have a '<tt>using
namespace llvm</tt>' directive at their top, after the <tt>#include</tt>s. The
general form of this rule is that any .cpp file that implements code in any
namespace may use that namespace (and its parents'), but should not use any
others.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="ll_virtual_anch">Provide a virtual method anchor for classes
in headers</a>
</div>
<div class="doc_text">
<p>If a class is defined in a header file and has a v-table (either it has
virtual methods or it derives from classes with virtual methods), it must
always have at least one out-of-line virtual method in the class. Without
this, the compiler will copy the vtable and RTTI into every .o file that
#includes the header, bloating .o file sizes and increasing link times.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="ll_preincrement">Prefer Preincrement</a>
<a name="hl_preincrement">Prefer Preincrement</a>
</div>
<div class="doc_text">
@@ -699,7 +536,7 @@ get in the habit of always using preincrement, and you won't have a problem.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="ll_avoidendl">Avoid <tt>std::endl</tt></a>
<a name="hl_avoidendl">Avoid std::endl</a>
</div>
<div class="doc_text">
@@ -720,6 +557,24 @@ it's better to use a literal <tt>'\n'</tt>.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="hl_exploitcpp">Exploit C++ to its Fullest</a>
</div>
<div class="doc_text">
<p>C++ is a powerful language. With a firm grasp on its capabilities, you can
make write effective, consise, readable and maintainable code all at the same
time. By staying consistent, you reduce the amount of special cases that need
to be remembered. Reducing the total number of lines of code you write is a
good way to avoid documentation, and avoid giving bugs a place to hide.</p>
<p>For these reasons, come to know and love the contents of your local
&lt;algorithm&gt; header file. Know about &lt;functional&gt; and what it can do
for you. C++ is just a tool that wants you to master it. :)</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
@@ -747,7 +602,7 @@ Software Design</a> by John Lakos</li>
</ol>
<p>If you get some free time, and you haven't read them: do so, you might learn
something.</p>
something. :)</p>
</div>
@@ -761,7 +616,7 @@ something.</p>
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
<a href="http://llvm.cs.uiuc.edu">LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>

View File

@@ -1,24 +1,7 @@
##===- docs/CommandGuide/Makefile --------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# 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.
#
##===----------------------------------------------------------------------===##
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.
POD := $(wildcard *.pod)
HTML := $(patsubst %.pod, html/%.html, $(POD))
MAN := $(patsubst %.pod, man/man1/%.1, $(POD))
PS := $(patsubst %.pod, ps/%.ps, $(POD))
POD = $(wildcard *.pod)
HTML = $(patsubst %.pod, html/%.html, $(POD))
MAN = $(patsubst %.pod, man/man1/%.1, $(POD))
PS = $(patsubst %.pod, ps/%.ps, $(POD))
all: $(HTML) $(MAN) $(PS)
@@ -27,10 +10,10 @@ all: $(HTML) $(MAN) $(PS)
html/%.html: %.pod
pod2html --css=manpage.css --htmlroot=. \
--podpath=. --noindex --infile=$< --outfile=$@ --title=$*
--podpath=. --noindex --infile=$< --outfile=$@
man/man1/%.1: %.pod
pod2man --release=CVS --center="LLVM Command Guide" $< $@
pod2man --release=1.3 --center="LLVM Command Guide" $< $@
ps/%.ps: man/man1/%.1
groff -Tps -man $< > $@
@@ -38,64 +21,3 @@ ps/%.ps: man/man1/%.1
clean:
rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
else
LEVEL := ../..
include $(LEVEL)/Makefile.common
POD := $(wildcard $(PROJ_SRC_DIR)/*.pod)
EXTRA_DIST := $(POD) index.html
HTML = $(patsubst $(PROJ_SRC_DIR)/%.pod, $(PROJ_OBJ_DIR)/%.html, $(POD))
MAN = $(patsubst $(PROJ_SRC_DIR)/%.pod, $(PROJ_OBJ_DIR)/%.1, $(POD))
PS = $(patsubst $(PROJ_SRC_DIR)/%.pod, $(PROJ_OBJ_DIR)/%.ps, $(POD))
.SUFFIXES:
.SUFFIXES: .html .pod .1 .ps
$(HTML) : html/.dir man/.dir man/man1/.dir ps/.dir
html: $(HTML)
$(PROJ_OBJ_DIR)/%.html: %.pod
$(POD2HTML) --css=manpage.css --htmlroot=. --podpath=. \
--noindex --infile=$< --outfile=$@ --title=$*
$(PROJ_OBJ_DIR)/%.1: %.pod
$(POD2MAN) --release=$(LLVMVersion) \
--center="LLVM Command Guide" $< $@
$(PROJ_OBJ_DIR)/%.ps: $(PROJ_OBJ_DIR)/%.1
$(GROFF) -Tps -man $< > $@
clean-local::
$(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 Documentation
$(Verb) $(RM) -rf $(LLVM_DOCSDIR)
printvars::
$(Echo) "POD : " '$(POD)'
$(Echo) "HTML : " '$(HTML)'
endif

View File

@@ -0,0 +1,75 @@
=pod
=head1 NAME
analyze - LLVM program analyzer
=head1 SYNOPSIS
B<analyze> [I<options>] [I<filename>]
=head1 DESCRIPTION
The B<analyze> 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.
If filename is omitted or is I<->, B<analyze> 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.
=head1 OPTIONS
=over
=item B<-help>
Print a summary of command line options.
=item B<-q>
Quiet mode. With this option, analysis pass names are not printed.
=item B<-load> I<plugin>
Load the specified dynamic object with name I<plugin>. This file
should contain additional analysis passes that register themselves
with the B<analyze> program after being loaded.
After being loaded, additional command line options are made
available for running the passes made available by I<plugin>. Use
B<analyze -load> I<plugin> B<-help> to see the new list of available
analysis passes.
=item B<-profile-info-file> I<filename>
Specify the name of the file loaded by the -profile-loader option.
=item B<-stats>
Print statistics.
=item B<-time-passes>
Record the amount of time needed for each pass and print it to standard
error.
=back
=head1 EXIT STATUS
If B<analyze> succeeds, 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 AUTHORS
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -15,9 +15,140 @@ 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.
For example, if B<gccas> 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.
=head2 Design Philosophy
B<bugpoint> 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. B<bugpoint> 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 B<bugpoint> is generally very quick unless debugging a miscompilation where
each test of the program (which requires executing it) takes a long time.
=head2 Automatic Debugger Selection
B<bugpoint> reads each F<.bc> or F<.ll> 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), B<bugpoint> starts the crash debugger.
Otherwise, if the B<-output> option was not specified, B<bugpoint> runs the test
program with the C backend (which is assumed to generate good code) to generate
a reference output. Once B<bugpoint> has a reference output for the test
program, it tries executing it with the selected code generator. If the
selected code generator crashes, B<bugpoint> starts the L</Crash debugger> 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 L</Code generator debugger>.
Finally, if the output of the selected code generator matches the reference
output, B<bugpoint> 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
miscompilation debugger. Otherwise, there is no problem B<bugpoint> can debug.
=head2 Crash debugger
If an optimizer or code generator crashes, B<bugpoint> will try as hard as it
can to reduce the list of passes (for optimizer crashes) and the size of the
test program. First, B<bugpoint> figures out which combination of optimizer
passes triggers the bug. This is useful when debugging a problem exposed by
B<gccas>, for example, because it runs over 38 passes.
Next, B<bugpoint> 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, B<bugpoint>
deletes any individual LLVM instructions whose absence does not eliminate the
failure. At the end, B<bugpoint> should tell you what passes crash, give you a
bytecode file, and give you instructions on how to reproduce the failure with
B<opt>, B<analyze>, or B<llc>.
=head2 Code generator debugger
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 compiler (B<llc>). 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.
=head2 Miscompilation debugger
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.
=head2 Advice for using bugpoint
B<bugpoint> can be a remarkably useful tool, but it sometimes works in
non-obvious ways. Here are some hints and tips:
=over
=item *
In the code generator and miscompilation debuggers, B<bugpoint> only
works with programs that have deterministic output. Thus, if the program
outputs C<argv[0]>, the date, time, or any other "random" data, B<bugpoint> 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.
=item *
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.
=item *
B<bugpoint> is extremely useful when working on a new optimization: it helps
track down regressions quickly. To avoid having to relink B<bugpoint> every
time you change your optimization, make B<bugpoint> dynamically load
your optimization by using the B<-load> option.
=item *
B<bugpoint> 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:
bugpoint ... |& tee bugpoint.log
to get a copy of B<bugpoint>'s output in the file F<bugpoint.log>, as well as on
your terminal.
=item *
B<bugpoint> cannot debug problems with the LLVM linker. If B<bugpoint> crashes
before you see its C<All input ok> message, you might try running C<llvm-link
-v> on the same set of input files. If that also crashes, you may be
experiencing a linker bug.
=item *
If your program is supposed to crash, B<bugpoint> will be confused. One way to
deal with this is to cause B<bugpoint> to ignore the exit code from your
program, by giving it the B<-check-exit-code=false> option.
=back
=head1 OPTIONS
@@ -64,17 +195,6 @@ program. By default, B<bugpoint> uses these passes internally when attempting to
reduce test programs. If you're trying to find a bug in one of these passes,
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.
@@ -93,11 +213,6 @@ 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
@@ -125,10 +240,10 @@ if an error occurs, it will exit with a non-zero value.
=head1 SEE ALSO
L<opt|opt>
L<opt|opt>, L<analyze|analyze>
=head1 AUTHOR
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -0,0 +1,72 @@
=pod
=head1 NAME
extract - extract a function from an LLVM module
=head1 SYNOPSIS
B<extract> [I<options>] B<--func> I<function-name> [I<filename>]
=head1 DESCRIPTION
The B<extract> 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.
In addition to extracting the bytecode of the specified function,
B<extract> will also remove unreachable global variables, prototypes, and
unused types.
The B<extract> command reads its input from standard input if filename is
omitted or if filename is -. The output is always written to standard output,
unless the B<-o> option is specified (see below).
=head1 OPTIONS
=over
=item B<-f>
Force overwrite. Normally, B<extract> will refuse to overwrite an
output file that already exists. With this option, B<extract>
will overwrite the output file and replace it with new bytecode.
=item B<--func> I<function-name>
Extract the function named I<function-name> from the LLVM bytecode.
=item B<--help>
Print a summary of command line options.
=item B<-o> I<filename>
Specify the output filename. If filename is "-" (the default), then
B<extract> sends its output to standard output.
=item B<--stats>
Print statistics.
=item B<--time-passes>
Record the amount of time needed for each pass and print it to standard
error.
=back
=head1 EXIT STATUS
If B<extract> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value.
=head1 SEE ALSO
L<bugpoint|bugpoint>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -0,0 +1,76 @@
=pod
=head1 NAME
gccas - optimizing LLVM assembler
=head1 SYNOPSIS
B<gccas> [I<options>] I<filename>
=head1 DESCRIPTION
The B<gccas> utility takes an LLVM assembly file generated by the
L<llvmgcc|llvmgcc> or L<llvmg++|llvmgxx> front-ends 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.
B<gccas> performs a number of optimizations on the input program,
including but not limited to: promotion of stack values to SSA
registers; elimination of dead globals, function arguments, code,
and types; tail-call elimination; loop-invariant code motion; global
common-subexpression elimination; and sparse conditional constant
propagation.
=head1 OPTIONS
=over
=item B<--help>
Print a summary of command line options.
=item B<-o> F<filename>
Specify the name of the output file which will hold the assembled bytecode.
=item B<--disable-inlining>
Disable the inlining pass. By default, it is enabled.
=item B<--disable-opt>
Disable all assembler-time optimization passes.
=item B<--stats>
Print statistics.
=item B<--time-passes>
Record the amount of time needed for each pass and print it to standard
error.
=item B<--verify>
Verify each pass result.
=back
=head1 EXIT STATUS
If B<gccas> succeeds, it will exit with an exit status of 0.
Otherwise, if an error occurs, it will exit with a non-zero exit
status.
=head1 SEE ALSO
L<llvm-as|llvm-as>, L<gccld|gccld>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -0,0 +1,175 @@
=pod
=head1 NAME
gccld - optimizing LLVM linker
=head1 SYNOPSIS
B<gccld> [I<options>] I<filename ...>
=head1 DESCRIPTION
The B<gccld> 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, B<gccld> is able to produce native code executables.
The B<gccld> utility is primarily used by the L<llvmgcc> and
L<llvmg++|llvmgxx> 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.
The B<gccld> tool performs a small set of interprocedural, post-link
optimizations on the program.
=head2 Search Order
When looking for objects specified on the command line, B<gccld> will search for
the object first in the current directory and then in the directory specified by
the B<LLVM_LIB_SEARCH_PATH> environment variable. If it cannot find the object,
it fails.
When looking for a library specified with the B<-l> option, B<gccld> first
attempts to load a file with that name from the current directory. If that
fails, it looks for libI<library>.bc, libI<library>.a, or libI<library>.I<shared
library extension>, in that order, in each directory added to the library search
path with the B<-L> option. These directories are searched in the order they
were specified. If the library cannot be located, then B<gccld> looks in the
directory specified by the B<LLVM_LIB_SEARCH_PATH> environment variable. If it
does not find a library there, it fails.
The shared library extension may be I<.so>, I<.dyld>, I<.dll>, or something
different, depending upon the system.
The B<-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.
=head2 Link order
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.
=head2 Library Linkage
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.
=head2 Native code generation
The B<gccld> program has limited support for native code generation, when
using the B<-native> or B<-native-cbe> options.
=head1 OPTIONS
=over
=item B<-help>
Print a summary of command line options.
=item B<-o> I<filename>
Specify the output filename which will hold the linked bytecode.
=item B<-stats>
Print statistics.
=item B<-time-passes>
Record the amount of time needed for each pass and print it to standard
error.
=item B<-verify>
Verify each pass result.
=item B<-disable-opt>
Disable all link-time optimization passes.
=item B<-disable-inlining>
Do not run the inliner pass.
=item B<-L>I<directory>
Add directory to the list of directories to search when looking for
libraries.
=item B<-disable-internalize>
Do not mark all symbols as internal.
=item B<-internalize-public-api-file> I<filename>
Preserve the list of symbol names in the file filename.
=item B<-internalize-public-api-list &lt;list&gt;>
Preserve the symbol names in list.
=item B<-l>I<library>
Specify libraries to include when linking the output file. When linking,
B<gccld> will first attempt to load a file with the pathname B<library>. If
that fails, it will then attempt to load libI<library>.bc, libI<library>.a, and
libI<library>.I<shared library extension>, in that order.
=item B<-link-as-library>
Link the .bc files together as a library, not an executable.
=item B<-native>
Generate a native machine code executable.
When generating native executables, B<gccld> first checks for a bytecode
version of the library and links it in, if necessary. If the library is
missing, B<gccld> skips it. Then, B<gccld> links in the same
libraries as native code.
In this way, B<gccld> 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.
=item B<-native-cbe>
Generate a native machine code executable with the LLVM C backend.
This option is identical to the B<-native> option, but uses the
C backend to generate code for the program instead of an LLVM native
code generator.
=item B<-s>
Strip symbol information from the generated executable.
=item B<-v>
Print information about actions taken.
=back
=head1 EXIT STATUS
If B<gccld> succeeds, it will exit with an exit status of 0.
Otherwise, if an error occurs, it will exit with a non-zero exit
status.
=head1 SEE ALSO
L<llvm-link|llvm-link>, L<gccas|gccas>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -0,0 +1 @@
*html

View File

@@ -3,7 +3,7 @@
<html>
<head>
<title>LLVM Command Guide</title>
<link rel="stylesheet" href="/docs/llvm.css" type="text/css">
<link rel="stylesheet" href="../llvm.css" type="text/css">
</head>
<body>
@@ -32,51 +32,34 @@ options) arguments to the tool you are interested in.</p>
<ul>
<li><a href="/cmds/llvm-as.html"><b>llvm-as</b></a> -
<li><a href="html/llvm-as.html"><b>llvm-as</b></a> -
assemble a human-readable .ll file into bytecode</li>
<li><a href="/cmds/llvm-dis.html"><b>llvm-dis</b></a> -
<li><a href="html/llvm-dis.html"><b>llvm-dis</b></a> -
disassemble a bytecode file into a human-readable .ll file</li>
<li><a href="/cmds/llvm-upgrade.html"><b>llvm-upgrade</b></a> -
upgrade LLVM assembly from previous version</li>
<li><a href="/cmds/opt.html"><b>opt</b></a> -
<li><a href="html/opt.html"><b>opt</b></a> -
run a series of LLVM-to-LLVM optimizations on a bytecode file</li>
<li><a href="/cmds/llc.html"><b>llc</b></a> -
<li><a href="html/llc.html"><b>llc</b></a> -
generate native machine code for a bytecode file</li>
<li><a href="/cmds/lli.html"><b>lli</b></a> -
<li><a href="html/lli.html"><b>lli</b></a> -
directly run a program compiled to bytecode using a JIT compiler or
interpreter</li>
<li><a href="/cmds/llvm-link.html"><b>llvm-link</b></a> -
<li><a href="html/llvm-link.html"><b>llvm-link</b></A>
link several bytecode files into one</li>
<li><a href="/cmds/llvm-ar.html"><b>llvm-ar</b></a> -
archive bytecode files</li>
<li><a href="html/analyze.html"><b>analyze</b></a> -
run LLVM analyses on a bytecode file and print the results</li>
<li><a href="/cmds/llvm-ranlib.html"><b>llvm-ranlib</b></a> -
create an index for archives made with llvm-ar</li>
<li><a href="/cmds/llvm-nm.html"><b>llvm-nm</b></a> -
<li><a href="html/llvm-nm.html"><b>llvm-nm</b></a>
print out the names and types of symbols in a bytecode file</li>
<li><a href="/cmds/llvm-prof.html"><b>llvm-prof</b></a> -
<li><a href="html/llvm-prof.html"><b>llvm-prof</b></a> -
format raw `<tt>llvmprof.out</tt>' data into a human-readable report</li>
<li><a href="/cmds/llvmc.html"><b>llvmc</b></a> -
generic and configurable compiler driver</li>
<li><a href="/cmds/llvm-ld.html"><b>llvm-ld</b></a> -
general purpose linker with loadable runtime optimization support</li>
<li><a href="/cmds/llvm-config.html"><b>llvm-config</b></a> -
print out LLVM compilation options, libraries, etc. as configured.</li>
<li><a href="/cmds/llvm2cpp.html"><b>llvm2cpp</b></a> - convert LLVM assembly
into the corresponding LLVM C++ API calls to produce it</li>
</ul>
</div>
@@ -90,13 +73,19 @@ options) arguments to the tool you are interested in.</p>
<div class="doc_text">
<ul>
<li><a href="/cmds/llvmgcc.html"><b>llvmgcc</b></a> -
<li><a href="html/llvmgcc.html"><b>llvmgcc</b></a> -
GCC-based C front-end for LLVM
<li><a href="/cmds/llvmgxx.html"><b>llvmg++</b></a> -
<li><a href="html/llvmgxx.html"><b>llvmg++</b></a> -
GCC-based C++ front-end for LLVM</li>
<li><a href="/cmds/stkrc.html"><b>stkrc</b></a> -
<li><a href="html/gccas.html"><b>gccas</b></a> -
compile-time optimizer used by llvm-g++ and llvm-gcc</li>
<li><a href="html/gccld.html"><b>gccld</b></a> -
linker and link-time optimizer used by llvm-g++ and llvm-gcc</li>
<li><a href="html/stkrc.html"><b>stkrc</b></a> -
front-end compiler for the <a href="../Stacker.html">Stacker</a>
language</li>
@@ -115,32 +104,18 @@ options) arguments to the tool you are interested in.</p>
<ul>
<li><a href="/cmds/bugpoint.html"><b>bugpoint</b></a> -
<li><a href="html/bugpoint.html"><b>bugpoint</b></a> -
automatic test-case reducer</li>
<li><a href="/cmds/llvm-extract.html"><b>llvm-extract</b></a> -
<li><a href="html/extract.html"><b>extract</b></a> -
extract a function from an LLVM bytecode file</li>
<li><a href="/cmds/llvm-bcanalyzer.html"><b>llvm-bcanalyzer</b></a> -
<li><a href="html/llvm-bcanalyzer.html"><b>llvm-bcanalyzer</b></a> -
bytecode analyzer (analyzes the binary encoding itself, not the program it
represents)</li>
</ul>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="internal">Internal Tools</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<ul>
<li><a href="/cmds/tblgen.html"><b>tblgen</b></a> -
target description reader and generator</li>
</ul>
</div>
<!-- *********************************************************************** -->
@@ -152,7 +127,7 @@ options) arguments to the tool you are interested in.</p>
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
<a href="http://llvm.cs.uiuc.edu">LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>

View File

@@ -10,18 +10,43 @@ B<llc> [I<options>] [I<filename>]
=head1 DESCRIPTION
The B<llc> command compiles LLVM bitcode into assembly language for a
The B<llc> command compiles LLVM bytecode into assembly language for a
specified architecture. The assembly language output can then be passed through
a native assembler and linker to generate a native executable.
a native assembler and linker to generate native code.
The choice of architecture for the output assembly code is automatically
determined from the input bitcode file, unless the B<-march> option is used to
override the default.
The choice of architecture for the output assembly code is determined as
follows, by attempting to satisfy each of the following rules in turn (first
one wins):
=over
=item *
If the user has specified an architecture with the -m option, use that
architecture.
=item *
Examine the input LLVM bytecode file: if it is little endian and has a
pointer size of 32 bits, select the Intel IA-32 architecture. If it is big
endian and has a pointer size of 64 bits, select the SparcV9 architecture.
=item *
If B<llc> was compiled on an architecture for which it can generate code, select
the architecture upon which B<llc> was compiled.
=item *
Exit with an error message telling the user to specify the output
architecture explicitly.
=back
=head1 OPTIONS
If I<filename> is - or omitted, B<llc> reads LLVM bitcode from standard input.
Otherwise, it will read LLVM bitcode from I<filename>.
If I<filename> is - or omitted, B<llc> reads LLVM bytecode from standard input.
Otherwise, it will read LLVM bytecode from I<filename>.
If the B<-o> option is omitted, then B<llc> will send its output to standard
output if the input is from standard input. If the B<-o> option specifies -,
@@ -33,91 +58,69 @@ removing any existing F<.bc> extension, and adding a F<.s> suffix.
Other B<llc> options are as follows:
=head2 End-user Options
=over
=item B<--help>
Print a summary of command line options.
=item B<-f>
Overwrite output files. By default, B<llc> will refuse to overwrite
an output file which already exists.
=item B<-mtriple>=I<target triple>
Override the target triple specified in the input bitcode file with the
specified string.
=item B<-march>=I<arch>
Specify the architecture for which to generate assembly, overriding the target
encoded in the bitcode file. See the output of B<llc --help> for a list of
valid architectures. By default this is inferred from the target triple or
autodetected to the current architecture.
Specify the architecture for which to generate assembly. Valid
architectures are:
=item B<-mcpu>=I<cpuname>
=over
Specify a specific chip in the current architecture to generate code for.
By default this is inferred from the target triple and autodetected to
the current architecture. For a list of available CPUs, use:
B<llvm-as E<lt> /dev/null | llc -march=xyz -mcpu=help>
=item I<x86>
=item B<-mattr>=I<a1,+a2,-a3,...>
Intel IA-32 (Pentium and above)
Override or control specific attributes of the target, such as whether SIMD
operations are enabled or not. The default set of attributes is set by the
current CPU. For a list of available attributes, use:
B<llvm-as E<lt> /dev/null | llc -march=xyz -mattr=help>
=item I<sparcv9>
64-bit SPARC V9
=item I<c>
Emit C code, not assembly
=back
=item B<-enable-correct-eh-support>
Instruct the B<-lowerinvoke> pass to insert code for correct exception handling
support. This is expensive and is by default omitted for efficiency.
=item B<-help>
Print a summary of command line options.
=item B<-stats>
Print statistics recorded by code-generation passes.
=item B<-time-passes>
Record the amount of time needed for each pass and print a report to standard
error.
=back
=head2 Intel IA-32-specific Options
=over
=item B<--disable-fp-elim>
Disable frame pointer elimination optimization.
=item B<--disable-excess-fp-precision>
=item B<--disable-pattern-isel>
Disable optimizations that may produce excess precision for floating point.
Note that this option can dramatically slow down code on some systems
(e.g. X86).
=item B<--enable-unsafe-fp-math>
Enable optimizations that make unsafe assumptions about IEEE math (e.g. that
addition is associative) or may not work for all input ranges. These
optimizations allow the code generator to make use of some instructions which
would otherwise not be usable (such as fsin on X86).
=item B<--enable-correct-eh-support>
Instruct the B<lowerinvoke> pass to insert code for correct exception handling
support. This is expensive and is by default omitted for efficiency.
=item B<--stats>
Print statistics recorded by code-generation passes.
=item B<--time-passes>
Record the amount of time needed for each pass and print a report to standard
error.
=item B<--load>=F<dso_path>
Dynamically load F<dso_path> (a path to a dynamically shared object) that
implements an LLVM target. This will permit the target name to be used with the
B<-march> option so that code can be generated for that target.
=back
=head2 Tuning/Configuration Options
=over
Use the 'simple' X86 instruction selector (the default).
=item B<--print-machineinstrs>
Print generated machine code between compilation phases (useful for debugging).
Print generated machine code.
=item B<--regalloc>=I<allocator>
@@ -164,14 +167,26 @@ Local spiller
=back
=head2 Intel IA-32-specific Options
=head2 SPARCV9-specific Options
=over
=item B<--x86-asm-syntax=att|intel>
=item B<--disable-peephole>
Specify whether to emit assembly code in AT&T syntax (the default) or intel
syntax.
Disable peephole optimization pass.
=item B<--disable-sched>
Disable local scheduling pass.
=item B<--disable-strip>
The Sparc backend embeds the LLVM bytecode into the assembly output. This
option requests that symbol names be retained; by default, they are stripped out.
=item B<--enable-maps>
Emit LLVM-to-machine code mapping information into the assembly output.
=back
@@ -186,6 +201,6 @@ L<lli|lli>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -2,7 +2,7 @@
=head1 NAME
lli - directly execute programs from LLVM bitcode
lli - directly execute programs from LLVM bytecode
=head1 SYNOPSIS
@@ -10,40 +10,26 @@ B<lli> [I<options>] [I<filename>] [I<program args>]
=head1 DESCRIPTION
B<lli> directly executes programs in LLVM bitcode format. It takes a program
in LLVM bitcode format and executes it using a just-in-time compiler, if one is
B<lli> directly executes programs in LLVM bytecode format. It takes a program
in LLVM bytecode format and executes it using a just-in-time compiler, if one is
available for the current architecture, or an interpreter. B<lli> takes all of
the same code generator options as L<llc|llc>, but they are only effective when
B<lli> is using the just-in-time compiler.
If I<filename> is not specified, then B<lli> reads the LLVM bitcode for the
If I<filename> is not specified, then B<lli> reads the LLVM bytecode for the
program from standard input.
The optional I<args> specified on the command line are passed to the program as
arguments.
=head1 GENERAL OPTIONS
=head1 OPTIONS
=over
=item B<-fake-argv0>=I<executable>
Override the C<argv[0]> value passed into the executing program.
=item B<-force-interpreter>=I<{false,true}>
If set to true, use the interpreter even if a just-in-time compiler is available
for this architecture. Defaults to false.
=item B<-help>
Print a summary of command line options.
=item B<-load>=I<puginfilename>
Causes B<lli> to load the plugin (shared object) named I<pluginfilename> and use
it for optimization.
=item B<-stats>
Print statistics from the code-generation passes. This is only meaningful for
@@ -54,149 +40,23 @@ the just-in-time compiler, at present.
Record the amount of time needed for each code-generation pass and print it to
standard error.
=item B<-version>
Print out the version of B<lli> and exit without doing anything else.
=back
=head1 TARGET OPTIONS
=over
=item B<-mtriple>=I<target triple>
Override the target triple specified in the input bitcode file with the
specified string. This may result in a crash if you pick an
architecture which is not compatible with the current system.
=item B<-march>=I<arch>
Specify the architecture for which to generate assembly, overriding the target
encoded in the bitcode file. See the output of B<llc --help> for a list of
valid architectures. By default this is inferred from the target triple or
autodetected to the current architecture.
Use the specified non-default architecture arch when selecting a code generator
for the just-in-time compiler. This may result in a crash if you pick an
architecture which is not compatible with the hardware you are running B<lli> on.
=item B<-mcpu>=I<cpuname>
=item B<-force-interpreter>=I<{false,true}>
Specify a specific chip in the current architecture to generate code for.
By default this is inferred from the target triple and autodetected to
the current architecture. For a list of available CPUs, use:
B<llvm-as E<lt> /dev/null | llc -march=xyz -mcpu=help>
If set to true, use the interpreter even if a just-in-time compiler is available
for this architecture. Defaults to false.
=item B<-mattr>=I<a1,+a2,-a3,...>
=item B<-f>=I<name>
Override or control specific attributes of the target, such as whether SIMD
operations are enabled or not. The default set of attributes is set by the
current CPU. For a list of available attributes, use:
B<llvm-as E<lt> /dev/null | llc -march=xyz -mattr=help>
=back
=head1 FLOATING POINT OPTIONS
=over
=item B<-disable-excess-fp-precision>
Disable optimizations that may increase floating point precision.
=item B<-enable-finite-only-fp-math>
Enable optimizations that assumes only finite floating point math. That is,
there is no NAN or Inf values.
=item B<-enable-unsafe-fp-math>
Causes B<lli> to enable optimizations that may decrease floating point
precision.
=item B<-soft-float>
Causes B<lli> to generate software floating point library calls instead of
equivalent hardware instructions.
=back
=head1 CODE GENERATION OPTIONS
=over
=item B<-code-model>=I<model>
Choose the code model from:
default: Target default code model
small: Small code model
kernel: Kernel code model
medium: Medium code model
large: Large code model
=item B<-disable-post-RA-scheduler>
Disable scheduling after register allocation.
=item B<-disable-spill-fusing>
Disable fusing of spill code into instructions.
=item B<-enable-correct-eh-support>
Make the -lowerinvoke pass insert expensive, but correct, EH code.
=item B<-enable-eh>
Exception handling should be emitted.
=item B<-join-liveintervals>
Coalesce copies (default=true).
=item B<-nozero-initialized-in-bss>
Don't place zero-initialized symbols into the BSS section.
=item B<-pre-RA-sched>=I<scheduler>
Instruction schedulers available (before register allocation):
=default: Best scheduler for the target
=none: No scheduling: breadth first sequencing
=simple: Simple two pass scheduling: minimize critical path and maximize processor utilization
=simple-noitin: Simple two pass scheduling: Same as simple except using generic latency
=list-burr: Bottom-up register reduction list scheduling
=list-tdrr: Top-down register reduction list scheduling
=list-td: Top-down list scheduler -print-machineinstrs - Print generated machine code
=item B<-regalloc>=I<allocator>
Register allocator to use: (default = linearscan)
=bigblock: Big-block register allocator
=linearscan: linear scan register allocator =local - local register allocator
=simple: simple register allocator
=item B<-relocation-model>=I<model>
Choose relocation model from:
=default: Target default relocation model
=static: Non-relocatable code =pic - Fully relocatable, position independent code
=dynamic-no-pic: Relocatable external references, non-relocatable code
=item B<-spiller>
Spiller to use: (default: local)
=simple: simple spiller
=local: local spiller
=item B<-x86-asm-syntax>=I<syntax>
Choose style of code to emit from X86 backend:
=att: Emit AT&T-style assembly
=intel: Emit Intel-style assembly
Call the function named I<name> to start the program. Note: The
function is assumed to have the C signature C<int> I<name> C<(int,
char **, char **)>. If you try to use this option to call a function of
incompatible type, undefined behavior may result. Defaults to C<main>.
=back
@@ -211,6 +71,6 @@ L<llc|llc>
=head1 AUTHOR
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -1,406 +0,0 @@
=pod
=head1 NAME
llvm-ar - LLVM archiver
=head1 SYNOPSIS
B<llvm-ar> [-]{dmpqrtx}[Rabfikouz] [relpos] [count] <archive> [files...]
=head1 DESCRIPTION
The B<llvm-ar> command is similar to the common Unix utility, C<ar>. It
archives several files together into a single file. The intent for this is
to produce archive libraries by LLVM bitcode that can be linked into an
LLVM program. However, the archive can contain any kind of file. By default,
B<llvm-ar> generates a symbol table that makes linking faster because
only the symbol table needs to be consulted, not each individual file member
of the archive.
The B<llvm-ar> command can be used to I<read> both SVR4 and BSD style archive
files. However, it cannot be used to write them. While the B<llvm-ar> command
produces files that are I<almost> identical to the format used by other C<ar>
implementations, it has two significant departures in order to make the
archive appropriate for LLVM. The first departure is that B<llvm-ar> only
uses BSD4.4 style long path names (stored immediately after the header) and
never contains a string table for long names. The second departure is that the
symbol table is formated for efficient construction of an in-memory data
structure that permits rapid (red-black tree) lookups. Consequently, archives
produced with B<llvm-ar> usually won't be readable or editable with any
C<ar> implementation or useful for linking. Using the C<f> modifier to flatten
file names will make the archive readable by other C<ar> implementations
but not for linking because the symbol table format for LLVM is unique. If an
SVR4 or BSD style archive is used with the C<r> (replace) or C<q> (quick
update) operations, the archive will be reconstructed in LLVM format. This
means that the string table will be dropped (in deference to BSD 4.4 long names)
and an LLVM symbol table will be added (by default). The system symbol table
will be retained.
Here's where B<llvm-ar> departs from previous C<ar> implementations:
=over
=item I<Symbol Table>
Since B<llvm-ar> is intended to archive bitcode files, the symbol table
won't make much sense to anything but LLVM. Consequently, the symbol table's
format has been simplified. It consists simply of a sequence of pairs
of a file member index number as an LSB 4byte integer and a null-terminated
string.
=item I<Long Paths>
Some C<ar> implementations (SVR4) use a separate file member to record long
path names (> 15 characters). B<llvm-ar> takes the BSD 4.4 and Mac OS X
approach which is to simply store the full path name immediately preceding
the data for the file. The path name is null terminated and may contain the
slash (/) character.
=item I<Compression>
B<llvm-ar> can compress the members of an archive to save space. The
compression used depends on what's available on the platform and what choices
the LLVM Compressor utility makes. It generally favors bzip2 but will select
between "no compression" or bzip2 depending on what makes sense for the
file's content.
=item I<Directory Recursion>
Most C<ar> implementations do not recurse through directories but simply
ignore directories if they are presented to the program in the F<files>
option. B<llvm-ar>, however, can recurse through directory structures and
add all the files under a directory, if requested.
=item I<TOC Verbose Output>
When B<llvm-ar> prints out the verbose table of contents (C<tv> option), it
precedes the usual output with a character indicating the basic kind of
content in the file. A blank means the file is a regular file. A 'Z' means
the file is compressed. A 'B' means the file is an LLVM bitcode file. An
'S' means the file is the symbol table.
=back
=head1 OPTIONS
The options to B<llvm-ar> are compatible with other C<ar> implementations.
However, there are a few modifiers (F<zR>) that are not found in other
C<ar>s. The options to B<llvm-ar> specify a single basic operation to
perform on the archive, a variety of modifiers for that operation, the
name of the archive file, and an optional list of file names. These options
are used to determine how B<llvm-ar> should process the archive file.
The Operations and Modifiers are explained in the sections below. The minimal
set of options is at least one operator and the name of the archive. Typically
archive files end with a C<.a> suffix, but this is not required. Following
the F<archive-name> comes a list of F<files> that indicate the specific members
of the archive to operate on. If the F<files> option is not specified, it
generally means either "none" or "all" members, depending on the operation.
=head2 Operations
=over
=item d
Delete files from the archive. No modifiers are applicable to this operation.
The F<files> options specify which members should be removed from the
archive. It is not an error if a specified file does not appear in the archive.
If no F<files> are specified, the archive is not modified.
=item m[abi]
Move files from one location in the archive to another. The F<a>, F<b>, and
F<i> modifiers apply to this operation. The F<files> will all be moved
to the location given by the modifiers. If no modifiers are used, the files
will be moved to the end of the archive. If no F<files> are specified, the
archive is not modified.
=item p[k]
Print files to the standard output. The F<k> modifier applies to this
operation. This operation simply prints the F<files> indicated to the
standard output. If no F<files> are specified, the entire archive is printed.
Printing bitcode files is ill-advised as they might confuse your terminal
settings. The F<p> operation never modifies the archive.
=item q[Rfz]
Quickly append files to the end of the archive. The F<R>, F<f>, and F<z>
modifiers apply to this operation. This operation quickly adds the
F<files> to the archive without checking for duplicates that should be
removed first. If no F<files> are specified, the archive is not modified.
Because of the way that B<llvm-ar> constructs the archive file, its dubious
whether the F<q> operation is any faster than the F<r> operation.
=item r[Rabfuz]
Replace or insert file members. The F<R>, F<a>, F<b>, F<f>, F<u>, and F<z>
modifiers apply to this operation. This operation will replace existing
F<files> or insert them at the end of the archive if they do not exist. If no
F<files> are specified, the archive is not modified.
=item t[v]
Print the table of contents. Without any modifiers, this operation just prints
the names of the members to the standard output. With the F<v> modifier,
B<llvm-ar> also prints out the file type (B=bitcode, Z=compressed, S=symbol
table, blank=regular file), the permission mode, the owner and group, the
size, and the date. If any F<files> are specified, the listing is only for
those files. If no F<files> are specified, the table of contents for the
whole archive is printed.
=item x[oP]
Extract archive members back to files. The F<o> modifier applies to this
operation. This operation retrieves the indicated F<files> from the archive
and writes them back to the operating system's file system. If no
F<files> are specified, the entire archive is extract.
=back
=head2 Modifiers (operation specific)
The modifiers below are specific to certain operations. See the Operations
section (above) to determine which modifiers are applicable to which operations.
=over
=item [a]
When inserting or moving member files, this option specifies the destination of
the new files as being C<a>fter the F<relpos> member. If F<relpos> is not found,
the files are placed at the end of the archive.
=item [b]
When inserting or moving member files, this option specifies the destination of
the new files as being C<b>efore the F<relpos> member. If F<relpos> is not
found, the files are placed at the end of the archive. This modifier is
identical to the the F<i> modifier.
=item [f]
Normally, B<llvm-ar> stores the full path name to a file as presented to it on
the command line. With this option, truncated (15 characters max) names are
used. This ensures name compatibility with older versions of C<ar> but may also
thwart correct extraction of the files (duplicates may overwrite). If used with
the F<R> option, the directory recursion will be performed but the file names
will all be C<f>lattened to simple file names.
=item [i]
A synonym for the F<b> option.
=item [k]
Normally, B<llvm-ar> will not print the contents of bitcode files when the
F<p> operation is used. This modifier defeats the default and allows the
bitcode members to be printed.
=item [N]
This option is ignored by B<llvm-ar> but provided for compatibility.
=item [o]
When extracting files, this option will cause B<llvm-ar> to preserve the
original modification times of the files it writes.
=item [P]
use full path names when matching
=item [R]
This modifier instructions the F<r> option to recursively process directories.
Without F<R>, directories are ignored and only those F<files> that refer to
files will be added to the archive. When F<R> is used, any directories specified
with F<files> will be scanned (recursively) to find files to be added to the
archive. Any file whose name begins with a dot will not be added.
=item [u]
When replacing existing files in the archive, only replace those files that have
a time stamp than the time stamp of the member in the archive.
=item [z]
When inserting or replacing any file in the archive, compress the file first.
This
modifier is safe to use when (previously) compressed bitcode files are added to
the archive; the compressed bitcode files will not be doubly compressed.
=back
=head2 Modifiers (generic)
The modifiers below may be applied to any operation.
=over
=item [c]
For all operations, B<llvm-ar> will always create the archive if it doesn't
exist. Normally, B<llvm-ar> will print a warning message indicating that the
archive is being created. Using this modifier turns off that warning.
=item [s]
This modifier requests that an archive index (or symbol table) be added to the
archive. This is the default mode of operation. The symbol table will contain
all the externally visible functions and global variables defined by all the
bitcode files in the archive. Using this modifier is more efficient that using
L<llvm-ranlib|llvm-ranlib> which also creates the symbol table.
=item [S]
This modifier is the opposite of the F<s> modifier. It instructs B<llvm-ar> to
not build the symbol table. If both F<s> and F<S> are used, the last modifier to
occur in the options will prevail.
=item [v]
This modifier instructs B<llvm-ar> to be verbose about what it is doing. Each
editing operation taken against the archive will produce a line of output saying
what is being done.
=back
=head1 STANDARDS
The B<llvm-ar> utility is intended to provide a superset of the IEEE Std 1003.2
(POSIX.2) functionality for C<ar>. B<llvm-ar> can read both SVR4 and BSD4.4 (or
Mac OS X) archives. If the C<f> modifier is given to the C<x> or C<r> operations
then B<llvm-ar> will write SVR4 compatible archives. Without this modifier,
B<llvm-ar> will write BSD4.4 compatible archives that have long names
immediately after the header and indicated using the "#1/ddd" notation for the
name in the header.
=head1 FILE FORMAT
The file format for LLVM Archive files is similar to that of BSD 4.4 or Mac OSX
archive files. In fact, except for the symbol table, the C<ar> commands on those
operating systems should be able to read LLVM archive files. The details of the
file format follow.
Each archive begins with the archive magic number which is the eight printable
characters "!<arch>\n" where \n represents the newline character (0x0A).
Following the magic number, the file is composed of even length members that
begin with an archive header and end with a \n padding character if necessary
(to make the length even). Each file member is composed of a header (defined
below), an optional newline-terminated "long file name" and the contents of
the file.
The fields of the header are described in the items below. All fields of the
header contain only ASCII characters, are left justified and are right padded
with space characters.
=over
=item name - char[16]
This field of the header provides the name of the archive member. If the name is
longer than 15 characters or contains a slash (/) character, then this field
contains C<#1/nnn> where C<nnn> provides the length of the name and the C<#1/>
is literal. In this case, the actual name of the file is provided in the C<nnn>
bytes immediately following the header. If the name is 15 characters or less, it
is contained directly in this field and terminated with a slash (/) character.
=item date - char[12]
This field provides the date of modification of the file in the form of a
decimal encoded number that provides the number of seconds since the epoch
(since 00:00:00 Jan 1, 1970) per Posix specifications.
=item uid - char[6]
This field provides the user id of the file encoded as a decimal ASCII string.
This field might not make much sense on non-Unix systems. On Unix, it is the
same value as the st_uid field of the stat structure returned by the stat(2)
operating system call.
=item gid - char[6]
This field provides the group id of the file encoded as a decimal ASCII string.
This field might not make much sense on non-Unix systems. On Unix, it is the
same value as the st_gid field of the stat structure returned by the stat(2)
operating system call.
=item mode - char[8]
This field provides the access mode of the file encoded as an octal ASCII
string. This field might not make much sense on non-Unix systems. On Unix, it
is the same value as the st_mode field of the stat structure returned by the
stat(2) operating system call.
=item size - char[10]
This field provides the size of the file, in bytes, encoded as a decimal ASCII
string. If the size field is negative (starts with a minus sign, 0x02D), then
the archive member is stored in compressed form. The first byte of the archive
member's data indicates the compression type used. A value of 0 (0x30) indicates
that no compression was used. A value of 2 (0x32) indicates that bzip2
compression was used.
=item fmag - char[2]
This field is the archive file member magic number. Its content is always the
two characters back tick (0x60) and newline (0x0A). This provides some measure
utility in identifying archive files that have been corrupted.
=back
The LLVM symbol table has the special name "#_LLVM_SYM_TAB_#". It is presumed
that no regular archive member file will want this name. The LLVM symbol table
is simply composed of a sequence of triplets: byte offset, length of symbol,
and the symbol itself. Symbols are not null or newline terminated. Here are
the details on each of these items:
=over
=item offset - vbr encoded 32-bit integer
The offset item provides the offset into the archive file where the bitcode
member is stored that is associated with the symbol. The offset value is 0
based at the start of the first "normal" file member. To derive the actual
file offset of the member, you must add the number of bytes occupied by the file
signature (8 bytes) and the symbol tables. The value of this item is encoded
using variable bit rate encoding to reduce the size of the symbol table.
Variable bit rate encoding uses the high bit (0x80) of each byte to indicate
if there are more bytes to follow. The remaining 7 bits in each byte carry bits
from the value. The final byte does not have the high bit set.
=item length - vbr encoded 32-bit integer
The length item provides the length of the symbol that follows. Like this
I<offset> item, the length is variable bit rate encoded.
=item symbol - character array
The symbol item provides the text of the symbol that is associated with the
I<offset>. The symbol is not terminated by any character. Its length is provided
by the I<length> field. Note that is allowed (but unwise) to use non-printing
characters (even 0x00) in the symbol. This allows for multiple encodings of
symbol names.
=back
=head1 EXIT STATUS
If B<llvm-ar> succeeds, it will exit with 0. A usage error, results
in an exit code of 1. A hard (file system typically) error results in an
exit code of 2. Miscellaneous or unknown errors result in an
exit code of 3.
=head1 SEE ALSO
L<llvm-ranlib|llvm-ranlib>, ar(1)
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
=cut

View File

@@ -10,9 +10,9 @@ B<llvm-as> [I<options>] [I<filename>]
=head1 DESCRIPTION
B<llvm-as> is the LLVM assembler. It reads a file containing human-readable
LLVM assembly language, translates it to LLVM bitcode, and writes the result
into a file or to standard output.
The B<llvm-as> command invokes the LLVM assembler. It reads a file containing
human-readable LLVM assembly language, translates it to LLVM bytecode, and
writes the result into a file or to standard output.
If F<filename> is omitted or is C<->, then B<llvm-as> reads its input from
standard input.
@@ -48,7 +48,7 @@ suffix is appended.
Force overwrite. Normally, B<llvm-as> will refuse to overwrite an
output file that already exists. With this option, B<llvm-as>
will overwrite the output file and replace it with new bitcode.
will overwrite the output file and replace it with new bytecode.
=item B<--help>
@@ -59,6 +59,15 @@ Print a summary of command line options.
Specify the output file name. If F<filename> is C<->, then B<llvm-as>
sends its output to standard output.
=item B<--stats>
Print statistics.
=item B<--time-passes>
Record the amount of time needed for each pass and print it to standard
error.
=back
=head1 EXIT STATUS
@@ -72,6 +81,6 @@ L<llvm-dis|llvm-dis>, L<gccas|gccas>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -2,24 +2,25 @@
=head1 NAME
llvm-bcanalyzer - LLVM bitcode analyzer
llvm-bcanalyzer - LLVM bytecode analyzer
=head1 SYNOPSIS
B<llvm-bcanalyzer> [I<options>] [F<filename>]
B<llvm-bcanalyzer> [I<options>] [I<filename>]
=head1 DESCRIPTION
The B<llvm-bcanalyzer> command is a small utility for analyzing bitcode files.
The tool reads a bitcode file (such as generated with the B<llvm-as> tool) and
produces a statistical report on the contents of the bitcode file. The tool
can also dump a low level but human readable version of the bitcode file.
The B<llvm-bcanalyzer> command is a small utility for analyzing bytecode files.
The tool reads a bytecode file (such as generated with the B<llvm-as> tool) and
produces a statistical report on the contents of the byteocde file. The tool
will also dump a low level but human readable version of the bytecode file.
This tool is probably not of much interest or utility except for those working
directly with the bitcode file format. Most LLVM users can just ignore
directly with the bytecode file format. Most LLVM users can just ignore
this tool.
If F<filename> is omitted or is C<->, then B<llvm-bcanalyzer> reads its input
from standard input. This is useful for combining the tool into a pipeline.
Output is written to the standard output.
=head1 OPTIONS
@@ -33,14 +34,14 @@ level summary. The details for individual functions are not displayed.
=item B<-dump>
Causes B<llvm-bcanalyzer> to dump the bitcode in a human readable format. This
Causes B<llvm-bcanalyzer> to dump the bytecode in a human readable format. This
format is significantly different from LLVM assembly and provides details about
the encoding of the bitcode file.
the encoding of the bytecode file.
=item B<-verify>
Causes B<llvm-bcanalyzer> to verify the module produced by reading the
bitcode. This ensures that the statistics generated are based on a consistent
Causes B<llvm-bcanalyzer> to verify the module produced by by reading the
bytecode. This ensures that the statistics generated are based on a consistent
module.
=item B<--help>
@@ -54,262 +55,12 @@ Print a summary of command line options.
If B<llvm-bcanalyzer> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value, usually 1.
=head1 SUMMARY OUTPUT DEFINITIONS
The following items are always printed by llvm-bcanalyzer. They comprize the
summary output.
=over
=item B<Bitcode Analysis Of Module>
This just provides the name of the module for which bitcode analysis is being
generated.
=item B<Bitcode Version Number>
The bitcode version (not LLVM version) of the file read by the analyzer.
=item B<File Size>
The size, in bytes, of the entire bitcode file.
=item B<Module Bytes>
The size, in bytes, of the module block. Percentage is relative to File Size.
=item B<Function Bytes>
The size, in bytes, of all the function blocks. Percentage is relative to File
Size.
=item B<Global Types Bytes>
The size, in bytes, of the Global Types Pool. Percentage is relative to File
Size. This is the size of the definitions of all types in the bitcode file.
=item B<Constant Pool Bytes>
The size, in bytes, of the Constant Pool Blocks Percentage is relative to File
Size.
=item B<Module Globals Bytes>
Ths size, in bytes, of the Global Variable Definitions and their initializers.
Percentage is relative to File Size.
=item B<Instruction List Bytes>
The size, in bytes, of all the instruction lists in all the functions.
Percentage is relative to File Size. Note that this value is also included in
the Function Bytes.
=item B<Compaction Table Bytes>
The size, in bytes, of all the compaction tables in all the functions.
Percentage is relative to File Size. Note that this value is also included in
the Function Bytes.
=item B<Symbol Table Bytes>
The size, in bytes, of all the symbol tables in all the functions. Percentage is
relative to File Size. Note that this value is also included in the Function
Bytes.
=item B<Dependent Libraries Bytes>
The size, in bytes, of the list of dependent libraries in the module. Percentage
is relative to File Size. Note that this value is also included in the Module
Global Bytes.
=item B<Number Of Bitcode Blocks>
The total number of blocks of any kind in the bitcode file.
=item B<Number Of Functions>
The total number of function definitions in the bitcode file.
=item B<Number Of Types>
The total number of types defined in the Global Types Pool.
=item B<Number Of Constants>
The total number of constants (of any type) defined in the Constant Pool.
=item B<Number Of Basic Blocks>
The total number of basic blocks defined in all functions in the bitcode file.
=item B<Number Of Instructions>
The total number of instructions defined in all functions in the bitcode file.
=item B<Number Of Long Instructions>
The total number of long instructions defined in all functions in the bitcode
file. Long instructions are those taking greater than 4 bytes. Typically long
instructions are GetElementPtr with several indices, PHI nodes, and calls to
functions with large numbers of arguments.
=item B<Number Of Operands>
The total number of operands used in all instructions in the bitcode file.
=item B<Number Of Compaction Tables>
The total number of compaction tables in all functions in the bitcode file.
=item B<Number Of Symbol Tables>
The total number of symbol tables in all functions in the bitcode file.
=item B<Number Of Dependent Libs>
The total number of dependent libraries found in the bitcode file.
=item B<Total Instruction Size>
The total size of the instructions in all functions in the bitcode file.
=item B<Average Instruction Size>
The average number of bytes per instruction across all functions in the bitcode
file. This value is computed by dividing Total Instruction Size by Number Of
Instructions.
=item B<Maximum Type Slot Number>
The maximum value used for a type's slot number. Larger slot number values take
more bytes to encode.
=item B<Maximum Value Slot Number>
The maximum value used for a value's slot number. Larger slot number values take
more bytes to encode.
=item B<Bytes Per Value>
The average size of a Value definition (of any type). This is computed by
dividing File Size by the total number of values of any type.
=item B<Bytes Per Global>
The average size of a global definition (constants and global variables).
=item B<Bytes Per Function>
The average number of bytes per function definition. This is computed by
dividing Function Bytes by Number Of Functions.
=item B<# of VBR 32-bit Integers>
The total number of 32-bit integers encoded using the Variable Bit Rate
encoding scheme.
=item B<# of VBR 64-bit Integers>
The total number of 64-bit integers encoded using the Variable Bit Rate encoding
scheme.
=item B<# of VBR Compressed Bytes>
The total number of bytes consumed by the 32-bit and 64-bit integers that use
the Variable Bit Rate encoding scheme.
=item B<# of VBR Expanded Bytes>
The total number of bytes that would have been consumed by the 32-bit and 64-bit
integers had they not been compressed with the Variable Bit Rage encoding
scheme.
=item B<Bytes Saved With VBR>
The total number of bytes saved by using the Variable Bit Rate encoding scheme.
The percentage is relative to # of VBR Expanded Bytes.
=back
=head1 DETAILED OUTPUT DEFINITIONS
The following definitions occur only if the -nodetails option was not given.
The detailed output provides additional information on a per-function basis.
=over
=item B<Type>
The type signature of the function.
=item B<Byte Size>
The total number of bytes in the function's block.
=item B<Basic Blocks>
The number of basic blocks defined by the function.
=item B<Instructions>
The number of instructions defined by the function.
=item B<Long Instructions>
The number of instructions using the long instruction format in the function.
=item B<Operands>
The number of operands used by all instructions in the function.
=item B<Instruction Size>
The number of bytes consumed by instructions in the function.
=item B<Average Instruction Size>
The average number of bytes consumed by the instructions in the funtion. This
value is computed by dividing Instruction Size by Instructions.
=item B<Bytes Per Instruction>
The average number of bytes used by the function per instruction. This value is
computed by dividing Byte Size by Instructions. Note that this is not the same
as Average Instruction Size. It computes a number relative to the total function
size not just the size of the instruction list.
=item B<Number of VBR 32-bit Integers>
The total number of 32-bit integers found in this function (for any use).
=item B<Number of VBR 64-bit Integers>
The total number of 64-bit integers found in this function (for any use).
=item B<Number of VBR Compressed Bytes>
The total number of bytes in this function consumed by the 32-bit and 64-bit
integers that use the Variable Bit Rate encoding scheme.
=item B<Number of VBR Expanded Bytes>
The total number of bytes in this function that would have been consumed by
the 32-bit and 64-bit integers had they not been compressed with the Variable
Bit Rate encoding scheme.
=item B<Bytes Saved With VBR>
The total number of bytes saved in this function by using the Variable Bit
Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes.
=back
=head1 SEE ALSO
L<llvm-dis|llvm-dis>, L<http://llvm.org/docs/BitcodeFormat.html>
L<llvm-dis|llvm-dis>, L<http://llvm.cs.uiuc.edu/docs/BytecodeFormat.html>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -1,131 +0,0 @@
=pod
=head1 NAME
llvm-config - Print LLVM compilation options
=head1 SYNOPSIS
B<llvm-config> I<option> [I<components>...]
=head1 DESCRIPTION
B<llvm-config> makes it easier to build applications that use LLVM. It can
print the compiler flags, linker flags and object libraries needed to link
against LLVM.
=head1 EXAMPLES
To link against the JIT:
g++ `llvm-config --cxxflags` -o HowToUseJIT.o -c HowToUseJIT.cpp
g++ `llvm-config --ldflags` -o HowToUseJIT HowToUseJIT.o \
`llvm-config --libs engine bcreader scalaropts`
=head1 OPTIONS
=over
=item B<--version>
Print the version number of LLVM.
=item B<--help>
Print a summary of B<llvm-config> arguments.
=item B<--prefix>
Print the installation prefix for LLVM.
=item B<--src-root>
Print the source root from which LLVM was built.
=item B<--obj-root>
Print the object root used to build LLVM.
=item B<--bindir>
Print the installation directory for LLVM binaries.
=item B<--includedir>
Print the installation directory for LLVM headers.
=item B<--libdir>
Print the installation directory for LLVM libraries.
=item B<--cxxflags>
Print the C++ compiler flags needed to use LLVM headers.
=item B<--ldflags>
Print the flags needed to link against LLVM libraries.
=item B<--libs>
Print all the libraries needed to link against the specified LLVM
I<components>, including any dependencies.
=item B<--libnames>
Similar to B<--libs>, but prints the bare filenames of the libraries
without B<-l> or pathnames. Useful for linking against a not-yet-installed
copy of LLVM.
=item B<--libfiles>
Similar to B<--libs>, but print the full path to each library file. This is
useful when creating makefile dependencies, to ensure that a tool is relinked if
any library it uses changes.
=item B<--components>
Print all valid component names.
=item B<--targets-built>
Print the component names for all targets supported by this copy of LLVM.
=item B<--build-mode>
Print the build mode used when LLVM was built (e.g. Debug or Release)
=back
=head1 COMPONENTS
To print a list of all available components, run B<llvm-config
--components>. In most cases, components correspond directly to LLVM
libraries. Useful "virtual" components include:
=over
=item B<all>
Includes all LLVM libaries. The default if no components are specified.
=item B<backend>
Includes either a native backend or the C backend.
=item B<engine>
Includes either a native JIT or the bitcode interpreter.
=back
=head1 EXIT STATUS
If B<llvm-config> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value.
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
=cut

View File

@@ -7,10 +7,10 @@ llvm-db - LLVM debugger (alpha)
=head1 SYNOPSIS
Details coming soon. Please see
L<http://llvm.org/docs/SourceLevelDebugging.html> in the meantime.
L<http://llvm.cs.uiuc.edu/docs/SourceLevelDebugging.html> in the meantime.
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -11,7 +11,7 @@ B<llvm-dis> [I<options>] [I<filename>]
=head1 DESCRIPTION
The B<llvm-dis> command is the LLVM disassembler. It takes an LLVM
bitcode file and converts it into human-readable LLVM assembly language.
bytecode file and converts it into human-readable LLVM assembly language.
If filename is omitted or specified as C<->, B<llvm-dis> reads its
input from standard input.
@@ -42,6 +42,11 @@ Print a summary of command line options.
Specify the output file name. If F<filename> is -, then the output is sent
to standard output.
=item B<-time-passes>
Record the amount of time needed for each pass and print it to standard
error.
=back
=head1 EXIT STATUS
@@ -55,6 +60,6 @@ L<llvm-as|llvm-as>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -1,63 +0,0 @@
=pod
=head1 NAME
llvm-extract - extract a function from an LLVM module
=head1 SYNOPSIS
B<llvm-extract> [I<options>] B<--func> I<function-name> [I<filename>]
=head1 DESCRIPTION
The B<llvm-extract> command takes the name of a function and extracts it from
the specified LLVM bitcode file. It is primarily used as a debugging tool to
reduce test cases from larger programs that are triggering a bug.
In addition to extracting the bitcode of the specified function,
B<llvm-extract> will also remove unreachable global variables, prototypes, and
unused types.
The B<llvm-extract> command reads its input from standard input if filename is
omitted or if filename is -. The output is always written to standard output,
unless the B<-o> option is specified (see below).
=head1 OPTIONS
=over
=item B<-f>
Force overwrite. Normally, B<llvm-extract> will refuse to overwrite an
output file that already exists. With this option, B<llvm-extract>
will overwrite the output file and replace it with new bitcode.
=item B<--func> I<function-name>
Extract the function named I<function-name> from the LLVM bitcode.
=item B<--help>
Print a summary of command line options.
=item B<-o> I<filename>
Specify the output filename. If filename is "-" (the default), then
B<llvm-extract> sends its output to standard output.
=back
=head1 EXIT STATUS
If B<llvm-extract> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value.
=head1 SEE ALSO
L<bugpoint|bugpoint>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
=cut

View File

@@ -1,269 +0,0 @@
=pod
=head1 NAME
llvm-ld - LLVM linker
=head1 SYNOPSIS
B<llvm-ld> <options> <files>
=head1 DESCRIPTION
The B<llvm-ld> tool takes a set of LLVM bitcode files and links them
together into a single LLVM bitcode file. The output bitcode file can be
another bitcode file or an executable bitcode program. Using additional
options, B<llvm-ld> is able to produce native code executables.
The B<llvm-ld> tool is the main linker for LLVM. It is used to link together
the output of LLVM front-end compilers and run "link time" optimizations (mostly
the inter-procedural kind).
The B<llvm-ld> tools attempts to mimic the interface provided by the default
system linker so that it can act as a I<drop-in> replacement.
=head2 Search Order
When looking for objects specified on the command line, B<llvm-ld> will search
for the object first in the current directory and then in the directory
specified by the B<LLVM_LIB_SEARCH_PATH> environment variable. If it cannot
find the object, it fails.
When looking for a library specified with the B<-l> option, B<llvm-ld> first
attempts to load a file with that name from the current directory. If that
fails, it looks for libI<library>.bc, libI<library>.a, or libI<library>.I<shared
library extension>, in that order, in each directory added to the library search
path with the B<-L> option. These directories are searched in the order they
are specified. If the library cannot be located, then B<llvm-ld> looks in the
directory specified by the B<LLVM_LIB_SEARCH_PATH> environment variable. If it
does not find a library there, it fails.
The I<shared library extension> may be I<.so>, I<.dyld>, I<.dll>, or something
different, depending upon the system.
The B<-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.
=head2 Link order
All object and bitcode 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.
=head2 Library Linkage
Object files and static bitcode 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.
=head2 Native code generation
The B<llvm-ld> program has limited support for native code generation, when
using the B<-native> or B<-native-cbe> options. Native code generation is
performed by converting the linked bitcode into native assembly (.s) or C code
and running the system compiler (typically gcc) on the result.
=head1 OPTIONS
=head2 General Options
=over
=item B<-help>
Print a summary of command line options.
=item B<-v>
Specifies verbose mode. In this mode the linker will print additional
information about the actions it takes, programs it executes, etc.
=item B<-stats>
Print statistics.
=item B<-time-passes>
Record the amount of time needed for each pass and print it to standard
error.
=back
=head2 Input/Output Options
=over
=item B<-o> F<filename>
This overrides the default output file and specifies the name of the file that
should be generated by the linker. By default, B<llvm-ld> generates a file named
F<a.out> for compatibility with B<ld>. The output will be written to
F<filename>.
=item B<-l>F<name>
This option specifies the F<name> of a library to search when resolving symbols
for the program. Only the base name should be specified as F<name>, without a
F<lib> prefix or any suffix.
=item B<-L>F<Path>
This option tells B<llvm-ld> to look in F<Path> to find any library subsequently
specified with the B<-l> option. The paths will be searched in the order in
which they are specified on the command line. If the library is still not found,
a small set of system specific directories will also be searched. Note that
libraries specified with the B<-l> option that occur I<before> any B<-L> options
will not search the paths given by the B<-L> options following it.
=item B<-link-as-library>
Link the bitcode files together as a library, not an executable. In this mode,
undefined symbols will be permitted.
=item B<-r>
An alias for -link-as-library.
=item B<-march=>C<target>
Specifies the kind of machine for which code or assembly should be generated.
=item B<-native>
Generate a native machine code executable.
When generating native executables, B<llvm-ld> first checks for a bitcode
version of the library and links it in, if necessary. If the library is
missing, B<llvm-ld> skips it. Then, B<llvm-ld> links in the same
libraries as native code.
In this way, B<llvm-ld> should be able to link in optimized bitcode
subsets of common libraries and then link in any part of the library that
hasn't been converted to bitcode.
=item B<-native-cbe>
Generate a native machine code executable with the LLVM C backend.
This option is identical to the B<-native> option, but uses the
C backend to generate code for the program instead of an LLVM native
code generator.
=back
=head2 Optimization Options
=over
=item B<-O0>
An alias for the -O1 option.
=item B<-O1>
Optimize for linking speed, not execution speed. The optimizer will attempt to
reduce the size of the linked program to reduce I/O but will not otherwise
perform any link-time optimizations.
=item B<-O2>
Perform only the minimal or required set of scalar optimizations.
=item B<-03>
An alias for the -O2 option.
=item B<-04>
Perform the standard link time inter-procedural optimizations. This will
attempt to optimize the program taking the entire program into consideration.
=item B<-O5>
Perform aggressive link time optimizations. This is the same as -O4 but works
more aggressively to optimize the program.
=item B<-disable-inlining>
Do not run the inlining pass. Functions will not be inlined into other
functions.
=item B<-disable-opt>
Completely disable optimization. The various B<-On> options will be ignored and
no link time optimization passes will be run.
=item B<-disable-internalize>
Do not mark all symbols as internal.
=item B<-verify-each>
Run the verification pass after each of the passes to verify intermediate
results.
=item B<-strip-all>
Strip all debug and symbol information from the executable to make it smaller.
=item B<-strip-debug>
Strip all debug information from the executable to make it smaller.
=item B<-s>
An alias for B<-strip-all>.
=item B<-S>
An alias for B<-strip-debug>.
=item B<-export-dynamic>
An alias for B<-disable-internalize>
=item B<-load> F<module>
Load an optimization module, F<module>, which is expected to be a dynamic
library that provides the function name C<RunOptimizations>. This function will
be passed the PassManager, and the optimization level (values 0-5 based on the
B<-On> option). This function may add passes to the PassManager that should be
run. This feature allows the optimization passes of B<llvm-ld> to be extended.
=item B<-post-link-opt>F<Path>
Run post-link optimization program. After linking is completed a bitcode file
will be generated. It will be passed to the program specified by F<Path> as the
first argument. The second argument to the program will be the name of a
temporary file into which the program should place its optimized output. For
example, the "no-op optimization" would be a simple shell script:
#!/bin/bash
cp $1 $2
=back
=head1 EXIT STATUS
If B<llvm-ld> succeeds, it will exit with 0 return code. If an error occurs,
it will exit with a non-zero return code.
=head1 ENVIRONMENT
The C<LLVM_LIB_SEARCH_PATH> environment variable is used to find bitcode
libraries. Any paths specified in this variable will be searched after the C<-L>
options.
=head1 SEE ALSO
L<llvm-link|llvm-link>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
=cut

View File

@@ -10,15 +10,15 @@ B<llvm-link> [I<options>] I<filename ...>
=head1 DESCRIPTION
B<llvm-link> takes several LLVM bitcode files and links them together into a
single LLVM bitcode file. It writes the output file to standard output, unless
the B<-o> option is used to specify a filename.
The B<llvm-link> command takes several LLVM bytecode files and links them
together into a single LLVM bytecode file. It writes the output file to
standard output, unless the B<-o> option is used to specify a filename.
B<llvm-link> attempts to load the input files from the current directory. If
that fails, it looks for each file in each of the directories specified by the
B<-L> options on the command line. The library search paths are global; each
one is searched for every input file if necessary. The directories are searched
in the order they were specified on the command line.
The B<llvm-link> command attempts to load the input files from the current
directory. If that fails, it looks for each file in each of the directories
specified by the B<-L> options on the command line. The library search paths
are global; each one is searched for every input file if necessary. The
directories are searched in the order they were specified on the command line.
=head1 OPTIONS
@@ -34,7 +34,7 @@ the order in which they were specified on the command line.
=item B<-f>
Overwrite output files. By default, B<llvm-link> will not overwrite an output
file if it already exists.
file if it alreadys exists.
=item B<-o> F<filename>
@@ -44,7 +44,7 @@ write its output to standard output.
=item B<-d>
If specified, B<llvm-link> prints a human-readable version of the output
bitcode file to standard error.
bytecode file to standard error.
=item B<--help>
@@ -53,7 +53,7 @@ Print a summary of command line options.
=item B<-v>
Verbose mode. Print information about what B<llvm-link> is doing. This
typically includes a message for each bitcode file linked in and for each
typically includes a message for each bytecode file linked in and for each
library found.
=back
@@ -65,10 +65,11 @@ occurs, it will exit with a non-zero value.
=head1 SEE ALSO
L<gccld|gccld>
L<gccld>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -2,7 +2,7 @@
=head1 NAME
llvm-nm - list LLVM bitcode file's symbol table
llvm-nm - list LLVM bytecode file's symbol table
=head1 SYNOPSIS
@@ -10,11 +10,11 @@ B<llvm-nm> [I<options>] [I<filenames...>]
=head1 DESCRIPTION
The B<llvm-nm> utility lists the names of symbols from the LLVM bitcode files,
or B<ar> archives containing LLVM bitcode files, named on the command line.
The B<llvm-nm> utility lists the names of symbols from the LLVM bytecode files,
or B<ar> archives containing LLVM bytecode files, named on the command line.
Each symbol is listed along with some simple information about its provenance.
If no filename is specified, or I<-> is used as a filename, B<llvm-nm> will
process a bitcode file on its standard input stream.
process a bytecode file on its standard input stream.
B<llvm-nm>'s default output format is the traditional BSD B<nm> output format.
Each such output record consists of an (optional) 8-digit hexadecimal address,
@@ -28,15 +28,15 @@ Type code characters currently supported, and their meanings, are as follows:
=item U
Named object is referenced but undefined in this bitcode file
Named object is referenced but undefined in this bytecode file
=item C
Common (multiple definitions link together into one def)
Common (multiple defs link together into one def)
=item W
Weak reference (multiple definitions link together into zero or one definitions)
Weak reference (multiple defs link together into zero or one defs)
=item t
@@ -60,10 +60,10 @@ Something unrecognizable
=back
Because LLVM bitcode files typically contain objects that are not considered to
Because LLVM bytecode files typically contain objects that are not considered to
have addresses until they are linked into an executable image or dynamically
compiled "just-in-time", B<llvm-nm> does not print an address for any symbol,
even symbols which are defined in the bitcode file.
even symbols which are defined in the bytecode file.
=head1 OPTIONS
@@ -83,18 +83,18 @@ Print a summary of command-line options and their meanings.
=item B<--defined-only>
Print only symbols defined in this bitcode file (as opposed to
Print only symbols defined in this bytecode file (as opposed to
symbols which may be referenced by objects in this file, but not
defined in this file.)
=item B<--extern-only>, B<-g>
Print only symbols whose definitions are external; that is, accessible
from other bitcode files.
from other bytecode files.
=item B<--undefined-only>, B<-u>
Print only symbols referenced but not defined in this bitcode file.
Print only symbols referenced but not defined in this bytecode file.
=item B<--format=>I<fmt>, B<-f>
@@ -113,10 +113,10 @@ B<llvm-nm> exits with an exit code of zero.
=head1 SEE ALSO
L<llvm-dis|llvm-dis>, ar(1), nm(1)
L<llvm-dis|llvm-dis>, L<ar(1)>, L<nm(1)>
=head1 AUTHOR
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -6,12 +6,12 @@ llvm-prof - print execution profile of LLVM program
=head1 SYNOPSIS
B<llvm-prof> [I<options>] [I<bitcode file>] [I<llvmprof.out>]
B<llvm-prof> [I<options>] [I<bytecode file>] [I<llvmprof.out>]
=head1 DESCRIPTION
The B<llvm-prof> tool reads in an F<llvmprof.out> file (which can
optionally use a specific file with the third program argument), a bitcode file
optionally use a specific file with the third program argument), a bytecode file
for the program, and produces a human readable report, suitable for determining
where the program hotspots are.
@@ -47,11 +47,11 @@ error.
=head1 EXIT STATUS
B<llvm-prof> returns 1 if it cannot load the bitcode file or the profile
information. Otherwise, it exits with zero.
B<llvm-prof|llvm-prof> returns 1 if it cannot load the bytecode file or the
profile information. Otherwise, it exits with zero.
=head1 AUTHOR
B<llvm-prof> is maintained by the LLVM Team (L<http://llvm.org>).
B<llvm-prof> is maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -1,52 +0,0 @@
=pod
=head1 NAME
llvm-ranlib - Generate index for LLVM archive
=head1 SYNOPSIS
B<llvm-ranlib> [--version] [--help] <archive-file>
=head1 DESCRIPTION
The B<llvm-ranlib> command is similar to the common Unix utility, C<ranlib>. It
adds or updates the symbol table in an LLVM archive file. Note that using the
B<llvm-ar> modifier F<s> is usually more efficient than running B<llvm-ranlib>
which is only provided only for completness and compatibility. Unlike other
implementations of C<ranlib>, B<llvm-ranlib> indexes LLVM bitcode files, not
native object modules. You can list the contents of the symbol table with the
C<llvm-nm -s> command.
=head1 OPTIONS
=over
=item F<archive-file>
Specifies the archive-file to which the symbol table is added or updated.
=item F<--version>
Print the version of B<llvm-ranlib> and exit without building a symbol table.
=item F<--help>
Print usage help for B<llvm-ranlib> and exit without building a symbol table.
=back
=head1 EXIT STATUS
If B<llvm-ranlib> succeeds, it will exit with 0. If an error occurs, a non-zero
exit code will be returned.
=head1 SEE ALSO
L<llvm-ar|llvm-ar>, ranlib(1)
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
=cut

View File

@@ -1,66 +0,0 @@
=pod
=head1 NAME
llvm-upgrade - LLVM assembly upgrade tool
=head1 SYNOPSIS
B<llvm-upgrade> [I<options>] [I<filename>]
=head1 DESCRIPTION
B<llvm-upgrade> is the LLVM assembly upgrade tool. It reads a file containing
human-readable LLVM assembly language, and upgrades that assembly to the current
version of LLVM. If the input is in the form currently accepted by LLVM, then
no upgrades are performed.
The expected usage of this tool is as a filter, like this:
=over
B<llvm-1.9/bin/llvm-dis < 1.9.bc | llvm-upgrade | llvm-2.0/bin/llvm-as -o 2.0.bc>
=back
If F<filename> is omitted or is C<->, then B<llvm-upgrade> reads its input from
standard input.
If an output file is not specified with the B<-o> option, then
B<llvm-upgrade> sends its output to standard output.
=head1 OPTIONS
=over
=item B<-f>
Force overwrite. Normally, B<llvm-upgrade> will refuse to overwrite an
output file that already exists. With this option, B<llvm-upgrade>
will overwrite the output file.
=item B<--help>
Print a summary of command line options.
=item B<-o> F<filename>
Specify the output file name. If F<filename> is C<->, then B<llvm-upgrade>
sends its output to standard output.
=back
=head1 EXIT STATUS
If B<llvm-upgrade> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value.
=head1 SEE ALSO
L<llvm-as|llvm-as>, L<llvm-dis|llvm-dis>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
=cut

View File

@@ -1,217 +0,0 @@
=pod
=head1 NAME
llvm2xpp - LLVM bitcode to LLVM C++ IR translator
=head1 SYNOPSIS
B<llvm2cpp> [I<options>] [I<filename>]
=head1 DESCRIPTION
B<llvm2cpp> translates from LLVM bitcode (.bc files) to a
corresponding C++ source file that will make calls against the LLVM C++ API to
build the same module as the input. By default, the C++ output is a complete
program that builds the module, verifies it and then emits the module as
LLVM assembly. This technique assists with testing because the input to
B<llvm2cpp> and the output of the generated C++ program should be identical.
If F<filename> is omitted or is C<->, then B<llvm2cpp> reads its input from
standard input.
If an output file is not specified with the B<-o> option, then
B<llvm2cpp> sends its output to a file or standard output by following
these rules:
=over
=item *
If the input is standard input, then the output is standard output.
=item *
If the input is a file that ends with C<.bc>, then the output file is of
the same name, except that the suffix is changed to C<.cpp>.
=item *
If the input is a file that does not end with the C<.bc> suffix, then the
output file has the same name as the input file, except that the C<.cpp>
suffix is appended.
=back
=head1 OPTIONS
=over
=item B<-f>
Force overwrite. Normally, B<llvm2cpp> will refuse to overwrite an
output file that already exists. With this option, B<llvm2cpp>
will overwrite the output file and replace it with new C++ source code.
=item B<--help>
Print a summary of command line options.
=item B<-f>
Normally, B<llvm2cpp> will not overwrite an existing output file. With this
option, that default behavior is changed and the program will overwrite existing
output files.
=item B<-o> F<filename>
Specify the output file name. If F<filename> is C<->, then B<llvm2cpp>
sends its output to standard output.
=item B<-funcname> F<functionName>
Specify the name of the function to be generated. The generated code contains a
single function that produces the input module. By default its name is
I<makeLLVMModule>. The B<-funcname> option overrides this default and allows
you to control the name of the generated function. This is handy in conjunction
with the B<-fragment> option when you only want B<llvm2cpp> to generate a
single function that produces the module. With both options, such generated code
could be I<#included> into another program.
=item B<-for>
Specify the name of the thing for which C++ code should be generated. By default
the entire input module is re-generated. However, use of the various B<-gen-*>
options can restrict what is produced. This option indicates what that
restriction is.
=item B<-gen-program>
Specify that the output should be a complete program. Such program will recreate
B<llvm2cpp>'s input as an LLVM module, verify that module, and then write out
the module in LLVM assembly format. This is useful for doing identity tests
where the output of the generated program is identical to the input to
B<llvm2cpp>. The LLVM DejaGnu test suite can make use of this fact. This is the
default form of generated output.
If the B<-for> option is given with this option, it specifies the module
identifier to use for the module created.
=item B<-gen-module>
Specify that the output should be a function that regenerates the module. It is
assumed that this output will be #included into another program that has already
arranged for the correct header files to be #included. The function generated
takes no arguments and returns a I<Module*>.
If the B<-for> option is given with this option, it specifies the module
identifier to use in creating the module returned by the generated function.
=item B<-gen-contents>
Specify that the output should be a function that adds the contents of the input
module to another module. It is assumed that the output will be #included into
another program that has already arranged for the correct header files to be
#included. The function generated takes a single argument of type I<Module*> and
returns that argument. Note that Module level attributes such as endianess,
pointer size, target triple and inline asm are not passed on from the input
module to the destination module. Only the sub-elements of the module (types,
constants, functions, global variables) will be added to the input module.
If the B<-for> option is given with this option, it specifies the module
identifier to set in the input module by the generated function.
=item B<-gen-function>
Specify that the output should be a function that produces the definitions
necessary for a specific function to be added to a module. It is assumed that
the output will be #included into another program that has already arranged
for the correct header files to be #included. The function generated takes a
single argument of type I<Module*> and returns the I<Function*> that it added to
the module. Note that only those things (types, constants, etc.) directly
needed in the definition of the function will be placed in the generated
function.
The B<-for> option must be given with this option or an error will be produced.
The value of the option must be the name of a function in the input module for
which code should be generated. If the named function does not exist an error
will be produced.
=item B<-gen-inline>
This option is very analagous to B<-gen-function> except that the generated
function will not re-produce the target function's definition. Instead, the body
of the target function is inserted into some other function passed as an
argument to the generated function. Similarly any arguments to the function must
be passed to the generated function. The result of the generated function is the
first basic block of the target function.
The B<-for> option works the same way as it does for B<-gen-function>.
=item B<-gen-variable>
Specify that the output should be a function that produces the definitions
necessary for a specific global variable to be added to a module. It is assumed
that the output will be #included into another program that has already arranged
for the correct header files to be #included. The function generated takes a
single argument of type I<Module*> and returns the I<GlobalVariable*> that it
added to the module. Note that only those things (types, constants, etc.)
directly needed in the definition of the global variable will be placed in the
generated function.
The B<-for> option must be given with this option or an error will be produced.
THe value of the option must be the name of a global variable in the input
module for which code should be generated. If the named global variable does not
exist an error will be produced.
=item B<-gen-type>
Specify that the output should be a function that produces the definitions
necessary for specific type to be added to a module. It is assumed that the
otuput will be #included into another program that has already arranged for the
correct header files to be #included. The function generated take a single
argument of type I<Module*> and returns the I<Type*> that it added to the
module. Note that the generated function will only add the necessary type
definitions to (possibly recursively) define the requested type.
The B<-for> option must be given with this option or an error will be produced.
The value of the option must be the name of a global type in the input module
for which code should be generated. If the named type does not exist an error
will be produced.
=item B<-stats>
Show pass statistics (not interesting in this program).
=item B<-time-passes>
Show pass timing statistics (not interesting in this program).
=item B<-version>
Show the version number of this program.
=back
=head1 EXIT STATUS
If B<llvm2cpp> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value.
=head1 SEE ALSO
L<llvm-as|llvm-as> L<tblgen|tblgen>
=head1 NOTES
This tool may be removed from a future version of LLVM. Instead, its
functionality may be incorporated into the llc tool. It would then act similarly
to other targets except its output would be C++ source that could be compiled to
construct the input program.
=head1 AUTHORS
Written by Reid Spencer (L<http://hlvm.org>).
=cut

View File

@@ -1,431 +0,0 @@
=pod
=head1 NAME
llvmc - The LLVM Compiler Driver (experimental)
=head1 SYNOPSIS
B<llvmc> [I<options>] [I<filenames>...]
=head1 DESCRIPTION
B<llvmc> is a configurable driver for invoking other LLVM (and non-LLVM) tools
in order to compile, optimize and link software for multiple languages. For
those familiar with FSF's B<gcc> tool, it is very similar. Please note that
B<llvmc> is considered an experimental tool. B<llvmc> has the following goals:
=over
=item * provide a single point of access to the LLVM tool set,
=item * hide the complexities of the LLVM tools through a single interface,
=item * make integration of existing non-LLVM tools simple,
=item * extend the capabilities of minimal front ends, and
=item * make the interface for compiling consistent for all languages.
=back
The tool itself does nothing with a user's program. It merely invokes other
tools to get the compilation tasks done.
The options supported by B<llvmc> generalize the compilation process and
provide a consistent and simple interface for multiple programming languages.
This makes it easier for developers to get their software compiled with LLVM.
Without B<llvmc>, developers would need to understand how to invoke the
front-end compiler, optimizer, assembler, and linker in order to compile their
programs. B<llvmc>'s sole mission is to trivialize that process.
=head2 Basic Operation
B<llvmc> always takes the following basic actions:
=over
=item * Command line options and filenames are collected.
The command line options provide the marching orders to B<llvmc> on what actions
it should perform. This is the I<request> the user is making of B<llvmc> and it
is interpreted first.
=item * Configuration files are read.
Based on the options and the suffixes of the filenames presented, a set of
configuration files are read to configure the actions B<llvmc> will take.
Configuration files are provided by either LLVM or the front end compiler tools
that B<llvmc> invokes. Users generally don't need to be concerned with the
contents of the configuration files.
=item * Determine actions to take.
The tool chain needed to complete the task is determined. This is the primary
work of B<llvmc>. It breaks the request specified by the command line options
into a set of basic actions to be done:
=over
=item * Pre-processing: gathering/filtering compiler input (optional).
=item * Translation: source language to bitcode conversion.
=item * Assembly: bitcode to native code conversion.
=item * Optimization: conversion of bitcode to something that runs faster.
=item * Linking: combining multiple bitcode files to produce executable program.
=back
=item * Execute actions.
The actions determined previously are executed sequentially and then
B<llvmc> terminates.
=back
=head1 OPTIONS
=head2 Control Options
Control options tell B<llvmc> what to do at a high level. The
following control options are defined:
=over
=item B<-c> or B<--compile>
This option specifies that the linking phase is not to be run. All
previous phases, if applicable will run. This is generally how a given
bitcode file is compiled and optimized for a source language module.
=item B<-k> or B<--link> or default
This option (or the lack of any control option) specifies that all stages
of compilation, optimization, and linking should be attempted. Source files
specified on the command line will be compiled and linked with objects and
libraries also specified.
=item B<-S>
This option specifies that compilation should end in the creation of
an LLVM assembly file that can be later converted to an LLVM object
file.
=item B<-E>
This option specifies that no compilation or linking should be
performed. Only pre-processing, if applicable to the language being
compiled, is performed. For languages that support it, this will
result in the output containing the raw input to the compiler.
=back
=head2 Optimization Options
Optimization with B<llvmc> is based on goals and specified with
the following -O options. The specific details of which
optimizations run is controlled by the configuration files because
each source language will have different needs.
=over
=item B<-O1> or B<-O0> (default, fast compilation)
Only those optimizations that will hasten the compilation (mostly by reducing
the output) are applied. In general these are extremely fast and simple
optimizations that reduce emitted code size. The goal here is not to make the
resulting program fast but to make the compilation fast. If not specified,
this is the default level of optimization.
=item B<-O2> (basic optimization)
This level of optimization specifies a balance between generating good code
that will execute reasonably quickly and not spending too much time optimizing
the code to get there. For example, this level of optimization may include
things like global common sub-expression elimination, aggressive dead code
elimination, and scalar replication.
=item B<-O3> (aggressive optimization)
This level of optimization aggressively optimizes each set of files compiled
together. However, no link-time inter-procedural optimization is performed.
This level implies all the optimizations of the B<-O1> and B<-O2> optimization
levels, and should also provide loop optimizations and compile time
inter-procedural optimizations. Essentially, this level tries to do as much
as it can with the input it is given but doesn't do any link time IPO.
=item B<-O4> (link time optimization)
In addition to the previous three levels of optimization, this level of
optimization aggressively optimizes each program at link time. It employs
basic analysis and basic link-time inter-procedural optimizations,
considering the program as a whole.
=item B<-O5> (aggressive link time optimization)
This is the same as B<-O4> except it employs aggressive analyses and
aggressive inter-procedural optimization.
=item B<-O6> (profile guided optimization: not implemented)
This is the same as B<-O5> except that it employs profile-guided
re-optimization of the program after it has executed. Note that this implies
a single level of re-optimization based on run time profile analysis. Once
the re-optimization has completed, the profiling instrumentation is
removed and final optimizations are employed.
=item B<-O7> (lifelong optimization: not implemented)
This is the same as B<-O5> and similar to B<-O6> except that re-optimization
is performed through the life of the program. That is, each run will update
the profile by which future re-optimizations are directed.
=back
=head2 Input Options
=over
=item B<-l> I<LIBRARY>
This option instructs B<llvmc> to locate a library named I<LIBRARY> and search
it for unresolved symbols when linking the program.
=item B<-L> F<path>
This option instructs B<llvmc> to add F<path> to the list of places in which
the linker will
=item B<-x> I<LANGUAGE>
This option instructs B<llvmc> to regard the following input files as
containing programs in the language I<LANGUAGE>. Normally, input file languages
are identified by their suffix but this option will override that default
behavior. The B<-x> option stays in effect until the end of the options or
a new B<-x> option is encountered.
=back
=head2 Output Options
=over
=item B<-m>I<arch>
This option selects the back end code generator to use. The I<arch> portion
of the option names the back end to use.
=item B<--native>
Normally, B<llvmc> produces bitcode files at most stages of compilation.
With this option, B<llvmc> will arrange for native object files to be
generated with the B<-c> option, native assembly files to be generated
with the B<-S> option, and native executables to be generated with the
B<--link> option. In the case of the B<-E> option, the output will not
differ as there is no I<native> version of pre-processed output.
=item B<-o> F<filename>
Specify the output file name. The contents of the file depend on other
options.
=back
=head2 Information Options
=over
=item B<-n> or B<--no-op>
This option tells B<llvmc> to do everything but actually execute the
resulting tools. In combination with the B<-v> option, this causes B<llvmc>
to merely print out what it would have done.
=item B<-v> or B<--verbose>
This option will cause B<llvmc> to print out (on standard output) each of the
actions it takes to accomplish the objective. The output will immediately
precede the invocation of other tools.
=item B<--stats>
Print all statistics gathered during the compilation to the standard error.
Note that this option is merely passed through to the sub-tools to do with
as they please.
=item B<--time-passes>
Record the amount of time needed for each optimization pass and print it
to standard error. Like B<--stats> this option is just passed through to
the sub-tools to do with as they please.
=item B<--time-programs>
Record the amount of time each program (compilation tool) takes and print
it to the standard error.
=back
=head2 Language Specific Options
=over
=item B<-T,pre>=I<options>
Pass an arbitrary option to the pre-processor.
=item B<-T,opt>=I<options>
Pass an arbitrary option to the optimizer.
=item B<-T,lnk>=I<options>
Pass an arbitrary option to the linker.
=item B<-T,asm>=I<options>
Pass an arbitrary option to the code generator.
=back
=head2 C/C++ Specific Options
=over
=item B<-I>F<path>
This option is just passed through to a C or C++ front end compiler to tell it
where include files can be found.
=item B<-D>F<symbol>
This option is just passed through to a C or C++ front end compiler to tell it
to define a symbol.
=back
=head2 Miscellaneous Options
=over
=item B<--help>
Print a summary of command line options.
=item B<--version>
This option will cause B<llvmc> to print out its version number and terminate.
=back
=head2 Advanced Options
You better know what you're doing if you use these options. Improper use
of these options can produce drastically wrong results.
=over
=item B<--config-dir> F<dirname>
This option tells B<llvmc> to read configuration data from the I<directory>
named F<dirname>. Data from such directories will be read in the order
specified on the command line after all other standard configuration files have
been read. This allows users or groups of users to conveniently create
their own configuration directories in addition to the standard ones to which
they may not have write access.
=back
=head2 Unimplemented Options
The options below are not currently implemented in B<llvmc> but will be
eventually. They are documented here as "future design".
=over
=item B<--show-config> I<[suffixes...]>
When this option is given, the only action taken by B<llvmc> is to show its
final configuration state in the form of a configuration file. No compilation
tasks will be conducted when this option is given; processing will stop once
the configuration has been printed. The optional (comma separated) list of
suffixes controls what is printed. Without any suffixes, the configuration
for all languages is printed. With suffixes, only the languages pertaining
to those file suffixes will be printed. The configuration information is
printed after all command line options and configuration files have been
read and processed. This allows the user to verify that the correct
configuration data has been read by B<llvmc>.
=item B<--config> :I<section>:I<name>=I<value>
This option instructs B<llvmc> to accept I<value> as the value for configuration
item I<name> in the section named I<section>. This is a quick way to override
a configuration item on the command line without resorting to changing the
configuration files.
=item B<--config-only-from> F<dirname>
This option tells B<llvmc> to skip the normal processing of configuration
files and only configure from the contents of the F<dirname> directory. Multiple
B<--config-only-from> options may be given in which case the directories are
read in the order given on the command line.
=item B<--emit-raw-code>
No optimization is done whatsoever. The compilers invoked by B<llvmc> with
this option given will be instructed to produce raw, unoptimized code. This
option is useful only to front end language developers and therefore does not
participate in the list of B<-O> options. This is distinctly different from
the B<-O0> option (a synonym for B<-O1>) because those optimizations will
reduce code size to make compilation faster. With B<--emit-raw-code>, only
the full raw code produced by the compiler will be generated.
=back
=head1 EXIT STATUS
If B<llvmc> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value and no compilation actions
will be taken. If one of the compilation tools returns a non-zero
status, pending actions will be discarded and B<llvmc> will return the
same result code as the failing compilation tool.
=head1 DEFICIENCIES
B<llvmc> is considered an experimental LLVM tool because it has these
deficiencies:
=over
=item Insufficient support for native linking
Because B<llvm-ld> doesn't handle native linking, neither can B<llvmc>
=item Poor configuration support
The support for configuring new languages, etc. is weak. There are many
command line configurations that cannot be achieved with the current
support. Furthermore the grammar is cumbersome for configuration files.
Please see L<http://llvm.org/PR686> for further details.
=item Does not handle target specific configurations
This is one of the major deficiencies, also addressed in
L<http://llvm.org/PR686>
=back
=head1 SEE ALSO
L<llvm-as|llvm-as>, L<llvm-dis|llvm-dis>, L<llc|llc>, L<llvm-link|llvm-link>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
=cut

View File

@@ -2,23 +2,26 @@
=head1 NAME
llvm-gcc - LLVM C front-end
llvmgcc - LLVM C front-end
=head1 SYNOPSIS
B<llvm-gcc> [I<options>] I<filename>
B<llvmgcc> [I<options>] I<filename>
=head1 DESCRIPTION
The B<llvm-gcc> command is the LLVM C front end. It is a modified
version of gcc that compiles C/ObjC programs into native objects, LLVM
bitcode or LLVM assembly language, depending upon the options.
The B<llvmgcc> command is the LLVM C front end. It is a modified
version of gcc that takes C programs and compiles them into LLVM
bytecode or assembly language, depending upon the options.
By default, B<llvm-gcc> compiles to native objects just like GCC does. If the
B<-emit-llvm> option is given then it will generate LLVM bitcode files instead.
If B<-S> (assembly) is also given, then it will generate LLVM assembly.
Unless the B<-S> option is specified, B<llvmgcc> will use the
L<gccas|gccas> program to perform some optimizations and create an
LLVM bytecode file. Unless the B<-c> option is specified, B<llvmgcc>
will also use the L<gccld|gccld> program to perform further
optimizations and link the resulting bytecode file(s) with support
libraries to create an executable program.
Being derived from the GNU Compiler Collection, B<llvm-gcc> has many
Being derived from the GNU Compiler Collection, B<llvmgcc> has many
of gcc's features and accepts most of gcc's options. It handles a
number of gcc's extensions to the C programming language.
@@ -32,14 +35,14 @@ Print a summary of command line options.
=item B<-S>
Do not generate an LLVM bitcode file. Rather, compile the source
Do not generate an LLVM bytecode file. Rather, compile the source
file into an LLVM assembly language file.
=item B<-c>
Do not generate a linked executable. Rather, compile the source
file into an LLVM bitcode file. This bitcode file can then be
linked with other bitcode files later on to generate a full LLVM
file into an LLVM bytecode file. This bytecode file can then be
linked with other bytecode files later on to generate a full LLVM
executable.
=item B<-o> I<filename>
@@ -59,27 +62,26 @@ repeated.
=item B<-l>I<name>
Link in the library libI<name>.[bc | a | so]. This library should
be a bitcode library.
be a bytecode library.
=item B<-emit-llvm>
=item B<-Wl,>I<option>
Make the output be LLVM bitcode (or assembly) instead of native object (or
assembly).
Pass I<option> to the linker (usually gccld).
=back
=head1 EXIT STATUS
If B<llvm-gcc> succeeds, it will exit with 0. Otherwise, if an error
If B<llvmgcc> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value.
=head1 SEE ALSO
L<llvm-g++|llvmgxx>
L<llvmg++|llvmgxx>, L<gccas|gccas>, L<gccld|gccld>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -2,23 +2,26 @@
=head1 NAME
llvm-g++ - LLVM C++ front-end
llvmg++ - LLVM C++ front-end
=head1 SYNOPSIS
B<llvm-g++> [I<options>] I<filename>
B<llvmg++> [I<options>] I<filename>
=head1 DESCRIPTION
The B<llvm-g++> command is the LLVM C++ front end. It is a modified
version of g++ that compiles C++/ObjC++ programs into native code,
LLVM bitcode or assembly language, depending upon the options.
The B<llvmg++> command is the LLVM C++ front end. It is a modified
version of g++ that takes C++ programs and compiles them into LLVM
bytecode or assembly language, depending upon the options.
By default, B<llvm-g++> compiles to native objects just like GCC does. If the
B<-emit-llvm> option is given then it will generate LLVM bitcode files instead.
If B<-S> (assembly) is also given, then it will generate LLVM assembly.
Unless the B<-S> option is specified, B<llvmg++> will use the
L<gccas|gccas> program to perform some optimizations and create an
LLVM bytecode file. Unless the B<-c> option is specified, B<llvmg++>
will also use the L<gccld|gccld> program to perform further
optimizations and link the resulting bytecode file(s) with support
libraries to create an executable program.
Being derived from the GNU Compiler Collection, B<llvm-g++> has many
Being derived from the GNU Compiler Collection, B<llvmg++> has many
of g++'s features and accepts most of g++'s options. It handles a
number of g++'s extensions to the C++ programming language.
@@ -32,14 +35,14 @@ Print a summary of command line options.
=item B<-S>
Do not generate an LLVM bitcode file. Rather, compile the source
Do not generate an LLVM bytecode file. Rather, compile the source
file into an LLVM assembly language file.
=item B<-c>
Do not generate a linked executable. Rather, compile the source
file into an LLVM bitcode file. This bitcode file can then be
linked with other bitcode files later on to generate a full LLVM
file into an LLVM bytecode file. This bytecode file can then be
linked with other bytecode files later on to generate a full LLVM
executable.
=item B<-o> I<filename>
@@ -59,27 +62,26 @@ repeated.
=item B<-l>I<name>
Link in the library libI<name>.[bc | a | so]. This library should
be a bitcode library.
be a bytecode library.
=item B<-emit-llvm>
=item B<-Wl,>I<option>
Make the output be LLVM bitcode (or assembly) instead of native object (or
assembly).
Pass I<option> to the linker (usually gccld).
=back
=head1 EXIT STATUS
If B<llvm-g++> succeeds, it will exit with 0. Otherwise, if an error
If B<llvmg++> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value.
=head1 SEE ALSO
L<llvm-gcc|llvmgcc>
L<llvmgcc>, L<gccas>, L<gccld>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -0,0 +1 @@
*.1

View File

@@ -10,25 +10,17 @@ B<opt> [I<options>] [I<filename>]
=head1 DESCRIPTION
The B<opt> command is the modular LLVM optimizer and analyzer. It takes LLVM
bitcode as input, runs the specified optimizations or analyses on it, and then
outputs the optimized LLVM bitcode or the analysis results. The function of
B<opt> depends on whether the B<-analyze> option is given.
The B<opt> command is the modular LLVM optimizer. It takes LLVM
bytecode as input, runs the specified optimizations on it, and then
outputs the optimized LLVM bytecode.
When B<-analyze> is specified, B<opt> performs various analyses of LLVM
bitcode. 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.
The optimizations available via B<opt> depend upon what libraries
were linked into it as well as any additional libraries that have
been loaded with the B<-load> option. Use the B<-help> option to
determine what optimizations you can use.
While B<-analyze> is I<not> given, B<opt> attempts to produce an optimized
bitcode file. The optimizations available via B<opt> depend upon what
libraries were linked into it as well as any additional libraries that have
been loaded with the B<-load> option. Use the B<-help> option to determine
what optimizations you can use.
If I<filename> is omitted from the command line or is I<->, B<opt> reads its
input from standard input. The input must be an LLVM bitcode file.
If no filename is specified on the command line, B<opt> reads its
input from standard input.
If an output filename is not specified with the B<-o> option, B<opt>
writes its output to the standard output.
@@ -41,7 +33,7 @@ writes its output to the standard output.
Force overwrite. Normally, B<opt> will refuse to overwrite an
output file that already exists. With this option, B<opt> will
overwrite the output file and replace it with new bitcode.
overwrite the output file and replace it with new bytecode.
=item B<-help>
@@ -51,47 +43,6 @@ Print a summary of command line options.
Specify the output filename.
=item B<-{passname}>
B<opt> provides the ability to run any of LLVM's optimization or analysis passes
in any order. The B<-help> option lists all the passes available. The order in
which the options occur on the command line are the order in which they are
executed (within pass constraints).
=item B<-std-compile-opts>
This is short hand for a standard list of I<compile time optimization> passes.
This is typically used to optimize the output from the llvm-gcc front end. It
might be useful for other front end compilers as well. To discover the full set
of options available, use the following command:
llvm-as < /dev/null | opt -std-compile-opts -disable-output -debug-pass=Arguments
=item B<-disable-inlining>
This option is only meaningful when B<-std-compile-opts> is given. It simply
removes the inlining pass from the standard list.
=item B<-disable-opt>
This option is only meaningful when B<-std-compile-opts> is given. It disables
most, but not all, of the B<-std-compile-opts>. The ones that remain are
B<-verify>, B<-lower-setjmp>, and B<-funcresolve>.
=item B<-strip-debug>
This option causes opt to strip debug information from the module before
applying other optimizations. It is essentially the same as B<-strip> but it
ensures that stripping of debug information is done first.
=item B<-verify-each>
This option causes opt to add a verify pass after every pass otherwise specified
on the command line (including B<-verify>). This is useful for cases where it
is suspected that a pass is creating an invalid module but it is not clear which
pass is doing it. The combination of B<-std-compile-opts> and B<-verify-each>
can quickly track down this kind of problem.
=item B<-profile-info-file> I<filename>
Specify the name of the file loaded by the -profile-loader option.
@@ -113,12 +64,16 @@ Manual>, section I<#DEBUG> for more information.
=item B<-load>=I<plugin>
Load the dynamic object I<plugin>. This object should register new optimization
or analysis passes. Once loaded, the object will add new command line options to
enable various optimizations or analyses. To see the new complete list of
optimizations, use the B<-help> and B<-load> options together. For example:
Load the dynamic object I<plugin>. 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:
opt -load=plugin.so -help
=over
B<opt -load>=I<plugin> B<-help>
=back
=item B<-p>
@@ -131,8 +86,12 @@ Print module after each transformation.
If B<opt> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value.
=head1 SEE ALSO
L<analyze|analyze>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -0,0 +1 @@
*ps

View File

@@ -13,9 +13,9 @@ B<stkrc> [I<options>] [I<filename>]
The B<stkrc> command is the compiler for the Stacker language. Stacker is a
simple stack based, Forth-like language that was written as a demonstration
language for LLVM. For details on the language, please see
L<http://llvm.org/docs/Stacker.html> . The B<stkrc> compiler is fairly
minimal. It compiles to bitcode only and doesn't perform any optimizations.
The output of stkrc (a bitcode file) can be piped through other LLVM tools
L<http://llvm.cs.uiuc.edu/docs/Stacker.html> . The B<stkrc> compiler is fairly
minimal. It compiles to bytecode only and doesn't perform any optimizations.
The output of stkrc (a bytecode file) can be piped through other LLVM tools
for optimization and linking.
If F<filename> is omitted or is C<->, then B<stkrc> reads its input
@@ -65,7 +65,7 @@ error.
=item B<-f>
Force the output to be written. Normally, B<stkrc> won't overwrite an existing
bitcode file. This option overrides that behavior.
bytecode file. This option overrides that behavior.
=item B<-s> F<stacksize>
@@ -87,10 +87,10 @@ occurs, it will exit with a non-zero value, usually 1.
=head1 SEE ALSO
L<llvm-as>, L<http://llvm.org/docs/Stacker.html>
L<llvm-as>, L<http://llvm.cs.uiuc.edu/docs/Stacker.html>
=head1 AUTHORS
Maintained by the LLVM Team (L<http://llvm.org>).
Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
=cut

View File

@@ -1,115 +0,0 @@
=pod
=head1 NAME
tblgen - Target Description To C++ Code Generator
=head1 SYNOPSIS
B<tblgen> [I<options>] [I<filename>]
=head1 DESCRIPTION
B<tblgen> translates from target description (.td) files into C++ code that can
be included in the definition of an LLVM target library. Most users of LLVM will
not need to use this program. It is only for assisting with writing an LLVM
target backend.
The input and output of B<tblgen> is beyond the scope of this short
introduction. Please see the I<CodeGeneration> page in the LLVM documentation.
The F<filename> argument specifies the name of a Target Description (.td) file
to read as input.
=head1 OPTIONS
=over
=item B<--help>
Print a summary of command line options.
=item B<-o> F<filename>
Specify the output file name. If F<filename> is C<->, then B<tblgen>
sends its output to standard output.
=item B<-I> F<directory>
Specify where to find other target description files for inclusion. The
F<directory> value should be a full or partial path to a directory that contains
target description files.
=item B<-asmwriternum> F<N>
Make -gen-asm-writer emit assembly writer number F<N>.
=item B<-class> F<class Name>
Print the enumeration list for this class.
=item B<-print-records>
Print all records to standard output (default).
=item B<-print-enums>
Print enumeration values for a class
=item B<-gen-emitter>
Generate machine code emitter.
=item B<-gen-register-enums>
Generate the enumeration values for all registers.
=item B<-gen-register-desc>
Generate a register info description for each register.
=item B<-gen-register-desc-header>
Generate a register info description header for each register.
=item B<-gen-instr-enums>
Generate enumeration values for instructions.
=item B<-gen-instr-desc>
Generate instruction descriptions.
=item B<-gen-asm-writer>
Generate the assembly writer.
=item B<-gen-dag-isel>
Generate a DAG (Directed Acycle Graph) instruction selector.
=item B<-gen-subtarget>
Generate subtarget enumerations.
=item B<-gen-intrinsic>
Generate intrinsic information.
=item B<-version>
Show the version number of this program.
=back
=head1 EXIT STATUS
If B<tblgen> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value.
=head1 AUTHORS
Maintained by The LLVM Team (L<http://llvm.org>).
=cut

File diff suppressed because it is too large Load Diff

View File

@@ -1,823 +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>The LLVM Compiler Driver (llvmc)</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
<meta name="author" content="Reid Spencer">
<meta name="description"
content="A description of the use and design of the LLVM Compiler Driver.">
</head>
<body>
<div class="doc_title">The LLVM Compiler Driver (llvmc)</div>
<p class="doc_warning">NOTE: This document is a work in progress!</p>
<ol>
<li><a href="#abstract">Abstract</a></li>
<li><a href="#introduction">Introduction</a>
<ol>
<li><a href="#purpose">Purpose</a></li>
<li><a href="#operation">Operation</a></li>
<li><a href="#phases">Phases</a></li>
<li><a href="#actions">Actions</a></li>
</ol>
</li>
<li><a href="#configuration">Configuration</a>
<ol>
<li><a href="#overview">Overview</a></li>
<li><a href="#filetypes">Configuration Files</a></li>
<li><a href="#syntax">Syntax</a></li>
<li><a href="#substitutions">Substitutions</a></li>
<li><a href="#sample">Sample Config File</a></li>
</ol>
<li><a href="#glossary">Glossary</a>
</ol>
<div class="doc_author">
<p>Written by <a href="mailto:rspencer@x10sys.com">Reid Spencer</a>
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="abstract">Abstract</a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>This document describes the requirements, design, and configuration of the
LLVM compiler driver, <tt>llvmc</tt>. The compiler driver knows about LLVM's
tool set and can be configured to know about a variety of compilers for
source languages. It uses this knowledge to execute the tools necessary
to accomplish general compilation, optimization, and linking tasks. The main
purpose of <tt>llvmc</tt> is to provide a simple and consistent interface to
all compilation tasks. This reduces the burden on the end user who can just
learn to use <tt>llvmc</tt> instead of the entire LLVM tool set and all the
source language compilers compatible with LLVM.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="introduction">Introduction</a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>The <tt>llvmc</tt> <a href="#def_tool">tool</a> is a configurable compiler
<a href="#def_driver">driver</a>. As such, it isn't a compiler, optimizer,
or a linker itself but it drives (invokes) other software that perform those
tasks. If you are familiar with the GNU Compiler Collection's <tt>gcc</tt>
tool, <tt>llvmc</tt> is very similar.</p>
<p>The following introductory sections will help you understand why this tool
is necessary and what it does.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="purpose">Purpose</a></div>
<div class="doc_text">
<p><tt>llvmc</tt> was invented to make compilation of user programs with
LLVM-based tools easier. To accomplish this, <tt>llvmc</tt> strives to:</p>
<ul>
<li>Be the single point of access to most of the LLVM tool set.</li>
<li>Hide the complexities of the LLVM tools through a single interface.</li>
<li>Provide a consistent interface for compiling all languages.</li>
</ul>
<p>Additionally, <tt>llvmc</tt> makes it easier to write a compiler for use
with LLVM, because it:</p>
<ul>
<li>Makes integration of existing non-LLVM tools simple.</li>
<li>Extends the capabilities of minimal compiler tools by optimizing their
output.</li>
<li>Reduces the number of interfaces a compiler writer must know about
before a working compiler can be completed (essentially only the VMCore
interfaces need to be understood).</li>
<li>Supports source language translator invocation via both dynamically
loadable shared objects and invocation of an executable.</li>
</ul>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="operation">Operation</a></div>
<div class="doc_text">
<p>At a high level, <tt>llvmc</tt> operation is very simple. The basic action
taken by <tt>llvmc</tt> is to simply invoke some tool or set of tools to fill
the user's request for compilation. Every execution of <tt>llvmc</tt>takes the
following sequence of steps:</p>
<dl>
<dt><b>Collect Command Line Options</b></dt>
<dd>The command line options provide the marching orders to <tt>llvmc</tt>
on what actions it should perform. This is the request the user is making
of <tt>llvmc</tt> and it is interpreted first. See the <tt>llvmc</tt>
<a href="CommandGuide/html/llvmc.html">manual page</a> for details on the
options.</dd>
<dt><b>Read Configuration Files</b></dt>
<dd>Based on the options and the suffixes of the filenames presented, a set
of configuration files are read to configure the actions <tt>llvmc</tt> will
take. Configuration files are provided by either LLVM or the
compiler tools that <tt>llvmc</tt> invokes. These files determine what
actions <tt>llvmc</tt> will take in response to the user's request. See
the section on <a href="#configuration">configuration</a> for more details.
</dd>
<dt><b>Determine Phases To Execute</b></dt>
<dd>Based on the command line options and configuration files,
<tt>llvmc</tt> determines the compilation <a href="#phases">phases</a> that
must be executed by the user's request. This is the primary work of
<tt>llvmc</tt>.</dd>
<dt><b>Determine Actions To Execute</b></dt>
<dd>Each <a href="#phases">phase</a> to be executed can result in the
invocation of one or more <a href="#actions">actions</a>. An action is
either a whole program or a function in a dynamically linked shared library.
In this step, <tt>llvmc</tt> determines the sequence of actions that must be
executed. Actions will always be executed in a deterministic order.</dd>
<dt><b>Execute Actions</b></dt>
<dd>The <a href="#actions">actions</a> necessary to support the user's
original request are executed sequentially and deterministically. All
actions result in either the invocation of a whole program to perform the
action or the loading of a dynamically linkable shared library and invocation
of a standard interface function within that library.</dd>
<dt><b>Termination</b></dt>
<dd>If any action fails (returns a non-zero result code), <tt>llvmc</tt>
also fails and returns the result code from the failing action. If
everything succeeds, <tt>llvmc</tt> will return a zero result code.</dd>
</dl>
<p><tt>llvmc</tt>'s operation must be simple, regular and predictable.
Developers need to be able to rely on it to take a consistent approach to
compilation. For example, the invocation:</p>
<code>
llvmc -O2 x.c y.c z.c -o xyz</code>
<p>must produce <i>exactly</i> the same results as:</p>
<pre><tt>
llvmc -O2 x.c -o x.o
llvmc -O2 y.c -o y.o
llvmc -O2 z.c -o z.o
llvmc -O2 x.o y.o z.o -o xyz</tt></pre>
<p>To accomplish this, <tt>llvmc</tt> uses a very simple goal oriented
procedure to do its work. The overall goal is to produce a functioning
executable. To accomplish this, <tt>llvmc</tt> always attempts to execute a
series of compilation <a href="#def_phase">phases</a> in the same sequence.
However, the user's options to <tt>llvmc</tt> can cause the sequence of phases
to start in the middle or finish early.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="phases"></a>Phases </div>
<div class="doc_text">
<p><tt>llvmc</tt> breaks every compilation task into the following five
distinct phases:</p>
<dl><dt><b>Preprocessing</b></dt><dd>Not all languages support preprocessing;
but for those that do, this phase can be invoked. This phase is for
languages that provide combining, filtering, or otherwise altering with the
source language input before the translator parses it. Although C and C++
are the most common users of this phase, other languages may provide their
own preprocessor (whether its the C pre-processor or not).</dd>
</dl>
<dl><dt><b>Translation</b></dt><dd>The translation phase converts the source
language input into something that LLVM can interpret and use for
downstream phases. The translation is essentially from "non-LLVM form" to
"LLVM form".</dd>
</dl>
<dl><dt><b>Optimization</b></dt><dd>Once an LLVM Module has been obtained from
the translation phase, the program enters the optimization phase. This phase
attempts to optimize all of the input provided on the command line according
to the options provided.</dd>
</dl>
<dl><dt><b>Linking</b></dt><dd>The inputs are combined to form a complete
program.</dd>
</dl>
<p>The following table shows the inputs, outputs, and command line options
applicable to each phase.</p>
<table>
<tr>
<th style="width: 10%">Phase</th>
<th style="width: 25%">Inputs</th>
<th style="width: 25%">Outputs</th>
<th style="width: 40%">Options</th>
</tr>
<tr><td><b>Preprocessing</b></td>
<td class="td_left"><ul><li>Source Language File</li></ul></td>
<td class="td_left"><ul><li>Source Language File</li></ul></td>
<td class="td_left"><dl>
<dt><tt>-E</tt></dt>
<dd>Stops the compilation after preprocessing</dd>
</dl></td>
</tr>
<tr>
<td><b>Translation</b></td>
<td class="td_left"><ul>
<li>Source Language File</li>
</ul></td>
<td class="td_left"><ul>
<li>LLVM Assembly</li>
<li>LLVM Bitcode</li>
<li>LLVM C++ IR</li>
</ul></td>
<td class="td_left"><dl>
<dt><tt>-c</tt></dt>
<dd>Stops the compilation after translation so that optimization and
linking are not done.</dd>
<dt><tt>-S</tt></dt>
<dd>Stops the compilation before object code is written so that only
assembly code remains.</dd>
</dl></td>
</tr>
<tr>
<td><b>Optimization</b></td>
<td class="td_left"><ul>
<li>LLVM Assembly</li>
<li>LLVM Bitcode</li>
</ul></td>
<td class="td_left"><ul>
<li>LLVM Bitcode</li>
</ul></td>
<td class="td_left"><dl>
<dt><tt>-Ox</tt>
<dd>This group of options controls the amount of optimization
performed.</dd>
</dl></td>
</tr>
<tr>
<td><b>Linking</b></td>
<td class="td_left"><ul>
<li>LLVM Bitcode</li>
<li>Native Object Code</li>
<li>LLVM Library</li>
<li>Native Library</li>
</ul></td>
<td class="td_left"><ul>
<li>LLVM Bitcode Executable</li>
<li>Native Executable</li>
</ul></td>
<td class="td_left"><dl>
<dt><tt>-L</tt></dt><dd>Specifies a path for library search.</dd>
<dt><tt>-l</tt></dt><dd>Specifies a library to link in.</dd>
</dl></td>
</tr>
</table>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="actions"></a>Actions</div>
<div class="doc_text">
<p>An action, with regard to <tt>llvmc</tt> is a basic operation that it takes
in order to fulfill the user's request. Each phase of compilation will invoke
zero or more actions in order to accomplish that phase.</p>
<p>Actions come in two forms:</p>
<ul>
<li>Invokable Executables</li>
<li>Functions in a shared library</li>
</ul>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="configuration">Configuration</a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>This section of the document describes the configuration files used by
<tt>llvmc</tt>. Configuration information is relatively static for a
given release of LLVM and a compiler tool. However, the details may
change from release to release of either. Users are encouraged to simply use
the various options of the <tt>llvmc</tt> command and ignore the configuration
of the tool. These configuration files are for compiler writers and LLVM
developers. Those wishing to simply use <tt>llvmc</tt> don't need to understand
this section but it may be instructive on how the tool works.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="overview"></a>Overview</div>
<div class="doc_text">
<p><tt>llvmc</tt> is highly configurable both on the command line and in
configuration files. The options it understands are generic, consistent and
simple by design. Furthermore, the <tt>llvmc</tt> options apply to the
compilation of any LLVM enabled programming language. To be enabled as a
supported source language compiler, a compiler writer must provide a
configuration file that tells <tt>llvmc</tt> how to invoke the compiler
and what its capabilities are. The purpose of the configuration files then
is to allow compiler writers to specify to <tt>llvmc</tt> how the compiler
should be invoked. Users may but are not advised to alter the compiler's
<tt>llvmc</tt> configuration.</p>
<p>Because <tt>llvmc</tt> just invokes other programs, it must deal with the
available command line options for those programs regardless of whether they
were written for LLVM or not. Furthermore, not all compiler tools will
have the same capabilities. Some compiler tools will simply generate LLVM assembly
code, others will be able to generate fully optimized bitcode. In general,
<tt>llvmc</tt> doesn't make any assumptions about the capabilities or command
line options of a sub-tool. It simply uses the details found in the
configuration files and leaves it to the compiler writer to specify the
configuration correctly.</p>
<p>This approach means that new compiler tools can be up and working very
quickly. As a first cut, a tool can simply compile its source to raw
(unoptimized) bitcode or LLVM assembly and <tt>llvmc</tt> can be configured
to pick up the slack (translate LLVM assembly to bitcode, optimize the
bitcode, generate native assembly, link, etc.). In fact, the compiler tools
need not use any LLVM libraries, and it could be written in any language
(instead of C++). The configuration data will allow the full range of
optimization, assembly, and linking capabilities that LLVM provides to be added
to these kinds of tools. Enabling the rapid development of front-ends is one
of the primary goals of <tt>llvmc</tt>.</p>
<p>As a compiler tool matures, it may utilize the LLVM libraries and tools
to more efficiently produce optimized bitcode directly in a single compilation
and optimization program. In these cases, multiple tools would not be needed
and the configuration data for the compiler would change.</p>
<p>Configuring <tt>llvmc</tt> to the needs and capabilities of a source language
compiler is relatively straight-forward. A compiler writer must provide a
definition of what to do for each of the five compilation phases for each of
the optimization levels. The specification consists simply of prototypical
command lines into which <tt>llvmc</tt> can substitute command line
arguments and file names. Note that any given phase can be completely blank if
the source language's compiler combines multiple phases into a single program.
For example, quite often pre-processing, translation, and optimization are
combined into a single program. The specification for such a compiler would have
blank entries for pre-processing and translation but a full command line for
optimization.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="filetypes">Configuration Files</a></div>
<div class="doc_subsubsection"><a name="filecontents">File Contents</a></div>
<div class="doc_text">
<p>Each configuration file provides the details for a single source language
that is to be compiled. This configuration information tells <tt>llvmc</tt>
how to invoke the language's pre-processor, translator, optimizer, assembler
and linker. Note that a given source language needn't provide all these tools
as many of them exist in llvm currently.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="dirsearch">Directory Search</a></div>
<div class="doc_text">
<p><tt>llvmc</tt> always looks for files of a specific name. It uses the
first file with the name its looking for by searching directories in the
following order:<br/>
<ol>
<li>Any directory specified by the <tt>-config-dir</tt> option will be
checked first.</li>
<li>If the environment variable LLVM_CONFIG_DIR is set, and it contains
the name of a valid directory, that directory will be searched next.</li>
<li>If the user's home directory (typically <tt>/home/user</tt> contains
a sub-directory named <tt>.llvm</tt> and that directory contains a
sub-directory named <tt>etc</tt> then that directory will be tried
next.</li>
<li>If the LLVM installation directory (typically <tt>/usr/local/llvm</tt>
contains a sub-directory named <tt>etc</tt> then that directory will be
tried last.</li>
<li>A standard "system" directory will be searched next. This is typically
<tt>/etc/llvm</tt> on UNIX&trade; and <tt>C:\WINNT</tt> on Microsoft
Windows&trade;.</li>
<li>If the configuration file sought still can't be found, <tt>llvmc</tt>
will print an error message and exit.</li>
</ol>
<p>The first file found in this search will be used. Other files with the
same name will be ignored even if they exist in one of the subsequent search
locations.</p>
</div>
<div class="doc_subsubsection"><a name="filenames">File Names</a></div>
<div class="doc_text">
<p>In the directories searched, each configuration file is given a specific
name to foster faster lookup (so llvmc doesn't have to do directory searches).
The name of a given language specific configuration file is simply the same
as the suffix used to identify files containing source in that language.
For example, a configuration file for C++ source might be named
<tt>cpp</tt>, <tt>C</tt>, or <tt>cxx</tt>. For languages that support multiple
file suffixes, multiple (probably identical) files (or symbolic links) will
need to be provided.</p>
</div>
<div class="doc_subsubsection"><a name="whatgetsread">What Gets Read</a></div>
<div class="doc_text">
<p>Which configuration files are read depends on the command line options and
the suffixes of the file names provided on <tt>llvmc</tt>'s command line. Note
that the <tt>-x LANGUAGE</tt> option alters the language that <tt>llvmc</tt>
uses for the subsequent files on the command line. Only the configuration
files actually needed to complete <tt>llvmc</tt>'s task are read. Other
language specific files will be ignored.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="syntax"></a>Syntax</div>
<div class="doc_text">
<p>The syntax of the configuration files is very simple and somewhat
compatible with Java's property files. Here are the syntax rules:</p>
<ul>
<li>The file encoding is ASCII.</li>
<li>The file is line oriented. There should be one configuration definition
per line. Lines are terminated by the newline (0x0A) and/or carriage return
characters (0x0D)</li>
<li>A backslash (<tt>\</tt>) before a newline causes the newline to be
ignored. This is useful for line continuation of long definitions. A
backslash anywhere else is recognized as a backslash.</li>
<li>A configuration item consists of a name, an <tt>=</tt> and a value.</li>
<li>A name consists of a sequence of identifiers separated by period.</li>
<li>An identifier consists of specific keywords made up of only lower case
and upper case letters (e.g. <tt>lang.name</tt>).</li>
<li>Values come in four flavors: booleans, integers, commands and
strings.</li>
<li>Valid "false" boolean values are <tt>false False FALSE no No NO
off Off</tt> and <tt>OFF</tt>.</li>
<li>Valid "true" boolean values are <tt>true True TRUE yes Yes YES
on On</tt> and <tt>ON</tt>.</li>
<li>Integers are simply sequences of digits.</li>
<li>Commands start with a program name and are followed by a sequence of
words that are passed to that program as command line arguments. Program
arguments that begin and end with the <tt>%</tt> sign will have their value
substituted. Program names beginning with <tt>/</tt> are considered to be
absolute. Otherwise the <tt>PATH</tt> will be applied to find the program to
execute.</li>
<li>Strings are composed of multiple sequences of characters from the
character class <tt>[-A-Za-z0-9_:%+/\\|,]</tt> separated by white
space.</li>
<li>White space on a line is folded. Multiple blanks or tabs will be
reduced to a single blank.</li>
<li>White space before the configuration item's name is ignored.</li>
<li>White space on either side of the <tt>=</tt> is ignored.</li>
<li>White space in a string value is used to separate the individual
components of the string value but otherwise ignored.</li>
<li>Comments are introduced by the <tt>#</tt> character. Everything after a
<tt>#</tt> and before the end of line is ignored.</li>
</ul>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="items">Configuration Items</a></div>
<div class="doc_text">
<p>The table below provides definitions of the allowed configuration items
that may appear in a configuration file. Every item has a default value and
does not need to appear in the configuration file. Missing items will have the
default value. Each identifier may appear as all lower case, first letter
capitalized or all upper case.</p>
<table>
<tbody>
<tr>
<th>Name</th>
<th>Value Type</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr><td colspan="4"><h4>LLVMC ITEMS</h4></td></tr>
<tr>
<td><b>version</b></td>
<td>string</td>
<td class="td_left">Provides the version string for the contents of this
configuration file. What is accepted as a legal configuration file
will change over time and this item tells <tt>llvmc</tt> which version
should be expected.</td>
<td><i>b</i></td>
</tr>
<tr><td colspan="4"><h4>LANG ITEMS</h4></td></tr>
<tr>
<td><b>lang.name</b></td>
<td>string</td>
<td class="td_left">Provides the common name for a language definition.
For example "C++", "Pascal", "FORTRAN", etc.</td>
<td><i>blank</i></td>
</tr>
<tr>
<td><b>lang.opt1</b></td>
<td>string</td>
<td class="td_left">Specifies the parameters to give the optimizer when
<tt>-O1</tt> is specified on the <tt>llvmc</tt> command line.</td>
<td><tt>-simplifycfg -instcombine -mem2reg</tt></td>
</tr>
<tr>
<td><b>lang.opt2</b></td>
<td>string</td>
<td class="td_left">Specifies the parameters to give the optimizer when
<tt>-O2</tt> is specified on the <tt>llvmc</tt> command line.</td>
<td><i>TBD</i></td>
</tr>
<tr>
<td><b>lang.opt3</b></td>
<td>string</td>
<td class="td_left">Specifies the parameters to give the optimizer when
<tt>-O3</tt> is specified on the <tt>llvmc</tt> command line.</td>
<td><i>TBD</i></td>
</tr>
<tr>
<td><b>lang.opt4</b></td>
<td>string</td>
<td class="td_left">Specifies the parameters to give the optimizer when
<tt>-O4</tt> is specified on the <tt>llvmc</tt> command line.</td>
<td><i>TBD</i></td>
</tr>
<tr>
<td><b>lang.opt5</b></td>
<td>string</td>
<td class="td_left">Specifies the parameters to give the optimizer when
<tt>-O5</tt> is specified on the <tt>llvmc</tt> command line.</td>
<td><i>TBD</i></td>
</tr>
<tr><td colspan="4"><h4>PREPROCESSOR ITEMS</h4></td></tr>
<tr>
<td><b>preprocessor.command</b></td>
<td>command</td>
<td class="td_left">This provides the command prototype that will be used
to run the preprocessor. This is generally only used with the
<tt>-E</tt> option.</td>
<td>&lt;blank&gt;</td>
</tr>
<tr>
<td><b>preprocessor.required</b></td>
<td>boolean</td>
<td class="td_left">This item specifies whether the pre-processing phase
is required by the language. If the value is true, then the
<tt>preprocessor.command</tt> value must not be blank. With this option,
<tt>llvmc</tt> will always run the preprocessor as it assumes that the
translation and optimization phases don't know how to pre-process their
input.</td>
<td>false</td>
</tr>
<tr><td colspan="4"><h4>TRANSLATOR ITEMS</h4></td></tr>
<tr>
<td><b>translator.command</b></td>
<td>command</td>
<td class="td_left">This provides the command prototype that will be used
to run the translator. Valid substitutions are <tt>%in%</tt> for the
input file and <tt>%out%</tt> for the output file.</td>
<td>&lt;blank&gt;</td>
</tr>
<tr>
<td><b>translator.output</b></td>
<td><tt>bitcode</tt> or <tt>assembly</tt></td>
<td class="td_left">This item specifies the kind of output the language's
translator generates.</td>
<td><tt>bitcode</tt></td>
</tr>
<tr>
<td><b>translator.preprocesses</b></td>
<td>boolean</td>
<td class="td_left">Indicates that the translator also preprocesses. If
this is true, then <tt>llvmc</tt> will skip the pre-processing phase
whenever the final phase is not pre-processing.</td>
<td><tt>false</tt></td>
</tr>
<tr><td colspan="4"><h4>OPTIMIZER ITEMS</h4></td></tr>
<tr>
<td><b>optimizer.command</b></td>
<td>command</td>
<td class="td_left">This provides the command prototype that will be used
to run the optimizer. Valid substitutions are <tt>%in%</tt> for the
input file and <tt>%out%</tt> for the output file.</td>
<td>&lt;blank&gt;</td>
</tr>
<tr>
<td><b>optimizer.output</b></td>
<td><tt>bitcode</tt> or <tt>assembly</tt></td>
<td class="td_left">This item specifies the kind of output the language's
optimizer generates. Valid values are "assembly" and "bitcode"</td>
<td><tt>bitcode</tt></td>
</tr>
<tr>
<td><b>optimizer.preprocesses</b></td>
<td>boolean</td>
<td class="td_left">Indicates that the optimizer also preprocesses. If
this is true, then <tt>llvmc</tt> will skip the pre-processing phase
whenever the final phase is optimization or later.</td>
<td><tt>false</tt></td>
</tr>
<tr>
<td><b>optimizer.translates</b></td>
<td>boolean</td>
<td class="td_left">Indicates that the optimizer also translates. If
this is true, then <tt>llvmc</tt> will skip the translation phase
whenever the final phase is optimization or later.</td>
<td><tt>false</tt></td>
</tr>
<tr><td colspan="4"><h4>ASSEMBLER ITEMS</h4></td></tr>
<tr>
<td><b>assembler.command</b></td>
<td>command</td>
<td class="td_left">This provides the command prototype that will be used
to run the assembler. Valid substitutions are <tt>%in%</tt> for the
input file and <tt>%out%</tt> for the output file.</td>
<td>&lt;blank&gt;</td>
</tr>
</tbody>
</table>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="substitutions">Substitutions</a></div>
<div class="doc_text">
<p>On any configuration item that ends in <tt>command</tt>, you must
specify substitution tokens. Substitution tokens begin and end with a percent
sign (<tt>%</tt>) and are replaced by the corresponding text. Any substitution
token may be given on any <tt>command</tt> line but some are more useful than
others. In particular each command <em>should</em> have both an <tt>%in%</tt>
and an <tt>%out%</tt> substitution. The table below provides definitions of
each of the allowed substitution tokens.</p>
<table>
<tbody>
<tr>
<th>Substitution Token</th>
<th>Replacement Description</th>
</tr>
<tr>
<td><tt>%args%</tt></td>
<td class="td_left">Replaced with all the tool-specific arguments given
to <tt>llvmc</tt> via the <tt>-T</tt> set of options. This just allows
you to place these arguments in the correct place on the command line.
If the <tt>%args%</tt> option does not appear on your command line,
then you are explicitly disallowing the <tt>-T</tt> option for your
tool.
</td>
<tr>
<td><tt>%force%</tt></td>
<td class="td_left">Replaced with the <tt>-f</tt> option if it was
specified on the <tt>llvmc</tt> command line. This is intended to tell
the compiler tool to force the overwrite of output files.
</td>
</tr>
<tr>
<td><tt>%in%</tt></td>
<td class="td_left">Replaced with the full path of the input file. You
needn't worry about the cascading of file names. <tt>llvmc</tt> will
create temporary files and ensure that the output of one phase is the
input to the next phase.</td>
</tr>
<tr>
<td><tt>%opt%</tt></td>
<td class="td_left">Replaced with the optimization options for the
tool. If the tool understands the <tt>-O</tt> options then that will
be passed. Otherwise, the <tt>lang.optN</tt> series of configuration
items will specify which arguments are to be given.</td>
</tr>
<tr>
<td><tt>%out%</tt></td>
<td class="td_left">Replaced with the full path of the output file.
Note that this is not necessarily the output file specified with the
<tt>-o</tt> option on <tt>llvmc</tt>'s command line. It might be a
temporary file that will be passed to a subsequent phase's input.
</td>
</tr>
<tr>
<td><tt>%stats%</tt></td>
<td class="td_left">If your command accepts the <tt>-stats</tt> option,
use this substitution token. If the user requested <tt>-stats</tt>
from the <tt>llvmc</tt> command line then this token will be replaced
with <tt>-stats</tt>, otherwise it will be ignored.
</td>
</tr>
<tr>
<td><tt>%target%</tt></td>
<td class="td_left">Replaced with the name of the target "machine" for
which code should be generated. The value used here is taken from the
<tt>llvmc</tt> option <tt>-march</tt>.
</td>
</tr>
<tr>
<td><tt>%time%</tt></td>
<td class="td_left">If your command accepts the <tt>-time-passes</tt>
option, use this substitution token. If the user requested
<tt>-time-passes</tt> from the <tt>llvmc</tt> command line then this
token will be replaced with <tt>-time-passes</tt>, otherwise it will
be ignored.
</td>
</tr>
</tbody>
</table>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="sample">Sample Config File</a></div>
<div class="doc_text">
<p>Since an example is always instructive, here's how the Stacker language
configuration file looks.</p>
<pre><tt>
# Stacker Configuration File For llvmc
##########################################################
# Language definitions
##########################################################
lang.name=Stacker
lang.opt1=-simplifycfg -instcombine -mem2reg
lang.opt2=-simplifycfg -instcombine -mem2reg -load-vn \
-gcse -dse -scalarrepl -sccp
lang.opt3=-simplifycfg -instcombine -mem2reg -load-vn \
-gcse -dse -scalarrepl -sccp -branch-combine -adce \
-globaldce -inline -licm
lang.opt4=-simplifycfg -instcombine -mem2reg -load-vn \
-gcse -dse -scalarrepl -sccp -ipconstprop \
-branch-combine -adce -globaldce -inline -licm
lang.opt5=-simplifycfg -instcombine -mem2reg --load-vn \
-gcse -dse scalarrepl -sccp -ipconstprop \
-branch-combine -adce -globaldce -inline -licm \
-block-placement
##########################################################
# Pre-processor definitions
##########################################################
# Stacker doesn't have a preprocessor but the following
# allows the -E option to be supported
preprocessor.command=cp %in% %out%
preprocessor.required=false
##########################################################
# Translator definitions
##########################################################
# To compile stacker source, we just run the stacker
# compiler with a default stack size of 2048 entries.
translator.command=stkrc -s 2048 %in% -o %out% %time% \
%stats% %force% %args%
# stkrc doesn't preprocess but we set this to true so
# that we don't run the cp command by default.
translator.preprocesses=true
# The translator is required to run.
translator.required=true
# stkrc doesn't handle the -On options
translator.output=bitcode
##########################################################
# Optimizer definitions
##########################################################
# For optimization, we use the LLVM "opt" program
optimizer.command=opt %in% -o %out% %opt% %time% %stats% \
%force% %args%
optimizer.required = true
# opt doesn't translate
optimizer.translates = no
# opt doesn't preprocess
optimizer.preprocesses=no
# opt produces bitcode
optimizer.output = bc
##########################################################
# Assembler definitions
##########################################################
assembler.command=llc %in% -o %out% %target% %time% %stats%
</tt></pre>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="glossary">Glossary</a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>This document uses precise terms in reference to the various artifacts and
concepts related to compilation. The terms used throughout this document are
defined below.</p>
<dl>
<dt><a name="def_assembly"><b>assembly</b></a></dt>
<dd>A compilation <a href="#def_phase">phase</a> in which LLVM bitcode or
LLVM assembly code is assembled to a native code format (either target
specific aseembly language or the platform's native object file format).
</dd>
<dt><a name="def_compiler"><b>compiler</b></a></dt>
<dd>Refers to any program that can be invoked by <tt>llvmc</tt> to accomplish
the work of one or more compilation <a href="#def_phase">phases</a>.</dd>
<dt><a name="def_driver"><b>driver</b></a></dt>
<dd>Refers to <tt>llvmc</tt> itself.</dd>
<dt><a name="def_linking"><b>linking</b></a></dt>
<dd>A compilation <a href="#def_phase">phase</a> in which LLVM bitcode files
and (optionally) native system libraries are combined to form a complete
executable program.</dd>
<dt><a name="def_optimization"><b>optimization</b></a></dt>
<dd>A compilation <a href="#def_phase">phase</a> in which LLVM bitcode is
optimized.</dd>
<dt><a name="def_phase"><b>phase</b></a></dt>
<dd>Refers to any one of the five compilation phases that that
<tt>llvmc</tt> supports. The five phases are:
<a href="#def_preprocessing">preprocessing</a>,
<a href="#def_translation">translation</a>,
<a href="#def_optimization">optimization</a>,
<a href="#def_assembly">assembly</a>,
<a href="#def_linking">linking</a>.</dd>
<dt><a name="def_sourcelanguage"><b>source language</b></a></dt>
<dd>Any common programming language (e.g. C, C++, Java, Stacker, ML,
FORTRAN). These languages are distinguished from any of the lower level
languages (such as LLVM or native assembly), by the fact that a
<a href="#def_translation">translation</a> <a href="#def_phase">phase</a>
is required before LLVM can be applied.</dd>
<dt><a name="def_tool"><b>tool</b></a></dt>
<dd>Refers to any program in the LLVM tool set.</dd>
<dt><a name="def_translation"><b>translation</b></a></dt>
<dd>A compilation <a href="#def_phase">phase</a> in which
<a href="#def_sourcelanguage">source language</a> code is translated into
either LLVM assembly language or LLVM bitcode.</dd>
</dl>
</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:rspencer@x10sys.com">Reid Spencer</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>
<!-- vim: sw=2
-->
</body>
</html>

View File

@@ -1,261 +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>Architecture/platform information for compiler writers</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<div class="doc_title">
Architecture/platform information for compiler writers
</div>
<div class="doc_warning">
<p>Note: This document is a work-in-progress. Additions and clarifications
are welcome.</p>
</div>
<ol>
<li><a href="#hw">Hardware</a>
<ol>
<li><a href="#alpha">Alpha</a></li>
<li><a href="#arm">ARM</a></li>
<li><a href="#ia64">Itanium</a></li>
<li><a href="#mips">MIPS</a></li>
<li><a href="#ppc">PowerPC</a></li>
<li><a href="#sparc">SPARC</a></li>
<li><a href="#x86">X86</a></li>
<li><a href="#other">Other lists</a></li>
</ol></li>
<li><a href="#abi">Application Binary Interface (ABI)</a>
<ol>
<li><a href="#linux">Linux</a></li>
<li><a href="#osx">OS X</a></li>
</ol></li>
<li><a href="#misc">Miscellaneous resources</a></li>
</ol>
<div class="doc_author">
<p>Compiled by <a href="http://misha.brukman.net">Misha Brukman</a></p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="hw">Hardware</a></div>
<!-- *********************************************************************** -->
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="alpha">Alpha</a></div>
<div class="doc_text">
<ul>
<li><a
href="http://ftp.digital.com/pub/Digital/info/semiconductor/literature/dsc-library.html">Alpha manuals</a>
</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="arm">ARM</a></div>
<div class="doc_text">
<ul>
<li><a href="http://www.arm.com/documentation/">ARM documentation</a>
(<a href="http://www.arm.com/documentation/ARMProcessor_Cores/">Processor
Cores</a>)</li>
<li><a href="http://www.arm.com/products/DevTools/ABI.html">ABI</a></li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="ia64">Itanium (ia64)</a></div>
<div class="doc_text">
<ul>
<li><a
href="http://developer.intel.com/design/itanium2/documentation.htm">Itanium documentation</a>
</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="mips">MIPS</a></div>
<div class="doc_text">
<ul>
<li><a
href="http://mips.com/content/Documentation/MIPSDocumentation/ProcessorArchitecture/doclibrary">MIPS
Processor Architecture</a></li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="ppc">PowerPC</a></div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">IBM - Official manuals and docs</div>
<div class="doc_text">
<ul>
<li><a
href="http://www-106.ibm.com/developerworks/eserver/articles/archguide.html">PowerPC
Architecture Book</a>
<ul>
<li>Book I: <a
href="http://www-106.ibm.com/developerworks/eserver/pdfs/archpub1.pdf">PowerPC
User Instruction Set Architecture</a></li>
<li>Book II: <a
href="http://www-106.ibm.com/developerworks/eserver/pdfs/archpub2.pdf">PowerPC
Virtual Environment Architecture</a></li>
<li>Book III: <a
href="http://www-106.ibm.com/developerworks/eserver/pdfs/archpub3.pdf">PowerPC
Operating Environment Architecture</a></li>
</ul></li>
<li><a
href="http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF7785256996007558C6">PowerPC
Compiler Writer's Guide</a></li>
<li><A
href="http://www-3.ibm.com/chips/techlib/techlib.nsf/products/PowerPC">PowerPC
Processor Manuals</a></li>
<li><a
href="http://www-106.ibm.com/developerworks/linux/library/l-powarch/">Intro to
PowerPC architecture</a></li>
<li><a href="http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixassem/alangref/alangreftfrm.htm">IBM AIX/5L for POWER Assembly reference</a></li>
</ul>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">Other documents, collections, notes</div>
<div class="doc_text">
<ul>
<li><a href="http://penguinppc.org/dev/#library">PowerPC ABI documents</a></li>
<li><a href="http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00997.html">PowerPC64
alignment of long doubles (from GCC)</a></li>
<li><a href="http://sources.redhat.com/ml/binutils/2002-04/msg00573.html">Long
branch stubs for powerpc64-linux (from binutils)</a></li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="sparc">SPARC</a></div>
<div class="doc_text">
<ul>
<li><a href="http://www.sparc.org/resource.htm">SPARC resources</a></li>
<li><a href="http://www.sparc.org/standards.html">SPARC standards</a></li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="x86">X86</a></div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">AMD - Official manuals and docs</div>
<div class="doc_text">
<ul>
<li><a
href="http://www.amd.com/us-en/Processors/TechnicalResources/0,,30_182_739,00.html">AMD processor manuals</a></li>
<li><a href="http://www.x86-64.org/documentation">X86-64 ABI</a></li>
</ul>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">Intel - Official manuals and docs</div>
<div class="doc_text">
<ul>
<li><a
href="http://developer.intel.com/design/pentium4/manuals/index_new.htm">IA-32
manuals</a></li>
<li><a
href="http://www.intel.com/design/itanium/documentation.htm?iid=ipp_srvr_proc_itanium2+techdocs">Intel
Itanium documentation</a></li>
</ul>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">Other x86-specific information</div>
<div class="doc_text">
<ul>
<li><a href="http://www.agner.org/assem/calling_conventions.pdf">Calling
conventions for different C++ compilers and operating systems</a></li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="other">Other relevant lists</a></div>
<div class="doc_text">
<ul>
<li><a href="http://gcc.gnu.org/readings.html">GCC reading list</a></li>
</ul>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="abi">ABI</a></div>
<!-- *********************************************************************** -->
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="linux">Linux</a></div>
<div class="doc_text">
<ol>
<li><a href="http://www.linuxbase.org/spec/ELF/ppc64/">PowerPC 64-bit ELF ABI
Supplement</a></li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="osx">OS X</a></div>
<div class="doc_text">
<ol>
<li><a
href="http://developer.apple.com/documentation/Darwin/RuntimeArchitecture-date.html">Mach-O
Runtime Architecture</a></li>
<li><a href="http://www.unsanity.org/archives/000044.php">Notes on Mach-O
ABI</a></li>
</ol>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="misc">Miscellaneous resources</a></div>
<!-- *********************************************************************** -->
<ul>
<li><a
href="http://www.nondot.org/sabre/os/articles/ExecutableFileFormats/">Executable
File Format library</a></li>
<li><a href="http://gcc.gnu.org/projects/prefetch.html">GCC prefetch project</a>
page has a good survey of the prefetching capabilities of a variety of modern
processors.</li>
</ul>
<!-- *********************************************************************** -->
<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://misha.brukman.net">Misha Brukman</a><br>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>
</body>
</html>

View File

@@ -1,504 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>LLVM Developer Policy</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>
<div class="doc_title">LLVM Developer Policy</div>
<ol>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#policies">Developer Policies</a>
<ol>
<li><a href="#informed">Stay Informed</a></li>
<li><a href="#patches">Making a Patch</a></li>
<li><a href="#reviews">Code Reviews</a></li>
<li><a href="#testcases">Test Cases</a></li>
<li><a href="#quality">Quality</a></li>
<li><a href="#commitaccess">Obtaining Commit Access</a></li>
<li><a href="#newwork">Making a Major Change</a></li>
<li><a href="#incremental">Incremental Development</a></li>
<li><a href="#attribution">Attribution of Changes</a></li>
</ol></li>
<li><a href="#clp">Copyright, License, and Patents</a>
<ol>
<li><a href="#copyright">Copyright</a></li>
<li><a href="#license">License</a></li>
<li><a href="#patents">Patents</a></li>
<li><a href="#devagree">Developer Agreements</a></li>
</ol></li>
</ol>
<div class="doc_author">Written by the LLVM Oversight Team</div>
<!--=========================================================================-->
<div class="doc_section"><a name="introduction">Introduction</a></div>
<!--=========================================================================-->
<div class="doc_text">
<p>This document contains the LLVM Developer Policy which defines the
project's policy towards developers and their contributions. The intent of
this policy is to eliminate mis-communication, rework, and confusion that
might arise from the distributed nature of LLVM's development. By stating
the policy in clear terms, we hope each developer can know ahead of time
what to expect when making LLVM contributions.</p>
<p>This policy is also designed to accomplish the following objectives:</p>
<ol>
<li>Attract both users and developers to the LLVM project.</li>
<li>Make life as simple and easy for contributors as possible.</li>
<li>Keep the top of Subversion trees as stable as possible.</li>
</ol>
<p>This policy is aimed at frequent contributors to LLVM. People interested in
contributing one-off patches can do so in an informal way by sending them to
the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">
llvm-commits mailing list</a> and engaging another developer to see it through
the process.</p>
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="policies">Developer Policies</a></div>
<!--=========================================================================-->
<div class="doc_text">
<p>This section contains policies that pertain to frequent LLVM
developers. We always welcome <a href="#patches">one-off patches</a> from
people who do not routinely contribute to LLVM, but we expect more from
frequent contributors to keep the system as efficient as possible for
everyone.
Frequent LLVM contributors are expected to meet the following requirements in
order for LLVM to maintain a high standard of quality.<p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="informed">Stay Informed</a> </div>
<div class="doc_text">
<p>Developers should stay informed by reading at least the
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">llvmdev</a>
email list. If you are doing anything more than just casual work on LLVM,
it is suggested that you also subscribe to the
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">llvm-commits</a>
list and pay attention to changes being made by others.</p>
<p>We recommend that active developers register an email account with
<a href="http://llvm.org/bugs/">LLVM Bugzilla</a> and preferably subscribe to
the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs">llvm-bugs</a>
email list to keep track of bugs and enhancements occurring in LLVM.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="patches">Making a Patch</a></div>
<div class="doc_text">
<p>When making a patch for review, the goal is to make it as easy for the
reviewer to read it as possible. As such, we recommend that you:</p>
<ol>
<li>Make your patch against the Subversion trunk, not a branch, and not an
old version of LLVM. This makes it easy to apply the patch.</li>
<li>Similarly, patches should be submitted soon after they are generated.
Old patches may not apply correctly if the underlying code changes between
the time the patch was created and the time it is applied.</li>
<li>Patches should be made with this command:
<pre>svn diff -x -u</pre>
or with the utility <tt>utils/mkpatch</tt>, which makes it easy to read the
diff.</li>
<li>Patches should not include differences in generated code such as the
code generated by <tt>flex</tt>, <tt>bison</tt> or <tt>tblgen</tt>. The
<tt>utils/mkpatch</tt> utility takes care of this for you.</li>
</ol>
<p>When sending a patch to a mailing list, it is a good idea to send it as an
<em>attachment</em> to the message, not embedded into the text of the
message. This ensures that your mailer will not mangle the patch when it
sends it (e.g. by making whitespace changes or by wrapping lines).</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="reviews">Code Reviews</a></div>
<div class="doc_text">
<p>LLVM has a code review policy. Code review is one way to increase the
quality of software. We generally follow these policies:</p>
<ol>
<li>All developers are required to have significant changes reviewed
before they are committed to the repository.</li>
<li>Code reviews are conducted by email, usually on the llvm-commits
list.</li>
<li>Code can be reviewed either before it is committed or after. We expect
major changes to be reviewed before being committed, but smaller
changes (or changes where the developer owns the component) can be
reviewed after commit.</li>
<li>The developer responsible for a code change is also responsible for
making all necessary review-related changes.</li>
<li>Code review can be an iterative process, which continues until the patch
is ready to be committed.</li>
</ol>
<p>Developers should participate in code reviews as both reviewers and
reviewees. If someone is kind enough to review your code, you should
return the favor for someone else. Note that anyone is welcome to review
and give feedback on a patch, but only people with Subversion write access
can approve it.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="testcases">Test Cases</a></div>
<div class="doc_text">
<p>Developers are required to create test cases for any bugs fixed and any new
features added. Some tips for getting your testcase approved:</p>
<ol>
<li>All feature and regression test cases are added to the
<tt>llvm/test</tt> directory. The appropriate sub-directory should be
selected (see the <a href="TestingGuide.html">Testing Guide</a> for
details).</li>
<li>Test cases should be written in
<a href="LangRef.html">LLVM assembly language</a> unless the
feature or regression being tested requires another language (e.g. the
bug being fixed or feature being implemented is in the llvm-gcc C++
front-end, in which case it must be written in C++).</li>
<li>Test cases, especially for regressions, should be reduced as much as
possible, by <a href="Bugpoint.html">bugpoint</a> or
manually. It is unacceptable
to place an entire failing program into <tt>llvm/test</tt> as this creates
a <i>time-to-test</i> burden on all developers. Please keep them short.</li>
</ol>
<p>Note that llvm/test is designed for regression and small feature tests
only. More extensive test cases (e.g., entire applications, benchmarks,
etc) should be added to the <tt>llvm-test</tt> test suite. The llvm-test
suite is for coverage (correctness, performance, etc) testing, not feature
or regression testing.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="quality">Quality</a></div>
<div class="doc_text">
<p>The minimum quality standards that any change must satisfy before being
committed to the main development branch are:</p>
<ol>
<li>Code must adhere to the
<a href="CodingStandards.html">LLVM Coding Standards</a>.</li>
<li>Code must compile cleanly (no errors, no warnings) on at least one
platform.</li>
<li>Bug fixes and new features should <a href="#testcases">include a
testcase</a> so we know if the fix/feature ever regresses in the
future.</li>
<li>Code must pass the dejagnu (<tt>llvm/test</tt>) test suite.</li>
<li>The code must not cause regressions on a reasonable subset of llvm-test,
where "reasonable" depends on the contributor's judgement and the scope
of the change (more invasive changes require more testing). A reasonable
subset is "<tt>llvm-test/MultiSource/Benchmarks</tt>".</li>
</ol>
<p>Additionally, the committer is responsible for addressing any problems
found in the future that the change is responsible for. For example:</p>
<ul>
<li>The code should compile cleanly on all supported platforms.</li>
<li>The changes should not cause any correctness regressions in the
<tt>llvm-test</tt> suite and must not cause any major performance
regressions.</li>
<li>The change set should not cause performance or correctness regressions
for the LLVM tools.</li>
<li>The changes should not cause performance or correctness regressions in
code compiled by LLVM on all applicable targets.</li>
<li>You are expected to address any <a href="http://llvm.org/bugs/">bugzilla
bugs</a> that result from your change.</li>
</ul>
<p>We prefer for this to be handled before submission but understand that it
isn't possible to test all of this for every submission. Our nightly
testing
infrastructure normally finds these problems. A good rule of thumb is to
check the nightly testers for regressions the day after your change.</p>
<p>Commits that violate these quality standards (e.g. are very broken) may
be reverted. This is necessary when the change blocks other developers from
making progress. The developer is welcome to re-commit the change after
the problem has been fixed.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection">
<a name="commitaccess">Obtaining Commit Access</a></div>
<div class="doc_text">
<p>
We grant commit access to contributors with a track record of submitting high
quality patches. If you would like commit access, please send an email to the
<a href="mailto:llvm-oversight@cs.uiuc.edu">LLVM oversight group</a>.</p>
<p>If you have recently been granted commit access, these policies apply:</p>
<ol>
<li>You are granted <i>commit-after-approval</i> to all parts of LLVM.
To get approval, submit a <a href="#patches">patch</a> to
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">
llvm-commits</a>. When approved you may commit it yourself.</li>
<li>You are allowed to commit patches without approval which you think are
obvious. This is clearly a subjective decision &mdash; we simply expect you
to use good judgement. Examples include: fixing build breakage, reverting
obviously broken patches, documentation/comment changes, any other minor
changes.</li>
<li>You are allowed to commit patches without approval to those portions
of LLVM that you have contributed or maintain (i.e., have been assigned
responsibility for), with the proviso that such commits must not break the
build. This is a "trust but verify" policy and commits of this nature are
reviewed after they are committed.</li>
<li>Multiple violations of these policies or a single egregious violation
may cause commit access to be revoked.</li>
</ol>
<p>In any case, your changes are still subject to <a href="#reviews">code
review</a> (either before or after they are committed, depending on the nature
of the change). You are encouraged to review other peoples' patches as well,
but you aren't required to.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="newwork">Making a Major Change</a></div>
<div class="doc_text">
<p>When a developer begins a major new project with the aim of contributing
it back to LLVM, s/he should inform the community with an email to
the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">llvmdev</a>
email list, to the extent possible. The reason for this is to:
<ol>
<li>keep the community informed about future changes to LLVM, </li>
<li>avoid duplication of effort by preventing multiple parties working on
the same thing and not knowing about it, and</li>
<li>ensure that any technical issues around the proposed work are
discussed and resolved before any significant work is done.</li>
</ol>
<p>The design of LLVM is carefully controlled to ensure that all the pieces
fit together well and are as consistent as possible. If you plan to make a
major change to the way LLVM works or want to add a major new extension, it
is a good idea to get consensus with the development
community before you start working on it.</p>
<p>Once the design of the new feature is finalized, the work itself should be
done as a series of <a href="#incremental">incremental changes</a>, not as
a long-term development branch.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="incremental">Incremental Development</a>
</div>
<div class="doc_text">
<p>In the LLVM project, we do all significant changes as a series of
incremental patches. We have a strong dislike for huge changes or
long-term development branches. Long-term development branches have a
number of drawbacks:</p>
<ol>
<li>Branches must have mainline merged into them periodically. If the branch
development and mainline development occur in the same pieces of code,
resolving merge conflicts can take a lot of time.</li>
<li>Other people in the community tend to ignore work on branches.</li>
<li>Huge changes (produced when a branch is merged back onto mainline) are
extremely difficult to <a href="#reviews">code review</a>.</li>
<li>Branches are not routinely tested by our nightly tester
infrastructure.</li>
<li>Changes developed as monolithic large changes often don't work until the
entire set of changes is done. Breaking it down into a set of smaller
changes increases the odds that any of the work will be committed to the
main repository.</li>
</ol>
<p>
To address these problems, LLVM uses an incremental development style and we
require contributors to follow this practice when making a large/invasive
change. Some tips:</p>
<ul>
<li>Large/invasive changes usually have a number of secondary changes that
are required before the big change can be made (e.g. API cleanup, etc).
These sorts of changes can often be done before the major change is done,
independently of that work.</li>
<li>The remaining inter-related work should be decomposed into unrelated
sets of changes if possible. Once this is done, define the first increment
and get consensus on what the end goal of the change is.</li>
<li>Each change in the set can be stand alone (e.g. to fix a bug), or part
of a planned series of changes that works towards the development goal.</li>
<li>Each change should be kept as small as possible. This simplifies your
work (into a logical progression), simplifies code review and reduces the
chance that you will get negative feedback on the change. Small increments
also facilitate the maintenance of a high quality code base.</li>
<li>Often, an independent precursor to a big change is to add a new API and
slowly migrate clients to use the new API. Each change to use the new
API is often "obvious" and can be committed without review. Once the
new API is in place and used, it is much easier to replace the
underlying implementation of the API. This implementation change is
logically separate from the API change.</li>
</ul>
<p>If you are interested in making a large change, and this scares you, please
make sure to first <a href="#newwork">discuss the change/gather
consensus</a> then ask about the best way to go about making
the change.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="attribution">Attribution of
Changes</a></div>
<div class="doc_text">
<p>We believe in correct attribution of contributions to
their contributors. However, we do not want the source code to be littered
with random attributions (this is noisy/distracting and revision control
keeps a perfect history of this anyway). As such, we follow these rules:</p>
<ol>
<li>Developers who originate new files in LLVM should place their name at
the top of the file per the
<a href="CodingStandards.html#scf_commenting">Coding Standards</a>.</li>
<li>There should be only one name at the top of the file and it should be
the person who created the file.</li>
<li>Placing your name in the file does not imply <a
href="#clp">copyright</a>: it is only used to attribute the file to
its original author.</li>
<li>Developers should be aware that after some time has passed, the name at
the top of a file may become meaningless as maintenance/ownership of files
changes. Despite this, once set, the attribution of a file never changes.
Revision control keeps an accurate history of contributions.</li>
<li>Developers should maintain their entry in the
<a href="http://llvm.org/svn/llvm-project/llvm/trunk/CREDITS.TXT">CREDITS.txt</a>
file to summarize their contributions.</li>
<li>Commit comments should contain correct attribution of the person who
submitted the patch if that person is not the committer (i.e. when a
developer with commit privileges commits a patch for someone else).</li>
</ol>
</div>
<!--=========================================================================-->
<div class="doc_section">
<a name="clp">Copyright, License, and Patents</a>
</div>
<!--=========================================================================-->
<div class="doc_text">
<p>This section addresses the issues of copyright, license and patents for
the LLVM project.
Currently, the University of Illinois is the LLVM copyright holder and the
terms of its license to LLVM users and developers is the
<a href="http://www.opensource.org/licenses/UoI-NCSA.php">University of
Illinois/NCSA Open Source License</a>.</p>
<div class="doc_notes">
<p><b>NOTE: This section deals with legal matters but does not provide
legal advice. We are not lawyers, please seek legal counsel from an
attorney.</b></p>
</div>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="copyright">Copyright</a></div>
<div class="doc_text">
<p>
<p>For consistency and ease of management, the project requires the
copyright for all LLVM software to be held by a single copyright holder:
the University of Illinois (UIUC).</p>
<p>
Although UIUC may eventually reassign the copyright of the software to another
entity (e.g. a dedicated non-profit "LLVM Organization", or something)
the intent for the project is to always have a single entity hold the
copyrights to LLVM at any given time.</p>
<p>We believe that having a single copyright
holder is in the best interests of all developers and users as it greatly
reduces the managerial burden for any kind of administrative or technical
decisions about LLVM. The goal of the LLVM project is to always keep the code
open and <a href="#license">licensed under a very liberal license</a>.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="license">License</a></div>
<div class="doc_text">
<p>We intend to keep LLVM perpetually open source
and to use a liberal open source license. The current license is the
<a href="http://www.opensource.org/licenses/UoI-NCSA.php">
University of Illinois/NCSA Open Source License</a>, which boils
down to this:</p>
<ul>
<li>You can freely distribute LLVM.</li>
<li>You must retain the copyright notice if you redistribute LLVM.</li>
<li>Binaries derived from LLVM must reproduce the copyright notice.</li>
<li>You can't use our names to promote your LLVM derived products.</li>
<li>There's no warranty on LLVM at all.</li>
</ul>
<p>We believe this fosters the widest adoption of LLVM because it <b>allows
commercial products to be derived from LLVM</b> with few restrictions and
without a requirement for making any derived works also open source (i.e.
LLVM's license is not a "copyleft" license like the GPL). We suggest that you
read the <a href="http://www.opensource.org/licenses/UoI-NCSA.php">License</a>
if further clarification is needed.</p>
<p>Note that the LLVM Project does distribute llvm-gcc, <b>which is GPL.</b>
This means that anything "linked" into llvm-gcc must itself be compatible
with the GPL, and must be releasable under the terms of the GPL. This implies
that <b>any code linked into llvm-gcc and distributed to others may be subject
to the viral aspects of the GPL</b> (for example, a proprietary code generator
linked into llvm-gcc must be made available under the GPL). This is not a
problem for code already distributed under a more liberal license (like the
UIUC license), and does not affect code generated by llvm-gcc. It may be a
problem if you intend to base commercial development on llvm-gcc without
redistributing your source code.</p>
<p>We have no plans to change the license of LLVM. If you have questions
or comments about the license, please contact the <a
href="mailto:llvm-oversight@cs.uiuc.edu">LLVM Oversight Group</a>.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="patents">Patents</a></div>
<div class="doc_text">
<p>To the best of our knowledge, LLVM does not infringe on any patents (we have
actually removed code from LLVM in the past that was found to infringe).
Having code in LLVM that infringes on patents would violate an important
goal of the project by making it hard or impossible to reuse the code for
arbitrary purposes (including commercial use).</p>
<p>When contributing code, we expect contributors to notify us of any potential
for patent-related trouble with their changes. If you own the rights to a
patent and would like to contribute code to LLVM that relies on it, we
require that you sign an agreement that allows any other user of LLVM to
freely use your patent. Please contact the <a
href="mailto:llvm-oversight@cs.uiuc.edu">oversight group</a> for more
details.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="devagree">Developer Agreements</a></div>
<div class="doc_text">
<p>With regards to the LLVM copyright and licensing, developers agree to
assign their copyrights to UIUC for any contribution made so that
the entire software base can be managed by a single copyright holder. This
implies that any contributions can be licensed under the license that the
project uses.</p>
</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>
Written by the
<a href="mailto:llvm-oversight@cs.uiuc.edu">LLVM Oversight Group</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>
</body>
</html>

View File

@@ -1,479 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Exception Handling in LLVM</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>
<div class="doc_title">Exception Handling in LLVM</div>
<table class="layout" style="width:100%">
<tr class="layout">
<td class="left">
<ul>
<li><a href="#introduction">Introduction</a>
<ol>
<li><a href="#itanium">Itanium ABI Zero-cost Exception Handling</a></li>
<li><a href="#overview">Overview</a></li>
</ol></li>
<li><a href="#codegen">LLVM Code Generation</a>
<ol>
<li><a href="#throw">Throw</a></li>
<li><a href="#try_catch">Try/Catch</a></li>
<li><a href="#cleanups">Cleanups</a></li>
<li><a href="#throw_filters">Throw Filters</a></li>
<li><a href="#restrictions">Restrictions</a></li>
</ol></li>
<li><a href="#format_common_intrinsics">Exception Handling Intrinsics</a>
<ol>
<li><a href="#llvm_eh_exception"><tt>llvm.eh.exception</tt></a></li>
<li><a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a></li>
<li><a href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a></li>
</ol></li>
<li><a href="#asm">Asm Table Formats</a>
<ol>
<li><a href="#unwind_tables">Exception Handling Frame</a></li>
<li><a href="#exception_tables">Exception Tables</a></li>
</ol></li>
<li><a href="#todo">ToDo</a></li>
</ul>
</td>
</tr></table>
<div class="doc_author">
<p>Written by <a href="mailto:jlaskey@mac.com">Jim Laskey</a></p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="introduction">Introduction</a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>This document is the central repository for all information pertaining to
exception handling in LLVM. It describes the format that LLVM exception
handling information takes, which is useful for those interested in creating
front-ends or dealing directly with the information. Further, this document
provides specific examples of what exception handling information is used for
C/C++.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="itanium">Itanium ABI Zero-cost Exception Handling</a>
</div>
<div class="doc_text">
<p>Exception handling for most programming languages is designed to recover from
conditions that rarely occur during general use of an application. To that end,
exception handling should not interfere with the main flow of an
application&apos;s algorithm by performing checkpointing tasks such as saving
the current pc or register state.</p>
<p>The Itanium ABI Exception Handling Specification defines a methodology for
providing outlying data in the form of exception tables without inlining
speculative exception handling code in the flow of an application&apos;s main
algorithm. Thus, the specification is said to add "zero-cost" to the normal
execution of an application.</p>
<p>A more complete description of the Itanium ABI exception handling runtime
support of can be found at <a
href="http://www.codesourcery.com/cxx-abi/abi-eh.html">Itanium C++ ABI:
Exception Handling.</a> A description of the exception frame format can be
found at <a
href="http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-
Core-generic/ehframechpt.html">Exception Frames</a>, with details of the Dwarf
specification at <a href="http://www.eagercon.com/dwarf/dwarf3std.htm">Dwarf 3
Standard.</a> A description for the C++ exception table formats can be found at
<a href="http://www.codesourcery.com/cxx-abi/exceptions.pdf">Exception Handling
Tables.</a></p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="overview">Overview</a>
</div>
<div class="doc_text">
<p>When an exception is thrown in llvm code, the runtime does a best effort to
find a handler suited to process the circumstance.</p>
<p>The runtime first attempts to find an <i>exception frame</i> corresponding to
the function where the exception was thrown. If the programming language (ex.
C++) supports exception handling, the exception frame contains a reference to an
exception table describing how to process the exception. If the language (ex.
C) does not support exception handling or if the exception needs to be forwarded
to a prior activation, the exception frame contains information about how to
unwind the current activation and restore the state of the prior activation.
This process is repeated until the exception is handled. If the exception is
not handled and no activations remain, then the application is terminated with
an appropriate error message.</p>
<p>Since different programming languages have different behaviors when handling
exceptions, the exception handling ABI provides a mechanism for supplying
<i>personalities.</i> An exception handling personality is defined by way of a
<i>personality function</i> (ex. for C++ <tt>__gxx_personality_v0</tt>) which
receives the context of the exception, an <i>exception structure</i> containing
the exception object type and value, and a reference to the exception table for
the current function. The personality function for the current compile unit is
specified in a <i>common exception frame</i>.</p>
<p>The organization of an exception table is language dependent. For C++, an
exception table is organized as a series of code ranges defining what to do if
an exception occurs in that range. Typically, the information associated with a
range defines which types of exception objects (using C++ <i>type info</i>) that
are handled in that range, and an associated action that should take place.
Actions typically pass control to a <i>landing pad</i>.</p>
<p>A landing pad corresponds to the code found in the catch portion of a
try/catch sequence. When execution resumes at a landing pad, it receives the
exception structure and a selector corresponding to the <i>type</i> of exception
thrown. The selector is then used to determine which catch should actually
process the exception.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_section">
<a name="codegen">LLVM Code Generation</a>
</div>
<div class="doc_text">
<p>At the time of this writing, only C++ exception handling support is available
in LLVM. So the remainder of this document will be somewhat C++-centric.</p>
<p>From the C++ developers perspective, exceptions are defined in terms of the
<tt>throw</tt> and <tt>try/catch</tt> statements. In this section we will
describe the implementation of llvm exception handling in terms of C++
examples.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="throw">Throw</a>
</div>
<div class="doc_text">
<p>Languages that support exception handling typically provide a <tt>throw</tt>
operation to initiate the exception process. Internally, a throw operation
breaks down into two steps. First, a request is made to allocate exception
space for an exception structure. This structure needs to survive beyond the
current activation. This structure will contain the type and value of the
object being thrown. Second, a call is made to the runtime to raise the
exception, passing the exception structure as an argument.</p>
<p>In C++, the allocation of the exception structure is done by the
<tt>__cxa_allocate_exception</tt> runtime function. The exception raising is
handled by <tt>__cxa_throw</tt>. The type of the exception is represented using
a C++ RTTI type info structure.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="try_catch">Try/Catch</a>
</div>
<div class="doc_text">
<p>A call within the scope of a try statement can potentially raise an exception.
In those circumstances, the LLVM C++ front-end replaces the call with an
<tt>invoke</tt> instruction. Unlike a call, the invoke has two potential
continuation points; where to continue when the call succeeds as per normal, and
where to continue if the call raises an exception, either by a throw or the
unwinding of a throw.</p>
<p>The term used to define a the place where an invoke continues after an
exception is called a <i>landing pad</i>. LLVM landing pads are conceptually
alternative function entry points where a exception structure reference and a type
info index are passed in as arguments. The landing pad saves the exception
structure reference and then proceeds to select the catch block that corresponds
to the type info of the exception object.</p>
<p>Two llvm intrinsic functions are used convey information about the landing
pad to the back end.</p>
<p><a href="#llvm_eh_exception"><tt>llvm.eh.exception</tt></a> takes no
arguments and returns the exception structure reference. The backend replaces
this intrinsic with the code that accesses the first argument of a call. The
LLVM C++ front end generates code to save this value in an alloca location for
further use in the landing pad and catch code.</p>
<p><a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> takes a minimum of
three arguments. The first argument is the reference to the exception
structure. The second argument is a reference to the personality function to be
used for this try catch sequence. Each of the remaining arguments is either a
reference to the type info for a catch statement,
a <a href="#throw_filters">filter</a> expression,
or the number zero representing a <a href="#cleanups">cleanup</a>.
The exception is tested against the arguments sequentially from first to last.
The result of the <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> is a
positive number if the exception matched a type info, a negative number if it matched
a filter, and zero if it matched a cleanup. If nothing is matched, the behaviour of
the program is <a href="#restrictions">undefined</a>.
The LLVM C++ front end generates code to save the selector value in an alloca
location for further use in the landing pad and catch code.
If a type info matched then the selector value is the index of the type info in
the exception table, which can be obtained using the
<a href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a> intrinsic.</p>
<p>Once the landing pad has the type info selector, the code branches to the
code for the first catch. The catch then checks the value of the type info
selector against the index of type info for that catch. Since the type info
index is not known until all the type info have been gathered in the backend,
the catch code will call the <a
href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a> intrinsic to
determine the index for a given type info. If the catch fails to match the
selector then control is passed on to the next catch. Note: Since the landing
pad will not be used if there is no match in the list of type info on the call
to <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a>, then neither the
last catch nor <i>catch all</i> need to perform the the check against the
selector.</p>
<p>Finally, the entry and exit of catch code is bracketed with calls to
<tt>__cxa_begin_catch</tt> and <tt>__cxa_end_catch</tt>.
<tt>__cxa_begin_catch</tt> takes a exception structure reference as an argument
and returns the value of the exception object.</tt> <tt>__cxa_end_catch</tt>
takes a exception structure reference as an argument. This function clears the
exception from the exception space. Note: a rethrow from within the catch may
replace this call with a <tt>__cxa_rethrow</tt>.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="cleanups">Cleanups</a>
</div>
<div class="doc_text">
<p>To handle destructors and cleanups in try code, control may not run directly
from a landing pad to the first catch. Control may actually flow from the
landing pad to clean up code and then to the first catch. Since the required
clean up for each invoke in a try may be different (ex., intervening
constructor), there may be several landing pads for a given try. If cleanups
need to be run, the number zero should be passed as the last
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> argument.
However for C++ a <tt>null i8*</tt> <a href="#restrictions">must</a> be passed
instead.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="throw_filters">Throw Filters</a>
</div>
<div class="doc_text">
<p>C++ allows the specification of which exception types that can be thrown from
a function. To represent this a top level landing pad may exist to filter out
invalid types. To express this in LLVM code the landing pad will call <a
href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a>. The arguments are the
length of the filter expression (the number of type infos plus one), followed by
the type infos themselves.
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> will return a negative
value if the exception does not match any of the type infos. If no match is
found then a call to <tt>__cxa_call_unexpected</tt> should be made, otherwise
<tt>_Unwind_Resume</tt>. Each of these functions require a reference to the
exception structure.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="restrictions">Restrictions</a>
</div>
<div class="doc_text">
<p>The semantics of the invoke instruction require that any exception that
unwinds through an invoke call should result in a branch to the invoke's unwind
label. However such a branch will only happen if the
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> matches.
Thus in order to ensure correct operation, the front-end must only generate
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> calls that are
guaranteed to always match whatever exception unwinds through the invoke.
For most languages it is enough to pass zero, indicating the presence of
a <a href="#cleanups">cleanup</a>, as the last
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> argument.
However for C++ this is not sufficient, because the C++ personality function
will terminate the program if it detects that unwinding the exception only
results in matches with cleanups. For C++ a <tt>null i8*</tt> should
be passed as the last
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> argument instead.
This is interpreted as a catch-all by the C++ personality function, and will
always match.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_section">
<a name="format_common_intrinsics">Exception Handling Intrinsics</a>
</div>
<div class="doc_text">
<p>LLVM uses several intrinsic functions (name prefixed with "llvm.eh") to
provide exception handling information at various points in generated code.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<a name="llvm_eh_exception">llvm.eh.exception</a>
</div>
<div class="doc_text">
<pre>
i8* %<a href="#llvm_eh_exception">llvm.eh.exception</a>( )
</pre>
<p>This intrinsic indicates that the exception structure is available at this
point in the code. The backend will replace this intrinsic with code to fetch
the first argument of a call. The effect is that the intrinsic result is the
exception structure reference.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<a name="llvm_eh_selector">llvm.eh.selector</a>
</div>
<div class="doc_text">
<pre>
i32 %<a href="#llvm_eh_selector">llvm.eh.selector.i32</a>(i8*, i8*, i8*, ...)
i64 %<a href="#llvm_eh_selector">llvm.eh.selector.i64</a>(i8*, i8*, i8*, ...)
</pre>
<p>This intrinsic indicates that the exception selector is available at this
point in the code. The backend will replace this intrinsic with code to fetch
the second argument of a call. The effect is that the intrinsic result is the
exception selector.</p>
<p><a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> takes a minimum of
three arguments. The first argument is the reference to the exception
structure. The second argument is a reference to the personality function to be
used for this try catch sequence. Each of the remaining arguments is either a
reference to the type info for a catch statement,
a <a href="#throw_filters">filter</a> expression,
or the number zero representing a <a href="#cleanups">cleanup</a>.
The exception is tested against the arguments sequentially from first to last.
The result of the <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> is a
positive number if the exception matched a type info, a negative number if it matched
a filter, and zero if it matched a cleanup. If nothing is matched, the behaviour of
the program is <a href="#restrictions">undefined</a>.
If a type info matched then the selector value is the index of the type info in
the exception table, which can be obtained using the
<a href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a> intrinsic.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<a name="llvm_eh_typeid_for">llvm.eh.typeid.for</a>
</div>
<div class="doc_text">
<pre>
i32 %<a href="#llvm_eh_typeid_for">llvm.eh.typeid.for.i32</a>(i8*)
i64 %<a href="#llvm_eh_typeid_for">llvm.eh.typeid.for.i64</a>(i8*)
</pre>
<p>This intrinsic returns the type info index in the exception table of the
current function. This value can be used to compare against the result of <a
href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a>. The single argument is
a reference to a type info.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_section">
<a name="asm">Asm Table Formats</a>
</div>
<div class="doc_text">
<p>There are two tables that are used by the exception handling runtime to
determine which actions should take place when an exception is thrown.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="unwind_tables">Exception Handling Frame</a>
</div>
<div class="doc_text">
<p>An exception handling frame <tt>eh_frame</tt> is very similar to the unwind
frame used by dwarf debug info. The frame contains all the information
necessary to tear down the current frame and restore the state of the prior
frame. There is an exception handling frame for each function in a compile
unit, plus a common exception handling frame that defines information common to
all functions in the unit.</p>
<p>Todo - Table details here.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="exception_tables">Exception Tables</a>
</div>
<div class="doc_text">
<p>An exception table contains information about what actions to take when an
exception is thrown in a particular part of a function&apos;s code. There is
one exception table per function except leaf routines and functions that have
only calls to non-throwing functions will not need an exception table.</p>
<p>Todo - Table details here.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_section">
<a name="todo">ToDo</a>
</div>
<div class="doc_text">
<ol>
<li><p>Testing/Testing/Testing.</li></p>
</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>

View File

@@ -16,7 +16,6 @@
<li><a href="#introduction">Introduction and Warning</a></li>
<li><a href="#intrinsic">Adding a new intrinsic function</a></li>
<li><a href="#instruction">Adding a new instruction</a></li>
<li><a href="#sdnode">Adding a new SelectionDAG node</a></li>
<li><a href="#type">Adding a new type</a>
<ol>
<li><a href="#fund_type">Adding a new fundamental type</a></li>
@@ -25,9 +24,7 @@
</ol>
<div class="doc_author">
<p>Written by <a href="http://misha.brukman.net">Misha Brukman</a>,
Brad Jones, Nate Begeman,
and <a href="http://nondot.org/sabre">Chris Lattner</a></p>
<p>Written by <a href="http://misha.brukman.net">Misha Brukman</a></p>
</div>
<!-- *********************************************************************** -->
@@ -53,9 +50,9 @@ different passes that you intend to use with your extension, and there are
<em>many</em> LLVM analyses and transformations, so it may be quite a bit of
work.</p>
<p>Adding an <a href="#intrinsic">intrinsic function</a> is far easier than
adding an instruction, and is transparent to optimization passes. If your added
functionality can be expressed as a
<p>Adding an <a href="#intrinsic">intrinsic function</a> is easier than adding
an instruction, and is transparent to optimization passes which treat it as an
unanalyzable function. If your added functionality can be expressed as a
function call, an intrinsic function is the method of choice for LLVM
extension.</p>
@@ -65,6 +62,11 @@ looking to do can be done with already-existing infrastructure, or if maybe
someone else is already working on it. You will save yourself a lot of time and
effort by doing so.</p>
<p>Finally, these are my notes, and since my extensions are not complete, I may
be missing steps. If you find some omissions, please let me know <a
href="http://misha.brukman.net/contact.html">directly</a> or post on <a
href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM-dev</a>.</p>
</div>
<!-- *********************************************************************** -->
@@ -85,138 +87,33 @@ function and then be turned into an instruction if warranted.</p>
what the restrictions are. Talk to other people about it so that you are
sure it's a good idea.</li>
<li><tt>llvm/include/llvm/Intrinsics*.td</tt>:
Add an entry for your intrinsic. Describe its memory access characteristics
for optimization (this controls whether it will be DCE'd, CSE'd, etc). Note
that any intrinsic using the <tt>llvm_int_ty</tt> type for an argument will
be deemed by <tt>tblgen</tt> as overloaded and the corresponding suffix
will be required on the intrinsic's name.</li>
<li><tt>llvm/include/llvm/Intrinsics.h</tt>:
add an enum in the <tt>llvm::Intrinsic</tt> namespace</li>
<li><tt>llvm/lib/Analysis/ConstantFolding.cpp</tt>: If it is possible to
constant fold your intrinsic, add support to it in the
<li><tt>llvm/lib/CodeGen/IntrinsicLowering.cpp</tt>:
implement the lowering for this intrinsic</li>
<li><tt>llvm/lib/VMCore/Verifier.cpp</tt>:
Add code to check the invariants of the intrinsic are respected.</li>
<li><tt>llvm/lib/VMCore/Function.cpp (<tt>Function::getIntrinsicID()</tt>)</tt>:
Identify the new intrinsic function, returning the enum for the intrinsic
that you added.</li>
<li><tt>llvm/lib/Analysis/BasicAliasAnalysis.cpp</tt>: If the new intrinsic does
not access memory or does not write to memory, add it to the relevant list
of functions.</li>
<li><tt>llvm/lib/Transforms/Utils/Local.cpp</tt>: If it is possible to constant
propagate your intrinsic, add support to it in the
<tt>canConstantFoldCallTo</tt> and <tt>ConstantFoldCall</tt> functions.</li>
<li><tt>llvm/test/Regression/*</tt>: Add test cases for your test cases to the
test suite</li>
<li>Test your intrinsic</li>
<li><tt>llvm/test/Regression/*</tt>: add your test cases to the test suite.</li>
</ol>
<p>Once the intrinsic has been added to the system, you must add code generator
support for it. Generally you must do the following steps:</p>
<dl>
<dt>Add support to the C backend in <tt>lib/Target/CBackend/</tt></dt>
<dd>Depending on the intrinsic, there are a few ways to implement this. For
most intrinsics, it makes sense to add code to lower your intrinsic in
<tt>LowerIntrinsicCall</tt> in <tt>lib/CodeGen/IntrinsicLowering.cpp</tt>.
Second, if it makes sense to lower the intrinsic to an expanded sequence of C
code in all cases, just emit the expansion in <tt>visitCallInst</tt> in
<tt>Writer.cpp</tt>. If the intrinsic has some way to express it with GCC
(or any other compiler) extensions, it can be conditionally supported based on
the compiler compiling the CBE output (see <tt>llvm.prefetch</tt> for an
example).
Third, if the intrinsic really has no way to be lowered, just have the code
generator emit code that prints an error message and calls abort if executed.
</dd>
<dl>
<dt>Add support to the .td file for the target(s) of your choice in
<tt>lib/Target/*/*.td</tt>.</dt>
<dd>This is usually a matter of adding a pattern to the .td file that matches
the intrinsic, though it may obviously require adding the instructions you
want to generate as well. There are lots of examples in the PowerPC and X86
backend to follow.</dd>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="sdnode">Adding a new SelectionDAG node</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>As with intrinsics, adding a new SelectionDAG node to LLVM is much easier
than adding a new instruction. New nodes are often added to help represent
instructions common to many targets. These nodes often map to an LLVM
instruction (add, sub) or intrinsic (byteswap, population count). In other
cases, new nodes have been added to allow many targets to perform a common task
(converting between floating point and integer representation) or capture more
complicated behavior in a single node (rotate).</p>
<ol>
<li><tt>include/llvm/CodeGen/SelectionDAGNodes.h</tt>:
Add an enum value for the new SelectionDAG node.</li>
<li><tt>lib/CodeGen/SelectionDAG/SelectionDAG.cpp</tt>:
Add code to print the node to <tt>getOperationName</tt>. If your new node
can be evaluated at compile time when given constant arguments (such as an
add of a constant with another constant), find the <tt>getNode</tt> method
that takes the appropriate number of arguments, and add a case for your node
to the switch statement that performs constant folding for nodes that take
the same number of arguments as your new node.</li>
<li><tt>lib/CodeGen/SelectionDAG/LegalizeDAG.cpp</tt>:
Add code to <a href="CodeGenerator.html#selectiondag_legalize">legalize,
promote, and expand</a> the node as necessary. At a minimum, you will need
to add a case statement for your node in <tt>LegalizeOp</tt> which calls
LegalizeOp on the node's operands, and returns a new node if any of the
operands changed as a result of being legalized. It is likely that not all
targets supported by the SelectionDAG framework will natively support the
new node. In this case, you must also add code in your node's case
statement in <tt>LegalizeOp</tt> to Expand your node into simpler, legal
operations. The case for <tt>ISD::UREM</tt> for expanding a remainder into
a divide, multiply, and a subtract is a good example.</li>
<li><tt>lib/CodeGen/SelectionDAG/LegalizeDAG.cpp</tt>:
If targets may support the new node being added only at certain sizes, you
will also need to add code to your node's case statement in
<tt>LegalizeOp</tt> to Promote your node's operands to a larger size, and
perform the correct operation. You will also need to add code to
<tt>PromoteOp</tt> to do this as well. For a good example, see
<tt>ISD::BSWAP</tt>,
which promotes its operand to a wider size, performs the byteswap, and then
shifts the correct bytes right to emulate the narrower byteswap in the
wider type.</li>
<li><tt>lib/CodeGen/SelectionDAG/LegalizeDAG.cpp</tt>:
Add a case for your node in <tt>ExpandOp</tt> to teach the legalizer how to
perform the action represented by the new node on a value that has been
split into high and low halves. This case will be used to support your
node with a 64 bit operand on a 32 bit target.</li>
<li><tt>lib/CodeGen/SelectionDAG/DAGCombiner.cpp</tt>:
If your node can be combined with itself, or other existing nodes in a
peephole-like fashion, add a visit function for it, and call that function
from <tt></tt>. There are several good examples for simple combines you
can do; <tt>visitFABS</tt> and <tt>visitSRL</tt> are good starting places.
</li>
<li><tt>lib/Target/PowerPC/PPCISelLowering.cpp</tt>:
Each target has an implementation of the <tt>TargetLowering</tt> class,
usually in its own file (although some targets include it in the same
file as the DAGToDAGISel). The default behavior for a target is to
assume that your new node is legal for all types that are legal for
that target. If this target does not natively support your node, then
tell the target to either Promote it (if it is supported at a larger
type) or Expand it. This will cause the code you wrote in
<tt>LegalizeOp</tt> above to decompose your new node into other legal
nodes for this target.</li>
<li><tt>lib/Target/TargetSelectionDAG.td</tt>:
Most current targets supported by LLVM generate code using the DAGToDAG
method, where SelectionDAG nodes are pattern matched to target-specific
nodes, which represent individual instructions. In order for the targets
to match an instruction to your new node, you must add a def for that node
to the list in this file, with the appropriate type constraints. Look at
<tt>add</tt>, <tt>bswap</tt>, and <tt>fadd</tt> for examples.</li>
<li><tt>lib/Target/PowerPC/PPCInstrInfo.td</tt>:
Each target has a tablegen file that describes the target's instruction
set. For targets that use the DAGToDAG instruction selection framework,
add a pattern for your new node that uses one or more target nodes.
Documentation for this is a bit sparse right now, but there are several
decent examples. See the patterns for <tt>rotl</tt> in
<tt>PPCInstrInfo.td</tt>.</li>
<li>TODO: document complex patterns.</li>
<li><tt>llvm/test/Regression/CodeGen/*</tt>: Add test cases for your new node
to the test suite. <tt>llvm/test/Regression/CodeGen/X86/bswap.ll</tt> is
a good example.</li>
</ol>
<p>If this intrinsic requires code generator support (ie, it cannot be lowered).
You should also add support to the code generator in question.</p>
</div>
@@ -228,7 +125,7 @@ complicated behavior in a single node (rotate).</p>
<div class="doc_text">
<p><span class="doc_warning">WARNING: adding instructions changes the bitcode
<p><span class="doc_warning">WARNING: adding instructions changes the bytecode
format, and it will take some effort to maintain compatibility with
the previous version.</span> Only add an instruction if it is absolutely
necessary.</p>
@@ -251,23 +148,14 @@ necessary.</p>
add the grammar on how your instruction can be read and what it will
construct as a result</li>
<li><tt>llvm/lib/Bitcode/Reader/Reader.cpp</tt>:
add a case for your instruction and how it will be parsed from bitcode</li>
<li><tt>llvm/lib/Bytecode/Reader/InstructionReader.cpp</tt>:
add a case for your instruction and how it will be parsed from bytecode</li>
<li><tt>llvm/lib/VMCore/Instruction.cpp</tt>:
add a case for how your instruction will be printed out to assembly</li>
<li><tt>llvm/lib/VMCore/Instructions.cpp</tt>:
implement the class you defined in
<tt>llvm/include/llvm/Instructions.h</tt></li>
<li>Test your instruction</li>
<li><tt>llvm/lib/Target/*</tt>:
Add support for your instruction to code generators, or add a lowering
pass.</li>
<li><tt>llvm/test/Regression/*</tt>: add your test cases to the test suite.</li>
implement the class you defined in <tt>llvm/include/llvm/Instructions.h</tt></li>
</ol>
@@ -285,7 +173,7 @@ to understand this new instruction.</p>
<div class="doc_text">
<p><span class="doc_warning">WARNING: adding new types changes the bitcode
<p><span class="doc_warning">WARNING: adding new types changes the bytecode
format, and will break compatibility with currently-existing LLVM
installations.</span> Only add new types if it is absolutely necessary.</p>
@@ -300,8 +188,11 @@ installations.</span> Only add new types if it is absolutely necessary.</p>
<ol>
<li><tt>llvm/include/llvm/Type.def</tt>:
add enum for the type</li>
<li><tt>llvm/include/llvm/Type.h</tt>:
add enum for the new type; add static <tt>Type*</tt> for this type</li>
add ID number for the new type; add static <tt>Type*</tt> for this type</li>
<li><tt>llvm/lib/VMCore/Type.cpp</tt>:
add mapping from <tt>TypeID</tt> =&gt; <tt>Type*</tt>;
@@ -324,53 +215,7 @@ installations.</span> Only add new types if it is absolutely necessary.</p>
<div class="doc_text">
<ol>
<li><tt>llvm/include/llvm/Type.h</tt>:
add enum for the new type; add a forward declaration of the type
also</li>
<li><tt>llvm/include/llvm/DerivedTypes.h</tt>:
add new class to represent new class in the hierarchy; add forward
declaration to the TypeMap value type</li>
<li><tt>llvm/lib/VMCore/Type.cpp</tt>:
add support for derived type to:
<div class="doc_code">
<pre>
std::string getTypeDescription(const Type &amp;Ty,
std::vector&lt;const Type*&gt; &amp;TypeStack)
bool TypesEqual(const Type *Ty, const Type *Ty2,
std::map&lt;const Type*, const Type*&gt; &amp; EqTypes)
</pre>
</div>
add necessary member functions for type, and factory methods</li>
<li><tt>llvm/lib/AsmReader/Lexer.l</tt>:
add ability to parse in the type from text assembly</li>
<li><tt>llvm/lib/BitCode/Writer/Writer.cpp</tt>:
modify <tt>void BitcodeWriter::outputType(const Type *T)</tt> to serialize
your type</li>
<li><tt>llvm/lib/BitCode/Reader/Reader.cpp</tt>:
modify <tt>const Type *BitcodeReader::ParseType()</tt> to read your data
type</li>
<li><tt>llvm/lib/VMCore/AsmWriter.cpp</tt>:
modify
<div class="doc_code">
<pre>
void calcTypeName(const Type *Ty,
std::vector&lt;const Type*&gt; &amp;TypeStack,
std::map&lt;const Type*,std::string&gt; &amp;TypeNames,
std::string &amp; Result)
</pre>
</div>
to output the new derived type
</li>
</ol>
<p>TODO</p>
</div>
@@ -383,7 +228,8 @@ void calcTypeName(const Type *Ty,
<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">The LLVM Compiler Infrastructure</a>
<a href="http://misha.brukman.net">Misha Brukman</a><br>
<a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a>
<br>
Last modified: $Date$
</address>

View File

@@ -36,11 +36,12 @@
<li><a href="#build">Build Problems</a>
<ol>
<li>When I run configure, it finds the wrong C compiler.</li>
<li>I compile the code, and I get some error about <tt>/localhome</tt>.</li>
<li>The <tt>configure</tt> script finds the right C compiler, but it uses the
LLVM linker from a previous build. What do I do?</li>
<li>When creating a dynamic library, I get a strange GLIBC error.</li>
<li>I've updated my source tree from Subversion, and now my build is trying
to use a file/directory that doesn't exist.</li>
<li>I've updated my source tree from CVS, and now my build is trying to use a
file/directory that doesn't exist.</li>
<li>I've modified a Makefile in my source tree, but my build tree keeps using
the old version. What do I do?</li>
<li>I've upgraded to a new version of LLVM, and I get strange build
@@ -50,21 +51,8 @@
<li>Compiling LLVM with GCC 3.3.2 fails, what should I do?</li>
<li>When I use the test suite, all of the C Backend tests fail. What is
wrong?</li>
<li>After Subversion update, rebuilding gives the error "No rule to make
target".</li>
<li><a href="#llvmc">The <tt>llvmc</tt> program gives me errors/doesn't
work.</li></a>
</ol></li>
<li><a href="#felangs">Source Languages</a>
<ol>
<li><a href="#langs">What source languages are supported?</a></li>
<li><a href="#langhlsupp">What support is there for higher level source
language constructs for building a compiler?</a></li>
<li><a href="GetElementPtr.html">I don't understand the GetElementPtr
instruction. Help!</a></li>
</ol>
<li><a href="#cfe">Using the GCC Front End</a>
<ol>
<li>
@@ -77,31 +65,23 @@
When I compile code using the LLVM GCC front end, it complains that it
cannot find libcrtend.a.
</li>
<li>
How can I disable all optimizations when compiling code using the LLVM GCC front end?
</li>
<li><a href="#translatec++">Can I use LLVM to convert C++ code to C code?</a></li>
</ol>
</li>
<li><a href="#cfe_code">Questions about code generated by the GCC front-end</a>
<ol>
<li><a href="#__main">What is this <tt>__main()</tt> call that gets inserted into
<tt>main()</tt>?</a></li>
<li><a href="#iosinit">What is this <tt>llvm.global_ctors</tt> and
<li>What is this <tt>__main()</tt> call that gets inserted into
<tt>main()</tt>?</li>
<li>Where did all of my code go??</li>
<li>What is this <tt>llvm.global_ctors</tt> and
<tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I
#include &lt;iostream&gt;?</a></li>
<li><a href="#codedce">Where did all of my code go??</a></li>
<li><a href="#undef">What is this "<tt>undef</tt>" thing that shows up in my code?</a></li>
#include &lt;iostream&gt;?</li>
</ol>
</li>
</ol>
<div class="doc_author">
<p>Written by <a href="http://llvm.org">The LLVM Team</a></p>
<p>Written by <a href="http://llvm.cs.uiuc.edu">The LLVM Team</a></p>
</div>
@@ -141,7 +121,7 @@ Source Initiative (OSI).</p>
<div class="answer">
<p>Yes. The modified source distribution must retain the copyright notice and
follow the three bulletted conditions listed in the <a
href="http://llvm.org/releases/1.3/LICENSE.TXT">LLVM license</a>.</p>
href="http://llvm.cs.uiuc.edu/releases/1.2/LICENSE.TXT">LLVM license</a>.</p>
</div>
<div class="question">
@@ -186,6 +166,10 @@ LLVM have been ported to a plethora of platforms.</p>
<li>The GCC front end code is not as portable as the LLVM suite, so it may not
compile as well on unsupported platforms.</li>
<li>The Python test classes are more UNIX-centric than they should be, so
porting to non-UNIX like platforms (i.e. Windows, MacOS 9) will require some
effort.</li>
<li>The LLVM build system relies heavily on UNIX shell tools, like the Bourne
Shell and sed. Porting to systems without these tools (MacOS 9, Plan 9) will
require more effort.</li>
@@ -216,6 +200,22 @@ explicitly.</p>
</div>
<div class="question">
<p>I compile the code, and I get some error about <tt>/localhome</tt>.</p>
</div>
<div class="answer">
<p>There are several possible causes for this. The first is that you didn't set
a pathname properly when using <tt>configure</tt>, and it defaulted to a
pathname that we use on our research machines.</p>
<p>Another possibility is that we hardcoded a path in our Makefiles. If you see
this, please email the LLVM bug mailing list with the name of the offending
Makefile and a description of what is wrong with it.</p>
</div>
<div class="question">
<p>The <tt>configure</tt> script finds the right C compiler, but it uses the
LLVM linker from a previous build. What do I do?</p>
@@ -257,8 +257,8 @@ your own version of GCC that has shared libraries enabled by default.</p>
</div>
<div class="question">
<p>I've updated my source tree from Subversion, and now my build is trying to
use a file/directory that doesn't exist.</p>
<p>I've updated my source tree from CVS, and now my build is trying to use a
file/directory that doesn't exist.</p>
</div>
<div class="answer">
@@ -313,20 +313,11 @@ clean</tt> and then <tt>make</tt> in the directory that fails to build.</p>
<p>For example, if you built LLVM with the command:</p>
<div class="doc_code">
<pre>
% gmake ENABLE_PROFILING=1
</pre>
</div>
<p><tt>gmake ENABLE_PROFILING=1</tt>
<p>...then you must run the tests with the following commands:</p>
<div class="doc_code">
<pre>
% cd llvm/test
% gmake ENABLE_PROFILING=1
</pre>
</div>
<p><tt>cd llvm/test<br>gmake ENABLE_PROFILING=1</tt></p>
</div>
@@ -358,86 +349,28 @@ build.</p>
</div>
<div class="question">
<p>After Subversion update, rebuilding gives the error
"No rule to make target".</p>
<p>
When I use the test suite, all of the C Backend tests fail. What is
wrong?
</p>
</div>
<div class="answer">
<p>If the error is of the form:</p>
<p>
If you build LLVM and the C Backend tests fail in <tt>llvm/test/Programs</tt>,
then chances are good that the directory pointed to by the LLVM_LIB_SEARCH_PATH
environment variable does not contain the libcrtend.a library.
</p>
<div class="doc_code">
<pre>
gmake[2]: *** No rule to make target `/path/to/somefile', needed by
`/path/to/another/file.d'.<br>
Stop.
</pre>
</div>
<p>This may occur anytime files are moved within the Subversion repository or
removed entirely. In this case, the best solution is to erase all
<tt>.d</tt> files, which list dependencies for source files, and rebuild:</p>
<div class="doc_code">
<pre>
% cd $LLVM_OBJ_DIR
% rm -f `find . -name \*\.d`
% gmake
</pre>
</div>
<p>In other cases, it may be necessary to run <tt>make clean</tt> before
rebuilding.</p>
</div>
<div class="question">
<a name="llvmc"<p>The <tt>llvmc</tt> program gives me errors/doesn't
work.</p></a>
</div>
<div class="answer">
<p><tt>llvmc</tt> is experimental and isn't really supported. We suggest
using <tt>llvm-gcc</tt> instead.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="felangs">Source Languages</a></div>
<div class="question"><p>
<a name="langs">What source languages are supported?</a></p>
</div>
<div class="answer">
<p>LLVM currently has full support for C and C++ source languages. These are
available through a special version of GCC that LLVM calls the
<a href="#cfe">C Front End</a></p>
<p>There is an incomplete version of a Java front end available in the
<tt>java</tt> module. There is no documentation on this yet so
you'll need to download the code, compile it, and try it.</p>
<p>In the <tt>stacker</tt> module is a compiler and runtime
library for the Stacker language, a "toy" language loosely based on Forth.</p>
<p>The PyPy developers are working on integrating LLVM into the PyPy backend
so that PyPy language can translate to LLVM.</p>
</div>
<div class="question"><a name="langhlsupp">
<p>What support is there for a higher level source language constructs for
building a compiler?</a></p>
</div>
<div class="answer">
<p>Currently, there isn't much. LLVM supports an intermediate representation
which is useful for code representation but will not support the high level
(abstract syntax tree) representation needed by most compilers. There are no
facilities for lexical nor semantic analysis. There is, however, a <i>mostly
implemented</i> configuration-driven
<a href="CompilerDriver.html">compiler driver</a> which simplifies the task
of running optimizations, linking, and executable generation.</p>
</div>
<div class="question"><a name="langhlsupp">
<p>I don't understand the GetElementPtr
instruction. Help!</a></p>
</div>
<div class="answer">
<p>See <a href="GetElementPtr.html">The Often Misunderstood GEP
Instruction</a>.</li>
<p>
To fix it, verify that LLVM_LIB_SEARCH_PATH points to the correct directory
and that libcrtend.a is inside. For pre-built LLVM GCC front ends, this
should be the absolute path to
<tt>cfrontend/&lt;<i>platform</i>&gt;/llvm-gcc/bytecode-libs</tt>. If you've
built your own LLVM GCC front end, then ensure that you've built and installed
the libraries in <tt>llvm/runtime</tt> and have LLVM_LIB_SEARCH_PATH pointing
to the <tt>LLVMGCCDIR/bytecode-libs</tt> subdirectory.
</p>
</div>
<!-- *********************************************************************** -->
@@ -463,21 +396,28 @@ or translation to the C back end). That is why configure thinks your system
<p>
To work around this, perform the following steps:
</p>
<ol>
<li>Make sure the CC and CXX environment variables contains the full path to
the LLVM GCC front end.</li>
<li>
Make sure the CC and CXX environment variables contains the full path to the
LLVM GCC front end.
</li>
<li>Make sure that the regular C compiler is first in your PATH. </li>
<li>
Make sure that the regular C compiler is first in your PATH.
</li>
<li>Add the string "-Wl,-native" to your CFLAGS environment variable.</li>
<li>
Add the string "-Wl,-native" to your CFLAGS environment variable.
</li>
</ol>
<p>
This will allow the <tt>llvm-ld</tt> linker to create a native code executable
instead of shell script that runs the JIT. Creating native code requires
standard linkage, which in turn will allow the configure script to find out if
code is not linking on your system because the feature isn't available on your
system.</p>
This will allow the gccld linker to create a native code executable instead of
a shell script that runs the JIT. Creating native code requires standard
linkage, which in turn will allow the configure script to find out if code is
not linking on your system because the feature isn't available on your system.
</p>
</div>
<div class="question">
@@ -489,108 +429,13 @@ find libcrtend.a.
<div class="answer">
<p>
The only way this can happen is if you haven't installed the runtime library. To
correct this, do:</p>
<div class="doc_code">
<pre>
% cd llvm/runtime
% make clean ; make install-bytecode
</pre>
</div>
</div>
<div class="question">
<p>
How can I disable all optimizations when compiling code using the LLVM GCC front end?
In order to find libcrtend.a, you must have the directory in which it lives in
your LLVM_LIB_SEARCH_PATH environment variable. For the binary distribution of
the LLVM GCC front end, this will be the full path of the bytecode-libs
directory inside of the LLVM GCC distribution.
</p>
</div>
<div class="answer">
<p>
Passing "-Wa,-disable-opt -Wl,-disable-opt" will disable *all* cleanup and
optimizations done at the llvm level, leaving you with the truly horrible
code that you desire.
</p>
</div>
<div class="question">
<p>
<a name="translatec++">Can I use LLVM to convert C++ code to C code?</a>
</p>
</div>
<div class="answer">
<p>Yes, you can use LLVM to convert code from any language LLVM supports to C.
Note that the generated C code will be very low level (all loops are lowered
to gotos, etc) and not very pretty (comments are stripped, original source
formatting is totally lost, variables are renamed, expressions are regrouped),
so this may not be what you're looking for. However, this is a good way to add
C++ support for a processor that does not otherwise have a C++ compiler.
</p>
<p>Use commands like this:</p>
<ol>
<li><p>Compile your program as normal with llvm-g++:</p></li>
<div class="doc_code">
<pre>
% llvm-g++ x.cpp -o program
</pre>
</div>
<p>or:</p>
<div class="doc_code">
<pre>
% llvm-g++ a.cpp -c
% llvm-g++ b.cpp -c
% llvm-g++ a.o b.o -o program
</pre>
</div>
<p>With llvm-gcc3, this will generate program and program.bc. The .bc file is
the LLVM version of the program all linked together.</p>
<li><p>Convert the LLVM code to C code, using the LLC tool with the C
backend:</p></li>
<div class="doc_code">
<pre>
% llc -march=c program.bc -o program.c
</pre>
</div>
<li><p>Finally, compile the c file:</p></li>
<div class="doc_code">
<pre>
% cc x.c
</pre>
</div>
</ol>
<p>Note that, by default, the C backend does not support exception handling.
If you want/need it for a certain program, you can enable it by passing
"-enable-correct-eh-support" to the llc program. The resultant code will
use setjmp/longjmp to implement exception support that is correct but
relatively slow.
</p>
<p>Also note: this specific sequence of commands won't work if you use a
function defined in the C++ runtime library (or any other C++ library). To
access an external C++ library, you must manually
compile libstdc++ to LLVM bitcode, statically link it into your program, then
use the commands above to convert the whole result into C code. Alternatively,
you can compile the libraries and your application into two different chunks
of C code and link them.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
@@ -598,7 +443,6 @@ of C code and link them.</p>
</div>
<div class="question"><p>
<a name="__main"></a>
What is this <tt>__main()</tt> call that gets inserted into <tt>main()</tt>?
</p></div>
@@ -620,40 +464,7 @@ linked in automatically when you link the program.
<!--=========================================================================-->
<div class="question">
<a name="iosinit"></a>
<p> What is this <tt>llvm.global_ctors</tt> and
<tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I #include
&lt;iostream&gt;?</p>
</div>
<div class="answer">
<p>If you #include the &lt;iostream&gt; header into a C++ translation unit, the
file will probably use the <tt>std::cin</tt>/<tt>std::cout</tt>/... global
objects. However, C++ does not guarantee an order of initialization between
static objects in different translation units, so if a static ctor/dtor in your
.cpp file used <tt>std::cout</tt>, for example, the object would not necessarily
be automatically initialized before your use.</p>
<p>To make <tt>std::cout</tt> and friends work correctly in these scenarios, the
STL that we use declares a static object that gets created in every translation
unit that includes <tt>&lt;iostream&gt;</tt>. This object has a static
constructor and destructor that initializes and destroys the global iostream
objects before they could possibly be used in the file. The code that you see
in the .ll file corresponds to the constructor and destructor registration code.
</p>
<p>If you would like to make it easier to <b>understand</b> the LLVM code
generated by the compiler in the demo page, consider using <tt>printf()</tt>
instead of <tt>iostream</tt>s to print values.</p>
</div>
<!--=========================================================================-->
<div class="question"><p>
<a name="codedce"></a>
Where did all of my code go??
</p></div>
@@ -676,24 +487,33 @@ you can read from and assign to <tt>volatile</tt> global variables.
<!--=========================================================================-->
<div class="question"><p>
<a name="undef"></a>
<p>What is this "<tt>undef</tt>" thing that shows up in my code?
What is this <tt>llvm.global_ctors</tt> and <tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I #include &lt;iostream&gt;?
</p></div>
<div class="answer">
<p>
<a href="LangRef.html#undef"><tt>undef</tt></a> is the LLVM way of representing
a value that is not defined. You can get these if you do not initialize a
variable before you use it. For example, the C function:</p>
If you #include the &lt;iostream&gt; header into a C++ translation unit, the
file will probably use the <tt>std::cin</tt>/<tt>std::cout</tt>/... global
objects. However, C++ does not guarantee an order of initialization between
static objects in different translation units, so if a static ctor/dtor in your
.cpp file used <tt>std::cout</tt>, for example, the object would not necessarily
be automatically initialized before your use.
</p>
<div class="doc_code">
<pre>
int X() { int i; return i; }
</pre>
</div>
<p>
To make <tt>std::cout</tt> and friends work correctly in these scenarios, the
STL that we use declares a static object that gets created in every translation
unit that includes &lt;iostream&gt;. This object has a static constructor and
destructor that initializes and destroys the global iostream objects before they
could possibly be used in the file. The code that you see in the .ll file
corresponds to the constructor and destructor registration code.
</p>
<p>Is compiled to "<tt>ret i32 undef</tt>" because "<tt>i</tt>" never has
a value specified for it.</p>
<p>
If you would like to make it easier to <b>understand</b> the LLVM code generated
by the compiler in the demo page, consider using printf instead of iostreams to
print values.
</p>
</div>
<!-- *********************************************************************** -->
@@ -705,7 +525,7 @@ a value specified for it.</p>
<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>
<a href="http://llvm.cs.uiuc.edu">LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>

View File

@@ -65,9 +65,8 @@ conservative and accurate.</p>
<p>Conservative garbage collection often does not require any special support
from either the language or the compiler: it can handle non-type-safe
programming languages (such as C/C++) and does not require any special
information from the compiler. The
<a href="http://www.hpl.hp.com/personal/Hans_Boehm/gc/">Boehm collector</a> is
an example of a state-of-the-art conservative collector.</p>
information from the compiler. The [LINK] Boehm collector is an example of a
state-of-the-art conservative collector.</p>
<p>Accurate garbage collection requires the ability to identify all pointers in
the program at run-time (which requires that the source-language be type-safe in
@@ -166,7 +165,9 @@ interface that front-end authors should generate code for.
The <tt>llvm.gcroot</tt> intrinsic is used to inform LLVM of a pointer variable
on the stack. The first argument contains the address of the variable on the
stack, and the second contains a pointer to metadata that should be associated
with the pointer (which <b>must</b> be a constant or global value address).</p>
with the pointer (which <b>must</b> be a constant or global value address). At
runtime, the <tt>llvm.gcroot</tt> intrinsic stores a null pointer into the
specified location to initialize the pointer.</p>
<p>
Consider the following fragment of Java code:
@@ -191,9 +192,6 @@ Entry:
%X = alloca %Object*
...
;; Java null-initializes pointers.
store %Object* null, %Object** %X
;; "CodeBlock" is the block corresponding to the start
;; of the scope above.
CodeBlock:
@@ -389,7 +387,7 @@ The <tt>llvm_cg_walk_gcroots</tt> function is a function provided by the code
generator that iterates through all of the GC roots on the stack, calling the
specified function pointer with each record. For each GC root, the address of
the pointer and the meta-data (from the <a
href="#roots"><tt>llvm.gcroot</tt></a> intrinsic) are provided.
href="#gcroot"><tt>llvm.gcroot</tt></a> intrinsic) are provided.
</p>
</div>
@@ -527,7 +525,7 @@ conference on LISP and functional programming.</p>
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
<a href="http://llvm.cs.uiuc.edu">LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>

View File

@@ -1,311 +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>The Often Misunderstood GEP Instruction</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
<style type="text/css">
TABLE { text-align: left; border: 1px solid black; border-collapse: collapse; margin: 0 0 0 0; }
</style>
</head>
<body>
<div class="doc_title">
The Often Misunderstood GEP Instruction
</div>
<ol>
<li><a href="#intro">Introduction</a></li>
<li><a href="#questions">The Questions</a>
<ol>
<li><a href="#extra_index">Why is the extra 0 index required?</a></li>
<li><a href="#deref">What is dereferenced by GEP?</a></li>
<li><a href="#firstptr">Why can you index through the first pointer but not
subsequent ones?</a></li>
<li><a href="#lead0">Why don't GEP x,0,0,1 and GEP x,1 alias? </a></li>
<li><a href="#trail0">Why do GEP x,1,0,0 and GEP x,1 alias? </a></li>
</ol></li>
<li><a href="#summary">Summary</a></li>
</ol>
<div class="doc_author">
<p>Written by: <a href="mailto:rspencer@reidspencer.com">Reid Spencer</a>.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="intro"><b>Introduction</b></a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>This document seeks to dispel the mystery and confusion surrounding LLVM's
GetElementPtr (GEP) instruction. Questions about the wiley GEP instruction are
probably the most frequently occuring questions once a developer gets down to
coding with LLVM. Here we lay out the sources of confusion and show that the
GEP instruction is really quite simple.
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="questions"><b>The Questions</b></a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>When people are first confronted with the GEP instruction, they tend to
relate it to known concepts from other programming paradigms, most notably C
array indexing and field selection. However, GEP is a little different and
this leads to the following questions, all of which are answered in the
following sections.</p>
<ol>
<li><a href="#firstptr">What is the first index of the GEP instruction?</a>
</li>
<li><a href="#extra_index">Why is the extra 0 index required?</a></li>
<li><a href="#deref">What is dereferenced by GEP?</a></li>
<li><a href="#lead0">Why don't GEP x,0,0,1 and GEP x,1 alias? </a></li>
<li><a href="#trail0">Why do GEP x,1,0,0 and GEP x,1 alias? </a></li>
</ol>
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="firstptr"><b>What is the first index of the GEP instruction?</b></a>
</div>
<div class="doc_text">
<p>Quick answer: The index stepping through the first operand.</p>
<p>The confusion with the first index usually arises from thinking about
the GetElementPtr instruction as if it was a C index operator. They aren't the
same. For example, when we write, in "C":</p>
<pre>
AType* Foo;
...
X = &amp;Foo-&gt;F;</pre>
<p>it is natural to think that there is only one index, the selection of the
field <tt>F</tt>. However, in this example, <tt>Foo</tt> is a pointer. That
pointer must be indexed explicitly in LLVM. C, on the other hand, indexs
through it transparently. To arrive at the same address location as the C
code, you would provide the GEP instruction with two index operands. The
first operand indexes through the pointer; the second operand indexes the
field <tt>F</tt> of the structure, just as if you wrote:</p>
<pre>
X = &amp;Foo[0].F;</pre>
<p>Sometimes this question gets rephrased as:</p>
<blockquote><p><i>Why is it okay to index through the first pointer, but
subsequent pointers won't be dereferenced?</i></p></blockquote>
<p>The answer is simply because memory does not have to be accessed to
perform the computation. The first operand to the GEP instruction must be a
value of a pointer type. The value of the pointer is provided directly to
the GEP instruction as an operand without any need for accessing memory. It
must, therefore be indexed and requires an index operand. Consider this
example:</p>
<pre>
struct munger_struct {
int f1;
int f2;
};
void munge(struct munger_struct *P)
{
P[0].f1 = P[1].f1 + P[2].f2;
}
...
munger_struct Array[3];
...
munge(Array);</pre>
<p>In this "C" example, the front end compiler (llvm-gcc) will generate three
GEP instructions for the three indices through "P" in the assignment
statement. The function argument <tt>P</tt> will be the first operand of each
of these GEP instructions. The second operand indexes through that pointer.
The third operand will be the field offset into the
<tt>struct munger_struct</tt> type, for either the <tt>f1</tt> or
<tt>f2</tt> field. So, in LLVM assembly the <tt>munge</tt> function looks
like:</p>
<pre>
void %munge(%struct.munger_struct* %P) {
entry:
%tmp = getelementptr %struct.munger_struct* %P, i32 1, i32 0
%tmp = load i32* %tmp
%tmp6 = getelementptr %struct.munger_struct* %P, i32 2, i32 1
%tmp7 = load i32* %tmp6
%tmp8 = add i32 %tmp7, %tmp
%tmp9 = getelementptr %struct.munger_struct* %P, i32 0, i32 0
store i32 %tmp8, i32* %tmp9
ret void
}</pre>
<p>In each case the first operand is the pointer through which the GEP
instruction starts. The same is true whether the first operand is an
argument, allocated memory, or a global variable. </p>
<p>To make this clear, let's consider a more obtuse example:</p>
<pre>
%MyVar = unintialized global i32
...
%idx1 = getelementptr i32* %MyVar, i64 0
%idx2 = getelementptr i32* %MyVar, i64 1
%idx3 = getelementptr i32* %MyVar, i64 2</pre>
<p>These GEP instructions are simply making address computations from the
base address of <tt>MyVar</tt>. They compute, as follows (using C syntax):
</p>
<ul>
<li> idx1 = (char*) &amp;MyVar + 0</li>
<li> idx2 = (char*) &amp;MyVar + 4</li>
<li> idx3 = (char*) &amp;MyVar + 8</li>
</ul>
<p>Since the type <tt>i32</tt> is known to be four bytes long, the indices
0, 1 and 2 translate into memory offsets of 0, 4, and 8, respectively. No
memory is accessed to make these computations because the address of
<tt>%MyVar</tt> is passed directly to the GEP instructions.</p>
<p>The obtuse part of this example is in the cases of <tt>%idx2</tt> and
<tt>%idx3</tt>. They result in the computation of addresses that point to
memory past the end of the <tt>%MyVar</tt> global, which is only one
<tt>i32</tt> long, not three <tt>i32</tt>s long. While this is legal in LLVM,
it is inadvisable because any load or store with the pointer that results
from these GEP instructions would produce undefined results.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="extra_index"><b>Why is the extra 0 index required?</b></a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>Quick answer: there are no superfluous indices.</p>
<p>This question arises most often when the GEP instruction is applied to a
global variable which is always a pointer type. For example, consider
this:</p><pre>
%MyStruct = uninitialized global { float*, i32 }
...
%idx = getelementptr { float*, i32 }* %MyStruct, i64 0, i32 1</pre>
<p>The GEP above yields an <tt>i32*</tt> by indexing the <tt>i32</tt> typed
field of the structure <tt>%MyStruct</tt>. When people first look at it, they
wonder why the <tt>i64 0</tt> index is needed. However, a closer inspection
of how globals and GEPs work reveals the need. Becoming aware of the following
facts will dispell the confusion:</p>
<ol>
<li>The type of <tt>%MyStruct</tt> is <i>not</i> <tt>{ float*, i32 }</tt>
but rather <tt>{ float*, i32 }*</tt>. That is, <tt>%MyStruct</tt> is a
pointer to a structure containing a pointer to a <tt>float</tt> and an
<tt>i32</tt>.</li>
<li>Point #1 is evidenced by noticing the type of the first operand of
the GEP instruction (<tt>%MyStruct</tt>) which is
<tt>{ float*, i32 }*</tt>.</li>
<li>The first index, <tt>i64 0</tt> is required to step over the global
variable <tt>%MyStruct</tt>. Since the first argument to the GEP
instruction must always be a value of pointer type, the first index
steps through that pointer. A value of 0 means 0 elements offset from that
pointer.</li>
<li>The second index, <tt>i32 1</tt> selects the second field of the
structure (the <tt>i32</tt>). </li>
</ol>
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="deref"><b>What is dereferenced by GEP?</b></a>
</div>
<div class="doc_text">
<p>Quick answer: nothing.</p>
<p>The GetElementPtr instruction dereferences nothing. That is, it doesn't
access memory in any way. That's what the Load and Store instructions are for.
GEP is only involved in the computation of addresses. For example, consider
this:</p>
<pre>
%MyVar = uninitialized global { [40 x i32 ]* }
...
%idx = getelementptr { [40 x i32]* }* %MyVar, i64 0, i32 0, i64 0, i64 17</pre>
<p>In this example, we have a global variable, <tt>%MyVar</tt> that is a
pointer to a structure containing a pointer to an array of 40 ints. The
GEP instruction seems to be accessing the 18th integer of the structure's
array of ints. However, this is actually an illegal GEP instruction. It
won't compile. The reason is that the pointer in the structure <i>must</i>
be dereferenced in order to index into the array of 40 ints. Since the
GEP instruction never accesses memory, it is illegal.</p>
<p>In order to access the 18th integer in the array, you would need to do the
following:</p>
<pre>
%idx = getelementptr { [40 x i32]* }* %, i64 0, i32 0
%arr = load [40 x i32]** %idx
%idx = getelementptr [40 x i32]* %arr, i64 0, i64 17</pre>
<p>In this case, we have to load the pointer in the structure with a load
instruction before we can index into the array. If the example was changed
to:</p>
<pre>
%MyVar = uninitialized global { [40 x i32 ] }
...
%idx = getelementptr { [40 x i32] }*, i64 0, i32 0, i64 17</pre>
<p>then everything works fine. In this case, the structure does not contain a
pointer and the GEP instruction can index through the global variable,
into the first field of the structure and access the 18th <tt>i32</tt> in the
array there.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="lead0"><b>Why don't GEP x,0,0,1 and GEP x,1 alias?</b></a>
</div>
<div class="doc_text">
<p>Quick Answer: They compute different address locations.</p>
<p>If you look at the first indices in these GEP
instructions you find that they are different (0 and 1), therefore the address
computation diverges with that index. Consider this example:</p>
<pre>
%MyVar = global { [10 x i32 ] }
%idx1 = getlementptr { [10 x i32 ] }* %MyVar, i64 0, i32 0, i64 1
%idx2 = getlementptr { [10 x i32 ] }* %MyVar, i64 1</pre>
<p>In this example, <tt>idx1</tt> computes the address of the second integer
in the array that is in the structure in %MyVar, that is <tt>MyVar+4</tt>. The
type of <tt>idx1</tt> is <tt>i32*</tt>. However, <tt>idx2</tt> computes the
address of <i>the next</i> structure after <tt>%MyVar</tt>. The type of
<tt>idx2</tt> is <tt>{ [10 x i32] }*</tt> and its value is equivalent
to <tt>MyVar + 40</tt> because it indexes past the ten 4-byte integers
in <tt>MyVar</tt>. Obviously, in such a situation, the pointers don't
alias.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="trail0"><b>Why do GEP x,1,0,0 and GEP x,1 alias?</b></a>
</div>
<div class="doc_text">
<p>Quick Answer: They compute the same address location.</p>
<p>These two GEP instructions will compute the same address because indexing
through the 0th element does not change the address. However, it does change
the type. Consider this example:</p>
<pre>
%MyVar = global { [10 x i32 ] }
%idx1 = getlementptr { [10 x i32 ] }* %MyVar, i64 1, i32 0, i64 0
%idx2 = getlementptr { [10 x i32 ] }* %MyVar, i64 1</pre>
<p>In this example, the value of <tt>%idx1</tt> is <tt>%MyVar+40</tt> and
its type is <tt>i32*</tt>. The value of <tt>%idx2</tt> is also
<tt>MyVar+40</tt> but its type is <tt>{ [10 x i32] }*</tt>.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="summary"><b>Summary</b></a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>In summary, here's some things to always remember about the GetElementPtr
instruction:</p>
<ol>
<li>The GEP instruction never accesses memory, it only provides pointer
computations.</li>
<li>The first operand to the GEP instruction is always a pointer and it must
be indexed.</li>
<li>There are no superfluous indices for the GEP instruction.</li>
<li>Trailing zero indices are superfluous for pointer aliasing, but not for
the types of the pointers.</li>
<li>Leading zero indices are not superfluous for pointer aliasing nor the
types of the pointers.</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">The LLVM Compiler Infrastructure</a><br/>
Last modified: $Date$
</address>
</body>
</html>

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