| author | |
| committer | |
| log | e0f8d4e68e159f3b33ab7397f54379345ec683a9 |
| tree | 3f076ec7b3885eea1992401ba96b3a43d133ff93 |
| parent | 9c015e6c2b7b153f1a5897caf872a9428f232b47 |
| signature |
7 files changed, 19 insertions(+), 20 deletions(-)
lib/std/Target.zig+2-3| ... | ... | @@ -1794,7 +1794,7 @@ pub const Cpu = struct { |
| 1794 | 1794 | .powerpc_aix_altivec, |
| 1795 | 1795 | => &.{ .powerpc, .powerpcle }, |
| 1796 | 1796 | |
| 1797 | .wasm_watc, | |
| 1797 | .wasm_mvp, | |
| 1798 | 1798 | => &.{ .wasm64, .wasm32 }, |
| 1799 | 1799 | |
| 1800 | 1800 | .arc_sysv, |
| ... | ... | @@ -3322,8 +3322,7 @@ pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention { |
| 3322 | 3322 | .aix => .{ .powerpc_aix = .{} }, |
| 3323 | 3323 | else => .{ .powerpc_sysv = .{} }, |
| 3324 | 3324 | }, |
| 3325 | .wasm32 => .{ .wasm_watc = .{} }, | |
| 3326 | .wasm64 => .{ .wasm_watc = .{} }, | |
| 3325 | .wasm32, .wasm64 => .{ .wasm_mvp = .{} }, | |
| 3327 | 3326 | .arc => .{ .arc_sysv = .{} }, |
| 3328 | 3327 | .avr => .avr_gnu, |
| 3329 | 3328 | .bpfel, .bpfeb => .{ .bpf_std = .{} }, |
lib/std/builtin.zig+1-1| ... | ... | @@ -325,7 +325,7 @@ pub const CallingConvention = union(enum(u8)) { |
| 325 | 325 | powerpc_aix_altivec: CommonOptions, |
| 326 | 326 | |
| 327 | 327 | /// The standard `wasm32` and `wasm64` calling convention, as specified in the WebAssembly Tool Conventions. |
| 328 | wasm_watc: CommonOptions, | |
| 328 | wasm_mvp: CommonOptions, | |
| 329 | 329 | |
| 330 | 330 | /// The standard `arc` calling convention. |
| 331 | 331 | arc_sysv: CommonOptions, |
src/Sema.zig+1-1| ... | ... | @@ -9425,7 +9425,7 @@ const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention |
| 9425 | 9425 | .powerpc_sysv_altivec, |
| 9426 | 9426 | .powerpc_aix, |
| 9427 | 9427 | .powerpc_aix_altivec, |
| 9428 | .wasm_watc, | |
| 9428 | .wasm_mvp, | |
| 9429 | 9429 | .arc_sysv, |
| 9430 | 9430 | .avr_gnu, |
| 9431 | 9431 | .bpf_std, |
src/Zcu.zig+1-1| ... | ... | @@ -4237,7 +4237,7 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.builtin.CallingConvention) union(enu |
| 4237 | 4237 | }; |
| 4238 | 4238 | }, |
| 4239 | 4239 | .stage2_wasm => switch (cc) { |
| 4240 | .wasm_watc => |opts| opts.incoming_stack_alignment == null, | |
| 4240 | .wasm_mvp => |opts| opts.incoming_stack_alignment == null, | |
| 4241 | 4241 | else => false, |
| 4242 | 4242 | }, |
| 4243 | 4243 | .stage2_arm => switch (cc) { |
src/arch/wasm/CodeGen.zig+8-8| ... | ... | @@ -1396,7 +1396,7 @@ fn resolveCallingConventionValues( |
| 1396 | 1396 | result.local_index += 1; |
| 1397 | 1397 | } |
| 1398 | 1398 | }, |
| 1399 | .wasm_watc => { | |
| 1399 | .wasm_mvp => { | |
| 1400 | 1400 | for (fn_info.param_types.get(ip)) |ty| { |
| 1401 | 1401 | const ty_classes = abi.classifyType(Type.fromInterned(ty), zcu); |
| 1402 | 1402 | for (ty_classes) |class| { |
| ... | ... | @@ -1421,7 +1421,7 @@ pub fn firstParamSRet( |
| 1421 | 1421 | switch (cc) { |
| 1422 | 1422 | .@"inline" => unreachable, |
| 1423 | 1423 | .auto => return isByRef(return_type, zcu, target), |
| 1424 | .wasm_watc => { | |
| 1424 | .wasm_mvp => { | |
| 1425 | 1425 | const ty_classes = abi.classifyType(return_type, zcu); |
| 1426 | 1426 | if (ty_classes[0] == .indirect) return true; |
| 1427 | 1427 | if (ty_classes[0] == .direct and ty_classes[1] == .direct) return true; |
| ... | ... | @@ -1434,7 +1434,7 @@ pub fn firstParamSRet( |
| 1434 | 1434 | /// Lowers a Zig type and its value based on a given calling convention to ensure |
| 1435 | 1435 | /// it matches the ABI. |
| 1436 | 1436 | fn lowerArg(cg: *CodeGen, cc: std.builtin.CallingConvention, ty: Type, value: WValue) !void { |
| 1437 | if (cc != .wasm_watc) { | |
| 1437 | if (cc != .wasm_mvp) { | |
| 1438 | 1438 | return cg.lowerToStack(value); |
| 1439 | 1439 | } |
| 1440 | 1440 | |
| ... | ... | @@ -2124,7 +2124,7 @@ fn airRet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2124 | 2124 | // to the stack instead |
| 2125 | 2125 | if (cg.return_value != .none) { |
| 2126 | 2126 | 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)) { | |
| 2128 | 2128 | switch (ret_ty.zigTypeTag(zcu)) { |
| 2129 | 2129 | // Aggregate types can be lowered as a singular value |
| 2130 | 2130 | .@"struct", .@"union" => { |
| ... | ... | @@ -2268,7 +2268,7 @@ fn airCall(cg: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModifie |
| 2268 | 2268 | } else if (first_param_sret) { |
| 2269 | 2269 | break :result_value sret; |
| 2270 | 2270 | // 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") { | |
| 2272 | 2272 | const result_local = try cg.allocLocal(ret_ty); |
| 2273 | 2273 | try cg.addLocal(.local_set, result_local.local.value); |
| 2274 | 2274 | const scalar_type = abi.scalarType(ret_ty, zcu); |
| ... | ... | @@ -2546,7 +2546,7 @@ fn airArg(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2546 | 2546 | const arg = cg.args[arg_index]; |
| 2547 | 2547 | const cc = zcu.typeToFunc(zcu.navValue(cg.owner_nav).typeOf(zcu)).?.cc; |
| 2548 | 2548 | const arg_ty = cg.typeOfIndex(inst); |
| 2549 | if (cc == .wasm_watc) { | |
| 2549 | if (cc == .wasm_mvp) { | |
| 2550 | 2550 | const arg_classes = abi.classifyType(arg_ty, zcu); |
| 2551 | 2551 | for (arg_classes) |class| { |
| 2552 | 2552 | if (class != .none) { |
| ... | ... | @@ -7047,7 +7047,7 @@ fn callIntrinsic( |
| 7047 | 7047 | |
| 7048 | 7048 | // Always pass over C-ABI |
| 7049 | 7049 | |
| 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); | |
| 7051 | 7051 | // if we want return as first param, we allocate a pointer to stack, |
| 7052 | 7052 | // and emit it as our first argument |
| 7053 | 7053 | const sret = if (want_sret_param) blk: { |
| ... | ... | @@ -7060,7 +7060,7 @@ fn callIntrinsic( |
| 7060 | 7060 | for (args, 0..) |arg, arg_i| { |
| 7061 | 7061 | assert(!(want_sret_param and arg == .stack)); |
| 7062 | 7062 | 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); | |
| 7064 | 7064 | } |
| 7065 | 7065 | |
| 7066 | 7066 | 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 |
| 11811 | 11811 | .powerpc_sysv_altivec, |
| 11812 | 11812 | .powerpc_aix, |
| 11813 | 11813 | .powerpc_aix_altivec, |
| 11814 | .wasm_watc, | |
| 11814 | .wasm_mvp, | |
| 11815 | 11815 | .arc_sysv, |
| 11816 | 11816 | .avr_gnu, |
| 11817 | 11817 | .bpf_std, |
| ... | ... | @@ -11988,7 +11988,7 @@ fn firstParamSRet(fn_info: InternPool.Key.FuncType, zcu: *Zcu, target: std.Targe |
| 11988 | 11988 | .x86_64_win => x86_64_abi.classifyWindows(return_type, zcu) == .memory, |
| 11989 | 11989 | .x86_sysv, .x86_win => isByRef(return_type, zcu), |
| 11990 | 11990 | .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, | |
| 11992 | 11992 | .aarch64_aapcs, |
| 11993 | 11993 | .aarch64_aapcs_darwin, |
| 11994 | 11994 | .aarch64_aapcs_win, |
| ... | ... | @@ -12073,7 +12073,7 @@ fn lowerFnRetTy(o: *Object, fn_info: InternPool.Key.FuncType) Allocator.Error!Bu |
| 12073 | 12073 | return o.builder.structType(.normal, types[0..types_len]); |
| 12074 | 12074 | }, |
| 12075 | 12075 | }, |
| 12076 | .wasm_watc => { | |
| 12076 | .wasm_mvp => { | |
| 12077 | 12077 | if (isScalar(zcu, return_type)) { |
| 12078 | 12078 | return o.lowerType(return_type); |
| 12079 | 12079 | } |
| ... | ... | @@ -12338,7 +12338,7 @@ const ParamTypeIterator = struct { |
| 12338 | 12338 | }, |
| 12339 | 12339 | } |
| 12340 | 12340 | }, |
| 12341 | .wasm_watc => { | |
| 12341 | .wasm_mvp => { | |
| 12342 | 12342 | it.zig_index += 1; |
| 12343 | 12343 | it.llvm_index += 1; |
| 12344 | 12344 | if (isScalar(zcu, ty)) { |
src/link/Wasm.zig+2-2| ... | ... | @@ -4600,7 +4600,7 @@ fn convertZcuFnType( |
| 4600 | 4600 | if (CodeGen.firstParamSRet(cc, return_type, zcu, target)) { |
| 4601 | 4601 | try params_buffer.append(gpa, .i32); // memory address is always a 32-bit handle |
| 4602 | 4602 | } else if (return_type.hasRuntimeBitsIgnoreComptime(zcu)) { |
| 4603 | if (cc == .wasm_watc) { | |
| 4603 | if (cc == .wasm_mvp) { | |
| 4604 | 4604 | const res_classes = abi.classifyType(return_type, zcu); |
| 4605 | 4605 | assert(res_classes[0] == .direct and res_classes[1] == .none); |
| 4606 | 4606 | const scalar_type = abi.scalarType(return_type, zcu); |
| ... | ... | @@ -4618,7 +4618,7 @@ fn convertZcuFnType( |
| 4618 | 4618 | if (!param_type.hasRuntimeBitsIgnoreComptime(zcu)) continue; |
| 4619 | 4619 | |
| 4620 | 4620 | switch (cc) { |
| 4621 | .wasm_watc => { | |
| 4621 | .wasm_mvp => { | |
| 4622 | 4622 | const param_classes = abi.classifyType(param_type, zcu); |
| 4623 | 4623 | if (param_classes[1] == .none) { |
| 4624 | 4624 | if (param_classes[0] == .direct) { |