|
MLIR 22.0.0git
|
This class defines a virtual interface for reading a bytecode stream, providing hooks into the bytecode reader. More...
#include "mlir/Bytecode/BytecodeImplementation.h"
Public Member Functions | |
| virtual | ~DialectBytecodeReader ()=default |
| virtual InFlightDiagnostic | emitError (const Twine &msg={}) const =0 |
| Emit an error to the reader. | |
| virtual FailureOr< const DialectVersion * > | getDialectVersion (StringRef dialectName) const =0 |
| Retrieve the dialect version by name if available. | |
| template<class T> | |
| FailureOr< const DialectVersion * > | getDialectVersion () const |
| virtual MLIRContext * | getContext () const =0 |
| Retrieve the context associated to the reader. | |
| virtual uint64_t | getBytecodeVersion () const =0 |
| Return the bytecode version being read. | |
| 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. | |
| virtual LogicalResult | readAttribute (Attribute &result)=0 |
| Read a reference to the given attribute. | |
| virtual LogicalResult | readOptionalAttribute (Attribute &attr)=0 |
| Read an optional reference to the given attribute. | |
| template<typename T> | |
| LogicalResult | readAttributes (SmallVectorImpl< T > &attrs) |
| template<typename T> | |
| LogicalResult | readAttribute (T &result) |
| template<typename T> | |
| LogicalResult | readOptionalAttribute (T &result) |
| virtual LogicalResult | readType (Type &result)=0 |
| Read a reference to the given type. | |
| template<typename T> | |
| LogicalResult | readTypes (SmallVectorImpl< T > &types) |
| template<typename T> | |
| LogicalResult | readType (T &result) |
| template<typename ResourceT> | |
| FailureOr< ResourceT > | readResourceHandle () |
| Read a handle to a dialect resource. | |
| virtual LogicalResult | readVarInt (uint64_t &result)=0 |
| Read a variable width integer. | |
| virtual LogicalResult | readSignedVarInt (int64_t &result)=0 |
| Read a signed variable width integer. | |
| 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 ?
| |
| template<typename T> | |
| 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. | |
| virtual FailureOr< APInt > | readAPIntWithKnownWidth (unsigned bitWidth)=0 |
| Read an APInt that is known to have been encoded with the given width. | |
| virtual FailureOr< APFloat > | readAPFloatWithKnownSemantics (const llvm::fltSemantics &semantics)=0 |
| Read an APFloat that is known to have been encoded with the given semantics. | |
| virtual LogicalResult | readString (StringRef &result)=0 |
| Read a string from the bytecode. | |
| virtual LogicalResult | readBlob (ArrayRef< char > &result)=0 |
| Read a blob from the bytecode. | |
| virtual LogicalResult | readBool (bool &result)=0 |
| Read a bool from the bytecode. | |
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.
|
virtualdefault |
|
pure virtual |
Emit an error to the reader.
Referenced by mlir::BytecodeDialectInterface::readAttribute(), readAttribute(), readOptionalAttribute(), readResourceHandle(), readSparseArray(), mlir::BytecodeDialectInterface::readType(), readType(), and mlir::BytecodeDialectInterface::readVersion().
|
pure virtual |
Return the bytecode version being read.
|
pure virtual |
Retrieve the context associated to the reader.
|
inline |
Definition at line 57 of file BytecodeImplementation.h.
References getDialectVersion().
Referenced by getDialectVersion().
|
pure virtual |
Retrieve the dialect version by name if available.
|
pure virtual |
Read an APFloat that is known to have been encoded with the given semantics.
|
pure virtual |
Read an APInt that is known to have been encoded with the given width.
|
pure virtual |
Read a reference to the given attribute.
References result.
Referenced by readAttribute(), and readAttributes().
|
inline |
Definition at line 111 of file BytecodeImplementation.h.
References emitError(), readAttribute(), result, and success().
|
inline |
Definition at line 107 of file BytecodeImplementation.h.
References readAttribute(), and readList().
|
pure virtual |
Read a blob from the bytecode.
References result.
|
pure virtual |
Read a bool from the bytecode.
References result.
|
inline |
Read out a list of elements, invoking the provided callback for each element.
The callback function may be in any of the following forms:
Definition at line 72 of file BytecodeImplementation.h.
References readVarInt(), result, and success().
Referenced by readAttributes(), readSignedVarInts(), and readTypes().
|
pure virtual |
Read an optional reference to the given attribute.
Returns success even if the Attribute isn't present.
Referenced by readOptionalAttribute().
|
inline |
Definition at line 121 of file BytecodeImplementation.h.
References emitError(), readOptionalAttribute(), result, and success().
|
inline |
Read a handle to a dialect resource.
Definition at line 152 of file BytecodeImplementation.h.
References emitError(), readResourceHandle(), and result.
Referenced by readResourceHandle(), and mlir::readResourceHandle().
|
pure virtual |
|
inline |
Definition at line 171 of file BytecodeImplementation.h.
References readList(), readSignedVarInt(), and result.
|
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(), readVarIntWithFlag(), and success().
|
pure virtual |
Read a string from the bytecode.
References result.
|
inline |
Definition at line 140 of file BytecodeImplementation.h.
References emitError(), readType(), result, and success().
|
pure virtual |
|
inline |
Definition at line 136 of file BytecodeImplementation.h.
References readList(), and readType().
|
pure virtual |
Read a variable width integer.
References result.
Referenced by readList(), readSparseArray(), and readVarIntWithFlag().
|
inline |
Parse a variable length encoded integer whose low bit is used to encode an unrelated flag, i.e: (integerValue << 1) | (flag ?
1 : 0).
Definition at line 178 of file BytecodeImplementation.h.
References readVarInt(), result, and success().
Referenced by readSparseArray().