MLIR
20.0.0git
|
The ExecutionContext is the main orchestration of the infrastructure, it acts as a handler in the MLIRContext for executing an Action. More...
#include "mlir/Debug/ExecutionContext.h"
Classes | |
struct | Observer |
This abstract class defines the interface used to observe an Action execution. More... | |
Public Types | |
enum | Control { Apply = 1 , Skip = 2 , Step = 3 , Next = 4 , Finish = 5 } |
Enum that allows the client of the context to control the execution of the action. More... | |
using | CallbackTy = function_ref< Control(const ActionActiveStack *)> |
The type of the callback that is used to control the execution. More... | |
Public Member Functions | |
ExecutionContext (CallbackTy callback) | |
Create an ExecutionContext with a callback that is used to control the execution. More... | |
ExecutionContext ()=default | |
void | setCallback (CallbackTy callback) |
Set the callback that is used to control the execution. More... | |
void | registerObserver (Observer *observer) |
Register a new Observer on this context. More... | |
void | addBreakpointManager (BreakpointManager *manager) |
Register a new BreakpointManager on this context. More... | |
void | operator() (function_ref< void()> transform, const Action &action) |
Process the given action. More... | |
The ExecutionContext is the main orchestration of the infrastructure, it acts as a handler in the MLIRContext for executing an Action.
When an action is dispatched, it'll query its set of Breakpoints managers for a breakpoint matching this action. If a breakpoint is hit, it passes the action and the breakpoint information to a callback. The callback is responsible for controlling the execution of the action through an enum value it returns. Optionally, observers can be registered to be notified before and after the callback is executed.
Definition at line 54 of file ExecutionContext.h.
using mlir::tracing::ExecutionContext::CallbackTy = function_ref<Control(const ActionActiveStack *)> |
The type of the callback that is used to control the execution.
The callback is passed the current action.
Definition at line 72 of file ExecutionContext.h.
Enum that allows the client of the context to control the execution of the action.
Enumerator | |
---|---|
Apply | |
Skip | |
Step | |
Next | |
Finish |
Definition at line 68 of file ExecutionContext.h.
|
inline |
Create an ExecutionContext with a callback that is used to control the execution.
Definition at line 76 of file ExecutionContext.h.
References setCallback().
|
default |
|
inline |
Register a new BreakpointManager
on this context.
It'll have a chance to match an action before it gets executed. Note that this method is not thread-safe: it isn't supported to add a new manager while actions may be executed.
Definition at line 114 of file ExecutionContext.h.
void ExecutionContext::operator() | ( | function_ref< void()> | transform, |
const Action & | action | ||
) |
Process the given action.
This is the operator called by MLIRContext on executeAction()
.
Definition at line 57 of file ExecutionContext.cpp.
References actionStack, Apply, Finish, mlir::tracing::ActionActiveStack::getDepth(), mlir::tracing::ActionActiveStack::getParent(), Next, Skip, and Step.
void ExecutionContext::registerObserver | ( | Observer * | observer | ) |
Register a new Observer
on this context.
It'll be notified before and after executing an action. Note that this method is not thread-safe: it isn't supported to add a new observer while actions may be executed.
Definition at line 53 of file ExecutionContext.cpp.
|
inline |
Set the callback that is used to control the execution.
Definition at line 80 of file ExecutionContext.h.
Referenced by ExecutionContext(), and mlir::setupDebuggerExecutionContextHook().