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).
29 **--alias** *alias-name*
31 Extract the alias named *function-name* from the LLVM bitcode. May be
32 specified multiple times to extract multiple alias at once.
34 **--ralias** *alias-regular-expr*
36 Extract the alias matching *alias-regular-expr* from the LLVM bitcode.
37 All alias matching the regular expression will be extracted. May be
38 specified multiple times.
40 **--bb** *basic-block-specifier*
42 Extract basic blocks(s) specified in *basic-block-specifier*. May be
43 specified multiple times. Each <function:bb[;bb]> specifier pair will create
44 a function. If multiple basic blocks are specified in one pair, the first
45 block in the sequence should dominate the rest.
49 Delete specified Globals from Module.
53 Enable binary output on terminals. Normally, :program:`llvm-extract` will
54 refuse to write raw bitcode output if the output stream is a terminal. With
55 this option, :program:`llvm-extract` will write raw bitcode regardless of the
58 **--func** *function-name*
60 Extract the function named *function-name* from the LLVM bitcode. May be
61 specified multiple times to extract multiple functions at once.
63 **--rfunc** *function-regular-expr*
65 Extract the function(s) matching *function-regular-expr* from the LLVM bitcode.
66 All functions matching the regular expression will be extracted. May be
67 specified multiple times.
69 **--glob** *global-name*
71 Extract the global variable named *global-name* from the LLVM bitcode. May be
72 specified multiple times to extract multiple global variables at once.
74 **--rglob** *glob-regular-expr*
76 Extract the global variable(s) matching *global-regular-expr* from the LLVM
77 bitcode. All global variables matching the regular expression will be
78 extracted. May be specified multiple times.
82 Preserve the values of constant globals.
86 Recursively extract all called functions
90 Print a summary of command line options.
94 Specify the output filename. If filename is "-" (the default), then
95 :program:`llvm-extract` sends its output to standard output.
99 Write output in LLVM intermediate language (instead of bitcode).
104 If :program:`llvm-extract` succeeds, it will exit with 0. Otherwise, if an error
105 occurs, it will exit with a non-zero value.
110 :manpage:`bugpoint(1)`