From 9c015e6c2b7b153f1a5897caf872a9428f232b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Fri, 24 Jan 2025 01:34:29 +0100 Subject: [PATCH] std.builtin: Remove CallingConvention.arm_(apcs,aapcs16_vfp). * arm_apcs is the long dead "OABI" which we never had working support for. * arm_aapcs16_vfp is for arm-watchos-none which is a dead target that we've dropped support for. --- lib/std/Target.zig | 2 -- lib/std/builtin.zig | 6 ------ src/Sema.zig | 2 -- src/Zcu.zig | 4 +--- src/codegen/c.zig | 2 +- src/codegen/llvm.zig | 16 ++++------------ src/link/Dwarf.zig | 5 +---- ...cs_aapcs_aapcsvfp_on_unsupported_platform.zig | 6 ++---- 8 files changed, 9 insertions(+), 34 deletions(-) diff --git a/lib/std/Target.zig b/lib/std/Target.zig index d36b4eaf6a..c74f0afdaf 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -1753,10 +1753,8 @@ pub const Cpu = struct { .aarch64_vfabi_sve, => &.{ .aarch64, .aarch64_be }, - .arm_apcs, .arm_aapcs, .arm_aapcs_vfp, - .arm_aapcs16_vfp, .arm_interrupt, => &.{ .arm, .armeb, .thumb, .thumbeb }, diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index eae6c16ede..374601fc38 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -220,8 +220,6 @@ pub const CallingConvention = union(enum(u8)) { }; /// Deprecated; use `.x86_thiscall`. pub const Thiscall: CallingConvention = .{ .x86_thiscall = .{} }; - /// Deprecated; do not use. - pub const APCS: CallingConvention = .{ .arm_apcs = .{} }; /// Deprecated; use `.arm_aapcs`. pub const AAPCS: CallingConvention = .{ .arm_aapcs = .{} }; /// Deprecated; use `.arm_aapcs_vfp`. @@ -284,14 +282,10 @@ pub const CallingConvention = union(enum(u8)) { aarch64_vfabi_sve: CommonOptions, // Calling convetions for the `arm`, `armeb`, `thumb`, and `thumbeb` architectures. - /// Deprecated; do not use. - arm_apcs: CommonOptions, // Removal of `arm_apcs` is blocked by #21842. /// ARM Architecture Procedure Call Standard arm_aapcs: CommonOptions, /// ARM Architecture Procedure Call Standard Vector Floating-Point arm_aapcs_vfp: CommonOptions, - /// Deprecated; do not use. - arm_aapcs16_vfp: CommonOptions, // Removal of `arm_aapcs16_vfp` is blocked by #21842. arm_interrupt: ArmInterruptOptions, // Calling conventions for the `mips64` and `mips64el` architectures. diff --git a/src/Sema.zig b/src/Sema.zig index a9d9ccb908..1559c12a09 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -9407,10 +9407,8 @@ const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention .aarch64_aapcs_win, .aarch64_vfabi, .aarch64_vfabi_sve, - .arm_apcs, .arm_aapcs, .arm_aapcs_vfp, - .arm_aapcs16_vfp, .mips64_n64, .mips64_n32, .mips_o32, diff --git a/src/Zcu.zig b/src/Zcu.zig index 89a2a8df6d..a5d21a804b 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -4209,9 +4209,7 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.builtin.CallingConvention) union(enu => |opts| opts.incoming_stack_alignment == null, .arm_aapcs_vfp, - => |opts| opts.incoming_stack_alignment == null and target.os.tag != .watchos, - .arm_aapcs16_vfp, - => |opts| opts.incoming_stack_alignment == null and target.os.tag == .watchos, + => |opts| opts.incoming_stack_alignment == null, .arm_interrupt, => |opts| opts.incoming_stack_alignment == null, diff --git a/src/codegen/c.zig b/src/codegen/c.zig index cdd249fd52..7dd2895911 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -7725,7 +7725,7 @@ fn toCallingConvention(cc: std.builtin.CallingConvention, zcu: *Zcu) ?[]const u8 .aarch64_vfabi_sve => "aarch64_sve_pcs", .arm_aapcs => "pcs(\"aapcs\")", - .arm_aapcs_vfp, .arm_aapcs16_vfp => "pcs(\"aapcs-vfp\")", + .arm_aapcs_vfp => "pcs(\"aapcs-vfp\")", .arm_interrupt => |opts| switch (opts.type) { .generic => "interrupt", diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 4556e07e10..9248edc1dc 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -11766,16 +11766,8 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: std.Targ .x86_interrupt => .x86_intrcc, .aarch64_vfabi => .aarch64_vector_pcs, .aarch64_vfabi_sve => .aarch64_sve_vector_pcs, - .arm_apcs => .arm_apcscc, .arm_aapcs => .arm_aapcscc, - .arm_aapcs_vfp => if (target.os.tag != .watchos) - .arm_aapcs_vfpcc - else - null, - .arm_aapcs16_vfp => if (target.os.tag == .watchos) - .arm_aapcs_vfpcc - else - null, + .arm_aapcs_vfp => .arm_aapcs_vfpcc, .riscv64_lp64_v => .riscv_vectorcallcc, .riscv32_ilp32_v => .riscv_vectorcallcc, .avr_builtin => .avr_builtincc, @@ -12001,7 +11993,7 @@ fn firstParamSRet(fn_info: InternPool.Key.FuncType, zcu: *Zcu, target: std.Targe .aarch64_aapcs_darwin, .aarch64_aapcs_win, => aarch64_c_abi.classifyType(return_type, zcu) == .memory, - .arm_aapcs, .arm_aapcs_vfp, .arm_aapcs16_vfp => switch (arm_c_abi.classifyType(return_type, zcu, .ret)) { + .arm_aapcs, .arm_aapcs_vfp => switch (arm_c_abi.classifyType(return_type, zcu, .ret)) { .memory, .i64_array => true, .i32_array => |size| size != 1, .byval => false, @@ -12051,7 +12043,7 @@ fn lowerFnRetTy(o: *Object, fn_info: InternPool.Key.FuncType) Allocator.Error!Bu .integer => return o.builder.intType(@intCast(return_type.bitSize(zcu))), .double_integer => return o.builder.arrayType(2, .i64), }, - .arm_aapcs, .arm_aapcs_vfp, .arm_aapcs16_vfp => switch (arm_c_abi.classifyType(return_type, zcu, .ret)) { + .arm_aapcs, .arm_aapcs_vfp => switch (arm_c_abi.classifyType(return_type, zcu, .ret)) { .memory, .i64_array => return .void, .i32_array => |len| return if (len == 1) .i32 else .void, .byval => return o.lowerType(return_type), @@ -12300,7 +12292,7 @@ const ParamTypeIterator = struct { .double_integer => return Lowering{ .i64_array = 2 }, } }, - .arm_aapcs, .arm_aapcs_vfp, .arm_aapcs16_vfp => { + .arm_aapcs, .arm_aapcs_vfp => { it.zig_index += 1; it.llvm_index += 1; switch (arm_c_abi.classifyType(ty, zcu, .arg)) { diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig index ff3570c673..e2a189e8e7 100644 --- a/src/link/Dwarf.zig +++ b/src/link/Dwarf.zig @@ -3538,11 +3538,8 @@ fn updateLazyType( .aarch64_vfabi => .LLVM_AAPCS, .aarch64_vfabi_sve => .LLVM_AAPCS, - .arm_apcs => .normal, .arm_aapcs => .LLVM_AAPCS, - .arm_aapcs_vfp, - .arm_aapcs16_vfp, - => .LLVM_AAPCS_VFP, + .arm_aapcs_vfp => .LLVM_AAPCS_VFP, .riscv64_lp64_v, .riscv32_ilp32_v, diff --git a/test/cases/compile_errors/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig b/test/cases/compile_errors/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig index ce1c80e9e6..4d4812253a 100644 --- a/test/cases/compile_errors/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig +++ b/test/cases/compile_errors/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig @@ -1,10 +1,8 @@ -export fn entry1() callconv(.APCS) void {} export fn entry2() callconv(.AAPCS) void {} export fn entry3() callconv(.AAPCSVFP) void {} // error // target=x86_64-linux-none // -// :1:30: error: calling convention 'arm_apcs' only available on architectures 'arm', 'armeb', 'thumb', 'thumbeb' -// :2:30: error: calling convention 'arm_aapcs' only available on architectures 'arm', 'armeb', 'thumb', 'thumbeb' -// :3:30: error: calling convention 'arm_aapcs_vfp' only available on architectures 'arm', 'armeb', 'thumb', 'thumbeb' +// :1:30: error: calling convention 'arm_aapcs' only available on architectures 'arm', 'armeb', 'thumb', 'thumbeb' +// :2:30: error: calling convention 'arm_aapcs_vfp' only available on architectures 'arm', 'armeb', 'thumb', 'thumbeb'