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

Include llvm-as in llvm-tools-preview component #78968

Merged
merged 2 commits into from
Nov 15, 2020
Merged

Conversation

zec
Copy link
Contributor

@zec zec commented Nov 12, 2020

Including llvm-as adds the ability to include assembly language fragments that can be inlined using LTO while making sure the correct version of LLVM is always used.

Including llvm-as adds the ability to include assembly language fragments
that can be inlined using LTO.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 12, 2020
@Mark-Simulacrum
Copy link
Member

Hm, can you say more about the use case here? How are you planning to run this tool?

@zec
Copy link
Contributor Author

zec commented Nov 12, 2020

The use case that prompted this involves memory barriers on an ARM Cortex-M4 processor using (hopefully) stable Rust (so no inline assembly anytime soon). I'm paranoid about memory ordering when it comes to peripheral access, so I'd like to be able to use barrier instructions to ensure that certain sets of reads and writes occur before other sets. A barrier is one or two instructions, so calling external object code linked in whole seems excessive (otherwise, I'd just use llc), hence the desire to use LTO for inlining, which in turn implies needing something that takes source and outputs LLVM bitcode. I'd prefer to reduce the amount of coordination between different toolchains, so not having to depend on a distribution's LLVM being a compatible version seems desirable.

As for running the tool, I intend to do that from a build script using the llvm-tools crate.

If this seems like a case where I'm committing a category error and this is better solved another way, be sure to let me know... I think this is reasonable, but it is also outside my normal wheelhouse.

@Mark-Simulacrum
Copy link
Member

Mark-Simulacrum commented Nov 12, 2020

I would guess that looking at the core::arch module might yield nicer looking code, I would expect most memory barrier instructions to be in there. The arm modules are currently unstable though.

I should also caution that as a preview component, the contents and availability of the llvm-tools component are not considered part of the stability promise. There's also not really a guarantee that LLVM will indefinitely be the backend rustc uses.

That said, it seems not altogether different from the other use cases for these tools, so I'm going to go ahead and @bors r+

@bors
Copy link
Contributor

bors commented Nov 12, 2020

📌 Commit e4a43fc has been approved by Mark-Simulacrum

@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 Nov 12, 2020
@zec
Copy link
Contributor Author

zec commented Nov 12, 2020

@Mark-Simulacrum Understood that this is trading off one sort of instability for another; I'm OK with that.

Thank you for reviewing this PR.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 13, 2020
Include llvm-as in llvm-tools-preview component

Including `llvm-as` adds the ability to include assembly language fragments that can be inlined using LTO while making sure the correct version of LLVM is always used.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 13, 2020
Include llvm-as in llvm-tools-preview component

Including `llvm-as` adds the ability to include assembly language fragments that can be inlined using LTO while making sure the correct version of LLVM is always used.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 14, 2020
Include llvm-as in llvm-tools-preview component

Including `llvm-as` adds the ability to include assembly language fragments that can be inlined using LTO while making sure the correct version of LLVM is always used.
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 15, 2020
Rollup of 15 pull requests

Successful merges:

 - rust-lang#78352 (Do not call `unwrap` with `signatures` option enabled)
 - rust-lang#78590 (refactor: removing alloc::collections::vec_deque ignore-tidy-filelength)
 - rust-lang#78848 (Bump minimal supported LLVM version to 9)
 - rust-lang#78856 (Explicitly checking for or-pattern before test)
 - rust-lang#78948 (test: add `()=()=()=...` to weird-exprs.rs)
 - rust-lang#78962 (Add a test for r# identifiers)
 - rust-lang#78963 (Added some unit tests as requested)
 - rust-lang#78966 (Never inline C variadics, cold functions, functions with incompatible attributes ...)
 - rust-lang#78968 (Include llvm-as in llvm-tools-preview component)
 - rust-lang#78969 (Normalize function type during validation)
 - rust-lang#78980 (Fix rustc_ast_pretty print_qpath resulting in invalid macro input)
 - rust-lang#78986 (Avoid installing external LLVM dylibs)
 - rust-lang#78988 (Fix an intrinsic invocation on threaded wasm)
 - rust-lang#78993 (rustc_target: Fix dash vs underscore mismatches in option names)
 - rust-lang#79013 (Clean up outdated `use_once_payload` pretty printer comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3fe2aba into rust-lang:master Nov 15, 2020
@rustbot rustbot added this to the 1.50.0 milestone Nov 15, 2020
@zec zec deleted the add-llvm-as branch November 22, 2020 23:09
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

5 participants