authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-02-16 15:58:47+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-02-17 19:17:56+01:00
loge0f8d4e68e159f3b33ab7397f54379345ec683a9
tree3f076ec7b3885eea1992401ba96b3a43d133ff93
parent9c015e6c2b7b153f1a5897caf872a9428f232b47
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.builtin: Rename CallingConvention.wasm_watc to wasm_mvp.


7 files changed, 19 insertions(+), 20 deletions(-)

lib/std/Target.zig+2-3
......@@ -1794,7 +1794,7 @@ pub const Cpu = struct {
17941794 .powerpc_aix_altivec,
17951795 => &.{ .powerpc, .powerpcle },
17961796
1797 .wasm_watc,
1797 .wasm_mvp,
17981798 => &.{ .wasm64, .wasm32 },
17991799
18001800 .arc_sysv,
......@@ -3322,8 +3322,7 @@ pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention {
33223322 .aix => .{ .powerpc_aix = .{} },
33233323 else => .{ .powerpc_sysv = .{} },
33243324 },
3325 .wasm32 => .{ .wasm_watc = .{} },
3326 .wasm64 => .{ .wasm_watc = .{} },
3325 .wasm32, .wasm64 => .{ .wasm_mvp = .{} },
33273326 .arc => .{ .arc_sysv = .{} },
33283327 .avr => .avr_gnu,
33293328 .bpfel, .bpfeb => .{ .bpf_std = .{} },
lib/std/builtin.zig+1-1
......@@ -325,7 +325,7 @@ pub const CallingConvention = union(enum(u8)) {
325325 powerpc_aix_altivec: CommonOptions,
326326
327327 /// The standard `wasm32` and `wasm64` calling convention, as specified in the WebAssembly Tool Conventions.
328 wasm_watc: CommonOptions,
328 wasm_mvp: CommonOptions,
329329
330330 /// The standard `arc` calling convention.
331331 arc_sysv: CommonOptions,
src/Sema.zig+1-1
......@@ -9425,7 +9425,7 @@ const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention
94259425 .powerpc_sysv_altivec,
94269426 .powerpc_aix,
94279427 .powerpc_aix_altivec,
9428 .wasm_watc,
9428 .wasm_mvp,
94299429 .arc_sysv,
94309430 .avr_gnu,
94319431 .bpf_std,
src/Zcu.zig+1-1
......@@ -4237,7 +4237,7 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.builtin.CallingConvention) union(enu
42374237 };
42384238 },
42394239 .stage2_wasm => switch (cc) {
4240 .wasm_watc => |opts| opts.incoming_stack_alignment == null,
4240 .wasm_mvp => |opts| opts.incoming_stack_alignment == null,
42414241 else => false,
42424242 },
42434243 .stage2_arm => switch (cc) {
src/arch/wasm/CodeGen.zig+8-8
......@@ -1396,7 +1396,7 @@ fn resolveCallingConventionValues(
13961396 result.local_index += 1;
13971397 }
13981398 },
1399 .wasm_watc => {
1399 .wasm_mvp => {
14001400 for (fn_info.param_types.get(ip)) |ty| {
14011401 const ty_classes = abi.classifyType(Type.fromInterned(ty), zcu);
14021402 for (ty_classes) |class| {
......@@ -1421,7 +1421,7 @@ pub fn firstParamSRet(
14211421 switch (cc) {
14221422 .@"inline" => unreachable,
14231423 .auto => return isByRef(return_type, zcu, target),
1424 .wasm_watc => {
1424 .wasm_mvp => {
14251425 const ty_classes = abi.classifyType(return_type, zcu);
14261426 if (ty_classes[0] == .indirect) return true;
14271427 if (ty_classes[0] == .direct and ty_classes[1] == .direct) return true;
......@@ -1434,7 +1434,7 @@ pub fn firstParamSRet(
14341434/// Lowers a Zig type and its value based on a given calling convention to ensure
14351435/// it matches the ABI.
14361436fn lowerArg(cg: *CodeGen, cc: std.builtin.CallingConvention, ty: Type, value: WValue) !void {
1437 if (cc != .wasm_watc) {
1437 if (cc != .wasm_mvp) {
14381438 return cg.lowerToStack(value);
14391439 }
14401440
......@@ -2124,7 +2124,7 @@ fn airRet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
21242124 // to the stack instead
21252125 if (cg.return_value != .none) {
21262126 try cg.store(cg.return_value, operand, ret_ty, 0);
2127 } else if (fn_info.cc == .wasm_watc and ret_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
2127 } else if (fn_info.cc == .wasm_mvp and ret_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
21282128 switch (ret_ty.zigTypeTag(zcu)) {
21292129 // Aggregate types can be lowered as a singular value
21302130 .@"struct", .@"union" => {
......@@ -2268,7 +2268,7 @@ fn airCall(cg: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModifie
22682268 } else if (first_param_sret) {
22692269 break :result_value sret;
22702270 // TODO: Make this less fragile and optimize
2271 } else if (zcu.typeToFunc(fn_ty).?.cc == .wasm_watc and ret_ty.zigTypeTag(zcu) == .@"struct" or ret_ty.zigTypeTag(zcu) == .@"union") {
2271 } else if (zcu.typeToFunc(fn_ty).?.cc == .wasm_mvp and ret_ty.zigTypeTag(zcu) == .@"struct" or ret_ty.zigTypeTag(zcu) == .@"union") {
22722272 const result_local = try cg.allocLocal(ret_ty);
22732273 try cg.addLocal(.local_set, result_local.local.value);
22742274 const scalar_type = abi.scalarType(ret_ty, zcu);
......@@ -2546,7 +2546,7 @@ fn airArg(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
25462546 const arg = cg.args[arg_index];
25472547 const cc = zcu.typeToFunc(zcu.navValue(cg.owner_nav).typeOf(zcu)).?.cc;
25482548 const arg_ty = cg.typeOfIndex(inst);
2549 if (cc == .wasm_watc) {
2549 if (cc == .wasm_mvp) {
25502550 const arg_classes = abi.classifyType(arg_ty, zcu);
25512551 for (arg_classes) |class| {
25522552 if (class != .none) {
......@@ -7047,7 +7047,7 @@ fn callIntrinsic(
70477047
70487048 // Always pass over C-ABI
70497049
7050 const want_sret_param = firstParamSRet(.{ .wasm_watc = .{} }, return_type, zcu, cg.target);
7050 const want_sret_param = firstParamSRet(.{ .wasm_mvp = .{} }, return_type, zcu, cg.target);
70517051 // if we want return as first param, we allocate a pointer to stack,
70527052 // and emit it as our first argument
70537053 const sret = if (want_sret_param) blk: {
......@@ -7060,7 +7060,7 @@ fn callIntrinsic(
70607060 for (args, 0..) |arg, arg_i| {
70617061 assert(!(want_sret_param and arg == .stack));
70627062 assert(Type.fromInterned(param_types[arg_i]).hasRuntimeBitsIgnoreComptime(zcu));
7063 try cg.lowerArg(.{ .wasm_watc = .{} }, Type.fromInterned(param_types[arg_i]), arg);
7063 try cg.lowerArg(.{ .wasm_mvp = .{} }, Type.fromInterned(param_types[arg_i]), arg);
70647064 }
70657065
70667066 try cg.addInst(.{ .tag = .call_intrinsic, .data = .{ .intrinsic = intrinsic } });
src/codegen/llvm.zig+4-4
......@@ -11811,7 +11811,7 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: std.Targ
1181111811 .powerpc_sysv_altivec,
1181211812 .powerpc_aix,
1181311813 .powerpc_aix_altivec,
11814 .wasm_watc,
11814 .wasm_mvp,
1181511815 .arc_sysv,
1181611816 .avr_gnu,
1181711817 .bpf_std,
......@@ -11988,7 +11988,7 @@ fn firstParamSRet(fn_info: InternPool.Key.FuncType, zcu: *Zcu, target: std.Targe
1198811988 .x86_64_win => x86_64_abi.classifyWindows(return_type, zcu) == .memory,
1198911989 .x86_sysv, .x86_win => isByRef(return_type, zcu),
1199011990 .x86_stdcall => !isScalar(zcu, return_type),
11991 .wasm_watc => wasm_c_abi.classifyType(return_type, zcu)[0] == .indirect,
11991 .wasm_mvp => wasm_c_abi.classifyType(return_type, zcu)[0] == .indirect,
1199211992 .aarch64_aapcs,
1199311993 .aarch64_aapcs_darwin,
1199411994 .aarch64_aapcs_win,
......@@ -12073,7 +12073,7 @@ fn lowerFnRetTy(o: *Object, fn_info: InternPool.Key.FuncType) Allocator.Error!Bu
1207312073 return o.builder.structType(.normal, types[0..types_len]);
1207412074 },
1207512075 },
12076 .wasm_watc => {
12076 .wasm_mvp => {
1207712077 if (isScalar(zcu, return_type)) {
1207812078 return o.lowerType(return_type);
1207912079 }
......@@ -12338,7 +12338,7 @@ const ParamTypeIterator = struct {
1233812338 },
1233912339 }
1234012340 },
12341 .wasm_watc => {
12341 .wasm_mvp => {
1234212342 it.zig_index += 1;
1234312343 it.llvm_index += 1;
1234412344 if (isScalar(zcu, ty)) {
src/link/Wasm.zig+2-2
......@@ -4600,7 +4600,7 @@ fn convertZcuFnType(
46004600 if (CodeGen.firstParamSRet(cc, return_type, zcu, target)) {
46014601 try params_buffer.append(gpa, .i32); // memory address is always a 32-bit handle
46024602 } else if (return_type.hasRuntimeBitsIgnoreComptime(zcu)) {
4603 if (cc == .wasm_watc) {
4603 if (cc == .wasm_mvp) {
46044604 const res_classes = abi.classifyType(return_type, zcu);
46054605 assert(res_classes[0] == .direct and res_classes[1] == .none);
46064606 const scalar_type = abi.scalarType(return_type, zcu);
......@@ -4618,7 +4618,7 @@ fn convertZcuFnType(
46184618 if (!param_type.hasRuntimeBitsIgnoreComptime(zcu)) continue;
46194619
46204620 switch (cc) {
4621 .wasm_watc => {
4621 .wasm_mvp => {
46224622 const param_classes = abi.classifyType(param_type, zcu);
46234623 if (param_classes[1] == .none) {
46244624 if (param_classes[0] == .direct) {