MLIR  19.0.0git
Public Member Functions | Static Public Member Functions | List of all members
mlir::DataLayout Class Reference

The main mechanism for performing data layout queries. More...

#include "mlir/Interfaces/DataLayoutInterfaces.h"

Public Member Functions

 DataLayout ()
 
 DataLayout (DataLayoutOpInterface op)
 
 DataLayout (ModuleOp op)
 
llvm::TypeSize getTypeSize (Type t) const
 Returns the size of the given type in the current scope. More...
 
llvm::TypeSize getTypeSizeInBits (Type t) const
 Returns the size in bits of the given type in the current scope. More...
 
uint64_t getTypeABIAlignment (Type t) const
 Returns the required alignment of the given type in the current scope. More...
 
uint64_t getTypePreferredAlignment (Type t) const
 Returns the preferred of the given type in the current scope. More...
 
std::optional< uint64_t > getTypeIndexBitwidth (Type t) const
 Returns the bitwidth that should be used when performing index computations for the given pointer-like type in the current scope. More...
 
Attribute getEndianness () const
 Returns the specified endianness. More...
 
Attribute getAllocaMemorySpace () const
 Returns the memory space used for AllocaOps. More...
 
Attribute getProgramMemorySpace () const
 Returns the memory space used for program memory operations. More...
 
Attribute getGlobalMemorySpace () const
 Returns the memory space used for global operations. More...
 
uint64_t getStackAlignment () const
 Returns the natural alignment of the stack in bits. More...
 

Static Public Member Functions

static DataLayout closest (Operation *op)
 Returns the layout of the closest parent operation carrying layout info. More...
 

Detailed Description

The main mechanism for performing data layout queries.

Instances of this class can be created for an operation implementing DataLayoutOpInterface. Upon construction, a layout spec combining that of the given operation with all its ancestors will be computed and used to handle further requests. For efficiency, results to all requests will be cached in this object. Therefore, if the data layout spec for the scoping operation, or any of the enclosing operations, changes, the cache is no longer valid. The user is responsible creating a new DataLayout object after any spec change. In debug mode, the cache validity is being checked in every request.

Definition at line 173 of file DataLayoutInterfaces.h.

Constructor & Destructor Documentation

◆ DataLayout() [1/3]

mlir::DataLayout::DataLayout ( )
explicit

Definition at line 433 of file DataLayoutInterfaces.cpp.

◆ DataLayout() [2/3]

mlir::DataLayout::DataLayout ( DataLayoutOpInterface  op)
explicit

Definition at line 435 of file DataLayoutInterfaces.cpp.

◆ DataLayout() [3/3]

mlir::DataLayout::DataLayout ( ModuleOp  op)
explicit

Definition at line 445 of file DataLayoutInterfaces.cpp.

Member Function Documentation

◆ closest()

mlir::DataLayout mlir::DataLayout::closest ( Operation op)
static

Returns the layout of the closest parent operation carrying layout info.

Definition at line 455 of file DataLayoutInterfaces.cpp.

Referenced by defaultIsSmallAlloc(), handleByValArgument(), mlir::LLVM::CanonicalizeAlignedGep::matchAndRewrite(), and mlir::LLVM::SplitStores::matchAndRewrite().

◆ getAllocaMemorySpace()

mlir::Attribute mlir::DataLayout::getAllocaMemorySpace ( ) const

Returns the memory space used for AllocaOps.

Definition at line 579 of file DataLayoutInterfaces.cpp.

References mlir::detail::getDefaultAllocaMemorySpace().

◆ getEndianness()

mlir::Attribute mlir::DataLayout::getEndianness ( ) const

Returns the specified endianness.

Definition at line 563 of file DataLayoutInterfaces.cpp.

References mlir::detail::getDefaultEndianness().

Referenced by isBigEndian().

◆ getGlobalMemorySpace()

mlir::Attribute mlir::DataLayout::getGlobalMemorySpace ( ) const

Returns the memory space used for global operations.

Definition at line 611 of file DataLayoutInterfaces.cpp.

References mlir::detail::getDefaultGlobalMemorySpace().

◆ getProgramMemorySpace()

mlir::Attribute mlir::DataLayout::getProgramMemorySpace ( ) const

Returns the memory space used for program memory operations.

Definition at line 595 of file DataLayoutInterfaces.cpp.

References mlir::detail::getDefaultProgramMemorySpace().

◆ getStackAlignment()

uint64_t mlir::DataLayout::getStackAlignment ( ) const

Returns the natural alignment of the stack in bits.

Alignment promotion of stack variables should be limited to the natural stack alignment to prevent dynamic stack alignment. Returns zero if the stack alignment is unspecified.

Definition at line 627 of file DataLayoutInterfaces.cpp.

References mlir::detail::getDefaultStackAlignment().

Referenced by tryToEnforceAllocaAlignment().

◆ getTypeABIAlignment()

uint64_t mlir::DataLayout::getTypeABIAlignment ( Type  t) const

◆ getTypeIndexBitwidth()

std::optional< uint64_t > mlir::DataLayout::getTypeIndexBitwidth ( Type  t) const

Returns the bitwidth that should be used when performing index computations for the given pointer-like type in the current scope.

If the type is not a pointer-like type, it returns std::nullopt.

Definition at line 551 of file DataLayoutInterfaces.cpp.

References mlir::detail::getDefaultIndexBitwidth().

Referenced by translateDataLayout().

◆ getTypePreferredAlignment()

uint64_t mlir::DataLayout::getTypePreferredAlignment ( Type  t) const

Returns the preferred of the given type in the current scope.

Definition at line 539 of file DataLayoutInterfaces.cpp.

References mlir::detail::getDefaultPreferredAlignment(), and mlir::Type::getTypeID().

Referenced by mlir::detail::getDefaultPreferredAlignment(), and translateDataLayout().

◆ getTypeSize()

llvm::TypeSize mlir::DataLayout::getTypeSize ( Type  t) const

◆ getTypeSizeInBits()

llvm::TypeSize mlir::DataLayout::getTypeSizeInBits ( Type  t) const

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