A considerable speedup could come from identifying sequences of instructions that have other representations, and skipping these instruction sequences in the bruteforce search. Some examples:
Independent instructions may be ordered any which way round. For example, on the 6502, txa; sec is equivalent to sec; txa.
Instructions might have no effect, or their effect might be overwritten by another instruction, such as clc; sec, which is the same as sec; sec, or nop; sec, or sec
The 6502 has zero page addressing. Many instructions doing that also have an absolute addressing mode doing the same thing but at a greater cost
n<<1 might be equivalent to n+n (depending of course, on specifics like what flags are updated and how, etc)
On the Z80, there are sometimes several ways to encode the same instructions, for example with ignored prefixes
It might be a good idea to have some automatically generated peephole optimizer that can notice this kind of thing and use this knowledge to cull the search space.
A considerable speedup could come from identifying sequences of instructions that have other representations, and skipping these instruction sequences in the bruteforce search. Some examples:
txa; sec
is equivalent tosec; txa
.clc; sec
, which is the same assec; sec
, ornop; sec
, orsec
n<<1
might be equivalent ton+n
(depending of course, on specifics like what flags are updated and how, etc)It might be a good idea to have some automatically generated peephole optimizer that can notice this kind of thing and use this knowledge to cull the search space.