| author | |
| committer | |
| log | 2d9a167cd2235ce221a9b3aec23a0e537c151380 |
| tree | 31edcd6974b2700b2146c4247d8b77be908ee344 |
| parent | cbfe00b17df276fcf89faa1bb4380ed7f43156a0 |
| signature |
11 files changed, 16 insertions(+), 16 deletions(-)
lib/std/Target.zig+2-2| ... | ... | @@ -1612,7 +1612,7 @@ pub const Cpu = struct { |
| 1612 | 1612 | |
| 1613 | 1613 | /// Returns the array of `Arch` to which a specific `std.builtin.CallingConvention` applies. |
| 1614 | 1614 | /// Asserts that `cc` is not `.auto`, `.@"async"`, `.naked`, or `.@"inline"`. |
| 1615 | pub fn fromCallconv(cc: std.builtin.CallingConvention.Tag) []const Arch { | |
| 1615 | pub fn fromCallingConvention(cc: std.builtin.CallingConvention.Tag) []const Arch { | |
| 1616 | 1616 | return switch (cc) { |
| 1617 | 1617 | .auto, |
| 1618 | 1618 | .@"async", |
| ... | ... | @@ -3032,7 +3032,7 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 { |
| 3032 | 3032 | ); |
| 3033 | 3033 | } |
| 3034 | 3034 | |
| 3035 | pub fn defaultCCallingConvention(target: Target) ?std.builtin.CallingConvention { | |
| 3035 | pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention { | |
| 3036 | 3036 | return switch (target.cpu.arch) { |
| 3037 | 3037 | .x86_64 => switch (target.os.tag) { |
| 3038 | 3038 | .windows, .uefi => .{ .x86_64_win = .{} }, |
lib/std/builtin.zig+2-2| ... | ... | @@ -171,7 +171,7 @@ pub const CallingConvention = union(enum(u8)) { |
| 171 | 171 | |
| 172 | 172 | /// This is an alias for the default C calling convention for this target. |
| 173 | 173 | /// Functions marked as `extern` or `export` are given this calling convention by default. |
| 174 | pub const c = builtin.target.defaultCCallingConvention().?; | |
| 174 | pub const c = builtin.target.cCallingConvention().?; | |
| 175 | 175 | |
| 176 | 176 | pub const winapi: CallingConvention = switch (builtin.target.cpu.arch) { |
| 177 | 177 | .x86_64 => .{ .x86_64_win = .{} }, |
| ... | ... | @@ -482,7 +482,7 @@ pub const CallingConvention = union(enum(u8)) { |
| 482 | 482 | /// Returns the array of `std.Target.Cpu.Arch` to which this `CallingConvention` applies. |
| 483 | 483 | /// Asserts that `cc` is not `.auto`, `.@"async"`, `.naked`, or `.@"inline"`. |
| 484 | 484 | pub fn archs(cc: CallingConvention) []const std.Target.Cpu.Arch { |
| 485 | return std.Target.Cpu.Arch.fromCallconv(cc); | |
| 485 | return std.Target.Cpu.Arch.fromCallingConvention(cc); | |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | pub fn eql(a: CallingConvention, b: CallingConvention) bool { |
src/Sema.zig+3-3| ... | ... | @@ -9499,11 +9499,11 @@ fn zirFunc( |
| 9499 | 9499 | break :exported zir_decl.flags.is_export; |
| 9500 | 9500 | }; |
| 9501 | 9501 | if (fn_is_exported) { |
| 9502 | break :cc target.defaultCCallingConvention() orelse { | |
| 9502 | break :cc target.cCallingConvention() orelse { | |
| 9503 | 9503 | // This target has no default C calling convention. We sometimes trigger a similar |
| 9504 | 9504 | // error by trying to evaluate `std.builtin.CallingConvention.c`, so for consistency, |
| 9505 | 9505 | // let's eval that now and just get the transitive error. (It's guaranteed to error |
| 9506 | // because it does the exact `defaultCCallingConvention` call we just did.) | |
| 9506 | // because it does the exact `cCallingConvention` call we just did.) | |
| 9507 | 9507 | const cc_type = try sema.getBuiltinType("CallingConvention"); |
| 9508 | 9508 | _ = try sema.namespaceLookupVal( |
| 9509 | 9509 | block, |
| ... | ... | @@ -9717,7 +9717,7 @@ fn checkCallConvSupportsVarArgs(sema: *Sema, block: *Block, src: LazySrcLoc, cc: |
| 9717 | 9717 | _ = options; |
| 9718 | 9718 | var first = true; |
| 9719 | 9719 | for (calling_conventions_supporting_var_args) |cc_inner| { |
| 9720 | for (std.Target.Cpu.Arch.fromCallconv(cc_inner)) |supported_arch| { | |
| 9720 | for (std.Target.Cpu.Arch.fromCallingConvention(cc_inner)) |supported_arch| { | |
| 9721 | 9721 | if (supported_arch == ctx.arch) break; |
| 9722 | 9722 | } else continue; // callconv not supported by this arch |
| 9723 | 9723 | if (!first) { |
src/Type.zig+1-1| ... | ... | @@ -391,7 +391,7 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error |
| 391 | 391 | } |
| 392 | 392 | try writer.writeAll(") "); |
| 393 | 393 | if (fn_info.cc != .auto) print_cc: { |
| 394 | if (zcu.getTarget().defaultCCallingConvention()) |ccc| { | |
| 394 | if (zcu.getTarget().cCallingConvention()) |ccc| { | |
| 395 | 395 | if (fn_info.cc.eql(ccc)) { |
| 396 | 396 | try writer.writeAll("callconv(.c) "); |
| 397 | 397 | break :print_cc; |
src/Zcu.zig+1-1| ... | ... | @@ -3562,7 +3562,7 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.builtin.CallingConvention) union(enu |
| 3562 | 3562 | |
| 3563 | 3563 | .stage2_llvm => @import("codegen/llvm.zig").toLlvmCallConv(cc, target) != null, |
| 3564 | 3564 | .stage2_c => ok: { |
| 3565 | if (target.defaultCCallingConvention()) |default_c| { | |
| 3565 | if (target.cCallingConvention()) |default_c| { | |
| 3566 | 3566 | if (cc.eql(default_c)) { |
| 3567 | 3567 | break :ok true; |
| 3568 | 3568 | } |
src/arch/riscv64/CodeGen.zig+1-1| ... | ... | @@ -4895,7 +4895,7 @@ fn genCall( |
| 4895 | 4895 | .lib => |lib| try pt.funcType(.{ |
| 4896 | 4896 | .param_types = lib.param_types, |
| 4897 | 4897 | .return_type = lib.return_type, |
| 4898 | .cc = func.target.defaultCCallingConvention().?, | |
| 4898 | .cc = func.target.cCallingConvention().?, | |
| 4899 | 4899 | }), |
| 4900 | 4900 | }; |
| 4901 | 4901 |
src/arch/x86_64/CodeGen.zig+1-1| ... | ... | @@ -12384,7 +12384,7 @@ fn genCall(self: *Self, info: union(enum) { |
| 12384 | 12384 | .lib => |lib| try pt.funcType(.{ |
| 12385 | 12385 | .param_types = lib.param_types, |
| 12386 | 12386 | .return_type = lib.return_type, |
| 12387 | .cc = self.target.defaultCCallingConvention().?, | |
| 12387 | .cc = self.target.cCallingConvention().?, | |
| 12388 | 12388 | }), |
| 12389 | 12389 | }; |
| 12390 | 12390 | const fn_info = zcu.typeToFunc(fn_ty).?; |
src/codegen/c.zig+1-1| ... | ... | @@ -7612,7 +7612,7 @@ fn toCallingConvention(cc: std.builtin.CallingConvention, zcu: *Zcu) ?[]const u8 |
| 7612 | 7612 | .x86_vectorcall, .x86_64_vectorcall => "vectorcall", |
| 7613 | 7613 | else => { |
| 7614 | 7614 | // `Zcu.callconvSupported` means this must be the C callconv. |
| 7615 | assert(cc.eql(zcu.getTarget().defaultCCallingConvention().?)); | |
| 7615 | assert(cc.eql(zcu.getTarget().cCallingConvention().?)); | |
| 7616 | 7616 | return null; |
| 7617 | 7617 | }, |
| 7618 | 7618 | }; |
src/codegen/llvm.zig+2-2| ... | ... | @@ -11616,7 +11616,7 @@ pub fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) ?Ca |
| 11616 | 11616 | }; |
| 11617 | 11617 | } |
| 11618 | 11618 | fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: std.Target) ?Builder.CallConv { |
| 11619 | if (target.defaultCCallingConvention()) |default_c| { | |
| 11619 | if (target.cCallingConvention()) |default_c| { | |
| 11620 | 11620 | if (cc_tag == default_c) { |
| 11621 | 11621 | return .ccc; |
| 11622 | 11622 | } |
| ... | ... | @@ -11668,7 +11668,7 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: std.Targ |
| 11668 | 11668 | .nvptx_kernel => .ptx_kernel, |
| 11669 | 11669 | |
| 11670 | 11670 | // All the calling conventions which LLVM does not have a general representation for. |
| 11671 | // Note that these are often still supported through the `defaultCCallingConvention` path above via `ccc`. | |
| 11671 | // Note that these are often still supported through the `cCallingConvention` path above via `ccc`. | |
| 11672 | 11672 | .x86_sysv, |
| 11673 | 11673 | .x86_win, |
| 11674 | 11674 | .x86_thiscall_mingw, |
src/link/Coff.zig+1-1| ... | ... | @@ -1484,7 +1484,7 @@ pub fn updateExports( |
| 1484 | 1484 | const exported_nav = ip.getNav(exported_nav_index); |
| 1485 | 1485 | const exported_ty = exported_nav.typeOf(ip); |
| 1486 | 1486 | if (!ip.isFunctionType(exported_ty)) continue; |
| 1487 | const c_cc = target.defaultCCallingConvention().?; | |
| 1487 | const c_cc = target.cCallingConvention().?; | |
| 1488 | 1488 | const winapi_cc: std.builtin.CallingConvention = switch (target.cpu.arch) { |
| 1489 | 1489 | .x86 => .{ .x86_stdcall = .{} }, |
| 1490 | 1490 | else => c_cc, |
src/link/Dwarf.zig+1-1| ... | ... | @@ -3399,7 +3399,7 @@ fn updateType( |
| 3399 | 3399 | try wip_nav.abbrevCode(if (is_nullary) .nullary_func_type else .func_type); |
| 3400 | 3400 | try wip_nav.strp(name); |
| 3401 | 3401 | const cc: DW.CC = cc: { |
| 3402 | if (zcu.getTarget().defaultCCallingConvention()) |cc| { | |
| 3402 | if (zcu.getTarget().cCallingConvention()) |cc| { | |
| 3403 | 3403 | if (@as(std.builtin.CallingConvention.Tag, cc) == func_type.cc) { |
| 3404 | 3404 | break :cc .normal; |
| 3405 | 3405 | } |