The rust compiler used to be pass based too, but then became on-demand as that architecture is more amenable for incremental compilation. In that time the performance has improved, although I'm not sure how much this architectural change was responsible for it, I think it were mostly unrelated changes.
Re:GCC Rust Monthly Report – October 2021
by pornel on Monday November 01, 2021 @01:04PM
(#29069599)
How are you going to do borrow checking without MIR? Is GCC-Generic suitable for that?
Rust moved it from HIR to MIR to handle more edge cases.
Re:GCC Rust Monthly Report – October 2021
by fnord77 on Monday November 01, 2021 @09:33AM
(#29066444)
isn't there basically some sort of static analysis going on during the rust compilation to ensure memory is accounted for?
Re:GCC Rust Monthly Report – October 2021
by kibwen on Monday November 01, 2021 @11:03AM
(#29067551)
There are a variety of static checks that Rust performs in order to ensure memory safety. rustc might perform these checks at various parts of the pipeline, but it might be possible for a different compiler to perform these checks at other points depending on what information its chosen IRs encode (for example, borrow checking requires a control-flow graph, which only exists at the MIR stage in rustc).
So we have AST->HIR->GCC-Generic->GCC
where as rustc is: AST->HIR->THIR->MIR->LLVM-IR->LLVM