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... | |
void | contextExit (const nanobind::object &excType, const nanobind::object &excVal, const nanobind::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... | |
static nanobind::object | contextEnter (nanobind::object insertionPoint) |
Enter and exit the context manager. 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 841 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 1881 of file IRCore.cpp.
Referenced by atBlockBegin().
PyInsertionPoint::PyInsertionPoint | ( | PyOperationBase & | beforeOperationBase | ) |
Creates an insertion point positioned before a reference operation.
Definition at line 1883 of file IRCore.cpp.
|
static |
Shortcut to create an insertion point at the beginning of the block.
Definition at line 1913 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 1926 of file IRCore.cpp.
References mlir::python::PyOperation::forOperation(), mlir::python::PyBlock::get(), mlir::python::BaseContextObject::getContext(), mlir::python::PyBlock::getParentOperation(), mlirBlockGetTerminator(), and mlirOperationIsNull().
|
static |
Enter and exit the context manager.
Definition at line 1935 of file IRCore.cpp.
References mlir::python::PyThreadContextEntry::pushInsertionPoint().
void PyInsertionPoint::contextExit | ( | const nanobind::object & | excType, |
const nanobind::object & | excVal, | ||
const nanobind::object & | excTb | ||
) |
Definition at line 1939 of file IRCore.cpp.
References mlir::python::PyThreadContextEntry::popInsertionPoint().
|
inline |
Definition at line 863 of file IRModule.h.
Referenced by mlir::python::PyThreadContextEntry::pushInsertionPoint().
|
inline |
Definition at line 864 of file IRModule.h.
void PyInsertionPoint::insert | ( | PyOperationBase & | operationBase | ) |
Inserts an operation.
Definition at line 1887 of file IRCore.cpp.
References mlir::python::PyOperationBase::getOperation(), mlir::python::PyOperation::isAttached(), mlirBlockGetTerminator(), mlirBlockInsertOwnedOperationBefore(), mlirOperationIsNull(), and mlir::python::PyOperation::setAttached().
Referenced by maybeInsertOperation().