MLIR 23.0.0git
mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry Class Reference

Tracks an entry in the thread context stack. More...

#include "mlir/Bindings/Python/IRCore.h"

Public Types

enum class  FrameKind { Context , InsertionPoint , Location }

Public Member Functions

 PyThreadContextEntry (FrameKind frameKind, nanobind::object context, nanobind::object insertionPoint, nanobind::object location)
PyMlirContextgetContext ()
PyInsertionPointgetInsertionPoint ()
PyLocationgetLocation ()
FrameKind getFrameKind ()

Static Public Member Functions

static PyMlirContextgetDefaultContext ()
 Gets the top of stack context and return nullptr if not defined.
static PyInsertionPointgetDefaultInsertionPoint ()
 Gets the top of stack insertion point and return nullptr if not defined.
static PyLocationgetDefaultLocation ()
 Gets the top of stack location and returns nullptr if not defined.
static PyThreadContextEntrygetTopOfStack ()
 Stack management.
static nanobind::object pushContext (nanobind::object context)
static void popContext (PyMlirContext &context)
static nanobind::object pushInsertionPoint (nanobind::object insertionPoint)
static void popInsertionPoint (PyInsertionPoint &insertionPoint)
static nanobind::object pushLocation (nanobind::object location)
static void popLocation (PyLocation &location)
static std::vector< PyThreadContextEntry > & getStack ()
 Gets the thread local stack.

Detailed Description

Tracks an entry in the thread context stack.

New entries are pushed onto here for each with block that activates a new InsertionPoint, Context or Location.

Pushing either a Location or InsertionPoint also pushes its associated Context. Pushing a Context will not modify the Location or InsertionPoint unless if they are from a different context, in which case, they are cleared.

Definition at line 126 of file IRCore.h.

Member Enumeration Documentation

◆ FrameKind

Enumerator
Context 
InsertionPoint 
Location 

Definition at line 128 of file IRCore.h.

Constructor & Destructor Documentation

◆ PyThreadContextEntry()

mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::PyThreadContextEntry ( FrameKind frameKind,
nanobind::object context,
nanobind::object insertionPoint,
nanobind::object location )
inline

Definition at line 134 of file IRCore.h.

Member Function Documentation

◆ getContext()

PyMlirContext * mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::getContext ( )

Definition at line 640 of file IRCore.cpp.

◆ getDefaultContext()

PyMlirContext * mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::getDefaultContext ( )
static

Gets the top of stack context and return nullptr if not defined.

Definition at line 658 of file IRCore.cpp.

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().

◆ getDefaultInsertionPoint()

PyInsertionPoint * mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::getDefaultInsertionPoint ( )
static

Gets the top of stack insertion point and return nullptr if not defined.

Definition at line 663 of file IRCore.cpp.

References getTopOfStack().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().

◆ getDefaultLocation()

PyLocation * mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::getDefaultLocation ( )
static

Gets the top of stack location and returns nullptr if not defined.

Definition at line 668 of file IRCore.cpp.

References getTopOfStack().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().

◆ getFrameKind()

FrameKind mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::getFrameKind ( )
inline

Definition at line 152 of file IRCore.h.

◆ getInsertionPoint()

PyInsertionPoint * mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::getInsertionPoint ( )

Definition at line 646 of file IRCore.cpp.

◆ getLocation()

PyLocation * mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::getLocation ( )

Definition at line 652 of file IRCore.cpp.

◆ getStack()

std::vector< PyThreadContextEntry > & mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::getStack ( )
static

Gets the thread local stack.

Definition at line 606 of file IRCore.cpp.

◆ getTopOfStack()

PyThreadContextEntry * mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::getTopOfStack ( )
static

Stack management.

Definition at line 611 of file IRCore.cpp.

Referenced by getDefaultInsertionPoint(), getDefaultLocation(), and pushContext().

◆ popContext()

void mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::popContext ( PyMlirContext & context)
static

◆ popInsertionPoint()

void mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::popInsertionPoint ( PyInsertionPoint & insertionPoint)
static

Definition at line 703 of file IRCore.cpp.

◆ popLocation()

void mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::popLocation ( PyLocation & location)
static

◆ pushContext()

nb::object mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::pushContext ( nanobind::object context)
static

◆ pushInsertionPoint()

nb::object mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::pushInsertionPoint ( nanobind::object insertionPoint)
static

◆ pushLocation()

nb::object mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::pushLocation ( nanobind::object location)
static

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