authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-05-20 15:50:56-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-10 20:47:53-07:00
logdfb3521160eb4397b7482de68796d370230a8d11
treef40c8351fec5f2a71e76d402a4d37fdc57f5858e
parent115c08956278b79c848e04c2f4eefca40e6cd8a3

compiler: remove var_args_param_type from SimpleType

This is now represented instead by a special `InternPool.Index.Tag` that has no corresponding type/value.

5 files changed, 10 insertions(+), 22 deletions(-)

src/Air.zig+3-1
......@@ -905,7 +905,6 @@ pub const Inst = struct {
905905 const_slice_u8_sentinel_0_type = @enumToInt(InternPool.Index.const_slice_u8_sentinel_0_type),
906906 anyerror_void_error_union_type = @enumToInt(InternPool.Index.anyerror_void_error_union_type),
907907 generic_poison_type = @enumToInt(InternPool.Index.generic_poison_type),
908 var_args_param_type = @enumToInt(InternPool.Index.var_args_param_type),
909908 empty_struct_type = @enumToInt(InternPool.Index.empty_struct_type),
910909 undef = @enumToInt(InternPool.Index.undef),
911910 zero = @enumToInt(InternPool.Index.zero),
......@@ -926,6 +925,9 @@ pub const Inst = struct {
926925 empty_struct = @enumToInt(InternPool.Index.empty_struct),
927926 generic_poison = @enumToInt(InternPool.Index.generic_poison),
928927
928 /// This Ref does not correspond to any AIR instruction or constant
929 /// value. It is used to handle argument types of var args functions.
930 var_args_param_type = @enumToInt(InternPool.Index.var_args_param_type),
929931 /// This Ref does not correspond to any AIR instruction or constant
930932 /// value and may instead be used as a sentinel to indicate null.
931933 none = @enumToInt(InternPool.Index.none),
src/InternPool.zig+2-5
......@@ -959,7 +959,6 @@ pub const Index = enum(u32) {
959959 const_slice_u8_sentinel_0_type,
960960 anyerror_void_error_union_type,
961961 generic_poison_type,
962 var_args_param_type,
963962 /// `@TypeOf(.{})`
964963 empty_struct_type,
965964
......@@ -1002,6 +1001,8 @@ pub const Index = enum(u32) {
10021001 /// is not known until generic function instantiation.
10031002 generic_poison,
10041003
1004 /// Used by Air/Sema only.
1005 var_args_param_type = std.math.maxInt(u32) - 1,
10051006 none = std.math.maxInt(u32),
10061007
10071008 _,
......@@ -1195,9 +1196,6 @@ pub const static_keys = [_]Key{
11951196 // generic_poison_type
11961197 .{ .simple_type = .generic_poison },
11971198
1198 // var_args_param_type
1199 .{ .simple_type = .var_args_param },
1200
12011199 // empty_struct_type
12021200 .{ .anon_struct_type = .{
12031201 .types = &.{},
......@@ -1570,7 +1568,6 @@ pub const SimpleType = enum(u32) {
15701568 type_info,
15711569
15721570 generic_poison,
1573 var_args_param,
15741571};
15751572
15761573pub const SimpleValue = enum(u32) {
src/Sema.zig+2-5
......@@ -31657,7 +31657,6 @@ pub fn resolveTypeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool {
3165731657 .anyerror,
3165831658 .noreturn,
3165931659 .generic_poison,
31660 .var_args_param,
3166131660 .atomic_order,
3166231661 .atomic_rmw_op,
3166331662 .calling_convention,
......@@ -31856,6 +31855,8 @@ pub fn resolveTypeFields(sema: *Sema, ty: Type) CompileError!Type {
3185631855 const mod = sema.mod;
3185731856
3185831857 switch (ty.ip_index) {
31858 .var_args_param_type => unreachable,
31859
3185931860 // TODO: After the InternPool transition is complete, change this to `unreachable`.
3186031861 .none => return ty,
3186131862
......@@ -31909,7 +31910,6 @@ pub fn resolveTypeFields(sema: *Sema, ty: Type) CompileError!Type {
3190931910 .const_slice_u8_sentinel_0_type,
3191031911 .anyerror_void_error_union_type,
3191131912 .generic_poison_type,
31912 .var_args_param_type,
3191331913 .empty_struct_type,
3191431914 => return ty,
3191531915
......@@ -33123,7 +33123,6 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {
3312333123 .undefined => Value.undef,
3312433124
3312533125 .generic_poison => return error.GenericPoison,
33126 .var_args_param => unreachable,
3312733126 },
3312833127 .struct_type => |struct_type| {
3312933128 const resolved_ty = try sema.resolveTypeFields(ty);
......@@ -33678,8 +33677,6 @@ pub fn typeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool {
3367833677 .enum_literal,
3367933678 .type_info,
3368033679 => true,
33681
33682 .var_args_param => unreachable,
3368333680 },
3368433681 .struct_type => |struct_type| {
3368533682 const struct_obj = mod.structPtrUnwrap(struct_type.index) orelse return false;
src/Zir.zig+3-1
......@@ -2112,7 +2112,6 @@ pub const Inst = struct {
21122112 const_slice_u8_sentinel_0_type = @enumToInt(InternPool.Index.const_slice_u8_sentinel_0_type),
21132113 anyerror_void_error_union_type = @enumToInt(InternPool.Index.anyerror_void_error_union_type),
21142114 generic_poison_type = @enumToInt(InternPool.Index.generic_poison_type),
2115 var_args_param_type = @enumToInt(InternPool.Index.var_args_param_type),
21162115 empty_struct_type = @enumToInt(InternPool.Index.empty_struct_type),
21172116 undef = @enumToInt(InternPool.Index.undef),
21182117 zero = @enumToInt(InternPool.Index.zero),
......@@ -2133,6 +2132,9 @@ pub const Inst = struct {
21332132 empty_struct = @enumToInt(InternPool.Index.empty_struct),
21342133 generic_poison = @enumToInt(InternPool.Index.generic_poison),
21352134
2135 /// This tag is here to match Air and InternPool, however it is unused
2136 /// for ZIR purposes.
2137 var_args_param_type = @enumToInt(InternPool.Index.var_args_param_type),
21362138 /// This Ref does not correspond to any ZIR instruction or constant
21372139 /// value and may instead be used as a sentinel to indicate null.
21382140 none = @enumToInt(InternPool.Index.none),
src/type.zig-10
......@@ -105,7 +105,6 @@ pub const Type = struct {
105105 .type_info => .Union,
106106
107107 .generic_poison => return error.GenericPoison,
108 .var_args_param => unreachable,
109108 },
110109
111110 // values, not types
......@@ -803,7 +802,6 @@ pub const Type = struct {
803802 => false,
804803
805804 .generic_poison => unreachable,
806 .var_args_param => unreachable,
807805 },
808806 .struct_type => |struct_type| {
809807 const struct_obj = mod.structPtrUnwrap(struct_type.index) orelse {
......@@ -952,8 +950,6 @@ pub const Type = struct {
952950 .type_info,
953951 .generic_poison,
954952 => false,
955
956 .var_args_param => unreachable,
957953 },
958954 .struct_type => |struct_type| {
959955 const struct_obj = mod.structPtrUnwrap(struct_type.index) orelse {
......@@ -1198,7 +1194,6 @@ pub const Type = struct {
11981194
11991195 .noreturn => unreachable,
12001196 .generic_poison => unreachable,
1201 .var_args_param => unreachable,
12021197 },
12031198 .struct_type => |struct_type| {
12041199 const struct_obj = mod.structPtrUnwrap(struct_type.index) orelse
......@@ -1610,7 +1605,6 @@ pub const Type = struct {
16101605 .type_info => unreachable,
16111606 .noreturn => unreachable,
16121607 .generic_poison => unreachable,
1613 .var_args_param => unreachable,
16141608 },
16151609 .struct_type => |struct_type| switch (ty.containerLayout(mod)) {
16161610 .Packed => {
......@@ -1841,7 +1835,6 @@ pub const Type = struct {
18411835 .undefined => unreachable,
18421836 .enum_literal => unreachable,
18431837 .generic_poison => unreachable,
1844 .var_args_param => unreachable,
18451838
18461839 .atomic_order => unreachable, // missing call to resolveTypeFields
18471840 .atomic_rmw_op => unreachable, // missing call to resolveTypeFields
......@@ -2717,7 +2710,6 @@ pub const Type = struct {
27172710 .undefined => return Value.undef,
27182711
27192712 .generic_poison => unreachable,
2720 .var_args_param => unreachable,
27212713 },
27222714 .struct_type => |struct_type| {
27232715 if (mod.structPtrUnwrap(struct_type.index)) |s| {
......@@ -2896,8 +2888,6 @@ pub const Type = struct {
28962888 .enum_literal,
28972889 .type_info,
28982890 => true,
2899
2900 .var_args_param => unreachable,
29012891 },
29022892 .struct_type => |struct_type| {
29032893 // A struct with no fields is not comptime-only.