MLIR: mlir::DialectBytecodeReader Class Reference (original) (raw)

This class defines a virtual interface for reading a bytecode stream, providing hooks into the bytecode reader. More...

#include "[mlir/Bytecode/BytecodeImplementation.h](BytecodeImplementation%5F8h%5Fsource.html)"

Public Member Functions
virtual ~DialectBytecodeReader ()=default
virtual InFlightDiagnostic emitError (const Twine &msg={}) const =0
Emit an error to the reader. More...
virtual FailureOr< const DialectVersion * > getDialectVersion (StringRef dialectName) const =0
Retrieve the dialect version by name if available. More...
template
FailureOr< const DialectVersion * > getDialectVersion () const
virtual MLIRContext * getContext () const =0
Retrieve the context associated to the reader. More...
virtual uint64_t getBytecodeVersion () const =0
Return the bytecode version being read. More...
template<typename T , typename CallbackFn >
LogicalResult readList (SmallVectorImpl< T > &result, CallbackFn &&callback)
Read out a list of elements, invoking the provided callback for each element. More...
virtual LogicalResult readAttribute (Attribute &result)=0
Read a reference to the given attribute. More...
virtual LogicalResult readOptionalAttribute (Attribute &attr)=0
Read an optional reference to the given attribute. More...
template
LogicalResult readAttributes (SmallVectorImpl< T > &attrs)
template
LogicalResult readAttribute (T &result)
template
LogicalResult readOptionalAttribute (T &result)
virtual LogicalResult readType (Type &result)=0
Read a reference to the given type. More...
template
LogicalResult readTypes (SmallVectorImpl< T > &types)
template
LogicalResult readType (T &result)
template
FailureOr< ResourceT > readResourceHandle ()
Read a handle to a dialect resource. More...
virtual LogicalResult readVarInt (uint64_t &result)=0
Read a variable width integer. More...
virtual LogicalResult readSignedVarInt (int64_t &result)=0
Read a signed variable width integer. More...
LogicalResult readSignedVarInts (SmallVectorImpl< int64_t > &result)
LogicalResult readVarIntWithFlag (uint64_t &result, bool &flag)
Parse a variable length encoded integer whose low bit is used to encode an unrelated flag, i.e: (integerValue << 1) | (flag ? 1 : 0). More...
template
LogicalResult readSparseArray (MutableArrayRef< T > array)
Read a "small" sparse array of integer <= 32 bits elements, where index/value pairs can be compressed when the array is small. More...
virtual FailureOr< APInt > readAPIntWithKnownWidth (unsigned bitWidth)=0
Read an APInt that is known to have been encoded with the given width. More...
virtual FailureOr< APFloat > readAPFloatWithKnownSemantics (const llvm::fltSemantics &semantics)=0
Read an APFloat that is known to have been encoded with the given semantics. More...
virtual LogicalResult readString (StringRef &result)=0
Read a string from the bytecode. More...
virtual LogicalResult readBlob (ArrayRef< char > &result)=0
Read a blob from the bytecode. More...
virtual LogicalResult readBool (bool &result)=0
Read a bool from the bytecode. More...

This class defines a virtual interface for reading a bytecode stream, providing hooks into the bytecode reader.

As such, this class should only be derived and defined by the main bytecode reader, users (i.e. dialects) should generally only interact with this class via the BytecodeDialectInterface below.

Definition at line 46 of file BytecodeImplementation.h.

virtual mlir::DialectBytecodeReader::~DialectBytecodeReader ( ) virtualdefault

emitError()

virtual InFlightDiagnostic mlir::DialectBytecodeReader::emitError ( const Twine & msg = {}) const pure virtual

getBytecodeVersion()

virtual uint64_t mlir::DialectBytecodeReader::getBytecodeVersion ( ) const pure virtual

Return the bytecode version being read.

getContext()

virtual MLIRContext* mlir::DialectBytecodeReader::getContext ( ) const pure virtual

Retrieve the context associated to the reader.

getDialectVersion() [1/2]

template

FailureOr<const DialectVersion *> mlir::DialectBytecodeReader::getDialectVersion ( ) const inline

getDialectVersion() [2/2]

virtual FailureOr<const DialectVersion *> mlir::DialectBytecodeReader::getDialectVersion ( StringRef dialectName) const pure virtual

Retrieve the dialect version by name if available.

readAPFloatWithKnownSemantics()

virtual FailureOr mlir::DialectBytecodeReader::readAPFloatWithKnownSemantics ( const llvm::fltSemantics & semantics) pure virtual

Read an APFloat that is known to have been encoded with the given semantics.

readAPIntWithKnownWidth()

virtual FailureOr mlir::DialectBytecodeReader::readAPIntWithKnownWidth ( unsigned bitWidth) pure virtual

Read an APInt that is known to have been encoded with the given width.

readAttribute() [1/2]

virtual LogicalResult mlir::DialectBytecodeReader::readAttribute ( Attribute & result) pure virtual

readAttribute() [2/2]

template

LogicalResult mlir::DialectBytecodeReader::readAttribute ( T & result) inline

readAttributes()

template

LogicalResult mlir::DialectBytecodeReader::readAttributes ( SmallVectorImpl< T > & attrs) inline

readBlob()

virtual LogicalResult mlir::DialectBytecodeReader::readBlob ( ArrayRef< char > & result) pure virtual

Read a blob from the bytecode.

readBool()

virtual LogicalResult mlir::DialectBytecodeReader::readBool ( bool & result) pure virtual

Read a bool from the bytecode.

readList()

template<typename T , typename CallbackFn >

LogicalResult mlir::DialectBytecodeReader::readList ( SmallVectorImpl< T > & result, CallbackFn && callback ) inline

readOptionalAttribute() [1/2]

virtual LogicalResult mlir::DialectBytecodeReader::readOptionalAttribute ( Attribute & attr) pure virtual

readOptionalAttribute() [2/2]

template

LogicalResult mlir::DialectBytecodeReader::readOptionalAttribute ( T & result) inline

readResourceHandle()

template

FailureOr mlir::DialectBytecodeReader::readResourceHandle ( ) inline

readSignedVarInt()

virtual LogicalResult mlir::DialectBytecodeReader::readSignedVarInt ( int64_t & result) pure virtual

readSignedVarInts()

LogicalResult mlir::DialectBytecodeReader::readSignedVarInts ( SmallVectorImpl< int64_t > & result) inline

readSparseArray()

template

LogicalResult mlir::DialectBytecodeReader::readSparseArray ( MutableArrayRef< T > array) inline

Read a "small" sparse array of integer <= 32 bits elements, where index/value pairs can be compressed when the array is small.

Note that only some position of the array will be read and the ones not stored in the bytecode are gonne be left untouched. If the provided array is too small for the stored indices, an error will be returned.

Definition at line 193 of file BytecodeImplementation.h.

References emitError(), readVarInt(), and readVarIntWithFlag().

readString()

virtual LogicalResult mlir::DialectBytecodeReader::readString ( StringRef & result) pure virtual

Read a string from the bytecode.

readType() [1/2]

template

LogicalResult mlir::DialectBytecodeReader::readType ( T & result) inline

readType() [2/2]

virtual LogicalResult mlir::DialectBytecodeReader::readType ( Type & result) pure virtual

readTypes()

template

LogicalResult mlir::DialectBytecodeReader::readTypes ( SmallVectorImpl< T > & types) inline

readVarInt()

virtual LogicalResult mlir::DialectBytecodeReader::readVarInt ( uint64_t & result) pure virtual

readVarIntWithFlag()

LogicalResult mlir::DialectBytecodeReader::readVarIntWithFlag ( uint64_t & result, bool & flag ) inline

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