2 ms·
Rust has an FFI to C, which is how it calls out to LLVM. Can you point me to the part of the codebase that codegens the basic constructs?
by artagnon 12y ago
Rust has an FFI to C, which is how it calls out to LLVM. Can you point me to the part of the codebase that codegens the basic constructs?
- steveklabnik 12y agoI _believe_ that https://github.com/rust-lang/rust/blob/master/src/librustc_llvm/lib.rs https://github.com/rust-lang/rust/blob/master/src/librustc_l... is the LLVM wrapper, and that https://github.com/rust-lang/rust/tree/master/src/librustc/middle/trans https://github.com/rust-lang/rust/tree/master/src/librustc/m... is what does the actual generation, but frankly, I am quite bad with the compiler internals.
- thomaslee 12y agoI wrote a little about the guts of the Rust compiler earlier this year. Shouldn't be too out of date, should get you pointed in the right direction if you're interested in the details: http://tomlee.co/2014/04/03/a-more-detailed-tour-of-the-rust-compiler/ http://tomlee.co/2014/04/03/a-more-detailed-tour-of-the-rust... At the time of writing, Rust would use LLVM to generate object files from LLVM IR, then link 'em together using the system's C compiler.