From 3c31b54b4704f8324afa5c4039622454567201a8 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 10 Dec 2007 18:37:40 +0000 Subject: Use getABITypeSizeInBits() instead of getTypeSizeInBits() during struct layout. llvm-svn: 44799 --- clang/CodeGen/CodeGenTypes.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'clang/CodeGen/CodeGenTypes.cpp') diff --git a/clang/CodeGen/CodeGenTypes.cpp b/clang/CodeGen/CodeGenTypes.cpp index f00413c849a..0cc9516d68e 100644 --- a/clang/CodeGen/CodeGenTypes.cpp +++ b/clang/CodeGen/CodeGenTypes.cpp @@ -417,15 +417,15 @@ void RecordOrganizer::layoutStructFields(const ASTRecordLayout &RL) { // struct { char A; short CurrentField:2; }; const llvm::Type *Ty = CGT.ConvertType(FD->getType()); // Calculate extra bits available in this bitfield. - ExtraBits = CGT.getTargetData().getTypeSizeInBits(Ty) - BitFieldSize; + ExtraBits = CGT.getTargetData().getABITypeSizeInBits(Ty) - BitFieldSize; if (LLVMFields.empty()) // Ths is - struct { char CurrentField:2; char B:4; } addLLVMField(Ty, BitFieldSize, FD, 0, ExtraBits); else { const llvm::Type *PrevTy = LLVMFields.back(); - if (CGT.getTargetData().getTypeSizeInBits(PrevTy) >= - CGT.getTargetData().getTypeSizeInBits(Ty)) + if (CGT.getTargetData().getABITypeSizeInBits(PrevTy) >= + CGT.getTargetData().getABITypeSizeInBits(Ty)) // This is - struct { char A; char CurrentField:2; }; addLLVMField(Ty, BitFieldSize, FD, 0, ExtraBits); else { @@ -446,8 +446,8 @@ void RecordOrganizer::layoutStructFields(const ASTRecordLayout &RL) { //ExtraBits are not enough to hold entire FD. const llvm::Type *Ty = CGT.ConvertType(FD->getType()); const llvm::Type *PrevTy = LLVMFields.back(); - uint64_t TySize = CGT.getTargetData().getTypeSizeInBits(Ty); - if (CGT.getTargetData().getTypeSizeInBits(PrevTy) >= TySize) { + uint64_t TySize = CGT.getTargetData().getABITypeSizeInBits(Ty); + if (CGT.getTargetData().getABITypeSizeInBits(PrevTy) >= TySize) { // Previous field does not allow sharing of ExtraBits. Use new field. // struct { char a; char b:5; char c:4; } where c is current FD. Cursor += ExtraBits; @@ -472,7 +472,7 @@ void RecordOrganizer::addPaddingFields(unsigned RequiredBits) { unsigned RequiredBytes = RequiredBits / 8; for (unsigned i = 0; i != RequiredBytes; ++i) addLLVMField(llvm::Type::Int8Ty, - CGT.getTargetData().getTypeSizeInBits(llvm::Type::Int8Ty)); + CGT.getTargetData().getABITypeSizeInBits(llvm::Type::Int8Ty)); } /// addLLVMField - Add llvm struct field that corresponds to llvm type Ty. -- cgit v1.2.3