MLIR  20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
mlir::python::PyThreadContextEntry Class Reference

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

#include "Bindings/Python/IRModule.h"

Public Types

enum class  FrameKind { Context , InsertionPoint , Location }
 

Public Member Functions

 PyThreadContextEntry (FrameKind frameKind, pybind11::object context, pybind11::object insertionPoint, pybind11::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. More...
 
static PyInsertionPointgetDefaultInsertionPoint ()
 Gets the top of stack insertion point and return nullptr if not defined. More...
 
static PyLocationgetDefaultLocation ()
 Gets the top of stack location and returns nullptr if not defined. More...
 
static PyThreadContextEntrygetTopOfStack ()
 Stack management. More...
 
static pybind11::object pushContext (PyMlirContext &context)
 
static void popContext (PyMlirContext &context)
 
static pybind11::object pushInsertionPoint (PyInsertionPoint &insertionPoint)
 
static void popInsertionPoint (PyInsertionPoint &insertionPoint)
 
static pybind11::object pushLocation (PyLocation &location)
 
static void popLocation (PyLocation &location)
 
static std::vector< PyThreadContextEntry > & getStack ()
 Gets the thread local stack. More...
 

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 107 of file IRModule.h.

Member Enumeration Documentation

◆ FrameKind

Enumerator
Context 
InsertionPoint 
Location 

Definition at line 109 of file IRModule.h.

Constructor & Destructor Documentation

◆ PyThreadContextEntry()

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

Definition at line 115 of file IRModule.h.

Member Function Documentation

◆ getContext()

PyMlirContext * PyThreadContextEntry::getContext ( )

Definition at line 844 of file IRCore.cpp.

◆ getDefaultContext()

PyMlirContext * PyThreadContextEntry::getDefaultContext ( )
static

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

Definition at line 862 of file IRCore.cpp.

Referenced by mlir::python::DefaultingPyMlirContext::resolve().

◆ getDefaultInsertionPoint()

PyInsertionPoint * PyThreadContextEntry::getDefaultInsertionPoint ( )
static

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

Definition at line 867 of file IRCore.cpp.

Referenced by maybeInsertOperation().

◆ getDefaultLocation()

PyLocation * PyThreadContextEntry::getDefaultLocation ( )
static

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

Definition at line 872 of file IRCore.cpp.

Referenced by mlir::python::DefaultingPyLocation::resolve().

◆ getFrameKind()

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

Definition at line 133 of file IRModule.h.

◆ getInsertionPoint()

PyInsertionPoint * PyThreadContextEntry::getInsertionPoint ( )

Definition at line 850 of file IRCore.cpp.

◆ getLocation()

PyLocation * PyThreadContextEntry::getLocation ( )

Definition at line 856 of file IRCore.cpp.

◆ getStack()

std::vector< PyThreadContextEntry > & PyThreadContextEntry::getStack ( )
static

Gets the thread local stack.

Definition at line 810 of file IRCore.cpp.

◆ getTopOfStack()

PyThreadContextEntry * PyThreadContextEntry::getTopOfStack ( )
static

Stack management.

Definition at line 815 of file IRCore.cpp.

◆ popContext()

void PyThreadContextEntry::popContext ( PyMlirContext context)
static

Definition at line 885 of file IRCore.cpp.

Referenced by mlir::python::PyMlirContext::contextExit().

◆ popInsertionPoint()

void PyThreadContextEntry::popInsertionPoint ( PyInsertionPoint insertionPoint)
static

Definition at line 907 of file IRCore.cpp.

Referenced by mlir::python::PyInsertionPoint::contextExit().

◆ popLocation()

void PyThreadContextEntry::popLocation ( PyLocation location)
static

Definition at line 927 of file IRCore.cpp.

Referenced by mlir::python::PyLocation::contextExit().

◆ pushContext()

py::object PyThreadContextEntry::pushContext ( PyMlirContext context)
static

Definition at line 877 of file IRCore.cpp.

Referenced by mlir::python::PyMlirContext::contextEnter().

◆ pushInsertionPoint()

py::object PyThreadContextEntry::pushInsertionPoint ( PyInsertionPoint insertionPoint)
static

◆ pushLocation()

py::object PyThreadContextEntry::pushLocation ( PyLocation location)
static

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