LLVM-EXTRACT(1)
π llvm-extract β extract a function from an LLVM module π
okay so this is the man page for llvm-extract, bestie, and it lives in the LLVM manual family. let me walk you through it π«Ά
πΈ SYNOPSIS πΈ
llvm-extract [options] βfunc function-name [filename]
that's the whole vibe. options, then βfunc plus a function name, then optionally a filename. iconic β¨
π¦ DESCRIPTION π¦
so llvm-extract takes the name of a function and pulls it out of the LLVM bitcode file you point it at. it's primarily a debugging tool β think of it as a little scalpel for shrinking test cases out of bigger programs that are triggering a bug. literally so useful ngl πͺπ
and it doesn't just carve out the bitcode of the function you named β it also removes unreachable global variables, prototypes, and unused types. cleanup era β¨π§Ή
also important: llvm-extract reads its input from standard input if filename is omitted, or if filename is -. and the output always goes to standard output, unless you use the -o option (peep below π).
π OPTIONS π
βaliasalias-name β extracts the alias named function-name from the LLVM bitcode. yes, the page really says function-name there, don't come for me π it may be specified multiple times to extract multiple alias at once. slay πβraliasalias-regular-expr β extracts the alias matching alias-regular-expr from the LLVM bitcode. every alias matching the regular expression gets extracted. may be specified multiple times. regex girlies rise πβbbbasic-block-specifier β extracts basic block(s) specified in basic-block-specifier. may be specified multiple times. each<function:bb[;bb]>specifier pair will create a function. if multiple basic blocks are specified in one pair, the first block in the sequence should dominate the rest β that's a real constraint, don't ignore it bestie πβdeleteβ delete specified Globals from Module. simple as that ποΈ-fβ enable binary output on terminals. normallyllvm-extractrefuses to write raw bitcode output if the output stream is a terminal, but with this option it'll write raw bitcode regardless of the output device. it's giving "I know what I'm doing" energy π₯βfuncfunction-name β extracts the function named function-name from the LLVM bitcode. may be specified multiple times to extract multiple functions at once. the main character option, honestly πβrfuncfunction-regular-expr β extracts the function(s) matching function-regular-expr from the LLVM bitcode. all functions matching the regular expression will be extracted. may be specified multiple times. batch extraction, we love to see it πβglobglobal-name β extracts the global variable named global-name from the LLVM bitcode. may be specified multiple times to extract multiple global variables at once πβrglobglob-regular-expr β extracts the global variable(s) matching global-regular-expr from the LLVM bitcode. all global variables matching the regular expression will be extracted. may be specified multiple times β¨βkeep-const-initβ preserve the values of constant globals. no cap, this one keeps your constants intact πβrecursiveβ recursively extract all called functions. it goes deep, bestie π-helpβ print a summary of command line options. when in doubt π«Ά-ofilename β specify the output filename. if filename is-(the default), thenllvm-extractsends its output to standard output π€-Sβ write output in LLVM intermediate language (instead of bitcode). human-readable, we stan πβ¨
β οΈ friendly reminder that -f is the one that overrides the terminal safety check for raw bitcode output β the default behavior is to refuse, so only flex it when you mean it π
π EXIT STATUS π
if llvm-extract succeeds, it exits with 0. otherwise, if an error occurs, it exits with a non-zero value. that's it, that's the check π«‘
π SEE ALSO π
π AUTHOR π
maintained by the LLVM Team (https://llvm.org/). absolute legends π«Άπ
π COPYRIGHT π
2003-2023, LLVM Project
okay that's the whole page bestie, you're officially an llvm-extract expert now π mwah π β page 15, dated 2023-07-14, from the LLVM manual, for LLVM-EXTRACT(1). go forth and shrink those test cases π¦β¨
π¦ where this page comes from
- ubuntu jammy: llvm-15 1:15.0.7-0ubuntu0.22.04.3 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms