I finished the x86-64 code generation for Linux and BSD in credence on Christmas morning, just in time to step away and spend time with family! ARM64 work has already started, and it's turning out to be even more exciting.
The final test was the translation of switch control structures from my IR, the JMP_E ITA statement.

If you're interested in what the machine code looks like, you should take a look at the test suite.
So far, the most challenging part has been designing the Intermediate Representation. Unlike other sections, its design was purely academic - there is no specification to follow. The last time I was in this position was when I needed to re-create left-recursion in a PEG grammar for work, for which I needed a paper from Microsoft to complete.
I am very thankful for this lecture at Stanford - it gave me a lot of inspiration. Here is a snippet of the IR for the switch program above:
__main():
BeginFunc ;
LOCL x;
LOCL y;
x = (10:int:4);
_L2:
_t5 = x >= (5:int:4);
IF _t5 GOTO _L4;
...
_L1:
LEAVE;
_L4:
_t6 = CMP x;
JMP_E _t6 (10:int:4) _L8;
JMP_E _t6 (6:int:4) _L16;
...
_L18:
x = (5:int:4);
GOTO _L17;
EndFunc ;
Support for ARM64 will be much quicker, and I've already finished the template classes and pure virtual methods for platform-agnostic code generation.
Until then, catch you soon 🤘
