Skip to content

Rewrite platform intrinsic generation as a build script #41885

Closed
@alexcrichton

Description

@alexcrichton

Right now the compiler has a rustc_platform_intrinsics crate which is basically a database of all platform intrinsics with their inputs/outputs and LLVM names, etc. This is the information the compiler uses to typecheck all intrinsics and also generate code for them with LLVM. An example generated file looks like aarch64.rs.

These files are all generated by a generator.py script in the src/etc dir. This generator slurps up a ton of JSON definitions, for example all the files in src/etc/platform-intrinsics/x86 and then generates these Rust files.

Now that we're using Cargo as a build system we can avoid checking in these generated source files. Instead we can translate generator.py into Rust as a build script and use build-time code generation to generate all of these files.

This isn't necessarily an easy task because generator.py is not exactly a trivial script, but I'm more than willing to help out if anyone's got any questions!

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.E-help-wantedCall for participation: Help is requested to fix this issue.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-infraRelevant to the infrastructure team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions