Lines Matching +full:fixed +full:- +full:layout
1 //===-- OptimizedStructLayout.h - Struct layout algorithm ---------*- C++ -*-=//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 /// requirements of the struct while still satisfying the layout
13 /// requirements of the individual fields. The resulting layout may be
17 /// Fields may be pre-assigned fixed offsets. They may also be given sizes
24 /// - First, it does not guarantee that the result is minimal in size.
28 /// - Second, there are other ways that a struct layout could be optimized
29 /// besides space usage, such as locality. This layout may have a mixed
33 //===----------------------------------------------------------------------===//
53 assert(Size > 0 && "adding an empty field to the layout"); in Offset()
56 /// The offset of this field in the final layout. If this is
57 /// initialized to FlexibleOffset, layout will overwrite it with
62 /// a multiple of Alignment. Must be non-zero.
75 /// Return true if this field has been assigned a fixed offset.
76 /// After layout, this will be true of all the fields.
81 /// Given that this field has a fixed offset, return the offset
89 /// Compute a layout for a struct containing the given fields, making a
90 /// best-effort attempt to minimize the amount of space required.
93 /// than the well-known "sort by decreasing alignment" solution:
95 /// - Fields may be assigned a fixed offset in the layout. If there are
96 /// gaps among the fixed-offset fields, the algorithm may attempt
97 /// to allocate flexible-offset fields into those gaps. If that's
99 /// just creating a single fixed-offset field that represents the
102 /// - The size of a field is not required to be a multiple of, or even
104 /// on fields is that they must not be zero-sized.
106 /// To simplify the implementation, any fixed-offset fields in the
107 /// layout must appear at the start of the field array, and they must
110 /// The algorithm will produce a guaranteed-minimal layout with no
111 /// interior padding in the following "C-style" case:
113 /// - every field's size is a multiple of its required alignment and
114 /// - either no fields have initially fixed offsets, or the fixed-offset
116 /// least as aligned as all the flexible-offset fields.
118 /// Otherwise, while the algorithm will make a best-effort attempt to
119 /// avoid padding, it cannot guarantee a minimal layout, as there is
122 /// The layout produced by this algorithm may not be stable across LLVM
125 /// Flexible-offset fields with the same size and alignment will be ordered
128 /// flexible-offset fields.
130 /// On return, all fields will have been assigned a fixed offset, and the
132 /// means that the fixed-offset fields may no longer form a strict prefix