1llvm-extract - extract a function from an LLVM module
2=====================================================
3
4.. program:: llvm-extract
5
6SYNOPSIS
7--------
8
9:program:`llvm-extract` [*options*] **--func** *function-name* [*filename*]
10
11DESCRIPTION
12-----------
13
14The :program:`llvm-extract` command takes the name of a function and extracts
15it from the specified LLVM bitcode file.  It is primarily used as a debugging
16tool to reduce test cases from larger programs that are triggering a bug.
17
18In addition to extracting the bitcode of the specified function,
19:program:`llvm-extract` will also remove unreachable global variables,
20prototypes, and unused types.
21
22The :program:`llvm-extract` command reads its input from standard input if
23filename is omitted or if filename is ``-``.  The output is always written to
24standard output, unless the **-o** option is specified (see below).
25
26OPTIONS
27-------
28
29**-f**
30
31 Enable binary output on terminals.  Normally, :program:`llvm-extract` will
32 refuse to write raw bitcode output if the output stream is a terminal.  With
33 this option, :program:`llvm-extract` will write raw bitcode regardless of the
34 output device.
35
36**--func** *function-name*
37
38 Extract the function named *function-name* from the LLVM bitcode.  May be
39 specified multiple times to extract multiple functions at once.
40
41**--rfunc** *function-regular-expr*
42
43 Extract the function(s) matching *function-regular-expr* from the LLVM bitcode.
44 All functions matching the regular expression will be extracted.  May be
45 specified multiple times.
46
47**--glob** *global-name*
48
49 Extract the global variable named *global-name* from the LLVM bitcode.  May be
50 specified multiple times to extract multiple global variables at once.
51
52**--rglob** *glob-regular-expr*
53
54 Extract the global variable(s) matching *global-regular-expr* from the LLVM
55 bitcode.  All global variables matching the regular expression will be
56 extracted.  May be specified multiple times.
57
58**--keep-const-init**
59
60 Preserve the values of constant globals.
61
62**-help**
63
64 Print a summary of command line options.
65
66**-o** *filename*
67
68 Specify the output filename.  If filename is "-" (the default), then
69 :program:`llvm-extract` sends its output to standard output.
70
71**-S**
72
73 Write output in LLVM intermediate language (instead of bitcode).
74
75EXIT STATUS
76-----------
77
78If :program:`llvm-extract` succeeds, it will exit with 0.  Otherwise, if an error
79occurs, it will exit with a non-zero value.
80
81SEE ALSO
82--------
83
84:manpage:`bugpoint(1)`
85