aboutsummaryrefslogtreecommitdiffstats
path: root/docs/CommandGuide
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2013-08-07 15:07:10 -0700
committerStephen Hines <srhines@google.com>2013-08-07 15:07:10 -0700
commitfab2daa4a1127ecb217abe2b07c1769122b6fee1 (patch)
tree268ebfd1963fd98ba412e76819afdf95a7d4267b /docs/CommandGuide
parent8197ac1c1a0a91baa70c4dea8cb488f254ef974c (diff)
parent10251753b6897adcd22cc981c0cc42f348c109de (diff)
downloadexternal_llvm-fab2daa4a1127ecb217abe2b07c1769122b6fee1.zip
external_llvm-fab2daa4a1127ecb217abe2b07c1769122b6fee1.tar.gz
external_llvm-fab2daa4a1127ecb217abe2b07c1769122b6fee1.tar.bz2
Merge commit '10251753b6897adcd22cc981c0cc42f348c109de' into merge-20130807
Conflicts: lib/Archive/ArchiveReader.cpp lib/Support/Unix/PathV2.inc Change-Id: I29d8c1e321a4a380b6013f00bac6a8e4b593cc4e
Diffstat (limited to 'docs/CommandGuide')
-rw-r--r--docs/CommandGuide/FileCheck.rst56
-rw-r--r--docs/CommandGuide/index.rst1
-rw-r--r--docs/CommandGuide/lit.rst4
-rw-r--r--docs/CommandGuide/llc.rst18
-rw-r--r--docs/CommandGuide/llvm-ar.rst129
-rw-r--r--docs/CommandGuide/llvm-ranlib.rst61
-rw-r--r--docs/CommandGuide/llvm-symbolizer.rst16
7 files changed, 102 insertions, 183 deletions
diff --git a/docs/CommandGuide/FileCheck.rst b/docs/CommandGuide/FileCheck.rst
index 0d98349..6be5fc3 100644
--- a/docs/CommandGuide/FileCheck.rst
+++ b/docs/CommandGuide/FileCheck.rst
@@ -18,7 +18,8 @@ using :program:`grep`, but it is optimized for matching multiple different
inputs in one file in a specific order.
The ``match-filename`` file specifies the file that contains the patterns to
-match. The file to verify is always read from standard input.
+match. The file to verify is read from standard input unless the
+:option:`--input-file` option is used.
OPTIONS
-------
@@ -44,7 +45,7 @@ OPTIONS
By default, FileCheck canonicalizes input horizontal whitespace (spaces and
tabs) which causes it to ignore these differences (a space will match a tab).
The :option:`--strict-whitespace` argument disables this behavior. End-of-line
- sequences are canonicalized to UNIX-style '\n' in all modes.
+ sequences are canonicalized to UNIX-style ``\n`` in all modes.
.. option:: -version
@@ -243,6 +244,57 @@ occurrences matching ``CHECK-DAG:`` after ``CHECK-NOT:``. For example,
This case will reject input strings where ``BEFORE`` occurs after ``AFTER``.
+The "CHECK-LABEL:" directive
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sometimes in a file containing multiple tests divided into logical blocks, one
+or more ``CHECK:`` directives may inadvertently succeed by matching lines in a
+later block. While an error will usually eventually be generated, the check
+flagged as causing the error may not actually bear any relationship to the
+actual source of the problem.
+
+In order to produce better error messages in these cases, the "``CHECK-LABEL:``"
+directive can be used. It is treated identically to a normal ``CHECK``
+directive except that FileCheck makes an additional assumption that a line
+matched by the directive cannot also be matched by any other check present in
+``match-filename``; this is intended to be used for lines containing labels or
+other unique identifiers. Conceptually, the presence of ``CHECK-LABEL`` divides
+the input stream into separate blocks, each of which is processed independently,
+preventing a ``CHECK:`` directive in one block matching a line in another block.
+For example,
+
+.. code-block:: llvm
+
+ define %struct.C* @C_ctor_base(%struct.C* %this, i32 %x) {
+ entry:
+ ; CHECK-LABEL: C_ctor_base:
+ ; CHECK: mov [[SAVETHIS:r[0-9]+]], r0
+ ; CHECK: bl A_ctor_base
+ ; CHECK: mov r0, [[SAVETHIS]]
+ %0 = bitcast %struct.C* %this to %struct.A*
+ %call = tail call %struct.A* @A_ctor_base(%struct.A* %0)
+ %1 = bitcast %struct.C* %this to %struct.B*
+ %call2 = tail call %struct.B* @B_ctor_base(%struct.B* %1, i32 %x)
+ ret %struct.C* %this
+ }
+
+ define %struct.D* @D_ctor_base(%struct.D* %this, i32 %x) {
+ entry:
+ ; CHECK-LABEL: D_ctor_base:
+
+The use of ``CHECK-LABEL:`` directives in this case ensures that the three
+``CHECK:`` directives only accept lines corresponding to the body of the
+``@C_ctor_base`` function, even if the patterns match lines found later in
+the file. Furthermore, if one of these three ``CHECK:`` directives fail,
+FileCheck will recover by continuing to the next block, allowing multiple test
+failures to be detected in a single invocation.
+
+There is no requirement that ``CHECK-LABEL:`` directives contain strings that
+correspond to actual syntactic labels in a source or output language: they must
+simply uniquely match a single line in the file being verified.
+
+``CHECK-LABEL:`` directives cannot contain variable definitions or uses.
+
FileCheck Pattern Matching Syntax
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/docs/CommandGuide/index.rst b/docs/CommandGuide/index.rst
index b3b4bc3..d50542d 100644
--- a/docs/CommandGuide/index.rst
+++ b/docs/CommandGuide/index.rst
@@ -21,7 +21,6 @@ Basic Commands
lli
llvm-link
llvm-ar
- llvm-ranlib
llvm-nm
llvm-prof
llvm-config
diff --git a/docs/CommandGuide/lit.rst b/docs/CommandGuide/lit.rst
index 2f6d9a1..a4681fb 100644
--- a/docs/CommandGuide/lit.rst
+++ b/docs/CommandGuide/lit.rst
@@ -316,6 +316,10 @@ executed, two important global variables are predefined:
*on_clone* function will generally modify), and (3) the test path to the new
directory being scanned.
+ **pipefail** Normally a test using a shell pipe fails if any of the commands
+ on the pipe fail. If this is not desired, setting this variable to false
+ makes the test fail only if the last command in the pipe fails.
+
TEST DISCOVERY
~~~~~~~~~~~~~~
diff --git a/docs/CommandGuide/llc.rst b/docs/CommandGuide/llc.rst
index e6a5976..02ad798 100644
--- a/docs/CommandGuide/llc.rst
+++ b/docs/CommandGuide/llc.rst
@@ -141,24 +141,24 @@ Tuning/Configuration Options
.. option:: --regalloc=<allocator>
- Specify the register allocator to use. The default ``allocator`` is *local*.
+ Specify the register allocator to use.
Valid register allocators are:
- *simple*
+ *basic*
- Very simple "always spill" register allocator
+ Basic register allocator.
- *local*
+ *fast*
- Local register allocator
+ Fast register allocator. It is the default for unoptimized code.
- *linearscan*
+ *greedy*
- Linear scan global register allocator
+ Greedy register allocator. It is the default for optimized code.
- *iterativescan*
+ *pbqp*
- Iterative scan global register allocator
+ Register allocator based on 'Partitioned Boolean Quadratic Programming'.
.. option:: --spiller=<spiller>
diff --git a/docs/CommandGuide/llvm-ar.rst b/docs/CommandGuide/llvm-ar.rst
index 8ff4192..d3ee993 100644
--- a/docs/CommandGuide/llvm-ar.rst
+++ b/docs/CommandGuide/llvm-ar.rst
@@ -21,64 +21,24 @@ LLVM program. However, the archive can contain any kind of file. By default,
only the symbol table needs to be consulted, not each individual file member
of the archive.
-The **llvm-ar** command can be used to *read* both SVR4 and BSD style archive
-files. However, it cannot be used to write them. While the **llvm-ar** command
-produces files that are *almost* identical to the format used by other ``ar``
-implementations, it has two significant departures in order to make the
-archive appropriate for LLVM. The first departure is that **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 **llvm-ar** usually won't be readable or editable with any
-``ar`` implementation or useful for linking. Using the ``f`` modifier to flatten
-file names will make the archive readable by other ``ar`` implementations
-but not for linking because the symbol table format for LLVM is unique. If an
+The **llvm-ar** command can be used to *read* SVR4, GNU and BSD style archive
+files. However, right now it can only write in the GNU format. If an
SVR4 or BSD style archive is used with the ``r`` (replace) or ``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.
+update) operations, the archive will be reconstructed in GNU format.
Here's where **llvm-ar** departs from previous ``ar`` implementations:
*Symbol Table*
- Since **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.
-
+ Since **llvm-ar** supports bitcode files. The symbol table it creates
+ is in GNU format and includes both native and bitcode files.
*Long Paths*
- Some ``ar`` implementations (SVR4) use a separate file member to record long
- path names (> 15 characters). **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.
-
-
-
-*Directory Recursion*
-
- Most ``ar`` implementations do not recurse through directories but simply
- ignore directories if they are presented to the program in the *files*
- option. **llvm-ar**, however, can recurse through directory structures and
- add all the files under a directory, if requested.
-
-
-
-*TOC Verbose Output*
-
- When **llvm-ar** prints out the verbose table of contents (``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 'B' means
- the file is an LLVM bitcode file. An 'S' means the file is the symbol table.
-
+ Currently **llvm-ar** can read GNU and BSD long file names, but only writes
+ archives with the GNU format.
@@ -124,20 +84,19 @@ m[abi]
-p[k]
+p
- Print files to the standard output. The *k* modifier applies to this
- operation. This operation simply prints the *files* indicated to the
- standard output. If no *files* are specified, the entire archive is printed.
- Printing bitcode files is ill-advised as they might confuse your terminal
- settings. The *p* operation never modifies the archive.
+ Print files to the standard output. This operation simply prints the
+ *files* indicated to the standard output. If no *files* are
+ specified, the entire archive is printed. Printing bitcode files is
+ ill-advised as they might confuse your terminal settings. The *p*
+ operation never modifies the archive.
-q[Rf]
+q
- Quickly append files to the end of the archive. The *R*, and *f*
- modifiers apply to this operation. This operation quickly adds the
+ Quickly append files to the end of the archive. This operation quickly adds the
*files* to the archive without checking for duplicates that should be
removed first. If no *files* are specified, the archive is not modified.
Because of the way that **llvm-ar** constructs the archive file, its dubious
@@ -145,9 +104,9 @@ q[Rf]
-r[Rabfu]
+r[abu]
- Replace or insert file members. The *R*, *a*, *b*, *f*, and *u*
+ Replace or insert file members. The *a*, *b*, and *u*
modifiers apply to this operation. This operation will replace existing
*files* or insert them at the end of the archive if they do not exist. If no
*files* are specified, the archive is not modified.
@@ -201,37 +160,12 @@ section (above) to determine which modifiers are applicable to which operations.
-[f]
-
- Normally, **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 ``ar`` but may also
- thwart correct extraction of the files (duplicates may overwrite). If used with
- the *R* option, the directory recursion will be performed but the file names
- will all be flattened to simple file names.
-
-
-
[i]
A synonym for the *b* option.
-[k]
-
- Normally, **llvm-ar** will not print the contents of bitcode files when the
- *p* operation is used. This modifier defeats the default and allows the
- bitcode members to be printed.
-
-
-
-[N]
-
- This option is ignored by **llvm-ar** but provided for compatibility.
-
-
-
[o]
When extracting files, this option will cause **llvm-ar** to preserve the
@@ -239,22 +173,6 @@ section (above) to determine which modifiers are applicable to which operations.
-[P]
-
- use full path names when matching
-
-
-
-[R]
-
- This modifier instructions the *r* option to recursively process directories.
- Without *R*, directories are ignored and only those *files* that refer to
- files will be added to the archive. When *R* is used, any directories specified
- with *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.
-
-
-
[u]
When replacing existing files in the archive, only replace those files that have
@@ -283,8 +201,7 @@ The modifiers below may be applied to any operation.
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
- llvm-ranlib|llvm-ranlib which also creates the symbol table.
+ bitcode files in the archive.
@@ -401,14 +318,6 @@ fmag - char[2]
utility in identifying archive files that have been corrupted.
-
-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:
-
-
offset - vbr encoded 32-bit integer
The offset item provides the offset into the archive file where the bitcode
@@ -455,4 +364,4 @@ SEE ALSO
--------
-llvm-ranlib|llvm-ranlib, ar(1)
+ar(1)
diff --git a/docs/CommandGuide/llvm-ranlib.rst b/docs/CommandGuide/llvm-ranlib.rst
deleted file mode 100644
index 6658818..0000000
--- a/docs/CommandGuide/llvm-ranlib.rst
+++ /dev/null
@@ -1,61 +0,0 @@
-llvm-ranlib - Generate index for LLVM archive
-=============================================
-
-
-SYNOPSIS
---------
-
-
-**llvm-ranlib** [--version] [-help] <archive-file>
-
-
-DESCRIPTION
------------
-
-
-The **llvm-ranlib** command is similar to the common Unix utility, ``ranlib``. It
-adds or updates the symbol table in an LLVM archive file. Note that using the
-**llvm-ar** modifier *s* is usually more efficient than running **llvm-ranlib**
-which is only provided only for completness and compatibility. Unlike other
-implementations of ``ranlib``, **llvm-ranlib** indexes LLVM bitcode files, not
-native object modules. You can list the contents of the symbol table with the
-``llvm-nm -s`` command.
-
-
-OPTIONS
--------
-
-
-
-*archive-file*
-
- Specifies the archive-file to which the symbol table is added or updated.
-
-
-
-*--version*
-
- Print the version of **llvm-ranlib** and exit without building a symbol table.
-
-
-
-*-help*
-
- Print usage help for **llvm-ranlib** and exit without building a symbol table.
-
-
-
-
-EXIT STATUS
------------
-
-
-If **llvm-ranlib** succeeds, it will exit with 0. If an error occurs, a non-zero
-exit code will be returned.
-
-
-SEE ALSO
---------
-
-
-llvm-ar|llvm-ar, ranlib(1)
diff --git a/docs/CommandGuide/llvm-symbolizer.rst b/docs/CommandGuide/llvm-symbolizer.rst
index 73babb1..e03be9b 100644
--- a/docs/CommandGuide/llvm-symbolizer.rst
+++ b/docs/CommandGuide/llvm-symbolizer.rst
@@ -22,6 +22,8 @@ EXAMPLE
a.out 0x4004f4
/tmp/b.out 0x400528
/tmp/c.so 0x710
+ /tmp/mach_universal_binary:i386 0x1f84
+ /tmp/mach_universal_binary:x86_64 0x100000f24
$ llvm-symbolizer < addr.txt
main
/tmp/a.cc:4
@@ -38,6 +40,12 @@ EXAMPLE
main
/tmp/source.cc:8
+ _main
+ /tmp/source_i386.cc:8
+
+ _main
+ /tmp/source_x86_64.cc:8
+
OPTIONS
-------
@@ -59,6 +67,14 @@ OPTIONS
If a source code location is in an inlined function, prints all the
inlnied frames. Defaults to true.
+.. option:: -default-arch
+
+ If a binary contains object files for multiple architectures (e.g. it is a
+ Mach-O universal binary), symbolize the object file for a given architecture.
+ You can also specify architecture by writing ``binary_name:arch_name`` in the
+ input (see example above). If architecture is not specified in either way,
+ address will not be symbolized. Defaults to empty string.
+
EXIT STATUS
-----------