MLIR
22.0.0git
|
Bindings for MLIR symbol tables. More...
#include "Bindings/Python/IRModule.h"
Public Member Functions | |
PySymbolTable (PyOperationBase &operation) | |
Constructs a symbol table for the given operation. More... | |
~PySymbolTable () | |
Destroys the symbol table. More... | |
nanobind::object | dunderGetItem (const std::string &name) |
Returns the symbol (opview) with the given name, throws if there is no such symbol in the table. More... | |
void | erase (PyOperationBase &symbol) |
Removes the given operation from the symbol table and erases it. More... | |
void | dunderDel (const std::string &name) |
Removes the operation with the given name from the symbol table and erases it, throws if there is no such symbol in the table. More... | |
PyStringAttribute | insert (PyOperationBase &symbol) |
Inserts the given operation into the symbol table. More... | |
operator MlirSymbolTable () | |
Casts the bindings class into the C API structure. More... | |
Static Public Member Functions | |
static PyStringAttribute | getSymbolName (PyOperationBase &symbol) |
Gets and sets the name of a symbol op. More... | |
static void | setSymbolName (PyOperationBase &symbol, const std::string &name) |
static PyStringAttribute | getVisibility (PyOperationBase &symbol) |
Gets and sets the visibility of a symbol op. More... | |
static void | setVisibility (PyOperationBase &symbol, const std::string &visibility) |
static void | replaceAllSymbolUses (const std::string &oldSymbol, const std::string &newSymbol, PyOperationBase &from) |
Replaces all symbol uses within an operation. More... | |
static void | walkSymbolTables (PyOperationBase &from, bool allSymUsesVisible, nanobind::object callback) |
Walks all symbol tables under and including 'from'. More... | |
Bindings for MLIR symbol tables.
Definition at line 1266 of file IRModule.h.
|
explicit |
Constructs a symbol table for the given operation.
Definition at line 2262 of file IRCore.cpp.
References mlir::python::PyOperation::get(), mlir::python::PyOperationBase::getOperation(), mlirSymbolTableCreate(), and mlirSymbolTableIsNull().
|
inline |
Destroys the symbol table.
Definition at line 1272 of file IRModule.h.
References mlirSymbolTableDestroy().
void PySymbolTable::dunderDel | ( | const std::string & | name | ) |
Removes the operation with the given name from the symbol table and erases it, throws if there is no such symbol in the table.
Definition at line 2293 of file IRCore.cpp.
References dunderGetItem(), and erase().
nb::object PySymbolTable::dunderGetItem | ( | const std::string & | name | ) |
Returns the symbol (opview) with the given name, throws if there is no such symbol in the table.
Definition at line 2270 of file IRCore.cpp.
References mlir::python::PyOperation::checkValid(), mlir::python::PyOperation::createOpView(), mlir::python::PyOperation::forOperation(), mlir::python::BaseContextObject::getContext(), mlirOperationIsNull(), mlirStringRefCreate(), and mlirSymbolTableLookup().
Referenced by dunderDel().
void PySymbolTable::erase | ( | PyOperationBase & | symbol | ) |
Removes the given operation from the symbol table and erases it.
Definition at line 2283 of file IRCore.cpp.
References mlir::python::PyOperation::checkValid(), mlir::python::PyOperation::get(), mlir::python::PyOperationBase::getOperation(), and mlirSymbolTableErase().
Referenced by dunderDel().
|
static |
Gets and sets the name of a symbol op.
Definition at line 2310 of file IRCore.cpp.
References mlir::python::PyOperation::checkValid(), mlir::python::PyOperation::get(), mlir::python::BaseContextObject::getContext(), mlir::python::PyOperationBase::getOperation(), mlirAttributeIsNull(), mlirOperationGetAttributeByName(), and mlirSymbolTableGetSymbolAttributeName().
|
static |
Gets and sets the visibility of a symbol op.
Definition at line 2338 of file IRCore.cpp.
References mlir::python::PyOperation::checkValid(), mlir::python::PyOperation::get(), mlir::python::BaseContextObject::getContext(), mlir::python::PyOperationBase::getOperation(), mlirAttributeIsNull(), mlirOperationGetAttributeByName(), and mlirSymbolTableGetVisibilityAttributeName().
PyStringAttribute PySymbolTable::insert | ( | PyOperationBase & | symbol | ) |
Inserts the given operation into the symbol table.
The operation must have the symbol trait.
Definition at line 2298 of file IRCore.cpp.
References mlir::python::PyOperation::checkValid(), mlir::python::PyOperation::get(), mlir::python::BaseContextObject::getContext(), mlir::python::PyOperationBase::getOperation(), mlirAttributeIsNull(), mlirOperationGetAttributeByName(), mlirSymbolTableGetSymbolAttributeName(), and mlirSymbolTableInsert().
|
inline |
Casts the bindings class into the C API structure.
Definition at line 1309 of file IRModule.h.
|
static |
Replaces all symbol uses within an operation.
See the API mlirSymbolTableReplaceAllSymbolUses for all caveats.
Definition at line 2367 of file IRCore.cpp.
References mlir::python::PyOperation::checkValid(), mlir::python::PyOperationBase::getOperation(), mlirLogicalResultIsFailure(), mlirSymbolTableReplaceAllSymbolUses(), and toMlirStringRef().
|
static |
Definition at line 2323 of file IRCore.cpp.
References mlir::python::PyOperation::checkValid(), mlir::python::PyMlirContext::get(), mlir::python::PyOperation::get(), mlir::python::BaseContextObject::getContext(), mlir::python::PyOperationBase::getOperation(), mlirAttributeIsNull(), mlirOperationGetAttributeByName(), mlirOperationSetAttributeByName(), mlirStringAttrGet(), mlirSymbolTableGetSymbolAttributeName(), and toMlirStringRef().
|
static |
Definition at line 2349 of file IRCore.cpp.
References mlir::python::PyOperation::checkValid(), mlir::python::PyMlirContext::get(), mlir::python::PyOperation::get(), mlir::python::BaseContextObject::getContext(), mlir::python::PyOperationBase::getOperation(), mlirAttributeIsNull(), mlirOperationGetAttributeByName(), mlirOperationSetAttributeByName(), mlirStringAttrGet(), mlirSymbolTableGetVisibilityAttributeName(), and toMlirStringRef().
|
static |
Walks all symbol tables under and including 'from'.
Definition at line 2379 of file IRCore.cpp.
References mlir::python::PyOperation::checkValid(), mlir::python::PyOperation::get(), mlir::python::BaseContextObject::getContext(), mlir::python::PyOperationBase::getOperation(), and mlirSymbolTableWalkSymbolTables().