From f734ea21a37e27862ccf7570c2c64ad904568234 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Mon, 19 Feb 2007 22:35:00 +0000 Subject: Implement support for non-standard integer bit widths of any size. The 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34431 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Target/TargetData.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h index 34cd897..36caf56 100644 --- a/include/llvm/Target/TargetData.h +++ b/include/llvm/Target/TargetData.h @@ -51,11 +51,11 @@ struct TargetAlignElem { 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 + uint32_t TypeBitWidth; //< Type bit width /// Initializer static TargetAlignElem get(AlignTypeEnum align_type, unsigned char abi_align, - unsigned char pref_align, short bit_width); + unsigned char pref_align, uint32_t bit_width); /// Equality predicate bool operator==(const TargetAlignElem &rhs) const; /// output stream operator @@ -89,8 +89,8 @@ private: //! Set/initialize target alignments void setAlignment(AlignTypeEnum align_type, unsigned char abi_align, - unsigned char pref_align, short bit_width); - unsigned getAlignmentInfo(AlignTypeEnum align_type, short bit_width, + unsigned char pref_align, uint32_t bit_width); + unsigned getAlignmentInfo(AlignTypeEnum align_type, uint32_t bit_width, bool ABIAlign) const; //! Internal helper method that returns requested alignment for type. unsigned char getAlignment(const Type *Ty, bool abi_or_pref) const; @@ -161,11 +161,11 @@ public: /// specified type. uint64_t getTypeSizeInBits(const Type* Ty) const; - /// getTypeAlignmentABI - Return the minimum ABI-required alignment for the + /// getABITypeAlignment - Return the minimum ABI-required alignment for the /// specified type. unsigned char getABITypeAlignment(const Type *Ty) const; - /// getTypeAlignmentPref - Return the preferred stack/global alignment for + /// getPrefTypeAlignment - Return the preferred stack/global alignment for /// the specified type. unsigned char getPrefTypeAlignment(const Type *Ty) const; -- cgit v1.1