Email or username:

Password:

Forgot your password?
Top-level
William D. Jones

@notgull If one of your goals is to compile Rust itself, which is the main point of mrustc, how is Rust's LLVM dep being handled?

Don't get me wrong, I would love to get rid of it, just based on the fact it's 10 million lines of C++, arguably the only language more complex to write a compiler for than Rust. But we don't have that luxury :/.

9 comments
notgull

@cr1901 My plan is to replace it with the Cranelift backend. It's written entirely in Rust, so it should be usable if we have a Rust compiler.

If that doesn't work, my plan is to write a QBE backend for rustc and use that instead.

William D. Jones

@notgull Does Cranelift do optimizations? I've heard conflicting info about this ("it doesn't optimize", "it does optimize, but debug-friendly opts only, no further opts planned", "release opts are planned/in progress").

notgull

@cr1901 I don't know, as far as I know there are some optimization passes but it's nowhere near LLVM's caliber.

William D. Jones

@notgull Actual no-optimization builds of rustc are so slow that config.toml itself says they're unsupported. Hopefully getting an acceptable speed compiler doesn't require LLVM-like levels of effort (i.e. 80% of the speed for 20% of the work).

Anyways, if you succeed in this project, I will have to find something else to bit- err, nothing left to bitch about- wrt rustc's bootstrap situation, so I do hope its feasible, and that e.g. upstream (if QBE is required) and Cranelift are supportive :D.

William D. Jones

@notgull This is OT, but while its on my mind...

Is GH Discussions a reasonable place to ask questions about design decisions about smol? (Specifically, I have a lifetime question, and can't figure it out for the life of me)

bjorn3

@notgull @cr1901 There are indeed a couple of optimizations, but not much. A cg_llvm compiled cg_clif builds the standard library in 19s. A cg_clif compiled rustc/cg_clif builds the standard library in 4m 42s, or in other words about a 14x slowdown. github.com/rust-lang/rustc_cod To shrink the gap, implementing clif ir level inlining (which should be more effective than mir inlining) as well as better optimizations of loads and stores should help a fair bit.

@notgull @cr1901 There are indeed a couple of optimizations, but not much. A cg_llvm compiled cg_clif builds the standard library in 19s. A cg_clif compiled rustc/cg_clif builds the standard library in 4m 42s, or in other words about a 14x slowdown. github.com/rust-lang/rustc_cod To shrink the gap, implementing clif ir level inlining (which should be more effective than mir inlining) as well as better optimizations of loads and stores...

William D. Jones

@bjorn3 @notgull Idk about 14x, but I think even a 3x slowdown would be acceptable to me personally :P.

Go Up