[llvm-commits] [llvm] r164897 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/Target/TargetData.cpp
Benjamin Kramer
benny.kra at gmail.com
Mon Oct 1 04:58:25 PDT 2012
On 30.09.2012, at 22:33, Jakub Staszak <kubastaszak at gmail.com> wrote:
> Maybe it is just me, but I think that
>
> uint32_t FieldName : 8
>
> is a little bit confusing, since it is 8bit variable with "uint32" type. I believe that
>
> unsigned FieldName : 8
>
> would be more proper.
> - Kuba
The idea was that the bitfields are aligned to fit into 32 bit values. OTOH llvm assumes 32 bit unsigneds everywhere so I don't feel very strongly about it. Changed it to unsigned in r164935.
- Ben
>
> On Sep 29, 2012, at 9:57 PM, Benjamin Kramer <benny.kra at googlemail.com> wrote:
>
>> Author: d0k
>> Date: Sat Sep 29 14:57:14 2012
>> New Revision: 164897
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=164897&view=rev
>> Log:
>> Shrink TargetAlignElem a bit, we do a lot of searches on them.
>>
>> Modified:
>> llvm/trunk/include/llvm/Target/TargetData.h
>> llvm/trunk/lib/Target/TargetData.cpp
>>
>> Modified: llvm/trunk/include/llvm/Target/TargetData.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=164897&r1=164896&r2=164897&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Target/TargetData.h (original)
>> +++ llvm/trunk/include/llvm/Target/TargetData.h Sat Sep 29 14:57:14 2012
>> @@ -53,10 +53,10 @@
>> /// @note The unusual order of elements in the structure attempts to reduce
>> /// padding and make the structure slightly more cache friendly.
>> struct TargetAlignElem {
>> - AlignTypeEnum AlignType : 8; ///< Alignment type (AlignTypeEnum)
>> - unsigned ABIAlign; ///< ABI alignment for this type/bitw
>> - unsigned PrefAlign; ///< Pref. alignment for this type/bitw
>> - uint32_t TypeBitWidth; ///< Type bit width
>> + uint32_t AlignType : 8; ///< Alignment type (AlignTypeEnum)
>> + uint32_t TypeBitWidth : 24; ///< Type bit width
>> + uint32_t ABIAlign : 16; ///< ABI alignment for this type/bitw
>> + uint32_t PrefAlign : 16; ///< Pref. alignment for this type/bitw
>>
>> /// Initializer
>> static TargetAlignElem get(AlignTypeEnum align_type, unsigned abi_align,
>>
>> Modified: llvm/trunk/lib/Target/TargetData.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=164897&r1=164896&r2=164897&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/TargetData.cpp (original)
>> +++ llvm/trunk/lib/Target/TargetData.cpp Sat Sep 29 14:57:14 2012
>> @@ -314,6 +314,8 @@
>> TargetData::setAlignment(AlignTypeEnum align_type, unsigned abi_align,
>> unsigned pref_align, uint32_t bit_width) {
>> assert(abi_align <= pref_align && "Preferred alignment worse than ABI!");
>> + assert(pref_align < (1 << 16) && "Alignment doesn't fit in bitfield");
>> + assert(bit_width < (1 << 24) && "Bit width doesn't fit in bitfield");
>> for (unsigned i = 0, e = Alignments.size(); i != e; ++i) {
>> if (Alignments[i].AlignType == align_type &&
>> Alignments[i].TypeBitWidth == bit_width) {
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list