blob: 67f00f0b8615643e82768edbd98306f9c957e614 [file] [log] [blame]
Brian Gaeke8172d532004-06-02 19:21:26 +00001=pod
2
3=head1 NAME
4
Misha Brukman4e8458d2005-04-24 17:46:58 +00005llvm-extract - extract a function from an LLVM module
Brian Gaeke8172d532004-06-02 19:21:26 +00006
7=head1 SYNOPSIS
8
Misha Brukman4e8458d2005-04-24 17:46:58 +00009B<llvm-extract> [I<options>] B<--func> I<function-name> [I<filename>]
Brian Gaeke8172d532004-06-02 19:21:26 +000010
11=head1 DESCRIPTION
12
Misha Brukman4e8458d2005-04-24 17:46:58 +000013The B<llvm-extract> command takes the name of a function and extracts it from
Gabor Greif3bd6e0d2007-07-09 11:24:05 +000014the specified LLVM bitcode file. It is primarily used as a debugging tool to
Brian Gaeke8172d532004-06-02 19:21:26 +000015reduce test cases from larger programs that are triggering a bug.
16
Gabor Greif3bd6e0d2007-07-09 11:24:05 +000017In addition to extracting the bitcode of the specified function,
Misha Brukman4e8458d2005-04-24 17:46:58 +000018B<llvm-extract> will also remove unreachable global variables, prototypes, and
Brian Gaeke8172d532004-06-02 19:21:26 +000019unused types.
20
Misha Brukman4e8458d2005-04-24 17:46:58 +000021The B<llvm-extract> command reads its input from standard input if filename is
Brian Gaeke8172d532004-06-02 19:21:26 +000022omitted or if filename is -. The output is always written to standard output,
23unless the B<-o> option is specified (see below).
24
25=head1 OPTIONS
26
27=over
28
29=item B<-f>
30
Dan Gohman0cabaa52009-08-25 15:54:01 +000031Enable binary output on terminals. Normally, B<llvm-extract> will refuse to
32write raw bitcode output if the output stream is a terminal. With this option,
33B<llvm-extract> will write raw bitcode regardless of the output device.
Brian Gaeke8172d532004-06-02 19:21:26 +000034
35=item B<--func> I<function-name>
36
Dan Gohmana499d202010-02-10 23:58:53 +000037Extract the function named I<function-name> from the LLVM bitcode. May be
38specified multiple times to extract multiple functions at once.
39
Chad Rosier4e0a55d2011-09-16 21:09:17 +000040=item B<--rfunc> I<function-regular-expr>
41
42Extract the function(s) matching I<function-regular-expr> from the LLVM bitcode.
43All functions matching the regular expression will be extracted. May be
44specified multiple times.
45
Dan Gohmana499d202010-02-10 23:58:53 +000046=item B<--glob> I<global-name>
47
48Extract the global variable named I<global-name> from the LLVM bitcode. May be
49specified multiple times to extract multiple global variables at once.
Brian Gaeke8172d532004-06-02 19:21:26 +000050
Chad Rosier4e0a55d2011-09-16 21:09:17 +000051=item B<--rglob> I<glob-regular-expr>
52
53Extract the global variable(s) matching I<global-regular-expr> from the LLVM
54bitcode. All global variables matching the regular expression will be extracted.
55May be specified multiple times.
56
Duncan Sands7e7ae5a2010-02-18 14:08:13 +000057=item B<-help>
Brian Gaeke8172d532004-06-02 19:21:26 +000058
59Print a summary of command line options.
60
61=item B<-o> I<filename>
62
63Specify the output filename. If filename is "-" (the default), then
Misha Brukman4e8458d2005-04-24 17:46:58 +000064B<llvm-extract> sends its output to standard output.
Brian Gaeke8172d532004-06-02 19:21:26 +000065
Dan Gohmanec080462009-09-11 20:46:33 +000066=item B<-S>
67
68Write output in LLVM intermediate language (instead of bitcode).
69
Brian Gaeke8172d532004-06-02 19:21:26 +000070=back
71
72=head1 EXIT STATUS
73
Misha Brukman4e8458d2005-04-24 17:46:58 +000074If B<llvm-extract> succeeds, it will exit with 0. Otherwise, if an error
Brian Gaeke8172d532004-06-02 19:21:26 +000075occurs, it will exit with a non-zero value.
76
77=head1 SEE ALSO
78
Misha Brukmanc08937a2004-07-02 16:06:19 +000079L<bugpoint|bugpoint>
Brian Gaeke8172d532004-06-02 19:21:26 +000080
81=head1 AUTHORS
82
NAKAMURA Takumib9a33632011-04-09 02:13:37 +000083Maintained by the LLVM Team (L<http://llvm.org/>).
Brian Gaeke8172d532004-06-02 19:21:26 +000084
85=cut