clang 24.0.0git
cir::CIRDataLayout Class Reference

#include "clang/CIR/Dialect/IR/CIRDataLayout.h"

Public Member Functions

 CIRDataLayout (mlir::ModuleOp modOp)
 Constructs a DataLayout the module's data layout attribute.
void reset (mlir::DataLayoutSpecInterface spec)
 Parse a data layout string (with fallback to default values).
bool isBigEndian () const
unsigned getProgramAddressSpace () const
llvm::Align getAlignment (mlir::Type ty, bool useABIAlign) const
 Internal helper method that returns requested alignment for type.
llvm::Align getABITypeAlign (mlir::Type ty) const
uint64_t getTypeLanguageAlignment (mlir::Type ty) const
 Returns the alignment, in bytes, that the source language requires for an object of type ty.
llvm::TypeSize getTypeStoreSize (mlir::Type ty) const
 Returns the maximum number of bytes that may be overwritten by storing the specified type.
llvm::TypeSize getTypeStoreSizeInBits (mlir::Type ty) const
 Returns the maximum number of bits that may be overwritten by storing the specified type; always a multiple of 8.
llvm::TypeSize getTypeAllocSize (mlir::Type ty) const
 Returns the offset in bytes between successive objects of the specified type, including alignment padding.
llvm::TypeSize getTypeAllocSizeInBits (mlir::Type ty) const
 Returns the offset in bits between successive objects of the specified type, including alignment padding; always a multiple of 8.
llvm::TypeSize getTypeSizeInBits (mlir::Type ty) const
llvm::TypeSize getPointerTypeSizeInBits (mlir::Type ty) const
mlir::Type getIntPtrType (mlir::Type ty) const
bool typeSizeEqualsStoreSize (mlir::Type ty) const
 Returns true if no extra padding bits are needed when storing the specified type.
mlir::ptr::MemorySpaceAttrInterface getAllocaAddrSpace (mlir::MLIRContext *ctx)
mlir::ptr::MemorySpaceAttrInterface getDefaultGlobalsAddrSpace (mlir::MLIRContext *ctx) const

Public Attributes

mlir::DataLayout layout

Detailed Description

Definition at line 23 of file CIRDataLayout.h.

Constructor & Destructor Documentation

◆ CIRDataLayout()

CIRDataLayout::CIRDataLayout ( mlir::ModuleOp modOp)

Constructs a DataLayout the module's data layout attribute.

Definition at line 13 of file CIRDataLayout.cpp.

References layout, and reset().

Member Function Documentation

◆ getABITypeAlign()

llvm::Align cir::CIRDataLayout::getABITypeAlign ( mlir::Type ty) const
inline

◆ getAlignment()

llvm::Align CIRDataLayout::getAlignment ( mlir::Type ty,
bool useABIAlign ) const

Internal helper method that returns requested alignment for type.

Definition at line 43 of file CIRDataLayout.cpp.

References cir::MissingFeatures::addressSpace(), and layout.

Referenced by getABITypeAlign().

◆ getAllocaAddrSpace()

mlir::ptr::MemorySpaceAttrInterface cir::CIRDataLayout::getAllocaAddrSpace ( mlir::MLIRContext * ctx)
inline

Definition at line 143 of file CIRDataLayout.h.

References layout.

Referenced by lowerArrayDtorCtorIntoLoop().

◆ getDefaultGlobalsAddrSpace()

mlir::ptr::MemorySpaceAttrInterface cir::CIRDataLayout::getDefaultGlobalsAddrSpace ( mlir::MLIRContext * ctx) const
inline

Definition at line 152 of file CIRDataLayout.h.

References layout.

Referenced by emitUsed().

◆ getIntPtrType()

mlir::Type cir::CIRDataLayout::getIntPtrType ( mlir::Type ty) const
inline

Definition at line 128 of file CIRDataLayout.h.

References getPointerTypeSizeInBits().

◆ getPointerTypeSizeInBits()

llvm::TypeSize cir::CIRDataLayout::getPointerTypeSizeInBits ( mlir::Type ty) const
inline

Definition at line 122 of file CIRDataLayout.h.

References layout.

Referenced by getIntPtrType().

◆ getProgramAddressSpace()

unsigned cir::CIRDataLayout::getProgramAddressSpace ( ) const
inline

Definition at line 52 of file CIRDataLayout.h.

Referenced by cir::direct::buildCtorDtorList().

◆ getTypeAllocSize()

llvm::TypeSize cir::CIRDataLayout::getTypeAllocSize ( mlir::Type ty) const
inline

Returns the offset in bytes between successive objects of the specified type, including alignment padding.

If Ty is a scalable vector type, the scalable property will be set and the runtime size will be a positive integer multiple of the base size.

This is the amount that alloca reserves for this type. For example, returns 12 or 16 for x86_fp80, depending on alignment.

Definition at line 103 of file CIRDataLayout.h.

References getABITypeAlign(), and getTypeStoreSize().

Referenced by clang::CIRGen::CIRGenBuilderTy::computeGlobalViewIndicesFromFlatOffset(), clang::CIRGen::CIRGenBuilderTy::computeOffsetFromGlobalViewIndices(), emitStoresForConstant(), and getTypeAllocSizeInBits().

◆ getTypeAllocSizeInBits()

llvm::TypeSize cir::CIRDataLayout::getTypeAllocSizeInBits ( mlir::Type ty) const
inline

Returns the offset in bits between successive objects of the specified type, including alignment padding; always a multiple of 8.

If Ty is a scalable vector type, the scalable property will be set and the runtime size will be a positive integer multiple of the base size.

This is the amount that alloca reserves for this type. For example, returns 96 or 128 for x86_fp80, depending on alignment.

Definition at line 116 of file CIRDataLayout.h.

References getTypeAllocSize().

◆ getTypeLanguageAlignment()

uint64_t CIRDataLayout::getTypeLanguageAlignment ( mlir::Type ty) const

Returns the alignment, in bytes, that the source language requires for an object of type ty.

ABI classification, coercion temporaries, and accesses with no explicit alignment use it. The ABI alignment of ty is the alignment of the memory representation ty lowers to, which record layout and array strides use.

Definition at line 54 of file CIRDataLayout.cpp.

References cir::RecordType::getMembers(), cir::RecordType::getName(), cir::RecordType::getPacked(), getTypeLanguageAlignment(), cir::RecordType::isComplete(), layout, and cir::tryGetRecordLayout().

Referenced by cir::direct::getMemoryFallbackAlignment(), getTypeLanguageAlignment(), mapCIRType(), and recordUnadjustedAlign().

◆ getTypeSizeInBits()

◆ getTypeStoreSize()

llvm::TypeSize cir::CIRDataLayout::getTypeStoreSize ( mlir::Type ty) const
inline

Returns the maximum number of bytes that may be overwritten by storing the specified type.

If Ty is a scalable vector type, the scalable property will be set and the runtime size will be a positive integer multiple of the base size.

For example, returns 5 for i36 and 10 for x86_fp80.

Definition at line 75 of file CIRDataLayout.h.

References getTypeSizeInBits().

Referenced by emitAtomicCmpXchg(), getTypeAllocSize(), and isFullSizeType().

◆ getTypeStoreSizeInBits()

llvm::TypeSize cir::CIRDataLayout::getTypeStoreSizeInBits ( mlir::Type ty) const
inline

Returns the maximum number of bits that may be overwritten by storing the specified type; always a multiple of 8.

If Ty is a scalable vector type, the scalable property will be set and the runtime size will be a positive integer multiple of the base size.

For example, returns 40 for i36 and 80 for x86_fp80.

Definition at line 88 of file CIRDataLayout.h.

References getTypeSizeInBits(), and uint64_t.

Referenced by typeSizeEqualsStoreSize().

◆ isBigEndian()

bool cir::CIRDataLayout::isBigEndian ( ) const
inline

Definition at line 50 of file CIRDataLayout.h.

◆ reset()

void CIRDataLayout::reset ( mlir::DataLayoutSpecInterface spec)

Parse a data layout string (with fallback to default values).

Definition at line 18 of file CIRDataLayout.cpp.

Referenced by CIRDataLayout().

◆ typeSizeEqualsStoreSize()

bool cir::CIRDataLayout::typeSizeEqualsStoreSize ( mlir::Type ty) const
inline

Returns true if no extra padding bits are needed when storing the specified type.

For example, returns false for i19 that has a 24-bit store size.

Definition at line 138 of file CIRDataLayout.h.

References getTypeSizeInBits(), and getTypeStoreSizeInBits().

Referenced by determineNoUndef().

Member Data Documentation

◆ layout


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