LLVM-EXTRACT(1)
πΈ NAME πΈ
llvm-extract β grab a single function out of an LLVM module, no cap π
So bestie, you found your way into the LLVM-EXTRACT(1) page of the LLVM manual β section 1, the real one, the command-line one π«Ά. This is the tool you call when a giant program is doing something cursed and you just want the one little function that's misbehaving.
β¨ SYNOPSIS β¨
llvm-extract [options] βfunc function-name [filename]
π¦ DESCRIPTION π¦
okay so here's the tea, bestie β. llvm-extract takes the name of a function and pulls it out of whatever LLVM bitcode file you point it at. That's the whole vibe.
It's mainly a debugging tool, and its main character moment is reducing test cases β like, you've got a massive program that's triggering a bug, and you want to shrink it down to just the guilty little function so you can actually look at it without your brain melting π. It's giving lab scientist with tiny tweezers π§.
And it doesn't stop at just copying the function out β it also sweeps away the stuff nobody needs anymore:
- unreachable global variables π§Ή
- prototypes π§Ή
- unused types π§Ή
Where does it read from? If you skip filename entirely, or if you pass filename as -, it reads its input from standard input. And where does the output go? Always to standard output, unless you say otherwise with the -o option (peep the OPTIONS section below, it's right there π).
π OPTIONS π
Every single one, in order, no skips, periodt π
βaliasalias-name β Extract the alias namedfunction-namefrom the LLVM bitcode. You can hit this one more than once to extract multiple aliases at the same time. (And yes, the page literally saysfunction-namein this one's description, we're not editing the queen's words π)βraliasalias-regular-expr β Extract the alias matchingalias-regular-exprfrom the LLVM bitcode. All aliases matching that regular expression get extracted. May be specified multiple times.βbbbasic-block-specifier β Extract the basic block(s) specified inbasic-block-specifier. May be specified multiple times. Each<function:bb[;bb]>specifier pair will create a function. And if you list multiple basic blocks inside one pair, the first block in the sequence should dominate the rest π₯.βdeleteβ Delete specified Globals from Module.-fβ Enable binary output on terminals. Normallyllvm-extractwill refuse to write raw bitcode output if the output stream is a terminal π. With this option,llvm-extractwill write raw bitcode regardless of the output device.βfuncfunction-name β Extract the function namedfunction-namefrom the LLVM bitcode. May be specified multiple times to extract multiple functions at once. This is the one you'll be typing the most, fr fr.βrfuncfunction-regular-expr β Extract the function(s) matchingfunction-regular-exprfrom the LLVM bitcode. All functions matching the regular expression will be extracted. May be specified multiple times. Regex girlies, this one's for you π.βglobglobal-name β Extract the global variable namedglobal-namefrom the LLVM bitcode. May be specified multiple times to extract multiple global variables at once.βrglobglob-regular-expr β Extract the global variable(s) matchingglobal-regular-exprfrom 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. Don't let them get dropped, bestie π«Ά.βrecursiveβ Recursively extract all called functions. It's giving "bring the whole friend group" energy π.-helpβ Print a summary of command line options.-ofilename β Specify the output filename. Iffilenameisβ-β(the default), thenllvm-extractsends its output to standard output.-Sβ Write output in LLVM intermediate language (instead of bitcode). Human-readable era β¨.
π EXIT STATUS π
If llvm-extract succeeds, it will exit with 0 π. Otherwise, if an error occurs, it will exit with a non-zero value π.
β SEE ALSO β
π AUTHOR π
Maintained by the LLVM Team (https://llvm.org/).
π COPYRIGHT π
2003-2024, LLVM Project
and that's the whole page, bestie β go extract something iconic π β¨π¦
tiny sign-off: this whole thing lives in the LLVM manual, version 15, dated 2024-04-14, filed under LLVM-EXTRACT(1). mwah π«Ά
π¦ where this page comes from
- ubuntu noble: llvm-16 1:16.0.6-23ubuntu4 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms