MLIR
20.0.0git
|
This class contains the configuration used for the bytecode writer. More...
#include "mlir/Bytecode/BytecodeWriter.h"
Classes | |
struct | Impl |
Public Member Functions | |
BytecodeWriterConfig (StringRef producer="MLIR" LLVM_VERSION_STRING) | |
producer is an optional string that can be used to identify the producer of the bytecode when reading. More... | |
BytecodeWriterConfig (FallbackAsmResourceMap &map, StringRef producer="MLIR" LLVM_VERSION_STRING) | |
map is a fallback resource map, which when provided will attach resource printers for the fallback resources within the map. More... | |
~BytecodeWriterConfig () | |
const Impl & | getImpl () const |
Return an instance of the internal implementation. More... | |
void | setDesiredBytecodeVersion (int64_t bytecodeVersion) |
Set the desired bytecode version to emit. More... | |
int64_t | getDesiredBytecodeVersion () const |
Get the set desired bytecode version to emit. More... | |
llvm::StringMap< std::unique_ptr< DialectVersion > > & | getDialectVersionMap () const |
A map containing the dialect versions to emit. More... | |
template<class T > | |
void | setDialectVersion (std::unique_ptr< DialectVersion > dialectVersion) const |
Set a given dialect version to emit on the map. More... | |
void | setDialectVersion (StringRef dialectName, std::unique_ptr< DialectVersion > dialectVersion) const |
ArrayRef< std::unique_ptr< AttrTypeBytecodeWriter< Attribute > > > | getAttributeWriterCallbacks () const |
Retrieve the callbacks. More... | |
ArrayRef< std::unique_ptr< AttrTypeBytecodeWriter< Type > > > | getTypeWriterCallbacks () const |
void | attachAttributeCallback (std::unique_ptr< AttrTypeBytecodeWriter< Attribute >> callback) |
Attach a custom bytecode printer callback to the configuration for the emission of custom type/attributes encodings. More... | |
void | attachTypeCallback (std::unique_ptr< AttrTypeBytecodeWriter< Type >> callback) |
template<typename CallableT > | |
std::enable_if_t< std::is_convertible_v< CallableT, std::function< LogicalResult(Attribute, std::optional< StringRef > &, DialectBytecodeWriter &)> > > | attachAttributeCallback (CallableT &&emitFn) |
Attach a custom bytecode printer callback to the configuration for the emission of custom type/attributes encodings. More... | |
template<typename CallableT > | |
std::enable_if_t< std::is_convertible_v< CallableT, std::function< LogicalResult(Type, std::optional< StringRef > &, DialectBytecodeWriter &)> > > | attachTypeCallback (CallableT &&emitFn) |
void | setElideResourceDataFlag (bool shouldElideResourceData=true) |
Set a boolean flag to skip emission of resources into the bytecode file. More... | |
void | attachResourcePrinter (std::unique_ptr< AsmResourcePrinter > printer) |
Attach the given resource printer to the writer configuration. More... | |
template<typename CallableT > | |
std::enable_if_t< std::is_convertible< CallableT, function_ref< void(Operation *, AsmResourceBuilder &)> >::value > | attachResourcePrinter (StringRef name, CallableT &&printFn) |
Attach an resource printer, in the form of a callable, to the configuration. More... | |
void | attachFallbackResourcePrinter (FallbackAsmResourceMap &map) |
Attach resource printers to the AsmState for the fallback resources in the given map. More... | |
This class contains the configuration used for the bytecode writer.
It controls various aspects of bytecode generation, and contains all of the various bytecode writer hooks.
Definition at line 75 of file BytecodeWriter.h.
BytecodeWriterConfig::BytecodeWriterConfig | ( | StringRef | producer = "MLIR" LLVM_VERSION_STRING | ) |
producer
is an optional string that can be used to identify the producer of the bytecode when reading.
It has no functional effect on the bytecode serialization.
Definition at line 62 of file BytecodeWriter.cpp.
BytecodeWriterConfig::BytecodeWriterConfig | ( | FallbackAsmResourceMap & | map, |
StringRef | producer = "MLIR" LLVM_VERSION_STRING |
||
) |
map
is a fallback resource map, which when provided will attach resource printers for the fallback resources within the map.
Definition at line 64 of file BytecodeWriter.cpp.
References attachFallbackResourcePrinter().
|
default |
|
inline |
Attach a custom bytecode printer callback to the configuration for the emission of custom type/attributes encodings.
Definition at line 139 of file BytecodeWriter.h.
References attachAttributeCallback().
void BytecodeWriterConfig::attachAttributeCallback | ( | std::unique_ptr< AttrTypeBytecodeWriter< Attribute >> | callback | ) |
Attach a custom bytecode printer callback to the configuration for the emission of custom type/attributes encodings.
Definition at line 81 of file BytecodeWriter.cpp.
Referenced by attachAttributeCallback().
|
inline |
Attach resource printers to the AsmState for the fallback resources in the given map.
Definition at line 174 of file BytecodeWriter.h.
References attachResourcePrinter(), and mlir::FallbackAsmResourceMap::getPrinters().
Referenced by BytecodeWriterConfig().
void BytecodeWriterConfig::attachResourcePrinter | ( | std::unique_ptr< AsmResourcePrinter > | printer | ) |
Attach the given resource printer to the writer configuration.
Definition at line 91 of file BytecodeWriter.cpp.
Referenced by attachFallbackResourcePrinter(), and attachResourcePrinter().
|
inline |
Attach an resource printer, in the form of a callable, to the configuration.
Definition at line 167 of file BytecodeWriter.h.
References attachResourcePrinter(), and mlir::AsmResourcePrinter::fromCallable().
|
inline |
Definition at line 147 of file BytecodeWriter.h.
References attachTypeCallback().
void BytecodeWriterConfig::attachTypeCallback | ( | std::unique_ptr< AttrTypeBytecodeWriter< Type >> | callback | ) |
Definition at line 86 of file BytecodeWriter.cpp.
Referenced by attachTypeCallback().
ArrayRef< std::unique_ptr< AttrTypeBytecodeWriter< Attribute > > > BytecodeWriterConfig::getAttributeWriterCallbacks | ( | ) | const |
Retrieve the callbacks.
Definition at line 72 of file BytecodeWriter.cpp.
int64_t BytecodeWriterConfig::getDesiredBytecodeVersion | ( | ) | const |
Get the set desired bytecode version to emit.
Definition at line 105 of file BytecodeWriter.cpp.
llvm::StringMap< std::unique_ptr< DialectVersion > > & BytecodeWriterConfig::getDialectVersionMap | ( | ) | const |
A map containing the dialect versions to emit.
Definition at line 110 of file BytecodeWriter.cpp.
|
inline |
Return an instance of the internal implementation.
Definition at line 92 of file BytecodeWriter.h.
ArrayRef< std::unique_ptr< AttrTypeBytecodeWriter< Type > > > BytecodeWriterConfig::getTypeWriterCallbacks | ( | ) | const |
Definition at line 77 of file BytecodeWriter.cpp.
void BytecodeWriterConfig::setDesiredBytecodeVersion | ( | int64_t | bytecodeVersion | ) |
Set the desired bytecode version to emit.
This method does not validate the desired version. The bytecode writer entry point will return failure if it cannot emit the desired version.
Definition at line 101 of file BytecodeWriter.cpp.
Referenced by performActions().
|
inline |
Set a given dialect version to emit on the map.
Definition at line 108 of file BytecodeWriter.h.
void mlir::BytecodeWriterConfig::setDialectVersion | ( | StringRef | dialectName, |
std::unique_ptr< DialectVersion > | dialectVersion | ||
) | const |
void BytecodeWriterConfig::setElideResourceDataFlag | ( | bool | shouldElideResourceData = true | ) |
Set a boolean flag to skip emission of resources into the bytecode file.
Definition at line 96 of file BytecodeWriter.cpp.
Referenced by performActions().