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

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...
 
pybind11::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...
 
MlirAttribute 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 MlirAttribute getSymbolName (PyOperationBase &symbol)
 Gets and sets the name of a symbol op. More...
 
static void setSymbolName (PyOperationBase &symbol, const std::string &name)
 
static MlirAttribute 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, pybind11::object callback)
 Walks all symbol tables under and including 'from'. More...
 

Detailed Description

Bindings for MLIR symbol tables.

Definition at line 1223 of file IRModule.h.

Constructor & Destructor Documentation

◆ PySymbolTable()

PySymbolTable::PySymbolTable ( PyOperationBase operation)
explicit

Constructs a symbol table for the given operation.

Definition at line 2009 of file IRCore.cpp.

References mlir::python::PyOperation::get(), mlir::python::PyOperationBase::getOperation(), mlirSymbolTableCreate(), and mlirSymbolTableIsNull().

◆ ~PySymbolTable()

mlir::python::PySymbolTable::~PySymbolTable ( )
inline

Destroys the symbol table.

Definition at line 1229 of file IRModule.h.

References mlirSymbolTableDestroy().

Member Function Documentation

◆ dunderDel()

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

References dunderGetItem(), and erase().

◆ dunderGetItem()

py::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 2017 of file IRCore.cpp.

References mlir::python::PyOperation::createOpView(), mlir::python::PyOperation::forOperation(), mlirOperationIsNull(), mlirStringRefCreate(), and mlirSymbolTableLookup().

Referenced by dunderDel().

◆ erase()

void PySymbolTable::erase ( PyOperationBase symbol)

Removes the given operation from the symbol table and erases it.

Definition at line 2029 of file IRCore.cpp.

References mlir::python::PyOperation::checkValid(), mlir::python::PyOperation::get(), mlir::python::PyOperationBase::getOperation(), and mlirSymbolTableErase().

Referenced by dunderDel().

◆ getSymbolName()

MlirAttribute PySymbolTable::getSymbolName ( PyOperationBase symbol)
static

◆ getVisibility()

MlirAttribute PySymbolTable::getVisibility ( PyOperationBase symbol)
static

◆ insert()

MlirAttribute PySymbolTable::insert ( PyOperationBase symbol)

◆ operator MlirSymbolTable()

mlir::python::PySymbolTable::operator MlirSymbolTable ( )
inline

Casts the bindings class into the C API structure.

Definition at line 1266 of file IRModule.h.

◆ replaceAllSymbolUses()

void PySymbolTable::replaceAllSymbolUses ( const std::string &  oldSymbol,
const std::string &  newSymbol,
PyOperationBase from 
)
static

Replaces all symbol uses within an operation.

See the API mlirSymbolTableReplaceAllSymbolUses for all caveats.

Definition at line 2110 of file IRCore.cpp.

References mlir::python::PyOperation::checkValid(), mlir::python::PyOperationBase::getOperation(), mlirLogicalResultIsFailure(), mlirSymbolTableReplaceAllSymbolUses(), and toMlirStringRef().

◆ setSymbolName()

void PySymbolTable::setSymbolName ( PyOperationBase symbol,
const std::string &  name 
)
static

◆ setVisibility()

void PySymbolTable::setVisibility ( PyOperationBase symbol,
const std::string &  visibility 
)
static

◆ walkSymbolTables()

void PySymbolTable::walkSymbolTables ( PyOperationBase from,
bool  allSymUsesVisible,
pybind11::object  callback 
)
static

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