Refactor librustc_codegen_llvm for multiple codegen backends.
3bdd304
Opened by Eduard-Mihai Burtescu at
~~Rename librustc_trans to librustc_codegen_llvm.~~
~~Then make rustc_driver either able to choose codegen backends, or even better, pass rustc_codegen_llvm to rustc_driver from rustc-main.
See also #45226.~~
Possible refactoring steps:
- ~~remove
SharedCrateContext, useTyCtxt~~ - ~~rename
(Local)CrateContexttoCodegenContext, remove accessor methods~~ - [WIP by @irinagpopa] merge
librustc_llvmintolibrustc_codegen_llvm- pass
ValueRefas&Valueinstead, encode LLVM lifetimes in FFI signatures
- pass
- split the metadata reading/writing and linking parts out of it
- refer to
cretonneandllvm2cretonnefor common Cretonne/LLVM builder APIs- common tools used by SSA backends could be placed in
rustc_codegen_ssa
- common tools used by SSA backends could be placed in
~~[#50615] Rename
librustc_transtolibrustc_codegen_llvm.~~ ~~Makerustc_drivereither able to choose codegen backends, or even better, passrustc_codegen_llvmtorustc_driverfromrustc-main. See also #45226.~~Possible refactoring steps:
- ~~remove
SharedCrateContext, useTyCtxt~~ - ~~rename
(Local)CrateContexttoCodegenContext, remove accessor methods~~ - [#52461] ~~merge
librustc_llvmintolibrustc_codegen_llvm~~- ~~pass
ValueRefas&'ll Valueinstead, encode LLVM lifetimes in FFI signatures~~ - ~~use this technique for C++ objects that borrow others: https://github.com/rust-lang/rust/issues/43467#issuecomment-405808005~~
- ~~pass
- use this technique for the
DI*inheritance hierarchy: https://github.com/rust-lang/rust/issues/43467#issuecomment-399509319 - use
&'ll Module<'ll>,&'ll Value<'ll>,&'ll Type<'ll>etc. to correctly model lifetime relationships (without an invariant lifetime parameter, very little is actually enforced) - refer to
craneliftandllvm2craneliftfor common Cranelift/LLVM builder APIs- [#55627] ~~common tools used by SSA backends could be placed in
rustc_codegen_ssa~~ - refactor
rustc_codegen_ssaAPIs to match Cranelift, leave LLVM second-class- unaddressed comments from #55627 may be relevant here
- [#55627] ~~common tools used by SSA backends could be placed in
- split the metadata, "optimize + generate machine code" (should it be called "
binemit"?) and linking components, out ofrustc_codegen_ssa
Eduard-Mihai Burtescu at 2018-07-13 17:55:15
- ~~remove