summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Core.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [PM] Make the verifier work independently of any pass manager.Chandler Carruth2014-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This makes the 'verifyFunction' and 'verifyModule' functions totally independent operations on the LLVM IR. It also cleans up their API a bit by lifting the abort behavior into their clients and just using an optional raw_ostream parameter to control printing. The implementation of the verifier is now just an InstVisitor with no multiple inheritance. It also is significantly more const-correct, and hides the const violations internally. The two layers that force us to break const correctness are building a DomTree and dispatching through the InstVisitor. A new VerifierPass is used to implement the legacy pass manager interface in terms of the other pieces. The error messages produced may be slightly different now, and we may have slightly different short circuiting behavior with different usage models of the verifier, but generally everything works equivalently and this unblocks wiring the verifier up to the new pass manager. llvm-svn: 199569
* [PM] Remove the preverifier and directly compute the DominatorTree forChandler Carruth2014-01-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the verifier after ensuring the CFG is at least usefully formed. This fixes a number of problems: 1) The PreVerifier was missing the controls the Verifier provides over *how* an invalid module is handled -- it just aborted the program! Now it uses the same logic as the Verifier which is significantly more library-friendly. 2) The DominatorTree used previously could have been cached and not updated due to bugs in prior passes and we would silently use the stale tree. This could cause dominance errors to not be as quickly diagnosed. 3) We can now (in the next patch) pull the functionality of the verifier apart from the pass infrastructure so that you can verify IR without having any form of pass manager. This in turn frees the code to share logic between old and new pass manager variants. Along the way I fixed at least one annoying bug -- the state for 'Broken' wasn't being cleared from run to run causing all functions visited after the first broken function to be marked as broken regardless of whether *they* were a problem. Fortunately, I don't really know much of a way to observe this peculiarity. In case folks are worried about the runtime cost, its negligible. I looked at running the entire regression test suite (which should be a relatively good use of the verifier) before and after but was unable to even measure the time spent on the verifier and there was no regresion from before to after. I checked both with debug builds and optimized builds. llvm-svn: 199487
* Decouple dllexport/dllimport from linkageNico Rieck2014-01-141-6/+4
| | | | | | | | | | | | | | | | | | | Representing dllexport/dllimport as distinct linkage types prevents using these attributes on templates and inline functions. Instead of introducing further mixed linkage types to include linkonce and weak ODR, the old import/export linkage types are replaced with a new separate visibility-like specifier: define available_externally dllimport void @f() {} @Var = dllexport global i32 1, align 4 Linkage for dllexported globals and functions is now equal to their linkage without dllexport. Imported globals and functions must be either declarations with external linkage, or definitions with AvailableExternallyLinkage. llvm-svn: 199218
* Revert "Decouple dllexport/dllimport from linkage"Nico Rieck2014-01-141-4/+6
| | | | | | | | Revert this for now until I fix an issue in Clang with it. This reverts commit r199204. llvm-svn: 199207
* Decouple dllexport/dllimport from linkageNico Rieck2014-01-141-6/+4
| | | | | | | | | | | | | | | | | | | Representing dllexport/dllimport as distinct linkage types prevents using these attributes on templates and inline functions. Instead of introducing further mixed linkage types to include linkonce and weak ODR, the old import/export linkage types are replaced with a new separate visibility-like specifier: define available_externally dllimport void @f() {} @Var = dllexport global i32 1, align 4 Linkage for dllexported globals and functions is now equal to their linkage without dllexport. Imported globals and functions must be either declarations with external linkage, or definitions with AvailableExternallyLinkage. llvm-svn: 199204
* [PM] Split DominatorTree into a concrete analysis result object whichChandler Carruth2014-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | can be used by both the new pass manager and the old. This removes it from any of the virtual mess of the pass interfaces and lets it derive cleanly from the DominatorTreeBase<> template. In turn, tons of boilerplate interface can be nuked and it turns into a very straightforward extension of the base DominatorTree interface. The old analysis pass is now a simple wrapper. The names and style of this split should match the split between CallGraph and CallGraphWrapperPass. All of the users of DominatorTree have been updated to match using many of the same tricks as with CallGraph. The goal is that the common type remains the resulting DominatorTree rather than the pass. This will make subsequent work toward the new pass manager significantly easier. Also in numerous places things became cleaner because I switched from re-running the pass (!!! mid way through some other passes run!!!) to directly recomputing the domtree. llvm-svn: 199104
* [PM] Add module and function printing passes for the new pass manager.Chandler Carruth2014-01-121-2/+2
| | | | | | | | | This implements the legacy passes in terms of the new ones. It adds basic testing using explicit runs of the passes. Next up will be wiring the basic output mechanism of opt up when the new pass manager is engaged unless bitcode writing is requested. llvm-svn: 199049
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-071-2/+2
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. llvm-svn: 198685
* Remove unused value.Rafael Espindola2013-12-071-1/+1
| | | | llvm-svn: 196635
* Expose the fence instruction via the C API.Filip Pizlo2013-11-201-15/+24
| | | | llvm-svn: 195173
* Add addrspacecast instruction.Matt Arsenault2013-11-151-0/+11
| | | | | | Patch by Michele Scandale! llvm-svn: 194760
* [llvm-c] Implement LLVMPrintValueToStringPeter Zotov2013-11-061-0/+10
| | | | | | Original patch by Chris Wailes llvm-svn: 194135
* Remove linkonce_odr_auto_hide.Rafael Espindola2013-11-011-3/+2
| | | | | | | | | | | | | | | linkonce_odr_auto_hide was in incomplete attempt to implement a way for the linker to hide symbols that are known to be available in every TU and whose addresses are not relevant for a particular DSO. It was redundant in that it all its uses are equivalent to linkonce_odr+unnamed_addr. Unlike those, it has never been connected to clang or llvm's optimizers, so it was effectively dead. Given that nothing produces it, this patch just nukes it (other than the llvm-c enum value). llvm-svn: 193865
* Fix misapplied patch in r193597Anders Waldenborg2013-10-291-2/+2
| | | | | | Sorry Peter Zotov, entirely my fault. llvm-svn: 193598
* llvm-c: Make LLVM{Get,Set}Alignment work on {Load,Store}Inst tooAnders Waldenborg2013-10-291-4/+22
| | | | | | | | Patch by Peter Zotov Differential Revision: http://llvm-reviews.chandlerc.com/D1910 llvm-svn: 193597
* llvm-c: Add LLVMPrintTypeToStringAnders Waldenborg2013-10-221-0/+10
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D1963 llvm-svn: 193149
* llvm-c: Add LLVMDumpTypeAnders Waldenborg2013-10-161-0/+4
| | | | | | | | | | The C API currently allows to dump values (LLVMDumpValue), but a similar method for types was not exported. Patch by Peter Zotov Differential Revision: http://llvm-reviews.chandlerc.com/D1911 llvm-svn: 192852
* [llvm-c] Add LLVMPrintModuleToString.Anders Waldenborg2013-10-161-0/+10
| | | | | | | | | Like LLVMDumpModule but returns the string (that needs to be freed with LLVMDisposeMessage) instead of printing it to stderr. Differential Revision: http://llvm-reviews.chandlerc.com/D1941 llvm-svn: 192821
* Revert "Encapsulate PassManager debug flags to avoid static init and cxa_exit."Andrew Trick2013-09-191-1/+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/+1
| | | | | | | | | | | | | | 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-19/+19
| | | | llvm-svn: 190973
* Expose the RTDyldMemoryManager through the C API. This allows clients of Filip Pizlo2013-05-221-0/+4
| | | | | | | | the C API to provide their own way of allocating JIT memory (both code and data) and finalizing memory permissions (page protections, cache flush). llvm-svn: 182448
* Roll out r182407 and r182408 because they broke builds.Filip Pizlo2013-05-211-4/+0
| | | | llvm-svn: 182409
* Expose the RTDyldMemoryManager through the C API. This allows clients of Filip Pizlo2013-05-211-0/+4
| | | | | | | | the C API to provide their own way of allocating JIT memory (both code and data) and finalizing memory permissions (page protections, cache flush). llvm-svn: 182408
* This patch breaks up Wrap.h so that it does not have to include all of Filip Pizlo2013-05-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | the things, and renames it to CBindingWrapping.h. I also moved CBindingWrapping.h into Support/. This new file just contains the macros for defining different wrap/unwrap methods. The calls to those macros, as well as any custom wrap/unwrap definitions (like for array of Values for example), are put into corresponding C++ headers. Doing this required some #include surgery, since some .cpp files relied on the fact that including Wrap.h implicitly caused the inclusion of a bunch of other things. This also now means that the C++ headers will include their corresponding C API headers; for example Value.h must include llvm-c/Core.h. I think this is harmless, since the C API headers contain just external function declarations and some C types, so I don't believe there should be any nasty dependency issues here. llvm-svn: 180881
* Expose IRBuilder::CreateAtomicRMW as LLVMBuildAtomicRMW in llvm-c.Carlo Kok2013-04-231-0/+36
| | | | llvm-svn: 180100
* Move C++ code out of the C headers and into either C++ headersEric Christopher2013-04-221-0/+1
| | | | | | | or the C++ files themselves. This enables people to use just a C compiler to interoperate with LLVM. llvm-svn: 180063
* C API: Fix coding styleTom Stellard2013-04-181-1/+1
| | | | llvm-svn: 179785
* Appease a gcc warning about an overflow in a constant conversion.Bill Wendling2013-04-171-1/+2
| | | | llvm-svn: 179703
* Don't store AttributeSet::FunctionIndex as an int.Benjamin Kramer2013-04-171-1/+1
| | | | | | | | GCC complains: Core.cpp:1449:27: warning: overflow in implicit constant conversion [-Woverflow] I'm not sure if that's really a problem here, but using the enum type is better style anyways. llvm-svn: 179696
* C API: Add LLVMGetBufferSize()Tom Stellard2013-04-161-0/+4
| | | | llvm-svn: 179647
* C API: Add LLVMGetBufferStart()Tom Stellard2013-04-161-0/+3
| | | | llvm-svn: 179646
* C API: Add LLVMAddTargetDependentFunctionAttr()Tom Stellard2013-04-161-0/+11
| | | | llvm-svn: 179645
* Add four new functions and one new enum to the C API:Hans Wennborg2013-04-161-0/+47
| | | | | | | | | | | | LLVMGetThreadLocalMode - exposes GlobalVariable::getThreadLocalMode LLVMSetThreadLocalMode - exposes GlobalVariable::setThreadLocalMode LLVMIsExternallyInitialized - exposes GlobalVariable::isExternallyInitialized LLVMSetExternallyInitialized - exposes GlobalVariable::setExternallyInitialized LLVMThreadLocalMode - maps to GlobalVariable::ThreadLocalMode Patch by Moritz Maxeiner! llvm-svn: 179588
* Add multithreading functions and shutdown to the C API. Patch by MoritzDuncan Sands2013-02-171-0/+20
| | | | | | Maxeiner. llvm-svn: 175398
* s/bool/LLVMBool/Bill Wendling2013-02-141-1/+1
| | | | llvm-svn: 175204
* Add two new functions to the C API:Bill Wendling2013-02-141-0/+23
| | | | | | | | | LLVMCreateMemoryBufferWithMemoryRange - exposes MemoryBuffer::getMemBuffer LLVMCreateMemoryBufferWithMemoryRangeCopy - exposes MemoryBuffer::getMemBufferCopy Patch by Moritz Maxeiner! llvm-svn: 175199
* Enable *BasicBlockPass::createPrinterPass()Sergei Larin2013-02-081-0/+1
| | | | | | Enables raw_ostream I/O for BasicBlockPass. llvm-svn: 174776
* Remove addRetAttributes and addFnAttributes, which aren't useful abstractions.Bill Wendling2013-01-301-3/+3
| | | | llvm-svn: 173992
* Remove the last of uses that use the Attribute object as a collection of ↵Bill Wendling2013-01-231-4/+4
| | | | | | | | | attributes. Collections of attributes are handled via the AttributeSet class now. This finally frees us up to make significant changes to how attributes are structured. llvm-svn: 173228
* Use the AttributeSet when removing multiple attributes. Use Attribute::AttrKindBill Wendling2013-01-231-5/+7
| | | | | | when removing one attribute. This further encapsulates the use of the attributes. llvm-svn: 173214
* More encapsulation work.Bill Wendling2013-01-221-6/+10
| | | | | | | Use the AttributeSet when we're talking about more than one attribute. Add a function that adds a single attribute. No functionality change intended. llvm-svn: 173196
* Revert s/Raw/getBitMask/g name change. This is possibly causing LTO test ↵Bill Wendling2013-01-091-2/+2
| | | | | | hangings. llvm-svn: 172020
* Move the initialization to the Analysis library as well as the pass.Chandler Carruth2013-01-071-1/+0
| | | | | | | This was (somewhat distressingly) only caught be the ocaml bindings tests... llvm-svn: 171690
* Convert the TargetTransformInfo from an immutable pass with dynamicChandler Carruth2013-01-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | interfaces which could be extracted from it, and must be provided on construction, to a chained analysis group. The end goal here is that TTI works much like AA -- there is a baseline "no-op" and target independent pass which is in the group, and each target can expose a target-specific pass in the group. These passes will naturally chain allowing each target-specific pass to delegate to the generic pass as needed. In particular, this will allow a much simpler interface for passes that would like to use TTI -- they can have a hard dependency on TTI and it will just be satisfied by the stub implementation when that is all that is available. This patch is a WIP however. In particular, the "stub" pass is actually the one and only pass, and everything there is implemented by delegating to the target-provided interfaces. As a consequence the tools still have to explicitly construct the pass. Switching targets to provide custom passes and sinking the stub behavior into the NoTTI pass is the next step. llvm-svn: 171621
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-021-10/+10
| | | | | | | | | | | | | | | | | | | | | 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
* Rename VMCore directory to IR.Chandler Carruth2013-01-021-0/+2408
Aside from moving the actual files, this patch only updates the build system and the source file comments under lib/... that are relevant. I'll be updating other docs and other files in smaller subsequnet commits. While I've tried to test this, but it is entirely possible that there will still be some build system fallout. Also, note that I've not changed the library name itself: libLLVMCore.a is still the library name. I'd be interested in others' opinions about whether we should rename this as well (I think we should, just not sure what it might break) llvm-svn: 171359
OpenPOWER on IntegriCloud