MLIR
22.0.0git
|
CRTP base classes for Python attributes that subclass Attribute and should be castable from it (i.e. More...
#include "Bindings/Python/IRModule.h"
Public Types | |
using | ClassTy = nanobind::class_< DerivedTy, BaseTy > |
using | IsAFunctionTy = bool(*)(MlirAttribute) |
using | GetTypeIDFunctionTy = MlirTypeID(*)() |
Public Member Functions | |
PyConcreteAttribute ()=default | |
PyConcreteAttribute (PyMlirContextRef contextRef, MlirAttribute attr) | |
PyConcreteAttribute (PyAttribute &orig) | |
![]() | |
PyAttribute (PyMlirContextRef contextRef, MlirAttribute attr) | |
bool | operator== (const PyAttribute &other) const |
operator MlirAttribute () const | |
MlirAttribute | get () const |
nanobind::object | getCapsule () |
Gets a capsule wrapping the void* within the MlirAttribute. More... | |
nanobind::object | maybeDownCast () |
![]() | |
BaseContextObject (PyMlirContextRef ref) | |
PyMlirContextRef & | getContext () |
Accesses the context reference. More... | |
Static Public Member Functions | |
static MlirAttribute | castFrom (PyAttribute &orig) |
static void | bind (nanobind::module_ &m, PyType_Slot *slots=nullptr) |
static void | bindDerived (ClassTy &m) |
Implemented by derived classes to add methods to the Python subclass. More... | |
![]() | |
static PyAttribute | createFromCapsule (const nanobind::object &capsule) |
Creates a PyAttribute from the MlirAttribute wrapped by a capsule. More... | |
Static Public Attributes | |
static constexpr GetTypeIDFunctionTy | getTypeIdFunction = nullptr |
CRTP base classes for Python attributes that subclass Attribute and should be castable from it (i.e.
via something like StringAttr(attr)). By default, attribute class hierarchies are one level deep (i.e. a concrete attribute class extends PyAttribute); however, intermediate python-visible base classes can be modeled by specifying a BaseTy.
Definition at line 1060 of file IRModule.h.
using mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::ClassTy = nanobind::class_<DerivedTy, BaseTy> |
Definition at line 1065 of file IRModule.h.
using mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::GetTypeIDFunctionTy = MlirTypeID (*)() |
Definition at line 1067 of file IRModule.h.
using mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::IsAFunctionTy = bool (*)(MlirAttribute) |
Definition at line 1066 of file IRModule.h.
|
default |
|
inline |
Definition at line 1071 of file IRModule.h.
|
inline |
Definition at line 1073 of file IRModule.h.
|
inlinestatic |
Definition at line 1089 of file IRModule.h.
References mlir::python::PyGlobals::get(), mlir::PyPrintAccumulator::getCallback(), mlir::python::BaseContextObject::getContext(), mlir::PyPrintAccumulator::getUserData(), mlir::PyPrintAccumulator::join(), mlir::python::PyType::maybeDownCast(), mlirAttributeGetType(), mlirAttributePrint(), mlir::PyPrintAccumulator::parts, and mlir::python::PyGlobals::registerTypeCaster().
|
inlinestatic |
Implemented by derived classes to add methods to the Python subclass.
Definition at line 1147 of file IRModule.h.
|
inlinestatic |
Definition at line 1076 of file IRModule.h.
|
staticconstexpr |
Definition at line 1068 of file IRModule.h.