MLIR  20.0.0git
Public Member Functions | Public Attributes | List of all members
mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter Struct Reference
+ Inheritance diagram for mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter:

Public Member Functions

 NumberingDialectWriter (IRNumberingState &state, llvm::StringMap< std::unique_ptr< DialectVersion >> &dialectVersionMap)
 
void writeAttribute (Attribute attr) override
 Write a reference to the given attribute. More...
 
void writeOptionalAttribute (Attribute attr) override
 
void writeType (Type type) override
 Write a reference to the given type. More...
 
void writeResourceHandle (const AsmDialectResourceHandle &resource) override
 Write the given handle to a dialect resource. More...
 
void writeVarInt (uint64_t) override
 Stubbed out methods that are not used for numbering. More...
 
void writeSignedVarInt (int64_t value) override
 Write a signed variable width integer to the output stream. More...
 
void writeAPIntWithKnownWidth (const APInt &value) override
 Write an APInt to the bytecode stream whose bitwidth will be known externally at read time. More...
 
void writeAPFloatWithKnownSemantics (const APFloat &value) override
 Write an APFloat to the bytecode stream whose semantics will be known externally at read time. More...
 
void writeOwnedString (StringRef) override
 Write a string to the bytecode, which is owned by the caller and is guaranteed to not die before the end of the bytecode process. More...
 
void writeOwnedBlob (ArrayRef< char > blob) override
 Write a blob to the bytecode, which is owned by the caller and is guaranteed to not die before the end of the bytecode process. More...
 
void writeOwnedBool (bool value) override
 Write a bool to the output stream. More...
 
int64_t getBytecodeVersion () const override
 Return the bytecode version being emitted for. More...
 
FailureOr< const DialectVersion * > getDialectVersion (StringRef dialectName) const override
 Retrieve the dialect version by name if available. More...
 
- Public Member Functions inherited from mlir::DialectBytecodeWriter
virtual ~DialectBytecodeWriter ()=default
 
template<typename RangeT , typename CallbackFn >
void writeList (RangeT &&range, CallbackFn &&callback)
 Write out a list of elements, invoking the provided callback for each element. More...
 
template<typename T >
void writeAttributes (ArrayRef< T > attrs)
 
template<typename T >
void writeTypes (ArrayRef< T > types)
 
void writeSignedVarInts (ArrayRef< int64_t > value)
 
void writeVarIntWithFlag (uint64_t value, bool flag)
 Write a VarInt and a flag packed together. More...
 
template<typename T >
void writeSparseArray (ArrayRef< T > array)
 Write out a "small" sparse array of integer <= 32 bits elements, where index/value pairs can be compressed when the array is small. More...
 
template<class T >
FailureOr< const DialectVersion * > getDialectVersion () const
 

Public Attributes

IRNumberingStatestate
 The parent numbering state that is populated by this writer. More...
 
llvm::StringMap< std::unique_ptr< DialectVersion > > & dialectVersionMap
 A map containing dialect version information for each dialect to emit. More...
 

Detailed Description

Definition at line 25 of file IRNumbering.cpp.

Constructor & Destructor Documentation

◆ NumberingDialectWriter()

mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::NumberingDialectWriter ( IRNumberingState state,
llvm::StringMap< std::unique_ptr< DialectVersion >> &  dialectVersionMap 
)
inline

Definition at line 26 of file IRNumbering.cpp.

Member Function Documentation

◆ getBytecodeVersion()

int64_t mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::getBytecodeVersion ( ) const
inlineoverridevirtual

◆ getDialectVersion()

FailureOr<const DialectVersion *> mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::getDialectVersion ( StringRef  dialectName) const
inlineoverridevirtual

Retrieve the dialect version by name if available.

Implements mlir::DialectBytecodeWriter.

Definition at line 59 of file IRNumbering.cpp.

References mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::dialectVersionMap.

◆ writeAPFloatWithKnownSemantics()

void mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::writeAPFloatWithKnownSemantics ( const APFloat &  value)
inlineoverridevirtual

Write an APFloat to the bytecode stream whose semantics will be known externally at read time.

This method is useful for encoding APFloat values when the semantics are known via external means, such as via a type.

Implements mlir::DialectBytecodeWriter.

Definition at line 45 of file IRNumbering.cpp.

◆ writeAPIntWithKnownWidth()

void mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::writeAPIntWithKnownWidth ( const APInt &  value)
inlineoverridevirtual

Write an APInt to the bytecode stream whose bitwidth will be known externally at read time.

This method is useful for encoding APInt values when the width is known via external means, such as via a type. This method should generally only be invoked if you need an APInt, otherwise use the varint methods above. APInt values are generally encoded using zigzag encoding, to enable more efficient encodings for negative values.

Implements mlir::DialectBytecodeWriter.

Definition at line 44 of file IRNumbering.cpp.

◆ writeAttribute()

void mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::writeAttribute ( Attribute  attr)
inlineoverridevirtual

Write a reference to the given attribute.

Implements mlir::DialectBytecodeWriter.

Definition at line 31 of file IRNumbering.cpp.

References mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::state.

◆ writeOptionalAttribute()

void mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::writeOptionalAttribute ( Attribute  attr)
inlineoverridevirtual

◆ writeOwnedBlob()

void mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::writeOwnedBlob ( ArrayRef< char >  blob)
inlineoverridevirtual

Write a blob to the bytecode, which is owned by the caller and is guaranteed to not die before the end of the bytecode process.

The blob is written as-is, with no additional compression or compaction.

Implements mlir::DialectBytecodeWriter.

Definition at line 51 of file IRNumbering.cpp.

◆ writeOwnedBool()

void mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::writeOwnedBool ( bool  value)
inlineoverridevirtual

Write a bool to the output stream.

Implements mlir::DialectBytecodeWriter.

Definition at line 52 of file IRNumbering.cpp.

◆ writeOwnedString()

void mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::writeOwnedString ( StringRef  str)
inlineoverridevirtual

Write a string to the bytecode, which is owned by the caller and is guaranteed to not die before the end of the bytecode process.

This should only be called if such a guarantee can be made, such as when the string is owned by an attribute or type.

Implements mlir::DialectBytecodeWriter.

Definition at line 46 of file IRNumbering.cpp.

◆ writeResourceHandle()

void mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::writeResourceHandle ( const AsmDialectResourceHandle resource)
inlineoverridevirtual

Write the given handle to a dialect resource.

Implements mlir::DialectBytecodeWriter.

Definition at line 37 of file IRNumbering.cpp.

References mlir::AsmDialectResourceHandle::getDialect(), and mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::state.

◆ writeSignedVarInt()

void mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::writeSignedVarInt ( int64_t  value)
inlineoverridevirtual

Write a signed variable width integer to the output stream.

This should be the preferred method for emitting signed integers whenever possible.

Implements mlir::DialectBytecodeWriter.

Definition at line 43 of file IRNumbering.cpp.

◆ writeType()

void mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::writeType ( Type  type)
inlineoverridevirtual

Write a reference to the given type.

Implements mlir::DialectBytecodeWriter.

Definition at line 36 of file IRNumbering.cpp.

References mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::state.

◆ writeVarInt()

void mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::writeVarInt ( uint64_t  )
inlineoverridevirtual

Stubbed out methods that are not used for numbering.

Implements mlir::DialectBytecodeWriter.

Definition at line 42 of file IRNumbering.cpp.

Member Data Documentation

◆ dialectVersionMap

llvm::StringMap<std::unique_ptr<DialectVersion> >& mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::dialectVersionMap

A map containing dialect version information for each dialect to emit.

Definition at line 70 of file IRNumbering.cpp.

Referenced by mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::getDialectVersion().

◆ state

IRNumberingState& mlir::bytecode::detail::IRNumberingState::NumberingDialectWriter::state

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