LLZK 0.1.0
Veridise's ZK Language IR
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#ifndef LLZK_TRANSFORMS_LOWERING_UTILS_H
8#define LLZK_TRANSFORMS_LOWERING_UTILS_H
9
13
14#include <mlir/IR/Builders.h>
15#include <mlir/IR/BuiltinOps.h>
16#include <mlir/IR/Value.h>
17#include <mlir/Support/LogicalResult.h>
18
19#include <llvm/ADT/DenseMap.h>
20
21namespace llzk {
22
24 std::string auxFieldName;
25 mlir::Value computedValue;
26};
27
28mlir::Value getSelfValueFromCompute(function::FuncDefOp computeFunc);
29
31 mlir::Value val, function::FuncDefOp computeFunc, mlir::OpBuilder &builder,
32 llvm::DenseMap<mlir::Value, mlir::Value> &memo
33);
34
35mlir::LogicalResult
36checkForAuxFieldConflicts(component::StructDefOp structDef, llvm::StringRef auxPrefix);
37
39
40unsigned getFeltDegree(mlir::Value val, llvm::DenseMap<mlir::Value, unsigned> &memo);
41
56void replaceSubsequentUsesWith(mlir::Value oldVal, mlir::Value newVal, mlir::Operation *afterOp);
57
58} // namespace llzk
59
60#endif // LLZK_TRANSFORMS_LOWERING_UTILS_H
MlirStringRef name
Value rebuildExprInCompute(Value val, FuncDefOp computeFunc, OpBuilder &builder, DenseMap< Value, Value > &memo)
void replaceSubsequentUsesWith(Value oldVal, Value newVal, Operation *afterOp)
Value getSelfValueFromCompute(FuncDefOp computeFunc)
LogicalResult checkForAuxFieldConflicts(StructDefOp structDef, StringRef prefix)
FieldDefOp addAuxField(StructDefOp structDef, StringRef name)
unsigned getFeltDegree(Value val, DenseMap< Value, unsigned > &memo)