1 llvm-extract - extract a function from an LLVM module
2 =====================================================
4 .. program:: llvm-extract
9 :program:`llvm-extract` [*options*] **--func** *function-name* [*filename*]
14 The :program:`llvm-extract` command takes the name of a function and extracts
15 it from the specified LLVM bitcode file. It is primarily used as a debugging
16 tool to reduce test cases from larger programs that are triggering a bug.
18 In addition to extracting the bitcode of the specified function,
19 :program:`llvm-extract` will also remove unreachable global variables,
20 prototypes, and unused types.
22 The :program:`llvm-extract` command reads its input from standard input if
23 filename is omitted or if filename is ``-``. The output is always written to
24 standard output, unless the **-o** option is specified (see below).
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
36 **--func** *function-name*
38 Extract the function named *function-name* from the LLVM bitcode. May be
39 specified multiple times to extract multiple functions at once.
41 **--rfunc** *function-regular-expr*
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.
47 **--glob** *global-name*
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.
52 **--rglob** *glob-regular-expr*
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.
60 Print a summary of command line options.
64 Specify the output filename. If filename is "-" (the default), then
65 :program:`llvm-extract` sends its output to standard output.
69 Write output in LLVM intermediate language (instead of bitcode).
74 If :program:`llvm-extract` succeeds, it will exit with 0. Otherwise, if an error
75 occurs, it will exit with a non-zero value.
80 :manpage:`bugpoint(1)`