21 using namespace nanobind::literals;
32 [](
const nb::object &, MlirContext context) {
35 "cls"_a,
"context"_a.none() = nb::none());
36 auto smtBitVectorType =
40 [](
const nb::object &, int32_t width, MlirContext context) {
43 "cls"_a,
"width"_a,
"context"_a.none() = nb::none());
45 auto exportSMTLIB = [](MlirOperation module,
bool inlineSingleUseValues,
52 inlineSingleUseValues, indentLetBody);
54 return printAccum.
join();
55 throw nb::value_error(
56 (
"Failed to export smtlib.\nDiagnostic message " + scope.
takeMessage())
62 [&
exportSMTLIB](MlirOperation module,
bool inlineSingleUseValues,
64 return exportSMTLIB(module, inlineSingleUseValues, indentLetBody);
66 "module"_a,
"inline_single_use_values"_a =
false,
67 "indent_let_body"_a =
false);
70 [&
exportSMTLIB](MlirModule module,
bool inlineSingleUseValues,
73 inlineSingleUseValues, indentLetBody);
75 "module"_a,
"inline_single_use_values"_a =
false,
76 "indent_let_body"_a =
false);
80 m.doc() =
"MLIR SMT Dialect";
NB_MODULE(_mlirDialectsSMT, m)
void populateDialectSMTSubmodule(nanobind::module_ &m)
MLIR_CAPI_EXPORTED MlirType mlirSMTTypeGetBitVector(MlirContext ctx, int32_t width)
Creates a smt::BitVectorType with the given width.
MLIR_CAPI_EXPORTED bool mlirSMTTypeIsABool(MlirType type)
Checks if the given type is a smt::BoolType.
MLIR_CAPI_EXPORTED MlirType mlirSMTTypeGetBool(MlirContext ctx)
Creates a smt::BoolType.
MLIR_CAPI_EXPORTED bool mlirSMTTypeIsABitVector(MlirType type)
Checks if the given type is a smt::BitVectorType.
RAII scope intercepting all diagnostics into a string.
std::string takeMessage()
Creates a custom subclass of mlir.ir.Type, implementing a casting constructor and type checking metho...
pure_subclass & def_classmethod(const char *name, Func &&f, const Extra &...extra)
MLIR_CAPI_EXPORTED MlirContext mlirOperationGetContext(MlirOperation op)
Gets the context this operation is associated with.
MLIR_CAPI_EXPORTED MlirOperation mlirModuleGetOperation(MlirModule module)
Views the module as a generic operation.
static bool mlirLogicalResultIsSuccess(MlirLogicalResult res)
Checks if the given logical result represents a success.
MLIR_CAPI_EXPORTED MlirLogicalResult mlirTranslateOperationToSMTLIB(MlirOperation, MlirStringCallback, void *userData, bool inlineSingleUseValues, bool indentLetBody)
LogicalResult exportSMTLIB(Operation *module, llvm::raw_ostream &os, const SMTEmissionOptions &options=SMTEmissionOptions())
Run the ExportSMTLIB pass.
Include the generated interface declarations.
A logical result value, essentially a boolean with named states.
Accumulates into a python string from a method that accepts an MlirStringCallback.
MlirStringCallback getCallback()