diff --git a/doc/langref.html.in b/doc/langref.html.in index c8830b796c..3effdafd5c 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -4275,7 +4275,7 @@ test "using @typeInfo with runtime values" { } // Calls to `isFieldOptional` on `Struct1` get unrolled to an equivalent -// of this function: +// of this function: fn isFieldOptionalUnrolled(field_index: usize) !bool { return switch (field_index) { 0 => false, @@ -7800,7 +7800,7 @@ comptime { {#header_close#} {#header_open|@call#} -
{#syntax#}@call(options: std.builtin.CallOptions, function: anytype, args: anytype) anytype{#endsyntax#}
+ {#syntax#}@call(modifier: std.builtin.CallModifier, function: anytype, args: anytype) anytype{#endsyntax#}
Calls a function, in the same way that invoking an expression with parentheses does:
@@ -7808,7 +7808,7 @@ comptime { const expect = @import("std").testing.expect; test "noinline function call" { - try expect(@call(.{}, add, .{3, 9}) == 12); + try expect(@call(.auto, add, .{3, 9}) == 12); } fn add(a: i32, b: i32) i32 { @@ -7817,48 +7817,41 @@ fn add(a: i32, b: i32) i32 { {#code_end#}{#syntax#}@call{#endsyntax#} allows more flexibility than normal function call syntax does. The - {#syntax#}CallOptions{#endsyntax#} struct is reproduced here: + {#syntax#}CallModifier{#endsyntax#} enum is reproduced here:
- {#syntax_block|zig|builtin.CallOptions struct#} -pub const CallOptions = struct { - modifier: Modifier = .auto, + {#syntax_block|zig|builtin.CallModifier struct#} +pub const CallModifier = enum { + /// Equivalent to function call syntax. + auto, - /// Only valid when `Modifier` is `Modifier.async_kw`. - stack: ?[]align(std.Target.stack_align) u8 = null, + /// Equivalent to async keyword used with function call syntax. + async_kw, - pub const Modifier = enum { - /// Equivalent to function call syntax. - auto, + /// Prevents tail call optimization. This guarantees that the return + /// address will point to the callsite, as opposed to the callsite's + /// callsite. If the call is otherwise required to be tail-called + /// or inlined, a compile error is emitted instead. + never_tail, - /// Equivalent to async keyword used with function call syntax. - async_kw, + /// Guarantees that the call will not be inlined. If the call is + /// otherwise required to be inlined, a compile error is emitted instead. + never_inline, - /// Prevents tail call optimization. This guarantees that the return - /// address will point to the callsite, as opposed to the callsite's - /// callsite. If the call is otherwise required to be tail-called - /// or inlined, a compile error is emitted instead. - never_tail, + /// Asserts that the function call will not suspend. This allows a + /// non-async function to call an async function. + no_async, - /// Guarantees that the call will not be inlined. If the call is - /// otherwise required to be inlined, a compile error is emitted instead. - never_inline, + /// Guarantees that the call will be generated with tail call optimization. + /// If this is not possible, a compile error is emitted instead. + always_tail, - /// Asserts that the function call will not suspend. This allows a - /// non-async function to call an async function. - no_async, + /// Guarantees that the call will inlined at the callsite. + /// If this is not possible, a compile error is emitted instead. + always_inline, - /// Guarantees that the call will be generated with tail call optimization. - /// If this is not possible, a compile error is emitted instead. - always_tail, - - /// Guarantees that the call will inlined at the callsite. - /// If this is not possible, a compile error is emitted instead. - always_inline, - - /// Evaluates the call at compile-time. If the call cannot be completed at - /// compile-time, a compile error is emitted instead. - compile_time, - }; + /// Evaluates the call at compile-time. If the call cannot be completed at + /// compile-time, a compile error is emitted instead. + compile_time, }; {#end_syntax_block#} {#header_close#} diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 4ee9d4306b..eb1212607d 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -591,45 +591,38 @@ fn testVersionParse() !void { /// This data structure is used by the Zig language code generation and /// therefore must be kept in sync with the compiler implementation. -pub const CallOptions = struct { - modifier: Modifier = .auto, +pub const CallModifier = enum { + /// Equivalent to function call syntax. + auto, - /// Only valid when `Modifier` is `Modifier.async_kw`. - stack: ?[]align(std.Target.stack_align) u8 = null, + /// Equivalent to async keyword used with function call syntax. + async_kw, - pub const Modifier = enum { - /// Equivalent to function call syntax. - auto, + /// Prevents tail call optimization. This guarantees that the return + /// address will point to the callsite, as opposed to the callsite's + /// callsite. If the call is otherwise required to be tail-called + /// or inlined, a compile error is emitted instead. + never_tail, - /// Equivalent to async keyword used with function call syntax. - async_kw, + /// Guarantees that the call will not be inlined. If the call is + /// otherwise required to be inlined, a compile error is emitted instead. + never_inline, - /// Prevents tail call optimization. This guarantees that the return - /// address will point to the callsite, as opposed to the callsite's - /// callsite. If the call is otherwise required to be tail-called - /// or inlined, a compile error is emitted instead. - never_tail, + /// Asserts that the function call will not suspend. This allows a + /// non-async function to call an async function. + no_async, - /// Guarantees that the call will not be inlined. If the call is - /// otherwise required to be inlined, a compile error is emitted instead. - never_inline, + /// Guarantees that the call will be generated with tail call optimization. + /// If this is not possible, a compile error is emitted instead. + always_tail, - /// Asserts that the function call will not suspend. This allows a - /// non-async function to call an async function. - no_async, + /// Guarantees that the call will inlined at the callsite. + /// If this is not possible, a compile error is emitted instead. + always_inline, - /// Guarantees that the call will be generated with tail call optimization. - /// If this is not possible, a compile error is emitted instead. - always_tail, - - /// Guarantees that the call will inlined at the callsite. - /// If this is not possible, a compile error is emitted instead. - always_inline, - - /// Evaluates the call at compile-time. If the call cannot be completed at - /// compile-time, a compile error is emitted instead. - compile_time, - }; + /// Evaluates the call at compile-time. If the call cannot be completed at + /// compile-time, a compile error is emitted instead. + compile_time, }; /// This data structure is used by the Zig language code generation and diff --git a/src/AstGen.zig b/src/AstGen.zig index 021990883a..8df3d56a88 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -8297,11 +8297,11 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .call => { - const options = try comptimeExpr(gz, scope, .{ .rl = .{ .ty = .call_options_type } }, params[0]); + const modifier = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .modifier_type } }, params[0]); const callee = try calleeExpr(gz, scope, params[1]); const args = try expr(gz, scope, .{ .rl = .none }, params[2]); const result = try gz.addPlNode(.builtin_call, node, Zir.Inst.BuiltinCall{ - .options = options, + .modifier = modifier, .callee = callee, .args = args, .flags = .{ @@ -8674,7 +8674,7 @@ fn callExpr( const astgen = gz.astgen; const callee = try calleeExpr(gz, scope, call.ast.fn_expr); - const modifier: std.builtin.CallOptions.Modifier = blk: { + const modifier: std.builtin.CallModifier = blk: { if (gz.force_comptime) { break :blk .compile_time; } diff --git a/src/Sema.zig b/src/Sema.zig index 3bad0b2b5f..885cdeb277 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -5986,7 +5986,7 @@ fn zirCall( const extra = sema.code.extraData(Zir.Inst.Call, inst_data.payload_index); const args_len = extra.data.flags.args_len; - const modifier = @intToEnum(std.builtin.CallOptions.Modifier, extra.data.flags.packed_modifier); + const modifier = @intToEnum(std.builtin.CallModifier, extra.data.flags.packed_modifier); const ensure_result_used = extra.data.flags.ensure_result_used; const pop_error_return_trace = extra.data.flags.pop_error_return_trace; @@ -6222,7 +6222,7 @@ fn analyzeCall( func: Air.Inst.Ref, func_src: LazySrcLoc, call_src: LazySrcLoc, - modifier: std.builtin.CallOptions.Modifier, + modifier: std.builtin.CallModifier, ensure_result_used: bool, uncasted_args: []const Air.Inst.Ref, bound_arg_src: ?LazySrcLoc, @@ -20751,118 +20751,66 @@ fn zirMulAdd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. }); } -fn resolveCallOptions( - sema: *Sema, - block: *Block, - src: LazySrcLoc, - zir_ref: Zir.Inst.Ref, - is_comptime: bool, - is_nosuspend: bool, - func: Air.Inst.Ref, - func_src: LazySrcLoc, -) CompileError!std.builtin.CallOptions.Modifier { - const call_options_ty = try sema.getBuiltinType("CallOptions"); - const air_ref = try sema.resolveInst(zir_ref); - const options = try sema.coerce(block, call_options_ty, air_ref, src); - - const modifier_src = sema.maybeOptionsSrc(block, src, "modifier"); - const stack_src = sema.maybeOptionsSrc(block, src, "stack"); - - const modifier = try sema.fieldVal(block, src, options, "modifier", modifier_src); - const modifier_val = try sema.resolveConstValue(block, modifier_src, modifier, "call modifier must be comptime-known"); - const wanted_modifier = modifier_val.toEnum(std.builtin.CallOptions.Modifier); - - const stack = try sema.fieldVal(block, src, options, "stack", stack_src); - const stack_val = try sema.resolveConstValue(block, stack_src, stack, "call stack value must be comptime-known"); - - if (!stack_val.isNull()) { - return sema.fail(block, stack_src, "TODO: implement @call with stack", .{}); - } - - switch (wanted_modifier) { - // These can be upgraded to comptime or nosuspend calls. - .auto, .never_tail, .no_async => { - if (is_comptime) { - if (wanted_modifier == .never_tail) { - return sema.fail(block, modifier_src, "unable to perform 'never_tail' call at compile-time", .{}); - } - return .compile_time; - } - if (is_nosuspend) { - return .no_async; - } - return wanted_modifier; - }, - // These can be upgraded to comptime. nosuspend bit can be safely ignored. - .always_inline, .compile_time => { - _ = (try sema.resolveDefinedValue(block, func_src, func)) orelse { - return sema.fail(block, func_src, "modifier '{s}' requires a comptime-known function", .{@tagName(wanted_modifier)}); - }; - - if (is_comptime) { - return .compile_time; - } - return wanted_modifier; - }, - .always_tail => { - if (is_comptime) { - return .compile_time; - } - return wanted_modifier; - }, - .async_kw => { - if (is_nosuspend) { - return sema.fail(block, modifier_src, "modifier 'async_kw' cannot be used inside nosuspend block", .{}); - } - if (is_comptime) { - return sema.fail(block, modifier_src, "modifier 'async_kw' cannot be used in combination with comptime function call", .{}); - } - return wanted_modifier; - }, - .never_inline => { - if (is_comptime) { - return sema.fail(block, modifier_src, "unable to perform 'never_inline' call at compile-time", .{}); - } - return wanted_modifier; - }, - } -} - fn zirBuiltinCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { const tracy = trace(@src()); defer tracy.end(); const inst_data = sema.code.instructions.items(.data)[inst].pl_node; - const options_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; + const modifier_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; const func_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; const args_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node }; const call_src = inst_data.src(); const extra = sema.code.extraData(Zir.Inst.BuiltinCall, inst_data.payload_index).data; var func = try sema.resolveInst(extra.callee); - const modifier = sema.resolveCallOptions( - block, - .unneeded, - extra.options, - extra.flags.is_comptime, - extra.flags.is_nosuspend, - func, - func_src, - ) catch |err| switch (err) { - error.NeededSourceLocation => { - _ = try sema.resolveCallOptions( - block, - options_src, - extra.options, - extra.flags.is_comptime, - extra.flags.is_nosuspend, - func, - func_src, - ); - return error.AnalysisFail; + + const modifier_ty = try sema.getBuiltinType("CallModifier"); + const air_ref = try sema.resolveInst(extra.modifier); + const modifier_ref = try sema.coerce(block, modifier_ty, air_ref, modifier_src); + const modifier_val = try sema.resolveConstValue(block, modifier_src, modifier_ref, "call modifier must be comptime-known"); + var modifier = modifier_val.toEnum(std.builtin.CallModifier); + switch (modifier) { + // These can be upgraded to comptime or nosuspend calls. + .auto, .never_tail, .no_async => { + if (extra.flags.is_comptime) { + if (modifier == .never_tail) { + return sema.fail(block, modifier_src, "unable to perform 'never_tail' call at compile-time", .{}); + } + modifier = .compile_time; + } else if (extra.flags.is_nosuspend) { + modifier = .no_async; + } }, - else => |e| return e, - }; + // These can be upgraded to comptime. nosuspend bit can be safely ignored. + .always_inline, .compile_time => { + _ = (try sema.resolveDefinedValue(block, func_src, func)) orelse { + return sema.fail(block, func_src, "modifier '{s}' requires a comptime-known function", .{@tagName(modifier)}); + }; + + if (extra.flags.is_comptime) { + modifier = .compile_time; + } + }, + .always_tail => { + if (extra.flags.is_comptime) { + modifier = .compile_time; + } + }, + .async_kw => { + if (extra.flags.is_nosuspend) { + return sema.fail(block, modifier_src, "modifier 'async_kw' cannot be used inside nosuspend block", .{}); + } + if (extra.flags.is_comptime) { + return sema.fail(block, modifier_src, "modifier 'async_kw' cannot be used in combination with comptime function call", .{}); + } + }, + .never_inline => { + if (extra.flags.is_comptime) { + return sema.fail(block, modifier_src, "unable to perform 'never_inline' call at compile-time", .{}); + } + }, + } + const args = try sema.resolveInst(extra.args); const args_ty = sema.typeOf(args); @@ -29558,7 +29506,7 @@ pub fn resolveTypeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -29823,7 +29771,7 @@ pub fn resolveTypeFields(sema: *Sema, ty: Type) CompileError!Type { .address_space => return sema.getBuiltinType("AddressSpace"), .float_mode => return sema.getBuiltinType("FloatMode"), .reduce_op => return sema.getBuiltinType("ReduceOp"), - .call_options => return sema.getBuiltinType("CallOptions"), + .modifier => return sema.getBuiltinType("CallModifier"), .prefetch_options => return sema.getBuiltinType("PrefetchOptions"), else => return ty, @@ -30841,7 +30789,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -31164,7 +31112,7 @@ pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref { .address_space => return .address_space_type, .float_mode => return .float_mode_type, .reduce_op => return .reduce_op_type, - .call_options => return .call_options_type, + .modifier => return .modifier_type, .prefetch_options => return .prefetch_options_type, .export_options => return .export_options_type, .extern_options => return .extern_options_type, @@ -31557,7 +31505,7 @@ pub fn typeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -32387,7 +32335,7 @@ fn enumHasInt( .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, diff --git a/src/TypedValue.zig b/src/TypedValue.zig index 3c1972c78d..805448d540 100644 --- a/src/TypedValue.zig +++ b/src/TypedValue.zig @@ -136,7 +136,7 @@ pub fn print( .address_space_type => return writer.writeAll("std.builtin.AddressSpace"), .float_mode_type => return writer.writeAll("std.builtin.FloatMode"), .reduce_op_type => return writer.writeAll("std.builtin.ReduceOp"), - .call_options_type => return writer.writeAll("std.builtin.CallOptions"), + .modifier_type => return writer.writeAll("std.builtin.CallModifier"), .prefetch_options_type => return writer.writeAll("std.builtin.PrefetchOptions"), .export_options_type => return writer.writeAll("std.builtin.ExportOptions"), .extern_options_type => return writer.writeAll("std.builtin.ExternOptions"), diff --git a/src/Zir.zig b/src/Zir.zig index ed425ea73e..6e7164878c 100644 --- a/src/Zir.zig +++ b/src/Zir.zig @@ -2070,7 +2070,7 @@ pub const Inst = struct { address_space_type, float_mode_type, reduce_op_type, - call_options_type, + modifier_type, prefetch_options_type, export_options_type, extern_options_type, @@ -2345,9 +2345,9 @@ pub const Inst = struct { .ty = Type.initTag(.type), .val = Value.initTag(.reduce_op_type), }, - .call_options_type = .{ + .modifier_type = .{ .ty = Type.initTag(.type), - .val = Value.initTag(.call_options_type), + .val = Value.initTag(.modifier_type), }, .prefetch_options_type = .{ .ty = Type.initTag(.type), @@ -2832,7 +2832,7 @@ pub const Inst = struct { callee: Ref, pub const Flags = packed struct { - /// std.builtin.CallOptions.Modifier in packed form + /// std.builtin.CallModifier in packed form pub const PackedModifier = u3; pub const PackedArgsLen = u27; @@ -2844,7 +2844,7 @@ pub const Inst = struct { comptime { if (@sizeOf(Flags) != 4 or @bitSizeOf(Flags) != 32) @compileError("Layout of Call.Flags needs to be updated!"); - if (@bitSizeOf(std.builtin.CallOptions.Modifier) != @bitSizeOf(PackedModifier)) + if (@bitSizeOf(std.builtin.CallModifier) != @bitSizeOf(PackedModifier)) @compileError("Call.Flags.PackedModifier needs to be updated!"); } }; @@ -2860,7 +2860,7 @@ pub const Inst = struct { // Note: Flags *must* come first so that unusedResultExpr // can find it when it goes to modify them. flags: Flags, - options: Ref, + modifier: Ref, callee: Ref, args: Ref, diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig index 2edc6cb7f9..e09664598a 100644 --- a/src/arch/aarch64/CodeGen.zig +++ b/src/arch/aarch64/CodeGen.zig @@ -4110,7 +4110,7 @@ fn airFence(self: *Self) !void { //return self.finishAirBookkeeping(); } -fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.Modifier) !void { +fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { if (modifier == .always_tail) return self.fail("TODO implement tail calls for aarch64", .{}); const pl_op = self.air.instructions.items(.data)[inst].pl_op; const callee = pl_op.operand; diff --git a/src/arch/arm/CodeGen.zig b/src/arch/arm/CodeGen.zig index 6125ef1914..8197d85b48 100644 --- a/src/arch/arm/CodeGen.zig +++ b/src/arch/arm/CodeGen.zig @@ -4097,7 +4097,7 @@ fn airFence(self: *Self) !void { //return self.finishAirBookkeeping(); } -fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.Modifier) !void { +fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { if (modifier == .always_tail) return self.fail("TODO implement tail calls for arm", .{}); const pl_op = self.air.instructions.items(.data)[inst].pl_op; const callee = pl_op.operand; diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig index 6a54ffeea2..58661926bb 100644 --- a/src/arch/riscv64/CodeGen.zig +++ b/src/arch/riscv64/CodeGen.zig @@ -1672,7 +1672,7 @@ fn airFence(self: *Self) !void { //return self.finishAirBookkeeping(); } -fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.Modifier) !void { +fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { if (modifier == .always_tail) return self.fail("TODO implement tail calls for riscv64", .{}); const pl_op = self.air.instructions.items(.data)[inst].pl_op; const fn_ty = self.air.typeOf(pl_op.operand); diff --git a/src/arch/sparc64/CodeGen.zig b/src/arch/sparc64/CodeGen.zig index 604fd3e69f..6eac6ba4fc 100644 --- a/src/arch/sparc64/CodeGen.zig +++ b/src/arch/sparc64/CodeGen.zig @@ -1155,7 +1155,7 @@ fn airBreakpoint(self: *Self) !void { return self.finishAirBookkeeping(); } -fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.Modifier) !void { +fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { if (modifier == .always_tail) return self.fail("TODO implement tail calls for {}", .{self.target.cpu.arch}); const pl_op = self.air.instructions.items(.data)[inst].pl_op; diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig index faed432a38..8596016a24 100644 --- a/src/arch/wasm/CodeGen.zig +++ b/src/arch/wasm/CodeGen.zig @@ -2003,7 +2003,7 @@ fn airRetLoad(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { return func.finishAir(inst, .none, &.{un_op}); } -fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.Modifier) InnerError!void { +fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) InnerError!void { if (modifier == .always_tail) return func.fail("TODO implement tail calls for wasm", .{}); const pl_op = func.air.instructions.items(.data)[inst].pl_op; const extra = func.air.extraData(Air.Call, pl_op.payload); diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index cd36642b03..bfb60bf74a 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -3899,7 +3899,7 @@ fn airFence(self: *Self) !void { //return self.finishAirBookkeeping(); } -fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.Modifier) !void { +fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { if (modifier == .always_tail) return self.fail("TODO implement tail calls for x86_64", .{}); const pl_op = self.air.instructions.items(.data)[inst].pl_op; const callee = pl_op.operand; diff --git a/src/codegen/c.zig b/src/codegen/c.zig index b78c9e9b1a..55b9cd4b77 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -3874,7 +3874,7 @@ fn airSlice(f: *Function, inst: Air.Inst.Index) !CValue { fn airCall( f: *Function, inst: Air.Inst.Index, - modifier: std.builtin.CallOptions.Modifier, + modifier: std.builtin.CallModifier, ) !CValue { // Not even allowed to call panic in a naked function. if (f.object.dg.decl.ty.fnCallingConvention() == .Naked) return .none; diff --git a/src/print_zir.zig b/src/print_zir.zig index 542f0e977d..6dbaf51bc3 100644 --- a/src/print_zir.zig +++ b/src/print_zir.zig @@ -801,7 +801,7 @@ const Writer = struct { try self.writeFlag(stream, "nosuspend ", extra.flags.is_nosuspend); try self.writeFlag(stream, "comptime ", extra.flags.is_comptime); - try self.writeInstRef(stream, extra.options); + try self.writeInstRef(stream, extra.modifier); try stream.writeAll(", "); try self.writeInstRef(stream, extra.callee); try stream.writeAll(", "); @@ -1170,7 +1170,7 @@ const Writer = struct { if (extra.data.flags.ensure_result_used) { try stream.writeAll("nodiscard "); } - try stream.print(".{s}, ", .{@tagName(@intToEnum(std.builtin.CallOptions.Modifier, extra.data.flags.packed_modifier))}); + try stream.print(".{s}, ", .{@tagName(@intToEnum(std.builtin.CallModifier, extra.data.flags.packed_modifier))}); try self.writeInstRef(stream, extra.data.callee); try stream.writeAll(", ["); diff --git a/src/type.zig b/src/type.zig index e64f310d79..93e8c4b502 100644 --- a/src/type.zig +++ b/src/type.zig @@ -129,7 +129,6 @@ pub const Type = extern union { .empty_struct, .empty_struct_literal, .@"struct", - .call_options, .prefetch_options, .export_options, .extern_options, @@ -147,6 +146,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, + .modifier, => return .Enum, .@"union", @@ -885,7 +885,6 @@ pub const Type = extern union { // we can't compare these based on tags because it wouldn't detect if, // for example, a was resolved into .@"struct" but b was one of these tags. - .call_options, .prefetch_options, .export_options, .extern_options, @@ -914,6 +913,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, + .modifier, => unreachable, // needed to resolve the type before now .@"union", .union_safety_tagged, .union_tagged => { @@ -1194,7 +1194,6 @@ pub const Type = extern union { }, // we can't hash these based on tags because they wouldn't match the expanded version. - .call_options, .prefetch_options, .export_options, .extern_options, @@ -1222,6 +1221,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, + .modifier, => unreachable, // needed to resolve the type before now .@"union", .union_safety_tagged, .union_tagged => { @@ -1333,7 +1333,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -1665,7 +1665,7 @@ pub const Type = extern union { .address_space => return writer.writeAll("std.builtin.AddressSpace"), .float_mode => return writer.writeAll("std.builtin.FloatMode"), .reduce_op => return writer.writeAll("std.builtin.ReduceOp"), - .call_options => return writer.writeAll("std.builtin.CallOptions"), + .modifier => return writer.writeAll("std.builtin.CallModifier"), .prefetch_options => return writer.writeAll("std.builtin.PrefetchOptions"), .export_options => return writer.writeAll("std.builtin.ExportOptions"), .extern_options => return writer.writeAll("std.builtin.ExternOptions"), @@ -1943,7 +1943,7 @@ pub const Type = extern union { .address_space => unreachable, .float_mode => unreachable, .reduce_op => unreachable, - .call_options => unreachable, + .modifier => unreachable, .prefetch_options => unreachable, .export_options => unreachable, .extern_options => unreachable, @@ -2311,7 +2311,7 @@ pub const Type = extern union { .address_space => return Value.initTag(.address_space_type), .float_mode => return Value.initTag(.float_mode_type), .reduce_op => return Value.initTag(.reduce_op_type), - .call_options => return Value.initTag(.call_options_type), + .modifier => return Value.initTag(.modifier_type), .prefetch_options => return Value.initTag(.prefetch_options_type), .export_options => return Value.initTag(.export_options_type), .extern_options => return Value.initTag(.extern_options_type), @@ -2385,7 +2385,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -2631,7 +2631,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -2873,7 +2873,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -3257,7 +3257,7 @@ pub const Type = extern union { .inferred_alloc_mut => unreachable, .var_args_param => unreachable, .generic_poison => unreachable, - .call_options => unreachable, // missing call to resolveTypeFields + .modifier => unreachable, // missing call to resolveTypeFields .prefetch_options => unreachable, // missing call to resolveTypeFields .export_options => unreachable, // missing call to resolveTypeFields .extern_options => unreachable, // missing call to resolveTypeFields @@ -3753,7 +3753,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -4279,7 +4279,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -4306,7 +4306,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -4990,7 +4990,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -5165,7 +5165,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -5483,7 +5483,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -5565,7 +5565,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -5878,7 +5878,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -5926,7 +5926,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, @@ -5991,7 +5991,7 @@ pub const Type = extern union { address_space, float_mode, reduce_op, - call_options, + modifier, prefetch_options, export_options, extern_options, @@ -6131,7 +6131,7 @@ pub const Type = extern union { .address_space, .float_mode, .reduce_op, - .call_options, + .modifier, .prefetch_options, .export_options, .extern_options, diff --git a/src/value.zig b/src/value.zig index dc0b150abc..f37fec13bb 100644 --- a/src/value.zig +++ b/src/value.zig @@ -71,7 +71,7 @@ pub const Value = extern union { address_space_type, float_mode_type, reduce_op_type, - call_options_type, + modifier_type, prefetch_options_type, export_options_type, extern_options_type, @@ -264,7 +264,7 @@ pub const Value = extern union { .address_space_type, .float_mode_type, .reduce_op_type, - .call_options_type, + .modifier_type, .prefetch_options_type, .export_options_type, .extern_options_type, @@ -467,7 +467,7 @@ pub const Value = extern union { .address_space_type, .float_mode_type, .reduce_op_type, - .call_options_type, + .modifier_type, .prefetch_options_type, .export_options_type, .extern_options_type, @@ -723,7 +723,7 @@ pub const Value = extern union { .address_space_type => return out_stream.writeAll("std.builtin.AddressSpace"), .float_mode_type => return out_stream.writeAll("std.builtin.FloatMode"), .reduce_op_type => return out_stream.writeAll("std.builtin.ReduceOp"), - .call_options_type => return out_stream.writeAll("std.builtin.CallOptions"), + .modifier_type => return out_stream.writeAll("std.builtin.CallModifier"), .prefetch_options_type => return out_stream.writeAll("std.builtin.PrefetchOptions"), .export_options_type => return out_stream.writeAll("std.builtin.ExportOptions"), .extern_options_type => return out_stream.writeAll("std.builtin.ExternOptions"), @@ -963,7 +963,7 @@ pub const Value = extern union { .address_space_type => Type.initTag(.address_space), .float_mode_type => Type.initTag(.float_mode), .reduce_op_type => Type.initTag(.reduce_op), - .call_options_type => Type.initTag(.call_options), + .modifier_type => Type.initTag(.modifier), .prefetch_options_type => Type.initTag(.prefetch_options), .export_options_type => Type.initTag(.export_options), .extern_options_type => Type.initTag(.extern_options),