Commit Graph

12 Commits

Author SHA1 Message Date
Warren Hunt 21db05d136 Complete Rewrite of CGRecordLayoutBuilder
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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201907 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-21 23:49:50 +00:00
Peter Collingbourne 9984d12729 Move vtable dumper call to VTableBuilder ctor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140508 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-26 01:57:00 +00:00
Anders Carlsson 014a358058 Don't add address points for virtual primary bases that aren't primary bases in the complete class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99555 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 21:45:14 +00:00
Anders Carlsson db4022cf95 Improve vcall offset handling in construction vtables. With this we layout the construction vtables from the ABI examples correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98127 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 02:33:41 +00:00
Anders Carlsson e54d1c12d7 Figured out why the test was failing, this will hopefully fix it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97336 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27 19:00:53 +00:00
Anders Carlsson 64b6e80e86 XFAIL this for now. I have no idea why this test is failing on some machines. Looks like some sort of whitespace issue in FileCheck.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97332 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27 18:09:05 +00:00
Anders Carlsson 5edcc37525 Generate correct vcall offsets when we have a primary virtual base that is not a primary base in the complete class hierarchy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97039 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-24 16:43:12 +00:00
Anders Carlsson f2349fc7e2 Add another test from the ABI spec.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96659 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 05:59:40 +00:00
Anders Carlsson 8b6765fb56 Fix another bug and add another class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96590 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 17:32:33 +00:00
Anders Carlsson 54d9a78b2c Add another class from cxx-vtable-ex.html
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96588 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 17:28:16 +00:00
Anders Carlsson eb577d0df4 More work on vcall offsets.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96587 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 17:26:40 +00:00
Anders Carlsson be71e3b28a Add tests from the Itanium C++ ABI spec.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96586 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 17:07:24 +00:00