[Mlir-commits] [mlir] [mlir][SMT] upstream `SMT` dialect (PR #131480)

Maksim Levental llvmlistbot at llvm.org
Fri Apr 4 03:18:33 PDT 2025


================
@@ -0,0 +1,475 @@
+//===- SMTOps.td - SMT dialect operations ------------------*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_DIALECT_SMT_SMTOPS_TD
+#define MLIR_DIALECT_SMT_SMTOPS_TD
+
+include "mlir/Dialect/SMT/IR/SMTDialect.td"
+include "mlir/Dialect/SMT/IR/SMTAttributes.td"
+include "mlir/Dialect/SMT/IR/SMTTypes.td"
+include "mlir/IR/EnumAttr.td"
+include "mlir/IR/OpAsmInterface.td"
+include "mlir/Interfaces/InferTypeOpInterface.td"
+include "mlir/Interfaces/SideEffectInterfaces.td"
+include "mlir/Interfaces/ControlFlowInterfaces.td"
+
+class SMTOp<string mnemonic, list<Trait> traits = []> :
+  Op<SMTDialect, mnemonic, traits>;
+
+def DeclareFunOp : SMTOp<"declare_fun", [
+  DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>
+]> {
+  let summary = "declare a symbolic value of a given sort";
----------------
makslevental wrote:

> My understanding is that declare-const is just syntactic sugar for declare-fun for 0-ary functions.

This is correct (I believe I learned the same thing at some point). 

> declare_fun and declare both sound fine to me. I think declare is probably slightly better, but whatever you prefer.

My preference is to keep things as close to the "target language" as possible instead of being "clever". So I propose we keep `declare_fun`.

https://github.com/llvm/llvm-project/pull/131480


More information about the Mlir-commits mailing list