LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
LLZKLoweringUtils.h
Go to the documentation of this file.
1//===-- LLZKLoweringUtils.h -------------------------------------*- C++ -*-===//
2//
3// Shared utilities for lowering passes in the LLZK project.
4//
5//===----------------------------------------------------------------------===//
6
7#pragma once
8
12
13#include <mlir/IR/Builders.h>
14#include <mlir/IR/BuiltinOps.h>
15#include <mlir/IR/Value.h>
16#include <mlir/Support/LogicalResult.h>
17
18#include <llvm/ADT/DenseMap.h>
19
20namespace llzk {
21
23 std::string auxMemberName;
24 mlir::Value computedValue;
25};
26
28 mlir::Value val, function::FuncDefOp computeFunc, mlir::OpBuilder &builder,
29 llvm::DenseMap<mlir::Value, mlir::Value> &memo
30);
31
32mlir::LogicalResult
33checkForAuxMemberConflicts(component::StructDefOp structDef, llvm::StringRef auxPrefix);
34
36
37unsigned getFeltDegree(mlir::Value val, llvm::DenseMap<mlir::Value, unsigned> &memo);
38
53void replaceSubsequentUsesWith(mlir::Value oldVal, mlir::Value newVal, mlir::Operation *afterOp);
54
55} // namespace llzk
Value rebuildExprInCompute(Value val, FuncDefOp computeFunc, OpBuilder &builder, DenseMap< Value, Value > &memo)
void replaceSubsequentUsesWith(Value oldVal, Value newVal, Operation *afterOp)
MemberDefOp addAuxMember(StructDefOp structDef, StringRef name)
unsigned getFeltDegree(Value val, DenseMap< Value, unsigned > &memo)
LogicalResult checkForAuxMemberConflicts(StructDefOp structDef, StringRef prefix)