[llvm-exegesis] [NFC] Fixing typo.
[llvm-complete.git] / docs / CommandGuide / llvm-extract.rst
blobd0e9c1c255abd0920c5247609af73e3104b3dd50
1 llvm-extract - extract a function from an LLVM module
2 =====================================================
4 SYNOPSIS
5 --------
7 :program:`llvm-extract` [*options*] **--func** *function-name* [*filename*]
9 DESCRIPTION
10 -----------
12 The :program:`llvm-extract` command takes the name of a function and extracts
13 it from the specified LLVM bitcode file.  It is primarily used as a debugging
14 tool to reduce test cases from larger programs that are triggering a bug.
16 In addition to extracting the bitcode of the specified function,
17 :program:`llvm-extract` will also remove unreachable global variables,
18 prototypes, and unused types.
20 The :program:`llvm-extract` command reads its input from standard input if
21 filename is omitted or if filename is ``-``.  The output is always written to
22 standard output, unless the **-o** option is specified (see below).
24 OPTIONS
25 -------
27 **-f**
29  Enable binary output on terminals.  Normally, :program:`llvm-extract` will
30  refuse to write raw bitcode output if the output stream is a terminal.  With
31  this option, :program:`llvm-extract` will write raw bitcode regardless of the
32  output device.
34 **--func** *function-name*
36  Extract the function named *function-name* from the LLVM bitcode.  May be
37  specified multiple times to extract multiple functions at once.
39 **--rfunc** *function-regular-expr*
41  Extract the function(s) matching *function-regular-expr* from the LLVM bitcode.
42  All functions matching the regular expression will be extracted.  May be
43  specified multiple times.
45 **--glob** *global-name*
47  Extract the global variable named *global-name* from the LLVM bitcode.  May be
48  specified multiple times to extract multiple global variables at once.
50 **--rglob** *glob-regular-expr*
52  Extract the global variable(s) matching *global-regular-expr* from the LLVM
53  bitcode.  All global variables matching the regular expression will be
54  extracted.  May be specified multiple times.
56 **-help**
58  Print a summary of command line options.
60 **-o** *filename*
62  Specify the output filename.  If filename is "-" (the default), then
63  :program:`llvm-extract` sends its output to standard output.
65 **-S**
67  Write output in LLVM intermediate language (instead of bitcode).
69 EXIT STATUS
70 -----------
72 If :program:`llvm-extract` succeeds, it will exit with 0.  Otherwise, if an error
73 occurs, it will exit with a non-zero value.
75 SEE ALSO
76 --------
78 bugpoint