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

Cross-crate inlining #1765

Closed
nikomatsakis opened this issue Feb 6, 2012 · 2 comments
Closed

Cross-crate inlining #1765

nikomatsakis opened this issue Feb 6, 2012 · 2 comments
Labels
A-codegen Area: Code generation A-frontend Area: frontend (errors, parsing and HIR) A-linkage Area: linking into static, shared libraries and binaries A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot.

Comments

@nikomatsakis
Copy link
Contributor

We should be able to inline functions across crate boundaries. My current plan is to allow functions to be designated as inline. For such functions---along with generic functions---we will serialize the IR into the crate metadata. Then, when compiling, we will read out the IR as needed and instantiate a local version. Hopefully we can badger LLVM into doing the actual inlining for us.

I currently plan to serialize in EBML rather than pretty-printing. I believe this will be easier, because it will make it easy to encode the information found in various side tables (last use, etc). It will also allow us to preserve the line-number information, which strikes me as a requirement. It's basically some rote work that doesn't seem especially challenging. @pcwalton let me know if you think is really misguided. I will start today.

The bigger open questions are the "user interface" ones: should users designate inline functions explicitly? inline by default? I rather like the idea of being explicit about what might be inlined, since recompilation will be required for all clients if those functions change.

@graydon
Copy link
Contributor

graydon commented Feb 15, 2012

I concur, please require the use of an inline keyword at the declaration site.

@nikomatsakis
Copy link
Contributor Author

This is basically done.

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-frontend Area: frontend (errors, parsing and HIR) A-linkage Area: linking into static, shared libraries and binaries A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot.
Projects
None yet
Development

No branches or pull requests

2 participants