At the moment, we invoke shouldExecute() that way:
if (manager.shouldExecute<DebugAction>(currentOp) { // apply a transformation … }
In this sequence, the manager isn’t involved in the actual execution
of the action and can’t develop rich instrumentations. Instead the API
could let the control to the handler itself:
// Execute the action under the control of the manager manager.execute<DebugAction>(currentOp, [&]() { // apply the transformation in this callback … });
This inversion of control (by injecting a callback) allows handlers to
implement potentially new interesting features: for example, snapshot
the IR before and after the action, or record an action execution time.
More importantly, it will allow to capture the nesting execution of
actions.
On the other side: handlers receives now a DebugAction object that wraps
generic information (tag and description especially) as well as
action-specific data.
Finally, the DebugActionManager is now enabled in release builds as
well.
Can we drop the llvm:: on all of these?