summaryrefslogtreecommitdiff
path: root/include/llvm/Support/AlignOf.h
Commit message (Collapse)AuthorAge
* Incrase the number of parameters for AlignedCharArrayUnion.Manuel Klimek2013-01-09
| | | | | | We need this to correctly fix ASTMatchers/ASTTypeTraits.h in clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171965 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the declspecs from small alignments that we can force withChandler Carruth2012-12-31
| | | | | | | | | | | | a union. These don't actually work for by-value function arguments, and MSVC warns if they exist even while (we hope) it aligns the argument correctly due to the other union member. This means MSVC will miss out on optimizations based on the alignment of the buffer, but really, there aren't that many for x86 and MSVC is likely not doing a great job of optimizing LLVM and Clang anyways. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171328 91177308-0d34-0410-b5e6-96231b3b80d8
* [AlignOf] Add AlignedCharArray and refactor AlignedCharArrayUnion.Michael J. Spencer2012-12-31
| | | | | | | This adds AlignedCharArray<Alignment, Size>. A templated struct that contains a member named buffer of type char[Size] that is aligned to Alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171319 91177308-0d34-0410-b5e6-96231b3b80d8
* xlc supports __attribute__((aligned(x))), use it.Rafael Espindola2012-10-31
| | | | | | Patch by Kai. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167087 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix up erroneous alignas usage while making this portable to GCC 4.7David Blaikie2012-09-14
| | | | | | Review by Chandler Carruth. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163944 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to appease MSVC even more elaborately in the alignment hacking space.Chandler Carruth2012-08-24
| | | | | | | | | | | | | | | | | | | | MSVC doesn't support passing by-value parameters with alignment of 16-bytes or higher apparantly. What is deeply confusing is that it seems to *sometimes* (but not always) apply this to any type whose alignment is set using __declspec(align(...)). This caused lots of errors when we switch SmallVector over to use the automatically aligned character array utilities as they used __declspec(align(...)) heavily. As a pretty horrible but effective work-around, we instead cherry pick the smallest alignment sizes with specific types that happen to have the correct alignment, and then fall back to the attribute solution past them. This should resolve the MSVC build errors folks have been hitting. Sorry for that. In good news, it will do this without introducing other UB I hope. =] Thanks to Timur Iskhodzhanov for helping me test this! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162549 91177308-0d34-0410-b5e6-96231b3b80d8
* Flatten the aligned-char-array utility template to be a directlyChandler Carruth2012-08-17
| | | | | | | templated union at the request of Richard Smith. This makes it substantially easier to type. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162072 91177308-0d34-0410-b5e6-96231b3b80d8
* Just remove generic support for C++11 alignas -- GCC is alreadyChandler Carruth2012-06-25
| | | | | | | | advertising complete support w/o alignas implemented, and its implementation of alignas in the latest versions is so convoluted as to be unusable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159125 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove 'static' from inline functions defined in header files.Chandler Carruth2012-06-20
| | | | | | | | | | | | | | | | | There is a pretty staggering amount of this in LLVM's header files, this is not all of the instances I'm afraid. These include all of the functions that (in my build) are used by a non-static inline (or external) function. Specifically, these issues were caught by the new '-Winternal-linkage-in-inline' warning. I'll try to just clean up the remainder of the clearly redundant "static inline" cases on functions (not methods!) defined within headers if I can do so in a reliable way. There were even several cases of a missing 'inline' altogether, or my personal favorite "static bool inline". Go figure. ;] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158800 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support to the alignment support header for conjuring a characterChandler Carruth2012-06-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | array of a suitable size and alignment for any of a number of different types to be stored into the character array. The mechanisms for producing an explicitly aligned type are fairly complex because this operation is poorly supported on all compilers. We've spent a fairly significant amount of time experimenting with different implementations inside of Google, and the one using explicitly expanded templates has been the most robust. Credit goes to Nick Lewycky for writing the first 20 versions or so of this logic we had inside of Google. I based this on the only one to actually survive. In case anyone is worried, yes we are both explicitly re-contributing and re-licensing it for LLVM. =] Once the issues with actually specifying the alignment are finished, it turns out that most compilers don't in turn align anything the way they are instructed. Testing of this logic against both Clang and GCC indicate that the alignment constraints are largely ignored by both compilers! I've come up with and used a work-around by wrapping each alignment-hinted type directly in a struct, and using that struct to align the character array through a union. This elaborate hackery is terrifying, but I've included testing that caught a terrifying number of bugs in every other technique I've tried. All of this in order to implement a poor C++98 programmers emulation of C++11 unrestricted unions in classes such as SmallDenseMap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158597 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix spelling.Michael J. Spencer2010-12-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121156 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename alignof -> alignOf to avoid irritating C++'0x compilers,Chris Lattner2010-10-30
| | | | | | | | PR8423, patch by nobled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117774 91177308-0d34-0410-b5e6-96231b3b80d8
* Removed trailing whitespace.Misha Brukman2009-02-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65196 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix more -Wshorten-64-to-32 warnings.Evan Cheng2008-05-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50659 91177308-0d34-0410-b5e6-96231b3b80d8
* Add more alignment enums.Ted Kremenek2008-04-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50363 91177308-0d34-0410-b5e6-96231b3b80d8
* Added "Profile" method to APFloat for use with FoldingSet.Ted Kremenek2008-02-11
| | | | | | | | | | | Added member template "Add" to FoldingSetNodeID that allows "adding" arbitrary objects to a profile via dispatch to FoldingSetTrait<T>::Profile(). Removed FoldingSetNodeID::AddAPFloat and FoldingSetNodeID::APInt, as their functionality is now replaced using the above mentioned member template. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46957 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't attribute in file headers anymore. See llvmdev for theChris Lattner2007-12-29
| | | | | | | | discussion of this change. Boy are my fingers tired. ;-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45411 91177308-0d34-0410-b5e6-96231b3b80d8
* Removed inclusion of cassert, which is no longer needed.Ted Kremenek2007-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43099 91177308-0d34-0410-b5e6-96231b3b80d8
* Added template function alignof() which provides a cleanTed Kremenek2007-10-17
| | | | | | | function-based interface to getting the alignment of a type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43096 91177308-0d34-0410-b5e6-96231b3b80d8
* Added llvm::AlignOf, a template class whose purpose is to portablyTed Kremenek2007-10-17
compute the minimum memory alignment of arbitrary types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43086 91177308-0d34-0410-b5e6-96231b3b80d8