MLIR  21.0.0git
ExportSMTLIB.cpp
Go to the documentation of this file.
1 //===- ExportSMTLIB.cpp - C Interface to ExportSMTLIB ---------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM
4 // Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Implements a C Interface for export SMTLIB.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "mlir/CAPI/IR.h"
16 #include "mlir/CAPI/Support.h"
17 #include "mlir/CAPI/Utils.h"
19 
20 using namespace mlir;
21 
23  MlirStringCallback callback,
24  void *userData,
25  bool inlineSingleUseValues,
26  bool indentLetBody) {
27  mlir::detail::CallbackOstream stream(callback, userData);
29  options.inlineSingleUseValues = inlineSingleUseValues;
30  options.indentLetBody = indentLetBody;
31  return wrap(smt::exportSMTLIB(unwrap(module), stream));
32 }
33 
35  MlirStringCallback callback,
36  void *userData,
37  bool inlineSingleUseValues,
38  bool indentLetBody) {
40  callback, userData,
41  inlineSingleUseValues, indentLetBody);
42 }
MlirLogicalResult mlirTranslateModuleToSMTLIB(MlirModule module, MlirStringCallback callback, void *userData, bool inlineSingleUseValues, bool indentLetBody)
Emits SMTLIB for the specified module using the provided callback and user data.
MlirLogicalResult mlirTranslateOperationToSMTLIB(MlirOperation module, MlirStringCallback callback, void *userData, bool inlineSingleUseValues, bool indentLetBody)
static llvm::ManagedStatic< PassManagerOptions > options
A simple raw ostream subclass that forwards write_impl calls to the user-supplied callback together w...
Definition: Utils.h:30
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
Definition: Diagnostics.h:19
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
Definition: Diagnostics.h:24
MLIR_CAPI_EXPORTED MlirOperation mlirModuleGetOperation(MlirModule module)
Views the module as a generic operation.
Definition: IR.cpp:460
void(* MlirStringCallback)(MlirStringRef, void *)
A callback for returning string references.
Definition: Support.h:105
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.
Definition: Support.h:116
Emission options for the ExportSMTLIB pass.
Definition: ExportSMTLIB.h:24