MLIR
18.0.0git
|
The following classes enable support for parsing and printing resources within MLIR assembly formats. 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 | |
AsmResourceBlob & | operator= (AsmResourceBlob &&rhs) |
AsmResourceBlob (const AsmResourceBlob &)=delete | |
AsmResourceBlob & | operator= (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... | |
DeleterFn & | getDeleter () |
Return the deleter function of this blob. More... | |
const DeleterFn & | getDeleter () const |
The following classes enable support for parsing and printing resources within MLIR assembly formats.
Resources are a mechanism by which dialects, and external clients, may attach additional information when parsing or printing IR without that information being encoded in the IR itself. Resources are not uniqued within the MLIR context, are not attached directly to any operation, and are solely intended to live and be processed outside of the immediate IR.
Resources are encoded using a key-value pair nested within dictionaries anchored either on a dialect, or an externally registered entity. Dictionaries anchored on dialects use the dialect namespace directly, and dictionaries anchored on external entities use a provided unique identifier. The resource key is an identifier used to disambiguate the data. The resource value may be stored in various limited forms, but general encodings use a string (human readable) or blob format (binary). Within the textual format, an example may be of the form:
{-# // The dialect_resources
section within the file-level metadata // dictionary is used to contain any dialect resource entries. dialect_resources: { // Here is a dictionary anchored on "foo_dialect", which is a dialect // namespace. foo_dialect: { // some_dialect_resource
is a key to be interpreted by the dialect, // and used to initialize/configure/etc. some_dialect_resource: "Some important resource value" } }, // The external_resources
section within the file-level metadata // dictionary is used to contain any non-dialect resource entries. external_resources: { // Here is a dictionary anchored on "mlir_reproducer", which is an // external entity representing MLIR's crash reproducer functionality. mlir_reproducer: { // pipeline
is an entry that holds a crash reproducer pipeline // resource. pipeline: "func.func(canonicalize,cse)" } } #-} 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 88 of file AsmState.h.
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 92 of file AsmState.h.
|
default |
|
inline |
Definition at line 100 of file AsmState.h.
|
inline |
Utility constructor that initializes a blob with a non-char type T.
Definition at line 106 of file AsmState.h.
|
default |
|
delete |
|
inline |
Definition at line 129 of file AsmState.h.
|
inline |
Return the raw underlying data of this blob.
Definition at line 142 of file AsmState.h.
Referenced by mlir::AsmResourceBuilder::buildBlob(), and mlir::detail::DenseResourceElementsAttrBase< T >::get().
|
inline |
Return the alignment of the underlying data.
Definition at line 139 of file AsmState.h.
Referenced by mlir::AsmResourceBuilder::buildBlob(), and mlir::detail::DenseResourceElementsAttrBase< T >::get().
|
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 148 of file AsmState.h.
|
inline |
Return the deleter function of this blob.
Definition at line 164 of file AsmState.h.
|
inline |
Definition at line 165 of file AsmState.h.
|
inline |
Return a mutable reference to the raw underlying data of this blob.
Asserts that the blob isMutable
.
Definition at line 154 of file AsmState.h.
References isMutable().
Referenced by mlir::HeapAsmResourceBlob::allocateAndCopyWithAlign().
|
inline |
Return if the data of this blob is mutable.
Definition at line 161 of file AsmState.h.
Referenced by getMutableData().
|
inline |
Definition at line 115 of file AsmState.h.
|
delete |