Fixed packed structure breakage from earlier TargetData patch; applied

Chris Lattner's code style suggestions.

Patch by Scott Michel!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34292 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2007-02-15 02:11:06 +00:00
parent 480cbb9387
commit b7d61101b1
2 changed files with 35 additions and 84 deletions

View File

@@ -48,7 +48,7 @@ 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 {
unsigned char AlignType; //< Alignment type (AlignTypeEnum)
AlignTypeEnum AlignType : 8; //< Alignment type (AlignTypeEnum)
unsigned char ABIAlign; //< ABI alignment for this type/bitw
unsigned char PrefAlign; //< Pref. alignment for this type/bitw
short TypeBitWidth; //< Type bit width
@@ -64,18 +64,12 @@ struct TargetAlignElem {
std::ostream &dump(std::ostream &os) const;
};
//! TargetAlignElem output stream inserter
/*!
@sa TargetAlignElem::dump()
*/
std::ostream &operator<<(std::ostream &os, const TargetAlignElem &elem);
class TargetData : public ImmutablePass {
private:
bool LittleEndian; ///< Defaults to false
unsigned char PointerMemSize; ///< Pointer size in bytes
unsigned char PointerABIAlign; ///< Pointer ABI alignment
unsigned char PointerPrefAlign; ///< Pointer preferred global alignment
unsigned char PointerPrefAlign; ///< Pointer preferred alignment
//! Where the primitive type alignment data is stored.
/*!
@@ -99,7 +93,8 @@ private:
void setAlignment(AlignTypeEnum align_type, unsigned char abi_align,
unsigned char pref_align, short bit_width);
//! Get TargetAlignElem from alignment type and bit width
const TargetAlignElem &getAlignment(AlignTypeEnum, short) const;
const TargetAlignElem &getAlignment(AlignTypeEnum align_type,
short bit_width) const;
//! Internal helper method that returns requested alignment for type.
unsigned char getAlignment(const Type *Ty, bool abi_or_pref) const;