15#include "llvm/Support/Compiler.h"
26#define GET_TYPEDEF_CLASSES
27#include "mlir/Dialect/Transform/IR/TransformTypes.cpp.inc"
29void transform::TransformDialect::initializeTypes() {
31#define GET_TYPEDEF_LIST
32#include "mlir/Dialect/Transform/IR/TransformTypes.cpp.inc"
41transform::AffineMapParamType::checkPayload(
Location loc,
44 if (!mlir::isa<AffineMapAttr>(attr)) {
45 return emitSilenceableError(loc)
46 <<
"expected affine map attribute, got " << attr;
57transform::AnyOpType::checkPayload(
Location loc,
67transform::AnyValueType::checkPayload(
Location loc,
77transform::OperationType::checkPayload(
Location loc,
81 if (opName != op->getName()) {
83 emitSilenceableError(loc)
84 <<
"incompatible payload operation name expected " << opName <<
" vs "
85 << op->getName() <<
" -> " << *op;
86 diag.attachNote(op->getLoc()) <<
"payload operation";
99transform::AnyParamType::checkPayload(
Location loc,
109transform::NormalizedOpType::checkPayload(
Location loc,
113 llvm::filter_to_vector(payload, [
this](
Operation *op) {
114 auto normalFormCheckedOp = dyn_cast<NormalFormCheckedOpInterface>(op);
115 if (!normalFormCheckedOp)
119 normalFormCheckedOp.getCheckedNormalForms(checkedNormalForms);
120 return !llvm::all_of(
121 this->getNormalForms(), [&](NormalFormAttrInterface form) {
122 return llvm::is_contained(checkedNormalForms, form);
125 return detail::checkNormalForms(getNormalForms(), payloadsToCheck);
128LogicalResult transform::NormalizedOpType::verify(
131 return detail::verifyNormalFormList(
emitError, normalForms);
141 IntegerType intType = llvm::dyn_cast<IntegerType>(type);
142 if (!intType || intType.getWidth() > 64)
143 return emitError() <<
"only supports integer types with width <=64";
148transform::ParamType::checkPayload(
Location loc,
151 auto integerAttr = llvm::dyn_cast<IntegerAttr>(attr);
153 return emitSilenceableError(loc)
154 <<
"expected parameter to be an integer attribute, got " << attr;
156 if (integerAttr.getType() !=
getType()) {
157 return emitSilenceableError(loc)
158 <<
"expected the type of the parameter attribute ("
159 << integerAttr.getType() <<
") to match the parameter type ("
171transform::TypeParamType::checkPayload(
Location loc,
174 if (!mlir::isa<TypeAttr>(attr)) {
175 return emitSilenceableError(loc)
176 <<
"expected type attribute, got " << attr;
This base class exposes generic asm parser hooks, usable across the various derived parsers.
This base class exposes generic asm printer hooks, usable across the various derived printers.
Attributes are known-constant values of operations.
The result of a transform IR operation application.
static DiagnosedSilenceableFailure success()
Constructs a DiagnosedSilenceableFailure in the success state.
This class represents a diagnostic that is inflight and set to be reported.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
MLIRContext * getContext() const
Return the context this location is uniqued in.
Operation is the basic unit of execution within MLIR.
This class implements Optional functionality for ParseResult.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Include the generated interface declarations.
Type getType(OpFoldResult ofr)
Returns the int type of the integer in ofr.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
llvm::function_ref< Fn > function_ref