From: Benjamin Kramer Date: Sat, 29 Sep 2012 19:57:14 +0000 (+0000) Subject: Shrink TargetAlignElem a bit, we do a lot of searches on them. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=01e872af2548144ab3df9c03f3b7cc69b9d758a8;p=oota-llvm.git Shrink TargetAlignElem a bit, we do a lot of searches on them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164897 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h index 4f94ab751cb..c97af7db68e 100644 --- a/include/llvm/Target/TargetData.h +++ b/include/llvm/Target/TargetData.h @@ -53,10 +53,10 @@ enum AlignTypeEnum { /// @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, diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index cc6dc1e2599..0040147022d 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -314,6 +314,8 @@ void 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) {