summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/TargetData.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Have scoped mutexes take referenes instead of pointers.Owen Anderson2009-07-071-3/+3
| | | | llvm-svn: 74931
* Guard the layout info object.Owen Anderson2009-06-231-0/+5
| | | | llvm-svn: 73928
* Change TargetData::getIntPtrType() to return an IntegerType instead ofJay Foad2009-05-111-1/+1
| | | | | | just a Type. llvm-svn: 71426
* Rename PaddedSize to AllocSize, in the hope that thisDuncan Sands2009-05-091-3/+3
| | | | | | | will make it more obvious what it represents, and stop it being confused with the StoreSize. llvm-svn: 71349
* Use LLVM type names instead of C type names in comments, to beDan Gohman2009-04-011-5/+5
| | | | | | less ambiguous and less C-specific. llvm-svn: 68219
* Delete trailing whitespace.Dan Gohman2009-02-161-5/+5
| | | | llvm-svn: 64694
* Rename getABITypeSize to getTypePaddedSize, asDuncan Sands2009-01-121-3/+3
| | | | | | suggested by Chris. llvm-svn: 62099
* Handle a compiler warning.Duncan Sands2008-12-091-1/+1
| | | | llvm-svn: 60755
* consistencyChris Lattner2008-12-081-2/+2
| | | | llvm-svn: 60694
* introduce a new RoundUpAlignment helper function, use it to Chris Lattner2008-12-081-32/+29
| | | | | | | remove some more 64-bit divs and rems from the StructLayout ctor. llvm-svn: 60692
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-041-1/+1
| | | | llvm-svn: 55779
* Change packed struct layout so that field sizesDuncan Sands2008-06-041-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | are the same as in unpacked structs, only field positions differ. This only matters for structs containing x86 long double or an apint; it may cause backwards compatibility problems if someone has bitcode containing a packed struct with a field of one of those types. The issue is that only 10 bytes are needed to hold an x86 long double: the store size is 10 bytes, but the ABI size is 12 or 16 bytes (linux/ darwin) which comes from rounding the store size up by the alignment. Because it seemed silly not to pack an x86 long double into 10 bytes in a packed struct, this is what was done. I now think this was a mistake. Reserving the ABI size for an x86 long double field even in a packed struct makes things more uniform: the ABI size is now always used when reserving space for a type. This means that developers are less likely to make mistakes. It also makes life easier for the CBE which otherwise could not represent all LLVM packed structs (PR2402). Front-end people might need to adjust the way they create LLVM structs - see following change to llvm-gcc. llvm-svn: 51928
* Clean up the use of static and anonymous namespaces. This turned upDan Gohman2008-05-131-6/+9
| | | | | | | several things that were neither in an anonymous namespace nor static but not intended to be global. llvm-svn: 51017
* Remove unnecessary <sstream> includes.Dan Gohman2008-04-141-1/+0
| | | | llvm-svn: 49681
* PassInfo keep tracks whether a pass is an analysis pass or not.Devang Patel2008-03-191-1/+2
| | | | llvm-svn: 48554
* Use getPreferredAlignmentLog or getPreferredAlignmentDuncan Sands2008-01-291-10/+19
| | | | | | | to get the alignment of global variables, rather than using hand-made versions. llvm-svn: 46495
* Fix PR1845 and rdar://5676945. Generic vectors smallerChris Lattner2008-01-101-18/+22
| | | | | | | | | | | | | | than hardware supported type will be scalarized, so we can infer their alignment from that info. We now codegen pr1845 into: _boolVectorSelect: lbz r2, 0(r3) stb r2, -16(r1) blr llvm-svn: 45796
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Fix a brain fart by our beloved leader (the contentDuncan Sands2007-12-211-4/+3
| | | | | | of this patch is the last line). llvm-svn: 45289
* Remove host endianness info from TargetData andDuncan Sands2007-12-121-9/+0
| | | | | | | | put it in a new header System/Host.h instead. Instead of getting the endianness from configure, calculate it directly. llvm-svn: 44959
* Move TargetData::hostIsLittleEndian out of line, which means we Chris Lattner2007-12-111-0/+9
| | | | | | | | don't have to #include config.h in it. #including config.h breaks other projects that have their own autoconf stuff and try to #include the llvm headers. One obscure example is llvm-gcc. llvm-svn: 44825
* Silence a warningAnton Korobeynikov2007-11-091-1/+1
| | | | llvm-svn: 43954
* Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.Duncan Sands2007-11-011-60/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The meaning of getTypeSize was not clear - clarifying it is important now that we have x86 long double and arbitrary precision integers. The issue with long double is that it requires 80 bits, and this is not a multiple of its alignment. This gives a primitive type for which getTypeSize differed from getABITypeSize. For arbitrary precision integers it is even worse: there is the minimum number of bits needed to hold the type (eg: 36 for an i36), the maximum number of bits that will be overwriten when storing the type (40 bits for i36) and the ABI size (i.e. the storage size rounded up to a multiple of the alignment; 64 bits for i36). This patch removes getTypeSize (not really - it is still there but deprecated to allow for a gradual transition). Instead there is: (1) getTypeSizeInBits - a number of bits that suffices to hold all values of the type. For a primitive type, this is the minimum number of bits. For an i36 this is 36 bits. For x86 long double it is 80. This corresponds to gcc's TYPE_PRECISION. (2) getTypeStoreSizeInBits - the maximum number of bits that is written when storing the type (or read when reading it). For an i36 this is 40 bits, for an x86 long double it is 80 bits. This is the size alias analysis is interested in (getTypeStoreSize returns the number of bytes). There doesn't seem to be anything corresponding to this in gcc. (3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded up to a multiple of the alignment. For an i36 this is 64, for an x86 long double this is 96 or 128 depending on the OS. This is the spacing between consecutive elements when you form an array out of this type (getABITypeSize returns the number of bytes). This is TYPE_SIZE in gcc. Since successive elements in a SequentialType (arrays, pointers and vectors) need to be aligned, the spacing between them will be given by getABITypeSize. This means that the size of an array is the length times the getABITypeSize. It also means that GEP computations need to use getABITypeSize when computing offsets. Furthermore, if an alloca allocates several elements at once then these too need to be aligned, so the size of the alloca has to be the number of elements multiplied by getABITypeSize. Logically speaking this doesn't have to be the case when allocating just one element, but it is simpler to also use getABITypeSize in this case. So alloca's and mallocs should use getABITypeSize. Finally, since gcc's only notion of size is that given by getABITypeSize, if you want to output assembler etc the same as gcc then getABITypeSize is the size you want. Since a store will overwrite no more than getTypeStoreSize bytes, and a read will read no more than that many bytes, this is the notion of size appropriate for alias analysis calculations. In this patch I have corrected all type size uses except some of those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard cases). I will get around to auditing these too at some point, but I could do with some help. Finally, I made one change which I think wise but others might consider pointless and suboptimal: in an unpacked struct the amount of space allocated for a field is now given by the ABI size rather than getTypeStoreSize. I did this because every other place that reserves memory for a type (eg: alloca) now uses getABITypeSize, and I didn't want to make an exception for unpacked structs, i.e. I did it to make things more uniform. This only effects structs containing long doubles and arbitrary precision integers. If someone wants to pack these types more tightly they can always use a packed struct. llvm-svn: 43620
* Fix PR1749 and InstCombine/2007-10-28-EmptyField.ll by handlingChris Lattner2007-10-291-1/+7
| | | | | | zero-length fields better. llvm-svn: 43427
* Simplify getIntPtrType, allowing it to work for arbitrary pointer sizes.Dan Gohman2007-10-081-6/+1
| | | | llvm-svn: 42751
* Add getABITypeSize, getABITypeSizeInBitsDale Johannesen2007-10-011-1/+6
| | | | llvm-svn: 42488
* Don't add a default STACK_ALIGN (use the generic ABI alignment)Rafael Espindola2007-09-211-1/+0
| | | | | | Implement calls to functions with byval arguments on X86 llvm-svn: 42192
* Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfoChris Lattner2007-09-171-2/+6
| | | | | | | Add a new DenseMapInfo::isEqual method to allow clients to redefine the equality predicate used when probing the hash table. llvm-svn: 42042
* Add support for having different alignment for objects on call frames.Rafael Espindola2007-09-071-5/+20
| | | | | | | The x86-64 ABI states that objects passed on the stack have 8 byte alignment. Implement that. llvm-svn: 41768
* Fix minor doxygen nits.Reid Spencer2007-08-051-3/+3
| | | | llvm-svn: 40854
* long double patch 2 of N. Handle it in TargetData.Dale Johannesen2007-08-031-0/+12
| | | | | | | (I've tried to get the info right for all targets, but I'm not expert on all of them - check yours.) llvm-svn: 40792
* Drop 'const'Devang Patel2007-05-031-1/+1
| | | | llvm-svn: 36662
* Use 'static const char' instead of 'static const int'.Devang Patel2007-05-021-1/+1
| | | | | | | Due to darwin gcc bug, one version of darwin linker coalesces static const int, which defauts PassID based pass identification. llvm-svn: 36652
* Fix build error.Lauro Ramos Venancio2007-05-021-1/+1
| | | | llvm-svn: 36648
* Do not use typeinfo to identify pass in pass manager.Devang Patel2007-05-011-1/+3
| | | | llvm-svn: 36632
* Support alignment queries for degenerate (length 1) vectors.Christopher Lamb2007-04-221-2/+8
| | | | llvm-svn: 36352
* When the number of elements is zero, don't malloc 32GB on 64-bit systems.Jeff Cohen2007-04-091-1/+1
| | | | | | | | | | Fixes unexpected failures on FreeBSD/amd64 of: CFrontend/2005-09-24-BitFieldCrash.c: CFrontend/2007-02-04-EmptyStruct.c: CFrontend/2007-03-26-ZeroWidthBitfield.c: CodeGen/Generic/2005-10-18-ZeroSizeStackObject.ll: llvm-svn: 35828
* Unbreak VC++ build.Jeff Cohen2007-03-051-1/+1
| | | | llvm-svn: 34917
* Wrap a long line.Reid Spencer2007-03-011-1/+2
| | | | llvm-svn: 34799
* Simplify some code by moving variable declarations into the only block thatReid Spencer2007-02-191-12/+6
| | | | | | uses them. llvm-svn: 34432
* Implement support for non-standard integer bit widths of any size. TheReid Spencer2007-02-191-10/+33
| | | | | | | | | | | | | rules alignment is to pick the alignment that corresponds to the smallest specified alignment that is larger than the bit width of the type or the largest specified integer alignment if none are larger than the bitwidth of the type. For the byte size, the size returned is the next larger multiple of the alignment for that type (using the above rule). This patch also changes bit widths from "short" to "uint32_t" to ensure there are enough bits to specify any bit width that LLVM can handle (currently 2^23); 16-bits isn't enough. llvm-svn: 34431
* Do not dereference invalid ranges. Generalize targetdata alignment model.Chris Lattner2007-02-171-59/+49
| | | | | | This fixes the UnitTests/Vector/sumarray-dbl regressions. llvm-svn: 34358
* Fix CodeGen/PowerPC/2007-02-16-AlignPacked.llChris Lattner2007-02-161-2/+2
| | | | llvm-svn: 34356
* Remove an unnecessary predicate.Reid Spencer2007-02-161-1/+1
| | | | | | Patch by Scott Michel. llvm-svn: 34354
* simplify some code, ensure that packed structures get abi alignment of 1.Chris Lattner2007-02-161-18/+11
| | | | llvm-svn: 34352
* For PR1195:Reid Spencer2007-02-151-4/+4
| | | | | | PACKED_ALIGN -> VECTOR_ALIGN llvm-svn: 34330
* For PR1202:Reid Spencer2007-02-151-1/+2
| | | | | | Make sure we found an existing Alignment before overwriting it. llvm-svn: 34308
* For PR1195:Reid Spencer2007-02-151-3/+3
| | | | | | | Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and PackedTyID -> VectorTyID. No functional changes. llvm-svn: 34293
* Fixed packed structure breakage from earlier TargetData patch; appliedReid Spencer2007-02-151-75/+31
| | | | | | | | Chris Lattner's code style suggestions. Patch by Scott Michel! llvm-svn: 34292
* Generalize TargetData strings, to support more interesting forms of data.Chris Lattner2007-02-141-214/+307
| | | | | | Patch by Scott Michel. llvm-svn: 34266
OpenPOWER on IntegriCloud