| ... | @@ -50,6 +50,7 @@ pub const Type = struct { | ... | @@ -50,6 +50,7 @@ pub const Type = struct { |
| 50 | .f64, | 50 | .f64, |
| 51 | .f80, | 51 | .f80, |
| 52 | .f128, | 52 | .f128, |
| | 53 | .c_longdouble, |
| 53 | => return .Float, | 54 | => return .Float, |
| 54 | | 55 | |
| 55 | .usize, | 56 | .usize, |
| ... | @@ -63,7 +64,6 @@ pub const Type = struct { | ... | @@ -63,7 +64,6 @@ pub const Type = struct { |
| 63 | .c_ulong, | 64 | .c_ulong, |
| 64 | .c_longlong, | 65 | .c_longlong, |
| 65 | .c_ulonglong, | 66 | .c_ulonglong, |
| 66 | .c_longdouble, | | |
| 67 | => return .Int, | 67 | => return .Int, |
| 68 | | 68 | |
| 69 | .anyopaque => return .Opaque, | 69 | .anyopaque => return .Opaque, |
| ... | @@ -134,14 +134,6 @@ pub const Type = struct { | ... | @@ -134,14 +134,6 @@ pub const Type = struct { |
| 134 | .c_ulonglong, | 134 | .c_ulonglong, |
| 135 | => return .Int, | 135 | => return .Int, |
| 136 | | 136 | |
| 137 | .f16, | | |
| 138 | .f32, | | |
| 139 | .f64, | | |
| 140 | .f80, | | |
| 141 | .f128, | | |
| 142 | .c_longdouble, | | |
| 143 | => return .Float, | | |
| 144 | | | |
| 145 | .error_set, | 137 | .error_set, |
| 146 | .error_set_single, | 138 | .error_set_single, |
| 147 | .anyerror, | 139 | .anyerror, |
| ... | @@ -154,7 +146,6 @@ pub const Type = struct { | ... | @@ -154,7 +146,6 @@ pub const Type = struct { |
| 154 | .void => return .Void, | 146 | .void => return .Void, |
| 155 | .type => return .Type, | 147 | .type => return .Type, |
| 156 | .comptime_int => return .ComptimeInt, | 148 | .comptime_int => return .ComptimeInt, |
| 157 | .comptime_float => return .ComptimeFloat, | | |
| 158 | .noreturn => return .NoReturn, | 149 | .noreturn => return .NoReturn, |
| 159 | .null => return .Null, | 150 | .null => return .Null, |
| 160 | .undefined => return .Undefined, | 151 | .undefined => return .Undefined, |
| ... | @@ -618,10 +609,13 @@ pub const Type = struct { | ... | @@ -618,10 +609,13 @@ pub const Type = struct { |
| 618 | } | 609 | } |
| 619 | | 610 | |
| 620 | pub fn eql(a: Type, b: Type, mod: *Module) bool { | 611 | pub fn eql(a: Type, b: Type, mod: *Module) bool { |
| 621 | // As a shortcut, if the small tags / addresses match, we're done. | | |
| 622 | if (a.ip_index != .none or b.ip_index != .none) { | 612 | if (a.ip_index != .none or b.ip_index != .none) { |
| | 613 | // The InternPool data structure hashes based on Key to make interned objects |
| | 614 | // unique. An Index can be treated simply as u32 value for the |
| | 615 | // purpose of Type/Value hashing and equality. |
| 623 | return a.ip_index == b.ip_index; | 616 | return a.ip_index == b.ip_index; |
| 624 | } | 617 | } |
| | 618 | // As a shortcut, if the small tags / addresses match, we're done. |
| 625 | if (a.legacy.tag_if_small_enough == b.legacy.tag_if_small_enough) return true; | 619 | if (a.legacy.tag_if_small_enough == b.legacy.tag_if_small_enough) return true; |
| 626 | | 620 | |
| 627 | switch (a.tag()) { | 621 | switch (a.tag()) { |
| ... | @@ -640,18 +634,10 @@ pub const Type = struct { | ... | @@ -640,18 +634,10 @@ pub const Type = struct { |
| 640 | .c_longlong, | 634 | .c_longlong, |
| 641 | .c_ulonglong, | 635 | .c_ulonglong, |
| 642 | | 636 | |
| 643 | .f16, | | |
| 644 | .f32, | | |
| 645 | .f64, | | |
| 646 | .f80, | | |
| 647 | .f128, | | |
| 648 | .c_longdouble, | | |
| 649 | | | |
| 650 | .bool, | 637 | .bool, |
| 651 | .void, | 638 | .void, |
| 652 | .type, | 639 | .type, |
| 653 | .comptime_int, | 640 | .comptime_int, |
| 654 | .comptime_float, | | |
| 655 | .noreturn, | 641 | .noreturn, |
| 656 | .null, | 642 | .null, |
| 657 | .undefined, | 643 | .undefined, |
| ... | @@ -1018,7 +1004,11 @@ pub const Type = struct { | ... | @@ -1018,7 +1004,11 @@ pub const Type = struct { |
| 1018 | | 1004 | |
| 1019 | pub fn hashWithHasher(ty: Type, hasher: *std.hash.Wyhash, mod: *Module) void { | 1005 | pub fn hashWithHasher(ty: Type, hasher: *std.hash.Wyhash, mod: *Module) void { |
| 1020 | if (ty.ip_index != .none) { | 1006 | if (ty.ip_index != .none) { |
| 1021 | return mod.intern_pool.indexToKey(ty.ip_index).hashWithHasher(hasher); | 1007 | // The InternPool data structure hashes based on Key to make interned objects |
| | 1008 | // unique. An Index can be treated simply as u32 value for the |
| | 1009 | // purpose of Type/Value hashing and equality. |
| | 1010 | std.hash.autoHash(hasher, ty.ip_index); |
| | 1011 | return; |
| 1022 | } | 1012 | } |
| 1023 | switch (ty.tag()) { | 1013 | switch (ty.tag()) { |
| 1024 | .generic_poison => unreachable, | 1014 | .generic_poison => unreachable, |
| ... | @@ -1039,22 +1029,10 @@ pub const Type = struct { | ... | @@ -1039,22 +1029,10 @@ pub const Type = struct { |
| 1039 | std.hash.autoHash(hasher, ty_tag); | 1029 | std.hash.autoHash(hasher, ty_tag); |
| 1040 | }, | 1030 | }, |
| 1041 | | 1031 | |
| 1042 | .f16, | | |
| 1043 | .f32, | | |
| 1044 | .f64, | | |
| 1045 | .f80, | | |
| 1046 | .f128, | | |
| 1047 | .c_longdouble, | | |
| 1048 | => |ty_tag| { | | |
| 1049 | std.hash.autoHash(hasher, std.builtin.TypeId.Float); | | |
| 1050 | std.hash.autoHash(hasher, ty_tag); | | |
| 1051 | }, | | |
| 1052 | | | |
| 1053 | .bool => std.hash.autoHash(hasher, std.builtin.TypeId.Bool), | 1032 | .bool => std.hash.autoHash(hasher, std.builtin.TypeId.Bool), |
| 1054 | .void => std.hash.autoHash(hasher, std.builtin.TypeId.Void), | 1033 | .void => std.hash.autoHash(hasher, std.builtin.TypeId.Void), |
| 1055 | .type => std.hash.autoHash(hasher, std.builtin.TypeId.Type), | 1034 | .type => std.hash.autoHash(hasher, std.builtin.TypeId.Type), |
| 1056 | .comptime_int => std.hash.autoHash(hasher, std.builtin.TypeId.ComptimeInt), | 1035 | .comptime_int => std.hash.autoHash(hasher, std.builtin.TypeId.ComptimeInt), |
| 1057 | .comptime_float => std.hash.autoHash(hasher, std.builtin.TypeId.ComptimeFloat), | | |
| 1058 | .noreturn => std.hash.autoHash(hasher, std.builtin.TypeId.NoReturn), | 1036 | .noreturn => std.hash.autoHash(hasher, std.builtin.TypeId.NoReturn), |
| 1059 | .null => std.hash.autoHash(hasher, std.builtin.TypeId.Null), | 1037 | .null => std.hash.autoHash(hasher, std.builtin.TypeId.Null), |
| 1060 | .undefined => std.hash.autoHash(hasher, std.builtin.TypeId.Undefined), | 1038 | .undefined => std.hash.autoHash(hasher, std.builtin.TypeId.Undefined), |
| ... | @@ -1378,19 +1356,12 @@ pub const Type = struct { | ... | @@ -1378,19 +1356,12 @@ pub const Type = struct { |
| 1378 | .c_ulong, | 1356 | .c_ulong, |
| 1379 | .c_longlong, | 1357 | .c_longlong, |
| 1380 | .c_ulonglong, | 1358 | .c_ulonglong, |
| 1381 | .c_longdouble, | | |
| 1382 | .anyopaque, | 1359 | .anyopaque, |
| 1383 | .f16, | | |
| 1384 | .f32, | | |
| 1385 | .f64, | | |
| 1386 | .f80, | | |
| 1387 | .f128, | | |
| 1388 | .bool, | 1360 | .bool, |
| 1389 | .void, | 1361 | .void, |
| 1390 | .type, | 1362 | .type, |
| 1391 | .anyerror, | 1363 | .anyerror, |
| 1392 | .comptime_int, | 1364 | .comptime_int, |
| 1393 | .comptime_float, | | |
| 1394 | .noreturn, | 1365 | .noreturn, |
| 1395 | .null, | 1366 | .null, |
| 1396 | .undefined, | 1367 | .undefined, |
| ... | @@ -1671,20 +1642,13 @@ pub const Type = struct { | ... | @@ -1671,20 +1642,13 @@ pub const Type = struct { |
| 1671 | .c_ulong, | 1642 | .c_ulong, |
| 1672 | .c_longlong, | 1643 | .c_longlong, |
| 1673 | .c_ulonglong, | 1644 | .c_ulonglong, |
| 1674 | .c_longdouble, | | |
| 1675 | .anyopaque, | 1645 | .anyopaque, |
| 1676 | .f16, | | |
| 1677 | .f32, | | |
| 1678 | .f64, | | |
| 1679 | .f80, | | |
| 1680 | .f128, | | |
| 1681 | .bool, | 1646 | .bool, |
| 1682 | .void, | 1647 | .void, |
| 1683 | .type, | 1648 | .type, |
| 1684 | .anyerror, | 1649 | .anyerror, |
| 1685 | .@"anyframe", | 1650 | .@"anyframe", |
| 1686 | .comptime_int, | 1651 | .comptime_int, |
| 1687 | .comptime_float, | | |
| 1688 | .noreturn, | 1652 | .noreturn, |
| 1689 | => return writer.writeAll(@tagName(t)), | 1653 | => return writer.writeAll(@tagName(t)), |
| 1690 | | 1654 | |
| ... | @@ -2067,20 +2031,13 @@ pub const Type = struct { | ... | @@ -2067,20 +2031,13 @@ pub const Type = struct { |
| 2067 | .c_ulong, | 2031 | .c_ulong, |
| 2068 | .c_longlong, | 2032 | .c_longlong, |
| 2069 | .c_ulonglong, | 2033 | .c_ulonglong, |
| 2070 | .c_longdouble, | | |
| 2071 | .anyopaque, | 2034 | .anyopaque, |
| 2072 | .f16, | | |
| 2073 | .f32, | | |
| 2074 | .f64, | | |
| 2075 | .f80, | | |
| 2076 | .f128, | | |
| 2077 | .bool, | 2035 | .bool, |
| 2078 | .void, | 2036 | .void, |
| 2079 | .type, | 2037 | .type, |
| 2080 | .anyerror, | 2038 | .anyerror, |
| 2081 | .@"anyframe", | 2039 | .@"anyframe", |
| 2082 | .comptime_int, | 2040 | .comptime_int, |
| 2083 | .comptime_float, | | |
| 2084 | .noreturn, | 2041 | .noreturn, |
| 2085 | => try writer.writeAll(@tagName(t)), | 2042 | => try writer.writeAll(@tagName(t)), |
| 2086 | | 2043 | |
| ... | @@ -2353,6 +2310,7 @@ pub const Type = struct { | ... | @@ -2353,6 +2310,7 @@ pub const Type = struct { |
| 2353 | } | 2310 | } |
| 2354 | | 2311 | |
| 2355 | pub fn toValue(self: Type, allocator: Allocator) Allocator.Error!Value { | 2312 | pub fn toValue(self: Type, allocator: Allocator) Allocator.Error!Value { |
| | 2313 | if (self.ip_index != .none) return self.ip_index.toValue(); |
| 2356 | switch (self.tag()) { | 2314 | switch (self.tag()) { |
| 2357 | .u1 => return Value.initTag(.u1_type), | 2315 | .u1 => return Value.initTag(.u1_type), |
| 2358 | .u8 => return Value.initTag(.u8_type), | 2316 | .u8 => return Value.initTag(.u8_type), |
| ... | @@ -2375,20 +2333,13 @@ pub const Type = struct { | ... | @@ -2375,20 +2333,13 @@ pub const Type = struct { |
| 2375 | .c_ulong => return Value.initTag(.c_ulong_type), | 2333 | .c_ulong => return Value.initTag(.c_ulong_type), |
| 2376 | .c_longlong => return Value.initTag(.c_longlong_type), | 2334 | .c_longlong => return Value.initTag(.c_longlong_type), |
| 2377 | .c_ulonglong => return Value.initTag(.c_ulonglong_type), | 2335 | .c_ulonglong => return Value.initTag(.c_ulonglong_type), |
| 2378 | .c_longdouble => return Value.initTag(.c_longdouble_type), | | |
| 2379 | .anyopaque => return Value.initTag(.anyopaque_type), | 2336 | .anyopaque => return Value.initTag(.anyopaque_type), |
| 2380 | .f16 => return Value.initTag(.f16_type), | | |
| 2381 | .f32 => return Value.initTag(.f32_type), | | |
| 2382 | .f64 => return Value.initTag(.f64_type), | | |
| 2383 | .f80 => return Value.initTag(.f80_type), | | |
| 2384 | .f128 => return Value.initTag(.f128_type), | | |
| 2385 | .bool => return Value.initTag(.bool_type), | 2337 | .bool => return Value.initTag(.bool_type), |
| 2386 | .void => return Value.initTag(.void_type), | 2338 | .void => return Value.initTag(.void_type), |
| 2387 | .type => return Value.initTag(.type_type), | 2339 | .type => return Value.initTag(.type_type), |
| 2388 | .anyerror => return Value.initTag(.anyerror_type), | 2340 | .anyerror => return Value.initTag(.anyerror_type), |
| 2389 | .@"anyframe" => return Value.initTag(.anyframe_type), | 2341 | .@"anyframe" => return Value.initTag(.anyframe_type), |
| 2390 | .comptime_int => return Value.initTag(.comptime_int_type), | 2342 | .comptime_int => return Value.initTag(.comptime_int_type), |
| 2391 | .comptime_float => return Value.initTag(.comptime_float_type), | | |
| 2392 | .noreturn => return Value.initTag(.noreturn_type), | 2343 | .noreturn => return Value.initTag(.noreturn_type), |
| 2393 | .null => return Value.initTag(.null_type), | 2344 | .null => return Value.initTag(.null_type), |
| 2394 | .undefined => return Value.initTag(.undefined_type), | 2345 | .undefined => return Value.initTag(.undefined_type), |
| ... | @@ -2522,12 +2473,6 @@ pub const Type = struct { | ... | @@ -2522,12 +2473,6 @@ pub const Type = struct { |
| 2522 | .c_ulong, | 2473 | .c_ulong, |
| 2523 | .c_longlong, | 2474 | .c_longlong, |
| 2524 | .c_ulonglong, | 2475 | .c_ulonglong, |
| 2525 | .c_longdouble, | | |
| 2526 | .f16, | | |
| 2527 | .f32, | | |
| 2528 | .f64, | | |
| 2529 | .f80, | | |
| 2530 | .f128, | | |
| 2531 | .bool, | 2476 | .bool, |
| 2532 | .anyerror, | 2477 | .anyerror, |
| 2533 | .const_slice_u8, | 2478 | .const_slice_u8, |
| ... | @@ -2588,7 +2533,6 @@ pub const Type = struct { | ... | @@ -2588,7 +2533,6 @@ pub const Type = struct { |
| 2588 | .void, | 2533 | .void, |
| 2589 | .type, | 2534 | .type, |
| 2590 | .comptime_int, | 2535 | .comptime_int, |
| 2591 | .comptime_float, | | |
| 2592 | .noreturn, | 2536 | .noreturn, |
| 2593 | .null, | 2537 | .null, |
| 2594 | .undefined, | 2538 | .undefined, |
| ... | @@ -2801,12 +2745,6 @@ pub const Type = struct { | ... | @@ -2801,12 +2745,6 @@ pub const Type = struct { |
| 2801 | .c_ulong, | 2745 | .c_ulong, |
| 2802 | .c_longlong, | 2746 | .c_longlong, |
| 2803 | .c_ulonglong, | 2747 | .c_ulonglong, |
| 2804 | .c_longdouble, | | |
| 2805 | .f16, | | |
| 2806 | .f32, | | |
| 2807 | .f64, | | |
| 2808 | .f80, | | |
| 2809 | .f128, | | |
| 2810 | .bool, | 2748 | .bool, |
| 2811 | .void, | 2749 | .void, |
| 2812 | .manyptr_u8, | 2750 | .manyptr_u8, |
| ... | @@ -2852,7 +2790,6 @@ pub const Type = struct { | ... | @@ -2852,7 +2790,6 @@ pub const Type = struct { |
| 2852 | .generic_poison, | 2790 | .generic_poison, |
| 2853 | .type, | 2791 | .type, |
| 2854 | .comptime_int, | 2792 | .comptime_int, |
| 2855 | .comptime_float, | | |
| 2856 | .enum_literal, | 2793 | .enum_literal, |
| 2857 | .type_info, | 2794 | .type_info, |
| 2858 | // These are function bodies, not function pointers. | 2795 | // These are function bodies, not function pointers. |
| ... | @@ -3085,7 +3022,74 @@ pub const Type = struct { | ... | @@ -3085,7 +3022,74 @@ pub const Type = struct { |
| 3085 | .vector_type => @panic("TODO"), | 3022 | .vector_type => @panic("TODO"), |
| 3086 | .optional_type => @panic("TODO"), | 3023 | .optional_type => @panic("TODO"), |
| 3087 | .error_union_type => @panic("TODO"), | 3024 | .error_union_type => @panic("TODO"), |
| 3088 | .simple_type => @panic("TODO"), | 3025 | .simple_type => |t| switch (t) { |
| | 3026 | .bool, |
| | 3027 | .atomic_order, |
| | 3028 | .atomic_rmw_op, |
| | 3029 | .calling_convention, |
| | 3030 | .address_space, |
| | 3031 | .float_mode, |
| | 3032 | .reduce_op, |
| | 3033 | .call_modifier, |
| | 3034 | .prefetch_options, |
| | 3035 | .anyopaque, |
| | 3036 | => return AbiAlignmentAdvanced{ .scalar = 1 }, |
| | 3037 | |
| | 3038 | .usize, |
| | 3039 | .isize, |
| | 3040 | .export_options, |
| | 3041 | .extern_options, |
| | 3042 | .@"anyframe", |
| | 3043 | => return AbiAlignmentAdvanced{ .scalar = @divExact(target.cpu.arch.ptrBitWidth(), 8) }, |
| | 3044 | |
| | 3045 | .c_char => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.char) }, |
| | 3046 | .c_short => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.short) }, |
| | 3047 | .c_ushort => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.ushort) }, |
| | 3048 | .c_int => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.int) }, |
| | 3049 | .c_uint => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.uint) }, |
| | 3050 | .c_long => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.long) }, |
| | 3051 | .c_ulong => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.ulong) }, |
| | 3052 | .c_longlong => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.longlong) }, |
| | 3053 | .c_ulonglong => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.ulonglong) }, |
| | 3054 | .c_longdouble => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.longdouble) }, |
| | 3055 | |
| | 3056 | .f16 => return AbiAlignmentAdvanced{ .scalar = 2 }, |
| | 3057 | .f32 => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.float) }, |
| | 3058 | .f64 => switch (target.c_type_bit_size(.double)) { |
| | 3059 | 64 => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.double) }, |
| | 3060 | else => return AbiAlignmentAdvanced{ .scalar = 8 }, |
| | 3061 | }, |
| | 3062 | .f80 => switch (target.c_type_bit_size(.longdouble)) { |
| | 3063 | 80 => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.longdouble) }, |
| | 3064 | else => { |
| | 3065 | const u80_ty: Type = .{ |
| | 3066 | .ip_index = .u80_type, |
| | 3067 | .legacy = undefined, |
| | 3068 | }; |
| | 3069 | return AbiAlignmentAdvanced{ .scalar = abiAlignment(u80_ty, mod) }; |
| | 3070 | }, |
| | 3071 | }, |
| | 3072 | .f128 => switch (target.c_type_bit_size(.longdouble)) { |
| | 3073 | 128 => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.longdouble) }, |
| | 3074 | else => return AbiAlignmentAdvanced{ .scalar = 16 }, |
| | 3075 | }, |
| | 3076 | |
| | 3077 | // TODO revisit this when we have the concept of the error tag type |
| | 3078 | .anyerror => return AbiAlignmentAdvanced{ .scalar = 2 }, |
| | 3079 | |
| | 3080 | .void, |
| | 3081 | .type, |
| | 3082 | .comptime_int, |
| | 3083 | .comptime_float, |
| | 3084 | .null, |
| | 3085 | .undefined, |
| | 3086 | .enum_literal, |
| | 3087 | .type_info, |
| | 3088 | => return AbiAlignmentAdvanced{ .scalar = 0 }, |
| | 3089 | |
| | 3090 | .noreturn => unreachable, |
| | 3091 | .generic_poison => unreachable, |
| | 3092 | }, |
| 3089 | .struct_type => @panic("TODO"), | 3093 | .struct_type => @panic("TODO"), |
| 3090 | .union_type => @panic("TODO"), | 3094 | .union_type => @panic("TODO"), |
| 3091 | .simple_value => unreachable, | 3095 | .simple_value => unreachable, |
| ... | @@ -3158,28 +3162,6 @@ pub const Type = struct { | ... | @@ -3158,28 +3162,6 @@ pub const Type = struct { |
| 3158 | .c_ulong => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.ulong) }, | 3162 | .c_ulong => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.ulong) }, |
| 3159 | .c_longlong => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.longlong) }, | 3163 | .c_longlong => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.longlong) }, |
| 3160 | .c_ulonglong => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.ulonglong) }, | 3164 | .c_ulonglong => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.ulonglong) }, |
| 3161 | .c_longdouble => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.longdouble) }, | | |
| 3162 | | | |
| 3163 | .f16 => return AbiAlignmentAdvanced{ .scalar = 2 }, | | |
| 3164 | .f32 => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.float) }, | | |
| 3165 | .f64 => switch (target.c_type_bit_size(.double)) { | | |
| 3166 | 64 => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.double) }, | | |
| 3167 | else => return AbiAlignmentAdvanced{ .scalar = 8 }, | | |
| 3168 | }, | | |
| 3169 | .f80 => switch (target.c_type_bit_size(.longdouble)) { | | |
| 3170 | 80 => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.longdouble) }, | | |
| 3171 | else => { | | |
| 3172 | const u80_ty: Type = .{ | | |
| 3173 | .ip_index = .u80_type, | | |
| 3174 | .legacy = undefined, | | |
| 3175 | }; | | |
| 3176 | return AbiAlignmentAdvanced{ .scalar = abiAlignment(u80_ty, mod) }; | | |
| 3177 | }, | | |
| 3178 | }, | | |
| 3179 | .f128 => switch (target.c_type_bit_size(.longdouble)) { | | |
| 3180 | 128 => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.longdouble) }, | | |
| 3181 | else => return AbiAlignmentAdvanced{ .scalar = 16 }, | | |
| 3182 | }, | | |
| 3183 | | 3165 | |
| 3184 | // TODO revisit this when we have the concept of the error tag type | 3166 | // TODO revisit this when we have the concept of the error tag type |
| 3185 | .anyerror_void_error_union, | 3167 | .anyerror_void_error_union, |
| ... | @@ -3366,7 +3348,6 @@ pub const Type = struct { | ... | @@ -3366,7 +3348,6 @@ pub const Type = struct { |
| 3366 | .empty_struct_literal, | 3348 | .empty_struct_literal, |
| 3367 | .type, | 3349 | .type, |
| 3368 | .comptime_int, | 3350 | .comptime_int, |
| 3369 | .comptime_float, | | |
| 3370 | .null, | 3351 | .null, |
| 3371 | .undefined, | 3352 | .undefined, |
| 3372 | .enum_literal, | 3353 | .enum_literal, |
| ... | @@ -3481,7 +3462,69 @@ pub const Type = struct { | ... | @@ -3481,7 +3462,69 @@ pub const Type = struct { |
| 3481 | .vector_type => @panic("TODO"), | 3462 | .vector_type => @panic("TODO"), |
| 3482 | .optional_type => @panic("TODO"), | 3463 | .optional_type => @panic("TODO"), |
| 3483 | .error_union_type => @panic("TODO"), | 3464 | .error_union_type => @panic("TODO"), |
| 3484 | .simple_type => @panic("TODO"), | 3465 | .simple_type => |t| switch (t) { |
| | 3466 | .bool, |
| | 3467 | .atomic_order, |
| | 3468 | .atomic_rmw_op, |
| | 3469 | .calling_convention, |
| | 3470 | .address_space, |
| | 3471 | .float_mode, |
| | 3472 | .reduce_op, |
| | 3473 | .call_modifier, |
| | 3474 | => return AbiSizeAdvanced{ .scalar = 1 }, |
| | 3475 | |
| | 3476 | .f16 => return AbiSizeAdvanced{ .scalar = 2 }, |
| | 3477 | .f32 => return AbiSizeAdvanced{ .scalar = 4 }, |
| | 3478 | .f64 => return AbiSizeAdvanced{ .scalar = 8 }, |
| | 3479 | .f128 => return AbiSizeAdvanced{ .scalar = 16 }, |
| | 3480 | .f80 => switch (target.c_type_bit_size(.longdouble)) { |
| | 3481 | 80 => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.longdouble) }, |
| | 3482 | else => { |
| | 3483 | const u80_ty: Type = .{ |
| | 3484 | .ip_index = .u80_type, |
| | 3485 | .legacy = undefined, |
| | 3486 | }; |
| | 3487 | return AbiSizeAdvanced{ .scalar = abiSize(u80_ty, mod) }; |
| | 3488 | }, |
| | 3489 | }, |
| | 3490 | |
| | 3491 | .usize, |
| | 3492 | .isize, |
| | 3493 | .@"anyframe", |
| | 3494 | => return AbiSizeAdvanced{ .scalar = @divExact(target.cpu.arch.ptrBitWidth(), 8) }, |
| | 3495 | |
| | 3496 | .c_char => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.char) }, |
| | 3497 | .c_short => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.short) }, |
| | 3498 | .c_ushort => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.ushort) }, |
| | 3499 | .c_int => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.int) }, |
| | 3500 | .c_uint => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.uint) }, |
| | 3501 | .c_long => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.long) }, |
| | 3502 | .c_ulong => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.ulong) }, |
| | 3503 | .c_longlong => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.longlong) }, |
| | 3504 | .c_ulonglong => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.ulonglong) }, |
| | 3505 | .c_longdouble => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.longdouble) }, |
| | 3506 | |
| | 3507 | .anyopaque, |
| | 3508 | .void, |
| | 3509 | .type, |
| | 3510 | .comptime_int, |
| | 3511 | .comptime_float, |
| | 3512 | .null, |
| | 3513 | .undefined, |
| | 3514 | .enum_literal, |
| | 3515 | => return AbiSizeAdvanced{ .scalar = 0 }, |
| | 3516 | |
| | 3517 | // TODO revisit this when we have the concept of the error tag type |
| | 3518 | .anyerror => return AbiSizeAdvanced{ .scalar = 2 }, |
| | 3519 | |
| | 3520 | .prefetch_options => unreachable, // missing call to resolveTypeFields |
| | 3521 | .export_options => unreachable, // missing call to resolveTypeFields |
| | 3522 | .extern_options => unreachable, // missing call to resolveTypeFields |
| | 3523 | |
| | 3524 | .type_info => unreachable, |
| | 3525 | .noreturn => unreachable, |
| | 3526 | .generic_poison => unreachable, |
| | 3527 | }, |
| 3485 | .struct_type => @panic("TODO"), | 3528 | .struct_type => @panic("TODO"), |
| 3486 | .union_type => @panic("TODO"), | 3529 | .union_type => @panic("TODO"), |
| 3487 | .simple_value => unreachable, | 3530 | .simple_value => unreachable, |
| ... | @@ -3506,7 +3549,6 @@ pub const Type = struct { | ... | @@ -3506,7 +3549,6 @@ pub const Type = struct { |
| 3506 | .anyopaque, | 3549 | .anyopaque, |
| 3507 | .type, | 3550 | .type, |
| 3508 | .comptime_int, | 3551 | .comptime_int, |
| 3509 | .comptime_float, | | |
| 3510 | .null, | 3552 | .null, |
| 3511 | .undefined, | 3553 | .undefined, |
| 3512 | .enum_literal, | 3554 | .enum_literal, |
| ... | @@ -3661,22 +3703,6 @@ pub const Type = struct { | ... | @@ -3661,22 +3703,6 @@ pub const Type = struct { |
| 3661 | .c_ulong => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.ulong) }, | 3703 | .c_ulong => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.ulong) }, |
| 3662 | .c_longlong => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.longlong) }, | 3704 | .c_longlong => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.longlong) }, |
| 3663 | .c_ulonglong => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.ulonglong) }, | 3705 | .c_ulonglong => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.ulonglong) }, |
| 3664 | .c_longdouble => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.longdouble) }, | | |
| 3665 | | | |
| 3666 | .f16 => return AbiSizeAdvanced{ .scalar = 2 }, | | |
| 3667 | .f32 => return AbiSizeAdvanced{ .scalar = 4 }, | | |
| 3668 | .f64 => return AbiSizeAdvanced{ .scalar = 8 }, | | |
| 3669 | .f128 => return AbiSizeAdvanced{ .scalar = 16 }, | | |
| 3670 | .f80 => switch (target.c_type_bit_size(.longdouble)) { | | |
| 3671 | 80 => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.longdouble) }, | | |
| 3672 | else => { | | |
| 3673 | const u80_ty: Type = .{ | | |
| 3674 | .ip_index = .u80_type, | | |
| 3675 | .legacy = undefined, | | |
| 3676 | }; | | |
| 3677 | return AbiSizeAdvanced{ .scalar = abiSize(u80_ty, mod) }; | | |
| 3678 | }, | | |
| 3679 | }, | | |
| 3680 | | 3706 | |
| 3681 | // TODO revisit this when we have the concept of the error tag type | 3707 | // TODO revisit this when we have the concept of the error tag type |
| 3682 | .anyerror_void_error_union, | 3708 | .anyerror_void_error_union, |
| ... | @@ -3820,7 +3846,57 @@ pub const Type = struct { | ... | @@ -3820,7 +3846,57 @@ pub const Type = struct { |
| 3820 | .vector_type => @panic("TODO"), | 3846 | .vector_type => @panic("TODO"), |
| 3821 | .optional_type => @panic("TODO"), | 3847 | .optional_type => @panic("TODO"), |
| 3822 | .error_union_type => @panic("TODO"), | 3848 | .error_union_type => @panic("TODO"), |
| 3823 | .simple_type => @panic("TODO"), | 3849 | .simple_type => |t| switch (t) { |
| | 3850 | .f16 => return 16, |
| | 3851 | .f32 => return 32, |
| | 3852 | .f64 => return 64, |
| | 3853 | .f80 => return 80, |
| | 3854 | .f128 => return 128, |
| | 3855 | |
| | 3856 | .usize, |
| | 3857 | .isize, |
| | 3858 | .@"anyframe", |
| | 3859 | => return target.cpu.arch.ptrBitWidth(), |
| | 3860 | |
| | 3861 | .c_char => return target.c_type_bit_size(.char), |
| | 3862 | .c_short => return target.c_type_bit_size(.short), |
| | 3863 | .c_ushort => return target.c_type_bit_size(.ushort), |
| | 3864 | .c_int => return target.c_type_bit_size(.int), |
| | 3865 | .c_uint => return target.c_type_bit_size(.uint), |
| | 3866 | .c_long => return target.c_type_bit_size(.long), |
| | 3867 | .c_ulong => return target.c_type_bit_size(.ulong), |
| | 3868 | .c_longlong => return target.c_type_bit_size(.longlong), |
| | 3869 | .c_ulonglong => return target.c_type_bit_size(.ulonglong), |
| | 3870 | .c_longdouble => return target.c_type_bit_size(.longdouble), |
| | 3871 | |
| | 3872 | .bool => return 1, |
| | 3873 | .void => return 0, |
| | 3874 | |
| | 3875 | // TODO revisit this when we have the concept of the error tag type |
| | 3876 | .anyerror => return 16, |
| | 3877 | |
| | 3878 | .anyopaque => unreachable, |
| | 3879 | .type => unreachable, |
| | 3880 | .comptime_int => unreachable, |
| | 3881 | .comptime_float => unreachable, |
| | 3882 | .noreturn => unreachable, |
| | 3883 | .null => unreachable, |
| | 3884 | .undefined => unreachable, |
| | 3885 | .enum_literal => unreachable, |
| | 3886 | .generic_poison => unreachable, |
| | 3887 | |
| | 3888 | .atomic_order => unreachable, // missing call to resolveTypeFields |
| | 3889 | .atomic_rmw_op => unreachable, // missing call to resolveTypeFields |
| | 3890 | .calling_convention => unreachable, // missing call to resolveTypeFields |
| | 3891 | .address_space => unreachable, // missing call to resolveTypeFields |
| | 3892 | .float_mode => unreachable, // missing call to resolveTypeFields |
| | 3893 | .reduce_op => unreachable, // missing call to resolveTypeFields |
| | 3894 | .call_modifier => unreachable, // missing call to resolveTypeFields |
| | 3895 | .prefetch_options => unreachable, // missing call to resolveTypeFields |
| | 3896 | .export_options => unreachable, // missing call to resolveTypeFields |
| | 3897 | .extern_options => unreachable, // missing call to resolveTypeFields |
| | 3898 | .type_info => unreachable, // missing call to resolveTypeFields |
| | 3899 | }, |
| 3824 | .struct_type => @panic("TODO"), | 3900 | .struct_type => @panic("TODO"), |
| 3825 | .union_type => @panic("TODO"), | 3901 | .union_type => @panic("TODO"), |
| 3826 | .simple_value => unreachable, | 3902 | .simple_value => unreachable, |
| ... | @@ -3836,7 +3912,6 @@ pub const Type = struct { | ... | @@ -3836,7 +3912,6 @@ pub const Type = struct { |
| 3836 | .anyopaque => unreachable, | 3912 | .anyopaque => unreachable, |
| 3837 | .type => unreachable, | 3913 | .type => unreachable, |
| 3838 | .comptime_int => unreachable, | 3914 | .comptime_int => unreachable, |
| 3839 | .comptime_float => unreachable, | | |
| 3840 | .noreturn => unreachable, | 3915 | .noreturn => unreachable, |
| 3841 | .null => unreachable, | 3916 | .null => unreachable, |
| 3842 | .undefined => unreachable, | 3917 | .undefined => unreachable, |
| ... | @@ -3852,12 +3927,11 @@ pub const Type = struct { | ... | @@ -3852,12 +3927,11 @@ pub const Type = struct { |
| 3852 | .void => return 0, | 3927 | .void => return 0, |
| 3853 | .bool, .u1 => return 1, | 3928 | .bool, .u1 => return 1, |
| 3854 | .u8, .i8 => return 8, | 3929 | .u8, .i8 => return 8, |
| 3855 | .i16, .u16, .f16 => return 16, | 3930 | .i16, .u16 => return 16, |
| 3856 | .u29 => return 29, | 3931 | .u29 => return 29, |
| 3857 | .i32, .u32, .f32 => return 32, | 3932 | .i32, .u32 => return 32, |
| 3858 | .i64, .u64, .f64 => return 64, | 3933 | .i64, .u64 => return 64, |
| 3859 | .f80 => return 80, | 3934 | .u128, .i128 => return 128, |
| 3860 | .u128, .i128, .f128 => return 128, | | |
| 3861 | | 3935 | |
| 3862 | .@"struct" => { | 3936 | .@"struct" => { |
| 3863 | const struct_obj = ty.castTag(.@"struct").?.data; | 3937 | const struct_obj = ty.castTag(.@"struct").?.data; |
| ... | @@ -3975,7 +4049,6 @@ pub const Type = struct { | ... | @@ -3975,7 +4049,6 @@ pub const Type = struct { |
| 3975 | .c_ulong => return target.c_type_bit_size(.ulong), | 4049 | .c_ulong => return target.c_type_bit_size(.ulong), |
| 3976 | .c_longlong => return target.c_type_bit_size(.longlong), | 4050 | .c_longlong => return target.c_type_bit_size(.longlong), |
| 3977 | .c_ulonglong => return target.c_type_bit_size(.ulonglong), | 4051 | .c_ulonglong => return target.c_type_bit_size(.ulonglong), |
| 3978 | .c_longdouble => return target.c_type_bit_size(.longdouble), | | |
| 3979 | | 4052 | |
| 3980 | .error_set, | 4053 | .error_set, |
| 3981 | .error_set_single, | 4054 | .error_set_single, |
| ... | @@ -4950,14 +5023,14 @@ pub const Type = struct { | ... | @@ -4950,14 +5023,14 @@ pub const Type = struct { |
| 4950 | } | 5023 | } |
| 4951 | | 5024 | |
| 4952 | /// Returns `false` for `comptime_float`. | 5025 | /// Returns `false` for `comptime_float`. |
| 4953 | pub fn isRuntimeFloat(self: Type) bool { | 5026 | pub fn isRuntimeFloat(ty: Type) bool { |
| 4954 | return switch (self.tag()) { | 5027 | return switch (ty.ip_index) { |
| 4955 | .f16, | 5028 | .f16_type, |
| 4956 | .f32, | 5029 | .f32_type, |
| 4957 | .f64, | 5030 | .f64_type, |
| 4958 | .f80, | 5031 | .f80_type, |
| 4959 | .f128, | 5032 | .f128_type, |
| 4960 | .c_longdouble, | 5033 | .c_longdouble_type, |
| 4961 | => true, | 5034 | => true, |
| 4962 | | 5035 | |
| 4963 | else => false, | 5036 | else => false, |
| ... | @@ -4965,15 +5038,15 @@ pub const Type = struct { | ... | @@ -4965,15 +5038,15 @@ pub const Type = struct { |
| 4965 | } | 5038 | } |
| 4966 | | 5039 | |
| 4967 | /// Returns `true` for `comptime_float`. | 5040 | /// Returns `true` for `comptime_float`. |
| 4968 | pub fn isAnyFloat(self: Type) bool { | 5041 | pub fn isAnyFloat(ty: Type) bool { |
| 4969 | return switch (self.tag()) { | 5042 | return switch (ty.ip_index) { |
| 4970 | .f16, | 5043 | .f16_type, |
| 4971 | .f32, | 5044 | .f32_type, |
| 4972 | .f64, | 5045 | .f64_type, |
| 4973 | .f80, | 5046 | .f80_type, |
| 4974 | .f128, | 5047 | .f128_type, |
| 4975 | .c_longdouble, | 5048 | .c_longdouble_type, |
| 4976 | .comptime_float, | 5049 | .comptime_float_type, |
| 4977 | => true, | 5050 | => true, |
| 4978 | | 5051 | |
| 4979 | else => false, | 5052 | else => false, |
| ... | @@ -4982,14 +5055,14 @@ pub const Type = struct { | ... | @@ -4982,14 +5055,14 @@ pub const Type = struct { |
| 4982 | | 5055 | |
| 4983 | /// Asserts the type is a fixed-size float or comptime_float. | 5056 | /// Asserts the type is a fixed-size float or comptime_float. |
| 4984 | /// Returns 128 for comptime_float types. | 5057 | /// Returns 128 for comptime_float types. |
| 4985 | pub fn floatBits(self: Type, target: Target) u16 { | 5058 | pub fn floatBits(ty: Type, target: Target) u16 { |
| 4986 | return switch (self.tag()) { | 5059 | return switch (ty.ip_index) { |
| 4987 | .f16 => 16, | 5060 | .f16_type => 16, |
| 4988 | .f32 => 32, | 5061 | .f32_type => 32, |
| 4989 | .f64 => 64, | 5062 | .f64_type => 64, |
| 4990 | .f80 => 80, | 5063 | .f80_type => 80, |
| 4991 | .f128, .comptime_float => 128, | 5064 | .f128_type, .comptime_float_type => 128, |
| 4992 | .c_longdouble => target.c_type_bit_size(.longdouble), | 5065 | .c_longdouble_type => target.c_type_bit_size(.longdouble), |
| 4993 | | 5066 | |
| 4994 | else => unreachable, | 5067 | else => unreachable, |
| 4995 | }; | 5068 | }; |
| ... | @@ -5094,14 +5167,7 @@ pub const Type = struct { | ... | @@ -5094,14 +5167,7 @@ pub const Type = struct { |
| 5094 | else => false, | 5167 | else => false, |
| 5095 | }; | 5168 | }; |
| 5096 | return switch (ty.tag()) { | 5169 | return switch (ty.tag()) { |
| 5097 | .f16, | | |
| 5098 | .f32, | | |
| 5099 | .f64, | | |
| 5100 | .f80, | | |
| 5101 | .f128, | | |
| 5102 | .c_longdouble, | | |
| 5103 | .comptime_int, | 5170 | .comptime_int, |
| 5104 | .comptime_float, | | |
| 5105 | .u1, | 5171 | .u1, |
| 5106 | .u8, | 5172 | .u8, |
| 5107 | .i8, | 5173 | .i8, |
| ... | @@ -5205,14 +5271,7 @@ pub const Type = struct { | ... | @@ -5205,14 +5271,7 @@ pub const Type = struct { |
| 5205 | }; | 5271 | }; |
| 5206 | | 5272 | |
| 5207 | while (true) switch (ty.tag()) { | 5273 | while (true) switch (ty.tag()) { |
| 5208 | .f16, | | |
| 5209 | .f32, | | |
| 5210 | .f64, | | |
| 5211 | .f80, | | |
| 5212 | .f128, | | |
| 5213 | .c_longdouble, | | |
| 5214 | .comptime_int, | 5274 | .comptime_int, |
| 5215 | .comptime_float, | | |
| 5216 | .u1, | 5275 | .u1, |
| 5217 | .u8, | 5276 | .u8, |
| 5218 | .i8, | 5277 | .i8, |
| ... | @@ -5391,14 +5450,59 @@ pub const Type = struct { | ... | @@ -5391,14 +5450,59 @@ pub const Type = struct { |
| 5391 | /// TODO merge these implementations together with the "advanced" pattern seen | 5450 | /// TODO merge these implementations together with the "advanced" pattern seen |
| 5392 | /// elsewhere in this file. | 5451 | /// elsewhere in this file. |
| 5393 | pub fn comptimeOnly(ty: Type, mod: *const Module) bool { | 5452 | pub fn comptimeOnly(ty: Type, mod: *const Module) bool { |
| 5394 | if (ty.ip_index != .none) switch (mod.intern_pool.indexToKey(ty.ip_index)) { | 5453 | if (ty.ip_index != .none) return switch (mod.intern_pool.indexToKey(ty.ip_index)) { |
| 5395 | .int_type => return false, | 5454 | .int_type => false, |
| 5396 | .ptr_type => @panic("TODO"), | 5455 | .ptr_type => @panic("TODO"), |
| 5397 | .array_type => @panic("TODO"), | 5456 | .array_type => @panic("TODO"), |
| 5398 | .vector_type => @panic("TODO"), | 5457 | .vector_type => @panic("TODO"), |
| 5399 | .optional_type => @panic("TODO"), | 5458 | .optional_type => @panic("TODO"), |
| 5400 | .error_union_type => @panic("TODO"), | 5459 | .error_union_type => @panic("TODO"), |
| 5401 | .simple_type => @panic("TODO"), | 5460 | .simple_type => |t| switch (t) { |
| | 5461 | .f16, |
| | 5462 | .f32, |
| | 5463 | .f64, |
| | 5464 | .f80, |
| | 5465 | .f128, |
| | 5466 | .usize, |
| | 5467 | .isize, |
| | 5468 | .c_char, |
| | 5469 | .c_short, |
| | 5470 | .c_ushort, |
| | 5471 | .c_int, |
| | 5472 | .c_uint, |
| | 5473 | .c_long, |
| | 5474 | .c_ulong, |
| | 5475 | .c_longlong, |
| | 5476 | .c_ulonglong, |
| | 5477 | .c_longdouble, |
| | 5478 | .anyopaque, |
| | 5479 | .bool, |
| | 5480 | .void, |
| | 5481 | .anyerror, |
| | 5482 | .@"anyframe", |
| | 5483 | .noreturn, |
| | 5484 | .generic_poison, |
| | 5485 | .atomic_order, |
| | 5486 | .atomic_rmw_op, |
| | 5487 | .calling_convention, |
| | 5488 | .address_space, |
| | 5489 | .float_mode, |
| | 5490 | .reduce_op, |
| | 5491 | .call_modifier, |
| | 5492 | .prefetch_options, |
| | 5493 | .export_options, |
| | 5494 | .extern_options, |
| | 5495 | => false, |
| | 5496 | |
| | 5497 | .type, |
| | 5498 | .comptime_int, |
| | 5499 | .comptime_float, |
| | 5500 | .null, |
| | 5501 | .undefined, |
| | 5502 | .enum_literal, |
| | 5503 | .type_info, |
| | 5504 | => true, |
| | 5505 | }, |
| 5402 | .struct_type => @panic("TODO"), | 5506 | .struct_type => @panic("TODO"), |
| 5403 | .union_type => @panic("TODO"), | 5507 | .union_type => @panic("TODO"), |
| 5404 | .simple_value => unreachable, | 5508 | .simple_value => unreachable, |
| ... | @@ -5431,20 +5535,12 @@ pub const Type = struct { | ... | @@ -5431,20 +5535,12 @@ pub const Type = struct { |
| 5431 | .c_ulong, | 5535 | .c_ulong, |
| 5432 | .c_longlong, | 5536 | .c_longlong, |
| 5433 | .c_ulonglong, | 5537 | .c_ulonglong, |
| 5434 | .c_longdouble, | | |
| 5435 | .f16, | | |
| 5436 | .f32, | | |
| 5437 | .f64, | | |
| 5438 | .f80, | | |
| 5439 | .f128, | | |
| 5440 | .anyopaque, | 5538 | .anyopaque, |
| 5441 | .bool, | 5539 | .bool, |
| 5442 | .void, | 5540 | .void, |
| 5443 | .anyerror, | 5541 | .anyerror, |
| 5444 | .noreturn, | 5542 | .noreturn, |
| 5445 | .@"anyframe", | 5543 | .@"anyframe", |
| 5446 | .null, | | |
| 5447 | .undefined, | | |
| 5448 | .atomic_order, | 5544 | .atomic_order, |
| 5449 | .atomic_rmw_op, | 5545 | .atomic_rmw_op, |
| 5450 | .calling_convention, | 5546 | .calling_convention, |
| ... | @@ -5477,11 +5573,12 @@ pub const Type = struct { | ... | @@ -5477,11 +5573,12 @@ pub const Type = struct { |
| 5477 | .single_const_pointer_to_comptime_int, | 5573 | .single_const_pointer_to_comptime_int, |
| 5478 | .type, | 5574 | .type, |
| 5479 | .comptime_int, | 5575 | .comptime_int, |
| 5480 | .comptime_float, | | |
| 5481 | .enum_literal, | 5576 | .enum_literal, |
| 5482 | .type_info, | 5577 | .type_info, |
| 5483 | // These are function bodies, not function pointers. | 5578 | // These are function bodies, not function pointers. |
| 5484 | .function, | 5579 | .function, |
| | 5580 | .null, |
| | 5581 | .undefined, |
| 5485 | => true, | 5582 | => true, |
| 5486 | | 5583 | |
| 5487 | .inferred_alloc_mut => unreachable, | 5584 | .inferred_alloc_mut => unreachable, |
| ... | @@ -6286,19 +6383,12 @@ pub const Type = struct { | ... | @@ -6286,19 +6383,12 @@ pub const Type = struct { |
| 6286 | c_ulong, | 6383 | c_ulong, |
| 6287 | c_longlong, | 6384 | c_longlong, |
| 6288 | c_ulonglong, | 6385 | c_ulonglong, |
| 6289 | c_longdouble, | | |
| 6290 | f16, | | |
| 6291 | f32, | | |
| 6292 | f64, | | |
| 6293 | f80, | | |
| 6294 | f128, | | |
| 6295 | anyopaque, | 6386 | anyopaque, |
| 6296 | bool, | 6387 | bool, |
| 6297 | void, | 6388 | void, |
| 6298 | type, | 6389 | type, |
| 6299 | anyerror, | 6390 | anyerror, |
| 6300 | comptime_int, | 6391 | comptime_int, |
| 6301 | comptime_float, | | |
| 6302 | noreturn, | 6392 | noreturn, |
| 6303 | @"anyframe", | 6393 | @"anyframe", |
| 6304 | null, | 6394 | null, |
| ... | @@ -6377,7 +6467,6 @@ pub const Type = struct { | ... | @@ -6377,7 +6467,6 @@ pub const Type = struct { |
| 6377 | pub const no_payload_count = @enumToInt(last_no_payload_tag) + 1; | 6467 | pub const no_payload_count = @enumToInt(last_no_payload_tag) + 1; |
| 6378 | | 6468 | |
| 6379 | pub fn Type(comptime t: Tag) type { | 6469 | pub fn Type(comptime t: Tag) type { |
| 6380 | // Keep in sync with tools/stage2_pretty_printers_common.py | | |
| 6381 | return switch (t) { | 6470 | return switch (t) { |
| 6382 | .u1, | 6471 | .u1, |
| 6383 | .u8, | 6472 | .u8, |
| ... | @@ -6402,19 +6491,12 @@ pub const Type = struct { | ... | @@ -6402,19 +6491,12 @@ pub const Type = struct { |
| 6402 | .c_ulong, | 6491 | .c_ulong, |
| 6403 | .c_longlong, | 6492 | .c_longlong, |
| 6404 | .c_ulonglong, | 6493 | .c_ulonglong, |
| 6405 | .c_longdouble, | | |
| 6406 | .f16, | | |
| 6407 | .f32, | | |
| 6408 | .f64, | | |
| 6409 | .f80, | | |
| 6410 | .f128, | | |
| 6411 | .anyopaque, | 6494 | .anyopaque, |
| 6412 | .bool, | 6495 | .bool, |
| 6413 | .void, | 6496 | .void, |
| 6414 | .type, | 6497 | .type, |
| 6415 | .anyerror, | 6498 | .anyerror, |
| 6416 | .comptime_int, | 6499 | .comptime_int, |
| 6417 | .comptime_float, | | |
| 6418 | .noreturn, | 6500 | .noreturn, |
| 6419 | .enum_literal, | 6501 | .enum_literal, |
| 6420 | .null, | 6502 | .null, |
| ... | @@ -6781,16 +6863,17 @@ pub const Type = struct { | ... | @@ -6781,16 +6863,17 @@ pub const Type = struct { |
| 6781 | pub const @"i32" = initTag(.i32); | 6863 | pub const @"i32" = initTag(.i32); |
| 6782 | pub const @"i64" = initTag(.i64); | 6864 | pub const @"i64" = initTag(.i64); |
| 6783 | | 6865 | |
| 6784 | pub const @"f16" = initTag(.f16); | 6866 | pub const @"f16": Type = .{ .ip_index = .f16_type, .legacy = undefined }; |
| 6785 | pub const @"f32" = initTag(.f32); | 6867 | pub const @"f32": Type = .{ .ip_index = .f32_type, .legacy = undefined }; |
| 6786 | pub const @"f64" = initTag(.f64); | 6868 | pub const @"f64": Type = .{ .ip_index = .f64_type, .legacy = undefined }; |
| 6787 | pub const @"f80" = initTag(.f80); | 6869 | pub const @"f80": Type = .{ .ip_index = .f80_type, .legacy = undefined }; |
| 6788 | pub const @"f128" = initTag(.f128); | 6870 | pub const @"f128": Type = .{ .ip_index = .f128_type, .legacy = undefined }; |
| 6789 | | 6871 | |
| 6790 | pub const @"bool" = initTag(.bool); | 6872 | pub const @"bool" = initTag(.bool); |
| 6791 | pub const @"usize" = initTag(.usize); | 6873 | pub const @"usize" = initTag(.usize); |
| 6792 | pub const @"isize" = initTag(.isize); | 6874 | pub const @"isize" = initTag(.isize); |
| 6793 | pub const @"comptime_int" = initTag(.comptime_int); | 6875 | pub const @"comptime_int": Type = .{ .ip_index = .comptime_int_type, .legacy = undefined }; |
| | 6876 | pub const @"comptime_float": Type = .{ .ip_index = .comptime_float_type, .legacy = undefined }; |
| 6794 | pub const @"void" = initTag(.void); | 6877 | pub const @"void" = initTag(.void); |
| 6795 | pub const @"type" = initTag(.type); | 6878 | pub const @"type" = initTag(.type); |
| 6796 | pub const @"anyerror" = initTag(.anyerror); | 6879 | pub const @"anyerror" = initTag(.anyerror); |
| ... | @@ -6798,6 +6881,8 @@ pub const Type = struct { | ... | @@ -6798,6 +6881,8 @@ pub const Type = struct { |
| 6798 | pub const @"null" = initTag(.null); | 6881 | pub const @"null" = initTag(.null); |
| 6799 | pub const @"noreturn" = initTag(.noreturn); | 6882 | pub const @"noreturn" = initTag(.noreturn); |
| 6800 | | 6883 | |
| | 6884 | pub const @"c_longdouble": Type = .{ .ip_index = .c_longdouble_type, .legacy = undefined }; |
| | 6885 | |
| 6801 | pub const err_int = Type.u16; | 6886 | pub const err_int = Type.u16; |
| 6802 | | 6887 | |
| 6803 | pub fn ptr(arena: Allocator, mod: *Module, data: Payload.Pointer.Data) !Type { | 6888 | pub fn ptr(arena: Allocator, mod: *Module, data: Payload.Pointer.Data) !Type { |