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

Make it easy to attach LLVM attributes to Rust functions #15180

Closed
kmcallister opened this issue Jun 25, 2014 · 8 comments
Closed

Make it easy to attach LLVM attributes to Rust functions #15180

kmcallister opened this issue Jun 25, 2014 · 8 comments
Labels
A-codegen Area: Code generation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

Comments

@kmcallister
Copy link
Contributor

Lots of good stuff there.

@kmcallister
Copy link
Contributor Author

This should only be allowed on unsafe fn because it can cause incorrect codegen. We should also determine if it's possible for a bad attribute to break the code for other functions in cases where the function with the attribute is never actually called.

@Tobba
Copy link
Contributor

Tobba commented Jun 25, 2014

There should also be a feature gated way to inject LLVM bitcode, which is really useful in certain cases

@Thiez
Copy link
Contributor

Thiez commented Jun 25, 2014

I think feature gates are for featues that we wish to eventually make it into the 'official' language, are they not? So it would not make sense to enable injection of LLVM bitcode, or it would not be possible to create a non-LLVM based rust compiler (not that I would expect that to happen any time soon, but it would be interesting to see a rustc that uses the GCC backend after the language reaches 1.0).

@huonw
Copy link
Member

huonw commented Jun 25, 2014

This and inline IR should probably go via an RFC.

@kmcallister
Copy link
Contributor Author

Maybe codegen plugins are a more appropriate way to do this. I have a demo working on a Rust branch and it suits my use case well, because I want to set some attributes globally and others on specific functions.

@thestinger
Copy link
Contributor

There aren't many of these attributes so I think we should just expose the ones that are useful for Rust. For example, there's already a #[cold] attribute.

@kmcallister kmcallister added A-codegen Area: Code generation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. labels Sep 27, 2014
@steveklabnik
Copy link
Member

Triage: no update specifically.

@alexcrichton
Copy link
Member

It's unlikely that this would end up ever being stabilized because we don't want to tie ourselves so closely to LLVM, and we already export a good number of the useful attributes from LLVM. We can add more over time but a general mechanism to just forward everything through is pretty scary from a backwards-compatibility perspective, so I'm going to close this for now. Any missing attributes we're not using in LLVM can certainly have attributes added for them though!

bors added a commit to rust-lang-ci/rust that referenced this issue Jul 17, 2023
Purge of unwraps

Removes unnecessary unwraps that I have overlooked in rust-lang#15101 ( fixes rust-lang#15176 )
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-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
Projects
None yet
Development

No branches or pull requests

7 participants