Skip to content
Snippets Groups Projects
user avatar
Warren Hunt authored
CGRecordLayoutBuilder was aging, complex, multi-pass, and shows signs of 
existing before ASTRecordLayoutBuilder.  It redundantly performed many 
layout operations that are now performed by ASTRecordLayoutBuilder and 
asserted that the results were the same.  With the addition of support 
for the MS-ABI, such as placement of vbptrs, vtordisps, different 
bitfield layout and a variety of other features, CGRecordLayoutBuilder 
was growing unwieldy in its redundancy.

This patch re-architects CGRecordLayoutBuilder to not perform any 
redundant layout but rather, as directly as possible, lower an 
ASTRecordLayout to an llvm::type.  The new architecture is significantly 
smaller and simpler than the CGRecordLayoutBuilder and contains fewer 
ABI-specific code paths.  It's also one pass.

The architecture of the new system is described in the comments. For the 
most part, the new system simply takes all of the fields and bases from 
an ASTRecordLayout, sorts them, inserts padding and dumps a record. 
Bitfields, unions and primary virtual bases make this process a bit more 
complicated.  See the inline comments.

In addition, this patch updates a few lit tests due to the fact that the 
new system computes more accurate llvm types than CGRecordLayoutBuilder. 
Each change is commented individually in the review.

Differential Revision: http://llvm-reviews.chandlerc.com/D2795

llvm-svn: 201907
fb00c887
Name Last commit Last update
..
Inputs
2003-11-02-WeakLinkage.cpp
2003-11-18-PtrMemConstantInitializer.cpp
2003-11-27-MultipleInheritanceThunk.cpp
2003-11-29-DuplicatedCleanupTest.cpp
2003-12-08-ArrayOfPtrToMemberFunc.cpp
2004-01-11-DynamicInitializedConstant.cpp
2004-03-08-ReinterpretCastCopy.cpp
2004-03-09-UnmangledBuiltinMethods.cpp
2004-03-15-CleanupsAndGotos.cpp
2004-06-08-LateTemplateInstantiation.cpp
2004-09-27-DidntEmitTemplate.cpp
2004-11-27-ExceptionCleanupAssertion.cpp
2004-11-27-FriendDefaultArgCrash.cpp
2005-01-03-StaticInitializers.cpp
2005-02-11-AnonymousUnion.cpp
2005-02-13-BadDynamicInit.cpp
2005-02-19-BitfieldStructCrash.cpp
2005-02-19-UnnamedVirtualThunkArgument.cpp
2005-02-20-BrokenReferenceTest.cpp
2006-03-01-GimplifyCrash.cpp
2006-03-06-C++RecurseCrash.cpp
2006-09-12-OpaqueStructCrash.cpp
2006-10-30-ClassBitfield.cpp
2006-11-20-GlobalSymbols.cpp
2006-11-30-ConstantExprCrash.cpp
2007-01-02-UnboundedArray.cpp
2007-01-06-PtrMethodInit.cpp
2007-04-05-PackedBitFields-1.cpp
2007-04-05-PackedBitFieldsOverlap-2.cpp
2007-04-05-PackedBitFieldsOverlap.cpp
2007-04-05-PackedBitFieldsSmall.cpp
2007-04-05-StructPackedFieldUnpacked.cpp
2007-04-10-PackedUnion.cpp
2007-04-14-FNoBuiltin.cpp
2007-05-03-VectorInit.cpp
2007-07-29-RestrictPtrArg.cpp
2007-07-29-RestrictRefArg.cpp
2007-09-10-RecursiveTypeResolution.cpp
2007-10-01-StructResize.cpp
2008-01-12-VecInit.cpp
2008-05-07-CrazyOffsetOf.cpp
2009-03-17-dbg.cpp
2009-04-23-bool2.cpp
2009-05-04-PureConstNounwind.cpp
2009-06-16-DebugInfoCrash.cpp
2009-07-16-Using.cpp
2009-08-05-ZeroInitWidth.cpp
2009-08-11-VectorRetTy.cpp
2009-09-09-packed-layout.cpp
2009-10-27-crash.cpp
2009-12-23-MissingSext.cpp
2010-03-09-AnonAggregate.cpp
2010-05-10-Var-DbgInfo.cpp
2010-05-11-alwaysinlineinstantiation.cpp
2010-05-12-PtrToMember-Dbg.cpp
2010-06-21-LocalVarDbg.cpp
2010-06-22-BitfieldInit.cpp
2010-06-22-ZeroBitfield.cpp
2010-07-23-DeclLoc.cpp
2011-12-19-init-list-ctor.cpp
2012-02-06-VecInitialization.cpp
2012-03-16-StoreAlign.cpp
DynArrayInit.cpp
PR4827-cast.cpp
PR4983-constructor-conversion.cpp
PR5050-constructor-conversion.cpp
PR5093-static-member-function.cpp
PR5834-constructor-conversion.cpp
PR5863-unreachable-block.cpp
PR6474.cpp
__null.cpp
aarch64-arguments.cpp
aarch64-cxxabi.cpp
aarch64-mangle-neon-vectors.cpp
aarch64-neon.cpp
abstract-class-ctors-dtors.cpp
address-of-fntemplate.cpp
alloca-align.cpp
anonymous-namespaces.cpp
anonymous-union-member-initializer.cpp
apple-kext-guard-variable.cpp
apple-kext-indirect-call-2.C
apple-kext-indirect-call.C
apple-kext-indirect-virtual-dtor-call.cpp
apple-kext-linkage.C
apple-kext-no-staticinit-section.C
apple-kext.cpp
arm-cc.cpp
arm-vaarg.cpp
arm.cpp
array-construction.cpp
array-operator-delete-call.cpp
array-pointer-decay.cpp
array-value-initialize.cpp
asm.cpp
assign-construct-memcpy.cpp
assign-operator.cpp
atomic.cpp
atomicinit.cpp