blob: cd8828b23724a9086dd216ac402d45d0a212990c [file] [log] [blame]
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +00001llvm-extract - extract a function from an LLVM module
2=====================================================
3
James Hendersona0566842019-06-27 13:24:46 +00004.. program:: llvm-extract
5
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +00006SYNOPSIS
7--------
8
Dmitri Gribenko8cac8352013-08-18 08:32:32 +00009:program:`llvm-extract` [*options*] **--func** *function-name* [*filename*]
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000010
11DESCRIPTION
12-----------
13
Dmitri Gribenko8cac8352013-08-18 08:32:32 +000014The :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.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000017
18In addition to extracting the bitcode of the specified function,
Dmitri Gribenko8cac8352013-08-18 08:32:32 +000019:program:`llvm-extract` will also remove unreachable global variables,
20prototypes, and unused types.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000021
Dmitri Gribenko8cac8352013-08-18 08:32:32 +000022The :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).
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000025
26OPTIONS
27-------
28
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000029**-f**
30
Dmitri Gribenko8cac8352013-08-18 08:32:32 +000031 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.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000035
36**--func** *function-name*
37
Dmitri Gribenko8cac8352013-08-18 08:32:32 +000038 Extract the function named *function-name* from the LLVM bitcode. May be
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000039 specified multiple times to extract multiple functions at once.
40
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000041**--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
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000047**--glob** *global-name*
48
Dmitri Gribenko8cac8352013-08-18 08:32:32 +000049 Extract the global variable named *global-name* from the LLVM bitcode. May be
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000050 specified multiple times to extract multiple global variables at once.
51
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000052**--rglob** *glob-regular-expr*
53
54 Extract the global variable(s) matching *global-regular-expr* from the LLVM
Dmitri Gribenko8cac8352013-08-18 08:32:32 +000055 bitcode. All global variables matching the regular expression will be
56 extracted. May be specified multiple times.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000057
58**-help**
59
60 Print a summary of command line options.
61
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000062**-o** *filename*
63
64 Specify the output filename. If filename is "-" (the default), then
Dmitri Gribenko8cac8352013-08-18 08:32:32 +000065 :program:`llvm-extract` sends its output to standard output.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000066
67**-S**
68
69 Write output in LLVM intermediate language (instead of bitcode).
70
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000071EXIT STATUS
72-----------
73
Dmitri Gribenko8cac8352013-08-18 08:32:32 +000074If :program:`llvm-extract` succeeds, it will exit with 0. Otherwise, if an error
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000075occurs, it will exit with a non-zero value.
76
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000077SEE ALSO
78--------
79
Alex Brachet09a066b2019-07-04 21:19:05 +000080:manpage:`bugpoint(1)`