summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Module.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "IR: MDNode => Value"Duncan P. N. Exon Smith2014-11-111-2/+1
| | | | | | | | | | | | | | | | | Instead, we're going to separate metadata from the Value hierarchy. See PR21532. This reverts commit r221375. This reverts commit r221373. This reverts commit r221359. This reverts commit r221167. This reverts commit r221027. This reverts commit r221024. This reverts commit r221023. This reverts commit r220995. This reverts commit r220994. llvm-svn: 221711
* Add Position-independent Code model Module API.Justin Hibbits2014-11-071-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This makes PIC levels a Module flag attribute, which can be queried by the backend. The flag is named `PIC Level`, and can have a value of: 0 - Backend-default 1 - Small-model (-fpic) 2 - Large-model (-fPIC) These match the `-pic-level' command line argument for clang, and the value of the preprocessor macro `__PIC__'. Test Plan: New flags tests specific for the 'PIC Level' module flag. Tests to be added as part of a future commit for PowerPC, which will use this new API. Reviewers: rafael, echristo Reviewed By: rafael, echristo Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D5882 llvm-svn: 221510
* IR: MDNode => Value: NamedMDNode::getOperator()Duncan P. N. Exon Smith2014-11-051-1/+2
| | | | | | | | | | | | | Change `NamedMDNode::getOperator()` from returning `MDNode *` to returning `Value *`. To reduce boilerplate at some call sites, add a `getOperatorAsMDNode()` for named metadata that's expected to only return `MDNode` -- for now, that's everything, but debug node named metadata (such as llvm.dbg.cu and llvm.dbg.sp) will soon change. This is part of PR21433. Note that there's a follow-up patch to clang for the API change. llvm-svn: 221375
* Modernize the error handling of the Materialize function.Rafael Espindola2014-10-241-9/+4
| | | | llvm-svn: 220600
* Don't ever call materializeAllPermanently during LTO.Rafael Espindola2014-10-241-6/+0
| | | | | | | | | | To do this, change the representation of lazy loaded functions. The previous representation cannot differentiate between a function whose body has been removed and one whose body hasn't been read from the .bc file. That means that in order to drop a function, the entire body had to be read. llvm-svn: 220580
* Be more careful in parsing Module::ModFlagBehavior valueAlexey Samsonov2014-09-081-4/+15
| | | | | | | | | | to make sure we don't do invalid load of an enum. Share the conversion code between llvm::Module implementation and the verifier. This bug was reported by UBSan. llvm-svn: 217395
* Pass a MemoryBufferRef when we can avoid taking ownership.Rafael Espindola2014-08-261-4/+1
| | | | | | | | | | | | | The attached patch simplifies a few interfaces that don't need to take ownership of a buffer. For example, both parseAssembly and parseBitcodeFile will parse the entire buffer before returning. There is no need to take ownership. Using a MemoryBufferRef makes it obvious in the type signature that there is no ownership transfer. llvm-svn: 216488
* IR: cleanup Module::dropReferencesDavid Majnemer2014-07-031-6/+6
| | | | | | This replaces some old-style loops with range-based for. llvm-svn: 212278
* IR: Add COMDATs to the IRDavid Majnemer2014-06-271-0/+8
| | | | | | | | | | | | | | | | This new IR facility allows us to represent the object-file semantic of a COMDAT group. COMDATs allow us to tie together sections and make the inclusion of one dependent on another. This is required to implement features like MS ABI VFTables and optimizing away certain kinds of initialization in C++. This functionality is only representable in COFF and ELF, Mach-O has no similar mechanism. Differential Revision: http://reviews.llvm.org/D4178 llvm-svn: 211920
* Random Number Generator (llvm)JF Bastien2014-06-251-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | Provides an abstraction for a random number generator (RNG) that produces a stream of pseudo-random numbers. The current implementation uses C++11 facilities and is therefore not cryptographically secure. The RNG is salted with the text of the current command line invocation. In addition, a user may specify a seed (reproducible builds). In clang, the seed can be set via -frandom-seed=X In the back end, the seed can be set via -rng-seed=X This is the llvm part of the patch. clang part: D3391 URL: http://reviews.llvm.org/D3390 Author: yln I'm landing this for the second time, it broke Windows bots the first time around. llvm-svn: 211705
* Make ObjectFile and BitcodeReader always own the MemoryBuffer.Rafael Espindola2014-06-231-1/+4
| | | | | | | | | | This allows us to just use a std::unique_ptr to store the pointer to the buffer. The flip side is that they have to support releasing the buffer back to the caller. Overall this looks like a more efficient and less brittle api. llvm-svn: 211542
* Revert "Random Number Generator (llvm)"JF Bastien2014-06-181-14/+1
| | | | | | | | This reverts commit cccba093090d127e0b6d17473b14c264c14c5259. It causes build breakage. llvm-svn: 211146
* Random Number Generator (llvm)JF Bastien2014-06-181-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Provides an abstraction for a random number generator (RNG) that produces a stream of pseudo-random numbers. The current implementation uses C++11 facilities and is therefore not cryptographically secure. The RNG is salted with the text of the current command line invocation. In addition, a user may specify a seed (reproducible builds). In clang, the seed can be set via -frandom-seed=X In the back end, the seed can be set via -rng-seed=X This is the llvm part of the patch. clang part: D3391 Reviewers: ahomescu, rinon, nicholas, jfb Reviewed By: jfb Subscribers: jfb, perl Differential Revision: http://reviews.llvm.org/D3390 llvm-svn: 211145
* Remove 'using std::errro_code' from lib.Rafael Espindola2014-06-131-7/+6
| | | | llvm-svn: 210871
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-121-0/+1
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-311-2/+2
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. llvm-svn: 209952
* Fix bug 19437 - Only add discriminators for DWARF 4 and above.Diego Novillo2014-04-171-0/+8
| | | | | | | | | | | | | | Summary: This prevents the discriminator generation pass from triggering if the DWARF version being used in the module is prior to 4. Reviewers: echristo, dblaikie CC: llvm-commits Differential Revision: http://reviews.llvm.org/D3413 llvm-svn: 206507
* [C++11] More 'nullptr' conversion or in some cases just using a boolean ↵Craig Topper2014-04-091-6/+6
| | | | | | check instead of comparing to nullptr. llvm-svn: 205831
* Module: Don't rename in getOrInsertFunction()Duncan P. N. Exon Smith2014-03-101-10/+0
| | | | | | | | | | | | | | | | | | | | | | | During LTO, user-supplied definitions of C library functions often exist. -instcombine uses Module::getOrInsertFunction() to get a handle on library functions (e.g., @puts, when optimizing @printf). Previously, Module::getOrInsertFunction() would rename any matching functions with local linkage, and create a new declaration. In LTO, this is the opposite of desired behaviour, as it skips by the user-supplied version of the library function and creates a new undefined reference which the linker often cannot resolve. After some discussing with Rafael on the list, it looks like it's undesired behaviour. If a consumer actually *needs* this behaviour, we should add new API with a more explicit name. I added two testcases: one specifically for the -instcombine behaviour and one for the LTO flow. <rdar://problem/16165191> llvm-svn: 203513
* [C++11] Modernize the IR library a bit.Benjamin Kramer2014-03-101-4/+2
| | | | | | No functionality change. llvm-svn: 203465
* 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
* [Layering] Move GVMaterializer.h into the IR library where itsChandler Carruth2014-03-061-1/+1
| | | | | | | | | | | | | implementation already lived. After this commit, the only IR-library headers in include/llvm/* are ones related to the legacy pass infrastructure that I'm planning to leave there until the new one is farther along. The only other headers at the top level are linking and initialization aids that aren't really libraries but just headers. llvm-svn: 203069
* [Modules] Move the LeakDetector header into the IR library where theChandler Carruth2014-03-041-1/+1
| | | | | | | | | | | source file had already been moved. Also move the unittest into the IR unittest library. This may seem an odd thing to put in the IR library but we only really use this with instructions and it needs the LLVM context to work, so it is intrinsically tied to the IR library. llvm-svn: 202842
* Fix resetting the DataLayout in a Module.Rafael Espindola2014-02-251-1/+5
| | | | | | | | | | | | | | | No tool does this currently, but as everything else in a module we should be able to change its DataLayout. Most of the fix is in DataLayout to make sure it can be reset properly. The test uses Module::setDataLayout since the fact that we mutate a DataLayout is an implementation detail. The module could hold a OwningPtr<DataLayout> and the DataLayout itself could be immutable. Thanks to Philip Reames for pushing me in the right direction. llvm-svn: 202198
* Store a DataLayout in Module.Rafael Espindola2014-02-251-2/+26
| | | | | | | | | | | | | | Now that DataLayout is not a pass, store one in Module. Since the C API expects to be able to get a char* to the datalayout description, we have to keep a std::string somewhere. This patch keeps it in Module and also uses it to represent modules without a DataLayout. Once DataLayout is mandatory, we should probably move the string to DataLayout itself since it won't be necessary anymore to represent the special case of a module without a DataLayout. llvm-svn: 202190
* Return an error_code from materializeAllPermanently.Rafael Espindola2014-01-141-7/+5
| | | | llvm-svn: 199275
* Use error_code in Module::materializeAll.Rafael Espindola2014-01-141-9/+7
| | | | llvm-svn: 199269
* Re-remove dead code.Nadav Rotem2014-01-091-45/+0
| | | | | | This reverts r198854. llvm-svn: 198879
* Revert r198819 - "Remove dead code."Nadav Rotem2014-01-091-0/+45
| | | | llvm-svn: 198854
* Remove dead code.Rafael Espindola2014-01-091-45/+0
| | | | llvm-svn: 198819
* When parsing data layout string looking for endianness, use the correct defaultDmitri Gribenko2013-12-201-1/+1
| | | | llvm-svn: 197771
* Correctly apply the default pointer sizeDmitri Gribenko2013-12-201-1/+1
| | | | llvm-svn: 197770
* Debug Info: drop debug info via upgrading path if version number does not match.Manman Ren2013-12-021-5/+10
| | | | | | | | | | | | | | Add a helper function getDebugInfoVersionFromModule to return the debug info version number for a module. "Verifier/module-flags-1.ll" checks for verification errors. It will seg fault when calling getDebugInfoVersionFromModule because of the incorrect format for module flags in the testing case. We make getModuleFlagsMetadata more robust by checking for error conditions. PR17982 llvm-svn: 196158
* Use error_code in GVMaterializer.Rafael Espindola2013-11-051-4/+15
| | | | | | They just propagate out the bitcode reader error, so we don't need a new enum. llvm-svn: 194091
* Reuse variableMatt Arsenault2013-09-301-1/+1
| | | | llvm-svn: 191712
* Fix getOrInsertGlobal dropping the address space.Matt Arsenault2013-09-301-2/+4
| | | | | | | | Currently it will insert an illegal bitcast. Arguably, the address space argument should be added for the creation case. llvm-svn: 191702
* Fix typoMatt Arsenault2013-09-281-1/+1
| | | | llvm-svn: 191595
* Make these methods const correct.Rafael Espindola2013-07-251-2/+1
| | | | | | Thanks to Nick Lewycky for noticing it. llvm-svn: 187098
* Add getModuleFlag(StringRef Key) to query a module flag given Key.Manman Ren2013-07-161-0/+13
| | | | | | No functionality change. llvm-svn: 186470
* Remove dead code.Eli Bendersky2013-05-151-17/+0
| | | | | | This method is not being used/tested anywhere. llvm-svn: 181943
* Removed extraneous #include "LLVMContextImpl.h" from lib/IR/Module.cppJean-Luc Duprat2013-03-011-1/+0
| | | | llvm-svn: 176382
* Cache the result of Function::getIntrinsicID() in a DenseMap attached to the ↵Michael Ilseman2013-03-011-0/+1
| | | | | | | | | | LLVMContext. This reduces the time actually spent doing string to ID conversion and shows a 10% improvement in compile time for a particularly bad case that involves ARM Neon intrinsics (these have many overloads). Patch by Jean-Luc Duprat! llvm-svn: 176365
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-021-5/+5
| | | | | | | | | | | | | | | | | | | | | 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/+451
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