MLIR  22.0.0git
SMTExtensionOps.cpp
Go to the documentation of this file.
1 //===- SMTExtensionOps.cpp - SMT extension for the Transform dialect ------===//
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 
13 
14 using namespace mlir;
15 
16 #define GET_OP_CLASSES
17 #include "mlir/Dialect/Transform/SMTExtension/SMTExtensionOps.cpp.inc"
18 
19 //===----------------------------------------------------------------------===//
20 // ConstrainParamsOp
21 //===----------------------------------------------------------------------===//
22 
23 void transform::smt::ConstrainParamsOp::getEffects(
25  onlyReadsHandle(getParamsMutable(), effects);
26 }
27 
29 transform::smt::ConstrainParamsOp::apply(transform::TransformRewriter &rewriter,
32  // TODO: Proper operational semantics are to check the SMT problem in the body
33  // with a SMT solver with the arguments of the body constrained to the
34  // values passed into the op. Success or failure is then determined by
35  // the solver's result.
36  // One way to support this is to just promise the TransformOpInterface
37  // and allow for users to attach their own implementation, which would,
38  // e.g., translate the ops to SMTLIB and hand that over to the user's
39  // favourite solver. This requires changes to the dialect's verifier.
40  return emitDefiniteFailure() << "op does not have interpreted semantics yet";
41 }
42 
44  if (getOperands().size() != getBody().getNumArguments())
45  return emitOpError(
46  "must have the same number of block arguments as operands");
47 
48  for (auto &op : getBody().getOps()) {
49  if (!isa<mlir::smt::SMTDialect>(op.getDialect()))
50  return emitOpError(
51  "ops contained in region should belong to SMT-dialect");
52  }
53 
54  return success();
55 }
The result of a transform IR operation application.
Local mapping between values defined by a specific op implementing the TransformOpInterface and the p...
This is a special rewriter to be used in transform op implementations, providing additional helper fu...
The state maintained across applications of various ops implementing the TransformOpInterface.
void onlyReadsHandle(MutableArrayRef< OpOperand > handles, SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
Include the generated interface declarations.
DiagnosedDefiniteFailure emitDefiniteFailure(Location loc, const Twine &message={})
Emits a definite failure with the given message.
LogicalResult verify(Operation *op, bool verifyRecursively=true)
Perform (potentially expensive) checks of invariants, used to detect compiler bugs,...
Definition: Verifier.cpp:423