QBE - Compiler Backend: Version 1.3

51 points by orib


lorddimwit

One of my long-running hobbyist projects is a TRIPOS/Amiga Exec style little OS. No memory protection, flat memory map, message passing is just passing a pointer.

Having such a system be self-hosted is much easier with a small compiler that can produce PIE/PIC. Amiga-style libraries of course have to be PIC (obviously), but it’s also nice to not have to do a lot of extra load time patching of executables when they are loaded somewhere in the shared memory map.

GCC and Clang of course can do it but they’re enormous. TCC last I checked couldn’t do PIC. I need to look more into QBE.

Riolku

Does this project have overlapping goals with Cranelift? Can't quite seem to figure out when one would use QBE

mcf

Really happy to have the new extern keyword. Although not mentioned in the release notes, this also works with thread, enabling initial-exec TLS. This is needed to access thread-local globals defined in other shared libraries (needed for ctype.h on FreeBSD). extern is also needed for regular global access in shared libraries (such as stderr) on platforms like macOS and Haiku. QBE-based compilers are now able to support a much larger set of operating systems and use-cases.

The performance improvements by Roland are also very appreciated. He did some really great work!