Lines Matching full:alignment
59 /// as alignment attributes on fields and pragmas in effect.
66 /// \brief Overall record alignment in bits.
579 /// Alignment - The current alignment of the record layout.
580 CharUnits Alignment; member in __anon07e898d70111::ItaniumRecordLayoutBuilder
582 /// \brief The alignment if attribute packed is not used.
591 /// \brief Whether we need to infer alignment, even when we have an
613 /// MaxFieldAlignment - The maximum allowed field alignment. This is set by
661 Alignment(CharUnits::One()), UnpackedAlignment(CharUnits::One()), in ItaniumRecordLayoutBuilder()
741 /// alignment.
772 CharUnits getAligment() const { return Alignment; } in getAligment()
969 // The maximum field alignment overrides base align. in EnsureVTablePointerAlignment()
975 // Round up the current record size to pointer alignment. in EnsureVTablePointerAlignment()
979 // Update the alignment. in EnsureVTablePointerAlignment()
1189 // The maximum field alignment overrides base align. in LayoutBase()
1196 // Round up the current record size to the base's alignment boundary. in LayoutBase()
1210 Alignment = CharUnits::One(); in LayoutBase()
1223 // Remember max struct/class alignment. in LayoutBase()
1237 // Honor the default struct packing maximum alignment flag. in InitializeLayout()
1242 // mac68k alignment supersedes maximum field alignment and attribute aligned, in InitializeLayout()
1243 // and forces all structures to have 2-byte alignment. The IBM docs on it in InitializeLayout()
1249 Alignment = CharUnits::fromQuantity(2); in InitializeLayout()
1265 // Update based on external alignment. in InitializeLayout()
1268 Alignment = Context.toCharUnitsFromBits(External.Align); in InitializeLayout()
1270 // The external source didn't have alignment information; infer it. in InitializeLayout()
1281 // Finally, round the size of the total struct up to the alignment of the in Layout()
1297 NonVirtualAlignment = Alignment; in Layout()
1302 // Finally, round the size of the total struct up to the alignment in Layout()
1344 // Finally, round the size of the total struct up to the alignment of the in Layout()
1350 // Layout each field, for now, just sequentially, respecting alignment. In in LayoutFields()
1433 // Remember max struct/class alignment. in LayoutWideBitField()
1479 // does not change the alignment of the struct itself, but it does in LayoutBitField()
1484 // A field alignment restriction (e.g. from #pragma pack) or in LayoutBitField()
1486 // formal alignment of the field. For System V, this alters the in LayoutBitField()
1487 // required alignment of the notional storage unit that must contain in LayoutBitField()
1496 // In an ms_struct struct, the alignment of a fundamental type is in LayoutBitField()
1498 // the i386 alignment rules on targets which might not fully align in LayoutBitField()
1503 // The field alignment for integer types is always the size. in LayoutBitField()
1530 // Handle targets that don't honor bitfield type alignment. in LayoutBitField()
1535 // The alignment to round up to is the max of the field's natural in LayoutBitField()
1536 // alignment and a target-specific fixed value (sometimes zero). in LayoutBitField()
1541 // If that doesn't apply, just ignore the field alignment. in LayoutBitField()
1547 // Remember the alignment we would have used if the field were not packed. in LayoutBitField()
1550 // Ignore the field alignment if the field is packed unless it has zero-size. in LayoutBitField()
1569 // alignment attributes. in LayoutBitField()
1576 // adding any alignment padding or if the field weren't packed. in LayoutBitField()
1581 // allocation unit with the right size and alignment. The rules are in LayoutBitField()
1587 // other consideration. Otherwise, round up to the right alignment. in LayoutBitField()
1624 // Anonymous members don't affect the overall record alignment, in LayoutBitField()
1667 // including padding up to char alignment, and then remember how in LayoutBitField()
1684 // Remember max struct/class alignment. in LayoutBitField()
1733 // alignment if necessary. in LayoutField()
1755 // The maximum field alignment overrides the aligned attribute. in LayoutField()
1761 // Round up the current record size to the field's alignment boundary. in LayoutField()
1813 // Remember max struct/class alignment. in LayoutField()
1831 // Finally, round the size of the record up to the alignment of the in FinishLayout()
1839 = llvm::RoundUpToAlignment(getSizeInBits(), Context.toBits(Alignment)); in FinishLayout()
1842 // If we're inferring alignment, and the external size is smaller than in FinishLayout()
1843 // our size after we've rounded up to alignment, conservatively set the in FinishLayout()
1844 // alignment to 1. in FinishLayout()
1846 Alignment = CharUnits::One(); in FinishLayout()
1872 // Warn if we packed it unnecessarily. If the alignment is 1 byte don't in FinishLayout()
1873 // bother since there won't be alignment issues. in FinishLayout()
1883 // The alignment is not modified when using 'mac68k' alignment or when in UpdateAlignment()
1884 // we have an externally-supplied layout that also provides overall alignment. in UpdateAlignment()
1888 if (NewAlignment > Alignment) { in UpdateAlignment()
1890 "Alignment not a power of 2"); in UpdateAlignment()
1891 Alignment = NewAlignment; in UpdateAlignment()
1896 "Alignment not a power of 2"); in UpdateAlignment()
1909 Alignment = CharUnits::One(); in updateExternalFieldOffset()
1969 // Warn if we packed it unnecessarily. If the alignment is 1 byte don't in CheckFieldPadding()
1970 // bother since there won't be alignment issues. in CheckFieldPadding()
2112 // * The alignment of bitfields in unions is ignored when computing the
2113 // alignment of the union.
2129 // * vtordisps are allocated in a block of memory with size and alignment equal
2130 // to the alignment of the completed structure (before applying __declspec(
2134 // order to guarantee proper alignment of all fields, the vfptr injection
2135 // pushes all bases and fields back by the alignment imposed by those bases
2139 // order to guarantee proper alignment of all fields, the vfptr injection
2140 // pushes all bases and fields back by the alignment imposed by those bases
2159 // bases is 1 byte. The padding added between vbases depends on the alignment
2161 // * There is no concept of non-virtual alignment, non-virtual alignment and
2162 // alignment are always identical.
2163 // * There is a distinction between alignment and required alignment.
2164 // __declspec(align) changes the required alignment of a struct. This
2165 // alignment is _always_ obeyed, even in the presence of #pragma pack. A
2166 // record inherits required alignment from all of its fields and bases.
2168 // alignment instead of its required alignment. This is the only known way
2169 // to make the alignment of a struct bigger than 8. Interestingly enough
2170 // this alignment is also immune to the effects of #pragma pack and can be
2171 // used to create structures with large alignment under #pragma pack.
2172 // However, because it does not impact required alignment, such a structure,
2184 // * 2012 and back: In 64-bit mode, if the alignment of a record is 16 or
2201 CharUnits Alignment; member
2211 /// \brief Initializes size and alignment and honors some flags.
2213 /// \brief Initialized C++ layout, compute alignment and virtual alignment and
2214 /// existence of vfptrs and vbptrs. Alignment is needed before the vfptr is
2224 /// alignment.
2233 /// \brief Gets the size and alignment of a base taking pragma pack and
2236 /// \brief Gets the size and alignment of a field taking pragma pack and
2259 /// \brief The current alignment of the record layout.
2260 CharUnits Alignment; member
2261 /// \brief The maximum allowed field alignment. This is set by #pragma pack.
2263 /// \brief The alignment that this record must obey. This is imposed by
2274 /// \brief The size and alignment info of a pointer.
2319 Info.Alignment = Layout.getAlignment(); in getAdjustedElementInfo()
2322 Info.Alignment = std::min(Info.Alignment, MaxFieldAlignment); in getAdjustedElementInfo()
2325 // Respect required alignment, this is necessary because we may have adjusted in getAdjustedElementInfo()
2326 // the alignment in the case of pragam pack. Note that the required alignment in getAdjustedElementInfo()
2327 // doesn't actually apply to the struct alignment at this point. in getAdjustedElementInfo()
2328 Alignment = std::max(Alignment, Info.Alignment); in getAdjustedElementInfo()
2330 Info.Alignment = std::max(Info.Alignment, Layout.getRequiredAlignment()); in getAdjustedElementInfo()
2338 // Get the alignment of the field type's natural alignment, ignore any in getAdjustedElementInfo()
2339 // alignment attributes. in getAdjustedElementInfo()
2341 std::tie(Info.Size, Info.Alignment) = in getAdjustedElementInfo()
2352 // For some reason __declspec align impacts alignment rather than required in getAdjustedElementInfo()
2353 // alignment when it is applied to bitfields. in getAdjustedElementInfo()
2354 Info.Alignment = std::max(Info.Alignment, FieldRequiredAlignment); in getAdjustedElementInfo()
2363 // Capture required alignment as a side-effect. in getAdjustedElementInfo()
2368 Info.Alignment = std::min(Info.Alignment, MaxFieldAlignment); in getAdjustedElementInfo()
2370 Info.Alignment = CharUnits::One(); in getAdjustedElementInfo()
2371 Info.Alignment = std::max(Info.Alignment, FieldRequiredAlignment); in getAdjustedElementInfo()
2380 DataSize = Size = Size.RoundUpToAlignment(Alignment); in layout()
2396 Alignment = std::max(Alignment, PointerInfo.Alignment); in cxxLayout()
2397 auto RoundingAlignment = Alignment; in cxxLayout()
2410 Alignment = CharUnits::One(); in initializeLayout()
2411 // In 64-bit mode we always perform an alignment step after laying out vbases. in initializeLayout()
2412 // In 32-bit mode we do not. The check to see if we need to perform alignment in initializeLayout()
2413 // checks the RequiredAlignment field and performs alignment if it isn't 0. in initializeLayout()
2417 // Compute the maximum field alignment. in initializeLayout()
2419 // Honor the default struct packing maximum alignment flag. in initializeLayout()
2429 // Packed attribute forces max field alignment to be 1. in initializeLayout()
2449 // Calculate pointer size and alignment. These are used for vfptr and vbprt in initializeCXXLayout()
2453 PointerInfo.Alignment = in initializeCXXLayout()
2457 PointerInfo.Alignment = std::min(PointerInfo.Alignment, MaxFieldAlignment); in initializeCXXLayout()
2466 // information about the bases, such as reqruied alignment and the presence of in layoutNonVirtualBases()
2555 BaseOffset = Size.RoundUpToAlignment(Info.Alignment); in layoutNonVirtualBase()
2574 Alignment = std::max(Alignment, Info.Alignment); in layoutField()
2585 FieldOffset = Size.RoundUpToAlignment(Info.Alignment); in layoutField()
2617 // TODO: Add a Sema warning that MS ignores bitfield alignment in unions. in layoutBitField()
2620 CharUnits FieldOffset = Size.RoundUpToAlignment(Info.Alignment); in layoutBitField()
2623 Alignment = std::max(Alignment, Info.Alignment); in layoutBitField()
2634 // TODO: Add a Sema warning that MS ignores alignment for zero in layoutZeroWidthBitField()
2643 // TODO: Add a Sema warning that MS ignores bitfield alignment in unions. in layoutZeroWidthBitField()
2645 // Round up the current record size to the field's alignment boundary. in layoutZeroWidthBitField()
2646 CharUnits FieldOffset = Size.RoundUpToAlignment(Info.Alignment); in layoutZeroWidthBitField()
2649 Alignment = std::max(Alignment, Info.Alignment); in layoutZeroWidthBitField()
2659 VBPtrOffset = VBPtrOffset.RoundUpToAlignment(PointerInfo.Alignment); in injectVBPtr()
2667 // alignment. in injectVBPtr()
2669 std::max(RequiredAlignment, Alignment)); in injectVBPtr()
2682 // alignment. in injectVFPtr()
2684 std::max(RequiredAlignment, Alignment)); in injectVFPtr()
2712 // The alignment of the vtordisp is at least the required alignment of the in layoutVirtualBases()
2735 // the required alignment, we don't know why. in layoutVirtualBases()
2739 Alignment = std::max(VtorDispAlignment, Alignment); in layoutVirtualBases()
2753 BaseOffset = Size.RoundUpToAlignment(Info.Alignment); in layoutVirtualBases()
2763 // Respect required alignment. Note that in 32-bit mode Required alignment in finalizeLayout()
2767 Alignment = std::max(Alignment, RequiredAlignment); in finalizeLayout()
2768 auto RoundingAlignment = Alignment; in finalizeLayout()
2777 // Zero-sized structures have size equal to their alignment if a in finalizeLayout()
2780 Size = Alignment; in finalizeLayout()
2788 Alignment = Context.toCharUnitsFromBits(External.Align); in finalizeLayout()
2907 *this, Builder.Size, Builder.Alignment, Builder.RequiredAlignment, in getASTRecordLayout()
2911 Builder.NonVirtualSize, Builder.Alignment, CharUnits::Zero(), in getASTRecordLayout()
2918 *this, Builder.Size, Builder.Alignment, Builder.RequiredAlignment, in getASTRecordLayout()
2940 *this, Builder.getSize(), Builder.Alignment, in getASTRecordLayout()
2942 Builder.Alignment, Builder.HasOwnVFPtr, RD->isDynamicClass(), in getASTRecordLayout()
2954 *this, Builder.getSize(), Builder.Alignment, in getASTRecordLayout()
2956 Builder.Alignment, Builder.getSize(), Builder.FieldOffsets.data(), in getASTRecordLayout()
3073 Builder.Alignment, in getObjCLayout()
3075 Builder.Alignment, in getObjCLayout()
3275 OS << " Alignment:" << toBits(Info.getAlignment()) << "\n"; in DumpRecordLayout()