mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 02:26:05 +00:00

Dialects can opt-in to providing custom encodings by implementing the `BytecodeDialectInterface`. This interface provides hooks, namely `readAttribute`/`readType` and `writeAttribute`/`writeType`, that will be used by the bytecode reader and writer. These hooks are provided a reader and writer implementation that can be used to encode various constructs in the underlying bytecode format. A unique feature of this interface is that dialects may choose to only encode a subset of their attributes and types in a custom bytecode format, which can simplify adding new or experimental components that aren't fully baked. Differential Revision: https://reviews.llvm.org/D132498
27 lines
954 B
C++
27 lines
954 B
C++
//===- BuiltinDialectBytecode.h - MLIR Bytecode Implementation --*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This header defines hooks into the builtin dialect bytecode implementation.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LIB_MLIR_IR_BUILTINDIALECTBYTECODE_H
|
|
#define LIB_MLIR_IR_BUILTINDIALECTBYTECODE_H
|
|
|
|
namespace mlir {
|
|
class BuiltinDialect;
|
|
|
|
namespace builtin_dialect_detail {
|
|
/// Add the interfaces necessary for encoding the builtin dialect components in
|
|
/// bytecode.
|
|
void addBytecodeInterface(BuiltinDialect *dialect);
|
|
} // namespace builtin_dialect_detail
|
|
} // namespace mlir
|
|
|
|
#endif // LIB_MLIR_IR_BUILTINDIALECTBYTECODE_H
|