Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 1 | llvm-extract - extract a function from an LLVM module |
| 2 | ===================================================== |
| 3 | |
James Henderson | a056684 | 2019-06-27 13:24:46 +0000 | [diff] [blame] | 4 | .. program:: llvm-extract |
| 5 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 6 | SYNOPSIS |
| 7 | -------- |
| 8 | |
Dmitri Gribenko | 8cac835 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 9 | :program:`llvm-extract` [*options*] **--func** *function-name* [*filename*] |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 10 | |
| 11 | DESCRIPTION |
| 12 | ----------- |
| 13 | |
Dmitri Gribenko | 8cac835 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 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. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 17 | |
| 18 | In addition to extracting the bitcode of the specified function, |
Dmitri Gribenko | 8cac835 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 19 | :program:`llvm-extract` will also remove unreachable global variables, |
| 20 | prototypes, and unused types. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 21 | |
Dmitri Gribenko | 8cac835 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 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). |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 25 | |
| 26 | OPTIONS |
| 27 | ------- |
| 28 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 29 | **-f** |
| 30 | |
Dmitri Gribenko | 8cac835 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 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 |
| 34 | output device. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 35 | |
| 36 | **--func** *function-name* |
| 37 | |
Dmitri Gribenko | 8cac835 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 38 | Extract the function named *function-name* from the LLVM bitcode. May be |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 39 | specified multiple times to extract multiple functions at once. |
| 40 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 41 | **--rfunc** *function-regular-expr* |
| 42 | |
| 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. |
| 46 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 47 | **--glob** *global-name* |
| 48 | |
Dmitri Gribenko | 8cac835 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 49 | Extract the global variable named *global-name* from the LLVM bitcode. May be |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 50 | specified multiple times to extract multiple global variables at once. |
| 51 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 52 | **--rglob** *glob-regular-expr* |
| 53 | |
| 54 | Extract the global variable(s) matching *global-regular-expr* from the LLVM |
Dmitri Gribenko | 8cac835 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 55 | bitcode. All global variables matching the regular expression will be |
| 56 | extracted. May be specified multiple times. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 57 | |
| 58 | **-help** |
| 59 | |
| 60 | Print a summary of command line options. |
| 61 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 62 | **-o** *filename* |
| 63 | |
| 64 | Specify the output filename. If filename is "-" (the default), then |
Dmitri Gribenko | 8cac835 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 65 | :program:`llvm-extract` sends its output to standard output. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 66 | |
| 67 | **-S** |
| 68 | |
| 69 | Write output in LLVM intermediate language (instead of bitcode). |
| 70 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 71 | EXIT STATUS |
| 72 | ----------- |
| 73 | |
Dmitri Gribenko | 8cac835 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 74 | If :program:`llvm-extract` succeeds, it will exit with 0. Otherwise, if an error |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 75 | occurs, it will exit with a non-zero value. |
| 76 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 77 | SEE ALSO |
| 78 | -------- |
| 79 | |
Alex Brachet | 09a066b | 2019-07-04 21:19:05 +0000 | [diff] [blame] | 80 | :manpage:`bugpoint(1)` |