ir+eval: Rework of instruction architecture #8
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Status quo
#6 implemented a rather hacky match on providing the inputs and processing the outputs of each instruction, and namely doesn't even handle instructions with multiple outputs at the moment.
Goal
An architecture for instructions that seperates the code of the individual instructions, and allows the instructions in
ir::instruction
to list their inputs and outputs coherently and type-safely (such that we can make the inner values of the IDs inir::id
private/pub(super)
).Suggestion
ir
Not sure at all. Maybe we just need a bit of macro magic on
ir::instruction::Kind
which allows specifying inputs and outputs as well as some helpful docs. Possible example, which would require movingVariant
out ofeval
(which is likely necessary for a type system anyway):which would then expand into an enum
Kind
holding all those variants, and form additional methods returningeval
Possibly a trait
Instruction
ineval::debug
would be beneficial, with a signature of somewhat like this:Then there'd need to be some kind of glue to make writing instructions actually easy, since
Variant
s themselves are quite tedious to extract. Maybe something like this (where theinstr
macro automatically extracts the individual types from theVariant
and returns an error/panics if they do not match what's expected:Those could then be mapped somewhere in the debug evaluator:
Other things
ir::instruction::Kind
, a generic overview of what instructions they are and what types they accept and returneval::kind::debug::Instruction
, a specific implementation of a specific instructioneval::kind::debug::instr
, which helps implementingeval::kind::debug::Instruction
by mapping the types appropiatelyeval::kind::debug
its own crate in order to allow parallel compilation to other evaluators, and make the module paths less complicated when referring to the debug evaluator and its children modules.