Skip to content

Minimal codegen support: numbers and function parameters #2

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

Merged
merged 11 commits into from
Oct 27, 2024

Conversation

Wybxc
Copy link
Contributor

@Wybxc Wybxc commented Sep 12, 2024

This is a minimal yet complete C code generation implementation, capable of compiling functions with number-typed parameters and as expressions.

The structure is organized as follows:

  • crates/rustc_codegen_c: Implementation of the codegen backend.
  • crates/rustc_codegen_c_ast: C syntax structure for generating C source code.
  • bootstrap: Build system for executing rustc with this codegen backend enabled.
  • example: Example files demonstrating the capabilities of the codegen backend.
  • tests: Test cases for validating functionality.

@tgross35
Copy link
Contributor

tgross35 commented Sep 17, 2024

Thanks for getting this started! Is it possible to put bootstrap and CI into its own PR so that can be merged first, before the codegen part?

(it will take me a little while to review this all, still don't have my usual github access)

@Wybxc
Copy link
Contributor Author

Wybxc commented Sep 19, 2024

Understood, I'm working on #3

@Wybxc Wybxc mentioned this pull request Sep 20, 2024
@tgross35
Copy link
Contributor

This can be rebased now that #3 merged. If it is possible to split this further for smaller review units then that would be great (e.g. AST crate first and codegen separately), but if not than this shouldn't be too bad with bootstrap out of the picture.

@tgross35
Copy link
Contributor

Could you put the license files into a separate PR that we can merge right away? Guess we are currently unlicensed.

Otherwise I'll try to look at this tomorrow-ish.

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Added some initial comments, but I still have a lot more to go through.

Could you please add documentation comments? Most everything that isn't a trait implementation or a trivial function could benefit (it's a bit tough to figure out how things fit together without them).

@tgross35
Copy link
Contributor

rustc_codegen_c_ast is pretty self-contained, it would be good to move that to its own PR as well.

@tgross35 tgross35 changed the title Minimal codegen support: numbers and function paramters Minimal codegen support: numbers and function parameters Oct 22, 2024
@tgross35
Copy link
Contributor

#6 merged so this can be rebased again.

It may be nice to just close this and open a new PR from the same branch to start fresh, since many of the comments here are related to things that have already merged.

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Nothing else stands out to me so I think we should merge this, then follow up with issues for any problems that come up. Please resolve the last remaining open discussion then clean up history.

@Wybxc Wybxc requested a review from tgross35 October 27, 2024 10:46
@tgross35 tgross35 merged commit 763d3eb into rust-lang:main Oct 27, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants