Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor librustc_codegen_llvm for multiple codegen backends. #45274

Open
eddyb opened this issue Oct 14, 2017 · 0 comments
Open

Refactor librustc_codegen_llvm for multiple codegen backends. #45274

eddyb opened this issue Oct 14, 2017 · 0 comments
Assignees
Labels
A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend A-gcc Things relevant to the [future] GCC backend C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@eddyb
Copy link
Member

eddyb commented 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:

@kennytm kennytm added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Oct 14, 2017
@eddyb eddyb self-assigned this Nov 8, 2017
bors added a commit that referenced this issue May 17, 2018
Rename trans to codegen everywhere.

Part of #45274.
@eddyb eddyb changed the title Rename librustc_trans to librustc_codegen_llvm. Refactor librustc_codegen_llvm for multiple codegen backends. Jul 13, 2018
bors added a commit that referenced this issue Jul 31, 2018
 rustc_codegen_llvm: use safe references for LLVM FFI types.

Part of #45274.
bors added a commit that referenced this issue Sep 7, 2018
rustc_codegen_llvm: traitification of LLVM-specific CodegenCx and Builder methods

This PR is the continuation of #52461 in the grand plan of #45274 to allow for multiple codegen backends. A first attempt at this was #52987 but since @irinagpopa is no longer working on it I'm taking ownership of the PR.

The changes are refactoring only and do not affect the logic of the code. Performance should not be impacted since all parametrization is done with generics (no trait objects).

The `librustc_codegen_llvm` crate now contains a new folder `interfaces` that describes with traits part of how the compiler interfaces with LLVM during codegen. `CodegenCx` and `Builder` implement those traits.

Many things are still missing. All the calls to LLVM are not yet under a trait, and later LLVM-agnostic code should be parametrized.
bors added a commit that referenced this issue Nov 17, 2018
rustc_codegen_llvm: traitification of LLVM-specific CodegenCx and Builder methods

This PR is the continuation of #54012 and earlier PRs, in the grand plan of #45274 to allow for multiple codegen backends.

High-level summary: interpose a set of traits between Rust's codegen logic and the LLVM APIs, allowing another backend to implement the traits and share most of the codegen logic. These traits are currently somewhat LLVM-specific, but once this refactoring is in place, they can evolve to be more general.

See [this README](https://github.com/rust-lang/rust/blob/756f84d7cef90b7364ae88ca707e59670dde4c92/src/librustc_codegen_ssa/README.md) for a writeup on the current trait organization.
@Centril Centril added the A-codegen Area: Code generation label Mar 12, 2020
@Centril Centril added A-cranelift Things relevant to the [future] cranelift backend T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 12, 2020
@bjorn3 bjorn3 added the A-gcc Things relevant to the [future] GCC backend label Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend A-gcc Things relevant to the [future] GCC backend C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants