LLZK
3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Toggle main menu visibility
Loading...
Searching...
No Matches
SMTDialect.cpp
Go to the documentation of this file.
1
//===- SMTDialect.cpp - SMT dialect implementation --------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "
llzk/Dialect/SMT/IR/SMTDialect.h
"
10
11
#include "
llzk/Dialect/SMT/IR/SMTAttributes.h
"
12
#include "
llzk/Dialect/SMT/IR/SMTOps.h
"
13
#include "
llzk/Dialect/SMT/IR/SMTTypes.h
"
14
15
using namespace
mlir
;
16
using namespace
llzk::smt
;
17
18
void
SMTDialect::initialize() {
19
registerAttributes
();
20
registerTypes
();
21
addOperations<
22
#define GET_OP_LIST
23
#include "
llzk/Dialect/SMT/IR/SMT.cpp.inc
"
24
>();
25
}
26
27
Operation *
28
SMTDialect::materializeConstant
(OpBuilder &builder, Attribute value, Type type, Location loc) {
29
// BitVectorType constants can materialize into smt.bv.constant
30
if
(
auto
bvType = dyn_cast<BitVectorType>(type)) {
31
if
(
auto
attrValue = dyn_cast<BitVectorAttr>(value)) {
32
assert(bvType == attrValue.getType() &&
"attribute and desired result types have to match"
);
33
return
builder.create<
BVConstantOp
>(loc, attrValue);
34
}
35
}
36
37
// BoolType constants can materialize into smt.constant
38
if
(
auto
boolType = dyn_cast<BoolType>(type)) {
39
if
(
auto
attrValue = dyn_cast<BoolAttr>(value)) {
40
return
builder.create<
BoolConstantOp
>(loc, attrValue);
41
}
42
}
43
44
return
nullptr
;
45
}
46
47
#include "
llzk/Dialect/SMT/IR/SMTDialect.cpp.inc
"
48
#include "
llzk/Dialect/SMT/IR/SMTEnums.cpp.inc
"
SMTAttributes.h
SMTDialect.cpp.inc
SMTDialect.h
SMTEnums.cpp.inc
SMTOps.h
SMTTypes.h
SMT.cpp.inc
llzk::smt::BVConstantOp
Definition
SMT.h.inc:2154
llzk::smt::BoolConstantOp
Definition
SMT.h.inc:4156
llzk::smt::SMTDialect::materializeConstant
::mlir::Operation * materializeConstant(::mlir::OpBuilder &builder, ::mlir::Attribute value, ::mlir::Type type, ::mlir::Location loc) override
Materialize a single constant operation from a given attribute value with the desired resultant type.
Definition
SMTDialect.cpp:28
llzk::smt::SMTDialect::registerAttributes
void registerAttributes()
Definition
SMTAttributes.cpp:236
llzk::smt::SMTDialect::registerTypes
void registerTypes()
Definition
SMTTypes.cpp:24
llzk::smt
Definition
SMT.cpp.inc:80
mlir
Definition
ValueModel.h:30
lib
Dialect
SMT
SMTDialect.cpp
Generated by
1.17.0
Copyright 2025 Veridise Inc. under the Apache License v2.0. Copyright 2026 Project LLZK under the Apache License v2.0.