MLIR 22.0.0git
mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyModule Class Reference

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

Inheritance diagram for mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyModule:

Public Member Functions

 PyModule (PyModule &)=delete
 PyModule (PyMlirContext &&)=delete
 ~PyModule ()
MlirModule get ()
 Gets the backing MlirModule.
PyModuleRef getRef ()
 Gets a strong reference to this module.
nanobind::object getCapsule ()
 Gets a capsule wrapping the void* within the MlirModule.
void clearMlirModule ()
Public Member Functions inherited from mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::BaseContextObject
 BaseContextObject (PyMlirContextRef ref)
PyMlirContextRefgetContext ()
 Accesses the context reference.

Static Public Member Functions

static PyModuleRef forModule (MlirModule module)
 Returns a PyModule reference for the given MlirModule.
static nanobind::object createFromCapsule (nanobind::object capsule)
 Creates a PyModule from the MlirModule wrapped by a capsule.

Detailed Description

Definition at line 539 of file IRCore.h.

Constructor & Destructor Documentation

◆ PyModule() [1/2]

mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyModule::PyModule ( PyModule & )
delete

References PyModule().

Referenced by createFromCapsule(), PyModule(), and PyModule().

◆ PyModule() [2/2]

mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyModule::PyModule ( PyMlirContext && )
delete

References PyModule().

◆ ~PyModule()

mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyModule::~PyModule ( )

Member Function Documentation

◆ clearMlirModule()

void mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyModule::clearMlirModule ( )
inline

Definition at line 567 of file IRCore.h.

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().

◆ createFromCapsule()

nb::object mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyModule::createFromCapsule ( nanobind::object capsule)
static

Creates a PyModule from the MlirModule wrapped by a capsule.

Note this returns a new object BUT clearMlirModule() must be called to prevent double-frees (of the underlying mlir::Module).

Definition at line 914 of file IRCore.cpp.

References PyModule().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().

◆ forModule()

PyModuleRef mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyModule::forModule ( MlirModule module)
static

Returns a PyModule reference for the given MlirModule.

This always returns a new object.

Definition at line 889 of file IRCore.cpp.

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().

◆ get()

MlirModule mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyModule::get ( )
inline

Gets the backing MlirModule.

Definition at line 549 of file IRCore.h.

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateRewriteSubmodule().

◆ getCapsule()

nb::object mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyModule::getCapsule ( )

Gets a capsule wrapping the void* within the MlirModule.

Note that the module does not (yet) provide a corresponding factory for constructing from a capsule as that would require uniquing PyModule instances, which is not currently done.

Definition at line 921 of file IRCore.cpp.

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().

◆ getRef()

PyModuleRef mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyModule::getRef ( )
inline

Gets a strong reference to this module.

Definition at line 552 of file IRCore.h.


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