Source

Branch

1/ @LubaRaphael

I’ve never looked at a real-world optimizer. Are they really table-driven so that they would use the same structure as our x64 assembler to figure out instructions and optimizations?
Or are they instead built from a basic operation-to-instruction mapping (like the current x64 backend) plus a thousand rules like “if I detect this kind of pattern, replace it with this instruction sequence”?
If it is the latter, they would use different structures anyways and we could factor out the assembler without impacting the optimizer very much.