LLVM-EXTRACT(1)
π llvm-extract β the manual page, but make it make sense
okay so real talk, this is llvm-extract from the LLVM manual set (that's the LLVM-EXTRACT(1) header energy right there), and it's genuinely one of the most useful little gremlin tools in the whole suite. let's get into it π«Ά
β¨ NAME β¨
llvm-extract β extract a function from an LLVM module. that's it. that's the whole job. and it ate. π
πΈ SYNOPSIS πΈ
llvm-extract [options] --func function-name [filename]
π¦ DESCRIPTION π¦
okay so picture this: llvm-extract takes the name of a function and pulls it out of the LLVM bitcode file you point it at. literally just yoink βοΈ
its main character purpose? debugging. it's a test-case-reduction tool β when some giant program is triggering a bug and you're drowning in a million lines of bitcode, you use this to shrink it down to just the interesting bits. big "cut the filler, keep the plot" energy fr fr.
and it's not just the function itself, bestie β it also cleans up after itself: any unreachable global variables, prototypes, and unused types get removed too. it's giving responsible roommate. π§Ήβ¨
input handling, super simple:
- no
filename? reads from standard input. filenameis-? also reads from standard input.- output? always standard output, unless you pass
-o(see below, iykyk).
π OPTIONS π
--aliasalias-name β extract the alias namedfunction-namefrom the LLVM bitcode. (yes, the page literally saysfunction-namein this description β we're keeping the facts exactly as written, bestie π). can be specified multiple times to extract multiple aliases at once.--raliasalias-regular-expr β extract the alias matchingalias-regular-exprfrom the LLVM bitcode. all aliases matching that regular expression get extracted. can be specified multiple times.--bbbasic-block-specifier β extract the basic block(s) specified inbasic-block-specifier. can be specified multiple times. each<function:bb[;bb]>specifier pair creates a function. and heads up: if multiple basic blocks are specified in one pair, the first block in the sequence should dominate the rest. no cap, that one matters.--deleteβ delete the specified Globals from the Module. ποΈ-fβ enable binary output on terminals. normallyllvm-extractwill refuse to write raw bitcode output if the output stream is a terminal (it's protecting you from yourself, honestly). with this flag it writes raw bitcode regardless of the output device. use responsibly, bestie π--funcfunction-name β extract the function namedfunction-namefrom the LLVM bitcode. can be specified multiple times to extract multiple functions at once. this is the classic, the staple, the go-to.--rfuncfunction-regular-expr β extract the function(s) matchingfunction-regular-exprfrom the LLVM bitcode. all functions matching the regular expression get extracted. can be specified multiple times.--globglobal-name β extract the global variable namedglobal-namefrom the LLVM bitcode. can be specified multiple times to grab multiple globals at once.--rglobglob-regular-expr β extract the global variable(s) matchingglobal-regular-exprfrom the LLVM bitcode. all globals matching the regular expression get extracted. can be specified multiple times.--keep-const-initβ preserve the values of constant globals. π«Ά--recursiveβ recursively extract all called functions. the way this one just keeps pulling in more functionsβ¦ it's giving completionist. π₯-helpβ print a summary of command line options. when in doubt, ask for help, that's growth. π-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. textual slay. β¨
π EXIT STATUS π
- success? exits with
0. iconic, flawless, no notes. π - error? exits with a non-zero value. π it happens to the best of us.
π SEE ALSO π
bugpoint(1)<bugpoint.html> β its partner in crime for hunting down bugs. dynamic duo behavior honestly. π¦
β Author β
maintained by the LLVM Team (https://llvm.org/). absolute legends, all of them. π«Ά
π Copyright π
2003-2026, LLVM Project
and that's the whole page, bestie β you're now fully fluent. mwah π
okay so tiny sign-off: this is the LLVM version of the page, the one stamped15in the corner, dated2026-09-09, akaLLVM-EXTRACT(1). go reduce some test cases, you've got this. πΈπ
π¦ where this page comes from
- ubuntu stonking: llvm-18 1:18.1.8-20ubuntu11 Β· 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