summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-extract
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-extract] Update the help message for group extraction featureJinsong Ji2019-08-201-2/+12
| | | | | | | | | | | | | | | | | | | | | | | Summary: https://reviews.llvm.org/D60973 exposed the group extraction feature of the BlockExtractor to llvm-extract. However, the help message was not updated, so users might not be able to know how to use this feature without looking into history/commits. This patch just update the help message to show how to use this group extraction feature. Reviewers: qcolombet, volkan Reviewed By: qcolombet Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66438 llvm-svn: 369438
* Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song2019-08-051-1/+1
| | | | | | F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
* Sanitize llvm-extract -help outputSerge Guelton2019-06-121-37/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Filter out irrelevant options New output: OVERVIEW: llvm extractor USAGE: llvm-extract [options] <input bitcode file> OPTIONS: Generic Options: --help - Display available options (--help-hidden for more) --help-list - Display list of available options (--help-list-hidden for more) --version - Display the version of this program llvm-extract Options: --alias=<alias> - Specify alias to extract --bb=<function:bb> - Specify <function, basic block> pairs to extract --delete - Delete specified Globals from Module -f - Enable binary output on terminals --func=<function> - Specify function to extract --glob=<global> - Specify global to extract -o=<filename> - Specify output filename --ralias=<ralias> - Specify alias(es) to extract using a regular expression --recursive - Recursively extract all called functions --rfunc=<rfunction> - Specify function(s) to extract using a regular expression --rglob=<rglobal> - Specify global(s) to extract using a regular expression Differential Revision: https://reviews.llvm.org/D62511 llvm-svn: 363201
* [llvm-extract] Expose the group extraction feature of the BlockExtractorQuentin Colombet2019-04-291-12/+19
| | | | | | | | | | | | This patch extends the `-bb` option to be able to use the group extraction feature from the BlockExtractor. In particular, `-bb=func:bb` is modified to support a list of basic blocks per function: `-bb=func:bb1[;bb2...]` that will be extracted together if at all possible (region must be single entry.) Differential Revision: https://reviews.llvm.org/D60973 llvm-svn: 359464
* Include invoke'd functions for recursive extractDavid Callahan2019-04-041-3/+3
| | | | | | | | | | | | | | | | Summary: When recursively extracting a function from a bit code file, include functions mentioned in InvokeInst as well as CallInst Reviewers: loladiro, espindola, volkan Reviewed By: loladiro Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60231 llvm-svn: 357735
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-192-8/+6
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Define InitLLVM to do common initialization all at once.Rui Ueyama2018-04-131-7/+2
| | | | | | | | | | | We have a few functions that virtually all command wants to run on process startup/shutdown. This patch adds InitLLVM class to do that all at once, so that we don't need to copy-n-paste boilerplate code to each llvm command's main() function. Differential Revision: https://reviews.llvm.org/D45602 llvm-svn: 330046
* [llvm-extract] Support extracting basic blocksVolkan Keles2018-01-231-0/+40
| | | | | | | | | | | | | | | | Summary: Currently, there is no way to extract a basic block from a function easily. This patch extends llvm-extract to extract the specified basic block(s). Reviewers: loladiro, rafael, bogner Reviewed By: bogner Subscribers: hintonda, mgorny, qcolombet, llvm-commits Differential Revision: https://reviews.llvm.org/D41638 llvm-svn: 323266
* [Support] Rename tool_output_file to ToolOutputFile, NFCReid Kleckner2017-09-231-1/+1
| | | | | | | This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. llvm-svn: 314050
* [llvm-extract] Add option for recursive extractionKeno Fischer2017-04-061-1/+34
| | | | | | | | | | | | | | | | | | | Summary: Particularly, with --delete, this can be very useful for testing new optimizations on some hotspots, without having to run it on the whole application. E.g. as such: ``` llvm-extract app.bc --recursive --rfunc .*hotspot.* > hotspot.bc llvm-extract app.bc --recursive --delete --rfunc .*hotspot.* > residual.bc llc -filetype=obj residual.bc > residual.o llc -filetype=obj hotspot.bc > hotspot.o cc -o app residual.o hotspot.o ``` Reviewed By: davide Differential Revision: https://reviews.llvm.org/D31722 llvm-svn: 299706
* [CMake] llvm-extract depends on intrinsics_genChris Bieneman2016-11-191-0/+3
| | | | | | | | | | | | | | | llvm-extract.cpp has the following include chain: llvm/Bitcode/BitcodeWriterPass.h llvm/IR/PassManager.h llvm/IR/Function.h llvm/IR/Argument.h llvm/IR/Attributes.h llvm/IR/Attributes.gen This means llvm-extract needs to depend on intrinsics_gen. llvm-svn: 287430
* [tools] Unbreak the GCC build (workaround a GCC bug).Davide Italiano2016-11-091-1/+2
| | | | | | | | | ../tools/llvm-extract/llvm-extract.cpp: In function ‘int main(int, char**)’: warning: ISO C++ forbids zero-size array ‘argv’ [-Wpedantic] GCC reference bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61259 llvm-svn: 286396
* Bitcode: Change the materializer interface to return llvm::Error.Peter Collingbourne2016-11-091-7/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D26439 llvm-svn: 286382
* Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith2016-06-091-1/+1
| | | | | | | looking for it along $PATH. This allows installs of LLVM tools outside of $PATH to find the symbolizer and produce pretty backtraces if they crash. llvm-svn: 272232
* Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini2016-04-141-1/+1
| | | | | | | | | | | At the same time, fixes InstructionsTest::CastInst unittest: yes you can leave the IR in an invalid state and exit when you don't destroy the context (like the global one), no longer now. This is the first part of http://reviews.llvm.org/D19094 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266379
* Remove autoconf supportChris Bieneman2016-01-261-17/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 llvm-svn: 258861
* Bring back "Assert that we have all use/users in the getters."Rafael Espindola2016-01-151-3/+12
| | | | | | | | | | | | | | | | | | | | | | This reverts commit r257751, bringing back r256105. The problem the assert found was fixed in r257915. Original commit message: Assert that we have all use/users in the getters. An error that is pretty easy to make is to use the lazy bitcode reader and then do something like if (V.use_empty()) The problem is that uses in unmaterialized functions are not accounted for. This patch adds asserts that all uses are known. llvm-svn: 257920
* Revert "Assert that we have all use/users in the getters."Michael Zolotukhin2016-01-141-12/+3
| | | | | | This reverts commit fdb838f3f8a8b6896bbbd5285555874eb3b748eb. llvm-svn: 257751
* Assert that we have all use/users in the getters.Rafael Espindola2015-12-191-3/+12
| | | | | | | | | | | | | | An error that is pretty easy to make is to use the lazy bitcode reader and then do something like if (V.use_empty()) The problem is that uses in unmaterialized functions are not accounted for. This patch adds asserts that all uses are known. llvm-svn: 256105
* Delete dead code: only functions are materializable.Rafael Espindola2015-12-181-4/+0
| | | | llvm-svn: 256052
* Use a lambda to reduce code duplication.Rafael Espindola2015-12-181-23/+15
| | | | llvm-svn: 256050
* uselistorder: Remove the global bitsDuncan P. N. Exon Smith2015-04-151-10/+13
| | | | | | | | | | | | | Remove all the global bits to do with preserving use-list order by moving the `cl::opt`s to the individual tools that want them. There's a minor functionality change to `libLTO`, in that you can't send in `-preserve-bc-uselistorder=false`, but making that bit settable (if it's worth doing) should be through explicit LTO API. As a drive-by fix, I removed some includes of `UseListOrder.h` that were made unnecessary by recent commits. llvm-svn: 234973
* uselistorder: Pull the bit through PrintModulePassDuncan P. N. Exon Smith2015-04-151-1/+2
| | | | | | | Now the callers of `PrintModulePass()` (etc.) that care about use-list order in assembly pass in the flag. llvm-svn: 234969
* uselistorder: Pull bit through BitcodeWriterPassDuncan P. N. Exon Smith2015-04-151-1/+2
| | | | | | | Now the callers of `BitcodeWriterPass` decide whether or not to preserve bitcode use-list order. llvm-svn: 234959
* IR: Set -preserve-bc-uselistorder=false by defaultDuncan P. N. Exon Smith2015-04-141-0/+6
| | | | | | | But keep it on by default in `llvm-as`, `opt`, `bugpoint`, `llvm-link`, `llvm-extract`, and `LTOCodeGenerator`. Part of PR5680. llvm-svn: 234921
* Make DataLayout Non-Optional in the ModuleMehdi Amini2015-03-041-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: DataLayout keeps the string used for its creation. As a side effect it is no longer needed in the Module. This is "almost" NFC, the string is no longer canonicalized, you can't rely on two "equals" DataLayout having the same string returned by getStringRepresentation(). Get rid of DataLayoutPass: the DataLayout is in the Module The DataLayout is "per-module", let's enforce this by not duplicating it more than necessary. One more step toward non-optionality of the DataLayout in the module. Make DataLayout Non-Optional in the Module Module->getDataLayout() will never returns nullptr anymore. Reviewers: echristo Subscribers: resistor, llvm-commits, jholewinski Differential Revision: http://reviews.llvm.org/D7992 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 231270
* [PM] Remove the old 'PassManager.h' header file at the top level ofChandler Carruth2015-02-131-2/+2
| | | | | | | | | | | | | | | | | | | | LLVM's include tree and the use of using declarations to hide the 'legacy' namespace for the old pass manager. This undoes the primary modules-hostile change I made to keep out-of-tree targets building. I sent an email inquiring about whether this would be reasonable to do at this phase and people seemed fine with it, so making it a reality. This should allow us to start bootstrapping with modules to a certain extent along with making it easier to mix and match headers in general. The updates to any code for users of LLVM are very mechanical. Switch from including "llvm/PassManager.h" to "llvm/IR/LegacyPassManager.h". Qualify the types which now produce compile errors with "legacy::". The most common ones are "PassManager", "PassManagerBase", and "FunctionPassManager". llvm-svn: 229094
* Remove redundant calls to isMaterializable.Rafael Espindola2014-11-011-8/+5
| | | | | | | | | | This removes calls to isMaterializable in the following cases: * It was redundant with a call to isDeclaration now that isDeclaration returns the correct answer for materializable functions. * It was followed by a call to Materialize. Just call Materialize and check EC. llvm-svn: 221050
* Modernize the error handling of the Materialize function.Rafael Espindola2014-10-241-9/+9
| | | | llvm-svn: 220600
* Add doInitialization/doFinalization to DataLayoutPass.Rafael Espindola2014-09-101-1/+1
| | | | | | | | | | | | | With this a DataLayoutPass can be reused for multiple modules. Once we have doInitialization/doFinalization, it doesn't seem necessary to pass a Module to the constructor. Overall this change seems in line with the idea of making DataLayout a required part of Module. With it the only way of having a DataLayout used is to add it to the Module. llvm-svn: 217548
* Return a std::unique_ptr from the IRReader.h functions. NFC.Rafael Espindola2014-08-261-2/+1
| | | | llvm-svn: 216466
* Modernize raw_fd_ostream's constructor a bit.Rafael Espindola2014-08-251-4/+4
| | | | | | | | | | Take a StringRef instead of a "const char *". Take a "std::error_code &" instead of a "std::string &" for error. A create static method would be even better, but this patch is already a bit too big. llvm-svn: 216393
* Use range loops.Rafael Espindola2014-05-081-13/+9
| | | | llvm-svn: 208353
* raw_ostream: Forward declare OpenFlags and include FileSystem.h only where ↵Benjamin Kramer2014-04-291-0/+1
| | | | | | necessary. llvm-svn: 207593
* [C++] Use 'nullptr'. Tools edition.Craig Topper2014-04-251-1/+1
| | | | llvm-svn: 207176
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-1/+1
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* Make DataLayout a plain object, not a pass.Rafael Espindola2014-02-251-1/+1
| | | | | | | Instead, have a DataLayoutPass that holds one. This will allow parts of LLVM don't don't handle passes to also use DataLayout. llvm-svn: 202168
* Replace the F_Binary flag with a F_Text one.Rafael Espindola2014-02-241-1/+1
| | | | | | | | | After this I will set the default back to F_None. The advantage is that before this patch forgetting to set F_Binary would corrupt a file on windows. Forgetting to set F_Text produces one that cannot be read in notepad, which is a better failure mode :-) llvm-svn: 202052
* [PM] Wire up support for writing bitcode with new PM.Chandler Carruth2014-01-131-1/+1
| | | | | | | | | | This moves the old pass creation functionality to its own header and updates the callers of that routine. Then it adds a new PM supporting bitcode writer to the header file, and wires that up in the opt tool. A test is added that round-trips code into bitcode and back out using the new pass manager. llvm-svn: 199078
* [PM] Simplify the interface exposed for IR printing passes.Chandler Carruth2014-01-121-1/+1
| | | | | | | | | | | | Nothing was using the ability of the pass to delete the raw_ostream it printed to, and nothing was trying to pass it a pointer to the raw_ostream. Also, the function variant had a different order of arguments from all of the others which was just really confusing. Now the interface accepts a reference, doesn't offer to delete it, and uses a consistent order. The implementation of the printing passes haven't been updated with this simplification, this is just the API switch. llvm-svn: 199044
* [PM] Rename the IR printing pass header to a more generic and correctChandler Carruth2014-01-121-2/+2
| | | | | | | | name to match the source file which I got earlier. Update the include sites. Also modernize the comments in the header to use the more recommended doxygen style. llvm-svn: 199041
* Move the LLVM IR asm writer header files into the IR directory, as theyChandler Carruth2014-01-071-1/+1
| | | | | | | | | | | | | | | | | are part of the core IR library in order to support dumping and other basic functionality. Rename the 'Assembly' include directory to 'AsmParser' to match the library name and the only functionality left their -- printing has been in the core IR library for quite some time. Update all of the #includes to match. All of this started because I wanted to have the layering in good shape before I started adding support for printing LLVM IR using the new pass infrastructure, and commandline support for the new pass infrastructure. llvm-svn: 198688
* [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.NAKAMURA Takumi2013-12-101-1/+7
| | | | llvm-svn: 196908
* Revert "Encapsulate PassManager debug flags to avoid static init and cxa_exit."Andrew Trick2013-09-191-4/+0
| | | | | | | | Working on a better solution to this. This reverts commit 7d4e9934e7ca83094c5cf41346966c8350179ff2. llvm-svn: 190990
* Encapsulate PassManager debug flags to avoid static init and cxa_exit.Andrew Trick2013-09-181-0/+4
| | | | | | | | | | | | | | This puts all the global PassManager debugging flags, like -print-after-all and -time-passes, behind a managed static. This eliminates their static initializers and, more importantly, exit-time destructors. The only behavioral change I anticipate is that tools need to initialize the PassManager before parsing the command line in order to export these options, which makes sense. Tools that already initialize the standard passes (opt/llc) don't need to do anything new. llvm-svn: 190974
* whitespaceAndrew Trick2013-09-181-1/+1
| | | | llvm-svn: 190973
* Add a wrapper for open.Rafael Espindola2013-07-161-2/+1
| | | | | | | This centralizes the handling of O_BINARY and opens the way for hiding more differences (like how open behaves with directories). llvm-svn: 186447
* Replace uses of the deprecated std::auto_ptr with OwningPtr.Andy Gibbs2013-04-121-1/+1
| | | | llvm-svn: 179373
* Manually update the dependencies in the Makefiles. It turns out that allChandler Carruth2013-03-261-1/+1
| | | | | | | | | | | that work on the LLVMBuild based dependency specification didn't actually work, we just now maintain dependencies in *3* places instead of 2. Yay. There may still be some missing dependencies, I'm still sifting through the bots and my builds, but this is a step in the right direction. llvm-svn: 177988
* Split out the IRReader header and the utility functions it provides intoChandler Carruth2013-03-263-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | its own library. These functions are bridging between the bitcode reader and the ll parser which are in different libraries. Previously we didn't have any good library to do this, and instead played fast and loose with a "header only" set of interfaces in the Support library. This really doesn't work well as evidenced by the recent attempt to add timing logic to the these routines. As part of this, make them normal functions rather than weird inline functions, and sink the implementation into the library. Also clean up the header to be nice and minimal. This requires updating lots of build system dependencies to specify that the IRReader library is needed, and several source files to not implicitly rely upon the header file to transitively include all manner of other headers. If you are using IRReader.h, this commit will break you (the header moved) and you'll need to also update your library usage to include 'irreader'. I will commit the corresponding change to Clang momentarily. llvm-svn: 177971
OpenPOWER on IntegriCloud