| ... | @@ -145,18 +145,6 @@ pub const Inst = struct { | ... | @@ -145,18 +145,6 @@ pub const Inst = struct { |
| 145 | /// Twos complement wrapping integer addition. | 145 | /// Twos complement wrapping integer addition. |
| 146 | /// Uses the `pl_node` union field. Payload is `Bin`. | 146 | /// Uses the `pl_node` union field. Payload is `Bin`. |
| 147 | addwrap, | 147 | addwrap, |
| 148 | /// Allocates stack local memory. | | |
| 149 | /// Uses the `un_node` union field. The operand is the type of the allocated object. | | |
| 150 | /// The node source location points to a var decl node. | | |
| 151 | /// Indicates the beginning of a new statement in debug info. | | |
| 152 | alloc, | | |
| 153 | /// Same as `alloc` except mutable. | | |
| 154 | alloc_mut, | | |
| 155 | /// Same as `alloc` except the type is inferred. | | |
| 156 | /// Uses the `node` union field. | | |
| 157 | alloc_inferred, | | |
| 158 | /// Same as `alloc_inferred` except mutable. | | |
| 159 | alloc_inferred_mut, | | |
| 160 | /// Array concatenation. `a ++ b` | 148 | /// Array concatenation. `a ++ b` |
| 161 | /// Uses the `pl_node` union field. Payload is `Bin`. | 149 | /// Uses the `pl_node` union field. Payload is `Bin`. |
| 162 | array_cat, | 150 | array_cat, |
| ... | @@ -483,12 +471,6 @@ pub const Inst = struct { | ... | @@ -483,12 +471,6 @@ pub const Inst = struct { |
| 483 | /// Create a pointer type which can have a sentinel, alignment, and/or bit range. | 471 | /// Create a pointer type which can have a sentinel, alignment, and/or bit range. |
| 484 | /// Uses the `ptr_type` union field. | 472 | /// Uses the `ptr_type` union field. |
| 485 | ptr_type, | 473 | ptr_type, |
| 486 | /// Each `store_to_inferred_ptr` puts the type of the stored value into a set, | | |
| 487 | /// and then `resolve_inferred_alloc` triggers peer type resolution on the set. | | |
| 488 | /// The operand is a `alloc_inferred` or `alloc_inferred_mut` instruction, which | | |
| 489 | /// is the allocation that needs to have its type inferred. | | |
| 490 | /// Uses the `un_node` field. The AST node is the var decl. | | |
| 491 | resolve_inferred_alloc, | | |
| 492 | /// Slice operation `lhs[rhs..]`. No sentinel and no end offset. | 474 | /// Slice operation `lhs[rhs..]`. No sentinel and no end offset. |
| 493 | /// Uses the `pl_node` field. AST node is the slice syntax. Payload is `SliceStart`. | 475 | /// Uses the `pl_node` field. AST node is the slice syntax. Payload is `SliceStart`. |
| 494 | slice_start, | 476 | slice_start, |
| ... | @@ -613,37 +595,40 @@ pub const Inst = struct { | ... | @@ -613,37 +595,40 @@ pub const Inst = struct { |
| 613 | ensure_err_payload_void, | 595 | ensure_err_payload_void, |
| 614 | /// An enum literal. Uses the `str_tok` union field. | 596 | /// An enum literal. Uses the `str_tok` union field. |
| 615 | enum_literal, | 597 | enum_literal, |
| 616 | /// An enum literal 8 or fewer bytes. No source location. | | |
| 617 | /// Uses the `small_str` field. | | |
| 618 | enum_literal_small, | | |
| 619 | /// A switch expression. Uses the `pl_node` union field. | 598 | /// A switch expression. Uses the `pl_node` union field. |
| 620 | /// AST node is the switch, payload is `SwitchBlock`. | 599 | /// AST node is the switch, payload is `SwitchBlock`. |
| 621 | /// All prongs of target handled. | 600 | /// All prongs of target handled. |
| 622 | switch_block, | 601 | switch_block, |
| 623 | /// Same as switch_block, except one or more prongs have multiple items. | 602 | /// Same as switch_block, except one or more prongs have multiple items. |
| | 603 | /// Payload is `SwitchBlockMulti` |
| 624 | switch_block_multi, | 604 | switch_block_multi, |
| 625 | /// Same as switch_block, except has an else prong. | 605 | /// Same as switch_block, except has an else prong. |
| 626 | switch_block_else, | 606 | switch_block_else, |
| 627 | /// Same as switch_block_else, except one or more prongs have multiple items. | 607 | /// Same as switch_block_else, except one or more prongs have multiple items. |
| | 608 | /// Payload is `SwitchBlockMulti` |
| 628 | switch_block_else_multi, | 609 | switch_block_else_multi, |
| 629 | /// Same as switch_block, except has an underscore prong. | 610 | /// Same as switch_block, except has an underscore prong. |
| 630 | switch_block_under, | 611 | switch_block_under, |
| 631 | /// Same as switch_block, except one or more prongs have multiple items. | 612 | /// Same as switch_block, except one or more prongs have multiple items. |
| | 613 | /// Payload is `SwitchBlockMulti` |
| 632 | switch_block_under_multi, | 614 | switch_block_under_multi, |
| 633 | /// Same as `switch_block` but the target is a pointer to the value being switched on. | 615 | /// Same as `switch_block` but the target is a pointer to the value being switched on. |
| 634 | switch_block_ref, | 616 | switch_block_ref, |
| 635 | /// Same as `switch_block_multi` but the target is a pointer to the value being switched on. | 617 | /// Same as `switch_block_multi` but the target is a pointer to the value being switched on. |
| | 618 | /// Payload is `SwitchBlockMulti` |
| 636 | switch_block_ref_multi, | 619 | switch_block_ref_multi, |
| 637 | /// Same as `switch_block_else` but the target is a pointer to the value being switched on. | 620 | /// Same as `switch_block_else` but the target is a pointer to the value being switched on. |
| 638 | switch_block_ref_else, | 621 | switch_block_ref_else, |
| 639 | /// Same as `switch_block_else_multi` but the target is a pointer to the | 622 | /// Same as `switch_block_else_multi` but the target is a pointer to the |
| 640 | /// value being switched on. | 623 | /// value being switched on. |
| | 624 | /// Payload is `SwitchBlockMulti` |
| 641 | switch_block_ref_else_multi, | 625 | switch_block_ref_else_multi, |
| 642 | /// Same as `switch_block_under` but the target is a pointer to the value | 626 | /// Same as `switch_block_under` but the target is a pointer to the value |
| 643 | /// being switched on. | 627 | /// being switched on. |
| 644 | switch_block_ref_under, | 628 | switch_block_ref_under, |
| 645 | /// Same as `switch_block_under_multi` but the target is a pointer to | 629 | /// Same as `switch_block_under_multi` but the target is a pointer to |
| 646 | /// the value being switched on. | 630 | /// the value being switched on. |
| | 631 | /// Payload is `SwitchBlockMulti` |
| 647 | switch_block_ref_under_multi, | 632 | switch_block_ref_under_multi, |
| 648 | /// Produces the capture value for a switch prong. | 633 | /// Produces the capture value for a switch prong. |
| 649 | /// Uses the `switch_capture` field. | 634 | /// Uses the `switch_capture` field. |
| ... | @@ -937,6 +922,32 @@ pub const Inst = struct { | ... | @@ -937,6 +922,32 @@ pub const Inst = struct { |
| 937 | /// Implements the `@cImport` builtin. | 922 | /// Implements the `@cImport` builtin. |
| 938 | /// Uses the `pl_node` union field with payload `Block`. | 923 | /// Uses the `pl_node` union field with payload `Block`. |
| 939 | c_import, | 924 | c_import, |
| | 925 | |
| | 926 | /// Allocates stack local memory. |
| | 927 | /// Uses the `un_node` union field. The operand is the type of the allocated object. |
| | 928 | /// The node source location points to a var decl node. |
| | 929 | /// Indicates the beginning of a new statement in debug info. |
| | 930 | alloc, |
| | 931 | /// Same as `alloc` except mutable. |
| | 932 | alloc_mut, |
| | 933 | /// Allocates comptime-mutable memory. |
| | 934 | /// Uses the `un_node` union field. The operand is the type of the allocated object. |
| | 935 | /// The node source location points to a var decl node. |
| | 936 | alloc_comptime, |
| | 937 | /// Same as `alloc` except the type is inferred. |
| | 938 | /// Uses the `node` union field. |
| | 939 | alloc_inferred, |
| | 940 | /// Same as `alloc_inferred` except mutable. |
| | 941 | alloc_inferred_mut, |
| | 942 | /// Same as `alloc_comptime` except the type is inferred. |
| | 943 | alloc_inferred_comptime, |
| | 944 | /// Each `store_to_inferred_ptr` puts the type of the stored value into a set, |
| | 945 | /// and then `resolve_inferred_alloc` triggers peer type resolution on the set. |
| | 946 | /// The operand is a `alloc_inferred` or `alloc_inferred_mut` instruction, which |
| | 947 | /// is the allocation that needs to have its type inferred. |
| | 948 | /// Uses the `un_node` field. The AST node is the var decl. |
| | 949 | resolve_inferred_alloc, |
| | 950 | |
| 940 | /// The ZIR instruction tag is one of the `Extended` ones. | 951 | /// The ZIR instruction tag is one of the `Extended` ones. |
| 941 | /// Uses the `extended` union field. | 952 | /// Uses the `extended` union field. |
| 942 | extended, | 953 | extended, |
| ... | @@ -949,8 +960,10 @@ pub const Inst = struct { | ... | @@ -949,8 +960,10 @@ pub const Inst = struct { |
| 949 | .addwrap, | 960 | .addwrap, |
| 950 | .alloc, | 961 | .alloc, |
| 951 | .alloc_mut, | 962 | .alloc_mut, |
| | 963 | .alloc_comptime, |
| 952 | .alloc_inferred, | 964 | .alloc_inferred, |
| 953 | .alloc_inferred_mut, | 965 | .alloc_inferred_mut, |
| | 966 | .alloc_inferred_comptime, |
| 954 | .array_cat, | 967 | .array_cat, |
| 955 | .array_mul, | 968 | .array_mul, |
| 956 | .array_type, | 969 | .array_type, |
| ... | @@ -1066,7 +1079,6 @@ pub const Inst = struct { | ... | @@ -1066,7 +1079,6 @@ pub const Inst = struct { |
| 1066 | .ptr_type_simple, | 1079 | .ptr_type_simple, |
| 1067 | .ensure_err_payload_void, | 1080 | .ensure_err_payload_void, |
| 1068 | .enum_literal, | 1081 | .enum_literal, |
| 1069 | .enum_literal_small, | | |
| 1070 | .merge_error_sets, | 1082 | .merge_error_sets, |
| 1071 | .error_union_type, | 1083 | .error_union_type, |
| 1072 | .bit_not, | 1084 | .bit_not, |
| ... | @@ -2251,6 +2263,7 @@ const Writer = struct { | ... | @@ -2251,6 +2263,7 @@ const Writer = struct { |
| 2251 | | 2263 | |
| 2252 | .alloc, | 2264 | .alloc, |
| 2253 | .alloc_mut, | 2265 | .alloc_mut, |
| | 2266 | .alloc_comptime, |
| 2254 | .indexable_ptr_len, | 2267 | .indexable_ptr_len, |
| 2255 | .bit_not, | 2268 | .bit_not, |
| 2256 | .bool_not, | 2269 | .bool_not, |
| ... | @@ -2516,6 +2529,7 @@ const Writer = struct { | ... | @@ -2516,6 +2529,7 @@ const Writer = struct { |
| 2516 | .repeat_inline, | 2529 | .repeat_inline, |
| 2517 | .alloc_inferred, | 2530 | .alloc_inferred, |
| 2518 | .alloc_inferred_mut, | 2531 | .alloc_inferred_mut, |
| | 2532 | .alloc_inferred_comptime, |
| 2519 | => try self.writeNode(stream, inst), | 2533 | => try self.writeNode(stream, inst), |
| 2520 | | 2534 | |
| 2521 | .error_value, | 2535 | .error_value, |
| ... | @@ -2530,8 +2544,6 @@ const Writer = struct { | ... | @@ -2530,8 +2544,6 @@ const Writer = struct { |
| 2530 | | 2544 | |
| 2531 | .@"unreachable" => try self.writeUnreachable(stream, inst), | 2545 | .@"unreachable" => try self.writeUnreachable(stream, inst), |
| 2532 | | 2546 | |
| 2533 | .enum_literal_small => try self.writeSmallStr(stream, inst), | | |
| 2534 | | | |
| 2535 | .switch_capture, | 2547 | .switch_capture, |
| 2536 | .switch_capture_ref, | 2548 | .switch_capture_ref, |
| 2537 | .switch_capture_multi, | 2549 | .switch_capture_multi, |
| ... | @@ -3442,15 +3454,6 @@ const Writer = struct { | ... | @@ -3442,15 +3454,6 @@ const Writer = struct { |
| 3442 | try self.writeSrc(stream, src); | 3454 | try self.writeSrc(stream, src); |
| 3443 | } | 3455 | } |
| 3444 | | 3456 | |
| 3445 | fn writeSmallStr( | | |
| 3446 | self: *Writer, | | |
| 3447 | stream: anytype, | | |
| 3448 | inst: Inst.Index, | | |
| 3449 | ) (@TypeOf(stream).Error || error{OutOfMemory})!void { | | |
| 3450 | const str = self.code.instructions.items(.data)[inst].small_str.get(); | | |
| 3451 | try stream.print("\"{}\")", .{std.zig.fmtEscapes(str)}); | | |
| 3452 | } | | |
| 3453 | | | |
| 3454 | fn writeSwitchCapture(self: *Writer, stream: anytype, inst: Inst.Index) !void { | 3457 | fn writeSwitchCapture(self: *Writer, stream: anytype, inst: Inst.Index) !void { |
| 3455 | const inst_data = self.code.instructions.items(.data)[inst].switch_capture; | 3458 | const inst_data = self.code.instructions.items(.data)[inst].switch_capture; |
| 3456 | try self.writeInstIndex(stream, inst_data.switch_inst); | 3459 | try self.writeInstIndex(stream, inst_data.switch_inst); |