[cfe-commits] r70778 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Daniel Dunbar
daniel at zuster.org
Sun May 3 07:17:50 PDT 2009
Author: ddunbar
Date: Sun May 3 09:17:18 2009
New Revision: 70778
URL: http://llvm.org/viewvc/llvm-project?rev=70778&view=rev
Log:
Lift common subexpression, remove dead "base" variable.
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=70778&r1=70777&r2=70778&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Sun May 3 09:17:18 2009
@@ -2956,21 +2956,22 @@
FieldDecl *MaxSkippedField = 0;
FieldDecl *LastFieldBitfield = 0;
- unsigned base = 0;
if (RecFields.empty())
return;
- if (IsUnion)
- base = BytePos + GetFieldBaseOffset(OI, Layout, RecFields[0]);
unsigned WordSizeInBits = CGM.getContext().Target.getPointerWidth(0);
unsigned ByteSizeInBits = CGM.getContext().Target.getCharWidth();
for (unsigned i = 0, e = RecFields.size(); i != e; ++i) {
FieldDecl *Field = RecFields[i];
+
// Skip over unnamed or bitfields
if (!Field->getIdentifier() || Field->isBitField()) {
LastFieldBitfield = Field;
continue;
}
+
+ unsigned FieldOffset = GetFieldBaseOffset(OI, Layout, Field);
+
LastFieldBitfield = 0;
QualType FQT = Field->getType();
if (FQT->isRecordType() || FQT->isUnionType()) {
@@ -2978,7 +2979,7 @@
HasUnion = true;
BuildAggrIvarRecordLayout(FQT->getAsRecordType(),
- BytePos + GetFieldBaseOffset(OI, Layout, Field),
+ BytePos + FieldOffset,
ForStrongLayout, HasUnion);
continue;
}
@@ -3003,9 +3004,7 @@
int OldSkIndex = SkipIvars.size() -1;
const RecordType *RT = FQT->getAsRecordType();
- BuildAggrIvarRecordLayout(RT,
- BytePos + GetFieldBaseOffset(OI, Layout,
- Field),
+ BuildAggrIvarRecordLayout(RT, BytePos + FieldOffset,
ForStrongLayout, HasUnion);
// Replicate layout information for each array element. Note that
@@ -3038,8 +3037,7 @@
MaxField = Field;
}
} else {
- IvarsInfo.push_back(GC_IVAR(BytePos + GetFieldBaseOffset(OI, Layout,
- Field),
+ IvarsInfo.push_back(GC_IVAR(BytePos + FieldOffset,
FieldSize / WordSizeInBits));
}
} else if ((ForStrongLayout &&
@@ -3055,8 +3053,7 @@
}
} else {
// FIXME: Why the asymmetry, we divide by byte size in bits here?
- SkipIvars.push_back(GC_IVAR(BytePos + GetFieldBaseOffset(OI, Layout,
- Field),
+ SkipIvars.push_back(GC_IVAR(BytePos + FieldOffset,
FieldSize / ByteSizeInBits));
}
}
More information about the cfe-commits
mailing list