summaryrefslogtreecommitdiff
path: root/tools/llvm-extract/llvm-extract.cpp
Commit message (Collapse)AuthorAge
* Use range loops.Rafael Espindola2014-05-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208353 91177308-0d34-0410-b5e6-96231b3b80d8
* raw_ostream: Forward declare OpenFlags and include FileSystem.h only where ↵Benjamin Kramer2014-04-29
| | | | | | necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207593 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++] Use 'nullptr'. Tools edition.Craig Topper2014-04-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207176 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-06
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
* Make DataLayout a plain object, not a pass.Rafael Espindola2014-02-25
| | | | | | | Instead, have a DataLayoutPass that holds one. This will allow parts of LLVM don't don't handle passes to also use DataLayout. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202168 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace the F_Binary flag with a F_Text one.Rafael Espindola2014-02-24
| | | | | | | | | 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 :-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202052 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Wire up support for writing bitcode with new PM.Chandler Carruth2014-01-13
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199078 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Simplify the interface exposed for IR printing passes.Chandler Carruth2014-01-12
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199044 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Rename the IR printing pass header to a more generic and correctChandler Carruth2014-01-12
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199041 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the LLVM IR asm writer header files into the IR directory, as theyChandler Carruth2014-01-07
| | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198688 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Encapsulate PassManager debug flags to avoid static init and cxa_exit."Andrew Trick2013-09-19
| | | | | | | | Working on a better solution to this. This reverts commit 7d4e9934e7ca83094c5cf41346966c8350179ff2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190990 91177308-0d34-0410-b5e6-96231b3b80d8
* Encapsulate PassManager debug flags to avoid static init and cxa_exit.Andrew Trick2013-09-18
| | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190974 91177308-0d34-0410-b5e6-96231b3b80d8
* whitespaceAndrew Trick2013-09-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190973 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a wrapper for open.Rafael Espindola2013-07-16
| | | | | | | This centralizes the handling of O_BINARY and opens the way for hiding more differences (like how open behaves with directories). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186447 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace uses of the deprecated std::auto_ptr with OwningPtr.Andy Gibbs2013-04-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179373 91177308-0d34-0410-b5e6-96231b3b80d8
* Split out the IRReader header and the utility functions it provides intoChandler Carruth2013-03-26
| | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177971 91177308-0d34-0410-b5e6-96231b3b80d8
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-02
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
* Sort the #include lines for tools/...Chandler Carruth2012-12-04
| | | | | | | | Again, tools are trickier to pick the main module header for than library source files. I've started to follow the pattern of using LLVMContext.h when it is included as a stub for program source files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169252 91177308-0d34-0410-b5e6-96231b3b80d8
* One more step towards making doInitialization and doFinalization useful forPedro Artigas2012-11-29
| | | | | | | | | start up and clean up module passes, now that ASAN and TSAN are fixed the tests pass git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168905 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r168635 "Step towards implementation of pass manager with ↵Owen Anderson2012-11-27
| | | | | | | | | doInitialization and doFinalization per module detangled from runOn?? calls, still has temporary code not to break ASAN to be removed when that pass conforms to the proposed model". It appears to have broken at least one buildbot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168654 91177308-0d34-0410-b5e6-96231b3b80d8
* Step towards implementation of pass manager with doInitialization and ↵Owen Anderson2012-11-26
| | | | | | | | | doFinalization per module detangled from runOn?? calls, still has temporary code not to break ASAN to be removed when that pass conforms to the proposed model Patch by Pedro Artigas, with feedback from by Chandler Carruth. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168635 91177308-0d34-0410-b5e6-96231b3b80d8
* Add doInitialization and doFinalization methods to ModulePass's, to allow ↵Owen Anderson2012-11-15
| | | | | | | | | them to be re-initialized and reused on multiple Module's. Patch by Pedro Artigas. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168008 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -alias and -ralias options to match what we have for functions andRafael Espindola2012-10-29
| | | | | | globals. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166909 91177308-0d34-0410-b5e6-96231b3b80d8
* Move TargetData to DataLayout.Micah Villmow2012-10-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165403 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove extraneous ".get()->" which is just "->". No functionality change.Nick Lewycky2011-12-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147379 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance llvm::SourceMgr to support diagnostic ranges, the same way clang ↵Chris Lattner2011-10-16
| | | | | | | | | | | | | | | | | does. Enhance the X86 asmparser to produce ranges in the one case that was annoying me, for example: test.s:10:15: error: invalid operand for instruction movl 0(%rax), 0(%edx) ^~~~~~~ It should be straight-forward to enhance filecheck, tblgen, and/or the .ll parser to use ranges where appropriate if someone is interested. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142106 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -rfunc and -rglob options to llvm-extract to support regularChad Rosier2011-09-16
| | | | | | expression matching. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139945 91177308-0d34-0410-b5e6-96231b3b80d8
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge System into Support.Michael J. Spencer2010-11-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
* Move tool_output_file into its own file.Dan Gohman2010-10-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115973 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix llvm-extract -delete's lazy loading to materialize the functions thatDan Gohman2010-09-23
| | | | | | | will not be deleted, rather than the ones that will. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114614 91177308-0d34-0410-b5e6-96231b3b80d8
* Make tool_output_file's raw_ostream instance a member variable insteadDan Gohman2010-09-01
| | | | | | | | | | | of a base class. This makes it possible to unregister the file from FilesToRemove when the file is done. Also, this eliminates the need for formatted_tool_output_file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112706 91177308-0d34-0410-b5e6-96231b3b80d8
* Rewrite ExtractGV, removing a bunch of stuff that didn't fully work,Dan Gohman2010-08-26
| | | | | | | and was over-complicated, and replacing it with a simple implementation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112120 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert llvm-extract to use lazy loading. This makes it substantiallyDan Gohman2010-08-25
| | | | | | | faster on large modules. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112110 91177308-0d34-0410-b5e6-96231b3b80d8
* Use tool_output_file in llvm-extract and llvm-link too.Dan Gohman2010-08-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111604 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't register stdout to be deleted on a signal.Dan Gohman2010-08-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111368 91177308-0d34-0410-b5e6-96231b3b80d8
* Preserve debug info for only extracted symbols.Devang Patel2010-07-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107417 91177308-0d34-0410-b5e6-96231b3b80d8
* Trim #includes.Dan Gohman2010-03-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99416 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support to llvm-extract for extracting multiple functions and/orDan Gohman2010-02-10
| | | | | | | multiple global variables at a time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95825 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix llvm-extract's "writing bitcode to a terminal" warning, which wasn'tDan Gohman2009-09-11
| | | | | | | | | | | | | | | | working. To support this, add an is_displayed() function to raw_ostream, and generalize Process::StandardOutIsDisplayed and friends in order to support it. Also, call RemoveFileOnSignal before creating a file instead of after, so that the file isn't left behind if the program is interrupted between when the file is created and RemoveFileOnSignal is called. While here, add a -S to llvm-extract and port it to IRReader so that it supports assembly input. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81568 91177308-0d34-0410-b5e6-96231b3b80d8
* Make LLVM command-line tools overwrite their output files without -f.Dan Gohman2009-08-25
| | | | | | | | | | | | | | | | | This is conventional command-line tool behavior. -f now just means "enable binary output on terminals". Add a -f option to llvm-extract and llvm-link, for consistency. Remove F_Force from raw_fd_ostream and enable overwriting and truncating by default. Introduce an F_Excl flag to permit users to enable a failure when the file already exists. This flag is currently unused. Update Makefiles and documentation accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79990 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify output file selection, fixing two FIXMEs about binary outputChris Lattner2009-08-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79808 91177308-0d34-0410-b5e6-96231b3b80d8
* Change raw_fd_ostream to take flags as an optional bitmask Chris Lattner2009-08-23
| | | | | | | | | | | | | | | | | | | instead of as two bools. Use this to add a F_Append flag which has the obvious behavior. Other unrelated changes conflated into this patch: 1. REmove EH stuff from llvm-dis and llvm-as, the try blocks are dead. 2. Simplify the filename inference code in llvm-as/llvm-dis, because raw_fd_ostream does the right thing with '-'. 3. Switch machine verifier to use raw_ostream instead of ostream (Which is the thing that needed append in the first place). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79807 91177308-0d34-0410-b5e6-96231b3b80d8
* "-" should write to stdout, not stderr.Chris Lattner2009-08-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79310 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert more tools code from cerr and cout to errs() and outs().Dan Gohman2009-07-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76070 91177308-0d34-0410-b5e6-96231b3b80d8
* To simplify the upcoming context-on-type change, switch all command line ↵Owen Anderson2009-07-15
| | | | | | | | | tools to using the default global context for now. This will let us to hardwire stuff to the global context in the short term while the API is sorted out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75846 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a Force option to raw_fd_ostream to specify whether openingDan Gohman2009-07-15
| | | | | | | | | an existing file is considered an error. Convert several tools to use raw_fd_ostream instead of std::ostream, and to use this new option instead of doing a manual check. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75801 91177308-0d34-0410-b5e6-96231b3b80d8
* Hold the LLVMContext by reference rather than by pointer.Owen Anderson2009-07-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74640 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a pointer to the owning LLVMContext to Module. This requires threading ↵Owen Anderson2009-07-01
| | | | | | | | | | | LLVMContext through a lot of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools. Patches for Clang and LLVM-GCC to follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74614 91177308-0d34-0410-b5e6-96231b3b80d8
* Use .empty() instead of .size().Dan Gohman2009-04-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69599 91177308-0d34-0410-b5e6-96231b3b80d8