Lines Matching full:alignment
60 /// as alignment attributes on fields and pragmas in effect.
67 /// \brief Overall record alignment in bits.
580 /// Alignment - The current alignment of the record layout.
581 CharUnits Alignment; member in __anonc00f4a770111::RecordLayoutBuilder
583 /// \brief The alignment if attribute packed is not used.
592 /// \brief Whether we need to infer alignment, even when we have an
614 /// MaxFieldAlignment - The maximum allowed field alignment. This is set by
662 Alignment(CharUnits::One()), UnpackedAlignment(CharUnits::One()), in RecordLayoutBuilder()
743 /// alignment.
774 CharUnits getAligment() const { return Alignment; } in getAligment()
973 // The maximum field alignment overrides base align. in EnsureVTablePointerAlignment()
979 // Round up the current record size to pointer alignment. in EnsureVTablePointerAlignment()
983 // Update the alignment. in EnsureVTablePointerAlignment()
1192 // The maximum field alignment overrides base align. in LayoutBase()
1199 // Round up the current record size to the base's alignment boundary. in LayoutBase()
1213 Alignment = CharUnits::One(); in LayoutBase()
1226 // Remember max struct/class alignment. in LayoutBase()
1240 // Honor the default struct packing maximum alignment flag. in InitializeLayout()
1245 // mac68k alignment supersedes maximum field alignment and attribute aligned, in InitializeLayout()
1246 // and forces all structures to have 2-byte alignment. The IBM docs on it in InitializeLayout()
1252 Alignment = CharUnits::fromQuantity(2); in InitializeLayout()
1268 // Update based on external alignment. in InitializeLayout()
1271 Alignment = Context.toCharUnitsFromBits(External.Align); in InitializeLayout()
1273 // The external source didn't have alignment information; infer it. in InitializeLayout()
1284 // Finally, round the size of the total struct up to the alignment of the in Layout()
1300 NonVirtualAlignment = Alignment; in Layout()
1305 // Finally, round the size of the total struct up to the alignment in Layout()
1347 // Finally, round the size of the total struct up to the alignment of the in Layout()
1353 // Layout each field, for now, just sequentially, respecting alignment. In in LayoutFields()
1436 // Remember max struct/class alignment. in LayoutWideBitField()
1482 // does not change the alignment of the struct itself, but it does in LayoutBitField()
1487 // A field alignment restriction (e.g. from #pragma pack) or in LayoutBitField()
1489 // formal alignment of the field. For System V, this alters the in LayoutBitField()
1490 // required alignment of the notional storage unit that must contain in LayoutBitField()
1499 // In an ms_struct struct, the alignment of a fundamental type is in LayoutBitField()
1501 // the i386 alignment rules on targets which might not fully align in LayoutBitField()
1506 // The field alignment for integer types is always the size. in LayoutBitField()
1533 // Handle targets that don't honor bitfield type alignment. in LayoutBitField()
1538 // The alignment to round up to is the max of the field's natural in LayoutBitField()
1539 // alignment and a target-specific fixed value (sometimes zero). in LayoutBitField()
1544 // If that doesn't apply, just ignore the field alignment. in LayoutBitField()
1550 // Remember the alignment we would have used if the field were not packed. in LayoutBitField()
1553 // Ignore the field alignment if the field is packed unless it has zero-size. in LayoutBitField()
1573 // adding any alignment padding or if the field weren't packed. in LayoutBitField()
1578 // allocation unit with the right size and alignment. The rules are in LayoutBitField()
1584 // other consideration. Otherwise, round up to the right alignment. in LayoutBitField()
1621 // Anonymous members don't affect the overall record alignment, in LayoutBitField()
1653 // including padding up to char alignment, and then remember how in LayoutBitField()
1670 // Remember max struct/class alignment. in LayoutBitField()
1719 // alignment if necessary. in LayoutField()
1741 // The maximum field alignment overrides the aligned attribute. in LayoutField()
1747 // Round up the current record size to the field's alignment boundary. in LayoutField()
1799 // Remember max struct/class alignment. in LayoutField()
1817 // Finally, round the size of the record up to the alignment of the in FinishLayout()
1825 = llvm::RoundUpToAlignment(getSizeInBits(), Context.toBits(Alignment)); in FinishLayout()
1828 // If we're inferring alignment, and the external size is smaller than in FinishLayout()
1829 // our size after we've rounded up to alignment, conservatively set the in FinishLayout()
1830 // alignment to 1. in FinishLayout()
1832 Alignment = CharUnits::One(); in FinishLayout()
1858 // Warn if we packed it unnecessarily. If the alignment is 1 byte don't in FinishLayout()
1859 // bother since there won't be alignment issues. in FinishLayout()
1869 // The alignment is not modified when using 'mac68k' alignment or when in UpdateAlignment()
1870 // we have an externally-supplied layout that also provides overall alignment. in UpdateAlignment()
1874 if (NewAlignment > Alignment) { in UpdateAlignment()
1876 "Alignment not a power of 2"); in UpdateAlignment()
1877 Alignment = NewAlignment; in UpdateAlignment()
1882 "Alignment not a power of 2"); in UpdateAlignment()
1895 Alignment = CharUnits::One(); in updateExternalFieldOffset()
1958 // Warn if we packed it unnecessarily. If the alignment is 1 byte don't in CheckFieldPadding()
1959 // bother since there won't be alignment issues. in CheckFieldPadding()
2080 // * The alignment of bitfields in unions is ignored when computing the
2081 // alignment of the union.
2097 // * vtordisps are allocated in a block of memory with size and alignment equal
2098 // to the alignment of the completed structure (before applying __declspec(
2102 // order to guarantee proper alignment of all fields, the vfptr injection
2103 // pushes all bases and fields back by the alignment imposed by those bases
2107 // order to guarantee proper alignment of all fields, the vfptr injection
2108 // pushes all bases and fields back by the alignment imposed by those bases
2127 // bases is 1 byte. The padding added between vbases depends on the alignment
2129 // * There is no concept of non-virtual alignment, non-virtual alignment and
2130 // alignment are always identical.
2131 // * There is a distinction between alignment and required alignment.
2132 // __declspec(align) changes the required alignment of a struct. This
2133 // alignment is _always_ obeyed, even in the presence of #pragma pack. A
2134 // record inherits required alignment from all of its fields and bases.
2136 // alignment instead of its required alignment. This is the only known way
2137 // to make the alignment of a struct bigger than 8. Interestingly enough
2138 // this alignment is also immune to the effects of #pragma pack and can be
2139 // used to create structures with large alignment under #pragma pack.
2140 // However, because it does not impact required alignment, such a structure,
2152 // * 2012 and back: In 64-bit mode, if the alignment of a record is 16 or
2169 CharUnits Alignment; member
2179 /// \brief Initializes size and alignment and honors some flags.
2181 /// \brief Initialized C++ layout, compute alignment and virtual alignment and
2182 /// existence of vfptrs and vbptrs. Alignment is needed before the vfptr is
2192 /// alignment.
2201 /// \brief Gets the size and alignment of a base taking pragma pack and
2204 /// \brief Gets the size and alignment of a field taking pragma pack and
2227 /// \brief The current alignment of the record layout.
2228 CharUnits Alignment; member
2229 /// \brief The maximum allowed field alignment. This is set by #pragma pack.
2231 /// \brief The alignment that this record must obey. This is imposed by
2242 /// \brief The size and alignment info of a pointer.
2287 Info.Alignment = Layout.getAlignment(); in getAdjustedElementInfo()
2290 Info.Alignment = std::min(Info.Alignment, MaxFieldAlignment); in getAdjustedElementInfo()
2293 // Respect required alignment, this is necessary because we may have adjusted in getAdjustedElementInfo()
2294 // the alignment in the case of pragam pack. Note that the required alignment in getAdjustedElementInfo()
2295 // doesn't actually apply to the struct alignment at this point. in getAdjustedElementInfo()
2296 Alignment = std::max(Alignment, Info.Alignment); in getAdjustedElementInfo()
2298 Info.Alignment = std::max(Info.Alignment, Layout.getRequiredAlignment()); in getAdjustedElementInfo()
2306 // Get the alignment of the field type's natural alignment, ignore any in getAdjustedElementInfo()
2307 // alignment attributes. in getAdjustedElementInfo()
2309 std::tie(Info.Size, Info.Alignment) = in getAdjustedElementInfo()
2320 // For some reason __declspec align impacts alignment rather than required in getAdjustedElementInfo()
2321 // alignment when it is applied to bitfields. in getAdjustedElementInfo()
2322 Info.Alignment = std::max(Info.Alignment, FieldRequiredAlignment); in getAdjustedElementInfo()
2331 // Capture required alignment as a side-effect. in getAdjustedElementInfo()
2336 Info.Alignment = std::min(Info.Alignment, MaxFieldAlignment); in getAdjustedElementInfo()
2338 Info.Alignment = CharUnits::One(); in getAdjustedElementInfo()
2339 Info.Alignment = std::max(Info.Alignment, FieldRequiredAlignment); in getAdjustedElementInfo()
2348 DataSize = Size = Size.RoundUpToAlignment(Alignment); in layout()
2364 Alignment = std::max(Alignment, PointerInfo.Alignment); in cxxLayout()
2365 auto RoundingAlignment = Alignment; in cxxLayout()
2378 Alignment = CharUnits::One(); in initializeLayout()
2379 // In 64-bit mode we always perform an alignment step after laying out vbases. in initializeLayout()
2380 // In 32-bit mode we do not. The check to see if we need to perform alignment in initializeLayout()
2381 // checks the RequiredAlignment field and performs alignment if it isn't 0. in initializeLayout()
2384 // Compute the maximum field alignment. in initializeLayout()
2386 // Honor the default struct packing maximum alignment flag. in initializeLayout()
2396 // Packed attribute forces max field alignment to be 1. in initializeLayout()
2416 // Calculate pointer size and alignment. These are used for vfptr and vbprt in initializeCXXLayout()
2420 PointerInfo.Alignment = PointerInfo.Size; in initializeCXXLayout()
2423 PointerInfo.Alignment = std::min(PointerInfo.Alignment, MaxFieldAlignment); in initializeCXXLayout()
2432 // information about the bases, such as reqruied alignment and the presence of in layoutNonVirtualBases()
2521 BaseOffset = Size.RoundUpToAlignment(Info.Alignment); in layoutNonVirtualBase()
2540 Alignment = std::max(Alignment, Info.Alignment); in layoutField()
2551 FieldOffset = Size.RoundUpToAlignment(Info.Alignment); in layoutField()
2583 // TODO: Add a Sema warning that MS ignores bitfield alignment in unions. in layoutBitField()
2586 CharUnits FieldOffset = Size.RoundUpToAlignment(Info.Alignment); in layoutBitField()
2589 Alignment = std::max(Alignment, Info.Alignment); in layoutBitField()
2600 // TODO: Add a Sema warning that MS ignores alignment for zero in layoutZeroWidthBitField()
2609 // TODO: Add a Sema warning that MS ignores bitfield alignment in unions. in layoutZeroWidthBitField()
2611 // Round up the current record size to the field's alignment boundary. in layoutZeroWidthBitField()
2612 CharUnits FieldOffset = Size.RoundUpToAlignment(Info.Alignment); in layoutZeroWidthBitField()
2615 Alignment = std::max(Alignment, Info.Alignment); in layoutZeroWidthBitField()
2625 VBPtrOffset = VBPtrOffset.RoundUpToAlignment(PointerInfo.Alignment); in injectVBPtr()
2633 // alignment. in injectVBPtr()
2635 std::max(RequiredAlignment, Alignment)); in injectVBPtr()
2648 // alignment. in injectVFPtr()
2650 std::max(RequiredAlignment, Alignment)); in injectVFPtr()
2671 // The alignment of the vtordisp is at least the required alignment of the in layoutVirtualBases()
2694 // the required alignment, we don't know why. in layoutVirtualBases()
2698 Alignment = std::max(VtorDispAlignment, Alignment); in layoutVirtualBases()
2712 BaseOffset = Size.RoundUpToAlignment(Info.Alignment); in layoutVirtualBases()
2722 // Respect required alignment. Note that in 32-bit mode Required alignment in finalizeLayout()
2726 Alignment = std::max(Alignment, RequiredAlignment); in finalizeLayout()
2727 auto RoundingAlignment = Alignment; in finalizeLayout()
2736 // Zero-sized structures have size equal to their alignment if a in finalizeLayout()
2739 Size = Alignment; in finalizeLayout()
2747 Alignment = Context.toCharUnitsFromBits(External.Align); in finalizeLayout()
2844 *this, Builder.Size, Builder.Alignment, Builder.RequiredAlignment, in BuildMicrosoftASTRecordLayout()
2849 Builder.Alignment, CharUnits::Zero(), Builder.PrimaryBase, in BuildMicrosoftASTRecordLayout()
2856 *this, Builder.Size, Builder.Alignment, Builder.RequiredAlignment, in BuildMicrosoftASTRecordLayout()
2907 Builder.Alignment, in getASTRecordLayout()
2909 Builder.Alignment, in getASTRecordLayout()
2929 Builder.Alignment, in getASTRecordLayout()
2931 Builder.Alignment, in getASTRecordLayout()
3049 Builder.Alignment, in getObjCLayout()
3051 Builder.Alignment, in getObjCLayout()
3206 OS << " Alignment:" << toBits(Info.getAlignment()) << "\n"; in DumpRecordLayout()