13 #include "llvm/ADT/TypeSwitch.h"
22 #define GET_TYPEDEF_CLASSES
23 #include "mlir/Dialect/PDL/IR/PDLOpsTypes.cpp.inc"
29 void PDLDialect::registerTypes() {
31 #define GET_TYPEDEF_LIST
32 #include "mlir/Dialect/PDL/IR/PDLOpsTypes.cpp.inc"
41 if (parseResult.has_value())
59 return llvm::isa<PDLDialect>(type.
getDialect());
63 if (
auto rangeType = llvm::dyn_cast<RangeType>(type))
64 return rangeType.getElementType();
81 if (llvm::isa<RangeType>(elementType)) {
83 <<
"element of pdl.range cannot be another range, but got"
98 if (!llvm::isa<PDLType>(elementType) || llvm::isa<RangeType>(elementType)) {
100 <<
"expected element of pdl.range to be one of [!pdl.attribute, "
101 "!pdl.operation, !pdl.type, !pdl.value], but got "
static Type getElementType(Type type)
Determine the element type of type.
static LLVM_ATTRIBUTE_UNUSED OptionalParseResult generatedTypeParser(AsmParser &parser, StringRef *mnemonic, Type &value)
These are unused for now.
static LLVM_ATTRIBUTE_UNUSED LogicalResult generatedTypePrinter(Type def, AsmPrinter &printer)
static Type parsePDLType(AsmParser &parser)
static void print(spirv::VerCapExtAttr triple, DialectAsmPrinter &printer)
This base class exposes generic asm parser hooks, usable across the various derived parsers.
virtual InFlightDiagnostic emitError(SMLoc loc, const Twine &message={})=0
Emit a diagnostic at the specified location and return failure.
virtual ParseResult parseLess()=0
Parse a '<' token.
virtual SMLoc getCurrentLocation()=0
Get the location of the next token and store it into the argument.
virtual SMLoc getNameLoc() const =0
Return the location of the original name token.
virtual ParseResult parseGreater()=0
Parse a '>' token.
This base class exposes generic asm printer hooks, usable across the various derived printers.
This class represents a diagnostic that is inflight and set to be reported.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Dialect & getDialect() const
Get the dialect this type is registered to.
static bool classof(Type type)
Type getRangeElementTypeOrSelf(Type type)
If the given type is a range, return its element type, otherwise return the type itself.
QueryRef parse(llvm::StringRef line, const QuerySession &qs)
Include the generated interface declarations.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
LogicalResult verify(Operation *op, bool verifyRecursively=true)
Perform (potentially expensive) checks of invariants, used to detect compiler bugs,...