blob: d0e9c1c255abd0920c5247609af73e3104b3dd50 [file] [log] [blame]
Daniel Dunbar3b709d52012-05-08 16:50:35 +00001llvm-extract - extract a function from an LLVM module
2=====================================================
3
Daniel Dunbar3b709d52012-05-08 16:50:35 +00004SYNOPSIS
5--------
6
Dmitri Gribenko70f6b362013-08-18 08:32:32 +00007:program:`llvm-extract` [*options*] **--func** *function-name* [*filename*]
Daniel Dunbar3b709d52012-05-08 16:50:35 +00008
9DESCRIPTION
10-----------
11
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000012The :program:`llvm-extract` command takes the name of a function and extracts
13it from the specified LLVM bitcode file. It is primarily used as a debugging
14tool to reduce test cases from larger programs that are triggering a bug.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000015
16In addition to extracting the bitcode of the specified function,
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000017:program:`llvm-extract` will also remove unreachable global variables,
18prototypes, and unused types.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000019
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000020The :program:`llvm-extract` command reads its input from standard input if
21filename is omitted or if filename is ``-``. The output is always written to
22standard output, unless the **-o** option is specified (see below).
Daniel Dunbar3b709d52012-05-08 16:50:35 +000023
24OPTIONS
25-------
26
Daniel Dunbar3b709d52012-05-08 16:50:35 +000027**-f**
28
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000029 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.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000033
34**--func** *function-name*
35
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000036 Extract the function named *function-name* from the LLVM bitcode. May be
Daniel Dunbar3b709d52012-05-08 16:50:35 +000037 specified multiple times to extract multiple functions at once.
38
Daniel Dunbar3b709d52012-05-08 16:50:35 +000039**--rfunc** *function-regular-expr*
40
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.
44
Daniel Dunbar3b709d52012-05-08 16:50:35 +000045**--glob** *global-name*
46
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000047 Extract the global variable named *global-name* from the LLVM bitcode. May be
Daniel Dunbar3b709d52012-05-08 16:50:35 +000048 specified multiple times to extract multiple global variables at once.
49
Daniel Dunbar3b709d52012-05-08 16:50:35 +000050**--rglob** *glob-regular-expr*
51
52 Extract the global variable(s) matching *global-regular-expr* from the LLVM
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000053 bitcode. All global variables matching the regular expression will be
54 extracted. May be specified multiple times.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000055
56**-help**
57
58 Print a summary of command line options.
59
Daniel Dunbar3b709d52012-05-08 16:50:35 +000060**-o** *filename*
61
62 Specify the output filename. If filename is "-" (the default), then
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000063 :program:`llvm-extract` sends its output to standard output.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000064
65**-S**
66
67 Write output in LLVM intermediate language (instead of bitcode).
68
Daniel Dunbar3b709d52012-05-08 16:50:35 +000069EXIT STATUS
70-----------
71
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000072If :program:`llvm-extract` succeeds, it will exit with 0. Otherwise, if an error
Daniel Dunbar3b709d52012-05-08 16:50:35 +000073occurs, it will exit with a non-zero value.
74
Daniel Dunbar3b709d52012-05-08 16:50:35 +000075SEE ALSO
76--------
77
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000078bugpoint
Daniel Dunbar3b709d52012-05-08 16:50:35 +000079