Opinions About Compiler Building
1 points by surprisetalk
1 points by surprisetalk
when doing code emission, emit “dumb” code first, then clean it up with a peepholer
A good tip is to use destination-driven code generation which is not much harder than naïve code gen, but makes the peephole optimizer’s job much easier. (ISTR Dybvig said something like there being no need to make a simple code generator gratuitously stupid, but I can’t immediately find the exact quote or if it was in fact Dybvig who said it to his students.)