From c382bc3c0f476bf94303d9892af4e2cee173bfe5 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 24 Feb 2010 22:05:23 +0000 Subject: Make getTypeSizeInBits work correctly for array types; it should return the number of value bits, not the number of bits of allocation for in-memory storage. Make getTypeStoreSize and getTypeAllocSize work consistently for arrays and vectors. Fix several places in CodeGen which compute offsets into in-memory vectors to use TargetData information. This fixes PR1784. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97064 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Target/TargetData.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h index cc88dae9fa..8c3f896268 100644 --- a/include/llvm/Target/TargetData.h +++ b/include/llvm/Target/TargetData.h @@ -193,9 +193,7 @@ public: /// getTypeStoreSize - Return the maximum number of bytes that may be /// overwritten by storing the specified type. For example, returns 5 /// for i36 and 10 for x86_fp80. - uint64_t getTypeStoreSize(const Type *Ty) const { - return (getTypeSizeInBits(Ty)+7)/8; - } + uint64_t getTypeStoreSize(const Type *Ty) const; /// getTypeStoreSizeInBits - Return the maximum number of bits that may be /// overwritten by storing the specified type; always a multiple of 8. For @@ -208,10 +206,7 @@ public: /// of the specified type, including alignment padding. This is the amount /// that alloca reserves for this type. For example, returns 12 or 16 for /// x86_fp80, depending on alignment. - uint64_t getTypeAllocSize(const Type* Ty) const { - // Round up to the next alignment boundary. - return RoundUpAlignment(getTypeStoreSize(Ty), getABITypeAlignment(Ty)); - } + uint64_t getTypeAllocSize(const Type* Ty) const; /// getTypeAllocSizeInBits - Return the offset in bits between successive /// objects of the specified type, including alignment padding; always a -- cgit v1.2.3-70-g09d2