| 664 | //===----------------------------------------------------------------------===// |
| 665 | |
| 666 | static ParseResult parseComparisonPredicate(OpAsmParser &parser, |
| 667 | ComparisonPredicateAttr &attr) { |
| 668 | StringRef enumKeyword; |
| 669 | SMLoc loc = parser.getCurrentLocation(); |
| 670 | if (failed(parser.parseKeyword(&enumKeyword))) |
| 671 | return parser.emitError(loc) |
| 672 | << "expected 'comparison_predicate' to be one " |
| 673 | "of: {'equal', 'not_equal', 'less_than', 'less_than_or_equal', " |
| 674 | "'greater_than', 'greater_than_or_equal'}"; |
| 675 | auto maybeEnum = symbolizeComparisonPredicate(enumKeyword); |
| 676 | if (!maybeEnum) |
| 677 | return parser.emitError(loc) |
| 678 | << "expected 'comparison_predicate' to be one " |
| 679 | "of: {'equal', 'not_equal', 'less_than', 'less_than_or_equal', " |
| 680 | "'greater_than', 'greater_than_or_equal'}"; |
| 681 | attr = ComparisonPredicateAttr::get(parser.getContext(), *maybeEnum); |
| 682 | return success(); |
| 683 | } |
| 684 | |
| 685 | static void printComparisonPredicate(OpAsmPrinter &p, Operation *op, |
| 686 | ComparisonPredicateAttr attr) { |