9#ifndef MLIR_TOOLS_PDLL_AST_TYPES_H_
10#define MLIR_TOOLS_PDLL_AST_TYPES_H_
46 template <
typename ImplT,
typename BaseT = Type>
63 explicit operator bool()
const {
return impl; }
86 return static_cast<const T *
>(
impl);
141 std::optional<StringRef> name = std::nullopt,
146 std::optional<StringRef>
getName()
const;
177 using RangeType::RangeType;
193 using RangeType::RangeType;
297 return llvm::hash_value(val.
getImpl());
307template <
typename To,
typename From>
311 std::is_same_v<mlir::pdll::ast::Type, std::remove_const_t<From>> ||
312 std::is_base_of_v<mlir::pdll::ast::Type, From>>>
318 if constexpr (std::is_base_of_v<To, From>) {
321 return To::classof(ty);
#define MLIR_DECLARE_EXPLICIT_TYPE_ID(CLASS_NAME)
This class provides an efficient unique identifier for a specific C++ type.
static TypeID get()
Construct a type info object for the given type T.
This class represents a PDLL type that corresponds to an mlir::Attribute.
static AttributeType get(Context &context)
Return an instance of the Attribute type.
This class represents a PDLL type that corresponds to a constraint.
static ConstraintType get(Context &context)
Return an instance of the Constraint type.
This class represents the main context of the PDLL AST.
This class represents a PDLL type that corresponds to an mlir::Operation.
const ods::Operation * getODSOperation() const
Return the ODS operation that this type refers to, or nullptr if the ODS operation is unknown.
static OperationType get(Context &context, std::optional< StringRef > name=std::nullopt, const ods::Operation *odsOp=nullptr)
Return an instance of the Operation type with an optional operation name.
std::optional< StringRef > getName() const
Return the name of this operation type, or std::nullopt if it doesn't have on.
This class represents a PDLL type that corresponds to a range of elements with a given element type.
Type getElementType() const
Return the element type of this range.
static RangeType get(Context &context, Type elementType)
Return an instance of the Range type with the given element type.
This class represents a PDLL type that corresponds to a rewrite reference.
static RewriteType get(Context &context)
Return an instance of the Rewrite type.
This class represents a PDLL tuple type, i.e.
size_t size() const
Return the number of elements within this tuple.
ArrayRef< StringRef > getElementNames() const
Return the element names of this tuple.
bool empty() const
Return if the tuple has no elements.
ArrayRef< Type > getElementTypes() const
Return the element types of this tuple.
static TupleType get(Context &context, ArrayRef< Type > elementTypes, ArrayRef< StringRef > elementNames)
Return an instance of the Tuple type.
This class represents a PDLL type that corresponds to an mlir::TypeRange.
static TypeRangeType get(Context &context)
Return an instance of the TypeRange type.
static bool classof(Type type)
Provide type casting support.
This class represents a PDLL type that corresponds to an mlir::Type.
static TypeType get(Context &context)
Return an instance of the Type type.
This class provides several utilities when defining derived type classes.
TypeBase< ImplT, BaseT > Base
static bool classof(Type type)
Provide type casting support.
TypeID getTypeID() const
Return the TypeID instance of this type.
bool operator!=(const Type &other) const
Storage * getImpl() const
Return the internal storage instance of this type.
void print(raw_ostream &os) const
Print this type to the given stream.
Type(Storage *impl=nullptr)
const T * getImplAs() const
Return the internal storage instance of this type reinterpreted as the given derived storage type.
Type refineWith(Type other) const
Try to refine this type with the one provided.
bool operator==(const Type &other) const
This class represents a PDLL type that corresponds to an mlir::ValueRange.
static bool classof(Type type)
Provide type casting support.
static ValueRangeType get(Context &context)
Return an instance of the ValueRange type.
This class represents a PDLL type that corresponds to an mlir::Value.
static ValueType get(Context &context)
Return an instance of the Value type.
This class provides an ODS representation of a specific operation.
The OpAsmOpInterface, see OpAsmInterface.td for more details.
llvm::hash_code hash_value(Type type)
raw_ostream & operator<<(raw_ostream &os, Type type)
Include the generated interface declarations.
llvm::DenseMapInfo< T, Enable > DenseMapInfo
static bool isPossible(mlir::pdll::ast::Type ty)
static To doCast(mlir::pdll::ast::Type ty)
static bool isEqual(mlir::pdll::ast::Type lhs, mlir::pdll::ast::Type rhs)
static unsigned getHashValue(mlir::pdll::ast::Type val)
static mlir::pdll::ast::Type getTombstoneKey()
static mlir::pdll::ast::Type getEmptyKey()