[PATCH] D76526: Add an algorithm for performing "optimal" layout of a struct.

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 15 11:04:42 PDT 2021


rjmccall added a comment.

In D76526#2689767 <https://reviews.llvm.org/D76526#2689767>, @dblaikie wrote:

> In D76526#2689041 <https://reviews.llvm.org/D76526#2689041>, @lxfind wrote:
>
>> In D76526#2688002 <https://reviews.llvm.org/D76526#2688002>, @dblaikie wrote:
>>
>>> Out of curiosity, what's the motivating use case for the fixed offset fields in this tool?
>>
>> There is a need for this in coroutines. In the coroutine frame layout, the first few fields are fixed according to C++ standard.
>
> Ah, makes sense - is that only for prefixes, or can that result in arbitrary non-initial-sequence fixed offset fields too?

It does support filling holes between fixed fields, yes.  This is actually currently used in coroutines with over-aligned promises that require padding.  (Apparently we are currently putting the padding in the wrong place, but that doesn't deeply matter, since in either case there's padding we can fill.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76526/new/

https://reviews.llvm.org/D76526



More information about the llvm-commits mailing list