I really want to like QBE, but declaration blocks like this make it feel like 1970s Unix code more than a modern hackable piece of software: int t, x, r, rf, rt, nr; bits rs; Ins *i, *i1; Mem *m; Ref *ra[4]; I think it deters some users by making it hard to read and understand the relatively subtle code in the 300 line function that follows. (Skill issue, I know)
QBE – Compiler Backend – 1.3
11–20 of 39 posts
Re: QBE – Compiler Backend – 1.3
#12Is QBE intended for production use, or is it primarily a research/educational project?
Re: QBE – Compiler Backend – 1.3
#13I really want to like QBE, but declaration blocks like this make it feel like 1970s Unix code more than a modern hackable piece of software: int t, x, r, rf, rt, nr; bits rs; Ins *i, *i1; Mem *m; Ref *ra[4]; I think it deters some users by making it hard to read and understand the relatively subtle code in the 300 line function that follows. (Skill issue, I know)
Re: QBE – Compiler Backend – 1.3
#14I really want to like QBE, but declaration blocks like this make it feel like 1970s Unix code more than a modern hackable piece of software: int t, x, r, rf, rt, nr; bits rs; Ins *i, *i1; Mem *m; Ref *ra[4]; I think it deters some users by making it hard to read and understand the relatively subtle code in the 300 line function that follows. (Skill issue, I know)
Re: QBE – Compiler Backend – 1.3
#15It was one of the projects that made me realize what the arcane wizened sages of olden C were capable of - C is not as much a programming language with best practices as a template for one - and many competing ideas and interesting ways of coding have emerged over the ~40 years of C dominance (starting from the emergence of the language, to the early 2000s, around when for various reasons, OOP kinda 'won') - if one abandons all pretense of safety and comfort.
There's this project and MIR - both have the same mad science DNA, QBE being a bit more friendly and well documented, with MIR making faster code - boiling down mostly to the architectural decision that MIR does inlining while QBE does not.
Re: QBE – Compiler Backend – 1.3
#16Is QBE intended for production use, or is it primarily a research/educational project?
Well according to this it's currently around 40% as fast as gcc -O2...
Now 1.3 is 63% the speed of gcc O2 on this largely hostile benchmark.
Re: QBE – Compiler Backend – 1.3
#17Earlier quoted context omitted.
Well according to this it's currently around 40% as fast as gcc -O2...
Read the article, 1.2 was 40% as fast on one specific benchmark, and its lack of speed largely came down to having a much worse CRC implementation, not general shortcomings. Now 1.3 is 63% the speed of gcc O2 on this largely hostile benchmark.
Re: QBE – Compiler Backend – 1.3
#18Earlier quoted context omitted.
I agree! One of the benefits of this new QBE feature of supporting windows could be that this allows a language like Hare to be used for windows too, all the more power to Hare and other programming languages built on top of QBE!
In theory, sure, but there's no way Hare is going to ever officially support Windows. Even if the compiled backend supports the target, the language still needs to abstract over the OS interfaces and implement syscalls.
Re: QBE – Compiler Backend – 1.3
#19Re: QBE – Compiler Backend – 1.3
#20Nearly ideal. The only stopper for me is missing a way to add source level debugging info.
Btw adding some non-standard debugging support to QBE is not impossibly hard even without that. You can inject bogus no-ops per line, force the compiler to keep them, and it will dutifully track all state values throughout the pipeline, and likewise you can track values from variables to SSA assignments, to temp registers to actual registers, its mostly bookkeeping.