Possible alternative compiler backend: Cretonne

If it isn’t clear yet, runtime performance would not be the primary goal, compile-time performance and correctness are. There are a lot of important use cases for code generation with these qualities, even if they can’t match LLVM’s runtime performance.

Cretonne’s design is philosophically aligned with Rust’s: the same way Rust starts from a disposition of zero-cost abstractions, and is working toward making that more ergonomic; Cretonne starts from a disposition of compiling fast and not having undefined behavior, and can push the boundaries of what is possible from there. I think it is not obvious at all what the limits of such an approach are in a production compiler, and we’re not likely to know without doing it. As @stoklund already mentioned, there are already notions to add powerful aliasing annotations - which are unique to Rust’s needs and could give it unique advantages - that would introduce undefined behavior in a controlled way, to allow specific important optimizations. This is a smart approach - start from a completely safe model and open escape hatches where absolutely necessary, similar to unsafe blocks in safe Rust.

15 Likes