MLIR
20.0.0git
|
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) |
PyBlock & | getBlock () |
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... | |
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.
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::PyInsertionPoint | ( | PyOperationBase & | beforeOperationBase | ) |
Creates an insertion point positioned before a reference operation.
Definition at line 1865 of file IRCore.cpp.
|
static |
Shortcut to create an insertion point at the beginning of the block.
Definition at line 1895 of file IRCore.cpp.
References mlir::python::PyOperation::forOperation(), mlir::python::PyBlock::get(), mlir::python::BaseContextObject::getContext(), mlir::python::PyBlock::getParentOperation(), mlirBlockGetFirstOperation(), mlirOperationIsNull(), and PyInsertionPoint().
|
static |
Shortcut to create an insertion point before the block terminator.
Definition at line 1908 of file IRCore.cpp.
References mlir::python::PyOperation::forOperation(), mlir::python::PyBlock::get(), mlir::python::BaseContextObject::getContext(), mlir::python::PyBlock::getParentOperation(), mlirBlockGetTerminator(), and mlirOperationIsNull().
py::object PyInsertionPoint::contextEnter | ( | ) |
Enter and exit the context manager.
Definition at line 1917 of file IRCore.cpp.
References mlir::python::PyThreadContextEntry::pushInsertionPoint().
void PyInsertionPoint::contextExit | ( | const pybind11::object & | excType, |
const pybind11::object & | excVal, | ||
const pybind11::object & | excTb | ||
) |
Definition at line 1921 of file IRCore.cpp.
References mlir::python::PyThreadContextEntry::popInsertionPoint().
|
inline |
Definition at line 866 of file IRModule.h.
Referenced by mlir::python::PyThreadContextEntry::pushInsertionPoint().
|
inline |
Definition at line 867 of file IRModule.h.
void PyInsertionPoint::insert | ( | PyOperationBase & | operationBase | ) |
Inserts an operation.
Definition at line 1869 of file IRCore.cpp.
References mlir::python::PyOperationBase::getOperation(), mlir::python::PyOperation::isAttached(), mlirBlockGetTerminator(), mlirBlockInsertOwnedOperationBefore(), mlirOperationIsNull(), and mlir::python::PyOperation::setAttached().
Referenced by maybeInsertOperation().