[PATCH] D99608: [StructLayout] Use TrailingObjects to allocate space for MemberOffsets.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 30 10:10:59 PDT 2021
craig.topper created this revision.
craig.topper added reviewers: rnk, jyknight, erichkeane, efriedma, chandlerc, mehdi_amini.
Herald added subscribers: dexonsmith, hiraditya.
craig.topper requested review of this revision.
Herald added a project: LLVM.
MemberOffsets are stored at the end of StructLayout. The class
contains a single entry array to mark the start of the member
offsets. getStructLayout calculates the additional space needed
for additional elements before allocating memory.
This patch converts this to use TrailingObjects. This simplifies
the size computation in getStructLayout and gets rid of the
single entry array.
This is prep work, but to use TypeSize instead of uint64_t for
D98169 <https://reviews.llvm.org/D98169>. The single entry array doesn't work with TypeSize because
TypeSize doesn't have a default constructor. We thought this
change was an improvement by itself so we've separated it out.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99608
Files:
llvm/include/llvm/IR/DataLayout.h
llvm/lib/IR/DataLayout.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99608.334213.patch
Type: text/x-patch
Size: 4362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210330/87972a43/attachment.bin>
More information about the llvm-commits
mailing list