Refactor librustc_codegen_llvm for multiple codegen backends. #45274
Open
Description
opened on Oct 14, 2017
[#50615] Rename librustc_trans
to librustc_codegen_llvm
.
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:
removeSharedCrateContext
, useTyCtxt
rename(Local)CrateContext
toCodegenContext
, remove accessor methods- [ rustc_codegen_llvm: use safe references for LLVM FFI types. #52461]
mergelibrustc_llvm
intolibrustc_codegen_llvm
passValueRef
as&'ll Value
instead, encode LLVM lifetimes in FFI signaturesuse this technique for C++ objects that borrow others: Tracking issue for RFC 1861: Extern types #43467 (comment)
- use this technique for the
DI*
inheritance hierarchy: Tracking issue for RFC 1861: Extern types #43467 (comment) - 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
cranelift
andllvm2cranelift
for common Cranelift/LLVM builder APIs- [rustc_codegen_llvm: traitification of LLVM-specific CodegenCx and Builder methods #55627]
common tools used by SSA backends could be placed inrustc_codegen_ssa
- refactor
rustc_codegen_ssa
APIs to match Cranelift, leave LLVM second-class- unaddressed comments from rustc_codegen_llvm: traitification of LLVM-specific CodegenCx and Builder methods #55627 may be relevant here
- [rustc_codegen_llvm: traitification of LLVM-specific CodegenCx and Builder methods #55627]
- split the metadata, "optimize + generate machine code" (should it be called "
binemit
"?) and linking components, out ofrustc_codegen_ssa
Activity