LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
llzk-translate.cpp
Go to the documentation of this file.
1//===-- llzk-translate.cpp - LLZK translate tool ----------------*- C++ -*-===//
2//
3// Part of the LLZK Project, under the Apache License v2.0.
4// See LICENSE.txt for license information.
5// Copyright 2026 Project LLZK
6// SPDX-License-Identifier: Apache-2.0
7//
8//===----------------------------------------------------------------------===//
14//===----------------------------------------------------------------------===//
15
16#include "r1cs/Target/TranslateRegistration.h"
17#include "smt/Target/TranslateRegistration.h"
18#include "tools/config.h"
19#include "zklean/Target/TranslateRegistration.h"
20
21#include "llzk/Config/Config.h"
22
23#include <mlir/Dialect/Func/Extensions/InlinerExtension.h>
24#include <mlir/Dialect/Func/IR/FuncOps.h>
25#include <mlir/Dialect/SCF/IR/SCF.h>
26#include <mlir/IR/DialectRegistry.h>
27#include <mlir/InitAllTranslations.h>
28#include <mlir/Pass/PassManager.h>
29#include <mlir/Pass/PassRegistry.h>
30#include <mlir/Tools/mlir-translate/MlirTranslateMain.h>
31#include <mlir/Transforms/Passes.h>
32
33#include <llvm/ADT/StringRef.h>
34#include <llvm/Support/CommandLine.h>
35#include <llvm/Support/PrettyStackTrace.h>
36#include <llvm/Support/Signals.h>
37
38#if LLZK_WITH_PCL
39#include "pcl/Target/TranslateRegistration.h"
40#endif // LLZK_WITH_PCL
41
42using namespace llzk;
43
44int main(int argc, char **argv) {
45 llvm::sys::PrintStackTraceOnErrorSignal(llvm::StringRef());
46 llvm::setBugReportMsg(
47 "PLEASE submit a bug report to " BUG_REPORT_URL
48 " and include the crash backtrace, relevant LLZK files,"
49 " and associated run script(s).\n"
50 );
51 llvm::cl::AddExtraVersionPrinter([](llvm::raw_ostream &os) {
52 os << "\nLLZK (" LLZK_URL "):\n LLZK version " LLZK_VERSION_STRING "\n";
53 });
54
55 // Register all MLIR translations
56 mlir::registerAllTranslations();
57 r1cs::registerR1CSTranslation();
58 smt::registerSmtTranslation();
59 zklean::registerZKLeanTranslation();
60#if LLZK_WITH_PCL
61 pcl::registerPclTranslation();
62#endif
63
64 // Run 'mlir-translate'
65 return failed(mlir::mlirTranslateMain(argc, argv, "LLZK Translation tool"));
66}
#define LLZK_VERSION_STRING
Definition Config.h:12
#define LLZK_URL
Definition Config.h:17
#define BUG_REPORT_URL
Definition config.h:15
int main(int argc, char **argv)