summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/TargetData.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* There are two ways of checking for a given type, for example isa<PointerType>(T)Duncan Sands2010-02-161-1/+1
| | | | | | | and T->isPointerTy(). Convert most instances of the first form to the second form. Requested by Chris. llvm-svn: 96344
* add a method to get the alignment of an integer type even Chris Lattner2010-01-251-0/+7
| | | | | | | when we don't have one laying around. Useful if you don't have an llvmcontext handy. llvm-svn: 94468
* finish cleaning up StructLayoutMap.Chris Lattner2009-12-171-21/+17
| | | | llvm-svn: 91612
* Calling InvalidateEntry during the refinement was breaking the bootstrap.Bill Wendling2009-12-051-2/+12
| | | | llvm-svn: 90656
* Final cleanups:Bill Wendling2009-12-051-14/+2
| | | | | | | - Privatize a typedef. - Call the InvalidateEntry when refining a type. llvm-svn: 90655
* Inline methods which are called only once.Bill Wendling2009-12-051-15/+3
| | | | llvm-svn: 90640
* Refactor some code. No functionality change.Bill Wendling2009-12-051-9/+13
| | | | llvm-svn: 90639
* Some code cleanup. No functionality change.Bill Wendling2009-12-041-15/+10
| | | | llvm-svn: 90588
* Revert r90371. It was causing build failures.Bill Wendling2009-12-031-23/+42
| | | | llvm-svn: 90383
* Further improvements: refactoring code that does the same thing into oneBill Wendling2009-12-031-42/+23
| | | | | | | function, converting "dyn_cast" to "cast", asserting the correct things, and other general cleanups. llvm-svn: 90371
* remove some dead std::ostream using code.Chris Lattner2009-12-031-9/+0
| | | | llvm-svn: 90366
* improve portability to avoid conflicting with std::next in c++'0x.Chris Lattner2009-12-031-0/+1
| | | | | | Patch by Howard Hinnant! llvm-svn: 90365
* This initial code is meant to convert TargetData to use an AbstractTypesUser soBill Wendling2009-12-031-59/+38
| | | | | | | | | that it doesn't have dangling pointers when abstract types are resolved. This modifies it somewhat to address comments: making the "StructLayoutMap" an anonymous structure, calling "removeAbstractTypeUser" when appropriate, and adding asserts where helpful. llvm-svn: 90362
* The llvm-gcc front-end and the pass manager use two separate TargetData objects.Bill Wendling2009-11-181-24/+116
| | | | | | | | | | | | | | | | | | This is probably not confined to *just* these two things. Anyway, the llvm-gcc front-end may look up the structure layout information for an abstract type. That information will be stored into a table with the FE's TD. Instruction combine can come along and also ask for information on that abstract type, but for a separate TD (the one associated with the pass manager). After the type is refined, the old structure layout information in the pass manager's TD file is out of date. If a new type is allocated in the same space as the old-unrefined type, then the structure type information in the pass manager's TD file will be wrong, but won't know it. Fix this by making the TD's structure type information an abstract type user. llvm-svn: 89176
* Make TargetData::getStringRepresentation spit out native integer types,Chris Lattner2009-11-081-0/+7
| | | | | | this gives llvm-gcc generated modules the right data. llvm-svn: 86435
* add the ability for TargetData to return information about legal integerChris Lattner2009-11-071-39/+12
| | | | | | | | | | | datatypes on a given CPU. This is intended to allow instcombine and other transformations to avoid converting big sequences of operations to an inconvenient width, and will help clean up after SRoA. See also "Adding legal integer sizes to TargetData" on Feb 1, 2009 on llvmdev, and PR3451. Comments welcome. llvm-svn: 86370
* more cleanup.Chris Lattner2009-11-071-4/+14
| | | | llvm-svn: 86369
* rewrite TargetData to use StringRef/raw_ostream instead of thrashing ↵Chris Lattner2009-11-071-39/+59
| | | | | | std::strings. llvm-svn: 86366
* Try again at privatizing the layout info map, with a rewritten patch.Owen Anderson2009-08-211-47/+17
| | | | | | This preserves the existing behavior much more closely than my previous attempt. llvm-svn: 79663
* Re-revert r79555. Apparently it's not just buildbot weirdness.Owen Anderson2009-08-201-35/+52
| | | | llvm-svn: 79578
* Reapply r79555 for testing. Daniel's trying to work out some buildbot ↵Owen Anderson2009-08-201-52/+35
| | | | | | weirdnesss. llvm-svn: 79572
* --- Reverse-merging r79555 into '.':Bill Wendling2009-08-201-35/+52
| | | | | | | | | U include/llvm/Target/TargetData.h U lib/Target/TargetData.cpp Temporarily revert 79555. It was causing hangs and test failures. llvm-svn: 79568
* Make the StructType->StructLayout table private to TargetData, allowing us ↵Owen Anderson2009-08-201-52/+35
| | | | | | to avoid locking on it. llvm-svn: 79555
* Update and fix some comments.Dan Gohman2009-08-201-7/+7
| | | | llvm-svn: 79532
* Push LLVMContexts through the IntegerType APIs.Owen Anderson2009-08-131-3/+4
| | | | llvm-svn: 78948
* llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.Torok Edwin2009-07-141-2/+2
| | | | | | | | | This adds location info for all llvm_unreachable calls (which is a macro now) in !NDEBUG builds. In NDEBUG builds location info and the message is off (it only prints "UREACHABLE executed"). llvm-svn: 75640
* assert(0) -> LLVM_UNREACHABLE.Torok Edwin2009-07-111-2/+3
| | | | | | | | | Make llvm_unreachable take an optional string, thus moving the cerr<< out of line. LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for NDEBUG builds. llvm-svn: 75379
* 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
OpenPOWER on IntegriCloud