[cfe-commits] r101344 - in /cfe/trunk/lib/CodeGen: CGObjCMac.cpp CGRecordLayout.h CGRecordLayoutBuilder.cpp
Daniel Dunbar
daniel at zuster.org
Wed Apr 14 22:09:28 PDT 2010
Author: ddunbar
Date: Thu Apr 15 00:09:28 2010
New Revision: 101344
URL: http://llvm.org/viewvc/llvm-project?rev=101344&view=rev
Log:
IRgen: Eliminate now unused fields from CGBitFieldInfo.
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CGRecordLayout.h
cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=101344&r1=101343&r2=101344&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Thu Apr 15 00:09:28 2010
@@ -124,10 +124,9 @@
// layout object. However, this is blocked on other cleanups to the
// Objective-C code, so for now we just live with allocating a bunch of these
// objects.
- unsigned FieldNo = 0; // This value is unused.
CGBitFieldInfo *Info =
- new (CGF.CGM.getContext()) CGBitFieldInfo(
- LTy, FieldNo, BitOffset, BitFieldSize, IvarTy->isSignedIntegerType());
+ new (CGF.CGM.getContext()) CGBitFieldInfo(BitFieldSize,
+ IvarTy->isSignedIntegerType());
// We always construct a single, possibly unaligned, access for this case.
Info->setNumComponents(1);
Modified: cfe/trunk/lib/CodeGen/CGRecordLayout.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayout.h?rev=101344&r1=101343&r2=101344&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayout.h (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayout.h Thu Apr 15 00:09:28 2010
@@ -77,9 +77,6 @@
};
private:
- /// The number of access components to use.
- unsigned NumComponents;
-
/// The components to use to access the bit-field. We may need up to three
/// separate components to support up to i64 bit-field access (4 + 2 + 1 byte
/// accesses).
@@ -87,20 +84,20 @@
// FIXME: De-hardcode this, just allocate following the struct.
AccessInfo Components[3];
-public:
- CGBitFieldInfo(const llvm::Type *FieldTy, unsigned FieldNo,
- unsigned Start, unsigned Size, bool IsSigned)
- : FieldTy(FieldTy), FieldNo(FieldNo),
- Start(Start), Size(Size), IsSigned(IsSigned) {}
+ /// The total size of the bit-field, in bits.
+ unsigned Size;
- const llvm::Type *FieldTy;
- unsigned FieldNo;
+ /// The number of access components to use.
+ unsigned NumComponents;
- unsigned Start;
- unsigned Size;
+ /// Whether the bit-field is signed.
bool IsSigned : 1;
public:
+ CGBitFieldInfo(unsigned Size, bool IsSigned)
+ : Size(Size), IsSigned(IsSigned) {}
+
+public:
/// \brief Check whether this bit-field access is (i.e., should be sign
/// extended on loads).
bool isSigned() const { return IsSigned; }
Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=101344&r1=101343&r2=101344&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Thu Apr 15 00:09:28 2010
@@ -153,15 +153,15 @@
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 @@
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 CGBitFieldInfo::print(llvm::raw_ostream &OS) const {
OS << "<CGBitFieldInfo";
- OS << " FieldTy:" << *FieldTy;
- OS << " FieldNo:" << FieldNo;
- OS << " Start:" << Start;
OS << " Size:" << Size;
OS << " IsSigned:" << IsSigned << "\n";
More information about the cfe-commits
mailing list