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

Proposal: Move architecture-specific information from std.builtin to @import("builtin") #9330

Closed
Snektron opened this issue Jul 7, 2021 · 2 comments
Labels
proposal This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone

Comments

@Snektron
Copy link
Collaborator

Snektron commented Jul 7, 2021

Currently, std.builtin contains architecture-specific information about calling conventions:

zig/lib/std/builtin.zig

Lines 156 to 172 in 9de452f

pub const CallingConvention = enum {
Unspecified,
C,
Naked,
Async,
Inline,
Interrupt,
Signal,
Stdcall,
Fastcall,
Vectorcall,
Thiscall,
APCS,
AAPCS,
AAPCSVFP,
SysV,
};

Using architecture-specific calling conventions on the improper architecture yields a compile-error as expected.

With relevance to #653, I believe this information should be moved to std.target, so that address space definitions (which are also architecture-specific) can also live there. Note that calling conventions share a good portion of calling conventions, so maybe this requires some .ArchitectureSpecific: std.target.CallingConvention variant in std.builtin.CallingConvention.

On a side note, maybe std.builtin and @import("builtin") should not have the same name.

@Vexu Vexu added the proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. label Jul 8, 2021
@Vexu Vexu added this to the 0.9.0 milestone Jul 8, 2021
@marler8997
Copy link
Contributor

My guess is that stuff goes into the builtin module if the compiler "depends" on it. I think the compiler avoids depending on anything in std other than what's in the builtin module.

@nektro
Copy link
Contributor

nektro commented Jul 10, 2021

i think std.builtin is for the stuff that doesn't change (ie the types of things). builtin.zig is generated by the compiler and saved in zig-cache

@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 Nov 24, 2021
@andrewrk andrewrk modified the milestones: 0.10.0, 0.11.0 Apr 16, 2022
@andrewrk andrewrk modified the milestones: 0.11.0, 0.12.0 Jun 19, 2023
@andrewrk andrewrk closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal This issue suggests modifications. If it also has the "accepted" label then it is planned.
Projects
None yet
Development

No branches or pull requests

5 participants