authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-04-28 21:40:51-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-01 06:47:20-04:00
log28729efe2998579fc36a35e5bdab12727ece1e7a
tree56339a095da516a56b72749d3272fadbeb5163eb
parent6b0f7de247f3c12281f47f38738e93651d6bf51b

ZIR: implement return instruction


5 files changed, 78 insertions(+), 5 deletions(-)

lib/std/math/big/int.zig+2-2
...@@ -62,6 +62,7 @@ pub const Int = struct {...@@ -62,6 +62,7 @@ pub const Int = struct {
6262
63 /// Hint: use `calcLimbLen` to figure out how big an array to allocate for `limbs`.63 /// Hint: use `calcLimbLen` to figure out how big an array to allocate for `limbs`.
64 pub fn initSetFixed(limbs: []Limb, value: var) Int {64 pub fn initSetFixed(limbs: []Limb, value: var) Int {
65 mem.set(Limb, limbs, 0);
65 var s = Int.initFixed(limbs);66 var s = Int.initFixed(limbs);
66 s.set(value) catch unreachable;67 s.set(value) catch unreachable;
67 return s;68 return s;
...@@ -126,11 +127,10 @@ pub const Int = struct {...@@ -126,11 +127,10 @@ pub const Int = struct {
126 /// sufficient capacity, the exact amount will be allocated. This occurs even if the requested127 /// sufficient capacity, the exact amount will be allocated. This occurs even if the requested
127 /// capacity is only greater than the current capacity by one limb.128 /// capacity is only greater than the current capacity by one limb.
128 pub fn ensureCapacity(self: *Int, capacity: usize) !void {129 pub fn ensureCapacity(self: *Int, capacity: usize) !void {
129 self.assertWritable();
130 if (capacity <= self.limbs.len) {130 if (capacity <= self.limbs.len) {
131 return;131 return;
132 }132 }
133133 self.assertWritable();
134 self.limbs = try self.allocator.?.realloc(self.limbs, capacity);134 self.limbs = try self.allocator.?.realloc(self.limbs, capacity);
135 }135 }
136136
src-self-hosted/ir.zig+22
...@@ -22,6 +22,7 @@ pub const Inst = struct {...@@ -22,6 +22,7 @@ pub const Inst = struct {
2222
23 pub const Tag = enum {23 pub const Tag = enum {
24 unreach,24 unreach,
25 ret,
25 constant,26 constant,
26 assembly,27 assembly,
27 ptrtoint,28 ptrtoint,
...@@ -58,6 +59,12 @@ pub const Inst = struct {...@@ -58,6 +59,12 @@ pub const Inst = struct {
58 args: void,59 args: void,
59 };60 };
6061
62 pub const Ret = struct {
63 pub const base_tag = Tag.ret;
64 base: Inst,
65 args: void,
66 };
67
61 pub const Constant = struct {68 pub const Constant = struct {
62 pub const base_tag = Tag.constant;69 pub const base_tag = Tag.constant;
63 base: Inst,70 base: Inst,
...@@ -491,6 +498,7 @@ const Analyze = struct {...@@ -491,6 +498,7 @@ const Analyze = struct {
491 .as => return self.analyzeInstAs(block, old_inst.cast(text.Inst.As).?),498 .as => return self.analyzeInstAs(block, old_inst.cast(text.Inst.As).?),
492 .@"asm" => return self.analyzeInstAsm(block, old_inst.cast(text.Inst.Asm).?),499 .@"asm" => return self.analyzeInstAsm(block, old_inst.cast(text.Inst.Asm).?),
493 .@"unreachable" => return self.analyzeInstUnreachable(block, old_inst.cast(text.Inst.Unreachable).?),500 .@"unreachable" => return self.analyzeInstUnreachable(block, old_inst.cast(text.Inst.Unreachable).?),
501 .@"return" => return self.analyzeInstRet(block, old_inst.cast(text.Inst.Return).?),
494 .@"fn" => return self.analyzeInstFn(block, old_inst.cast(text.Inst.Fn).?),502 .@"fn" => return self.analyzeInstFn(block, old_inst.cast(text.Inst.Fn).?),
495 .@"export" => {503 .@"export" => {
496 try self.analyzeExport(block, old_inst.cast(text.Inst.Export).?);504 try self.analyzeExport(block, old_inst.cast(text.Inst.Export).?);
...@@ -556,6 +564,13 @@ const Analyze = struct {...@@ -556,6 +564,13 @@ const Analyze = struct {
556 return self.constType(fntype.base.src, Type.initTag(.fn_naked_noreturn_no_args));564 return self.constType(fntype.base.src, Type.initTag(.fn_naked_noreturn_no_args));
557 }565 }
558566
567 if (return_type.zigTypeTag() == .Void and
568 fntype.positionals.param_types.len == 0 and
569 fntype.kw_args.cc == .C)
570 {
571 return self.constType(fntype.base.src, Type.initTag(.fn_ccc_void_no_args));
572 }
573
559 return self.fail(fntype.base.src, "TODO implement fntype instruction more", .{});574 return self.fail(fntype.base.src, "TODO implement fntype instruction more", .{});
560 }575 }
561576
...@@ -886,6 +901,11 @@ const Analyze = struct {...@@ -886,6 +901,11 @@ const Analyze = struct {
886 return self.addNewInstArgs(b, unreach.base.src, Type.initTag(.noreturn), Inst.Unreach, {});901 return self.addNewInstArgs(b, unreach.base.src, Type.initTag(.noreturn), Inst.Unreach, {});
887 }902 }
888903
904 fn analyzeInstRet(self: *Analyze, block: ?*Block, inst: *text.Inst.Return) InnerError!*Inst {
905 const b = try self.requireRuntimeBlock(block, inst.base.src);
906 return self.addNewInstArgs(b, inst.base.src, Type.initTag(.noreturn), Inst.Ret, {});
907 }
908
889 fn analyzeBody(self: *Analyze, block: ?*Block, body: text.Module.Body) !void {909 fn analyzeBody(self: *Analyze, block: ?*Block, body: text.Module.Body) !void {
890 for (body.instructions) |src_inst| {910 for (body.instructions) |src_inst| {
891 const new_inst = self.analyzeInst(block, src_inst) catch |err| {911 const new_inst = self.analyzeInst(block, src_inst) catch |err| {
...@@ -1199,11 +1219,13 @@ pub fn main() anyerror!void {...@@ -1199,11 +1219,13 @@ pub fn main() anyerror!void {
1199 const allocator = if (std.builtin.link_libc) std.heap.c_allocator else &arena.allocator;1219 const allocator = if (std.builtin.link_libc) std.heap.c_allocator else &arena.allocator;
12001220
1201 const args = try std.process.argsAlloc(allocator);1221 const args = try std.process.argsAlloc(allocator);
1222 defer std.process.argsFree(allocator, args);
12021223
1203 const src_path = args[1];1224 const src_path = args[1];
1204 const debug_error_trace = true;1225 const debug_error_trace = true;
12051226
1206 const source = try std.fs.cwd().readFileAllocOptions(allocator, src_path, std.math.maxInt(u32), 1, 0);1227 const source = try std.fs.cwd().readFileAllocOptions(allocator, src_path, std.math.maxInt(u32), 1, 0);
1228 defer allocator.free(source);
12071229
1208 var zir_module = try text.parse(allocator, source);1230 var zir_module = try text.parse(allocator, source);
1209 defer zir_module.deinit(allocator);1231 defer zir_module.deinit(allocator);
src-self-hosted/ir/text.zig+24-3
...@@ -26,6 +26,7 @@ pub const Inst = struct {...@@ -26,6 +26,7 @@ pub const Inst = struct {
26 as,26 as,
27 @"asm",27 @"asm",
28 @"unreachable",28 @"unreachable",
29 @"return",
29 @"fn",30 @"fn",
30 @"export",31 @"export",
31 primitive,32 primitive,
...@@ -50,6 +51,7 @@ pub const Inst = struct {...@@ -50,6 +51,7 @@ pub const Inst = struct {
50 .as => As,51 .as => As,
51 .@"asm" => Asm,52 .@"asm" => Asm,
52 .@"unreachable" => Unreachable,53 .@"unreachable" => Unreachable,
54 .@"return" => Return,
53 .@"fn" => Fn,55 .@"fn" => Fn,
54 .@"export" => Export,56 .@"export" => Export,
55 .primitive => Primitive,57 .primitive => Primitive,
...@@ -159,6 +161,14 @@ pub const Inst = struct {...@@ -159,6 +161,14 @@ pub const Inst = struct {
159 kw_args: struct {},161 kw_args: struct {},
160 };162 };
161163
164 pub const Return = struct {
165 pub const base_tag = Tag.@"return";
166 base: Inst,
167
168 positionals: struct {},
169 kw_args: struct {},
170 };
171
162 pub const Fn = struct {172 pub const Fn = struct {
163 pub const base_tag = Tag.@"fn";173 pub const base_tag = Tag.@"fn";
164 base: Inst,174 base: Inst,
...@@ -417,6 +427,7 @@ pub const Module = struct {...@@ -417,6 +427,7 @@ pub const Module = struct {
417 .as => return self.writeInstToStreamGeneric(stream, .as, decl, inst_table),427 .as => return self.writeInstToStreamGeneric(stream, .as, decl, inst_table),
418 .@"asm" => return self.writeInstToStreamGeneric(stream, .@"asm", decl, inst_table),428 .@"asm" => return self.writeInstToStreamGeneric(stream, .@"asm", decl, inst_table),
419 .@"unreachable" => return self.writeInstToStreamGeneric(stream, .@"unreachable", decl, inst_table),429 .@"unreachable" => return self.writeInstToStreamGeneric(stream, .@"unreachable", decl, inst_table),
430 .@"return" => return self.writeInstToStreamGeneric(stream, .@"return", decl, inst_table),
420 .@"fn" => return self.writeInstToStreamGeneric(stream, .@"fn", decl, inst_table),431 .@"fn" => return self.writeInstToStreamGeneric(stream, .@"fn", decl, inst_table),
421 .@"export" => return self.writeInstToStreamGeneric(stream, .@"export", decl, inst_table),432 .@"export" => return self.writeInstToStreamGeneric(stream, .@"export", decl, inst_table),
422 .primitive => return self.writeInstToStreamGeneric(stream, .primitive, decl, inst_table),433 .primitive => return self.writeInstToStreamGeneric(stream, .primitive, decl, inst_table),
...@@ -1000,14 +1011,15 @@ const EmitZIR = struct {...@@ -1000,14 +1011,15 @@ const EmitZIR = struct {
10001011
1001 const fn_type = try self.emitType(src, module_fn.fn_type);1012 const fn_type = try self.emitType(src, module_fn.fn_type);
10021013
1014 const arena_instrs = try self.arena.allocator.alloc(*Inst, instructions.items.len);
1015 mem.copy(*Inst, arena_instrs, instructions.items);
1016
1003 const fn_inst = try self.arena.allocator.create(Inst.Fn);1017 const fn_inst = try self.arena.allocator.create(Inst.Fn);
1004 fn_inst.* = .{1018 fn_inst.* = .{
1005 .base = .{ .src = src, .tag = Inst.Fn.base_tag },1019 .base = .{ .src = src, .tag = Inst.Fn.base_tag },
1006 .positionals = .{1020 .positionals = .{
1007 .fn_type = fn_type,1021 .fn_type = fn_type,
1008 .body = .{1022 .body = .{ .instructions = arena_instrs },
1009 .instructions = instructions.toOwnedSlice(),
1010 },
1011 },1023 },
1012 .kw_args = .{},1024 .kw_args = .{},
1013 };1025 };
...@@ -1035,6 +1047,15 @@ const EmitZIR = struct {...@@ -1035,6 +1047,15 @@ const EmitZIR = struct {
1035 };1047 };
1036 break :blk &unreach_inst.base;1048 break :blk &unreach_inst.base;
1037 },1049 },
1050 .ret => blk: {
1051 const ret_inst = try self.arena.allocator.create(Inst.Return);
1052 ret_inst.* = .{
1053 .base = .{ .src = inst.src, .tag = Inst.Return.base_tag },
1054 .positionals = .{},
1055 .kw_args = .{},
1056 };
1057 break :blk &ret_inst.base;
1058 },
1038 .constant => unreachable, // excluded from function bodies1059 .constant => unreachable, // excluded from function bodies
1039 .assembly => blk: {1060 .assembly => blk: {
1040 const old_inst = inst.cast(ir.Inst.Assembly).?;1061 const old_inst = inst.cast(ir.Inst.Assembly).?;
src-self-hosted/type.zig+18
...@@ -53,6 +53,7 @@ pub const Type = extern union {...@@ -53,6 +53,7 @@ pub const Type = extern union {
53 .noreturn => return .NoReturn,53 .noreturn => return .NoReturn,
5454
55 .fn_naked_noreturn_no_args => return .Fn,55 .fn_naked_noreturn_no_args => return .Fn,
56 .fn_ccc_void_no_args => return .Fn,
5657
57 .array, .array_u8_sentinel_0 => return .Array,58 .array, .array_u8_sentinel_0 => return .Array,
58 .single_const_pointer => return .Pointer,59 .single_const_pointer => return .Pointer,
...@@ -184,6 +185,7 @@ pub const Type = extern union {...@@ -184,6 +185,7 @@ pub const Type = extern union {
184185
185 .const_slice_u8 => return out_stream.writeAll("[]const u8"),186 .const_slice_u8 => return out_stream.writeAll("[]const u8"),
186 .fn_naked_noreturn_no_args => return out_stream.writeAll("fn() callconv(.Naked) noreturn"),187 .fn_naked_noreturn_no_args => return out_stream.writeAll("fn() callconv(.Naked) noreturn"),
188 .fn_ccc_void_no_args => return out_stream.writeAll("fn() callconv(.C) void"),
187 .single_const_pointer_to_comptime_int => return out_stream.writeAll("*const comptime_int"),189 .single_const_pointer_to_comptime_int => return out_stream.writeAll("*const comptime_int"),
188190
189 .array_u8_sentinel_0 => {191 .array_u8_sentinel_0 => {
...@@ -243,6 +245,7 @@ pub const Type = extern union {...@@ -243,6 +245,7 @@ pub const Type = extern union {
243 .comptime_float => return Value.initTag(.comptime_float_type),245 .comptime_float => return Value.initTag(.comptime_float_type),
244 .noreturn => return Value.initTag(.noreturn_type),246 .noreturn => return Value.initTag(.noreturn_type),
245 .fn_naked_noreturn_no_args => return Value.initTag(.fn_naked_noreturn_no_args_type),247 .fn_naked_noreturn_no_args => return Value.initTag(.fn_naked_noreturn_no_args_type),
248 .fn_ccc_void_no_args => return Value.initTag(.fn_ccc_void_no_args_type),
246 .single_const_pointer_to_comptime_int => return Value.initTag(.single_const_pointer_to_comptime_int_type),249 .single_const_pointer_to_comptime_int => return Value.initTag(.single_const_pointer_to_comptime_int_type),
247 .const_slice_u8 => return Value.initTag(.const_slice_u8_type),250 .const_slice_u8 => return Value.initTag(.const_slice_u8_type),
248 else => {251 else => {
...@@ -284,6 +287,7 @@ pub const Type = extern union {...@@ -284,6 +287,7 @@ pub const Type = extern union {
284 .array_u8_sentinel_0,287 .array_u8_sentinel_0,
285 .const_slice_u8,288 .const_slice_u8,
286 .fn_naked_noreturn_no_args,289 .fn_naked_noreturn_no_args,
290 .fn_ccc_void_no_args,
287 .int_unsigned,291 .int_unsigned,
288 .int_signed,292 .int_signed,
289 => false,293 => false,
...@@ -326,6 +330,7 @@ pub const Type = extern union {...@@ -326,6 +330,7 @@ pub const Type = extern union {
326 .single_const_pointer,330 .single_const_pointer,
327 .single_const_pointer_to_comptime_int,331 .single_const_pointer_to_comptime_int,
328 .fn_naked_noreturn_no_args,332 .fn_naked_noreturn_no_args,
333 .fn_ccc_void_no_args,
329 .int_unsigned,334 .int_unsigned,
330 .int_signed,335 .int_signed,
331 => false,336 => false,
...@@ -365,6 +370,7 @@ pub const Type = extern union {...@@ -365,6 +370,7 @@ pub const Type = extern union {
365 .array,370 .array,
366 .array_u8_sentinel_0,371 .array_u8_sentinel_0,
367 .fn_naked_noreturn_no_args,372 .fn_naked_noreturn_no_args,
373 .fn_ccc_void_no_args,
368 .int_unsigned,374 .int_unsigned,
369 .int_signed,375 .int_signed,
370 => unreachable,376 => unreachable,
...@@ -405,6 +411,7 @@ pub const Type = extern union {...@@ -405,6 +411,7 @@ pub const Type = extern union {
405 .comptime_float,411 .comptime_float,
406 .noreturn,412 .noreturn,
407 .fn_naked_noreturn_no_args,413 .fn_naked_noreturn_no_args,
414 .fn_ccc_void_no_args,
408 .int_unsigned,415 .int_unsigned,
409 .int_signed,416 .int_signed,
410 => unreachable,417 => unreachable,
...@@ -445,6 +452,7 @@ pub const Type = extern union {...@@ -445,6 +452,7 @@ pub const Type = extern union {
445 .comptime_float,452 .comptime_float,
446 .noreturn,453 .noreturn,
447 .fn_naked_noreturn_no_args,454 .fn_naked_noreturn_no_args,
455 .fn_ccc_void_no_args,
448 .single_const_pointer,456 .single_const_pointer,
449 .single_const_pointer_to_comptime_int,457 .single_const_pointer_to_comptime_int,
450 .const_slice_u8,458 .const_slice_u8,
...@@ -474,6 +482,7 @@ pub const Type = extern union {...@@ -474,6 +482,7 @@ pub const Type = extern union {
474 .comptime_float,482 .comptime_float,
475 .noreturn,483 .noreturn,
476 .fn_naked_noreturn_no_args,484 .fn_naked_noreturn_no_args,
485 .fn_ccc_void_no_args,
477 .array,486 .array,
478 .single_const_pointer,487 .single_const_pointer,
479 .single_const_pointer_to_comptime_int,488 .single_const_pointer_to_comptime_int,
...@@ -516,6 +525,7 @@ pub const Type = extern union {...@@ -516,6 +525,7 @@ pub const Type = extern union {
516 .comptime_float,525 .comptime_float,
517 .noreturn,526 .noreturn,
518 .fn_naked_noreturn_no_args,527 .fn_naked_noreturn_no_args,
528 .fn_ccc_void_no_args,
519 .array,529 .array,
520 .single_const_pointer,530 .single_const_pointer,
521 .single_const_pointer_to_comptime_int,531 .single_const_pointer_to_comptime_int,
...@@ -570,6 +580,7 @@ pub const Type = extern union {...@@ -570,6 +580,7 @@ pub const Type = extern union {
570 pub fn fnParamLen(self: Type) usize {580 pub fn fnParamLen(self: Type) usize {
571 return switch (self.tag()) {581 return switch (self.tag()) {
572 .fn_naked_noreturn_no_args => 0,582 .fn_naked_noreturn_no_args => 0,
583 .fn_ccc_void_no_args => 0,
573584
574 .f16,585 .f16,
575 .f32,586 .f32,
...@@ -612,6 +623,7 @@ pub const Type = extern union {...@@ -612,6 +623,7 @@ pub const Type = extern union {
612 pub fn fnParamTypes(self: Type, types: []Type) void {623 pub fn fnParamTypes(self: Type, types: []Type) void {
613 switch (self.tag()) {624 switch (self.tag()) {
614 .fn_naked_noreturn_no_args => return,625 .fn_naked_noreturn_no_args => return,
626 .fn_ccc_void_no_args => return,
615627
616 .f16,628 .f16,
617 .f32,629 .f32,
...@@ -653,6 +665,7 @@ pub const Type = extern union {...@@ -653,6 +665,7 @@ pub const Type = extern union {
653 pub fn fnReturnType(self: Type) Type {665 pub fn fnReturnType(self: Type) Type {
654 return switch (self.tag()) {666 return switch (self.tag()) {
655 .fn_naked_noreturn_no_args => Type.initTag(.noreturn),667 .fn_naked_noreturn_no_args => Type.initTag(.noreturn),
668 .fn_ccc_void_no_args => Type.initTag(.void),
656669
657 .f16,670 .f16,
658 .f32,671 .f32,
...@@ -694,6 +707,7 @@ pub const Type = extern union {...@@ -694,6 +707,7 @@ pub const Type = extern union {
694 pub fn fnCallingConvention(self: Type) std.builtin.CallingConvention {707 pub fn fnCallingConvention(self: Type) std.builtin.CallingConvention {
695 return switch (self.tag()) {708 return switch (self.tag()) {
696 .fn_naked_noreturn_no_args => .Naked,709 .fn_naked_noreturn_no_args => .Naked,
710 .fn_ccc_void_no_args => .C,
697711
698 .f16,712 .f16,
699 .f32,713 .f32,
...@@ -763,6 +777,7 @@ pub const Type = extern union {...@@ -763,6 +777,7 @@ pub const Type = extern union {
763 .anyerror,777 .anyerror,
764 .noreturn,778 .noreturn,
765 .fn_naked_noreturn_no_args,779 .fn_naked_noreturn_no_args,
780 .fn_ccc_void_no_args,
766 .array,781 .array,
767 .single_const_pointer,782 .single_const_pointer,
768 .single_const_pointer_to_comptime_int,783 .single_const_pointer_to_comptime_int,
...@@ -798,6 +813,7 @@ pub const Type = extern union {...@@ -798,6 +813,7 @@ pub const Type = extern union {
798 .type,813 .type,
799 .anyerror,814 .anyerror,
800 .fn_naked_noreturn_no_args,815 .fn_naked_noreturn_no_args,
816 .fn_ccc_void_no_args,
801 .single_const_pointer_to_comptime_int,817 .single_const_pointer_to_comptime_int,
802 .array_u8_sentinel_0,818 .array_u8_sentinel_0,
803 .const_slice_u8,819 .const_slice_u8,
...@@ -850,6 +866,7 @@ pub const Type = extern union {...@@ -850,6 +866,7 @@ pub const Type = extern union {
850 .type,866 .type,
851 .anyerror,867 .anyerror,
852 .fn_naked_noreturn_no_args,868 .fn_naked_noreturn_no_args,
869 .fn_ccc_void_no_args,
853 .single_const_pointer_to_comptime_int,870 .single_const_pointer_to_comptime_int,
854 .array_u8_sentinel_0,871 .array_u8_sentinel_0,
855 .const_slice_u8,872 .const_slice_u8,
...@@ -898,6 +915,7 @@ pub const Type = extern union {...@@ -898,6 +915,7 @@ pub const Type = extern union {
898 comptime_float,915 comptime_float,
899 noreturn,916 noreturn,
900 fn_naked_noreturn_no_args,917 fn_naked_noreturn_no_args,
918 fn_ccc_void_no_args,
901 single_const_pointer_to_comptime_int,919 single_const_pointer_to_comptime_int,
902 const_slice_u8, // See last_no_payload_tag below.920 const_slice_u8, // See last_no_payload_tag below.
903 // After this, the tag requires a payload.921 // After this, the tag requires a payload.
src-self-hosted/value.zig+12
...@@ -45,6 +45,7 @@ pub const Value = extern union {...@@ -45,6 +45,7 @@ pub const Value = extern union {
45 comptime_float_type,45 comptime_float_type,
46 noreturn_type,46 noreturn_type,
47 fn_naked_noreturn_no_args_type,47 fn_naked_noreturn_no_args_type,
48 fn_ccc_void_no_args_type,
48 single_const_pointer_to_comptime_int_type,49 single_const_pointer_to_comptime_int_type,
49 const_slice_u8_type,50 const_slice_u8_type,
5051
...@@ -134,6 +135,7 @@ pub const Value = extern union {...@@ -134,6 +135,7 @@ pub const Value = extern union {
134 .comptime_float_type => return out_stream.writeAll("comptime_float"),135 .comptime_float_type => return out_stream.writeAll("comptime_float"),
135 .noreturn_type => return out_stream.writeAll("noreturn"),136 .noreturn_type => return out_stream.writeAll("noreturn"),
136 .fn_naked_noreturn_no_args_type => return out_stream.writeAll("fn() callconv(.Naked) noreturn"),137 .fn_naked_noreturn_no_args_type => return out_stream.writeAll("fn() callconv(.Naked) noreturn"),
138 .fn_ccc_void_no_args_type => return out_stream.writeAll("fn() callconv(.C) void"),
137 .single_const_pointer_to_comptime_int_type => return out_stream.writeAll("*const comptime_int"),139 .single_const_pointer_to_comptime_int_type => return out_stream.writeAll("*const comptime_int"),
138 .const_slice_u8_type => return out_stream.writeAll("[]const u8"),140 .const_slice_u8_type => return out_stream.writeAll("[]const u8"),
139141
...@@ -202,6 +204,7 @@ pub const Value = extern union {...@@ -202,6 +204,7 @@ pub const Value = extern union {
202 .comptime_float_type => Type.initTag(.@"comptime_float"),204 .comptime_float_type => Type.initTag(.@"comptime_float"),
203 .noreturn_type => Type.initTag(.@"noreturn"),205 .noreturn_type => Type.initTag(.@"noreturn"),
204 .fn_naked_noreturn_no_args_type => Type.initTag(.fn_naked_noreturn_no_args),206 .fn_naked_noreturn_no_args_type => Type.initTag(.fn_naked_noreturn_no_args),
207 .fn_ccc_void_no_args_type => Type.initTag(.fn_ccc_void_no_args),
205 .single_const_pointer_to_comptime_int_type => Type.initTag(.single_const_pointer_to_comptime_int),208 .single_const_pointer_to_comptime_int_type => Type.initTag(.single_const_pointer_to_comptime_int),
206 .const_slice_u8_type => Type.initTag(.const_slice_u8),209 .const_slice_u8_type => Type.initTag(.const_slice_u8),
207210
...@@ -253,6 +256,7 @@ pub const Value = extern union {...@@ -253,6 +256,7 @@ pub const Value = extern union {
253 .comptime_float_type,256 .comptime_float_type,
254 .noreturn_type,257 .noreturn_type,
255 .fn_naked_noreturn_no_args_type,258 .fn_naked_noreturn_no_args_type,
259 .fn_ccc_void_no_args_type,
256 .single_const_pointer_to_comptime_int_type,260 .single_const_pointer_to_comptime_int_type,
257 .const_slice_u8_type,261 .const_slice_u8_type,
258 .bool_true,262 .bool_true,
...@@ -306,6 +310,7 @@ pub const Value = extern union {...@@ -306,6 +310,7 @@ pub const Value = extern union {
306 .comptime_float_type,310 .comptime_float_type,
307 .noreturn_type,311 .noreturn_type,
308 .fn_naked_noreturn_no_args_type,312 .fn_naked_noreturn_no_args_type,
313 .fn_ccc_void_no_args_type,
309 .single_const_pointer_to_comptime_int_type,314 .single_const_pointer_to_comptime_int_type,
310 .const_slice_u8_type,315 .const_slice_u8_type,
311 .bool_true,316 .bool_true,
...@@ -360,6 +365,7 @@ pub const Value = extern union {...@@ -360,6 +365,7 @@ pub const Value = extern union {
360 .comptime_float_type,365 .comptime_float_type,
361 .noreturn_type,366 .noreturn_type,
362 .fn_naked_noreturn_no_args_type,367 .fn_naked_noreturn_no_args_type,
368 .fn_ccc_void_no_args_type,
363 .single_const_pointer_to_comptime_int_type,369 .single_const_pointer_to_comptime_int_type,
364 .const_slice_u8_type,370 .const_slice_u8_type,
365 .bool_true,371 .bool_true,
...@@ -419,6 +425,7 @@ pub const Value = extern union {...@@ -419,6 +425,7 @@ pub const Value = extern union {
419 .comptime_float_type,425 .comptime_float_type,
420 .noreturn_type,426 .noreturn_type,
421 .fn_naked_noreturn_no_args_type,427 .fn_naked_noreturn_no_args_type,
428 .fn_ccc_void_no_args_type,
422 .single_const_pointer_to_comptime_int_type,429 .single_const_pointer_to_comptime_int_type,
423 .const_slice_u8_type,430 .const_slice_u8_type,
424 .bool_true,431 .bool_true,
...@@ -500,6 +507,7 @@ pub const Value = extern union {...@@ -500,6 +507,7 @@ pub const Value = extern union {
500 .comptime_float_type,507 .comptime_float_type,
501 .noreturn_type,508 .noreturn_type,
502 .fn_naked_noreturn_no_args_type,509 .fn_naked_noreturn_no_args_type,
510 .fn_ccc_void_no_args_type,
503 .single_const_pointer_to_comptime_int_type,511 .single_const_pointer_to_comptime_int_type,
504 .const_slice_u8_type,512 .const_slice_u8_type,
505 .bool_true,513 .bool_true,
...@@ -550,6 +558,7 @@ pub const Value = extern union {...@@ -550,6 +558,7 @@ pub const Value = extern union {
550 .comptime_float_type,558 .comptime_float_type,
551 .noreturn_type,559 .noreturn_type,
552 .fn_naked_noreturn_no_args_type,560 .fn_naked_noreturn_no_args_type,
561 .fn_ccc_void_no_args_type,
553 .single_const_pointer_to_comptime_int_type,562 .single_const_pointer_to_comptime_int_type,
554 .const_slice_u8_type,563 .const_slice_u8_type,
555 .bool_true,564 .bool_true,
...@@ -639,6 +648,7 @@ pub const Value = extern union {...@@ -639,6 +648,7 @@ pub const Value = extern union {
639 .comptime_float_type,648 .comptime_float_type,
640 .noreturn_type,649 .noreturn_type,
641 .fn_naked_noreturn_no_args_type,650 .fn_naked_noreturn_no_args_type,
651 .fn_ccc_void_no_args_type,
642 .single_const_pointer_to_comptime_int_type,652 .single_const_pointer_to_comptime_int_type,
643 .const_slice_u8_type,653 .const_slice_u8_type,
644 .zero,654 .zero,
...@@ -691,6 +701,7 @@ pub const Value = extern union {...@@ -691,6 +701,7 @@ pub const Value = extern union {
691 .comptime_float_type,701 .comptime_float_type,
692 .noreturn_type,702 .noreturn_type,
693 .fn_naked_noreturn_no_args_type,703 .fn_naked_noreturn_no_args_type,
704 .fn_ccc_void_no_args_type,
694 .single_const_pointer_to_comptime_int_type,705 .single_const_pointer_to_comptime_int_type,
695 .const_slice_u8_type,706 .const_slice_u8_type,
696 .zero,707 .zero,
...@@ -754,6 +765,7 @@ pub const Value = extern union {...@@ -754,6 +765,7 @@ pub const Value = extern union {
754 .comptime_float_type,765 .comptime_float_type,
755 .noreturn_type,766 .noreturn_type,
756 .fn_naked_noreturn_no_args_type,767 .fn_naked_noreturn_no_args_type,
768 .fn_ccc_void_no_args_type,
757 .single_const_pointer_to_comptime_int_type,769 .single_const_pointer_to_comptime_int_type,
758 .const_slice_u8_type,770 .const_slice_u8_type,
759 .zero,771 .zero,