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

An insertion point maintains a pointer to a Block and a reference operation. More...

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

Public Member Functions

 PyInsertionPoint (const PyBlock &block)
 Creates an insertion point positioned after the last operation in the block, but still inside the block.
 PyInsertionPoint (PyOperationBase &beforeOperationBase)
 Creates an insertion point positioned before a reference operation.
 PyInsertionPoint (PyOperationRef beforeOperationRef)
 Creates an insertion point positioned before a reference operation.
void insert (PyOperationBase &operationBase)
 Inserts an operation.
void contextExit (const nanobind::object &excType, const nanobind::object &excVal, const nanobind::object &excTb)
PyBlockgetBlock ()
std::optional< PyOperationRef > & getRefOperation ()

Static Public Member Functions

static PyInsertionPoint atBlockBegin (PyBlock &block)
 Shortcut to create an insertion point at the beginning of the block.
static PyInsertionPoint atBlockTerminator (PyBlock &block)
 Shortcut to create an insertion point before the block terminator.
static PyInsertionPoint after (PyOperationBase &op)
 Shortcut to create an insertion point to the node after the specified operation.
static nanobind::object contextEnter (nanobind::object insertionPoint)
 Enter and exit the context manager.

Detailed Description

An insertion point maintains a pointer to a Block and a reference operation.

Calls to insert() will insert a new operation before the reference operation. If the reference operation is null, then appends to the end of the block.

Definition at line 834 of file IRCore.h.

Constructor & Destructor Documentation

◆ PyInsertionPoint() [1/3]

mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInsertionPoint::PyInsertionPoint ( const PyBlock & block)

Creates an insertion point positioned after the last operation in the block, but still inside the block.

Definition at line 1815 of file IRCore.cpp.

Referenced by after(), atBlockTerminator(), and contextEnter().

◆ PyInsertionPoint() [2/3]

mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInsertionPoint::PyInsertionPoint ( PyOperationBase & beforeOperationBase)

Creates an insertion point positioned before a reference operation.

Definition at line 1817 of file IRCore.cpp.

◆ PyInsertionPoint() [3/3]

mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInsertionPoint::PyInsertionPoint ( PyOperationRef beforeOperationRef)

Creates an insertion point positioned before a reference operation.

Definition at line 1821 of file IRCore.cpp.

Member Function Documentation

◆ after()

PyInsertionPoint mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInsertionPoint::after ( PyOperationBase & op)
static

Shortcut to create an insertion point to the node after the specified operation.

Definition at line 1872 of file IRCore.cpp.

References PyInsertionPoint().

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

◆ atBlockBegin()

PyInsertionPoint mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInsertionPoint::atBlockBegin ( PyBlock & block)
static

Shortcut to create an insertion point at the beginning of the block.

Definition at line 1850 of file IRCore.cpp.

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

◆ atBlockTerminator()

PyInsertionPoint mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInsertionPoint::atBlockTerminator ( PyBlock & block)
static

Shortcut to create an insertion point before the block terminator.

Definition at line 1863 of file IRCore.cpp.

References PyInsertionPoint().

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

◆ contextEnter()

nb::object mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInsertionPoint::contextEnter ( nanobind::object insertionPoint)
static

Enter and exit the context manager.

Definition at line 1885 of file IRCore.cpp.

References PyInsertionPoint().

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

◆ contextExit()

void mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInsertionPoint::contextExit ( const nanobind::object & excType,
const nanobind::object & excVal,
const nanobind::object & excTb )

◆ getBlock()

PyBlock & mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInsertionPoint::getBlock ( )
inline

Definition at line 861 of file IRCore.h.

Referenced by insert().

◆ getRefOperation()

std::optional< PyOperationRef > & mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInsertionPoint::getRefOperation ( )
inline

Definition at line 862 of file IRCore.h.

◆ insert()

void mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInsertionPoint::insert ( PyOperationBase & operationBase)

Inserts an operation.

Definition at line 1824 of file IRCore.cpp.

References getBlock().

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


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