LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Versioning.cpp
Go to the documentation of this file.
1//===-- Versioning.cpp ------------------------------------------*- C++ -*-===//
2//
3// Part of the LLZK Project, under the Apache License v2.0.
4// See LICENSE.txt for license information.
5// Copyright 2025 Veridise Inc.
6// SPDX-License-Identifier: Apache-2.0
7//
8//===----------------------------------------------------------------------===//
9
11
12#include "llzk/Config/Config.h"
13
14#include <mlir/Support/LLVM.h>
15
16using namespace mlir;
17
18namespace llzk {
19
20//===------------------------------------------------------------------===//
21// LLZKDialectVersion
22//===------------------------------------------------------------------===//
23
28
29FailureOr<LLZKDialectVersion> LLZKDialectVersion::read(DialectBytecodeReader &reader) {
31 if (failed(reader.readVarInt(v.majorVersion)) || failed(reader.readVarInt(v.minorVersion)) ||
32 failed(reader.readVarInt(v.patchVersion))) {
33 return failure();
34 }
35 return v;
36}
37
38void LLZKDialectVersion::write(DialectBytecodeWriter &writer) const {
39 writer.writeVarInt(majorVersion);
40 writer.writeVarInt(minorVersion);
41 writer.writeVarInt(patchVersion);
42}
43
44std::string LLZKDialectVersion::str() const {
45 return (Twine(majorVersion) + "." + Twine(minorVersion) + "." + Twine(patchVersion)).str();
46}
47
48std::strong_ordering LLZKDialectVersion::operator<=>(const LLZKDialectVersion &other) const {
49 if (auto cmp = majorVersion <=> other.majorVersion; cmp != 0) {
50 return cmp;
51 }
52 if (auto cmp = minorVersion <=> other.minorVersion; cmp != 0) {
53 return cmp;
54 }
55 return patchVersion <=> other.patchVersion;
56}
57
58} // namespace llzk
#define LLZK_VERSION_MAJOR
Definition Config.h:13
#define LLZK_VERSION_MINOR
Definition Config.h:14
#define LLZK_VERSION_PATCH
Definition Config.h:15
ExpressionValue cmp(const llvm::SMTSolverRef &solver, CmpOp op, const ExpressionValue &lhs, const ExpressionValue &rhs)
static const LLZKDialectVersion & CurrentVersion()
std::strong_ordering operator<=>(const LLZKDialectVersion &other) const
static mlir::FailureOr< LLZKDialectVersion > read(mlir::DialectBytecodeReader &reader)
void write(mlir::DialectBytecodeWriter &writer) const
std::string str() const