//===- BasicPyDialect.td - Basic python dialect ------------*- tablegen -*-===// // // This file is licensed under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef NPCOMP_DIALECT_BASICPY_BASICPY_DIALECT #define NPCOMP_DIALECT_BASICPY_BASICPY_DIALECT include "mlir/IR/OpBase.td" //===----------------------------------------------------------------------===// // Dialect definition //===----------------------------------------------------------------------===// def Basicpy_Dialect : Dialect { let name = "basicpy"; let summary = "Basic Python dialect"; let description = [{ Core types and ops }]; let cppNamespace = "Basicpy"; } //===----------------------------------------------------------------------===// // Op templates //===----------------------------------------------------------------------===// class Basicpy_Op traits = []> : Op { let parser = [{ return parse$cppClass(parser, &result); }]; let printer = [{ return print$cppClass(p, *this); }]; } //===----------------------------------------------------------------------===// // Dialect types //===----------------------------------------------------------------------===// def Basicpy_SlotObjectType : DialectType()">, "Slot object"> { let typeDescription = [{ Type for built-in objects which have a fixed number of slots and a type name in the system catalog of types. In some ways, this resembles a namedtuple, but it is used for built-in custom objects. }]; } def Basicpy_NoneType : DialectType()">, "None type">, BuildableType<"$_builder.getType<::mlir::NPCOMP::Basicpy::NoneType>()"> { let typeDescription = [{ Type of the Python 'None' value. }]; } def Basicpy_EllipsisType : DialectType()">, "Ellipsis type">, BuildableType<"$_builder.getType<::mlir::NPCOMP::Basicpy::EllipsisType>()"> { let typeDescription = [{ Type of the Python 'Ellipsis' value. }]; } //===----------------------------------------------------------------------===// // Type predicates //===----------------------------------------------------------------------===// def Basicpy_SingletonType : AnyTypeOf<[ Basicpy_NoneType, Basicpy_EllipsisType ]>; // A predicate to determine whether a Type is a SlotObject of a given // className and arity. Does no checking of slot types. class Basicpy_SlotObjectOfClassArity : And<[ Basicpy_SlotObjectType.predicate, CPred< "$_self.cast<::mlir::NPCOMP::Basicpy::SlotObjectType>().isOfClassArity(\"" # className # "\", " # arity # ")"> ]>; // Type representing a 'slice' object, which mirrors the Python built-in // slice class. def Basicpy_SliceSlotObjectType : Type>; #endif // NPCOMP_DIALECT_BASICPY_BASICPY_DIALECT