llvm-extract.rst 2.3 KB

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