LLVM 20.0.0git
Public Member Functions | Friends | List of all members
llvm::StructLayout Class Referencefinal

Used to lazily calculate structure layout information for a target machine, based on the DataLayout structure. More...

#include "llvm/IR/DataLayout.h"

Inheritance diagram for llvm::StructLayout:
Inheritance graph
[legend]

Public Member Functions

TypeSize getSizeInBytes () const
 
TypeSize getSizeInBits () const
 
Align getAlignment () const
 
bool hasPadding () const
 Returns whether the struct has padding or not between its fields.
 
unsigned getElementContainingOffset (uint64_t FixedOffset) const
 Given a valid byte offset into the structure, returns the structure index that contains it.
 
MutableArrayRef< TypeSizegetMemberOffsets ()
 
ArrayRef< TypeSizegetMemberOffsets () const
 
TypeSize getElementOffset (unsigned Idx) const
 
TypeSize getElementOffsetInBits (unsigned Idx) const
 
- Public Member Functions inherited from llvm::TrailingObjects< StructLayout, TypeSize >
const TgetTrailingObjects () const
 Returns a pointer to the trailing object array of the given type (which must be one of those specified in the class template).
 
TgetTrailingObjects ()
 Returns a pointer to the trailing object array of the given type (which must be one of those specified in the class template).
 
 TrailingObjects ()=default
 
 TrailingObjects (const TrailingObjects &)=delete
 
 TrailingObjects (TrailingObjects &&)=delete
 
TrailingObjectsoperator= (const TrailingObjects &)=delete
 
TrailingObjectsoperator= (TrailingObjects &&)=delete
 

Friends

class DataLayout
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::TrailingObjects< StructLayout, TypeSize >
static constexpr std::enable_if_t< std::is_same_v< Foo< TrailingTys... >, Foo< Tys... > >, size_t > additionalSizeToAlloc (typename trailing_objects_internal::ExtractSecondType< TrailingTys, size_t >::type... Counts)
 Returns the size of the trailing data, if an object were allocated with the given counts (The counts are in the same order as the template arguments).
 
static constexpr std::enable_if_t< std::is_same_v< Foo< TrailingTys... >, Foo< Tys... > >, size_t > totalSizeToAlloc (typename trailing_objects_internal::ExtractSecondType< TrailingTys, size_t >::type... Counts)
 Returns the total size of an object if it were allocated with the given trailing object counts.
 

Detailed Description

Used to lazily calculate structure layout information for a target machine, based on the DataLayout structure.

Definition at line 572 of file DataLayout.h.

Member Function Documentation

◆ getAlignment()

Align llvm::StructLayout::getAlignment ( ) const
inline

Definition at line 583 of file DataLayout.h.

◆ getElementContainingOffset()

unsigned StructLayout::getElementContainingOffset ( uint64_t  FixedOffset) const

◆ getElementOffset()

TypeSize llvm::StructLayout::getElementOffset ( unsigned  Idx) const
inline

◆ getElementOffsetInBits()

TypeSize llvm::StructLayout::getElementOffsetInBits ( unsigned  Idx) const
inline

Definition at line 606 of file DataLayout.h.

References getElementOffset(), and Idx.

Referenced by isDenselyPacked(), and solveDIType().

◆ getMemberOffsets() [1/2]

MutableArrayRef< TypeSize > llvm::StructLayout::getMemberOffsets ( )
inline

Definition at line 593 of file DataLayout.h.

Referenced by getElementContainingOffset(), getElementOffset(), and splitGlobal().

◆ getMemberOffsets() [2/2]

ArrayRef< TypeSize > llvm::StructLayout::getMemberOffsets ( ) const
inline

Definition at line 597 of file DataLayout.h.

◆ getSizeInBits()

TypeSize llvm::StructLayout::getSizeInBits ( ) const
inline

◆ getSizeInBytes()

TypeSize llvm::StructLayout::getSizeInBytes ( ) const
inline

◆ hasPadding()

bool llvm::StructLayout::hasPadding ( ) const
inline

Returns whether the struct has padding or not between its fields.

NB: Padding in nested element is not taken into account.

Definition at line 587 of file DataLayout.h.

Friends And Related Function Documentation

◆ DataLayout

friend class DataLayout
friend

Definition at line 611 of file DataLayout.h.


The documentation for this class was generated from the following files: