Re:TempleOS: x86_64 HolyC Compiler/Assembler/Unassembler [vi...
by blt on Monday September 28, 2015 @01:45AM
(#10289078)
I've often thought about this idea. It could be as simple as `#pragma jit` before a function call. If you're about to call a function that chews on a big dataset for several seconds, it's probably worth the effort. In particular I'm thinking of hot loops with an `if` statement or function pointer / virtual call.
It's impressive that he made his own optimizing compiler, even if it is not C standard. From the video it has at least constant folding, dead code elimination and jump optimization. It's interesting that the intermediate code is in the form of a double-linked list for easy editing.
I would suggest to try to make a compiler which uses SSA- it's pretty simple and allows more optimizations, particularly CSE. I worked with Bob Morgan at one point, and I suggest his book on compilers as an accessible resource. He would like your jump optimization outer loop: repeat while we're still making progress.