GCC Rust Approved by GCC Steering Committee
11–20 of 300 posts
Re: GCC Rust Approved by GCC Steering Committee
#12What does a "front-end" mean exactly, in this context?
Re: GCC Rust Approved by GCC Steering Committee
#13What does a "front-end" mean exactly, in this context?
Old compilers didn't use this concept. So a C->x86 compiler and a Fortran->x86 one couldn't share code as easily. And if you wanted to expand to, say, ARM, Alpha, etc. targets, it gets worse. You end up needing O(l*t) compilers[a] to be homogenous. It gets even worse if you want to add optimization. With this model, the whole system is working on an AST, and therefore, the optimizers are tailored to the individual compiler varient, so they end up being just as unportable.
However, with a modular design (front and back end), you can have C->IR and Fortran->IR front ends, then a single back end for each target: IR->x86 and IR->ARM. If you want to add, say, Ada support, you only need to write an Ada->IR module, and the back ends handle the rest. In the end, you only need O(l+t) modules. You also get the benefit of agnostic optimizers as they only need to support your internal IR.
[a]: 'l' is languages and 't' is targets
Re: GCC Rust Approved by GCC Steering Committee
#14What does a "front-end" mean exactly, in this context?
Re: GCC Rust Approved by GCC Steering Committee
#15What does a "front-end" mean exactly, in this context?
The front-end compiles your input language (C, C++, Rust, etc) down to a low-level language called an Intermediate Representation. Then the back-end of the compiler optimizes the IR and compiles it into object code. A family of compilers will usually share the back-end.
This kind of split allows for deduplication across different compilers in the same family, and also makes it easier to design a new language without having to fully re-implement everything about the compiler yourself.
In GCC, these are bundled together as a common project afaik. In Clang/LLVM, these are split into the front-end (clang) and the back-end (LLVM).
Re: GCC Rust Approved by GCC Steering Committee
#16Why would someone want this? (Honest question)
Re: GCC Rust Approved by GCC Steering Committee
#17Re: GCC Rust Approved by GCC Steering Committee
#18Earlier quoted context omitted.
Multiple implementations of a standard help shine light into dark corners.
Indeed, but I think they should first create a standard?
https://users.rust-lang.org/t/where-is-the-rust-language-spe...
"For the most part though, rustc itself is the spec" - so, for implementing the GCC frontend, read the current LLVM frontend really carefully and do everything the same way? And try to keep up with all the changes which will inevitably happen in the LLVM frontend while you are implementing the GCC frontend?