1LLVM-EXTRACT(1) LLVM LLVM-EXTRACT(1)
2
3
4
6 llvm-extract - extract a function from an LLVM module
7
9 llvm-extract [options] --func function-name [filename]
10
12 The llvm-extract command takes the name of a function and extracts it
13 from the specified LLVM bitcode file. It is primarily used as a debug‐
14 ging tool to reduce test cases from larger programs that are triggering
15 a bug.
16
17 In addition to extracting the bitcode of the specified function,
18 llvm-extract will also remove unreachable global variables, prototypes,
19 and unused types.
20
21 The llvm-extract command reads its input from standard input if file‐
22 name is omitted or if filename is -. The output is always written to
23 standard output, unless the -o option is specified (see below).
24
26 --alias alias-name
27 Extract the alias named function-name from the LLVM bitcode. May be
28 specified multiple times to extract multiple alias at once.
29
30 --ralias alias-regular-expr
31 Extract the alias matching alias-regular-expr from the LLVM bitcode.
32 All alias matching the regular expression will be extracted. May be
33 specified multiple times.
34
35 --bb basic-block-specifier
36 Extract basic blocks(s) specified in basic-block-specifier. May be
37 specified multiple times. Each <function:bb[;bb]> specifier pair
38 will create a function. If multiple basic blocks are specified in
39 one pair, the first block in the sequence should dominate the rest.
40
41 --delete
42 Delete specified Globals from Module.
43
44 -f
45 Enable binary output on terminals. Normally, llvm-extract will
46 refuse to write raw bitcode output if the output stream is a termi‐
47 nal. With this option, llvm-extract will write raw bitcode regard‐
48 less of the output device.
49
50 --func function-name
51 Extract the function named function-name from the LLVM bitcode. May
52 be specified multiple times to extract multiple functions at once.
53
54 --rfunc function-regular-expr
55 Extract the function(s) matching function-regular-expr from the LLVM
56 bitcode. All functions matching the regular expression will be ex‐
57 tracted. May be specified multiple times.
58
59 --glob global-name
60 Extract the global variable named global-name from the LLVM bitcode.
61 May be specified multiple times to extract multiple global variables
62 at once.
63
64 --rglob glob-regular-expr
65 Extract the global variable(s) matching global-regular-expr from the
66 LLVM bitcode. All global variables matching the regular expression
67 will be extracted. May be specified multiple times.
68
69 --keep-const-init
70 Preserve the values of constant globals.
71
72 --recursive
73 Recursively extract all called functions
74
75 -help
76 Print a summary of command line options.
77
78 -o filename
79 Specify the output filename. If filename is "-" (the default), then
80 llvm-extract sends its output to standard output.
81
82 -S
83 Write output in LLVM intermediate language (instead of bitcode).
84
86 If llvm-extract succeeds, it will exit with 0. Otherwise, if an error
87 occurs, it will exit with a non-zero value.
88
90 bugpoint(1)
91
93 Maintained by the LLVM Team (https://llvm.org/).
94
96 2003-2021, LLVM Project
97
98
99
100
10112 2021-05-17 LLVM-EXTRACT(1)