Registry for library node dispatchers.
This registry maps library node codes (operation identifiers like "GEMM", "Memcpy") to dispatcher factory functions. Each library node type can register a custom dispatcher that generates the appropriate code for that operation.
The registry is thread-safe and follows the singleton pattern. Dispatchers are registered at program startup and looked up during code generation.
Usage
Register a dispatcher:
"MyOperation",
return std::make_unique<MyOperationDispatcher>(lang, func, dfg, node);
}
);
Definition language_extension.h:39
void register_library_node_dispatcher(std::string library_node_code, LibraryNodeDispatcherFn fn)
Definition node_dispatcher_registry.h:264
static LibraryNodeDispatcherRegistry & instance()
Definition node_dispatcher_registry.h:251
Definition data_flow_graph.h:29
Base class for all library nodes in the dataflow graph.
Definition library_node.h:106
Lookup a dispatcher:
if (factory) {
auto dispatcher = factory(lang, func, dfg, node);
}
LibraryNodeDispatcherFn get_library_node_dispatcher(std::string library_node_code) const
Definition node_dispatcher_registry.h:291