summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
Commit message (Collapse)AuthorAgeFilesLines
* [C++11] Add range based accessors for the Use-Def chain of a Value.Chandler Carruth2014-03-093-19/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requires a number of steps. 1) Move value_use_iterator into the Value class as an implementation detail 2) Change it to actually be a *Use* iterator rather than a *User* iterator. 3) Add an adaptor which is a User iterator that always looks through the Use to the User. 4) Wrap these in Value::use_iterator and Value::user_iterator typedefs. 5) Add the range adaptors as Value::uses() and Value::users(). 6) Update *all* of the callers to correctly distinguish between whether they wanted a use_iterator (and to explicitly dig out the User when needed), or a user_iterator which makes the Use itself totally opaque. Because #6 requires churning essentially everything that walked the Use-Def chains, I went ahead and added all of the range adaptors and switched them to range-based loops where appropriate. Also because the renaming requires at least churning every line of code, it didn't make any sense to split these up into multiple commits -- all of which would touch all of the same lies of code. The result is still not quite optimal. The Value::use_iterator is a nice regular iterator, but Value::user_iterator is an iterator over User*s rather than over the User objects themselves. As a consequence, it fits a bit awkwardly into the range-based world and it has the weird extra-dereferencing 'operator->' that so many of our iterators have. I think this could be fixed by providing something which transforms a range of T&s into a range of T*s, but that *can* be separated into another patch, and it isn't yet 100% clear whether this is the right move. However, this change gets us most of the benefit and cleans up a substantial amount of code around Use and User. =] llvm-svn: 203364
* 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
* [Layering] Move AutoUpgrade.h into the IR library where itsChandler Carruth2014-03-051-1/+1
| | | | | | implementation already lives. llvm-svn: 202961
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-052-7/+7
| | | | | | class. llvm-svn: 202946
* [Modules] Move ValueHandle into the IR library where Value itself lives.Chandler Carruth2014-03-041-1/+1
| | | | | | | | | | | Move the test for this class into the IR unittests as well. This uncovers that ValueMap too is in the IR library. Ironically, the unittest for ValueMap is useless in the Support library (honestly, so was the ValueHandle test) and so it already lives in the IR unittests. Mmmm, tasty layering. llvm-svn: 202821
* Switch all uses of LLVM_OVERRIDE to just use 'override' directly.Craig Topper2014-03-021-2/+2
| | | | llvm-svn: 202621
* Now that we have C++11, turn simple functors into lambdas and remove a ton ↵Benjamin Kramer2014-03-011-19/+9
| | | | | | | | of boilerplate. No intended functionality change. llvm-svn: 202588
* Store a DataLayout in Module.Rafael Espindola2014-02-251-3/+3
| | | | | | | | | | | | | | 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
* 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
* Make parseBitcodeFile return an ErrorOr<Module *>.Rafael Espindola2014-01-152-18/+11
| | | | llvm-svn: 199279
* Return an error_code from materializeAllPermanently.Rafael Espindola2014-01-141-1/+3
| | | | llvm-svn: 199275
* Decouple dllexport/dllimport from linkageNico Rieck2014-01-142-9/+53
| | | | | | | | | | | | | | | | | | | 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-142-53/+9
| | | | | | | | 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-142-9/+53
| | | | | | | | | | | | | | | | | | | 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
* Update getLazyBitcodeModule to use ErrorOr for error handling.Rafael Espindola2014-01-132-13/+17
| | | | llvm-svn: 199125
* [PM] Wire up support for writing bitcode with new PM.Chandler Carruth2014-01-131-3/+9
| | | | | | | | | | 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
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-071-1/+1
| | | | | | | | | | 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
* Begin adding docs and IR-level support for the inalloca attributeReid Kleckner2013-12-192-0/+4
| | | | | | | | | | | | | | | | | | | The inalloca attribute is designed to support passing C++ objects by value in the Microsoft C++ ABI. It behaves the same as byval, except that it always implies that the argument is in memory and that the bytes are never copied. This attribute allows the caller to take the address of an outgoing argument's memory and execute arbitrary code to store into it. This patch adds basic IR support, docs, and verification. It does not attempt to implement any lowering or fix any possibly broken transforms. When this patch lands, a complete description of this feature should appear at http://llvm.org/docs/InAlloca.html . Differential Revision: http://llvm-reviews.chandlerc.com/D2173 llvm-svn: 197645
* Remove unused value.Rafael Espindola2013-12-071-1/+0
| | | | llvm-svn: 196635
* Debug Info: drop debug info via upgrading path if version number does not match.Manman Ren2013-12-021-0/+1
| | | | | | | | | | | | | | 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
* Fix spacing, forward declare order.Matt Arsenault2013-11-182-2/+2
| | | | llvm-svn: 194985
* Add addrspacecast instruction.Matt Arsenault2013-11-152-2/+13
| | | | | | Patch by Michele Scandale! llvm-svn: 194760
* Extract a bc attr parsing helper that returns Attribute::None on errorReid Kleckner2013-11-121-78/+49
| | | | | | | The parsing method still returns llvm::error_code for consistency with other parsing methods. Minor cleanup, no functionality change. llvm-svn: 194437
* Use error_code in GVMaterializer.Rafael Espindola2013-11-052-19/+19
| | | | | | They just propagate out the bitcode reader error, so we don't need a new enum. llvm-svn: 194091
* Convert FindFunctionInStream to return an error_code.Rafael Espindola2013-11-052-5/+6
| | | | llvm-svn: 194084
* Silence GCC warning about dropping off a fully covered switch.Benjamin Kramer2013-11-051-0/+1
| | | | llvm-svn: 194077
* Change BitcodeReader to use error_code instead of bool + string.Rafael Espindola2013-11-042-379/+493
| | | | | | | | In order to create an ObjectFile implementation that uses bitcode files, we need to propagate the bitcode errors to the ObjectFile interface, so we need to convert it to use the same error handling as ObjectFile: error_code. llvm-svn: 193996
* Remove linkonce_odr_auto_hide.Rafael Espindola2013-11-012-2/+0
| | | | | | | | | | | | | | | 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 a use after free on invalid input.Rafael Espindola2013-10-311-5/+1
| | | | llvm-svn: 193737
* Revert r193251 : Use address-taken to disambiguate global variable and ↵Shuxin Yang2013-10-272-6/+1
| | | | | | indirect memops. llvm-svn: 193489
* Use address-taken to disambiguate global variable and indirect memops.Shuxin Yang2013-10-232-1/+6
| | | | | | | | | | Major steps include: 1). introduces a not-addr-taken bit-field in GlobalVariable 2). GlobalOpt pass sets "not-address-taken" if it proves a global varirable dosen't have its address taken. 3). AA use this info for disambiguation. llvm-svn: 193251
* Update comment list of GLOBALVAR modifiers in BitcodeWriter to include ↵Michael Gottesman2013-10-141-1/+1
| | | | | | | | externally_initialized. Thanks to Shuxin Yang for catching this. llvm-svn: 192637
* AutoUpgrade: upgrade from scalar TBAA format to struct-path aware TBAA format.Manman Ren2013-09-282-0/+8
| | | | | | | We treat TBAA tags as struct-path aware TBAA format when the first operand is a MDNode and the tag has 3 or more operands. llvm-svn: 191593
* Implement function prefix data as an IR feature.Peter Collingbourne2013-09-164-1/+29
| | | | | | | | | Previous discussion: http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-July/063909.html Differential Revision: http://llvm-reviews.chandlerc.com/D1191 llvm-svn: 190773
* Patch provide by Tom Roeder!Joe Abbey2013-09-121-6/+15
| | | | | | | | | | | Reviewed by Joe Abbey and Tobias Grosser Here is a patch that fixes decoding of CE_SELECT in BitcodeReader, along with a simple test case. The problem in the current code is that it generates but doesn't accept bitcode that uses vectors for the first element of a select in this context. llvm-svn: 190634
* Revert "Give internal classes hidden visibility."Benjamin Kramer2013-09-112-4/+4
| | | | | | | It works with clang, but GCC has different rules so we can't make all of those hidden. This reverts commit r190534. llvm-svn: 190536
* Give internal classes hidden visibility.Benjamin Kramer2013-09-112-4/+4
| | | | | | Worth 100k on a linux/x86_64 Release+Asserts clang. llvm-svn: 190534
* Revert patches to add case-range support for PR1255.Bob Wilson2013-09-092-103/+39
| | | | | | | | | | | | | | | | | The work on this project was left in an unfinished and inconsistent state. Hopefully someone will eventually get a chance to implement this feature, but in the meantime, it is better to put things back the way the were. I have left support in the bitcode reader to handle the case-range bitcode format, so that we do not lose bitcode compatibility with the llvm 3.3 release. This reverts the following commits: 155464, 156374, 156377, 156613, 156704, 156757, 156804 156808, 156985, 157046, 157112, 157183, 157315, 157384, 157575, 157576, 157586, 157612, 157810, 157814, 157815, 157880, 157881, 157882, 157884, 157887, 157901, 158979, 157987, 157989, 158986, 158997, 159076, 159101, 159100, 159200, 159201, 159207, 159527, 159532, 159540, 159583, 159618, 159658, 159659, 159660, 159661, 159703, 159704, 160076, 167356, 172025, 186736 llvm-svn: 190328
* Add function attribute 'optnone'.Andrea Di Biagio2013-08-232-0/+5
| | | | | | | | This function attribute indicates that the function is not optimized by any optimization or code generator passes with the exception of interprocedural optimization passes. llvm-svn: 189101
* Make .bc en/decoding of AttrKind stableTobias Grosser2013-07-263-4/+216
| | | | | | | | | | | | | | | The bitcode representation attribute kinds are encoded into / decoded from should be independent of the current set of LLVM attributes and their position in the AttrKind enum. This patch explicitly encodes attributes to fixed bitcode values. With this patch applied, LLVM does not silently misread attributes written by LLVM 3.3. We also enhance the decoding slightly such that an error message is printed if an unknown AttrKind encoding was dected. Bonus: Dropping bitcode attributes from AttrKind is now easy, as old AttrKinds do not need to be kept to support the Bitcode reader. llvm-svn: 187186
* Add a wrapper for open.Rafael Espindola2013-07-161-1/+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
* Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector ↵Craig Topper2013-07-113-13/+13
| | | | | | size. llvm-svn: 186098
* Remove the Copied parameter from MemoryObject::readBytes.Benjamin Kramer2013-05-241-1/+1
| | | | | | | | | | There was exactly one caller using this API right, the others were relying on specific behavior of the default implementation. Since it's too hard to use it right just remove it and standardize on the default behavior. Defines away PR16132. llvm-svn: 182636
* Micro-optimization: don't shift an entire bitcode record over to get the code.Jordan Rose2013-05-101-3/+10
| | | | | | | | | | | Previously, BitstreamCursor read an abbreviated record by splatting the whole thing into a data vector, then extracting and removing the /first/ element. Now, it reads the first element--the record code--separately from the actual field values. No (intended) functionality change. llvm-svn: 181639
* Add ArrayRef constructor from None, and do the cleanups that this ↵Dmitri Gribenko2013-05-051-1/+1
| | | | | | | | constructor enables Patch by Robert Wilhelm. llvm-svn: 181138
* This patch breaks up Wrap.h so that it does not have to include all of Filip Pizlo2013-05-012-2/+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
* Move C++ code out of the C headers and into either C++ headersEric Christopher2013-04-222-0/+2
| | | | | | | or the C++ files themselves. This enables people to use just a C compiler to interoperate with LLVM. llvm-svn: 180063
* Whitespace cleanupJoe Abbey2013-04-012-2/+2
| | | | llvm-svn: 178454
* Simplify code. No functionality change.Jakub Staszak2013-02-191-14/+7
| | | | llvm-svn: 175501
OpenPOWER on IntegriCloud