DeclareOpInterfaceMethods<VerifyConstraintInterface>] # traits> {
}
-def IRDL_Is : IRDL_ConstraintOp<"is",
+def IRDL_IsOp : IRDL_ConstraintOp<"is",
[ParentOneOf<["TypeOp", "AttributeOp", "OperationOp"]>, Pure]> {
let summary = "Constraints an attribute/type to be a specific attribute instance";
let description = [{
let assemblyFormat = " $expected ` ` attr-dict ";
}
-def IRDL_Parametric : IRDL_ConstraintOp<"parametric",
+def IRDL_ParametricOp : IRDL_ConstraintOp<"parametric",
[ParentOneOf<["TypeOp", "AttributeOp", "OperationOp"]>, Pure]> {
let summary = "Constraints an attribute/type base and its parameters";
let description = [{
let assemblyFormat = " $base_type `<` $args `>` ` ` attr-dict ";
}
-def IRDL_Any : IRDL_ConstraintOp<"any",
+def IRDL_AnyOp : IRDL_ConstraintOp<"any",
[ParentOneOf<["TypeOp", "AttributeOp", "OperationOp"]>]> {
let summary = "Accept any type or attribute";
let description = [{
let assemblyFormat = " attr-dict ";
}
-def IRDL_AnyOf : IRDL_ConstraintOp<"any_of",
+def IRDL_AnyOfOp : IRDL_ConstraintOp<"any_of",
[ParentOneOf<["TypeOp", "AttributeOp", "OperationOp"]>,
SameOperandsAndResultType]> {
let summary = "Constraints to the union of the provided constraints";
let assemblyFormat = [{ `(` $args `)` ` ` attr-dict }];
}
-def IRDL_AllOf : IRDL_ConstraintOp<"all_of",
+def IRDL_AllOfOp : IRDL_ConstraintOp<"all_of",
[ParentOneOf<["TypeOp", "AttributeOp", "OperationOp"]>,
SameOperandsAndResultType]> {
let summary = "Constraints to the intersection of the provided constraints";
using namespace mlir;
using namespace mlir::irdl;
-std::unique_ptr<Constraint> Is::getVerifier(
+std::unique_ptr<Constraint> IsOp::getVerifier(
ArrayRef<Value> valueToConstr,
DenseMap<TypeOp, std::unique_ptr<DynamicTypeDefinition>> const &types,
DenseMap<AttributeOp, std::unique_ptr<DynamicAttrDefinition>> const
return std::make_unique<IsConstraint>(getExpectedAttr());
}
-std::unique_ptr<Constraint> Parametric::getVerifier(
+std::unique_ptr<Constraint> ParametricOp::getVerifier(
ArrayRef<Value> valueToConstr,
DenseMap<TypeOp, std::unique_ptr<DynamicTypeDefinition>> const &types,
DenseMap<AttributeOp, std::unique_ptr<DynamicAttrDefinition>> const
"either a type or an attribute definition");
}
-std::unique_ptr<Constraint> AnyOf::getVerifier(
+std::unique_ptr<Constraint> AnyOfOp::getVerifier(
ArrayRef<Value> valueToConstr,
DenseMap<TypeOp, std::unique_ptr<DynamicTypeDefinition>> const &types,
DenseMap<AttributeOp, std::unique_ptr<DynamicAttrDefinition>> const
return std::make_unique<AnyOfConstraint>(constraints);
}
-std::unique_ptr<Constraint> AllOf::getVerifier(
+std::unique_ptr<Constraint> AllOfOp::getVerifier(
ArrayRef<Value> valueToConstr,
DenseMap<TypeOp, std::unique_ptr<DynamicTypeDefinition>> const &types,
DenseMap<AttributeOp, std::unique_ptr<DynamicAttrDefinition>> const
return std::make_unique<AllOfConstraint>(constraints);
}
-std::unique_ptr<Constraint> Any::getVerifier(
+std::unique_ptr<Constraint> AnyOp::getVerifier(
ArrayRef<Value> valueToConstr,
DenseMap<TypeOp, std::unique_ptr<DynamicTypeDefinition>> const &types,
DenseMap<AttributeOp, std::unique_ptr<DynamicAttrDefinition>> const
SmallPtrSet<Operation *, 4> ¶mIrdlOps,
SmallPtrSet<TypeID, 4> &isIds) {
// For `irdl.any_of`, we get the bases from all its arguments.
- if (auto anyOf = dyn_cast<AnyOf>(op)) {
+ if (auto anyOf = dyn_cast<AnyOfOp>(op)) {
bool has_any = false;
for (Value arg : anyOf.getArgs())
has_any &= getBases(arg.getDefiningOp(), paramIds, paramIrdlOps, isIds);
// For `irdl.all_of`, we get the bases from the first argument.
// This is restrictive, but we can relax it later if needed.
- if (auto allOf = dyn_cast<AllOf>(op))
+ if (auto allOf = dyn_cast<AllOfOp>(op))
return getBases(allOf.getArgs()[0].getDefiningOp(), paramIds, paramIrdlOps,
isIds);
// For `irdl.parametric`, we get directly the base from the operation.
- if (auto params = dyn_cast<Parametric>(op)) {
+ if (auto params = dyn_cast<ParametricOp>(op)) {
SymbolRefAttr symRef = params.getBaseType();
Operation *defOp = SymbolTable::lookupNearestSymbolFrom(op, symRef);
assert(defOp && "symbol reference should refer to an existing operation");
}
// For `irdl.is`, we get the base TypeID directly.
- if (auto is = dyn_cast<Is>(op)) {
+ if (auto is = dyn_cast<IsOp>(op)) {
Attribute expected = is.getExpected();
isIds.insert(expected.getTypeID());
return false;
// For `irdl.any`, we return `false` since we can match any type or attribute
// base.
- if (auto isA = dyn_cast<Any>(op))
+ if (auto isA = dyn_cast<AnyOp>(op))
return true;
llvm_unreachable("unknown IRDL constraint");
/// that they are disjoint between `parametric` and `is` operations.
/// This restriction will be relaxed in the future, when we will change our
/// algorithm to be non-greedy.
-static LogicalResult checkCorrectAnyOf(AnyOf anyOf) {
+static LogicalResult checkCorrectAnyOf(AnyOfOp anyOf) {
SmallPtrSet<TypeID, 4> paramIds;
SmallPtrSet<Operation *, 4> paramIrdlOps;
SmallPtrSet<TypeID, 4> isIds;
LogicalResult mlir::irdl::loadDialects(ModuleOp op) {
// First, check that all any_of constraints are in a correct form.
// This is to ensure we can do the verification correctly.
- WalkResult anyOfCorrects =
- op.walk([](AnyOf anyOf) { return (WalkResult)checkCorrectAnyOf(anyOf); });
+ WalkResult anyOfCorrects = op.walk(
+ [](AnyOfOp anyOf) { return (WalkResult)checkCorrectAnyOf(anyOf); });
if (anyOfCorrects.wasInterrupted())
return op.emitError("any_of constraints are not in the correct form");