llvm/mlir/include/mlir/Bytecode/Encoding.h

//===- Encoding.h - MLIR binary format encoding information -----*- 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 enum values describing the structure of MLIR bytecode
// files.
//
//===----------------------------------------------------------------------===//

#ifndef MLIR_BYTECODE_ENCODING_H
#define MLIR_BYTECODE_ENCODING_H

#include "mlir/IR/Value.h"
#include <cstdint>
#include <type_traits>

namespace mlir {
namespace bytecode {
//===----------------------------------------------------------------------===//
// General constants
//===----------------------------------------------------------------------===//

enum BytecodeVersion {};

//===----------------------------------------------------------------------===//
// Sections
//===----------------------------------------------------------------------===//

namespace Section {
enum ID : uint8_t {};
} // namespace Section

//===----------------------------------------------------------------------===//
// IR Section
//===----------------------------------------------------------------------===//

/// This enum represents a mask of all of the potential components of an
/// operation. This mask is used when encoding an operation to indicate which
/// components are present in the bytecode.
namespace OpEncodingMask {
enum : uint8_t {};
} // namespace OpEncodingMask

/// Get the unique ID of a value use. We encode the unique ID combining an owner
/// number and the argument number such as if ownerID(op1) < ownerID(op2), then
/// useID(op1) < useID(op2). If uses have the same owner, then argNumber(op1) <
/// argNumber(op2) implies useID(op1) < useID(op2).
template <typename OperandT>
static inline uint64_t getUseID(OperandT &val, unsigned ownerID) {}

} // namespace bytecode
} // namespace mlir

#endif