[PATCH] Complete Rewrite of CGRecordLayoutBuilder

Warren Hunt whunt at google.com
Tue Feb 18 16:48:43 PST 2014


whunt added you to the CC list for the revision "Complete Rewrite of CGRecordLayoutBuilder".

Hi rnk, rjmccall, majnemer,

This patch completely replaces CGRecordLayoutBuilder.  CGRecordLayoutBuilder was aging, complex, multi-pass, shows signs of existing before ASTRecordLayoutBuilder and was getting hackier as support for MS layout, including vbase placement, vtordisps, ms-bitfields and a variety of other features.  By reimplementing it, a significant code reduction was achieved and a significant amount of duplication of functionality between CGRecordLayoutBuilder and ASTRecordLayoutBuilder was removed.

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.

I'm sorry the diff is hard to read due to the way diff works when replacing almost the entire contents of a file.

I had to update a few lit tests due to the fact that the new system compute more accurate llvm types than CGRecordLayoutBuilder.  I'll comment on each change individually.

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

Files:
  lib/CodeGen/CGRecordLayoutBuilder.cpp
  test/CodeGen/PR4611-bitfield-layout.c
  test/CodeGen/bitfield-2.c
  test/CodeGen/packed-nest-unpacked.c
  test/CodeGen/packed-union.c
  test/CodeGen/pragma-pack-1.c
  test/CodeGen/pragma-pack-2.c
  test/CodeGen/struct-x86-darwin.c
  test/CodeGen/volatile.c
  test/CodeGenCXX/bitfield-layout.cpp
  test/CodeGenCXX/class-layout.cpp
  test/CodeGenCXX/copy-constructor-synthesis.cpp
  test/CodeGenCXX/pragma-pack-3.cpp
  test/CodeGenCXX/vtable-layout-abi-examples.cpp
  test/Sema/ms_class_layout.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2795.4.patch
Type: text/x-patch
Size: 79863 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140218/0c3bbca8/attachment.bin>


More information about the cfe-commits mailing list