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

Let backends define custom targets #76832

Merged
merged 2 commits into from
Sep 20, 2020

Conversation

khyperia
Copy link
Contributor

Add a target_override hook that takes priority over builtin targets.

Add a target_override hook that takes priority over builtin targets.
@rust-highfive
Copy link
Collaborator

r? @oli-obk

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 17, 2020
@eddyb
Copy link
Member

eddyb commented Sep 17, 2020

r? @eddyb cc @nagisa @bjorn3

@rust-highfive rust-highfive assigned eddyb and unassigned oli-obk Sep 17, 2020
Copy link
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels bit roundabout, but in such startup code this seems the best way forward.

compiler/rustc_codegen_ssa/src/traits/backend.rs Outdated Show resolved Hide resolved
@eddyb
Copy link
Member

eddyb commented Sep 17, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Sep 17, 2020

📌 Commit 48655c2 has been approved by eddyb

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 17, 2020
@@ -54,6 +55,12 @@ pub trait CodegenBackend {
fn print_passes(&self) {}
fn print_version(&self) {}

/// If this plugin provides additional builtin targets, provide the one enabled by the options here.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// If this plugin provides additional builtin targets, provide the one enabled by the options here.
/// If this codegen backend provides additional builtin targets, provide the one enabled by the options here.

The llvm codegen backend is not in any way a plugin. It is linked into librustc_driver.so.

@@ -54,6 +55,12 @@ pub trait CodegenBackend {
fn print_passes(&self) {}
fn print_version(&self) {}

/// If this plugin provides additional builtin targets, provide the one enabled by the options here.
/// Be careful: this is called *before* init() is called.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the llvm codegen backend already check that init is called before anything else? If not it would be nice to check just in case. I think there is already a function for this used in some cases.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe open a separate issue? This PR doesn't add a target_override for the LLVM backend.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 19, 2020
…=eddyb

Let backends define custom targets

Add a target_override hook that takes priority over builtin targets.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 19, 2020
…=eddyb

Let backends define custom targets

Add a target_override hook that takes priority over builtin targets.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 19, 2020
…=eddyb

Let backends define custom targets

Add a target_override hook that takes priority over builtin targets.
RalfJung added a commit to RalfJung/rust that referenced this pull request Sep 20, 2020
…=eddyb

Let backends define custom targets

Add a target_override hook that takes priority over builtin targets.
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 20, 2020
Rollup of 15 pull requests

Successful merges:

 - rust-lang#76732 (Add docs for `BasicBlock`)
 - rust-lang#76832 (Let backends define custom targets)
 - rust-lang#76866 (Remove unused feature gates from library/ crates)
 - rust-lang#76875 (Move to intra-doc links in library/alloc/src/collections/binary_heap.rs)
 - rust-lang#76876 (Move to intra-doc links in collections/btree/map.rs and collections/linked_list.rs)
 - rust-lang#76877 (Move to intra-doc links in collections/vec_deque.rs and collections/vec_deque/drain.rs)
 - rust-lang#76878 (Move the version number to a plaintext file)
 - rust-lang#76883 (README.md: Remove prompts from code blocks)
 - rust-lang#76887 (Add missing examples on HashSet iter types)
 - rust-lang#76890 (use matches!() macro for simple if let conditions)
 - rust-lang#76891 (don't take `TyCtxt` by reference)
 - rust-lang#76910 (transmute: use diagnostic item)
 - rust-lang#76924 (Add tracking issue for feature(unix_socket_peek))
 - rust-lang#76926 (BTreeMap: code readability tweaks)
 - rust-lang#76940 (Don't allow implementing trait directly on type-alias-impl-trait)

Failed merges:

r? `@ghost`
@bors bors merged commit c847eaa into rust-lang:master Sep 20, 2020
@rustbot rustbot added this to the 1.48.0 milestone Sep 20, 2020
@khyperia khyperia deleted the backend_target_override branch September 20, 2020 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants