aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-extract/llvm-extract.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-11-09[tools] Unbreak the GCC build (workaround a GCC bug).Davide Italiano1-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
2016-11-09Bitcode: Change the materializer interface to return llvm::Error.Peter Collingbourne1-7/+5
Differential Revision: https://reviews.llvm.org/D26439 llvm-svn: 286382
2016-06-09Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith1-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
2016-04-14Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini1-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
2016-01-15Bring back "Assert that we have all use/users in the getters."Rafael Espindola1-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
2016-01-14Revert "Assert that we have all use/users in the getters."Michael Zolotukhin1-12/+3
This reverts commit fdb838f3f8a8b6896bbbd5285555874eb3b748eb. llvm-svn: 257751
2015-12-19Assert that we have all use/users in the getters.Rafael Espindola1-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
2015-12-18Delete dead code: only functions are materializable.Rafael Espindola1-4/+0
llvm-svn: 256052
2015-12-18Use a lambda to reduce code duplication.Rafael Espindola1-23/+15
llvm-svn: 256050
2015-04-15uselistorder: Remove the global bitsDuncan P. N. Exon Smith1-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
2015-04-15uselistorder: Pull the bit through PrintModulePassDuncan P. N. Exon Smith1-1/+2
Now the callers of `PrintModulePass()` (etc.) that care about use-list order in assembly pass in the flag. llvm-svn: 234969
2015-04-15uselistorder: Pull bit through BitcodeWriterPassDuncan P. N. Exon Smith1-1/+2
Now the callers of `BitcodeWriterPass` decide whether or not to preserve bitcode use-list order. llvm-svn: 234959
2015-04-14IR: Set -preserve-bc-uselistorder=false by defaultDuncan P. N. Exon Smith1-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
2015-03-04Make DataLayout Non-Optional in the ModuleMehdi Amini1-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
2015-02-13[PM] Remove the old 'PassManager.h' header file at the top level ofChandler Carruth1-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
2014-11-01Remove redundant calls to isMaterializable.Rafael Espindola1-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
2014-10-24Modernize the error handling of the Materialize function.Rafael Espindola1-9/+9
llvm-svn: 220600
2014-09-10Add doInitialization/doFinalization to DataLayoutPass.Rafael Espindola1-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
2014-08-26Return a std::unique_ptr from the IRReader.h functions. NFC.Rafael Espindola1-2/+1
llvm-svn: 216466
2014-08-25Modernize raw_fd_ostream's constructor a bit.Rafael Espindola1-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
2014-05-08Use range loops.Rafael Espindola1-13/+9
llvm-svn: 208353
2014-04-29raw_ostream: Forward declare OpenFlags and include FileSystem.h only where ↵Benjamin Kramer1-0/+1
necessary. llvm-svn: 207593
2014-04-25[C++] Use 'nullptr'. Tools edition.Craig Topper1-1/+1
llvm-svn: 207176
2014-03-06Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles1-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
2014-02-25Make DataLayout a plain object, not a pass.Rafael Espindola1-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
2014-02-24Replace the F_Binary flag with a F_Text one.Rafael Espindola1-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
2014-01-13[PM] Wire up support for writing bitcode with new PM.Chandler Carruth1-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
2014-01-12[PM] Simplify the interface exposed for IR printing passes.Chandler Carruth1-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
2014-01-12[PM] Rename the IR printing pass header to a more generic and correctChandler Carruth1-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
2014-01-07Move the LLVM IR asm writer header files into the IR directory, as theyChandler Carruth1-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
2013-09-19Revert "Encapsulate PassManager debug flags to avoid static init and cxa_exit."Andrew Trick1-4/+0
Working on a better solution to this. This reverts commit 7d4e9934e7ca83094c5cf41346966c8350179ff2. llvm-svn: 190990
2013-09-18Encapsulate PassManager debug flags to avoid static init and cxa_exit.Andrew Trick1-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
2013-09-18whitespaceAndrew Trick1-1/+1
llvm-svn: 190973
2013-07-16Add a wrapper for open.Rafael Espindola1-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
2013-04-12Replace uses of the deprecated std::auto_ptr with OwningPtr.Andy Gibbs1-1/+1
llvm-svn: 179373
2013-03-26Split out the IRReader header and the utility functions it provides intoChandler Carruth1-1/+2
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
2013-01-02Move all of the header files which are involved in modelling the LLVM IRChandler Carruth1-3/+3
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. llvm-svn: 171366
2012-12-04Sort the #include lines for tools/...Chandler Carruth1-8/+8
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. llvm-svn: 169252
2012-11-29One more step towards making doInitialization and doFinalization useful forPedro Artigas1-2/+0
start up and clean up module passes, now that ASAN and TSAN are fixed the tests pass llvm-svn: 168905
2012-11-27Revert r168635 "Step towards implementation of pass manager with ↵Owen Anderson1-0/+2
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. llvm-svn: 168654
2012-11-26Step towards implementation of pass manager with doInitialization and ↵Owen Anderson1-2/+0
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. llvm-svn: 168635
2012-11-15Add doInitialization and doFinalization methods to ModulePass's, to allow ↵Owen Anderson1-0/+2
them to be re-initialized and reused on multiple Module's. Patch by Pedro Artigas. llvm-svn: 168008
2012-10-29Add -alias and -ralias options to match what we have for functions andRafael Espindola1-0/+47
globals. llvm-svn: 166909
2012-10-08Move TargetData to DataLayout.Micah Villmow1-2/+2
llvm-svn: 165403
2011-12-30Remove extraneous ".get()->" which is just "->". No functionality change.Nick Lewycky1-5/+5
llvm-svn: 147379
2011-10-16Enhance llvm::SourceMgr to support diagnostic ranges, the same way clang ↵Chris Lattner1-1/+1
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. llvm-svn: 142106
2011-09-16Add -rfunc and -rglob options to llvm-extract to support regularChad Rosier1-6/+71
expression matching. llvm-svn: 139945
2011-07-09Land the long talked about "type system rewrite" patch. ThisChris Lattner1-1/+0
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. llvm-svn: 134829
2010-11-29Merge System into Support.Michael J. Spencer1-1/+1
llvm-svn: 120298
2010-10-07Move tool_output_file into its own file.Dan Gohman1-1/+1
llvm-svn: 115973