authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-05-03 20:40:54-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-10 20:40:04-07:00
log9d422bff18dbb92d3a6b8705c3dae7404a34bba6
treea8ddd594c5e334ecea3f0c9fb2822b57016c7201
parent85c69c51945d7fb5d4cd2dea03fdb7915ecc55fa

stage2: move all integer types to InternPool


8 files changed, 106 insertions(+), 399 deletions(-)

src/AstGen.zig+22-1
...@@ -10271,6 +10271,8 @@ fn rvalue(...@@ -10271,6 +10271,8 @@ fn rvalue(
10271 as_ty | @enumToInt(Zir.Inst.Ref.i32_type),10271 as_ty | @enumToInt(Zir.Inst.Ref.i32_type),
10272 as_ty | @enumToInt(Zir.Inst.Ref.u64_type),10272 as_ty | @enumToInt(Zir.Inst.Ref.u64_type),
10273 as_ty | @enumToInt(Zir.Inst.Ref.i64_type),10273 as_ty | @enumToInt(Zir.Inst.Ref.i64_type),
10274 as_ty | @enumToInt(Zir.Inst.Ref.u128_type),
10275 as_ty | @enumToInt(Zir.Inst.Ref.i128_type),
10274 as_ty | @enumToInt(Zir.Inst.Ref.usize_type),10276 as_ty | @enumToInt(Zir.Inst.Ref.usize_type),
10275 as_ty | @enumToInt(Zir.Inst.Ref.isize_type),10277 as_ty | @enumToInt(Zir.Inst.Ref.isize_type),
10276 as_ty | @enumToInt(Zir.Inst.Ref.c_char_type),10278 as_ty | @enumToInt(Zir.Inst.Ref.c_char_type),
...@@ -10296,11 +10298,30 @@ fn rvalue(...@@ -10296,11 +10298,30 @@ fn rvalue(
10296 as_ty | @enumToInt(Zir.Inst.Ref.comptime_int_type),10298 as_ty | @enumToInt(Zir.Inst.Ref.comptime_int_type),
10297 as_ty | @enumToInt(Zir.Inst.Ref.comptime_float_type),10299 as_ty | @enumToInt(Zir.Inst.Ref.comptime_float_type),
10298 as_ty | @enumToInt(Zir.Inst.Ref.noreturn_type),10300 as_ty | @enumToInt(Zir.Inst.Ref.noreturn_type),
10301 as_ty | @enumToInt(Zir.Inst.Ref.anyframe_type),
10299 as_ty | @enumToInt(Zir.Inst.Ref.null_type),10302 as_ty | @enumToInt(Zir.Inst.Ref.null_type),
10300 as_ty | @enumToInt(Zir.Inst.Ref.undefined_type),10303 as_ty | @enumToInt(Zir.Inst.Ref.undefined_type),
10304 as_ty | @enumToInt(Zir.Inst.Ref.enum_literal_type),
10305 as_ty | @enumToInt(Zir.Inst.Ref.atomic_order_type),
10306 as_ty | @enumToInt(Zir.Inst.Ref.atomic_rmw_op_type),
10307 as_ty | @enumToInt(Zir.Inst.Ref.calling_convention_type),
10308 as_ty | @enumToInt(Zir.Inst.Ref.address_space_type),
10309 as_ty | @enumToInt(Zir.Inst.Ref.float_mode_type),
10310 as_ty | @enumToInt(Zir.Inst.Ref.reduce_op_type),
10311 as_ty | @enumToInt(Zir.Inst.Ref.call_modifier_type),
10312 as_ty | @enumToInt(Zir.Inst.Ref.prefetch_options_type),
10313 as_ty | @enumToInt(Zir.Inst.Ref.export_options_type),
10314 as_ty | @enumToInt(Zir.Inst.Ref.extern_options_type),
10315 as_ty | @enumToInt(Zir.Inst.Ref.type_info_type),
10316 as_ty | @enumToInt(Zir.Inst.Ref.manyptr_u8_type),
10317 as_ty | @enumToInt(Zir.Inst.Ref.manyptr_const_u8_type),
10318 as_ty | @enumToInt(Zir.Inst.Ref.manyptr_const_u8_sentinel_0_type),
10301 as_ty | @enumToInt(Zir.Inst.Ref.single_const_pointer_to_comptime_int_type),10319 as_ty | @enumToInt(Zir.Inst.Ref.single_const_pointer_to_comptime_int_type),
10302 as_ty | @enumToInt(Zir.Inst.Ref.const_slice_u8_type),10320 as_ty | @enumToInt(Zir.Inst.Ref.const_slice_u8_type),
10303 as_ty | @enumToInt(Zir.Inst.Ref.enum_literal_type),10321 as_ty | @enumToInt(Zir.Inst.Ref.const_slice_u8_sentinel_0_type),
10322 as_ty | @enumToInt(Zir.Inst.Ref.anyerror_void_error_union_type),
10323 as_ty | @enumToInt(Zir.Inst.Ref.generic_poison_type),
10324 as_ty | @enumToInt(Zir.Inst.Ref.empty_struct_type),
10304 as_comptime_int | @enumToInt(Zir.Inst.Ref.zero),10325 as_comptime_int | @enumToInt(Zir.Inst.Ref.zero),
10305 as_comptime_int | @enumToInt(Zir.Inst.Ref.one),10326 as_comptime_int | @enumToInt(Zir.Inst.Ref.one),
10306 as_bool | @enumToInt(Zir.Inst.Ref.bool_true),10327 as_bool | @enumToInt(Zir.Inst.Ref.bool_true),
src/Sema.zig-52
...@@ -31478,19 +31478,6 @@ pub fn resolveTypeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool {...@@ -31478,19 +31478,6 @@ pub fn resolveTypeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool {
31478 };31478 };
3147931479
31480 return switch (ty.tag()) {31480 return switch (ty.tag()) {
31481 .u1,
31482 .u8,
31483 .i8,
31484 .u16,
31485 .i16,
31486 .u29,
31487 .u32,
31488 .i32,
31489 .u64,
31490 .i64,
31491 .u128,
31492 .i128,
31493
31494 .manyptr_u8,31481 .manyptr_u8,
31495 .manyptr_const_u8,31482 .manyptr_const_u8,
31496 .manyptr_const_u8_sentinel_0,31483 .manyptr_const_u8_sentinel_0,
...@@ -32971,19 +32958,6 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {...@@ -32971,19 +32958,6 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {
32971 };32958 };
3297232959
32973 switch (ty.tag()) {32960 switch (ty.tag()) {
32974 .u1,
32975 .u8,
32976 .i8,
32977 .u16,
32978 .i16,
32979 .u29,
32980 .u32,
32981 .i32,
32982 .u64,
32983 .i64,
32984 .u128,
32985 .i128,
32986
32987 .error_set_single,32961 .error_set_single,
32988 .error_set,32962 .error_set,
32989 .error_set_merged,32963 .error_set_merged,
...@@ -33175,19 +33149,6 @@ pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref {...@@ -33175,19 +33149,6 @@ pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref {
33175 return Air.indexToRef(@intCast(u32, sema.air_instructions.len - 1));33149 return Air.indexToRef(@intCast(u32, sema.air_instructions.len - 1));
33176 }33150 }
33177 switch (ty.tag()) {33151 switch (ty.tag()) {
33178 .u1 => return .u1_type,
33179 .u8 => return .u8_type,
33180 .i8 => return .i8_type,
33181 .u16 => return .u16_type,
33182 .u29 => return .u29_type,
33183 .i16 => return .i16_type,
33184 .u32 => return .u32_type,
33185 .i32 => return .i32_type,
33186 .u64 => return .u64_type,
33187 .i64 => return .i64_type,
33188 .u128 => return .u128_type,
33189 .i128 => return .i128_type,
33190
33191 .manyptr_u8 => return .manyptr_u8_type,33152 .manyptr_u8 => return .manyptr_u8_type,
33192 .manyptr_const_u8 => return .manyptr_const_u8_type,33153 .manyptr_const_u8 => return .manyptr_const_u8_type,
33193 .single_const_pointer_to_comptime_int => return .single_const_pointer_to_comptime_int_type,33154 .single_const_pointer_to_comptime_int => return .single_const_pointer_to_comptime_int_type,
...@@ -33617,19 +33578,6 @@ pub fn typeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool {...@@ -33617,19 +33578,6 @@ pub fn typeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool {
33617 }33578 }
33618 }33579 }
33619 return switch (ty.tag()) {33580 return switch (ty.tag()) {
33620 .u1,
33621 .u8,
33622 .i8,
33623 .u16,
33624 .i16,
33625 .u29,
33626 .u32,
33627 .i32,
33628 .u64,
33629 .i64,
33630 .u128,
33631 .i128,
33632
33633 .manyptr_u8,33581 .manyptr_u8,
33634 .manyptr_const_u8,33582 .manyptr_const_u8,
33635 .manyptr_const_u8_sentinel_0,33583 .manyptr_const_u8_sentinel_0,
src/arch/aarch64/CodeGen.zig+11-11
...@@ -2577,7 +2577,7 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void {...@@ -2577,7 +2577,7 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void {
2577 });2577 });
25782578
2579 try self.genSetStack(lhs_ty, stack_offset, .{ .register = truncated_reg });2579 try self.genSetStack(lhs_ty, stack_offset, .{ .register = truncated_reg });
2580 try self.genSetStack(Type.initTag(.u1), stack_offset - overflow_bit_offset, .{ .compare_flags = .ne });2580 try self.genSetStack(Type.u1, stack_offset - overflow_bit_offset, .{ .compare_flags = .ne });
25812581
2582 break :result MCValue{ .stack_offset = stack_offset };2582 break :result MCValue{ .stack_offset = stack_offset };
2583 },2583 },
...@@ -2720,7 +2720,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {...@@ -2720,7 +2720,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
2720 }2720 }
27212721
2722 try self.genSetStack(lhs_ty, stack_offset, .{ .register = truncated_reg });2722 try self.genSetStack(lhs_ty, stack_offset, .{ .register = truncated_reg });
2723 try self.genSetStack(Type.initTag(.u1), stack_offset - overflow_bit_offset, .{ .compare_flags = .ne });2723 try self.genSetStack(Type.u1, stack_offset - overflow_bit_offset, .{ .compare_flags = .ne });
27242724
2725 break :result MCValue{ .stack_offset = stack_offset };2725 break :result MCValue{ .stack_offset = stack_offset };
2726 } else if (int_info.bits <= 64) {2726 } else if (int_info.bits <= 64) {
...@@ -2860,7 +2860,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {...@@ -2860,7 +2860,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
2860 try self.truncRegister(dest_reg, truncated_reg, int_info.signedness, int_info.bits);2860 try self.truncRegister(dest_reg, truncated_reg, int_info.signedness, int_info.bits);
28612861
2862 try self.genSetStack(lhs_ty, stack_offset, .{ .register = truncated_reg });2862 try self.genSetStack(lhs_ty, stack_offset, .{ .register = truncated_reg });
2863 try self.genSetStack(Type.initTag(.u1), stack_offset - overflow_bit_offset, .{ .compare_flags = .ne });2863 try self.genSetStack(Type.u1, stack_offset - overflow_bit_offset, .{ .compare_flags = .ne });
28642864
2865 break :result MCValue{ .stack_offset = stack_offset };2865 break :result MCValue{ .stack_offset = stack_offset };
2866 } else return self.fail("TODO implement mul_with_overflow for integers > u64/i64", .{});2866 } else return self.fail("TODO implement mul_with_overflow for integers > u64/i64", .{});
...@@ -2993,7 +2993,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {...@@ -2993,7 +2993,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
2993 });2993 });
29942994
2995 try self.genSetStack(lhs_ty, stack_offset, .{ .register = dest_reg });2995 try self.genSetStack(lhs_ty, stack_offset, .{ .register = dest_reg });
2996 try self.genSetStack(Type.initTag(.u1), stack_offset - overflow_bit_offset, .{ .compare_flags = .ne });2996 try self.genSetStack(Type.u1, stack_offset - overflow_bit_offset, .{ .compare_flags = .ne });
29972997
2998 break :result MCValue{ .stack_offset = stack_offset };2998 break :result MCValue{ .stack_offset = stack_offset };
2999 } else {2999 } else {
...@@ -3780,7 +3780,7 @@ fn genInlineMemset(...@@ -3780,7 +3780,7 @@ fn genInlineMemset(
37803780
3781 const val_reg = switch (val) {3781 const val_reg = switch (val) {
3782 .register => |r| r,3782 .register => |r| r,
3783 else => try self.copyToTmpRegister(Type.initTag(.u8), val),3783 else => try self.copyToTmpRegister(Type.u8, val),
3784 };3784 };
3785 const val_reg_lock = self.register_manager.lockReg(val_reg);3785 const val_reg_lock = self.register_manager.lockReg(val_reg);
3786 defer if (val_reg_lock) |lock| self.register_manager.unlockReg(lock);3786 defer if (val_reg_lock) |lock| self.register_manager.unlockReg(lock);
...@@ -4330,7 +4330,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier...@@ -4330,7 +4330,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
4330 } else if (self.bin_file.cast(link.File.MachO)) |macho_file| {4330 } else if (self.bin_file.cast(link.File.MachO)) |macho_file| {
4331 const atom = try macho_file.getOrCreateAtomForDecl(func.owner_decl);4331 const atom = try macho_file.getOrCreateAtomForDecl(func.owner_decl);
4332 const sym_index = macho_file.getAtom(atom).getSymbolIndex().?;4332 const sym_index = macho_file.getAtom(atom).getSymbolIndex().?;
4333 try self.genSetReg(Type.initTag(.u64), .x30, .{4333 try self.genSetReg(Type.u64, .x30, .{
4334 .linker_load = .{4334 .linker_load = .{
4335 .type = .got,4335 .type = .got,
4336 .sym_index = sym_index,4336 .sym_index = sym_index,
...@@ -4339,7 +4339,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier...@@ -4339,7 +4339,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
4339 } else if (self.bin_file.cast(link.File.Coff)) |coff_file| {4339 } else if (self.bin_file.cast(link.File.Coff)) |coff_file| {
4340 const atom = try coff_file.getOrCreateAtomForDecl(func.owner_decl);4340 const atom = try coff_file.getOrCreateAtomForDecl(func.owner_decl);
4341 const sym_index = coff_file.getAtom(atom).getSymbolIndex().?;4341 const sym_index = coff_file.getAtom(atom).getSymbolIndex().?;
4342 try self.genSetReg(Type.initTag(.u64), .x30, .{4342 try self.genSetReg(Type.u64, .x30, .{
4343 .linker_load = .{4343 .linker_load = .{
4344 .type = .got,4344 .type = .got,
4345 .sym_index = sym_index,4345 .sym_index = sym_index,
...@@ -4379,7 +4379,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier...@@ -4379,7 +4379,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
4379 });4379 });
4380 } else if (self.bin_file.cast(link.File.Coff)) |coff_file| {4380 } else if (self.bin_file.cast(link.File.Coff)) |coff_file| {
4381 const sym_index = try coff_file.getGlobalSymbol(decl_name, lib_name);4381 const sym_index = try coff_file.getGlobalSymbol(decl_name, lib_name);
4382 try self.genSetReg(Type.initTag(.u64), .x30, .{4382 try self.genSetReg(Type.u64, .x30, .{
4383 .linker_load = .{4383 .linker_load = .{
4384 .type = .import,4384 .type = .import,
4385 .sym_index = sym_index,4385 .sym_index = sym_index,
...@@ -4536,7 +4536,7 @@ fn cmp(...@@ -4536,7 +4536,7 @@ fn cmp(
4536 var opt_buffer: Type.Payload.ElemType = undefined;4536 var opt_buffer: Type.Payload.ElemType = undefined;
4537 const payload_ty = lhs_ty.optionalChild(&opt_buffer);4537 const payload_ty = lhs_ty.optionalChild(&opt_buffer);
4538 if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) {4538 if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) {
4539 break :blk Type.initTag(.u1);4539 break :blk Type.u1;
4540 } else if (lhs_ty.isPtrLikeOptional(mod)) {4540 } else if (lhs_ty.isPtrLikeOptional(mod)) {
4541 break :blk Type.usize;4541 break :blk Type.usize;
4542 } else {4542 } else {
...@@ -4546,9 +4546,9 @@ fn cmp(...@@ -4546,9 +4546,9 @@ fn cmp(
4546 .Float => return self.fail("TODO ARM cmp floats", .{}),4546 .Float => return self.fail("TODO ARM cmp floats", .{}),
4547 .Enum => lhs_ty.intTagType(),4547 .Enum => lhs_ty.intTagType(),
4548 .Int => lhs_ty,4548 .Int => lhs_ty,
4549 .Bool => Type.initTag(.u1),4549 .Bool => Type.u1,
4550 .Pointer => Type.usize,4550 .Pointer => Type.usize,
4551 .ErrorSet => Type.initTag(.u16),4551 .ErrorSet => Type.u16,
4552 else => unreachable,4552 else => unreachable,
4553 };4553 };
45544554
src/arch/arm/CodeGen.zig+12-12
...@@ -1637,7 +1637,7 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void {...@@ -1637,7 +1637,7 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void {
1637 });1637 });
16381638
1639 try self.genSetStack(lhs_ty, stack_offset, .{ .register = truncated_reg });1639 try self.genSetStack(lhs_ty, stack_offset, .{ .register = truncated_reg });
1640 try self.genSetStack(Type.initTag(.u1), stack_offset - overflow_bit_offset, .{ .cpsr_flags = .ne });1640 try self.genSetStack(Type.u1, stack_offset - overflow_bit_offset, .{ .cpsr_flags = .ne });
16411641
1642 break :result MCValue{ .stack_offset = stack_offset };1642 break :result MCValue{ .stack_offset = stack_offset };
1643 } else if (int_info.bits == 32) {1643 } else if (int_info.bits == 32) {
...@@ -1750,7 +1750,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {...@@ -1750,7 +1750,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
1750 });1750 });
17511751
1752 try self.genSetStack(lhs_ty, stack_offset, .{ .register = truncated_reg });1752 try self.genSetStack(lhs_ty, stack_offset, .{ .register = truncated_reg });
1753 try self.genSetStack(Type.initTag(.u1), stack_offset - overflow_bit_offset, .{ .cpsr_flags = .ne });1753 try self.genSetStack(Type.u1, stack_offset - overflow_bit_offset, .{ .cpsr_flags = .ne });
17541754
1755 break :result MCValue{ .stack_offset = stack_offset };1755 break :result MCValue{ .stack_offset = stack_offset };
1756 } else if (int_info.bits <= 32) {1756 } else if (int_info.bits <= 32) {
...@@ -1848,7 +1848,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {...@@ -1848,7 +1848,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
1848 });1848 });
18491849
1850 // strb rdlo, [...]1850 // strb rdlo, [...]
1851 try self.genSetStack(Type.initTag(.u1), stack_offset - overflow_bit_offset, .{ .register = rdlo });1851 try self.genSetStack(Type.u1, stack_offset - overflow_bit_offset, .{ .register = rdlo });
18521852
1853 break :result MCValue{ .stack_offset = stack_offset };1853 break :result MCValue{ .stack_offset = stack_offset };
1854 } else {1854 } else {
...@@ -1983,7 +1983,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {...@@ -1983,7 +1983,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
1983 });1983 });
19841984
1985 try self.genSetStack(lhs_ty, stack_offset, .{ .register = dest_reg });1985 try self.genSetStack(lhs_ty, stack_offset, .{ .register = dest_reg });
1986 try self.genSetStack(Type.initTag(.u1), stack_offset - overflow_bit_offset, .{ .cpsr_flags = .ne });1986 try self.genSetStack(Type.u1, stack_offset - overflow_bit_offset, .{ .cpsr_flags = .ne });
19871987
1988 break :result MCValue{ .stack_offset = stack_offset };1988 break :result MCValue{ .stack_offset = stack_offset };
1989 } else {1989 } else {
...@@ -4086,7 +4086,7 @@ fn genInlineMemset(...@@ -4086,7 +4086,7 @@ fn genInlineMemset(
40864086
4087 const val_reg = switch (val) {4087 const val_reg = switch (val) {
4088 .register => |r| r,4088 .register => |r| r,
4089 else => try self.copyToTmpRegister(Type.initTag(.u8), val),4089 else => try self.copyToTmpRegister(Type.u8, val),
4090 };4090 };
4091 const val_reg_lock = self.register_manager.lockReg(val_reg);4091 const val_reg_lock = self.register_manager.lockReg(val_reg);
4092 defer if (val_reg_lock) |lock| self.register_manager.unlockReg(lock);4092 defer if (val_reg_lock) |lock| self.register_manager.unlockReg(lock);
...@@ -4485,7 +4485,7 @@ fn cmp(...@@ -4485,7 +4485,7 @@ fn cmp(
4485 var opt_buffer: Type.Payload.ElemType = undefined;4485 var opt_buffer: Type.Payload.ElemType = undefined;
4486 const payload_ty = lhs_ty.optionalChild(&opt_buffer);4486 const payload_ty = lhs_ty.optionalChild(&opt_buffer);
4487 if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) {4487 if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) {
4488 break :blk Type.initTag(.u1);4488 break :blk Type.u1;
4489 } else if (lhs_ty.isPtrLikeOptional(mod)) {4489 } else if (lhs_ty.isPtrLikeOptional(mod)) {
4490 break :blk Type.usize;4490 break :blk Type.usize;
4491 } else {4491 } else {
...@@ -4495,9 +4495,9 @@ fn cmp(...@@ -4495,9 +4495,9 @@ fn cmp(
4495 .Float => return self.fail("TODO ARM cmp floats", .{}),4495 .Float => return self.fail("TODO ARM cmp floats", .{}),
4496 .Enum => lhs_ty.intTagType(),4496 .Enum => lhs_ty.intTagType(),
4497 .Int => lhs_ty,4497 .Int => lhs_ty,
4498 .Bool => Type.initTag(.u1),4498 .Bool => Type.u1,
4499 .Pointer => Type.usize,4499 .Pointer => Type.usize,
4500 .ErrorSet => Type.initTag(.u16),4500 .ErrorSet => Type.u16,
4501 else => unreachable,4501 else => unreachable,
4502 };4502 };
45034503
...@@ -5367,7 +5367,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro...@@ -5367,7 +5367,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro
5367 1, 4 => {5367 1, 4 => {
5368 const offset = if (math.cast(u12, stack_offset)) |imm| blk: {5368 const offset = if (math.cast(u12, stack_offset)) |imm| blk: {
5369 break :blk Instruction.Offset.imm(imm);5369 break :blk Instruction.Offset.imm(imm);
5370 } else Instruction.Offset.reg(try self.copyToTmpRegister(Type.initTag(.u32), MCValue{ .immediate = stack_offset }), .none);5370 } else Instruction.Offset.reg(try self.copyToTmpRegister(Type.u32, MCValue{ .immediate = stack_offset }), .none);
53715371
5372 const tag: Mir.Inst.Tag = switch (abi_size) {5372 const tag: Mir.Inst.Tag = switch (abi_size) {
5373 1 => .strb,5373 1 => .strb,
...@@ -5390,7 +5390,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro...@@ -5390,7 +5390,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro
5390 2 => {5390 2 => {
5391 const offset = if (stack_offset <= math.maxInt(u8)) blk: {5391 const offset = if (stack_offset <= math.maxInt(u8)) blk: {
5392 break :blk Instruction.ExtraLoadStoreOffset.imm(@intCast(u8, stack_offset));5392 break :blk Instruction.ExtraLoadStoreOffset.imm(@intCast(u8, stack_offset));
5393 } else Instruction.ExtraLoadStoreOffset.reg(try self.copyToTmpRegister(Type.initTag(.u32), MCValue{ .immediate = stack_offset }));5393 } else Instruction.ExtraLoadStoreOffset.reg(try self.copyToTmpRegister(Type.u32, MCValue{ .immediate = stack_offset }));
53945394
5395 _ = try self.addInst(.{5395 _ = try self.addInst(.{
5396 .tag = .strh,5396 .tag = .strh,
...@@ -5769,7 +5769,7 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I...@@ -5769,7 +5769,7 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I
5769 1, 4 => {5769 1, 4 => {
5770 const offset = if (math.cast(u12, stack_offset)) |imm| blk: {5770 const offset = if (math.cast(u12, stack_offset)) |imm| blk: {
5771 break :blk Instruction.Offset.imm(imm);5771 break :blk Instruction.Offset.imm(imm);
5772 } else Instruction.Offset.reg(try self.copyToTmpRegister(Type.initTag(.u32), MCValue{ .immediate = stack_offset }), .none);5772 } else Instruction.Offset.reg(try self.copyToTmpRegister(Type.u32, MCValue{ .immediate = stack_offset }), .none);
57735773
5774 const tag: Mir.Inst.Tag = switch (abi_size) {5774 const tag: Mir.Inst.Tag = switch (abi_size) {
5775 1 => .strb,5775 1 => .strb,
...@@ -5789,7 +5789,7 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I...@@ -5789,7 +5789,7 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I
5789 2 => {5789 2 => {
5790 const offset = if (stack_offset <= math.maxInt(u8)) blk: {5790 const offset = if (stack_offset <= math.maxInt(u8)) blk: {
5791 break :blk Instruction.ExtraLoadStoreOffset.imm(@intCast(u8, stack_offset));5791 break :blk Instruction.ExtraLoadStoreOffset.imm(@intCast(u8, stack_offset));
5792 } else Instruction.ExtraLoadStoreOffset.reg(try self.copyToTmpRegister(Type.initTag(.u32), MCValue{ .immediate = stack_offset }));5792 } else Instruction.ExtraLoadStoreOffset.reg(try self.copyToTmpRegister(Type.u32, MCValue{ .immediate = stack_offset }));
57935793
5794 _ = try self.addInst(.{5794 _ = try self.addInst(.{
5795 .tag = .strh,5795 .tag = .strh,
src/arch/sparc64/CodeGen.zig+3-3
...@@ -1436,14 +1436,14 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {...@@ -1436,14 +1436,14 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
1436 .Vector => unreachable, // Handled by cmp_vector.1436 .Vector => unreachable, // Handled by cmp_vector.
1437 .Enum => lhs_ty.intTagType(),1437 .Enum => lhs_ty.intTagType(),
1438 .Int => lhs_ty,1438 .Int => lhs_ty,
1439 .Bool => Type.initTag(.u1),1439 .Bool => Type.u1,
1440 .Pointer => Type.usize,1440 .Pointer => Type.usize,
1441 .ErrorSet => Type.initTag(.u16),1441 .ErrorSet => Type.u16,
1442 .Optional => blk: {1442 .Optional => blk: {
1443 var opt_buffer: Type.Payload.ElemType = undefined;1443 var opt_buffer: Type.Payload.ElemType = undefined;
1444 const payload_ty = lhs_ty.optionalChild(&opt_buffer);1444 const payload_ty = lhs_ty.optionalChild(&opt_buffer);
1445 if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) {1445 if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) {
1446 break :blk Type.initTag(.u1);1446 break :blk Type.u1;
1447 } else if (lhs_ty.isPtrLikeOptional(mod)) {1447 } else if (lhs_ty.isPtrLikeOptional(mod)) {
1448 break :blk Type.usize;1448 break :blk Type.usize;
1449 } else {1449 } else {
src/arch/wasm/CodeGen.zig+9-9
...@@ -4272,7 +4272,7 @@ fn airWrapOptional(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {...@@ -4272,7 +4272,7 @@ fn airWrapOptional(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
42724272
4273 const result = result: {4273 const result = result: {
4274 if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) {4274 if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) {
4275 const non_null_bit = try func.allocStack(Type.initTag(.u1));4275 const non_null_bit = try func.allocStack(Type.u1);
4276 try func.emitWValue(non_null_bit);4276 try func.emitWValue(non_null_bit);
4277 try func.addImm32(1);4277 try func.addImm32(1);
4278 try func.addMemArg(.i32_store8, .{ .offset = non_null_bit.offset(), .alignment = 1 });4278 try func.addMemArg(.i32_store8, .{ .offset = non_null_bit.offset(), .alignment = 1 });
...@@ -5195,7 +5195,7 @@ fn cmpOptionals(func: *CodeGen, lhs: WValue, rhs: WValue, operand_ty: Type, op:...@@ -5195,7 +5195,7 @@ fn cmpOptionals(func: *CodeGen, lhs: WValue, rhs: WValue, operand_ty: Type, op:
51955195
5196 // We store the final result in here that will be validated5196 // We store the final result in here that will be validated
5197 // if the optional is truly equal.5197 // if the optional is truly equal.
5198 var result = try func.ensureAllocLocal(Type.initTag(.i32));5198 var result = try func.ensureAllocLocal(Type.i32);
5199 defer result.free(func);5199 defer result.free(func);
52005200
5201 try func.startBlock(.block, wasm.block_empty);5201 try func.startBlock(.block, wasm.block_empty);
...@@ -5658,7 +5658,7 @@ fn airAddSubWithOverflow(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerErro...@@ -5658,7 +5658,7 @@ fn airAddSubWithOverflow(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerErro
5658 const result_ptr = try func.allocStack(func.typeOfIndex(inst));5658 const result_ptr = try func.allocStack(func.typeOfIndex(inst));
5659 try func.store(result_ptr, result, lhs_ty, 0);5659 try func.store(result_ptr, result, lhs_ty, 0);
5660 const offset = @intCast(u32, lhs_ty.abiSize(mod));5660 const offset = @intCast(u32, lhs_ty.abiSize(mod));
5661 try func.store(result_ptr, overflow_local, Type.initTag(.u1), offset);5661 try func.store(result_ptr, overflow_local, Type.u1, offset);
56625662
5663 func.finishAir(inst, result_ptr, &.{ extra.lhs, extra.rhs });5663 func.finishAir(inst, result_ptr, &.{ extra.lhs, extra.rhs });
5664}5664}
...@@ -5717,13 +5717,13 @@ fn addSubWithOverflowBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type,...@@ -5717,13 +5717,13 @@ fn addSubWithOverflowBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type,
57175717
5718 break :blk WValue{ .stack = {} };5718 break :blk WValue{ .stack = {} };
5719 };5719 };
5720 var overflow_local = try overflow_bit.toLocal(func, Type.initTag(.u1));5720 var overflow_local = try overflow_bit.toLocal(func, Type.u1);
5721 defer overflow_local.free(func);5721 defer overflow_local.free(func);
57225722
5723 const result_ptr = try func.allocStack(result_ty);5723 const result_ptr = try func.allocStack(result_ty);
5724 try func.store(result_ptr, high_op_res, Type.u64, 0);5724 try func.store(result_ptr, high_op_res, Type.u64, 0);
5725 try func.store(result_ptr, tmp_op, Type.u64, 8);5725 try func.store(result_ptr, tmp_op, Type.u64, 8);
5726 try func.store(result_ptr, overflow_local, Type.initTag(.u1), 16);5726 try func.store(result_ptr, overflow_local, Type.u1, 16);
57275727
5728 return result_ptr;5728 return result_ptr;
5729}5729}
...@@ -5774,13 +5774,13 @@ fn airShlWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {...@@ -5774,13 +5774,13 @@ fn airShlWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5774 const shr = try func.binOp(result, rhs_final, lhs_ty, .shr);5774 const shr = try func.binOp(result, rhs_final, lhs_ty, .shr);
5775 break :blk try func.cmp(.{ .stack = {} }, shr, lhs_ty, .neq);5775 break :blk try func.cmp(.{ .stack = {} }, shr, lhs_ty, .neq);
5776 };5776 };
5777 var overflow_local = try overflow_bit.toLocal(func, Type.initTag(.u1));5777 var overflow_local = try overflow_bit.toLocal(func, Type.u1);
5778 defer overflow_local.free(func);5778 defer overflow_local.free(func);
57795779
5780 const result_ptr = try func.allocStack(func.typeOfIndex(inst));5780 const result_ptr = try func.allocStack(func.typeOfIndex(inst));
5781 try func.store(result_ptr, result, lhs_ty, 0);5781 try func.store(result_ptr, result, lhs_ty, 0);
5782 const offset = @intCast(u32, lhs_ty.abiSize(mod));5782 const offset = @intCast(u32, lhs_ty.abiSize(mod));
5783 try func.store(result_ptr, overflow_local, Type.initTag(.u1), offset);5783 try func.store(result_ptr, overflow_local, Type.u1, offset);
57845784
5785 func.finishAir(inst, result_ptr, &.{ extra.lhs, extra.rhs });5785 func.finishAir(inst, result_ptr, &.{ extra.lhs, extra.rhs });
5786}5786}
...@@ -5800,7 +5800,7 @@ fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {...@@ -5800,7 +5800,7 @@ fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
58005800
5801 // We store the bit if it's overflowed or not in this. As it's zero-initialized5801 // We store the bit if it's overflowed or not in this. As it's zero-initialized
5802 // we only need to update it if an overflow (or underflow) occurred.5802 // we only need to update it if an overflow (or underflow) occurred.
5803 var overflow_bit = try func.ensureAllocLocal(Type.initTag(.u1));5803 var overflow_bit = try func.ensureAllocLocal(Type.u1);
5804 defer overflow_bit.free(func);5804 defer overflow_bit.free(func);
58055805
5806 const int_info = lhs_ty.intInfo(mod);5806 const int_info = lhs_ty.intInfo(mod);
...@@ -5955,7 +5955,7 @@ fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {...@@ -5955,7 +5955,7 @@ fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5955 const result_ptr = try func.allocStack(func.typeOfIndex(inst));5955 const result_ptr = try func.allocStack(func.typeOfIndex(inst));
5956 try func.store(result_ptr, bin_op_local, lhs_ty, 0);5956 try func.store(result_ptr, bin_op_local, lhs_ty, 0);
5957 const offset = @intCast(u32, lhs_ty.abiSize(mod));5957 const offset = @intCast(u32, lhs_ty.abiSize(mod));
5958 try func.store(result_ptr, overflow_bit, Type.initTag(.u1), offset);5958 try func.store(result_ptr, overflow_bit, Type.u1, offset);
59595959
5960 func.finishAir(inst, result_ptr, &.{ extra.lhs, extra.rhs });5960 func.finishAir(inst, result_ptr, &.{ extra.lhs, extra.rhs });
5961}5961}
src/codegen/c/type.zig+1-1
...@@ -1471,7 +1471,7 @@ pub const CType = extern union {...@@ -1471,7 +1471,7 @@ pub const CType = extern union {
1471 else1471 else
1472 info.pointee_type;1472 info.pointee_type;
14731473
1474 if (if (info.size == .C and pointee_ty.tag() == .u8)1474 if (if (info.size == .C and pointee_ty.ip_index == .u8_type)
1475 Tag.char.toIndex()1475 Tag.char.toIndex()
1476 else1476 else
1477 try lookup.typeToIndex(pointee_ty, .forward)) |child_idx|1477 try lookup.typeToIndex(pointee_ty, .forward)) |child_idx|
src/type.zig+48-310
...@@ -107,20 +107,6 @@ pub const Type = struct {...@@ -107,20 +107,6 @@ pub const Type = struct {
107 }107 }
108 }108 }
109 switch (ty.tag()) {109 switch (ty.tag()) {
110 .u1,
111 .u8,
112 .i8,
113 .u16,
114 .i16,
115 .u29,
116 .u32,
117 .i32,
118 .u64,
119 .i64,
120 .u128,
121 .i128,
122 => return .Int,
123
124 .error_set,110 .error_set,
125 .error_set_single,111 .error_set_single,
126 .error_set_inferred,112 .error_set_inferred,
...@@ -589,26 +575,6 @@ pub const Type = struct {...@@ -589,26 +575,6 @@ pub const Type = struct {
589 if (a.legacy.tag_if_small_enough == b.legacy.tag_if_small_enough) return true;575 if (a.legacy.tag_if_small_enough == b.legacy.tag_if_small_enough) return true;
590576
591 switch (a.tag()) {577 switch (a.tag()) {
592 .u1,
593 .u8,
594 .i8,
595 .u16,
596 .i16,
597 .u29,
598 .u32,
599 .i32,
600 .u64,
601 .i64,
602 .u128,
603 .i128,
604 => {
605 if (b.zigTypeTag(mod) != .Int) return false;
606 if (b.isNamedInt()) return false;
607 const info_a = a.intInfo(mod);
608 const info_b = b.intInfo(mod);
609 return info_a.signedness == info_b.signedness and info_a.bits == info_b.bits;
610 },
611
612 .error_set_inferred => {578 .error_set_inferred => {
613 // Inferred error sets are only equal if both are inferred579 // Inferred error sets are only equal if both are inferred
614 // and they share the same pointer.580 // and they share the same pointer.
...@@ -926,26 +892,6 @@ pub const Type = struct {...@@ -926,26 +892,6 @@ pub const Type = struct {
926 return;892 return;
927 }893 }
928 switch (ty.tag()) {894 switch (ty.tag()) {
929 .u1,
930 .u8,
931 .i8,
932 .u16,
933 .i16,
934 .u29,
935 .u32,
936 .i32,
937 .u64,
938 .i64,
939 .u128,
940 .i128,
941 => {
942 // Arbitrary sized integers.
943 std.hash.autoHash(hasher, std.builtin.TypeId.Int);
944 const info = ty.intInfo(mod);
945 std.hash.autoHash(hasher, info.signedness);
946 std.hash.autoHash(hasher, info.bits);
947 },
948
949 .error_set,895 .error_set,
950 .error_set_single,896 .error_set_single,
951 .error_set_merged,897 .error_set_merged,
...@@ -1183,18 +1129,6 @@ pub const Type = struct {...@@ -1183,18 +1129,6 @@ pub const Type = struct {
1183 .legacy = .{ .tag_if_small_enough = self.legacy.tag_if_small_enough },1129 .legacy = .{ .tag_if_small_enough = self.legacy.tag_if_small_enough },
1184 };1130 };
1185 } else switch (self.legacy.ptr_otherwise.tag) {1131 } else switch (self.legacy.ptr_otherwise.tag) {
1186 .u1,
1187 .u8,
1188 .i8,
1189 .u16,
1190 .i16,
1191 .u29,
1192 .u32,
1193 .i32,
1194 .u64,
1195 .i64,
1196 .u128,
1197 .i128,
1198 .single_const_pointer_to_comptime_int,1132 .single_const_pointer_to_comptime_int,
1199 .const_slice_u8,1133 .const_slice_u8,
1200 .const_slice_u8_sentinel_0,1134 .const_slice_u8_sentinel_0,
...@@ -1435,20 +1369,6 @@ pub const Type = struct {...@@ -1435,20 +1369,6 @@ pub const Type = struct {
1435 while (true) {1369 while (true) {
1436 const t = ty.tag();1370 const t = ty.tag();
1437 switch (t) {1371 switch (t) {
1438 .u1,
1439 .u8,
1440 .i8,
1441 .u16,
1442 .i16,
1443 .u29,
1444 .u32,
1445 .i32,
1446 .u64,
1447 .i64,
1448 .u128,
1449 .i128,
1450 => return writer.writeAll(@tagName(t)),
1451
1452 .empty_struct, .empty_struct_literal => return writer.writeAll("struct {}"),1372 .empty_struct, .empty_struct_literal => return writer.writeAll("struct {}"),
14531373
1454 .@"struct" => {1374 .@"struct" => {
...@@ -1775,20 +1695,6 @@ pub const Type = struct {...@@ -1775,20 +1695,6 @@ pub const Type = struct {
1775 .inferred_alloc_const => unreachable,1695 .inferred_alloc_const => unreachable,
1776 .inferred_alloc_mut => unreachable,1696 .inferred_alloc_mut => unreachable,
17771697
1778 .u1,
1779 .u8,
1780 .i8,
1781 .u16,
1782 .i16,
1783 .u29,
1784 .u32,
1785 .i32,
1786 .u64,
1787 .i64,
1788 .u128,
1789 .i128,
1790 => try writer.writeAll(@tagName(t)),
1791
1792 .empty_struct_literal => try writer.writeAll("@TypeOf(.{})"),1698 .empty_struct_literal => try writer.writeAll("@TypeOf(.{})"),
17931699
1794 .empty_struct => {1700 .empty_struct => {
...@@ -2057,16 +1963,6 @@ pub const Type = struct {...@@ -2057,16 +1963,6 @@ pub const Type = struct {
2057 pub fn toValue(self: Type, allocator: Allocator) Allocator.Error!Value {1963 pub fn toValue(self: Type, allocator: Allocator) Allocator.Error!Value {
2058 if (self.ip_index != .none) return self.ip_index.toValue();1964 if (self.ip_index != .none) return self.ip_index.toValue();
2059 switch (self.tag()) {1965 switch (self.tag()) {
2060 .u1 => return Value{ .ip_index = .u1_type, .legacy = undefined },
2061 .u8 => return Value{ .ip_index = .u8_type, .legacy = undefined },
2062 .i8 => return Value{ .ip_index = .i8_type, .legacy = undefined },
2063 .u16 => return Value{ .ip_index = .u16_type, .legacy = undefined },
2064 .u29 => return Value{ .ip_index = .u29_type, .legacy = undefined },
2065 .i16 => return Value{ .ip_index = .i16_type, .legacy = undefined },
2066 .u32 => return Value{ .ip_index = .u32_type, .legacy = undefined },
2067 .i32 => return Value{ .ip_index = .i32_type, .legacy = undefined },
2068 .u64 => return Value{ .ip_index = .u64_type, .legacy = undefined },
2069 .i64 => return Value{ .ip_index = .i64_type, .legacy = undefined },
2070 .single_const_pointer_to_comptime_int => return Value{ .ip_index = .single_const_pointer_to_comptime_int_type, .legacy = undefined },1966 .single_const_pointer_to_comptime_int => return Value{ .ip_index = .single_const_pointer_to_comptime_int_type, .legacy = undefined },
2071 .const_slice_u8 => return Value{ .ip_index = .const_slice_u8_type, .legacy = undefined },1967 .const_slice_u8 => return Value{ .ip_index = .const_slice_u8_type, .legacy = undefined },
2072 .const_slice_u8_sentinel_0 => return Value{ .ip_index = .const_slice_u8_sentinel_0_type, .legacy = undefined },1968 .const_slice_u8_sentinel_0 => return Value{ .ip_index = .const_slice_u8_sentinel_0_type, .legacy = undefined },
...@@ -2162,19 +2058,6 @@ pub const Type = struct {...@@ -2162,19 +2058,6 @@ pub const Type = struct {
2162 .enum_tag => unreachable, // it's a value, not a type2058 .enum_tag => unreachable, // it's a value, not a type
2163 };2059 };
2164 switch (ty.tag()) {2060 switch (ty.tag()) {
2165 .u1,
2166 .u8,
2167 .i8,
2168 .u16,
2169 .i16,
2170 .u29,
2171 .u32,
2172 .i32,
2173 .u64,
2174 .i64,
2175 .u128,
2176 .i128,
2177
2178 .const_slice_u8,2061 .const_slice_u8,
2179 .const_slice_u8_sentinel_0,2062 .const_slice_u8_sentinel_0,
2180 .array_u8_sentinel_0,2063 .array_u8_sentinel_0,
...@@ -2404,19 +2287,6 @@ pub const Type = struct {...@@ -2404,19 +2287,6 @@ pub const Type = struct {
2404 .enum_tag => unreachable, // it's a value, not a type2287 .enum_tag => unreachable, // it's a value, not a type
2405 };2288 };
2406 return switch (ty.tag()) {2289 return switch (ty.tag()) {
2407 .u1,
2408 .u8,
2409 .i8,
2410 .u16,
2411 .i16,
2412 .u29,
2413 .u32,
2414 .i32,
2415 .u64,
2416 .i64,
2417 .u128,
2418 .i128,
2419
2420 .manyptr_u8,2290 .manyptr_u8,
2421 .manyptr_const_u8,2291 .manyptr_const_u8,
2422 .manyptr_const_u8_sentinel_0,2292 .manyptr_const_u8_sentinel_0,
...@@ -2752,10 +2622,6 @@ pub const Type = struct {...@@ -2752,10 +2622,6 @@ pub const Type = struct {
2752 else => null,2622 else => null,
2753 };2623 };
2754 switch (ty.tag()) {2624 switch (ty.tag()) {
2755 .u1,
2756 .u8,
2757 .i8,
2758
2759 .array_u8_sentinel_0,2625 .array_u8_sentinel_0,
2760 .array_u8,2626 .array_u8,
2761 .@"opaque",2627 .@"opaque",
...@@ -2806,12 +2672,6 @@ pub const Type = struct {...@@ -2806,12 +2672,6 @@ pub const Type = struct {
2806 return AbiAlignmentAdvanced{ .scalar = @intCast(u32, alignment) };2672 return AbiAlignmentAdvanced{ .scalar = @intCast(u32, alignment) };
2807 },2673 },
28082674
2809 .i16, .u16 => return AbiAlignmentAdvanced{ .scalar = intAbiAlignment(16, target) },
2810 .u29 => return AbiAlignmentAdvanced{ .scalar = intAbiAlignment(29, target) },
2811 .i32, .u32 => return AbiAlignmentAdvanced{ .scalar = intAbiAlignment(32, target) },
2812 .i64, .u64 => return AbiAlignmentAdvanced{ .scalar = intAbiAlignment(64, target) },
2813 .u128, .i128 => return AbiAlignmentAdvanced{ .scalar = intAbiAlignment(128, target) },
2814
2815 .optional => {2675 .optional => {
2816 var buf: Payload.ElemType = undefined;2676 var buf: Payload.ElemType = undefined;
2817 const child_type = ty.optionalChild(&buf);2677 const child_type = ty.optionalChild(&buf);
...@@ -3208,11 +3068,6 @@ pub const Type = struct {...@@ -3208,11 +3068,6 @@ pub const Type = struct {
3208 return abiSizeAdvancedUnion(ty, mod, strat, union_obj, true);3068 return abiSizeAdvancedUnion(ty, mod, strat, union_obj, true);
3209 },3069 },
32103070
3211 .u1,
3212 .u8,
3213 .i8,
3214 => return AbiSizeAdvanced{ .scalar = 1 },
3215
3216 .array_u8 => return AbiSizeAdvanced{ .scalar = ty.castTag(.array_u8).?.data },3071 .array_u8 => return AbiSizeAdvanced{ .scalar = ty.castTag(.array_u8).?.data },
3217 .array_u8_sentinel_0 => return AbiSizeAdvanced{ .scalar = ty.castTag(.array_u8_sentinel_0).?.data + 1 },3072 .array_u8_sentinel_0 => return AbiSizeAdvanced{ .scalar = ty.castTag(.array_u8_sentinel_0).?.data + 1 },
3218 .array => {3073 .array => {
...@@ -3293,12 +3148,6 @@ pub const Type = struct {...@@ -3293,12 +3148,6 @@ pub const Type = struct {
3293 .error_set_single,3148 .error_set_single,
3294 => return AbiSizeAdvanced{ .scalar = 2 },3149 => return AbiSizeAdvanced{ .scalar = 2 },
32953150
3296 .i16, .u16 => return AbiSizeAdvanced{ .scalar = intAbiSize(16, target) },
3297 .u29 => return AbiSizeAdvanced{ .scalar = intAbiSize(29, target) },
3298 .i32, .u32 => return AbiSizeAdvanced{ .scalar = intAbiSize(32, target) },
3299 .i64, .u64 => return AbiSizeAdvanced{ .scalar = intAbiSize(64, target) },
3300 .u128, .i128 => return AbiSizeAdvanced{ .scalar = intAbiSize(128, target) },
3301
3302 .optional => {3151 .optional => {
3303 var buf: Payload.ElemType = undefined;3152 var buf: Payload.ElemType = undefined;
3304 const child_type = ty.optionalChild(&buf);3153 const child_type = ty.optionalChild(&buf);
...@@ -3497,14 +3346,6 @@ pub const Type = struct {...@@ -3497,14 +3346,6 @@ pub const Type = struct {
3497 .inferred_alloc_mut => unreachable,3346 .inferred_alloc_mut => unreachable,
3498 .@"opaque" => unreachable,3347 .@"opaque" => unreachable,
34993348
3500 .u1 => return 1,
3501 .u8, .i8 => return 8,
3502 .i16, .u16 => return 16,
3503 .u29 => return 29,
3504 .i32, .u32 => return 32,
3505 .i64, .u64 => return 64,
3506 .u128, .i128 => return 128,
3507
3508 .@"struct" => {3349 .@"struct" => {
3509 const struct_obj = ty.castTag(.@"struct").?.data;3350 const struct_obj = ty.castTag(.@"struct").?.data;
3510 if (struct_obj.layout != .Packed) {3351 if (struct_obj.layout != .Packed) {
...@@ -4398,47 +4239,25 @@ pub const Type = struct {...@@ -4398,47 +4239,25 @@ pub const Type = struct {
43984239
4399 /// Returns true if and only if the type is a fixed-width, signed integer.4240 /// Returns true if and only if the type is a fixed-width, signed integer.
4400 pub fn isSignedInt(ty: Type, mod: *const Module) bool {4241 pub fn isSignedInt(ty: Type, mod: *const Module) bool {
4401 if (ty.ip_index != .none) switch (mod.intern_pool.indexToKey(ty.ip_index)) {4242 return switch (ty.ip_index) {
4402 .int_type => |int_type| return int_type.signedness == .signed,4243 .c_char_type, .isize_type, .c_short_type, .c_int_type, .c_long_type, .c_longlong_type => true,
4403 .simple_type => |s| return switch (s) {4244 .none => false,
4404 .c_char, .isize, .c_short, .c_int, .c_long, .c_longlong => true,4245 else => switch (mod.intern_pool.indexToKey(ty.ip_index)) {
4246 .int_type => |int_type| int_type.signedness == .signed,
4405 else => false,4247 else => false,
4406 },4248 },
4407 else => return false,
4408 };
4409 return switch (ty.tag()) {
4410 .i8,
4411 .i16,
4412 .i32,
4413 .i64,
4414 .i128,
4415 => true,
4416
4417 else => false,
4418 };4249 };
4419 }4250 }
44204251
4421 /// Returns true if and only if the type is a fixed-width, unsigned integer.4252 /// Returns true if and only if the type is a fixed-width, unsigned integer.
4422 pub fn isUnsignedInt(ty: Type, mod: *const Module) bool {4253 pub fn isUnsignedInt(ty: Type, mod: *const Module) bool {
4423 if (ty.ip_index != .none) switch (mod.intern_pool.indexToKey(ty.ip_index)) {4254 return switch (ty.ip_index) {
4424 .int_type => |int_type| return int_type.signedness == .unsigned,4255 .usize_type, .c_ushort_type, .c_uint_type, .c_ulong_type, .c_ulonglong_type => true,
4425 .simple_type => |s| return switch (s) {4256 .none => false,
4426 .usize, .c_ushort, .c_uint, .c_ulong, .c_ulonglong => true,4257 else => switch (mod.intern_pool.indexToKey(ty.ip_index)) {
4258 .int_type => |int_type| int_type.signedness == .unsigned,
4427 else => false,4259 else => false,
4428 },4260 },
4429 else => return false,
4430 };
4431 return switch (ty.tag()) {
4432 .u1,
4433 .u8,
4434 .u16,
4435 .u29,
4436 .u32,
4437 .u64,
4438 .u128,
4439 => true,
4440
4441 else => false,
4442 };4261 };
4443 }4262 }
44444263
...@@ -4459,19 +4278,6 @@ pub const Type = struct {...@@ -4459,19 +4278,6 @@ pub const Type = struct {
44594278
4460 while (true) switch (ty.ip_index) {4279 while (true) switch (ty.ip_index) {
4461 .none => switch (ty.tag()) {4280 .none => switch (ty.tag()) {
4462 .u1 => return .{ .signedness = .unsigned, .bits = 1 },
4463 .u8 => return .{ .signedness = .unsigned, .bits = 8 },
4464 .i8 => return .{ .signedness = .signed, .bits = 8 },
4465 .u16 => return .{ .signedness = .unsigned, .bits = 16 },
4466 .i16 => return .{ .signedness = .signed, .bits = 16 },
4467 .u29 => return .{ .signedness = .unsigned, .bits = 29 },
4468 .u32 => return .{ .signedness = .unsigned, .bits = 32 },
4469 .i32 => return .{ .signedness = .signed, .bits = 32 },
4470 .u64 => return .{ .signedness = .unsigned, .bits = 64 },
4471 .i64 => return .{ .signedness = .signed, .bits = 64 },
4472 .u128 => return .{ .signedness = .unsigned, .bits = 128 },
4473 .i128 => return .{ .signedness = .signed, .bits = 128 },
4474
4475 .enum_full, .enum_nonexhaustive => ty = ty.cast(Payload.EnumFull).?.data.tag_ty,4281 .enum_full, .enum_nonexhaustive => ty = ty.cast(Payload.EnumFull).?.data.tag_ty,
4476 .enum_numbered => ty = ty.castTag(.enum_numbered).?.data.tag_ty,4282 .enum_numbered => ty = ty.castTag(.enum_numbered).?.data.tag_ty,
4477 .enum_simple => {4283 .enum_simple => {
...@@ -4664,50 +4470,34 @@ pub const Type = struct {...@@ -4664,50 +4470,34 @@ pub const Type = struct {
4664 }4470 }
46654471
4666 pub fn isNumeric(ty: Type, mod: *const Module) bool {4472 pub fn isNumeric(ty: Type, mod: *const Module) bool {
4667 if (ty.ip_index != .none) return switch (mod.intern_pool.indexToKey(ty.ip_index)) {4473 return switch (ty.ip_index) {
4668 .int_type => true,4474 .f16_type,
4669 .simple_type => |s| return switch (s) {4475 .f32_type,
4670 .f16,4476 .f64_type,
4671 .f32,4477 .f80_type,
4672 .f64,4478 .f128_type,
4673 .f80,4479 .c_longdouble_type,
4674 .f128,4480 .comptime_int_type,
4675 .c_longdouble,4481 .comptime_float_type,
4676 .comptime_int,4482 .usize_type,
4677 .comptime_float,4483 .isize_type,
4678 .usize,4484 .c_char_type,
4679 .isize,4485 .c_short_type,
4680 .c_char,4486 .c_ushort_type,
4681 .c_short,4487 .c_int_type,
4682 .c_ushort,4488 .c_uint_type,
4683 .c_int,4489 .c_long_type,
4684 .c_uint,4490 .c_ulong_type,
4685 .c_long,4491 .c_longlong_type,
4686 .c_ulong,4492 .c_ulonglong_type,
4687 .c_longlong,4493 => true,
4688 .c_ulonglong,4494
4689 => true,4495 .none => false,
46904496
4497 else => switch (mod.intern_pool.indexToKey(ty.ip_index)) {
4498 .int_type => true,
4691 else => false,4499 else => false,
4692 },4500 },
4693 else => false,
4694 };
4695 return switch (ty.tag()) {
4696 .u1,
4697 .u8,
4698 .i8,
4699 .u16,
4700 .i16,
4701 .u29,
4702 .u32,
4703 .i32,
4704 .u64,
4705 .i64,
4706 .u128,
4707 .i128,
4708 => true,
4709
4710 else => false,
4711 };4501 };
4712 }4502 }
47134503
...@@ -4785,19 +4575,6 @@ pub const Type = struct {...@@ -4785,19 +4575,6 @@ pub const Type = struct {
4785 };4575 };
47864576
4787 while (true) switch (ty.tag()) {4577 while (true) switch (ty.tag()) {
4788 .u1,
4789 .u8,
4790 .i8,
4791 .u16,
4792 .i16,
4793 .u29,
4794 .u32,
4795 .i32,
4796 .u64,
4797 .i64,
4798 .u128,
4799 .i128,
4800
4801 .error_union,4578 .error_union,
4802 .error_set_single,4579 .error_set_single,
4803 .error_set,4580 .error_set,
...@@ -4995,19 +4772,6 @@ pub const Type = struct {...@@ -4995,19 +4772,6 @@ pub const Type = struct {
4995 };4772 };
49964773
4997 return switch (ty.tag()) {4774 return switch (ty.tag()) {
4998 .u1,
4999 .u8,
5000 .i8,
5001 .u16,
5002 .i16,
5003 .u29,
5004 .u32,
5005 .i32,
5006 .u64,
5007 .i64,
5008 .u128,
5009 .i128,
5010
5011 .manyptr_u8,4775 .manyptr_u8,
5012 .manyptr_const_u8,4776 .manyptr_const_u8,
5013 .manyptr_const_u8_sentinel_0,4777 .manyptr_const_u8_sentinel_0,
...@@ -5764,19 +5528,6 @@ pub const Type = struct {...@@ -5764,19 +5528,6 @@ pub const Type = struct {
5764 /// See `zigTypeTag` for the function that corresponds to `std.builtin.TypeId`.5528 /// See `zigTypeTag` for the function that corresponds to `std.builtin.TypeId`.
5765 pub const Tag = enum(usize) {5529 pub const Tag = enum(usize) {
5766 // The first section of this enum are tags that require no payload.5530 // The first section of this enum are tags that require no payload.
5767 u1,
5768 u8,
5769 i8,
5770 u16,
5771 i16,
5772 u29,
5773 u32,
5774 i32,
5775 u64,
5776 i64,
5777 u128,
5778 i128,
5779
5780 manyptr_u8,5531 manyptr_u8,
5781 manyptr_const_u8,5532 manyptr_const_u8,
5782 manyptr_const_u8_sentinel_0,5533 manyptr_const_u8_sentinel_0,
...@@ -5839,19 +5590,6 @@ pub const Type = struct {...@@ -5839,19 +5590,6 @@ pub const Type = struct {
58395590
5840 pub fn Type(comptime t: Tag) type {5591 pub fn Type(comptime t: Tag) type {
5841 return switch (t) {5592 return switch (t) {
5842 .u1,
5843 .u8,
5844 .i8,
5845 .u16,
5846 .i16,
5847 .u29,
5848 .u32,
5849 .i32,
5850 .u64,
5851 .i64,
5852 .u128,
5853 .i128,
5854
5855 .single_const_pointer_to_comptime_int,5593 .single_const_pointer_to_comptime_int,
5856 .anyerror_void_error_union,5594 .anyerror_void_error_union,
5857 .const_slice_u8,5595 .const_slice_u8,
...@@ -6203,19 +5941,19 @@ pub const Type = struct {...@@ -6203,19 +5941,19 @@ pub const Type = struct {
6203 };5941 };
6204 };5942 };
62055943
6206 pub const @"u1" = initTag(.u1);5944 pub const @"u1": Type = .{ .ip_index = .u1_type, .legacy = undefined };
6207 pub const @"u8" = initTag(.u8);5945 pub const @"u8": Type = .{ .ip_index = .u8_type, .legacy = undefined };
6208 pub const @"u16" = initTag(.u16);5946 pub const @"u16": Type = .{ .ip_index = .u16_type, .legacy = undefined };
6209 pub const @"u29" = initTag(.u29);5947 pub const @"u29": Type = .{ .ip_index = .u29_type, .legacy = undefined };
6210 pub const @"u32" = initTag(.u32);5948 pub const @"u32": Type = .{ .ip_index = .u32_type, .legacy = undefined };
6211 pub const @"u64" = initTag(.u64);5949 pub const @"u64": Type = .{ .ip_index = .u64_type, .legacy = undefined };
6212 pub const @"u128" = initTag(.u128);5950 pub const @"u128": Type = .{ .ip_index = .u128_type, .legacy = undefined };
62135951
6214 pub const @"i8" = initTag(.i8);5952 pub const @"i8": Type = .{ .ip_index = .i8_type, .legacy = undefined };
6215 pub const @"i16" = initTag(.i16);5953 pub const @"i16": Type = .{ .ip_index = .i16_type, .legacy = undefined };
6216 pub const @"i32" = initTag(.i32);5954 pub const @"i32": Type = .{ .ip_index = .i32_type, .legacy = undefined };
6217 pub const @"i64" = initTag(.i64);5955 pub const @"i64": Type = .{ .ip_index = .i64_type, .legacy = undefined };
6218 pub const @"i128" = initTag(.i128);5956 pub const @"i128": Type = .{ .ip_index = .i128_type, .legacy = undefined };
62195957
6220 pub const @"f16": Type = .{ .ip_index = .f16_type, .legacy = undefined };5958 pub const @"f16": Type = .{ .ip_index = .f16_type, .legacy = undefined };
6221 pub const @"f32": Type = .{ .ip_index = .f32_type, .legacy = undefined };5959 pub const @"f32": Type = .{ .ip_index = .f32_type, .legacy = undefined };