From bb13845c5f6fc61888092b455e9616bbbebcffb7 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 15 Apr 2010 05:09:28 +0000 Subject: IRgen: Eliminate now unused fields from CGBitFieldInfo. llvm-svn: 101344 --- clang/lib/CodeGen/CGRecordLayoutBuilder.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'clang/lib/CodeGen/CGRecordLayoutBuilder.cpp') diff --git a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp index 45acb03450f..cfdae2445e6 100644 --- a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -153,15 +153,15 @@ static CGBitFieldInfo ComputeBitFieldInfo(CodeGenTypes &Types, uint64_t TypeSizeInBytes = Types.getTargetData().getTypeAllocSize(Ty); uint64_t TypeSizeInBits = TypeSizeInBytes * 8; + unsigned StartBit = FieldOffset % TypeSizeInBits; bool IsSigned = FD->getType()->isSignedIntegerType(); - CGBitFieldInfo BFI(Ty, FieldOffset / TypeSizeInBits, - FieldOffset % TypeSizeInBits, FieldSize, IsSigned); + CGBitFieldInfo BFI(FieldSize, IsSigned); // The current policy is to always access the bit-field using the source type // of the bit-field. With the C bit-field rules, this implies that we always // use either one or two accesses, and two accesses can only occur with a // packed structure when the bit-field straddles an alignment boundary. - unsigned LowBits = std::min(FieldSize, TypeSizeInBits - BFI.Start); + unsigned LowBits = std::min(FieldSize, TypeSizeInBits - StartBit); bool NeedsHighAccess = LowBits != FieldSize; BFI.setNumComponents(1 + NeedsHighAccess); @@ -170,7 +170,7 @@ static CGBitFieldInfo ComputeBitFieldInfo(CodeGenTypes &Types, LowAccess.FieldIndex = 0; LowAccess.FieldByteOffset = TypeSizeInBytes * ((FieldOffset / 8) / TypeSizeInBytes); - LowAccess.FieldBitStart = BFI.Start; + LowAccess.FieldBitStart = StartBit; LowAccess.AccessWidth = TypeSizeInBits; // FIXME: This might be wrong! LowAccess.AccessAlignment = 0; @@ -565,9 +565,6 @@ void CGRecordLayout::dump() const { void CGBitFieldInfo::print(llvm::raw_ostream &OS) const { OS << "