MLIR  22.0.0git
Public Member Functions | Static Public Member Functions | List of all members
mlir::python::PyInsertionPoint Class Reference

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

#include "Bindings/Python/IRModule.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. More...
 
 PyInsertionPoint (PyOperationBase &beforeOperationBase)
 Creates an insertion point positioned before a reference operation. More...
 
void insert (PyOperationBase &operationBase)
 Inserts an operation. More...
 
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. More...
 
static PyInsertionPoint atBlockTerminator (PyBlock &block)
 Shortcut to create an insertion point before the block terminator. More...
 
static PyInsertionPoint after (PyOperationBase &op)
 Shortcut to create an insertion point to the node after the specified operation. More...
 
static nanobind::object contextEnter (nanobind::object insertionPoint)
 Enter and exit the context manager. More...
 

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 839 of file IRModule.h.

Constructor & Destructor Documentation

◆ PyInsertionPoint() [1/2]

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 2039 of file IRCore.cpp.

Referenced by after(), and atBlockBegin().

◆ PyInsertionPoint() [2/2]

PyInsertionPoint::PyInsertionPoint ( PyOperationBase beforeOperationBase)

Creates an insertion point positioned before a reference operation.

Definition at line 2041 of file IRCore.cpp.

Member Function Documentation

◆ after()

PyInsertionPoint PyInsertionPoint::after ( PyOperationBase op)
static

◆ atBlockBegin()

PyInsertionPoint PyInsertionPoint::atBlockBegin ( PyBlock block)
static

◆ atBlockTerminator()

PyInsertionPoint PyInsertionPoint::atBlockTerminator ( PyBlock block)
static

◆ contextEnter()

nb::object PyInsertionPoint::contextEnter ( nanobind::object  insertionPoint)
static

Enter and exit the context manager.

Definition at line 2106 of file IRCore.cpp.

References mlir::python::PyThreadContextEntry::pushInsertionPoint().

◆ contextExit()

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

◆ getBlock()

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

Definition at line 864 of file IRModule.h.

Referenced by mlir::python::PyThreadContextEntry::pushInsertionPoint().

◆ getRefOperation()

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

Definition at line 865 of file IRModule.h.

◆ insert()

void PyInsertionPoint::insert ( PyOperationBase operationBase)

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