-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Refactor codegen backends in bootstrap #144787
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
base: master
Are you sure you want to change the base?
Conversation
To clarify what it does.
Make it clear that it only works for the Cranelift backend, add step metadata, add a test and change the default enablement logic for this step.
|
This PR modifies If appropriate, please update This PR modifies If appropriate, please update |
The job Click to see the possible cause of the failure (guessed by this bot)
|
# | ||
# Note that the LLVM codegen backend is special and will always be built and distributed. | ||
# | ||
# Currently, the only standard options supported here are `"llvm"`, `"cranelift"` and `"gcc"`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comment: this is exactly the behaviour I wanted, thanks so much for implementing it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the existing behavior, I didn't change it in this PR, just documented it and refactored it :D The only change is that it is now possible to build a backend even if it isn't in the array in the config file.
This PR refactors the codegen backend steps, in preparation to make more progress on the integration of the GCC codegen backend in bootstrap. It does several things:
CodegenBackend
step into two, one for clif and another one for gcc. Even though their code is mostly similar, that's IMO mostly fake similarity, and they do (or will) ultimately require different handling. This was already visible in the requirement of building GCC for cg_gcc, of course.rust.codegen-backends
. It was quite weird that it wasn't possible to even invoke the corresponding codegen backend if the backend wasn't specified in that array, as that array should ideally only change defaults (see later below).compiler/rustc_codegen_cranelift
, the step is now built only usingrustc_codegen_cranelift
orcg_clif
. This is done to avoid an annoying clash withx build compiler
, which would otherwise build both codegen backends after the 2) change.Assemble
step.rust.codegen-backends
, which now only affects the defaults of whether a codegen backend will be included in rustc's sysroot and whether it will be disted inx dist
by default. We can change the behavior later, e.g. to dist cranelift by default inx dist
once it becomes stabilized. Currently I left the existing behavior that we use on CI, I just tried to document it better.I don't think that this requires a change tracker entry, because the defaults should work the same as before. It is just now possible to do
x build/dist rustc_codegen_cranelift
even if CLIF is not in thecodegen-backends
array. It is no longer possible to do./x build compiler/rustc_codegen_cranelift
though, not sure if that requires a change tracker entry.There is one thing that I didn't touch yet, and that is the fact that
rust.codegen-backends
not only affects the default behavior ofx dist
w.r.t. Cranelift, but also ofx test
. In other words,x test rustc_codegen_cranelift
still does not hing if cranelift isn't inrust.codegen-backends
. I plan to take a look at this once I get to refactoring the test steps.Based on #144303, which fixed the staging for codegen backends and introduced the
RustcPrivateCompilers
abstraction (last three commits are new).r? @jieyouxu