Alamvic / druid

Meta-compiler to generate an optimised JIT compiler frontend based on an Interpreter definition
8 stars 6 forks source link

Collapse logical and bit AND/OR instructions with comparisons #118

Open PalumboN opened 6 months ago

PalumboN commented 6 months ago

Avoid unnecessary comparison instructions (by zero) after And or Or instructions:

    self AndCq: 7 R: t0.
    self CmpCq: 0 R: t0. "<- We can remove this"
    jump2 := self JumpNonZero: 0.

We can do this because the flags in the core are updated after logical instructions too.