summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DataLayout.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* fix formatting; NFCSanjay Patel2015-07-211-2/+2
| | | | llvm-svn: 242796
* COFF: Let globals with private linkage reside in their own sectionDavid Majnemer2015-03-171-3/+6
| | | | | | | | | | COFF COMDATs (for selection kinds other than 'select any') require at least one non-section symbol in the symbol table. Satisfy this by morally enhancing the linkage from private to internal. Differential Revision: http://reviews.llvm.org/D8394 llvm-svn: 232570
* Teach DataLayout to infer a plausible alignment for things even when nothing ↵Owen Anderson2015-03-081-3/+14
| | | | | | is specified by the user. llvm-svn: 231613
* Make DataLayout Non-Optional in the ModuleMehdi Amini2015-03-041-90/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Teach DataLayout that alignments on basic types must be powers of two.Owen Anderson2015-03-021-0/+4
| | | | | | Fixes assertion failures/crashes on bad datalayout specifications. llvm-svn: 230940
* Teach DataLayout that ABI alignments for non-aggregate types must be non-zero.Owen Anderson2015-03-021-0/+3
| | | | | | | This manifested as assertions and/or crashes in later phases of optimization, depending on the build configuration. llvm-svn: 230939
* Teach DataLayout that pointer ABI and preferred alignments are required to ↵Owen Anderson2015-03-021-0/+6
| | | | | | | | be powers of two. Previously this resulted in asserts and/or crashes (depending on build configuration) at various phases in the optimizer. llvm-svn: 230938
* Teach DataLayout that zero-byte pointer sizes don't make sense.Owen Anderson2015-03-021-0/+2
| | | | | | | | Previously this would result in assertion failures or simply crashes at various points in the optimizer when trying to create types of zero bit width. llvm-svn: 230936
* DataLayout: Validate that the pref alignment is at least the ABI alignDavid Majnemer2015-02-161-1/+4
| | | | llvm-svn: 229355
* DataLayout: Report when the datalayout type alignment/width is too largeDavid Majnemer2015-02-161-6/+11
| | | | llvm-svn: 229354
* DataLayout: Report when the preferred alignment is less than the ABIDavid Majnemer2015-02-111-0/+3
| | | | llvm-svn: 228819
* DataLayout: Provide nicer diagnostics for malformed stringsDavid Majnemer2014-12-101-2/+11
| | | | llvm-svn: 223911
* DataLayout: Be more verbose when diagnosing problems in pointer specsDavid Majnemer2014-12-101-3/+10
| | | | llvm-svn: 223903
* DataLayout: Move asserts over to report_fatal_errorDavid Majnemer2014-12-101-7/+10
| | | | | | | | As indicated by the tests, it is possible to feed the AsmParser an invalid datalayout string. We should verify the result of parsing this string regardless of whether or not we have assertions enabled. llvm-svn: 223898
* Switch the default DataLayout to be little endian, and make the variableChandler Carruth2014-10-201-5/+5
| | | | | | | | | be BigEndian so the default can continue to be zero-initialized. This is one of the prerequisites to making DataLayout a constant and always available part of every module. llvm-svn: 220193
* IR: Replace DataLayout::RoundUpAlignment with RoundUpToAlignmentDavid Majnemer2014-10-201-2/+2
| | | | | | No functional change intended, just cleaning up some code. llvm-svn: 220187
* Use cast<> instead of unchecked dyn_cast<>Matt Arsenault2014-09-181-1/+1
| | | | llvm-svn: 218085
* Add doInitialization/doFinalization to DataLayoutPass.Rafael Espindola2014-09-101-7/+11
| | | | | | | | | | | | | 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
* Revert "Introduce a string_ostream string builder facilty"Alp Toker2014-06-261-1/+2
| | | | | | Temporarily back out commits r211749, r211752 and r211754. llvm-svn: 211814
* Introduce a string_ostream string builder faciltyAlp Toker2014-06-261-2/+1
| | | | | | | | | | | | | | | | | | | | string_ostream is a safe and efficient string builder that combines opaque stack storage with a built-in ostream interface. small_string_ostream<bytes> additionally permits an explicit stack storage size other than the default 128 bytes to be provided. Beyond that, storage is transferred to the heap. This convenient class can be used in most places an std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair would previously have been used, in order to guarantee consistent access without byte truncation. The patch also converts much of LLVM to use the new facility. These changes include several probable bug fixes for truncated output, a programming error that's no longer possible with the new interface. llvm-svn: 211749
* Use pointer size function where only a pointer is expectedMatt Arsenault2014-04-231-1/+1
| | | | llvm-svn: 207023
* Fix DataLayout::operator==().Rafael Espindola2014-04-221-1/+1
| | | | | | Patch by Maks Naumov! llvm-svn: 206911
* [C++11] More 'nullptr' conversion or in some cases just using a boolean ↵Craig Topper2014-04-091-5/+5
| | | | | | check instead of comparing to nullptr. llvm-svn: 205831
* ARM: update subtarget information for Windows on ARMSaleem Abdulrasool2014-04-021-4/+3
| | | | | | | Update the subtarget information for Windows on ARM. This enables using the MC layer to target Windows on ARM. llvm-svn: 205459
* [C++11] Modernize the IR library a bit.Benjamin Kramer2014-03-101-37/+21
| | | | | | No functionality change. llvm-svn: 203465
* [Modules] Move GetElementPtrTypeIterator into the IR library. As itsChandler Carruth2014-03-041-1/+1
| | | | | | | | | name might indicate, it is an iterator over the types in an instruction in the IR.... You see where this is going. Another step of modularizing the support library. llvm-svn: 202815
* Fix typo. Thanks to Roman Divacky for noticing it.Rafael Espindola2014-02-261-8/+8
| | | | llvm-svn: 202277
* Compare DataLayout by Value, not by pointer.Rafael Espindola2014-02-261-0/+10
| | | | | | | | This fixes spurious warnings in llvm-link about the datalayout not matching. Thanks to Zalman Stern for reporting the bug! llvm-svn: 202276
* Use a sorted array to store the information about a few address spaces.Rafael Espindola2014-02-261-32/+36
| | | | | | | | | We don't have any test with more than 6 address spaces, so a DenseMap is probably not the correct answer. An unsorted array would also be OK, but we have to sort it for printing anyway. llvm-svn: 202275
* Move these functions out of line. A DenseMap lookup is not a simple operation.Rafael Espindola2014-02-261-0/+24
| | | | llvm-svn: 202274
* Use DataLayout from the module when easily available.Rafael Espindola2014-02-251-4/+0
| | | | | | | | | | | | | | | | | Eventually DataLayoutPass should go away, but for now that is the only easy way to get a DataLayout in some APIs. This patch only changes the ones that have easy access to a Module. One interesting issue with sometimes using DataLayoutPass and sometimes fetching it from the Module is that we have to make sure they are equivalent. We can get most of the way there by always constructing the pass with a Module. In fact, the pass could be changed to point to an external DataLayout instead of owning one to make this stricter. Unfortunately, the C api passes a DataLayout, so it has to be up to the caller to make sure the pass and the module are in sync. llvm-svn: 202204
* Fix resetting the DataLayout in a Module.Rafael Espindola2014-02-251-4/+14
| | | | | | | | | | | | | | | 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-1/+7
| | | | | | | | | | | | | | 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
* Make DataLayout a plain object, not a pass.Rafael Espindola2014-02-251-24/+23
| | | | | | | 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
* Fix uninitialized warning in llvm/lib/IR/DataLayout.cpp.Cameron McInally2014-01-131-2/+3
| | | | llvm-svn: 199147
* Use 'w' instead of 'c' to represent the win32 mangling.Rafael Espindola2014-01-101-5/+5
| | | | | | | This change was requested to avoid confusion if we ever support non windows coff systems. llvm-svn: 198938
* Fix uninitialized variable warning in DataLayout.Cameron McInally2014-01-071-2/+2
| | | | llvm-svn: 198702
* Improve documentation of the 'a' specifier and the '<abi>:<pref>' align pair.Rafael Espindola2014-01-061-0/+3
| | | | llvm-svn: 198636
* Make the llvm mangler depend only on DataLayout.Rafael Espindola2014-01-031-0/+49
| | | | | | | | | | | | | | Before this patch any program that wanted to know the final symbol name of a GlobalValue had to link with Target. This patch implements a compromise solution where the mangler uses DataLayout. This way, any tool that already links with Target (llc, clang) gets the exact behavior as before and new IR files can be mangled without linking with Target. With this patch the mangler is constructed with just a DataLayout and DataLayout is extended to include the information the Mangler needs. llvm-svn: 198438
* Remove the 's' DataLayout specificationRafael Espindola2014-01-011-11/+5
| | | | | | | | | | | | | | | | | | | | | | | During the years there have been some attempts at figuring out how to align byval arguments. A look at the commit log suggests that they were * Use the ABI alignment. * When that was not sufficient for x86-64, I added the 's' specification to DataLayout. * When that was not sufficient Evan added the virtual getByValTypeAlignment. * When even that was not sufficient, we just got the FE to add the alignment to the byval. This patch is just a simple cleanup that removes my first attempt at fixing the problem. I also added an AArch64 implementation of getByValTypeAlignment to make sure this patch is a nop. I also left the 's' parsing for backward compatibility. I will send a short email to llvmdev about the change for anyone maintaining an out of tree target. llvm-svn: 198287
* Make this array const.Rafael Espindola2013-12-201-4/+4
| | | | llvm-svn: 197814
* Change getStringRepresentation to skip defaults.Rafael Espindola2013-12-191-17/+45
| | | | | | | | | | I have a pending change for clang to use getStringRepresentation to check that its DataLayout is in sync with llvm's. getStringRepresentation is not called from llvm itself, so far it is mostly a debugging aid, so the shorter strings are an independent improvement. llvm-svn: 197740
* Pointer sizes are stored in Bytes. Fix variables names to say so.Rafael Espindola2013-12-131-19/+19
| | | | | | Also update for the current naming style. llvm-svn: 197283
* DataLayout: value initialize globals to avoid static construction.Benjamin Kramer2013-11-191-2/+2
| | | | llvm-svn: 195150
* MemCpyOptimizer: Use max legal int size instead of pointer sizeMatt Arsenault2013-09-161-0/+7
| | | | | | | | | | | | If there are no legal integers, assume 1 byte. This makes more sense than using the pointer size as a guess for the maximum GPR width. It is conceivable to want to use some 64-bit pointers on a target where 64-bit integers aren't legal. llvm-svn: 190817
* Minor code simplification suggested by DuncanMatt Arsenault2013-07-271-2/+1
| | | | llvm-svn: 187309
* Re-add DataLayout pointer size convenience functions.Matt Arsenault2013-07-261-0/+10
| | | | | | | | These were reverted in r167222 along with the rest of the last different address space pointer size attempt. These will be used in later commits. llvm-svn: 187223
* Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid ↵Craig Topper2013-07-041-1/+1
| | | | | | specifying the vector size. llvm-svn: 185606
* Fix extra whitespace / formattingMatt Arsenault2013-06-281-3/+0
| | | | llvm-svn: 185238
* Remove duplicated commentMatt Arsenault2013-05-181-5/+0
| | | | | | The same comment is already made in the header llvm-svn: 182181
OpenPOWER on IntegriCloud