llvm-extract.rst 2.4 KB

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