LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
Ops.cpp
Go to the documentation of this file.
1//===-- Ops.cpp - Constrain operation implementations -----------*- 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
15
16// TableGen'd implementation files
17#define GET_OP_CLASSES
19
20using namespace mlir;
21using namespace llzk::array;
22
23namespace llzk::constrain {
24
25//===------------------------------------------------------------------===//
26// EmitEqualityOp
27//===------------------------------------------------------------------===//
28
29LogicalResult EmitEqualityOp::verifySymbolUses(SymbolTableCollection &tables) {
30 // Ensure any SymbolRef used in the type are valid
32 tables, *this, ArrayRef<Type> {getLhs().getType(), getRhs().getType()}
33 );
34}
35
36Type EmitEqualityOp::inferRHS(Type lhsType) { return lhsType; }
37
38//===------------------------------------------------------------------===//
39// EmitContainmentOp
40//===------------------------------------------------------------------===//
41
42LogicalResult EmitContainmentOp::verifySymbolUses(SymbolTableCollection &tables) {
43 // Ensure any SymbolRef used in the type are valid
45 tables, *this, ArrayRef<Type> {getLhs().getType(), getRhs().getType()}
46 );
47}
48
49Type EmitContainmentOp::inferRHS(Type lhsType) {
50 assert(llvm::isa<ArrayType>(lhsType)); // per ODS spec of EmitContainmentOp
51 return llvm::cast<ArrayType>(lhsType).getElementType();
52}
53
54} // namespace llzk::constrain
::mlir::Type inferRHS(::mlir::Type lhsType)
Definition Ops.cpp:49
::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable)
Definition Ops.cpp:42
::mlir::TypedValue<::llzk::array::ArrayType > getLhs()
Definition Ops.cpp.inc:98
::mlir::Type inferRHS(::mlir::Type lhsType)
Definition Ops.cpp:36
::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable)
Definition Ops.cpp:29
LogicalResult verifyTypeResolution(SymbolTableCollection &tables, Operation *origin, Type ty)