17#include "llvm/ADT/TypeSwitch.h"
18#include "llvm/Support/Compiler.h"
29#define GET_TYPEDEF_CLASSES
30#include "mlir/Dialect/Transform/IR/TransformTypes.cpp.inc"
32void transform::TransformDialect::initializeTypes() {
34#define GET_TYPEDEF_LIST
35#include "mlir/Dialect/Transform/IR/TransformTypes.cpp.inc"
44transform::AffineMapParamType::checkPayload(
Location loc,
47 if (!mlir::isa<AffineMapAttr>(attr)) {
48 return emitSilenceableError(loc)
49 <<
"expected affine map attribute, got " << attr;
60transform::AnyOpType::checkPayload(
Location loc,
70transform::AnyValueType::checkPayload(
Location loc,
80transform::OperationType::checkPayload(
Location loc,
84 if (opName != op->getName()) {
86 emitSilenceableError(loc)
87 <<
"incompatible payload operation name expected " << opName <<
" vs "
88 << op->getName() <<
" -> " << *op;
89 diag.attachNote(op->getLoc()) <<
"payload operation";
102transform::AnyParamType::checkPayload(
Location loc,
112transform::NormalizedOpType::checkPayload(
Location loc,
116 llvm::filter_to_vector(payload, [
this](
Operation *op) {
117 auto normalFormCheckedOp = dyn_cast<NormalFormCheckedOpInterface>(op);
118 if (!normalFormCheckedOp)
122 normalFormCheckedOp.getCheckedNormalForms(checkedNormalForms);
123 return !llvm::all_of(
124 this->getNormalForms(), [&](NormalFormAttrInterface form) {
125 return llvm::is_contained(checkedNormalForms, form);
128 return detail::checkNormalForms(getNormalForms(), payloadsToCheck);
131LogicalResult transform::NormalizedOpType::verify(
134 return detail::verifyNormalFormList(
emitError, normalForms);
144 IntegerType intType = llvm::dyn_cast<IntegerType>(type);
145 if (!intType || intType.getWidth() > 64)
146 return emitError() <<
"only supports integer types with width <=64";
151transform::ParamType::checkPayload(
Location loc,
154 auto integerAttr = llvm::dyn_cast<IntegerAttr>(attr);
156 return emitSilenceableError(loc)
157 <<
"expected parameter to be an integer attribute, got " << attr;
159 if (integerAttr.getType() !=
getType()) {
160 return emitSilenceableError(loc)
161 <<
"expected the type of the parameter attribute ("
162 << integerAttr.getType() <<
") to match the parameter type ("
174transform::TypeParamType::checkPayload(
Location loc,
177 if (!mlir::isa<TypeAttr>(attr)) {
178 return emitSilenceableError(loc)
179 <<
"expected type attribute, got " << attr;
static std::string diag(const llvm::Value &value)
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