working on rewriting SPIR-V to LLVM IR translation code
The old code was a giant mess, so, I'm hoping to organize the new code into different SPIR-V facets.
I'm planning on ending up with a class diagram like this:
spirv::Parser_callbacks
|
v
Parser_callbacks_base
| | |
+------+ | +-------------------------+
| | |
| +--------------+ |
| virtual | virtual | virtual
v v v
Parser_header_callbacks Parser_debug_callbacks ... <other>
| | |
| +--------------+ |
| | |
+------+ | +--------------------------+
| | |
v v v
Parser_callbacks_implementation
where each intermediate class implements a facet of
SPIR-V parsing/translation.
So, Parser_header_callbacks implements the handle_header() function,
Parser_debug_callbacks implements the source-level debug instructions,
and the rest of the intermediate classes implement the rest of the
instructions. Parser_callbacks_implementation just serves to combine
them all into one non-abstract type.
Using virtual inheritence shouldn't affect the compilation speed appreciably
because most of the compilation time should be spent by LLVM's optimization
passes and by LLVM's code generation back-end.