Lines Matching full:alignment
59 /// as alignment attributes on fields and pragmas in effect.
66 /// Overall record alignment in bits.
589 /// Alignment - The current alignment of the record layout.
590 CharUnits Alignment;
592 /// PreferredAlignment - The preferred alignment of the record layout.
595 /// The alignment if attribute packed is not used.
608 /// Whether we need to infer alignment, even when we have an
639 /// MaxFieldAlignment - The maximum allowed field alignment. This is set by
701 Alignment(CharUnits::One()), PreferredAlignment(CharUnits::One()),
787 /// alignment.
822 CharUnits getAligment() const { return Alignment; }
1019 // The maximum field alignment overrides base align.
1025 // Round up the current record size to pointer alignment.
1028 // Update the alignment.
1249 // AIX `power` alignment does not apply the preferred alignment for
1250 // non-union classes if the source of the alignment (the current base in
1271 // On PS4/PS5, don't update the alignment, to preserve compatibility.
1278 // The maximum field alignment overrides the base align/(AIX-only) preferred
1289 // Round up the current record size to the base's alignment boundary.
1303 Alignment = CharUnits::One();
1316 // Remember max struct/class alignment.
1330 // Honor the default struct packing maximum alignment flag.
1335 // mac68k alignment supersedes maximum field alignment and attribute aligned,
1336 // and forces all structures to have 2-byte alignment. The IBM docs on it
1342 "Having both mac68k and natural alignment on a decl is not allowed.");
1345 Alignment = CharUnits::fromQuantity(2);
1368 // Update based on external alignment.
1371 Alignment = Context.toCharUnitsFromBits(External.Align);
1374 // The external source didn't have alignment information; infer it.
1385 // Finally, round the size of the total struct up to the alignment of the
1400 NonVirtualAlignment = Alignment;
1406 // Finally, round the size of the total struct up to the alignment
1448 // Finally, round the size of the total struct up to the alignment of the
1454 // Layout each field, for now, just sequentially, respecting alignment. In
1536 // Remember max struct/class alignment.
1587 // does not change the alignment of the struct itself, but it does
1592 // A field alignment restriction (e.g. from #pragma pack) or
1594 // formal alignment of the field. For System V, this alters the
1595 // required alignment of the notional storage unit that must contain
1604 // In an ms_struct struct, the alignment of a fundamental type is
1606 // the i386 alignment rules on targets which might not fully align
1611 // The field alignment for integer types is always the size.
1630 // On AIX, [bool, char, short] bitfields have the same alignment
1645 // The bitfield alignment should always be greater than or equal to
1663 // Handle targets that don't honor bitfield type alignment.
1673 // The alignment to round up to is the max of the field's natural
1674 // alignment and a target-specific fixed value (sometimes zero).
1679 // If that doesn't apply, just ignore the field alignment.
1685 // Remember the alignment we would have used if the field were not packed.
1688 // Ignore the field alignment if the field is packed unless it has zero-size.
1711 // alignment attributes.
1718 // adding any alignment padding or if the field weren't packed.
1723 // allocation unit with the right size and alignment. The rules are
1729 // other consideration. Otherwise, round up to the right alignment.
1751 // bit-field type alignment like ARM APCS ABI.
1780 // Anonymous members don't affect the overall record alignment,
1787 // On AIX, zero-width bitfields pad out to the natural alignment boundary,
1788 // but do not increase the alignment greater than the MaxFieldAlignment, or 1
1836 // including padding up to char alignment, and then remember how
1853 // Remember max struct/class alignment.
1936 // alignment if necessary.
1982 // 'aligned' attribute can be used to decrease alignment. In that case, it
1983 // overrides any computed alignment we have, and there is no need to upgrade
1984 // the alignment.
1986 // Enum alignment sources can be safely ignored here, because this only
1987 // helps decide whether we need the AIX alignment upgrade, which only
1994 // The AIX `power` alignment rules apply the natural alignment of the
1996 // whose recursively "first" member or element is such a type). The alignment
1997 // associated with these types for subsequent members use an alignment value
1998 // where the floating-point data type is considered to have 4-byte alignment.
2010 "No need to upgrade the alignment value.");
2042 // The maximum field alignment overrides the aligned attribute.
2061 // Round up the current record size to the field's alignment boundary.
2122 // Remember max struct/class ABI-specified alignment.
2126 // For checking the alignment of inner fields against
2127 // the alignment of its parent record.
2133 // If the offset is a multiple of the alignment of
2135 // TODO: Takes no account the alignment of the outer struct
2164 // Finally, round the size of the record up to the alignment of the
2173 ? Alignment
2177 // If we're inferring alignment, and the external size is smaller than
2178 // our size after we've rounded up to alignment, conservatively set the
2179 // alignment to 1.
2181 Alignment = CharUnits::One();
2210 // Warn if we packed it unnecessarily, when the unpacked alignment is not
2216 if (Packed && UnpackedAlignment <= Alignment &&
2229 // The alignment is not modified when using 'mac68k' alignment or when
2230 // we have an externally-supplied layout that also provides overall alignment.
2234 if (NewAlignment > Alignment) {
2236 "Alignment not a power of 2");
2237 Alignment = NewAlignment;
2242 "Alignment not a power of 2");
2248 "Alignment not a power of 2");
2261 Alignment = CharUnits::One();
2474 // * The alignment of bitfields in unions is ignored when computing the
2475 // alignment of the union.
2491 // * vtordisps are allocated in a block of memory with size and alignment equal
2492 // to the alignment of the completed structure (before applying __declspec(
2496 // order to guarantee proper alignment of all fields, the vfptr injection
2497 // pushes all bases and fields back by the alignment imposed by those bases
2501 // order to guarantee proper alignment of all fields, the vfptr injection
2502 // pushes all bases and fields back by the alignment imposed by those bases
2521 // bases is 1 byte. The padding added between vbases depends on the alignment
2523 // * There is no concept of non-virtual alignment, non-virtual alignment and
2524 // alignment are always identical.
2525 // * There is a distinction between alignment and required alignment.
2526 // __declspec(align) changes the required alignment of a struct. This
2527 // alignment is _always_ obeyed, even in the presence of #pragma pack. A
2528 // record inherits required alignment from all of its fields and bases.
2530 // alignment instead of its required alignment. This is the only known way
2531 // to make the alignment of a struct bigger than 8. Interestingly enough
2532 // this alignment is also immune to the effects of #pragma pack and can be
2533 // used to create structures with large alignment under #pragma pack.
2534 // However, because it does not impact required alignment, such a structure,
2546 // * 2012 and back: In 64-bit mode, if the alignment of a record is 16 or
2563 CharUnits Alignment;
2576 /// Initializes size and alignment and honors some flags.
2578 /// Initialized C++ layout, compute alignment and virtual alignment and
2579 /// existence of vfptrs and vbptrs. Alignment is needed before the vfptr is
2590 /// alignment.
2599 /// Gets the size and alignment of a base taking pragma pack and
2602 /// Gets the size and alignment of a field taking pragma pack and
2627 /// The current alignment of the record layout.
2628 CharUnits Alignment;
2629 /// The maximum allowed field alignment. This is set by #pragma pack.
2631 /// The alignment that this record must obey. This is imposed by
2642 /// The size and alignment info of a pointer.
2687 Info.Alignment = Layout.getAlignment();
2690 Info.Alignment = std::min(Info.Alignment, MaxFieldAlignment);
2693 // Respect required alignment, this is necessary because we may have adjusted
2694 // the alignment in the case of pragma pack. Note that the required alignment
2695 // doesn't actually apply to the struct alignment at this point.
2696 Alignment = std::max(Alignment, Info.Alignment);
2698 Info.Alignment = std::max(Info.Alignment, Layout.getRequiredAlignment());
2706 // Get the alignment of the field type's natural alignment, ignore any
2707 // alignment attributes.
2720 // For some reason __declspec align impacts alignment rather than required
2721 // alignment when it is applied to bitfields.
2722 Info.Alignment = std::max(Info.Alignment, FieldRequiredAlignment);
2731 // Capture required alignment as a side-effect.
2736 Info.Alignment = std::min(Info.Alignment, MaxFieldAlignment);
2738 Info.Alignment = CharUnits::One();
2739 Info.Alignment = std::max(Info.Alignment, FieldRequiredAlignment);
2748 DataSize = Size = Size.alignTo(Alignment);
2764 Alignment = std::max(Alignment, PointerInfo.Alignment);
2765 auto RoundingAlignment = Alignment;
2780 Alignment = CharUnits::One();
2781 // In 64-bit mode we always perform an alignment step after laying out vbases.
2782 // In 32-bit mode we do not. The check to see if we need to perform alignment
2783 // checks the RequiredAlignment field and performs alignment if it isn't 0.
2787 // Compute the maximum field alignment.
2789 // Honor the default struct packing maximum alignment flag.
2800 // Packed attribute forces max field alignment to be 1.
2820 // Calculate pointer size and alignment. These are used for vfptr and vbprt
2824 PointerInfo.Alignment = Context.toCharUnitsFromBits(
2828 PointerInfo.Alignment = std::min(PointerInfo.Alignment, MaxFieldAlignment);
2837 // information about the bases, such as required alignment and the presence of
2962 BaseOffset = Size = Size.alignTo(Info.Alignment);
2984 Alignment = std::max(Alignment, Info.Alignment);
2999 FieldOffset = DataSize.alignTo(Info.Alignment);
3009 FieldOffset = DataSize.alignTo(Info.Alignment);
3011 FieldOffset += Info.Alignment;
3015 FieldOffset = Size.alignTo(Info.Alignment);
3051 llvm::alignDown(FieldBitOffset, Context.toBits(Info.Alignment)) +
3054 Alignment = std::max(Alignment, Info.Alignment);
3058 // TODO: Add a Sema warning that MS ignores bitfield alignment in unions.
3061 CharUnits FieldOffset = Size.alignTo(Info.Alignment);
3064 Alignment = std::max(Alignment, Info.Alignment);
3076 // TODO: Add a Sema warning that MS ignores alignment for zero
3085 // TODO: Add a Sema warning that MS ignores bitfield alignment in unions.
3087 // Round up the current record size to the field's alignment boundary.
3088 CharUnits FieldOffset = Size.alignTo(Info.Alignment);
3091 Alignment = std::max(Alignment, Info.Alignment);
3102 VBPtrOffset = VBPtrOffset.alignTo(PointerInfo.Alignment);
3115 // alignment.
3117 .alignTo(std::max(RequiredAlignment, Alignment));
3130 // alignment.
3132 PointerInfo.Size.alignTo(std::max(RequiredAlignment, Alignment));
3165 // The alignment of the vtordisp is at least the required alignment of the
3188 // the required alignment, we don't know why.
3193 Alignment = std::max(VtorDispAlignment, Alignment);
3204 BaseOffset = Size.alignTo(Info.Alignment);
3216 // Respect required alignment. Note that in 32-bit mode Required alignment
3220 Alignment = std::max(Alignment, RequiredAlignment);
3221 auto RoundingAlignment = Alignment;
3232 // Zero-sized structures have size equal to their alignment if a
3235 Size = Alignment;
3243 Alignment = Context.toCharUnitsFromBits(External.Align);
3365 *this, Builder.Size, Builder.Alignment, Builder.Alignment,
3366 Builder.Alignment, Builder.RequiredAlignment, Builder.HasOwnVFPtr,
3369 Builder.Alignment, Builder.Alignment, CharUnits::Zero(),
3377 *this, Builder.Size, Builder.Alignment, Builder.Alignment,
3378 Builder.Alignment, Builder.RequiredAlignment, Builder.Size,
3399 *this, Builder.getSize(), Builder.Alignment,
3402 Builder.Alignment, Builder.HasOwnVFPtr, RD->isDynamicClass(),
3414 *this, Builder.getSize(), Builder.Alignment,
3417 Builder.Alignment, Builder.getSize(), Builder.FieldOffsets);
3569 *this, Builder.getSize(), Builder.Alignment, Builder.PreferredAlignment,
3572 Builder.Alignment, Builder.getDataSize(), Builder.FieldOffsets);
3776 OS << " Alignment:" << toBits(Info.getAlignment()) << "\n";