LLZK 0.1.0
Veridise's ZK Language IR
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
10#include "llzk/Config/Config.h"
12
13#include <mlir/Support/LLVM.h>
14
15using namespace mlir;
16
17namespace llzk {
18
19//===------------------------------------------------------------------===//
20// LLZKDialectVersion
21//===------------------------------------------------------------------===//
22
27
28FailureOr<LLZKDialectVersion> LLZKDialectVersion::read(DialectBytecodeReader &reader) {
30 if (failed(reader.readVarInt(v.majorVersion)) || failed(reader.readVarInt(v.minorVersion)) ||
31 failed(reader.readVarInt(v.patchVersion))) {
32 return failure();
33 }
34 return v;
35}
36
37void LLZKDialectVersion::write(DialectBytecodeWriter &writer) const {
38 writer.writeVarInt(majorVersion);
39 writer.writeVarInt(minorVersion);
40 writer.writeVarInt(patchVersion);
41}
42
43std::string LLZKDialectVersion::str() const {
44 return (Twine(majorVersion) + "." + Twine(minorVersion) + "." + Twine(patchVersion)).str();
45}
46
47std::strong_ordering LLZKDialectVersion::operator<=>(const LLZKDialectVersion &other) const {
48 if (auto cmp = majorVersion <=> other.majorVersion; cmp != 0) {
49 return cmp;
50 }
51 if (auto cmp = minorVersion <=> other.minorVersion; cmp != 0) {
52 return cmp;
53 }
54 return patchVersion <=> other.patchVersion;
55}
56
57} // 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(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