MLIR  20.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 (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...
 
pybind11::object contextEnter ()
 Enter and exit the context manager. More...
 
void contextExit (const pybind11::object &excType, const pybind11::object &excVal, const pybind11::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...
 

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

Constructor & Destructor Documentation

◆ PyInsertionPoint() [1/2]

PyInsertionPoint::PyInsertionPoint ( PyBlock block)

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

Definition at line 1863 of file IRCore.cpp.

Referenced by atBlockBegin().

◆ PyInsertionPoint() [2/2]

PyInsertionPoint::PyInsertionPoint ( PyOperationBase beforeOperationBase)

Creates an insertion point positioned before a reference operation.

Definition at line 1865 of file IRCore.cpp.

Member Function Documentation

◆ atBlockBegin()

PyInsertionPoint PyInsertionPoint::atBlockBegin ( PyBlock block)
static

◆ atBlockTerminator()

PyInsertionPoint PyInsertionPoint::atBlockTerminator ( PyBlock block)
static

◆ contextEnter()

py::object PyInsertionPoint::contextEnter ( )

Enter and exit the context manager.

Definition at line 1917 of file IRCore.cpp.

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

◆ contextExit()

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

◆ getBlock()

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

Definition at line 866 of file IRModule.h.

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

◆ getRefOperation()

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

Definition at line 867 of file IRModule.h.

◆ insert()

void PyInsertionPoint::insert ( PyOperationBase operationBase)

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