MLIR 22.0.0git
mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteValue< DerivedTy > Class Template Reference

CRTP base class for Python MLIR values that subclass Value and should be castable from it. More...

#include "mlir/Bindings/Python/IRCore.h"

Inheritance diagram for mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteValue< DerivedTy >:

Public Types

using ClassTy = nanobind::class_<DerivedTy, PyValue>
using IsAFunctionTy = bool (*)(MlirValue)
using GetTypeIDFunctionTy = MlirTypeID (*)()
using Base = PyConcreteValue

Public Member Functions

 PyConcreteValue ()=default
 PyConcreteValue (PyOperationRef operationRef, MlirValue value)
 PyConcreteValue (PyValue &orig)
Public Member Functions inherited from mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyValue
virtual ~PyValue ()=default
 PyValue (PyOperationRef parentOperation, MlirValue value)
 operator MlirValue () const
MlirValue get ()
PyOperationRefgetParentOperation ()
void checkValid ()
nanobind::object getCapsule ()
 Gets a capsule wrapping the void* within the MlirValue.
nanobind::typed< nanobind::object, PyValuemaybeDownCast ()

Static Public Member Functions

static MlirValue castFrom (PyValue &orig)
 Attempts to cast the original value to the derived type and throws on type mismatches.
static void bind (nanobind::module_ &m)
 Binds the Python module objects to functions of this class.
static void bindDerived (ClassTy &m)
 Implemented by derived classes to add methods to the Python subclass.
Static Public Member Functions inherited from mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyValue
static PyValue createFromCapsule (nanobind::object capsule)
 Creates a PyValue from the MlirValue wrapped by a capsule.

Static Public Attributes

static constexpr GetTypeIDFunctionTy getTypeIdFunction = nullptr

Detailed Description

template<typename DerivedTy>
class mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteValue< DerivedTy >

CRTP base class for Python MLIR values that subclass Value and should be castable from it.

The value hierarchy is one level deep and is not supposed to accommodate other levels unless core MLIR changes.

Definition at line 1523 of file IRCore.h.

Member Typedef Documentation

◆ Base

Definition at line 1533 of file IRCore.h.

◆ ClassTy

template<typename DerivedTy>
using mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteValue< DerivedTy >::ClassTy = nanobind::class_<DerivedTy, PyValue>

Definition at line 1529 of file IRCore.h.

◆ GetTypeIDFunctionTy

template<typename DerivedTy>
using mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteValue< DerivedTy >::GetTypeIDFunctionTy = MlirTypeID (*)()

Definition at line 1531 of file IRCore.h.

◆ IsAFunctionTy

template<typename DerivedTy>
using mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteValue< DerivedTy >::IsAFunctionTy = bool (*)(MlirValue)

Definition at line 1530 of file IRCore.h.

Constructor & Destructor Documentation

◆ PyConcreteValue() [1/3]

template<typename DerivedTy>
mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteValue< DerivedTy >::PyConcreteValue ( )
default

Referenced by PyConcreteValue().

◆ PyConcreteValue() [2/3]

template<typename DerivedTy>
mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteValue< DerivedTy >::PyConcreteValue ( PyOperationRef operationRef,
MlirValue value )
inline

◆ PyConcreteValue() [3/3]

Member Function Documentation

◆ bind()

template<typename DerivedTy>
void mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteValue< DerivedTy >::bind ( nanobind::module_ & m)
inlinestatic

Binds the Python module objects to functions of this class.

Definition at line 1557 of file IRCore.h.

References mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyGlobals::get(), MLIR_PYTHON_MAYBE_DOWNCAST_ATTR, and mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyValue::PyValue().

◆ bindDerived()

template<typename DerivedTy>
void mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteValue< DerivedTy >::bindDerived ( ClassTy & m)
inlinestatic

Implemented by derived classes to add methods to the Python subclass.

Definition at line 1583 of file IRCore.h.

◆ castFrom()

template<typename DerivedTy>
MlirValue mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteValue< DerivedTy >::castFrom ( PyValue & orig)
inlinestatic

Attempts to cast the original value to the derived type and throws on type mismatches.

Definition at line 1543 of file IRCore.h.

References mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyValue::get(), and mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyValue::PyValue().

Referenced by PyConcreteValue().

Member Data Documentation

◆ getTypeIdFunction

Definition at line 1532 of file IRCore.h.


The documentation for this class was generated from the following file: