Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 1 | llvm-extract - extract a function from an LLVM module |
| 2 | ===================================================== |
| 3 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 4 | SYNOPSIS |
| 5 | -------- |
| 6 | |
Dmitri Gribenko | 70f6b36 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 7 | :program:`llvm-extract` [*options*] **--func** *function-name* [*filename*] |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 8 | |
| 9 | DESCRIPTION |
| 10 | ----------- |
| 11 | |
Dmitri Gribenko | 70f6b36 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 12 | The :program:`llvm-extract` command takes the name of a function and extracts |
| 13 | it from the specified LLVM bitcode file. It is primarily used as a debugging |
| 14 | tool to reduce test cases from larger programs that are triggering a bug. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 15 | |
| 16 | In addition to extracting the bitcode of the specified function, |
Dmitri Gribenko | 70f6b36 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 17 | :program:`llvm-extract` will also remove unreachable global variables, |
| 18 | prototypes, and unused types. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 19 | |
Dmitri Gribenko | 70f6b36 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 20 | The :program:`llvm-extract` command reads its input from standard input if |
| 21 | filename is omitted or if filename is ``-``. The output is always written to |
| 22 | standard output, unless the **-o** option is specified (see below). |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 23 | |
| 24 | OPTIONS |
| 25 | ------- |
| 26 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 27 | **-f** |
| 28 | |
Dmitri Gribenko | 70f6b36 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 29 | Enable binary output on terminals. Normally, :program:`llvm-extract` will |
| 30 | refuse to write raw bitcode output if the output stream is a terminal. With |
| 31 | this option, :program:`llvm-extract` will write raw bitcode regardless of the |
| 32 | output device. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 33 | |
| 34 | **--func** *function-name* |
| 35 | |
Dmitri Gribenko | 70f6b36 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 36 | Extract the function named *function-name* from the LLVM bitcode. May be |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 37 | specified multiple times to extract multiple functions at once. |
| 38 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 39 | **--rfunc** *function-regular-expr* |
| 40 | |
| 41 | Extract the function(s) matching *function-regular-expr* from the LLVM bitcode. |
| 42 | All functions matching the regular expression will be extracted. May be |
| 43 | specified multiple times. |
| 44 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 45 | **--glob** *global-name* |
| 46 | |
Dmitri Gribenko | 70f6b36 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 47 | Extract the global variable named *global-name* from the LLVM bitcode. May be |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 48 | specified multiple times to extract multiple global variables at once. |
| 49 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 50 | **--rglob** *glob-regular-expr* |
| 51 | |
| 52 | Extract the global variable(s) matching *global-regular-expr* from the LLVM |
Dmitri Gribenko | 70f6b36 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 53 | bitcode. All global variables matching the regular expression will be |
| 54 | extracted. May be specified multiple times. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 55 | |
| 56 | **-help** |
| 57 | |
| 58 | Print a summary of command line options. |
| 59 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 60 | **-o** *filename* |
| 61 | |
| 62 | Specify the output filename. If filename is "-" (the default), then |
Dmitri Gribenko | 70f6b36 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 63 | :program:`llvm-extract` sends its output to standard output. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 64 | |
| 65 | **-S** |
| 66 | |
| 67 | Write output in LLVM intermediate language (instead of bitcode). |
| 68 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 69 | EXIT STATUS |
| 70 | ----------- |
| 71 | |
Dmitri Gribenko | 70f6b36 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 72 | If :program:`llvm-extract` succeeds, it will exit with 0. Otherwise, if an error |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 73 | occurs, it will exit with a non-zero value. |
| 74 | |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 75 | SEE ALSO |
| 76 | -------- |
| 77 | |
Dmitri Gribenko | 70f6b36 | 2013-08-18 08:32:32 +0000 | [diff] [blame] | 78 | bugpoint |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 79 | |