MLIR  20.0.0git
Public Types | Public Member Functions | Friends | List of all members
mlir::AsmResourceBlob Class Reference

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

#include "mlir/IR/AsmState.h"

Public Types

using DeleterFn = 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. More...
 

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. More...
 
 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. More...
 
ArrayRef< char > getData () const
 Return the raw underlying data of this blob. More...
 
template<typename T >
ArrayRef< T > getDataAs () const
 Return the underlying data as an array of the given type. More...
 
MutableArrayRef< char > getMutableData ()
 Return a mutable reference to the raw underlying data of this blob. More...
 
bool isMutable () const
 Return if the data of this blob is mutable. More...
 
DeleterFngetDeleter ()
 Return the deleter function of this blob. More...
 
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 90 of file AsmState.h.

Member Typedef Documentation

◆ DeleterFn

using mlir::AsmResourceBlob::DeleterFn = 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 94 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 102 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 108 of file AsmState.h.

◆ AsmResourceBlob() [4/5]

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

◆ AsmResourceBlob() [5/5]

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

◆ ~AsmResourceBlob()

mlir::AsmResourceBlob::~AsmResourceBlob ( )
inline

Definition at line 131 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 144 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 141 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 150 of file AsmState.h.

◆ getDeleter() [1/2]

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

Return the deleter function of this blob.

Definition at line 166 of file AsmState.h.

◆ getDeleter() [2/2]

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

Definition at line 167 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 156 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 163 of file AsmState.h.

Referenced by getMutableData().

◆ operator=() [1/2]

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

Definition at line 117 of file AsmState.h.

◆ operator=() [2/2]

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

Friends And Related Function Documentation

◆ HeapAsmResourceBlob

Definition at line 183 of file AsmState.h.


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