MLIR 22.0.0git
mlir::AsmResourceBlob Class Reference

This class represents a processed binary blob of data. More...

#include "mlir/IR/AsmState.h"

Public Types

using DeleterFn
 A deleter function that frees a blob given the data, allocation size, and allocation aligment.

Public Member Functions

 AsmResourceBlob ()=default
 AsmResourceBlob (ArrayRef< char > data, size_t dataAlignment, DeleterFn deleter, bool dataIsMutable)
template<typename T, typename DelT>
 AsmResourceBlob (ArrayRef< T > data, DelT &&deleteFn, bool dataIsMutable)
 Utility constructor that initializes a blob with a non-char type T.
 AsmResourceBlob (AsmResourceBlob &&)=default
AsmResourceBloboperator= (AsmResourceBlob &&rhs)
 AsmResourceBlob (const AsmResourceBlob &)=delete
AsmResourceBloboperator= (const AsmResourceBlob &)=delete
 ~AsmResourceBlob ()
size_t getDataAlignment () const
 Return the alignment of the underlying data.
ArrayRef< char > getData () const
 Return the raw underlying data of this blob.
template<typename T>
ArrayRef< T > getDataAs () const
 Return the underlying data as an array of the given type.
MutableArrayRef< char > getMutableData ()
 Return a mutable reference to the raw underlying data of this blob.
bool isMutable () const
 Return if the data of this blob is mutable.
DeleterFngetDeleter ()
 Return the deleter function of this blob.
const DeleterFngetDeleter () const

Friends

class HeapAsmResourceBlob

Detailed Description

This class represents a processed binary blob of data.

A resource blob is essentially a collection of data, potentially mutable, with an associated deleter function (used if the data needs to be destroyed).

Definition at line 91 of file AsmState.h.

Member Typedef Documentation

◆ DeleterFn

Initial value:
llvm::unique_function<void(void *data, size_t size, size_t align)>

A deleter function that frees a blob given the data, allocation size, and allocation aligment.

Definition at line 95 of file AsmState.h.

Constructor & Destructor Documentation

◆ AsmResourceBlob() [1/5]

mlir::AsmResourceBlob::AsmResourceBlob ( )
default

◆ AsmResourceBlob() [2/5]

mlir::AsmResourceBlob::AsmResourceBlob ( ArrayRef< char > data,
size_t dataAlignment,
DeleterFn deleter,
bool dataIsMutable )
inline

Definition at line 103 of file AsmState.h.

◆ AsmResourceBlob() [3/5]

template<typename T, typename DelT>
mlir::AsmResourceBlob::AsmResourceBlob ( ArrayRef< T > data,
DelT && deleteFn,
bool dataIsMutable )
inline

Utility constructor that initializes a blob with a non-char type T.

Definition at line 109 of file AsmState.h.

◆ AsmResourceBlob() [4/5]

mlir::AsmResourceBlob::AsmResourceBlob ( AsmResourceBlob && )
default

References AsmResourceBlob().

◆ AsmResourceBlob() [5/5]

mlir::AsmResourceBlob::AsmResourceBlob ( const AsmResourceBlob & )
delete

References AsmResourceBlob().

◆ ~AsmResourceBlob()

mlir::AsmResourceBlob::~AsmResourceBlob ( )
inline

Definition at line 132 of file AsmState.h.

Member Function Documentation

◆ getData()

ArrayRef< char > mlir::AsmResourceBlob::getData ( ) const
inline

Return the raw underlying data of this blob.

Definition at line 145 of file AsmState.h.

Referenced by mlir::AsmResourceBuilder::buildBlob(), convertDenseResourceElementsAttr(), and mlir::detail::DenseResourceElementsAttrBase< T >::get().

◆ getDataAlignment()

size_t mlir::AsmResourceBlob::getDataAlignment ( ) const
inline

Return the alignment of the underlying data.

Definition at line 142 of file AsmState.h.

Referenced by mlir::AsmResourceBuilder::buildBlob(), and mlir::detail::DenseResourceElementsAttrBase< T >::get().

◆ getDataAs()

template<typename T>
ArrayRef< T > mlir::AsmResourceBlob::getDataAs ( ) const
inline

Return the underlying data as an array of the given type.

This is an inherrently unsafe operation, and should only be used when the data is known to be of the correct type.

Definition at line 151 of file AsmState.h.

◆ getDeleter() [1/2]

DeleterFn & mlir::AsmResourceBlob::getDeleter ( )
inline

Return the deleter function of this blob.

Definition at line 167 of file AsmState.h.

◆ getDeleter() [2/2]

const DeleterFn & mlir::AsmResourceBlob::getDeleter ( ) const
inline

Definition at line 168 of file AsmState.h.

◆ getMutableData()

MutableArrayRef< char > mlir::AsmResourceBlob::getMutableData ( )
inline

Return a mutable reference to the raw underlying data of this blob.

Asserts that the blob isMutable.

Definition at line 157 of file AsmState.h.

References isMutable().

Referenced by mlir::HeapAsmResourceBlob::allocateAndCopyWithAlign().

◆ isMutable()

bool mlir::AsmResourceBlob::isMutable ( ) const
inline

Return if the data of this blob is mutable.

Definition at line 164 of file AsmState.h.

Referenced by getMutableData().

◆ operator=() [1/2]

AsmResourceBlob & mlir::AsmResourceBlob::operator= ( AsmResourceBlob && rhs)
inline

Definition at line 118 of file AsmState.h.

References AsmResourceBlob(), and rhs.

◆ operator=() [2/2]

AsmResourceBlob & mlir::AsmResourceBlob::operator= ( const AsmResourceBlob & )
delete

References AsmResourceBlob().

◆ HeapAsmResourceBlob

Definition at line 184 of file AsmState.h.

References HeapAsmResourceBlob.

Referenced by HeapAsmResourceBlob.


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