LLVM  14.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]
Collaboration diagram for llvm::StructLayout:
Collaboration graph
[legend]

Public Member Functions

uint64_t getSizeInBytes () const
 
uint64_t getSizeInBits () const
 
Align getAlignment () const
 
bool hasPadding () const
 Returns whether the struct has padding or not between its fields. More...
 
unsigned getElementContainingOffset (uint64_t Offset) const
 Given a valid byte offset into the structure, returns the structure index that contains it. More...
 
MutableArrayRef< uint64_tgetMemberOffsets ()
 
ArrayRef< uint64_tgetMemberOffsets () const
 
uint64_t getElementOffset (unsigned Idx) const
 
uint64_t getElementOffsetInBits (unsigned Idx) const
 
- Public Member Functions inherited from llvm::TrailingObjects< StructLayout, uint64_t >
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). More...
 
TgetTrailingObjects ()
 Returns a pointer to the trailing object array of the given type (which must be one of those specified in the class template). More...
 
 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, uint64_t >
static constexpr std::enable_if_t< std::is_same< Foo< TrailingTys... >, Foo< Tys... > >::value, size_tadditionalSizeToAlloc (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). More...
 
static constexpr std::enable_if_t< std::is_same< Foo< TrailingTys... >, Foo< Tys... > >::value, size_ttotalSizeToAlloc (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. More...
 

Detailed Description

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

Definition at line 604 of file DataLayout.h.

Member Function Documentation

◆ getAlignment()

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

Definition at line 615 of file DataLayout.h.

◆ getElementContainingOffset()

unsigned StructLayout::getElementContainingOffset ( uint64_t  Offset) const

Given a valid byte offset into the structure, returns the structure index that contains it.

getElementContainingOffset - Given a valid offset into the structure, return the structure index that contains it.

Definition at line 82 of file DataLayout.cpp.

References assert(), llvm::ArrayRef< T >::begin(), llvm::ArrayRef< T >::end(), getMemberOffsets(), Offset, SI, and llvm::upper_bound().

Referenced by constructPointer(), findFuncPointers(), getNaturalGEPRecursively(), llvm::getPointerAtOffset(), getTypePartition(), and stripAggregateTypeWrapping().

◆ getElementOffset()

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

◆ getElementOffsetInBits()

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

◆ getMemberOffsets() [1/2]

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

Definition at line 625 of file DataLayout.h.

References llvm::makeMutableArrayRef().

Referenced by getElementContainingOffset(), and getElementOffset().

◆ getMemberOffsets() [2/2]

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

Definition at line 630 of file DataLayout.h.

References llvm::makeArrayRef().

◆ getSizeInBits()

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

Definition at line 613 of file DataLayout.h.

◆ getSizeInBytes()

uint64_t 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 619 of file DataLayout.h.

Friends And Related Function Documentation

◆ DataLayout

friend class DataLayout
friend

Definition at line 644 of file DataLayout.h.


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