Lines Matching defs:constraint

169   /// Create a user defined native constraint for a constraint imported from
178 createODSNativePDLLConstraintDecl(const tblgen::Constraint &constraint,
203 /// Parse a UserConstraintDecl. `isInline` signals if the constraint is being
286 /// Parse the constraint reference list for a variable decl.
290 /// Parse the expression used within a type constraint, e.g. Attr<type-expr>.
293 /// Try to parse a single reference to a constraint. `typeConstraint` is the
294 /// location of a previously parsed type constraint for the entity that will
295 /// be constrained by the parsed constraint. `existingConstraints` are any
297 /// that will be constrained by this constraint. `allowInlineTypeConstraints`
304 /// Try to parse the constraint for a UserConstraintDecl/UserRewriteDecl
306 /// allow inline type constraints, and only permit a single constraint.
384 const ast::ConstraintRef &constraint);
386 /// Validate the constraints used to constraint a variable decl.
389 /// the constraints. Returns success if the constraint list is valid, failure
394 /// Validate a single reference to a constraint. `inferredType` contains the
396 /// by the constraint. Returns success if the constraint is valid, failure
875 // Insert a type constraint into the ODS context.
880 cst.constraint.getUniqueDefName(),
881 processDoc(cst.constraint.getSummary()), cst.constraint.getCppType());
932 tblgen::Attribute constraint(def);
934 constraint, convertLocToRange(def->getLoc().front()), attrTy,
935 constraint.getStorageType()));
942 tblgen::TypeConstraint constraint(def);
944 constraint, convertLocToRange(def->getLoc().front()), typeTy,
945 constraint.getCppType()));
984 // Build the native constraint.
996 Parser::createODSNativePDLLConstraintDecl(const tblgen::Constraint &constraint,
1003 "return ::mlir::success(" + constraint.getConditionTemplate() + ");",
1007 // constraint. It would be nice to do this lazily, but TableGen information is
1011 StringRef desc = constraint.getDescription();
1013 constraint.getSummary() +
1014 (desc.empty() ? "" : ("\n\n" + constraint.getDescription())));
1018 constraint.getUniqueDefName(), codeBlock, loc, type, nativeType,
1114 parseToken(Token::colon, "expected `:` before argument constraint")))
1129 // If it wasn't a constraint, parse the result similarly to a variable. If
1137 "expected `:` before result constraint")))
1148 // If it isn't named, we parse the constraint directly and create an unnamed
1165 ParserContext::Constraint, "constraint", isInline);
1186 // Parse the body of the constraint. The body is either defined as a compound
1331 // Check to see which type of constraint this is. If the constraint contains a
1594 "expected `>` after variable type constraint")))
1642 FailureOr<ast::ConstraintRef> constraint = parseConstraint(
1644 if (failed(constraint))
1646 constraints.push_back(*constraint);
1650 // Check to see if this is a single constraint, or a list.
1658 return parseToken(Token::r_square, "expected `]` after constraint list");
1676 *typeConstraint, "see previous constraint location here");
1690 // Check for a type constraint.
1720 // Check for a type constraint.
1731 // Check for a type constraint.
1741 // Handle an inline constraint.
1751 // Lookup the referenced constraint.
1754 return emitError(loc, "unknown reference to constraint `" +
1758 // Handle a reference to a proper constraint.
1763 loc, "invalid reference to non-constraint", cstDecl->getLoc(),
1766 // Handle single entity constraint code completion.
1778 return emitError(loc, "expected identifier constraint");
1965 return emitError("expected native constraint");
2235 // Underscore expressions require a constraint list.
2352 for (ast::ConstraintRef constraint : constraints) {
2354 TypeSwitch<const ast::Node *, LogicalResult>(constraint.constraint)
2359 constraint.referenceLoc,
2544 // constraint or an initializer expression.
2560 // been resolved from the constraint list.
2564 "the type of a variable must be inferable from the constraint "
2585 const ast::ConstraintRef &constraint) {
2587 if (failed(validateVariableConstraint(constraint, argType)))
2589 return defineVariableDecl(name, loc, argType, constraint);
2604 if (const auto *cst = dyn_cast<ast::AttrConstraintDecl>(ref.constraint)) {
2611 dyn_cast<ast::OpConstraintDecl>(ref.constraint)) {
2614 } else if (isa<ast::TypeConstraintDecl>(ref.constraint)) {
2616 } else if (isa<ast::TypeRangeConstraintDecl>(ref.constraint)) {
2619 dyn_cast<ast::ValueConstraintDecl>(ref.constraint)) {
2626 dyn_cast<ast::ValueRangeConstraintDecl>(ref.constraint)) {
2633 dyn_cast<ast::UserConstraintDecl>(ref.constraint)) {
2637 "`Constraint`s applied via a variable constraint "
2641 "see definition of constraint here");
2645 llvm_unreachable("unknown constraint type");
2648 // Check that the constraint type is compatible with the current inferred
2656 llvm::formatv("constraint type `{0}` is incompatible "
2667 "expected expression of `Type` in type constraint");
2677 "expected expression of `TypeRange` in type constraint");
2975 // Zero-values is a valid constraint on the operation.