111 lines · plain
1llvm-extract - extract a function from an LLVM module2=====================================================3 4.. program:: llvm-extract5 6SYNOPSIS7--------8 9:program:`llvm-extract` [*options*] **--func** *function-name* [*filename*]10 11DESCRIPTION12-----------13 14The :program:`llvm-extract` command takes the name of a function and extracts15it from the specified LLVM bitcode file. It is primarily used as a debugging16tool to reduce test cases from larger programs that are triggering a bug.17 18In addition to extracting the bitcode of the specified function,19:program:`llvm-extract` will also remove unreachable global variables,20prototypes, and unused types.21 22The :program:`llvm-extract` command reads its input from standard input if23filename is omitted or if filename is ``-``. The output is always written to24standard output, unless the **-o** option is specified (see below).25 26OPTIONS27-------28 29**--alias** *alias-name*30 31 Extract the alias named *function-name* from the LLVM bitcode. May be32 specified multiple times to extract multiple alias at once.33 34**--ralias** *alias-regular-expr*35 36 Extract the alias matching *alias-regular-expr* from the LLVM bitcode.37 All alias matching the regular expression will be extracted. May be38 specified multiple times.39 40**--bb** *basic-block-specifier*41 42 Extract basic blocks(s) specified in *basic-block-specifier*. May be43 specified multiple times. Each <function:bb[;bb]> specifier pair will create44 a function. If multiple basic blocks are specified in one pair, the first45 block in the sequence should dominate the rest.46 47**--delete**48 49 Delete specified Globals from Module.50 51**-f**52 53 Enable binary output on terminals. Normally, :program:`llvm-extract` will54 refuse to write raw bitcode output if the output stream is a terminal. With55 this option, :program:`llvm-extract` will write raw bitcode regardless of the56 output device.57 58**--func** *function-name*59 60 Extract the function named *function-name* from the LLVM bitcode. May be61 specified multiple times to extract multiple functions at once.62 63**--rfunc** *function-regular-expr*64 65 Extract the function(s) matching *function-regular-expr* from the LLVM bitcode.66 All functions matching the regular expression will be extracted. May be67 specified multiple times.68 69**--glob** *global-name*70 71 Extract the global variable named *global-name* from the LLVM bitcode. May be72 specified multiple times to extract multiple global variables at once.73 74**--rglob** *glob-regular-expr*75 76 Extract the global variable(s) matching *global-regular-expr* from the LLVM77 bitcode. All global variables matching the regular expression will be78 extracted. May be specified multiple times.79 80**--keep-const-init**81 82 Preserve the values of constant globals.83 84**--recursive**85 86 Recursively extract all called functions87 88**-help**89 90 Print a summary of command line options.91 92**-o** *filename*93 94 Specify the output filename. If filename is "-" (the default), then95 :program:`llvm-extract` sends its output to standard output.96 97**-S**98 99 Write output in LLVM intermediate language (instead of bitcode).100 101EXIT STATUS102-----------103 104If :program:`llvm-extract` succeeds, it will exit with 0. Otherwise, if an error105occurs, it will exit with a non-zero value.106 107SEE ALSO108--------109 110:manpage:`bugpoint(1)`111