IRgen: Eliminate now unused fields from CGBitFieldInfo.
llvm-svn: 101344
This commit is contained in:
parent
4041ab6e00
commit
bb13845c5f
|
@ -124,10 +124,9 @@ LValue CGObjCRuntime::EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF,
|
|||
// 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);
|
||||
|
|
|
@ -77,9 +77,6 @@ public:
|
|||
};
|
||||
|
||||
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,19 +84,19 @@ private:
|
|||
// 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) {}
|
||||
|
||||
const llvm::Type *FieldTy;
|
||||
unsigned FieldNo;
|
||||
|
||||
unsigned Start;
|
||||
/// The total size of the bit-field, in bits.
|
||||
unsigned Size;
|
||||
|
||||
/// The number of access components to use.
|
||||
unsigned NumComponents;
|
||||
|
||||
/// 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).
|
||||
|
|
|
@ -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 << "<CGBitFieldInfo";
|
||||
OS << " FieldTy:" << *FieldTy;
|
||||
OS << " FieldNo:" << FieldNo;
|
||||
OS << " Start:" << Start;
|
||||
OS << " Size:" << Size;
|
||||
OS << " IsSigned:" << IsSigned << "\n";
|
||||
|
||||
|
|
Loading…
Reference in New Issue