| ... | @@ -61,7 +61,8 @@ const Zir = @import("Zir.zig"); | ... | @@ -61,7 +61,8 @@ const Zir = @import("Zir.zig"); |
| 61 | const Module = @import("Module.zig"); | 61 | const Module = @import("Module.zig"); |
| 62 | const trace = @import("tracy.zig").trace; | 62 | const trace = @import("tracy.zig").trace; |
| 63 | const Scope = Module.Scope; | 63 | const Scope = Module.Scope; |
| 64 | const InnerError = Module.InnerError; | 64 | const CompileError = Module.CompileError; |
| | 65 | const SemaError = Module.SemaError; |
| 65 | const Decl = Module.Decl; | 66 | const Decl = Module.Decl; |
| 66 | const LazySrcLoc = Module.LazySrcLoc; | 67 | const LazySrcLoc = Module.LazySrcLoc; |
| 67 | const RangeSet = @import("RangeSet.zig"); | 68 | const RangeSet = @import("RangeSet.zig"); |
| ... | @@ -83,7 +84,7 @@ pub fn analyzeFnBody( | ... | @@ -83,7 +84,7 @@ pub fn analyzeFnBody( |
| 83 | sema: *Sema, | 84 | sema: *Sema, |
| 84 | block: *Scope.Block, | 85 | block: *Scope.Block, |
| 85 | fn_body_inst: Zir.Inst.Index, | 86 | fn_body_inst: Zir.Inst.Index, |
| 86 | ) InnerError!void { | 87 | ) SemaError!void { |
| 87 | const tags = sema.code.instructions.items(.tag); | 88 | const tags = sema.code.instructions.items(.tag); |
| 88 | const datas = sema.code.instructions.items(.data); | 89 | const datas = sema.code.instructions.items(.data); |
| 89 | const body: []const Zir.Inst.Index = switch (tags[fn_body_inst]) { | 90 | const body: []const Zir.Inst.Index = switch (tags[fn_body_inst]) { |
| ... | @@ -109,13 +110,16 @@ pub fn analyzeFnBody( | ... | @@ -109,13 +110,16 @@ pub fn analyzeFnBody( |
| 109 | }, | 110 | }, |
| 110 | else => unreachable, | 111 | else => unreachable, |
| 111 | }; | 112 | }; |
| 112 | _ = try sema.analyzeBody(block, body); | 113 | _ = sema.analyzeBody(block, body) catch |err| switch (err) { |
| | 114 | error.NeededSourceLocation => unreachable, |
| | 115 | else => |e| return e, |
| | 116 | }; |
| 113 | } | 117 | } |
| 114 | | 118 | |
| 115 | /// Returns only the result from the body that is specified. | 119 | /// Returns only the result from the body that is specified. |
| 116 | /// Only appropriate to call when it is determined at comptime that this body | 120 | /// Only appropriate to call when it is determined at comptime that this body |
| 117 | /// has no peers. | 121 | /// has no peers. |
| 118 | fn resolveBody(sema: *Sema, block: *Scope.Block, body: []const Zir.Inst.Index) InnerError!Air.Inst.Ref { | 122 | fn resolveBody(sema: *Sema, block: *Scope.Block, body: []const Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 119 | const break_inst = try sema.analyzeBody(block, body); | 123 | const break_inst = try sema.analyzeBody(block, body); |
| 120 | const operand_ref = sema.code.instructions.items(.data)[break_inst].@"break".operand; | 124 | const operand_ref = sema.code.instructions.items(.data)[break_inst].@"break".operand; |
| 121 | return sema.resolveInst(operand_ref); | 125 | return sema.resolveInst(operand_ref); |
| ... | @@ -125,7 +129,7 @@ fn resolveBody(sema: *Sema, block: *Scope.Block, body: []const Zir.Inst.Index) I | ... | @@ -125,7 +129,7 @@ fn resolveBody(sema: *Sema, block: *Scope.Block, body: []const Zir.Inst.Index) I |
| 125 | /// return type of `analyzeBody` so that we can tail call them. | 129 | /// return type of `analyzeBody` so that we can tail call them. |
| 126 | /// Only appropriate to return when the instruction is known to be NoReturn | 130 | /// Only appropriate to return when the instruction is known to be NoReturn |
| 127 | /// solely based on the ZIR tag. | 131 | /// solely based on the ZIR tag. |
| 128 | const always_noreturn: InnerError!Zir.Inst.Index = @as(Zir.Inst.Index, undefined); | 132 | const always_noreturn: CompileError!Zir.Inst.Index = @as(Zir.Inst.Index, undefined); |
| 129 | | 133 | |
| 130 | /// This function is the main loop of `Sema` and it can be used in two different ways: | 134 | /// This function is the main loop of `Sema` and it can be used in two different ways: |
| 131 | /// * The traditional way where there are N breaks out of the block and peer type | 135 | /// * The traditional way where there are N breaks out of the block and peer type |
| ... | @@ -140,7 +144,7 @@ pub fn analyzeBody( | ... | @@ -140,7 +144,7 @@ pub fn analyzeBody( |
| 140 | sema: *Sema, | 144 | sema: *Sema, |
| 141 | block: *Scope.Block, | 145 | block: *Scope.Block, |
| 142 | body: []const Zir.Inst.Index, | 146 | body: []const Zir.Inst.Index, |
| 143 | ) InnerError!Zir.Inst.Index { | 147 | ) CompileError!Zir.Inst.Index { |
| 144 | // No tracy calls here, to avoid interfering with the tail call mechanism. | 148 | // No tracy calls here, to avoid interfering with the tail call mechanism. |
| 145 | | 149 | |
| 146 | const map = &block.sema.inst_map; | 150 | const map = &block.sema.inst_map; |
| ... | @@ -541,7 +545,7 @@ pub fn analyzeBody( | ... | @@ -541,7 +545,7 @@ pub fn analyzeBody( |
| 541 | } | 545 | } |
| 542 | } | 546 | } |
| 543 | | 547 | |
| 544 | fn zirExtended(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 548 | fn zirExtended(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 545 | const extended = sema.code.instructions.items(.data)[inst].extended; | 549 | const extended = sema.code.instructions.items(.data)[inst].extended; |
| 546 | switch (extended.opcode) { | 550 | switch (extended.opcode) { |
| 547 | // zig fmt: off | 551 | // zig fmt: off |
| ... | @@ -638,7 +642,7 @@ fn resolveConstValue( | ... | @@ -638,7 +642,7 @@ fn resolveConstValue( |
| 638 | block: *Scope.Block, | 642 | block: *Scope.Block, |
| 639 | src: LazySrcLoc, | 643 | src: LazySrcLoc, |
| 640 | air_ref: Air.Inst.Ref, | 644 | air_ref: Air.Inst.Ref, |
| 641 | ) !Value { | 645 | ) CompileError!Value { |
| 642 | return (try sema.resolveDefinedValue(block, src, air_ref)) orelse | 646 | return (try sema.resolveDefinedValue(block, src, air_ref)) orelse |
| 643 | return sema.failWithNeededComptime(block, src); | 647 | return sema.failWithNeededComptime(block, src); |
| 644 | } | 648 | } |
| ... | @@ -648,7 +652,7 @@ fn resolveDefinedValue( | ... | @@ -648,7 +652,7 @@ fn resolveDefinedValue( |
| 648 | block: *Scope.Block, | 652 | block: *Scope.Block, |
| 649 | src: LazySrcLoc, | 653 | src: LazySrcLoc, |
| 650 | air_ref: Air.Inst.Ref, | 654 | air_ref: Air.Inst.Ref, |
| 651 | ) !?Value { | 655 | ) CompileError!?Value { |
| 652 | if (try sema.resolvePossiblyUndefinedValue(block, src, air_ref)) |val| { | 656 | if (try sema.resolvePossiblyUndefinedValue(block, src, air_ref)) |val| { |
| 653 | if (val.isUndef()) { | 657 | if (val.isUndef()) { |
| 654 | return sema.failWithUseOfUndef(block, src); | 658 | return sema.failWithUseOfUndef(block, src); |
| ... | @@ -663,7 +667,7 @@ fn resolvePossiblyUndefinedValue( | ... | @@ -663,7 +667,7 @@ fn resolvePossiblyUndefinedValue( |
| 663 | block: *Scope.Block, | 667 | block: *Scope.Block, |
| 664 | src: LazySrcLoc, | 668 | src: LazySrcLoc, |
| 665 | air_ref: Air.Inst.Ref, | 669 | air_ref: Air.Inst.Ref, |
| 666 | ) !?Value { | 670 | ) CompileError!?Value { |
| 667 | const ty = sema.getTypeOf(air_ref); | 671 | const ty = sema.getTypeOf(air_ref); |
| 668 | if (try sema.typeHasOnePossibleValue(block, src, ty)) |opv| { | 672 | if (try sema.typeHasOnePossibleValue(block, src, ty)) |opv| { |
| 669 | return opv; | 673 | return opv; |
| ... | @@ -687,11 +691,11 @@ fn resolvePossiblyUndefinedValue( | ... | @@ -687,11 +691,11 @@ fn resolvePossiblyUndefinedValue( |
| 687 | } | 691 | } |
| 688 | } | 692 | } |
| 689 | | 693 | |
| 690 | fn failWithNeededComptime(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) InnerError { | 694 | fn failWithNeededComptime(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) CompileError { |
| 691 | return sema.mod.fail(&block.base, src, "unable to resolve comptime value", .{}); | 695 | return sema.mod.fail(&block.base, src, "unable to resolve comptime value", .{}); |
| 692 | } | 696 | } |
| 693 | | 697 | |
| 694 | fn failWithUseOfUndef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) InnerError { | 698 | fn failWithUseOfUndef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) CompileError { |
| 695 | return sema.mod.fail(&block.base, src, "use of undefined value here causes undefined behavior", .{}); | 699 | return sema.mod.fail(&block.base, src, "use of undefined value here causes undefined behavior", .{}); |
| 696 | } | 700 | } |
| 697 | | 701 | |
| ... | @@ -733,7 +737,7 @@ pub fn resolveInstConst( | ... | @@ -733,7 +737,7 @@ pub fn resolveInstConst( |
| 733 | block: *Scope.Block, | 737 | block: *Scope.Block, |
| 734 | src: LazySrcLoc, | 738 | src: LazySrcLoc, |
| 735 | zir_ref: Zir.Inst.Ref, | 739 | zir_ref: Zir.Inst.Ref, |
| 736 | ) InnerError!TypedValue { | 740 | ) CompileError!TypedValue { |
| 737 | const air_ref = sema.resolveInst(zir_ref); | 741 | const air_ref = sema.resolveInst(zir_ref); |
| 738 | const val = try sema.resolveConstValue(block, src, air_ref); | 742 | const val = try sema.resolveConstValue(block, src, air_ref); |
| 739 | return TypedValue{ | 743 | return TypedValue{ |
| ... | @@ -742,13 +746,13 @@ pub fn resolveInstConst( | ... | @@ -742,13 +746,13 @@ pub fn resolveInstConst( |
| 742 | }; | 746 | }; |
| 743 | } | 747 | } |
| 744 | | 748 | |
| 745 | fn zirBitcastResultPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 749 | fn zirBitcastResultPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 746 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 750 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 747 | const src = inst_data.src(); | 751 | const src = inst_data.src(); |
| 748 | return sema.mod.fail(&block.base, src, "TODO implement zir_sema.zirBitcastResultPtr", .{}); | 752 | return sema.mod.fail(&block.base, src, "TODO implement zir_sema.zirBitcastResultPtr", .{}); |
| 749 | } | 753 | } |
| 750 | | 754 | |
| 751 | fn zirCoerceResultPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 755 | fn zirCoerceResultPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 752 | _ = inst; | 756 | _ = inst; |
| 753 | const tracy = trace(@src()); | 757 | const tracy = trace(@src()); |
| 754 | defer tracy.end(); | 758 | defer tracy.end(); |
| ... | @@ -760,7 +764,7 @@ pub fn analyzeStructDecl( | ... | @@ -760,7 +764,7 @@ pub fn analyzeStructDecl( |
| 760 | new_decl: *Decl, | 764 | new_decl: *Decl, |
| 761 | inst: Zir.Inst.Index, | 765 | inst: Zir.Inst.Index, |
| 762 | struct_obj: *Module.Struct, | 766 | struct_obj: *Module.Struct, |
| 763 | ) InnerError!void { | 767 | ) SemaError!void { |
| 764 | const extended = sema.code.instructions.items(.data)[inst].extended; | 768 | const extended = sema.code.instructions.items(.data)[inst].extended; |
| 765 | assert(extended.opcode == .struct_decl); | 769 | assert(extended.opcode == .struct_decl); |
| 766 | const small = @bitCast(Zir.Inst.StructDecl.Small, extended.small); | 770 | const small = @bitCast(Zir.Inst.StructDecl.Small, extended.small); |
| ... | @@ -783,7 +787,7 @@ fn zirStructDecl( | ... | @@ -783,7 +787,7 @@ fn zirStructDecl( |
| 783 | block: *Scope.Block, | 787 | block: *Scope.Block, |
| 784 | extended: Zir.Inst.Extended.InstData, | 788 | extended: Zir.Inst.Extended.InstData, |
| 785 | inst: Zir.Inst.Index, | 789 | inst: Zir.Inst.Index, |
| 786 | ) InnerError!Air.Inst.Ref { | 790 | ) CompileError!Air.Inst.Ref { |
| 787 | const small = @bitCast(Zir.Inst.StructDecl.Small, extended.small); | 791 | const small = @bitCast(Zir.Inst.StructDecl.Small, extended.small); |
| 788 | const src: LazySrcLoc = if (small.has_src_node) blk: { | 792 | const src: LazySrcLoc = if (small.has_src_node) blk: { |
| 789 | const node_offset = @bitCast(i32, sema.code.extra[extended.operand]); | 793 | const node_offset = @bitCast(i32, sema.code.extra[extended.operand]); |
| ... | @@ -854,7 +858,7 @@ fn zirEnumDecl( | ... | @@ -854,7 +858,7 @@ fn zirEnumDecl( |
| 854 | sema: *Sema, | 858 | sema: *Sema, |
| 855 | block: *Scope.Block, | 859 | block: *Scope.Block, |
| 856 | extended: Zir.Inst.Extended.InstData, | 860 | extended: Zir.Inst.Extended.InstData, |
| 857 | ) InnerError!Air.Inst.Ref { | 861 | ) CompileError!Air.Inst.Ref { |
| 858 | const tracy = trace(@src()); | 862 | const tracy = trace(@src()); |
| 859 | defer tracy.end(); | 863 | defer tracy.end(); |
| 860 | | 864 | |
| ... | @@ -1051,7 +1055,7 @@ fn zirUnionDecl( | ... | @@ -1051,7 +1055,7 @@ fn zirUnionDecl( |
| 1051 | block: *Scope.Block, | 1055 | block: *Scope.Block, |
| 1052 | extended: Zir.Inst.Extended.InstData, | 1056 | extended: Zir.Inst.Extended.InstData, |
| 1053 | inst: Zir.Inst.Index, | 1057 | inst: Zir.Inst.Index, |
| 1054 | ) InnerError!Air.Inst.Ref { | 1058 | ) CompileError!Air.Inst.Ref { |
| 1055 | const tracy = trace(@src()); | 1059 | const tracy = trace(@src()); |
| 1056 | defer tracy.end(); | 1060 | defer tracy.end(); |
| 1057 | | 1061 | |
| ... | @@ -1115,7 +1119,7 @@ fn zirOpaqueDecl( | ... | @@ -1115,7 +1119,7 @@ fn zirOpaqueDecl( |
| 1115 | block: *Scope.Block, | 1119 | block: *Scope.Block, |
| 1116 | inst: Zir.Inst.Index, | 1120 | inst: Zir.Inst.Index, |
| 1117 | name_strategy: Zir.Inst.NameStrategy, | 1121 | name_strategy: Zir.Inst.NameStrategy, |
| 1118 | ) InnerError!Air.Inst.Ref { | 1122 | ) CompileError!Air.Inst.Ref { |
| 1119 | const tracy = trace(@src()); | 1123 | const tracy = trace(@src()); |
| 1120 | defer tracy.end(); | 1124 | defer tracy.end(); |
| 1121 | | 1125 | |
| ... | @@ -1135,7 +1139,7 @@ fn zirErrorSetDecl( | ... | @@ -1135,7 +1139,7 @@ fn zirErrorSetDecl( |
| 1135 | block: *Scope.Block, | 1139 | block: *Scope.Block, |
| 1136 | inst: Zir.Inst.Index, | 1140 | inst: Zir.Inst.Index, |
| 1137 | name_strategy: Zir.Inst.NameStrategy, | 1141 | name_strategy: Zir.Inst.NameStrategy, |
| 1138 | ) InnerError!Air.Inst.Ref { | 1142 | ) CompileError!Air.Inst.Ref { |
| 1139 | const tracy = trace(@src()); | 1143 | const tracy = trace(@src()); |
| 1140 | defer tracy.end(); | 1144 | defer tracy.end(); |
| 1141 | | 1145 | |
| ... | @@ -1175,7 +1179,7 @@ fn zirRetPtr( | ... | @@ -1175,7 +1179,7 @@ fn zirRetPtr( |
| 1175 | sema: *Sema, | 1179 | sema: *Sema, |
| 1176 | block: *Scope.Block, | 1180 | block: *Scope.Block, |
| 1177 | extended: Zir.Inst.Extended.InstData, | 1181 | extended: Zir.Inst.Extended.InstData, |
| 1178 | ) InnerError!Air.Inst.Ref { | 1182 | ) CompileError!Air.Inst.Ref { |
| 1179 | const tracy = trace(@src()); | 1183 | const tracy = trace(@src()); |
| 1180 | defer tracy.end(); | 1184 | defer tracy.end(); |
| 1181 | | 1185 | |
| ... | @@ -1187,7 +1191,7 @@ fn zirRetPtr( | ... | @@ -1187,7 +1191,7 @@ fn zirRetPtr( |
| 1187 | return block.addNoOp(src, ptr_type, .alloc); | 1191 | return block.addNoOp(src, ptr_type, .alloc); |
| 1188 | } | 1192 | } |
| 1189 | | 1193 | |
| 1190 | fn zirRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1194 | fn zirRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1191 | const tracy = trace(@src()); | 1195 | const tracy = trace(@src()); |
| 1192 | defer tracy.end(); | 1196 | defer tracy.end(); |
| 1193 | | 1197 | |
| ... | @@ -1200,7 +1204,7 @@ fn zirRetType( | ... | @@ -1200,7 +1204,7 @@ fn zirRetType( |
| 1200 | sema: *Sema, | 1204 | sema: *Sema, |
| 1201 | block: *Scope.Block, | 1205 | block: *Scope.Block, |
| 1202 | extended: Zir.Inst.Extended.InstData, | 1206 | extended: Zir.Inst.Extended.InstData, |
| 1203 | ) InnerError!Air.Inst.Ref { | 1207 | ) CompileError!Air.Inst.Ref { |
| 1204 | const tracy = trace(@src()); | 1208 | const tracy = trace(@src()); |
| 1205 | defer tracy.end(); | 1209 | defer tracy.end(); |
| 1206 | | 1210 | |
| ... | @@ -1211,7 +1215,7 @@ fn zirRetType( | ... | @@ -1211,7 +1215,7 @@ fn zirRetType( |
| 1211 | return sema.addType(ret_type); | 1215 | return sema.addType(ret_type); |
| 1212 | } | 1216 | } |
| 1213 | | 1217 | |
| 1214 | fn zirEnsureResultUsed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 1218 | fn zirEnsureResultUsed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1215 | const tracy = trace(@src()); | 1219 | const tracy = trace(@src()); |
| 1216 | defer tracy.end(); | 1220 | defer tracy.end(); |
| 1217 | | 1221 | |
| ... | @@ -1227,14 +1231,14 @@ fn ensureResultUsed( | ... | @@ -1227,14 +1231,14 @@ fn ensureResultUsed( |
| 1227 | block: *Scope.Block, | 1231 | block: *Scope.Block, |
| 1228 | operand: Air.Inst.Ref, | 1232 | operand: Air.Inst.Ref, |
| 1229 | src: LazySrcLoc, | 1233 | src: LazySrcLoc, |
| 1230 | ) InnerError!void { | 1234 | ) CompileError!void { |
| 1231 | switch (operand.ty.zigTypeTag()) { | 1235 | switch (operand.ty.zigTypeTag()) { |
| 1232 | .Void, .NoReturn => return, | 1236 | .Void, .NoReturn => return, |
| 1233 | else => return sema.mod.fail(&block.base, src, "expression value is ignored", .{}), | 1237 | else => return sema.mod.fail(&block.base, src, "expression value is ignored", .{}), |
| 1234 | } | 1238 | } |
| 1235 | } | 1239 | } |
| 1236 | | 1240 | |
| 1237 | fn zirEnsureResultNonError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 1241 | fn zirEnsureResultNonError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1238 | const tracy = trace(@src()); | 1242 | const tracy = trace(@src()); |
| 1239 | defer tracy.end(); | 1243 | defer tracy.end(); |
| 1240 | | 1244 | |
| ... | @@ -1247,7 +1251,7 @@ fn zirEnsureResultNonError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde | ... | @@ -1247,7 +1251,7 @@ fn zirEnsureResultNonError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde |
| 1247 | } | 1251 | } |
| 1248 | } | 1252 | } |
| 1249 | | 1253 | |
| 1250 | fn zirIndexablePtrLen(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1254 | fn zirIndexablePtrLen(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1251 | const tracy = trace(@src()); | 1255 | const tracy = trace(@src()); |
| 1252 | defer tracy.end(); | 1256 | defer tracy.end(); |
| 1253 | | 1257 | |
| ... | @@ -1281,7 +1285,7 @@ fn zirIndexablePtrLen(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In | ... | @@ -1281,7 +1285,7 @@ fn zirIndexablePtrLen(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In |
| 1281 | return sema.analyzeLoad(block, src, result_ptr, result_ptr.src); | 1285 | return sema.analyzeLoad(block, src, result_ptr, result_ptr.src); |
| 1282 | } | 1286 | } |
| 1283 | | 1287 | |
| 1284 | fn zirArg(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1288 | fn zirArg(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1285 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; | 1289 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; |
| 1286 | const arg_name = inst_data.get(sema.code); | 1290 | const arg_name = inst_data.get(sema.code); |
| 1287 | const arg_index = sema.next_arg_index; | 1291 | const arg_index = sema.next_arg_index; |
| ... | @@ -1304,13 +1308,13 @@ fn zirAllocExtended( | ... | @@ -1304,13 +1308,13 @@ fn zirAllocExtended( |
| 1304 | sema: *Sema, | 1308 | sema: *Sema, |
| 1305 | block: *Scope.Block, | 1309 | block: *Scope.Block, |
| 1306 | extended: Zir.Inst.Extended.InstData, | 1310 | extended: Zir.Inst.Extended.InstData, |
| 1307 | ) InnerError!Air.Inst.Ref { | 1311 | ) CompileError!Air.Inst.Ref { |
| 1308 | const extra = sema.code.extraData(Zir.Inst.AllocExtended, extended.operand); | 1312 | const extra = sema.code.extraData(Zir.Inst.AllocExtended, extended.operand); |
| 1309 | const src: LazySrcLoc = .{ .node_offset = extra.data.src_node }; | 1313 | const src: LazySrcLoc = .{ .node_offset = extra.data.src_node }; |
| 1310 | return sema.mod.fail(&block.base, src, "TODO implement Sema.zirAllocExtended", .{}); | 1314 | return sema.mod.fail(&block.base, src, "TODO implement Sema.zirAllocExtended", .{}); |
| 1311 | } | 1315 | } |
| 1312 | | 1316 | |
| 1313 | fn zirAllocComptime(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1317 | fn zirAllocComptime(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1314 | const tracy = trace(@src()); | 1318 | const tracy = trace(@src()); |
| 1315 | defer tracy.end(); | 1319 | defer tracy.end(); |
| 1316 | | 1320 | |
| ... | @@ -1333,13 +1337,13 @@ fn zirAllocComptime(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne | ... | @@ -1333,13 +1337,13 @@ fn zirAllocComptime(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne |
| 1333 | }); | 1337 | }); |
| 1334 | } | 1338 | } |
| 1335 | | 1339 | |
| 1336 | fn zirAllocInferredComptime(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1340 | fn zirAllocInferredComptime(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1337 | const src_node = sema.code.instructions.items(.data)[inst].node; | 1341 | const src_node = sema.code.instructions.items(.data)[inst].node; |
| 1338 | const src: LazySrcLoc = .{ .node_offset = src_node }; | 1342 | const src: LazySrcLoc = .{ .node_offset = src_node }; |
| 1339 | return sema.mod.fail(&block.base, src, "TODO implement Sema.zirAllocInferredComptime", .{}); | 1343 | return sema.mod.fail(&block.base, src, "TODO implement Sema.zirAllocInferredComptime", .{}); |
| 1340 | } | 1344 | } |
| 1341 | | 1345 | |
| 1342 | fn zirAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1346 | fn zirAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1343 | const tracy = trace(@src()); | 1347 | const tracy = trace(@src()); |
| 1344 | defer tracy.end(); | 1348 | defer tracy.end(); |
| 1345 | | 1349 | |
| ... | @@ -1352,7 +1356,7 @@ fn zirAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!A | ... | @@ -1352,7 +1356,7 @@ fn zirAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!A |
| 1352 | return block.addNoOp(var_decl_src, ptr_type, .alloc); | 1356 | return block.addNoOp(var_decl_src, ptr_type, .alloc); |
| 1353 | } | 1357 | } |
| 1354 | | 1358 | |
| 1355 | fn zirAllocMut(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1359 | fn zirAllocMut(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1356 | const tracy = trace(@src()); | 1360 | const tracy = trace(@src()); |
| 1357 | defer tracy.end(); | 1361 | defer tracy.end(); |
| 1358 | | 1362 | |
| ... | @@ -1371,7 +1375,7 @@ fn zirAllocInferred( | ... | @@ -1371,7 +1375,7 @@ fn zirAllocInferred( |
| 1371 | block: *Scope.Block, | 1375 | block: *Scope.Block, |
| 1372 | inst: Zir.Inst.Index, | 1376 | inst: Zir.Inst.Index, |
| 1373 | inferred_alloc_ty: Type, | 1377 | inferred_alloc_ty: Type, |
| 1374 | ) InnerError!Air.Inst.Ref { | 1378 | ) CompileError!Air.Inst.Ref { |
| 1375 | const tracy = trace(@src()); | 1379 | const tracy = trace(@src()); |
| 1376 | defer tracy.end(); | 1380 | defer tracy.end(); |
| 1377 | | 1381 | |
| ... | @@ -1395,7 +1399,7 @@ fn zirAllocInferred( | ... | @@ -1395,7 +1399,7 @@ fn zirAllocInferred( |
| 1395 | return result; | 1399 | return result; |
| 1396 | } | 1400 | } |
| 1397 | | 1401 | |
| 1398 | fn zirResolveInferredAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 1402 | fn zirResolveInferredAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1399 | const tracy = trace(@src()); | 1403 | const tracy = trace(@src()); |
| 1400 | defer tracy.end(); | 1404 | defer tracy.end(); |
| 1401 | | 1405 | |
| ... | @@ -1421,7 +1425,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde | ... | @@ -1421,7 +1425,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde |
| 1421 | ptr.tag = .alloc; | 1425 | ptr.tag = .alloc; |
| 1422 | } | 1426 | } |
| 1423 | | 1427 | |
| 1424 | fn zirValidateStructInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 1428 | fn zirValidateStructInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1425 | const tracy = trace(@src()); | 1429 | const tracy = trace(@src()); |
| 1426 | defer tracy.end(); | 1430 | defer tracy.end(); |
| 1427 | | 1431 | |
| ... | @@ -1494,7 +1498,7 @@ fn zirValidateStructInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Ind | ... | @@ -1494,7 +1498,7 @@ fn zirValidateStructInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Ind |
| 1494 | } | 1498 | } |
| 1495 | } | 1499 | } |
| 1496 | | 1500 | |
| 1497 | fn zirValidateArrayInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 1501 | fn zirValidateArrayInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1498 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 1502 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 1499 | const src = inst_data.src(); | 1503 | const src = inst_data.src(); |
| 1500 | return sema.mod.fail(&block.base, src, "TODO implement Sema.zirValidateArrayInitPtr", .{}); | 1504 | return sema.mod.fail(&block.base, src, "TODO implement Sema.zirValidateArrayInitPtr", .{}); |
| ... | @@ -1506,7 +1510,7 @@ fn failWithBadFieldAccess( | ... | @@ -1506,7 +1510,7 @@ fn failWithBadFieldAccess( |
| 1506 | struct_obj: *Module.Struct, | 1510 | struct_obj: *Module.Struct, |
| 1507 | field_src: LazySrcLoc, | 1511 | field_src: LazySrcLoc, |
| 1508 | field_name: []const u8, | 1512 | field_name: []const u8, |
| 1509 | ) InnerError { | 1513 | ) CompileError { |
| 1510 | const mod = sema.mod; | 1514 | const mod = sema.mod; |
| 1511 | const gpa = sema.gpa; | 1515 | const gpa = sema.gpa; |
| 1512 | | 1516 | |
| ... | @@ -1533,7 +1537,7 @@ fn failWithBadUnionFieldAccess( | ... | @@ -1533,7 +1537,7 @@ fn failWithBadUnionFieldAccess( |
| 1533 | union_obj: *Module.Union, | 1537 | union_obj: *Module.Union, |
| 1534 | field_src: LazySrcLoc, | 1538 | field_src: LazySrcLoc, |
| 1535 | field_name: []const u8, | 1539 | field_name: []const u8, |
| 1536 | ) InnerError { | 1540 | ) CompileError { |
| 1537 | const mod = sema.mod; | 1541 | const mod = sema.mod; |
| 1538 | const gpa = sema.gpa; | 1542 | const gpa = sema.gpa; |
| 1539 | | 1543 | |
| ... | @@ -1554,7 +1558,7 @@ fn failWithBadUnionFieldAccess( | ... | @@ -1554,7 +1558,7 @@ fn failWithBadUnionFieldAccess( |
| 1554 | return mod.failWithOwnedErrorMsg(&block.base, msg); | 1558 | return mod.failWithOwnedErrorMsg(&block.base, msg); |
| 1555 | } | 1559 | } |
| 1556 | | 1560 | |
| 1557 | fn zirStoreToBlockPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 1561 | fn zirStoreToBlockPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1558 | const tracy = trace(@src()); | 1562 | const tracy = trace(@src()); |
| 1559 | defer tracy.end(); | 1563 | defer tracy.end(); |
| 1560 | | 1564 | |
| ... | @@ -1575,7 +1579,7 @@ fn zirStoreToBlockPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In | ... | @@ -1575,7 +1579,7 @@ fn zirStoreToBlockPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In |
| 1575 | return sema.storePtr(block, src, bitcasted_ptr, value); | 1579 | return sema.storePtr(block, src, bitcasted_ptr, value); |
| 1576 | } | 1580 | } |
| 1577 | | 1581 | |
| 1578 | fn zirStoreToInferredPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 1582 | fn zirStoreToInferredPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1579 | const tracy = trace(@src()); | 1583 | const tracy = trace(@src()); |
| 1580 | defer tracy.end(); | 1584 | defer tracy.end(); |
| 1581 | | 1585 | |
| ... | @@ -1594,7 +1598,7 @@ fn zirStoreToInferredPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) | ... | @@ -1594,7 +1598,7 @@ fn zirStoreToInferredPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) |
| 1594 | return sema.storePtr(block, src, bitcasted_ptr, value); | 1598 | return sema.storePtr(block, src, bitcasted_ptr, value); |
| 1595 | } | 1599 | } |
| 1596 | | 1600 | |
| 1597 | fn zirSetEvalBranchQuota(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 1601 | fn zirSetEvalBranchQuota(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1598 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 1602 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 1599 | const src = inst_data.src(); | 1603 | const src = inst_data.src(); |
| 1600 | const quota = try sema.resolveAlreadyCoercedInt(block, src, inst_data.operand, u32); | 1604 | const quota = try sema.resolveAlreadyCoercedInt(block, src, inst_data.operand, u32); |
| ... | @@ -1602,7 +1606,7 @@ fn zirSetEvalBranchQuota(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) | ... | @@ -1602,7 +1606,7 @@ fn zirSetEvalBranchQuota(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) |
| 1602 | sema.branch_quota = quota; | 1606 | sema.branch_quota = quota; |
| 1603 | } | 1607 | } |
| 1604 | | 1608 | |
| 1605 | fn zirStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 1609 | fn zirStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1606 | const tracy = trace(@src()); | 1610 | const tracy = trace(@src()); |
| 1607 | defer tracy.end(); | 1611 | defer tracy.end(); |
| 1608 | | 1612 | |
| ... | @@ -1612,7 +1616,7 @@ fn zirStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!v | ... | @@ -1612,7 +1616,7 @@ fn zirStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!v |
| 1612 | return sema.storePtr(block, sema.src, ptr, value); | 1616 | return sema.storePtr(block, sema.src, ptr, value); |
| 1613 | } | 1617 | } |
| 1614 | | 1618 | |
| 1615 | fn zirStoreNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 1619 | fn zirStoreNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1616 | const tracy = trace(@src()); | 1620 | const tracy = trace(@src()); |
| 1617 | defer tracy.end(); | 1621 | defer tracy.end(); |
| 1618 | | 1622 | |
| ... | @@ -1624,7 +1628,7 @@ fn zirStoreNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr | ... | @@ -1624,7 +1628,7 @@ fn zirStoreNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 1624 | return sema.storePtr(block, src, ptr, value); | 1628 | return sema.storePtr(block, src, ptr, value); |
| 1625 | } | 1629 | } |
| 1626 | | 1630 | |
| 1627 | fn zirParamType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1631 | fn zirParamType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1628 | const tracy = trace(@src()); | 1632 | const tracy = trace(@src()); |
| 1629 | defer tracy.end(); | 1633 | defer tracy.end(); |
| 1630 | | 1634 | |
| ... | @@ -1660,7 +1664,7 @@ fn zirParamType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr | ... | @@ -1660,7 +1664,7 @@ fn zirParamType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 1660 | return sema.addType(param_type); | 1664 | return sema.addType(param_type); |
| 1661 | } | 1665 | } |
| 1662 | | 1666 | |
| 1663 | fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1667 | fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1664 | const tracy = trace(@src()); | 1668 | const tracy = trace(@src()); |
| 1665 | defer tracy.end(); | 1669 | defer tracy.end(); |
| 1666 | | 1670 | |
| ... | @@ -1688,7 +1692,7 @@ fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air | ... | @@ -1688,7 +1692,7 @@ fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air |
| 1688 | return sema.analyzeDeclRef(block, .unneeded, new_decl); | 1692 | return sema.analyzeDeclRef(block, .unneeded, new_decl); |
| 1689 | } | 1693 | } |
| 1690 | | 1694 | |
| 1691 | fn zirInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1695 | fn zirInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1692 | _ = block; | 1696 | _ = block; |
| 1693 | const tracy = trace(@src()); | 1697 | const tracy = trace(@src()); |
| 1694 | defer tracy.end(); | 1698 | defer tracy.end(); |
| ... | @@ -1697,7 +1701,7 @@ fn zirInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air | ... | @@ -1697,7 +1701,7 @@ fn zirInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air |
| 1697 | return sema.addIntUnsigned(Type.initTag(.comptime_int), int); | 1701 | return sema.addIntUnsigned(Type.initTag(.comptime_int), int); |
| 1698 | } | 1702 | } |
| 1699 | | 1703 | |
| 1700 | fn zirIntBig(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1704 | fn zirIntBig(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1701 | _ = block; | 1705 | _ = block; |
| 1702 | const tracy = trace(@src()); | 1706 | const tracy = trace(@src()); |
| 1703 | defer tracy.end(); | 1707 | defer tracy.end(); |
| ... | @@ -1715,7 +1719,7 @@ fn zirIntBig(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! | ... | @@ -1715,7 +1719,7 @@ fn zirIntBig(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 1715 | }); | 1719 | }); |
| 1716 | } | 1720 | } |
| 1717 | | 1721 | |
| 1718 | fn zirFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1722 | fn zirFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1719 | _ = block; | 1723 | _ = block; |
| 1720 | const arena = sema.arena; | 1724 | const arena = sema.arena; |
| 1721 | const inst_data = sema.code.instructions.items(.data)[inst].float; | 1725 | const inst_data = sema.code.instructions.items(.data)[inst].float; |
| ... | @@ -1728,7 +1732,7 @@ fn zirFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!A | ... | @@ -1728,7 +1732,7 @@ fn zirFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!A |
| 1728 | }); | 1732 | }); |
| 1729 | } | 1733 | } |
| 1730 | | 1734 | |
| 1731 | fn zirFloat128(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1735 | fn zirFloat128(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1732 | _ = block; | 1736 | _ = block; |
| 1733 | const arena = sema.arena; | 1737 | const arena = sema.arena; |
| 1734 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 1738 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| ... | @@ -1742,7 +1746,7 @@ fn zirFloat128(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro | ... | @@ -1742,7 +1746,7 @@ fn zirFloat128(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 1742 | }); | 1746 | }); |
| 1743 | } | 1747 | } |
| 1744 | | 1748 | |
| 1745 | fn zirCompileError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Zir.Inst.Index { | 1749 | fn zirCompileError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 1746 | const tracy = trace(@src()); | 1750 | const tracy = trace(@src()); |
| 1747 | defer tracy.end(); | 1751 | defer tracy.end(); |
| 1748 | | 1752 | |
| ... | @@ -1757,7 +1761,7 @@ fn zirCompileLog( | ... | @@ -1757,7 +1761,7 @@ fn zirCompileLog( |
| 1757 | sema: *Sema, | 1761 | sema: *Sema, |
| 1758 | block: *Scope.Block, | 1762 | block: *Scope.Block, |
| 1759 | extended: Zir.Inst.Extended.InstData, | 1763 | extended: Zir.Inst.Extended.InstData, |
| 1760 | ) InnerError!Air.Inst.Ref { | 1764 | ) CompileError!Air.Inst.Ref { |
| 1761 | var managed = sema.mod.compile_log_text.toManaged(sema.gpa); | 1765 | var managed = sema.mod.compile_log_text.toManaged(sema.gpa); |
| 1762 | defer sema.mod.compile_log_text = managed.moveToUnmanaged(); | 1766 | defer sema.mod.compile_log_text = managed.moveToUnmanaged(); |
| 1763 | const writer = managed.writer(); | 1767 | const writer = managed.writer(); |
| ... | @@ -1789,7 +1793,7 @@ fn zirCompileLog( | ... | @@ -1789,7 +1793,7 @@ fn zirCompileLog( |
| 1789 | }); | 1793 | }); |
| 1790 | } | 1794 | } |
| 1791 | | 1795 | |
| 1792 | fn zirRepeat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Zir.Inst.Index { | 1796 | fn zirRepeat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 1793 | const tracy = trace(@src()); | 1797 | const tracy = trace(@src()); |
| 1794 | defer tracy.end(); | 1798 | defer tracy.end(); |
| 1795 | | 1799 | |
| ... | @@ -1799,7 +1803,7 @@ fn zirRepeat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! | ... | @@ -1799,7 +1803,7 @@ fn zirRepeat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 1799 | return always_noreturn; | 1803 | return always_noreturn; |
| 1800 | } | 1804 | } |
| 1801 | | 1805 | |
| 1802 | fn zirPanic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Zir.Inst.Index { | 1806 | fn zirPanic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 1803 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 1807 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 1804 | const src: LazySrcLoc = inst_data.src(); | 1808 | const src: LazySrcLoc = inst_data.src(); |
| 1805 | const msg_inst = sema.resolveInst(inst_data.operand); | 1809 | const msg_inst = sema.resolveInst(inst_data.operand); |
| ... | @@ -1807,7 +1811,7 @@ fn zirPanic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Z | ... | @@ -1807,7 +1811,7 @@ fn zirPanic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Z |
| 1807 | return sema.panicWithMsg(block, src, msg_inst); | 1811 | return sema.panicWithMsg(block, src, msg_inst); |
| 1808 | } | 1812 | } |
| 1809 | | 1813 | |
| 1810 | fn zirLoop(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1814 | fn zirLoop(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1811 | const tracy = trace(@src()); | 1815 | const tracy = trace(@src()); |
| 1812 | defer tracy.end(); | 1816 | defer tracy.end(); |
| 1813 | | 1817 | |
| ... | @@ -1872,7 +1876,7 @@ fn zirLoop(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) InnerE | ... | @@ -1872,7 +1876,7 @@ fn zirLoop(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) InnerE |
| 1872 | return sema.analyzeBlockBody(parent_block, src, &child_block, merges); | 1876 | return sema.analyzeBlockBody(parent_block, src, &child_block, merges); |
| 1873 | } | 1877 | } |
| 1874 | | 1878 | |
| 1875 | fn zirCImport(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1879 | fn zirCImport(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1876 | const tracy = trace(@src()); | 1880 | const tracy = trace(@src()); |
| 1877 | defer tracy.end(); | 1881 | defer tracy.end(); |
| 1878 | | 1882 | |
| ... | @@ -1882,13 +1886,13 @@ fn zirCImport(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) Inn | ... | @@ -1882,13 +1886,13 @@ fn zirCImport(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) Inn |
| 1882 | return sema.mod.fail(&parent_block.base, src, "TODO: implement Sema.zirCImport", .{}); | 1886 | return sema.mod.fail(&parent_block.base, src, "TODO: implement Sema.zirCImport", .{}); |
| 1883 | } | 1887 | } |
| 1884 | | 1888 | |
| 1885 | fn zirSuspendBlock(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1889 | fn zirSuspendBlock(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1886 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 1890 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 1887 | const src = inst_data.src(); | 1891 | const src = inst_data.src(); |
| 1888 | return sema.mod.fail(&parent_block.base, src, "TODO: implement Sema.zirSuspendBlock", .{}); | 1892 | return sema.mod.fail(&parent_block.base, src, "TODO: implement Sema.zirSuspendBlock", .{}); |
| 1889 | } | 1893 | } |
| 1890 | | 1894 | |
| 1891 | fn zirBlock(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 1895 | fn zirBlock(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1892 | const tracy = trace(@src()); | 1896 | const tracy = trace(@src()); |
| 1893 | defer tracy.end(); | 1897 | defer tracy.end(); |
| 1894 | | 1898 | |
| ... | @@ -1946,7 +1950,7 @@ fn resolveBlockBody( | ... | @@ -1946,7 +1950,7 @@ fn resolveBlockBody( |
| 1946 | child_block: *Scope.Block, | 1950 | child_block: *Scope.Block, |
| 1947 | body: []const Zir.Inst.Index, | 1951 | body: []const Zir.Inst.Index, |
| 1948 | merges: *Scope.Block.Merges, | 1952 | merges: *Scope.Block.Merges, |
| 1949 | ) InnerError!Air.Inst.Ref { | 1953 | ) CompileError!Air.Inst.Ref { |
| 1950 | _ = try sema.analyzeBody(child_block, body); | 1954 | _ = try sema.analyzeBody(child_block, body); |
| 1951 | return sema.analyzeBlockBody(parent_block, src, child_block, merges); | 1955 | return sema.analyzeBlockBody(parent_block, src, child_block, merges); |
| 1952 | } | 1956 | } |
| ... | @@ -1957,7 +1961,7 @@ fn analyzeBlockBody( | ... | @@ -1957,7 +1961,7 @@ fn analyzeBlockBody( |
| 1957 | src: LazySrcLoc, | 1961 | src: LazySrcLoc, |
| 1958 | child_block: *Scope.Block, | 1962 | child_block: *Scope.Block, |
| 1959 | merges: *Scope.Block.Merges, | 1963 | merges: *Scope.Block.Merges, |
| 1960 | ) InnerError!Air.Inst.Ref { | 1964 | ) CompileError!Air.Inst.Ref { |
| 1961 | const tracy = trace(@src()); | 1965 | const tracy = trace(@src()); |
| 1962 | defer tracy.end(); | 1966 | defer tracy.end(); |
| 1963 | | 1967 | |
| ... | @@ -2033,7 +2037,7 @@ fn analyzeBlockBody( | ... | @@ -2033,7 +2037,7 @@ fn analyzeBlockBody( |
| 2033 | return &merges.block_inst.base; | 2037 | return &merges.block_inst.base; |
| 2034 | } | 2038 | } |
| 2035 | | 2039 | |
| 2036 | fn zirExport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 2040 | fn zirExport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2037 | const tracy = trace(@src()); | 2041 | const tracy = trace(@src()); |
| 2038 | defer tracy.end(); | 2042 | defer tracy.end(); |
| 2039 | | 2043 | |
| ... | @@ -2069,13 +2073,13 @@ fn zirExport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! | ... | @@ -2069,13 +2073,13 @@ fn zirExport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 2069 | try sema.mod.analyzeExport(&block.base, src, export_name, decl); | 2073 | try sema.mod.analyzeExport(&block.base, src, export_name, decl); |
| 2070 | } | 2074 | } |
| 2071 | | 2075 | |
| 2072 | fn zirSetAlignStack(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 2076 | fn zirSetAlignStack(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2073 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 2077 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2074 | const src: LazySrcLoc = inst_data.src(); | 2078 | const src: LazySrcLoc = inst_data.src(); |
| 2075 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirSetAlignStack", .{}); | 2079 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirSetAlignStack", .{}); |
| 2076 | } | 2080 | } |
| 2077 | | 2081 | |
| 2078 | fn zirSetCold(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 2082 | fn zirSetCold(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2079 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 2083 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2080 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 2084 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 2081 | const is_cold = try sema.resolveConstBool(block, operand_src, inst_data.operand); | 2085 | const is_cold = try sema.resolveConstBool(block, operand_src, inst_data.operand); |
| ... | @@ -2083,19 +2087,19 @@ fn zirSetCold(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError | ... | @@ -2083,19 +2087,19 @@ fn zirSetCold(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 2083 | func.is_cold = is_cold; | 2087 | func.is_cold = is_cold; |
| 2084 | } | 2088 | } |
| 2085 | | 2089 | |
| 2086 | fn zirSetFloatMode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 2090 | fn zirSetFloatMode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2087 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 2091 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2088 | const src: LazySrcLoc = inst_data.src(); | 2092 | const src: LazySrcLoc = inst_data.src(); |
| 2089 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirSetFloatMode", .{}); | 2093 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirSetFloatMode", .{}); |
| 2090 | } | 2094 | } |
| 2091 | | 2095 | |
| 2092 | fn zirSetRuntimeSafety(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 2096 | fn zirSetRuntimeSafety(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2093 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 2097 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2094 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 2098 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 2095 | block.want_safety = try sema.resolveConstBool(block, operand_src, inst_data.operand); | 2099 | block.want_safety = try sema.resolveConstBool(block, operand_src, inst_data.operand); |
| 2096 | } | 2100 | } |
| 2097 | | 2101 | |
| 2098 | fn zirBreakpoint(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 2102 | fn zirBreakpoint(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2099 | const tracy = trace(@src()); | 2103 | const tracy = trace(@src()); |
| 2100 | defer tracy.end(); | 2104 | defer tracy.end(); |
| 2101 | | 2105 | |
| ... | @@ -2105,13 +2109,13 @@ fn zirBreakpoint(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr | ... | @@ -2105,13 +2109,13 @@ fn zirBreakpoint(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 2105 | _ = try block.addNoOp(src, Type.initTag(.void), .breakpoint); | 2109 | _ = try block.addNoOp(src, Type.initTag(.void), .breakpoint); |
| 2106 | } | 2110 | } |
| 2107 | | 2111 | |
| 2108 | fn zirFence(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 2112 | fn zirFence(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2109 | const src_node = sema.code.instructions.items(.data)[inst].node; | 2113 | const src_node = sema.code.instructions.items(.data)[inst].node; |
| 2110 | const src: LazySrcLoc = .{ .node_offset = src_node }; | 2114 | const src: LazySrcLoc = .{ .node_offset = src_node }; |
| 2111 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirFence", .{}); | 2115 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirFence", .{}); |
| 2112 | } | 2116 | } |
| 2113 | | 2117 | |
| 2114 | fn zirBreak(sema: *Sema, start_block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Zir.Inst.Index { | 2118 | fn zirBreak(sema: *Sema, start_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 2115 | const tracy = trace(@src()); | 2119 | const tracy = trace(@src()); |
| 2116 | defer tracy.end(); | 2120 | defer tracy.end(); |
| 2117 | | 2121 | |
| ... | @@ -2151,7 +2155,7 @@ fn zirBreak(sema: *Sema, start_block: *Scope.Block, inst: Zir.Inst.Index) InnerE | ... | @@ -2151,7 +2155,7 @@ fn zirBreak(sema: *Sema, start_block: *Scope.Block, inst: Zir.Inst.Index) InnerE |
| 2151 | } | 2155 | } |
| 2152 | } | 2156 | } |
| 2153 | | 2157 | |
| 2154 | fn zirDbgStmt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 2158 | fn zirDbgStmt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2155 | const tracy = trace(@src()); | 2159 | const tracy = trace(@src()); |
| 2156 | defer tracy.end(); | 2160 | defer tracy.end(); |
| 2157 | | 2161 | |
| ... | @@ -2165,7 +2169,7 @@ fn zirDbgStmt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError | ... | @@ -2165,7 +2169,7 @@ fn zirDbgStmt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 2165 | _ = try block.addDbgStmt(.unneeded, inst_data.line, inst_data.column); | 2169 | _ = try block.addDbgStmt(.unneeded, inst_data.line, inst_data.column); |
| 2166 | } | 2170 | } |
| 2167 | | 2171 | |
| 2168 | fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2172 | fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2169 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; | 2173 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; |
| 2170 | const src = inst_data.src(); | 2174 | const src = inst_data.src(); |
| 2171 | const decl_name = inst_data.get(sema.code); | 2175 | const decl_name = inst_data.get(sema.code); |
| ... | @@ -2173,7 +2177,7 @@ fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError | ... | @@ -2173,7 +2177,7 @@ fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 2173 | return sema.analyzeDeclRef(block, src, decl); | 2177 | return sema.analyzeDeclRef(block, src, decl); |
| 2174 | } | 2178 | } |
| 2175 | | 2179 | |
| 2176 | fn zirDeclVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2180 | fn zirDeclVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2177 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; | 2181 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; |
| 2178 | const src = inst_data.src(); | 2182 | const src = inst_data.src(); |
| 2179 | const decl_name = inst_data.get(sema.code); | 2183 | const decl_name = inst_data.get(sema.code); |
| ... | @@ -2199,7 +2203,7 @@ fn lookupInNamespace( | ... | @@ -2199,7 +2203,7 @@ fn lookupInNamespace( |
| 2199 | sema: *Sema, | 2203 | sema: *Sema, |
| 2200 | namespace: *Scope.Namespace, | 2204 | namespace: *Scope.Namespace, |
| 2201 | ident_name: []const u8, | 2205 | ident_name: []const u8, |
| 2202 | ) InnerError!?*Decl { | 2206 | ) CompileError!?*Decl { |
| 2203 | const namespace_decl = namespace.getDecl(); | 2207 | const namespace_decl = namespace.getDecl(); |
| 2204 | if (namespace_decl.analysis == .file_failure) { | 2208 | if (namespace_decl.analysis == .file_failure) { |
| 2205 | try sema.mod.declareDeclDependency(sema.owner_decl, namespace_decl); | 2209 | try sema.mod.declareDeclDependency(sema.owner_decl, namespace_decl); |
| ... | @@ -2227,7 +2231,7 @@ fn zirCall( | ... | @@ -2227,7 +2231,7 @@ fn zirCall( |
| 2227 | inst: Zir.Inst.Index, | 2231 | inst: Zir.Inst.Index, |
| 2228 | modifier: std.builtin.CallOptions.Modifier, | 2232 | modifier: std.builtin.CallOptions.Modifier, |
| 2229 | ensure_result_used: bool, | 2233 | ensure_result_used: bool, |
| 2230 | ) InnerError!Air.Inst.Ref { | 2234 | ) CompileError!Air.Inst.Ref { |
| 2231 | const tracy = trace(@src()); | 2235 | const tracy = trace(@src()); |
| 2232 | defer tracy.end(); | 2236 | defer tracy.end(); |
| 2233 | | 2237 | |
| ... | @@ -2257,7 +2261,7 @@ fn analyzeCall( | ... | @@ -2257,7 +2261,7 @@ fn analyzeCall( |
| 2257 | modifier: std.builtin.CallOptions.Modifier, | 2261 | modifier: std.builtin.CallOptions.Modifier, |
| 2258 | ensure_result_used: bool, | 2262 | ensure_result_used: bool, |
| 2259 | args: []const Air.Inst.Ref, | 2263 | args: []const Air.Inst.Ref, |
| 2260 | ) InnerError!Air.Inst.Ref { | 2264 | ) CompileError!Air.Inst.Ref { |
| 2261 | if (func.ty.zigTypeTag() != .Fn) | 2265 | if (func.ty.zigTypeTag() != .Fn) |
| 2262 | return sema.mod.fail(&block.base, func_src, "type '{}' not a function", .{func.ty}); | 2266 | return sema.mod.fail(&block.base, func_src, "type '{}' not a function", .{func.ty}); |
| 2263 | | 2267 | |
| ... | @@ -2412,7 +2416,7 @@ fn analyzeCall( | ... | @@ -2412,7 +2416,7 @@ fn analyzeCall( |
| 2412 | return result; | 2416 | return result; |
| 2413 | } | 2417 | } |
| 2414 | | 2418 | |
| 2415 | fn zirIntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2419 | fn zirIntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2416 | _ = block; | 2420 | _ = block; |
| 2417 | const tracy = trace(@src()); | 2421 | const tracy = trace(@src()); |
| 2418 | defer tracy.end(); | 2422 | defer tracy.end(); |
| ... | @@ -2423,7 +2427,7 @@ fn zirIntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError | ... | @@ -2423,7 +2427,7 @@ fn zirIntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 2423 | return sema.addType(ty); | 2427 | return sema.addType(ty); |
| 2424 | } | 2428 | } |
| 2425 | | 2429 | |
| 2426 | fn zirOptionalType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2430 | fn zirOptionalType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2427 | const tracy = trace(@src()); | 2431 | const tracy = trace(@src()); |
| 2428 | defer tracy.end(); | 2432 | defer tracy.end(); |
| 2429 | | 2433 | |
| ... | @@ -2435,7 +2439,7 @@ fn zirOptionalType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner | ... | @@ -2435,7 +2439,7 @@ fn zirOptionalType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner |
| 2435 | return sema.addType(opt_type); | 2439 | return sema.addType(opt_type); |
| 2436 | } | 2440 | } |
| 2437 | | 2441 | |
| 2438 | fn zirElemType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2442 | fn zirElemType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2439 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 2443 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2440 | const src = inst_data.src(); | 2444 | const src = inst_data.src(); |
| 2441 | const array_type = try sema.resolveType(block, src, inst_data.operand); | 2445 | const array_type = try sema.resolveType(block, src, inst_data.operand); |
| ... | @@ -2443,7 +2447,7 @@ fn zirElemType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro | ... | @@ -2443,7 +2447,7 @@ fn zirElemType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 2443 | return sema.addType(elem_type); | 2447 | return sema.addType(elem_type); |
| 2444 | } | 2448 | } |
| 2445 | | 2449 | |
| 2446 | fn zirVectorType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2450 | fn zirVectorType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2447 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 2451 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 2448 | const elem_type_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 2452 | const elem_type_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 2449 | const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 2453 | const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| ... | @@ -2457,7 +2461,7 @@ fn zirVectorType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr | ... | @@ -2457,7 +2461,7 @@ fn zirVectorType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 2457 | return sema.addType(vector_type); | 2461 | return sema.addType(vector_type); |
| 2458 | } | 2462 | } |
| 2459 | | 2463 | |
| 2460 | fn zirArrayType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2464 | fn zirArrayType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2461 | const tracy = trace(@src()); | 2465 | const tracy = trace(@src()); |
| 2462 | defer tracy.end(); | 2466 | defer tracy.end(); |
| 2463 | | 2467 | |
| ... | @@ -2470,7 +2474,7 @@ fn zirArrayType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr | ... | @@ -2470,7 +2474,7 @@ fn zirArrayType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 2470 | return sema.addType(array_ty); | 2474 | return sema.addType(array_ty); |
| 2471 | } | 2475 | } |
| 2472 | | 2476 | |
| 2473 | fn zirArrayTypeSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2477 | fn zirArrayTypeSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2474 | const tracy = trace(@src()); | 2478 | const tracy = trace(@src()); |
| 2475 | defer tracy.end(); | 2479 | defer tracy.end(); |
| 2476 | | 2480 | |
| ... | @@ -2485,7 +2489,7 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) | ... | @@ -2485,7 +2489,7 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) |
| 2485 | return sema.addType(array_ty); | 2489 | return sema.addType(array_ty); |
| 2486 | } | 2490 | } |
| 2487 | | 2491 | |
| 2488 | fn zirAnyframeType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2492 | fn zirAnyframeType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2489 | const tracy = trace(@src()); | 2493 | const tracy = trace(@src()); |
| 2490 | defer tracy.end(); | 2494 | defer tracy.end(); |
| 2491 | | 2495 | |
| ... | @@ -2497,7 +2501,7 @@ fn zirAnyframeType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner | ... | @@ -2497,7 +2501,7 @@ fn zirAnyframeType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner |
| 2497 | return sema.addType(anyframe_type); | 2501 | return sema.addType(anyframe_type); |
| 2498 | } | 2502 | } |
| 2499 | | 2503 | |
| 2500 | fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2504 | fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2501 | const tracy = trace(@src()); | 2505 | const tracy = trace(@src()); |
| 2502 | defer tracy.end(); | 2506 | defer tracy.end(); |
| 2503 | | 2507 | |
| ... | @@ -2517,7 +2521,7 @@ fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inn | ... | @@ -2517,7 +2521,7 @@ fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inn |
| 2517 | return sema.addType(err_union_ty); | 2521 | return sema.addType(err_union_ty); |
| 2518 | } | 2522 | } |
| 2519 | | 2523 | |
| 2520 | fn zirErrorValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2524 | fn zirErrorValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2521 | _ = block; | 2525 | _ = block; |
| 2522 | const tracy = trace(@src()); | 2526 | const tracy = trace(@src()); |
| 2523 | defer tracy.end(); | 2527 | defer tracy.end(); |
| ... | @@ -2536,7 +2540,7 @@ fn zirErrorValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr | ... | @@ -2536,7 +2540,7 @@ fn zirErrorValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 2536 | }); | 2540 | }); |
| 2537 | } | 2541 | } |
| 2538 | | 2542 | |
| 2539 | fn zirErrorToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2543 | fn zirErrorToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2540 | const tracy = trace(@src()); | 2544 | const tracy = trace(@src()); |
| 2541 | defer tracy.end(); | 2545 | defer tracy.end(); |
| 2542 | | 2546 | |
| ... | @@ -2566,7 +2570,7 @@ fn zirErrorToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr | ... | @@ -2566,7 +2570,7 @@ fn zirErrorToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 2566 | return block.addTyOp(.bitcast, result_ty, op_coerced); | 2570 | return block.addTyOp(.bitcast, result_ty, op_coerced); |
| 2567 | } | 2571 | } |
| 2568 | | 2572 | |
| 2569 | fn zirIntToError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2573 | fn zirIntToError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2570 | const tracy = trace(@src()); | 2574 | const tracy = trace(@src()); |
| 2571 | defer tracy.end(); | 2575 | defer tracy.end(); |
| 2572 | | 2576 | |
| ... | @@ -2599,7 +2603,7 @@ fn zirIntToError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr | ... | @@ -2599,7 +2603,7 @@ fn zirIntToError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 2599 | return block.addTyOp(.bitcast, Type.initTag(.anyerror), op); | 2603 | return block.addTyOp(.bitcast, Type.initTag(.anyerror), op); |
| 2600 | } | 2604 | } |
| 2601 | | 2605 | |
| 2602 | fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2606 | fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2603 | const tracy = trace(@src()); | 2607 | const tracy = trace(@src()); |
| 2604 | defer tracy.end(); | 2608 | defer tracy.end(); |
| 2605 | | 2609 | |
| ... | @@ -2689,7 +2693,7 @@ fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inn | ... | @@ -2689,7 +2693,7 @@ fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inn |
| 2689 | }); | 2693 | }); |
| 2690 | } | 2694 | } |
| 2691 | | 2695 | |
| 2692 | fn zirEnumLiteral(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2696 | fn zirEnumLiteral(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2693 | _ = block; | 2697 | _ = block; |
| 2694 | const tracy = trace(@src()); | 2698 | const tracy = trace(@src()); |
| 2695 | defer tracy.end(); | 2699 | defer tracy.end(); |
| ... | @@ -2703,7 +2707,7 @@ fn zirEnumLiteral(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE | ... | @@ -2703,7 +2707,7 @@ fn zirEnumLiteral(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE |
| 2703 | }); | 2707 | }); |
| 2704 | } | 2708 | } |
| 2705 | | 2709 | |
| 2706 | fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2710 | fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2707 | const mod = sema.mod; | 2711 | const mod = sema.mod; |
| 2708 | const arena = sema.arena; | 2712 | const arena = sema.arena; |
| 2709 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 2713 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| ... | @@ -2741,7 +2745,7 @@ fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr | ... | @@ -2741,7 +2745,7 @@ fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 2741 | }); | 2745 | }); |
| 2742 | } | 2746 | } |
| 2743 | | 2747 | |
| 2744 | if (enum_tag.value()) |enum_tag_val| { | 2748 | if (try sema.resolvePossiblyUndefinedValue(block, operand_src, enum_tag)) |enum_tag_val| { |
| 2745 | if (enum_tag_val.castTag(.enum_field_index)) |enum_field_payload| { | 2749 | if (enum_tag_val.castTag(.enum_field_index)) |enum_field_payload| { |
| 2746 | const field_index = enum_field_payload.data; | 2750 | const field_index = enum_field_payload.data; |
| 2747 | switch (enum_tag.ty.tag()) { | 2751 | switch (enum_tag.ty.tag()) { |
| ... | @@ -2785,7 +2789,7 @@ fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr | ... | @@ -2785,7 +2789,7 @@ fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 2785 | return block.addTyOp(.bitcast, int_tag_ty, enum_tag); | 2789 | return block.addTyOp(.bitcast, int_tag_ty, enum_tag); |
| 2786 | } | 2790 | } |
| 2787 | | 2791 | |
| 2788 | fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 2792 | fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2789 | const mod = sema.mod; | 2793 | const mod = sema.mod; |
| 2790 | const target = mod.getTarget(); | 2794 | const target = mod.getTarget(); |
| 2791 | const arena = sema.arena; | 2795 | const arena = sema.arena; |
| ... | @@ -2801,16 +2805,16 @@ fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr | ... | @@ -2801,16 +2805,16 @@ fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 2801 | return mod.fail(&block.base, dest_ty_src, "expected enum, found {}", .{dest_ty}); | 2805 | return mod.fail(&block.base, dest_ty_src, "expected enum, found {}", .{dest_ty}); |
| 2802 | } | 2806 | } |
| 2803 | | 2807 | |
| 2804 | if (dest_ty.isNonexhaustiveEnum()) { | 2808 | if (try sema.resolvePossiblyUndefinedValue(block, operand_src, operand)) |int_val| { |
| 2805 | if (operand.value()) |int_val| { | 2809 | if (dest_ty.isNonexhaustiveEnum()) { |
| 2806 | return mod.constInst(arena, src, .{ | 2810 | return mod.constInst(arena, src, .{ |
| 2807 | .ty = dest_ty, | 2811 | .ty = dest_ty, |
| 2808 | .val = int_val, | 2812 | .val = int_val, |
| 2809 | }); | 2813 | }); |
| 2810 | } | 2814 | } |
| 2811 | } | 2815 | if (int_val.isUndef()) { |
| 2812 | | 2816 | return sema.failWithUseOfUndef(block, operand_src); |
| 2813 | if (try sema.resolveDefinedValue(block, operand_src, operand)) |int_val| { | 2817 | } |
| 2814 | if (!dest_ty.enumHasInt(int_val, target)) { | 2818 | if (!dest_ty.enumHasInt(int_val, target)) { |
| 2815 | const msg = msg: { | 2819 | const msg = msg: { |
| 2816 | const msg = try mod.errMsg( | 2820 | const msg = try mod.errMsg( |
| ... | @@ -2846,7 +2850,7 @@ fn zirOptionalPayloadPtr( | ... | @@ -2846,7 +2850,7 @@ fn zirOptionalPayloadPtr( |
| 2846 | block: *Scope.Block, | 2850 | block: *Scope.Block, |
| 2847 | inst: Zir.Inst.Index, | 2851 | inst: Zir.Inst.Index, |
| 2848 | safety_check: bool, | 2852 | safety_check: bool, |
| 2849 | ) InnerError!Air.Inst.Ref { | 2853 | ) CompileError!Air.Inst.Ref { |
| 2850 | const tracy = trace(@src()); | 2854 | const tracy = trace(@src()); |
| 2851 | defer tracy.end(); | 2855 | defer tracy.end(); |
| 2852 | | 2856 | |
| ... | @@ -2863,7 +2867,7 @@ fn zirOptionalPayloadPtr( | ... | @@ -2863,7 +2867,7 @@ fn zirOptionalPayloadPtr( |
| 2863 | const child_type = try opt_type.optionalChildAlloc(sema.arena); | 2867 | const child_type = try opt_type.optionalChildAlloc(sema.arena); |
| 2864 | const child_pointer = try Module.simplePtrType(sema.arena, child_type, !optional_ptr.ty.isConstPtr(), .One); | 2868 | const child_pointer = try Module.simplePtrType(sema.arena, child_type, !optional_ptr.ty.isConstPtr(), .One); |
| 2865 | | 2869 | |
| 2866 | if (optional_ptr.value()) |pointer_val| { | 2870 | if (try sema.resolveDefinedValue(block, src, optional_ptr)) |pointer_val| { |
| 2867 | const val = try pointer_val.pointerDeref(sema.arena); | 2871 | const val = try pointer_val.pointerDeref(sema.arena); |
| 2868 | if (val.isNull()) { | 2872 | if (val.isNull()) { |
| 2869 | return sema.mod.fail(&block.base, src, "unable to unwrap null", .{}); | 2873 | return sema.mod.fail(&block.base, src, "unable to unwrap null", .{}); |
| ... | @@ -2889,7 +2893,7 @@ fn zirOptionalPayload( | ... | @@ -2889,7 +2893,7 @@ fn zirOptionalPayload( |
| 2889 | block: *Scope.Block, | 2893 | block: *Scope.Block, |
| 2890 | inst: Zir.Inst.Index, | 2894 | inst: Zir.Inst.Index, |
| 2891 | safety_check: bool, | 2895 | safety_check: bool, |
| 2892 | ) InnerError!Air.Inst.Ref { | 2896 | ) CompileError!Air.Inst.Ref { |
| 2893 | const tracy = trace(@src()); | 2897 | const tracy = trace(@src()); |
| 2894 | defer tracy.end(); | 2898 | defer tracy.end(); |
| 2895 | | 2899 | |
| ... | @@ -2903,7 +2907,7 @@ fn zirOptionalPayload( | ... | @@ -2903,7 +2907,7 @@ fn zirOptionalPayload( |
| 2903 | | 2907 | |
| 2904 | const child_type = try opt_type.optionalChildAlloc(sema.arena); | 2908 | const child_type = try opt_type.optionalChildAlloc(sema.arena); |
| 2905 | | 2909 | |
| 2906 | if (operand.value()) |val| { | 2910 | if (try sema.resolveDefinedValue(block, src, operand)) |val| { |
| 2907 | if (val.isNull()) { | 2911 | if (val.isNull()) { |
| 2908 | return sema.mod.fail(&block.base, src, "unable to unwrap null", .{}); | 2912 | return sema.mod.fail(&block.base, src, "unable to unwrap null", .{}); |
| 2909 | } | 2913 | } |
| ... | @@ -2927,7 +2931,7 @@ fn zirErrUnionPayload( | ... | @@ -2927,7 +2931,7 @@ fn zirErrUnionPayload( |
| 2927 | block: *Scope.Block, | 2931 | block: *Scope.Block, |
| 2928 | inst: Zir.Inst.Index, | 2932 | inst: Zir.Inst.Index, |
| 2929 | safety_check: bool, | 2933 | safety_check: bool, |
| 2930 | ) InnerError!Air.Inst.Ref { | 2934 | ) CompileError!Air.Inst.Ref { |
| 2931 | const tracy = trace(@src()); | 2935 | const tracy = trace(@src()); |
| 2932 | defer tracy.end(); | 2936 | defer tracy.end(); |
| 2933 | | 2937 | |
| ... | @@ -2937,7 +2941,7 @@ fn zirErrUnionPayload( | ... | @@ -2937,7 +2941,7 @@ fn zirErrUnionPayload( |
| 2937 | if (operand.ty.zigTypeTag() != .ErrorUnion) | 2941 | if (operand.ty.zigTypeTag() != .ErrorUnion) |
| 2938 | return sema.mod.fail(&block.base, operand.src, "expected error union type, found '{}'", .{operand.ty}); | 2942 | return sema.mod.fail(&block.base, operand.src, "expected error union type, found '{}'", .{operand.ty}); |
| 2939 | | 2943 | |
| 2940 | if (operand.value()) |val| { | 2944 | if (try sema.resolveDefinedValue(block, src, operand)) |val| { |
| 2941 | if (val.getError()) |name| { | 2945 | if (val.getError()) |name| { |
| 2942 | return sema.mod.fail(&block.base, src, "caught unexpected error '{s}'", .{name}); | 2946 | return sema.mod.fail(&block.base, src, "caught unexpected error '{s}'", .{name}); |
| 2943 | } | 2947 | } |
| ... | @@ -2962,7 +2966,7 @@ fn zirErrUnionPayloadPtr( | ... | @@ -2962,7 +2966,7 @@ fn zirErrUnionPayloadPtr( |
| 2962 | block: *Scope.Block, | 2966 | block: *Scope.Block, |
| 2963 | inst: Zir.Inst.Index, | 2967 | inst: Zir.Inst.Index, |
| 2964 | safety_check: bool, | 2968 | safety_check: bool, |
| 2965 | ) InnerError!Air.Inst.Ref { | 2969 | ) CompileError!Air.Inst.Ref { |
| 2966 | const tracy = trace(@src()); | 2970 | const tracy = trace(@src()); |
| 2967 | defer tracy.end(); | 2971 | defer tracy.end(); |
| 2968 | | 2972 | |
| ... | @@ -2976,7 +2980,7 @@ fn zirErrUnionPayloadPtr( | ... | @@ -2976,7 +2980,7 @@ fn zirErrUnionPayloadPtr( |
| 2976 | | 2980 | |
| 2977 | const operand_pointer_ty = try Module.simplePtrType(sema.arena, operand.ty.elemType().castTag(.error_union).?.data.payload, !operand.ty.isConstPtr(), .One); | 2981 | const operand_pointer_ty = try Module.simplePtrType(sema.arena, operand.ty.elemType().castTag(.error_union).?.data.payload, !operand.ty.isConstPtr(), .One); |
| 2978 | | 2982 | |
| 2979 | if (operand.value()) |pointer_val| { | 2983 | if (try sema.resolveDefinedValue(block, src, operand)) |pointer_val| { |
| 2980 | const val = try pointer_val.pointerDeref(sema.arena); | 2984 | const val = try pointer_val.pointerDeref(sema.arena); |
| 2981 | if (val.getError()) |name| { | 2985 | if (val.getError()) |name| { |
| 2982 | return sema.mod.fail(&block.base, src, "caught unexpected error '{s}'", .{name}); | 2986 | return sema.mod.fail(&block.base, src, "caught unexpected error '{s}'", .{name}); |
| ... | @@ -3001,7 +3005,7 @@ fn zirErrUnionPayloadPtr( | ... | @@ -3001,7 +3005,7 @@ fn zirErrUnionPayloadPtr( |
| 3001 | } | 3005 | } |
| 3002 | | 3006 | |
| 3003 | /// Value in, value out | 3007 | /// Value in, value out |
| 3004 | fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3008 | fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3005 | const tracy = trace(@src()); | 3009 | const tracy = trace(@src()); |
| 3006 | defer tracy.end(); | 3010 | defer tracy.end(); |
| 3007 | | 3011 | |
| ... | @@ -3013,7 +3017,7 @@ fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner | ... | @@ -3013,7 +3017,7 @@ fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner |
| 3013 | | 3017 | |
| 3014 | const result_ty = operand.ty.castTag(.error_union).?.data.error_set; | 3018 | const result_ty = operand.ty.castTag(.error_union).?.data.error_set; |
| 3015 | | 3019 | |
| 3016 | if (operand.value()) |val| { | 3020 | if (try sema.resolveDefinedValue(block, src, operand)) |val| { |
| 3017 | assert(val.getError() != null); | 3021 | assert(val.getError() != null); |
| 3018 | const data = val.castTag(.error_union).?.data; | 3022 | const data = val.castTag(.error_union).?.data; |
| 3019 | return sema.mod.constInst(sema.arena, src, .{ | 3023 | return sema.mod.constInst(sema.arena, src, .{ |
| ... | @@ -3027,7 +3031,7 @@ fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner | ... | @@ -3027,7 +3031,7 @@ fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner |
| 3027 | } | 3031 | } |
| 3028 | | 3032 | |
| 3029 | /// Pointer in, value out | 3033 | /// Pointer in, value out |
| 3030 | fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3034 | fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3031 | const tracy = trace(@src()); | 3035 | const tracy = trace(@src()); |
| 3032 | defer tracy.end(); | 3036 | defer tracy.end(); |
| 3033 | | 3037 | |
| ... | @@ -3041,7 +3045,7 @@ fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In | ... | @@ -3041,7 +3045,7 @@ fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In |
| 3041 | | 3045 | |
| 3042 | const result_ty = operand.ty.elemType().castTag(.error_union).?.data.error_set; | 3046 | const result_ty = operand.ty.elemType().castTag(.error_union).?.data.error_set; |
| 3043 | | 3047 | |
| 3044 | if (operand.value()) |pointer_val| { | 3048 | if (try sema.resolveDefinedValue(block, src, operand)) |pointer_val| { |
| 3045 | const val = try pointer_val.pointerDeref(sema.arena); | 3049 | const val = try pointer_val.pointerDeref(sema.arena); |
| 3046 | assert(val.getError() != null); | 3050 | assert(val.getError() != null); |
| 3047 | const data = val.castTag(.error_union).?.data; | 3051 | const data = val.castTag(.error_union).?.data; |
| ... | @@ -3055,7 +3059,7 @@ fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In | ... | @@ -3055,7 +3059,7 @@ fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In |
| 3055 | return block.addTyOp(.unwrap_errunion_err_ptr, result_ty, operand); | 3059 | return block.addTyOp(.unwrap_errunion_err_ptr, result_ty, operand); |
| 3056 | } | 3060 | } |
| 3057 | | 3061 | |
| 3058 | fn zirEnsureErrPayloadVoid(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { | 3062 | fn zirEnsureErrPayloadVoid(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 3059 | const tracy = trace(@src()); | 3063 | const tracy = trace(@src()); |
| 3060 | defer tracy.end(); | 3064 | defer tracy.end(); |
| 3061 | | 3065 | |
| ... | @@ -3074,7 +3078,7 @@ fn zirFunc( | ... | @@ -3074,7 +3078,7 @@ fn zirFunc( |
| 3074 | block: *Scope.Block, | 3078 | block: *Scope.Block, |
| 3075 | inst: Zir.Inst.Index, | 3079 | inst: Zir.Inst.Index, |
| 3076 | inferred_error_set: bool, | 3080 | inferred_error_set: bool, |
| 3077 | ) InnerError!Air.Inst.Ref { | 3081 | ) CompileError!Air.Inst.Ref { |
| 3078 | const tracy = trace(@src()); | 3082 | const tracy = trace(@src()); |
| 3079 | defer tracy.end(); | 3083 | defer tracy.end(); |
| 3080 | | 3084 | |
| ... | @@ -3125,7 +3129,7 @@ fn funcCommon( | ... | @@ -3125,7 +3129,7 @@ fn funcCommon( |
| 3125 | is_extern: bool, | 3129 | is_extern: bool, |
| 3126 | src_locs: Zir.Inst.Func.SrcLocs, | 3130 | src_locs: Zir.Inst.Func.SrcLocs, |
| 3127 | opt_lib_name: ?[]const u8, | 3131 | opt_lib_name: ?[]const u8, |
| 3128 | ) InnerError!Air.Inst.Ref { | 3132 | ) CompileError!Air.Inst.Ref { |
| 3129 | const src: LazySrcLoc = .{ .node_offset = src_node_offset }; | 3133 | const src: LazySrcLoc = .{ .node_offset = src_node_offset }; |
| 3130 | const ret_ty_src: LazySrcLoc = .{ .node_offset_fn_type_ret_ty = src_node_offset }; | 3134 | const ret_ty_src: LazySrcLoc = .{ .node_offset_fn_type_ret_ty = src_node_offset }; |
| 3131 | const bare_return_type = try sema.resolveType(block, ret_ty_src, zir_return_type); | 3135 | const bare_return_type = try sema.resolveType(block, ret_ty_src, zir_return_type); |
| ... | @@ -3266,7 +3270,7 @@ fn funcCommon( | ... | @@ -3266,7 +3270,7 @@ fn funcCommon( |
| 3266 | return result; | 3270 | return result; |
| 3267 | } | 3271 | } |
| 3268 | | 3272 | |
| 3269 | fn zirAs(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3273 | fn zirAs(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3270 | const tracy = trace(@src()); | 3274 | const tracy = trace(@src()); |
| 3271 | defer tracy.end(); | 3275 | defer tracy.end(); |
| 3272 | | 3276 | |
| ... | @@ -3274,7 +3278,7 @@ fn zirAs(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air. | ... | @@ -3274,7 +3278,7 @@ fn zirAs(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air. |
| 3274 | return sema.analyzeAs(block, .unneeded, bin_inst.lhs, bin_inst.rhs); | 3278 | return sema.analyzeAs(block, .unneeded, bin_inst.lhs, bin_inst.rhs); |
| 3275 | } | 3279 | } |
| 3276 | | 3280 | |
| 3277 | fn zirAsNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3281 | fn zirAsNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3278 | const tracy = trace(@src()); | 3282 | const tracy = trace(@src()); |
| 3279 | defer tracy.end(); | 3283 | defer tracy.end(); |
| 3280 | | 3284 | |
| ... | @@ -3290,13 +3294,13 @@ fn analyzeAs( | ... | @@ -3290,13 +3294,13 @@ fn analyzeAs( |
| 3290 | src: LazySrcLoc, | 3294 | src: LazySrcLoc, |
| 3291 | zir_dest_type: Zir.Inst.Ref, | 3295 | zir_dest_type: Zir.Inst.Ref, |
| 3292 | zir_operand: Zir.Inst.Ref, | 3296 | zir_operand: Zir.Inst.Ref, |
| 3293 | ) InnerError!Air.Inst.Ref { | 3297 | ) CompileError!Air.Inst.Ref { |
| 3294 | const dest_type = try sema.resolveType(block, src, zir_dest_type); | 3298 | const dest_type = try sema.resolveType(block, src, zir_dest_type); |
| 3295 | const operand = sema.resolveInst(zir_operand); | 3299 | const operand = sema.resolveInst(zir_operand); |
| 3296 | return sema.coerce(block, dest_type, operand, src); | 3300 | return sema.coerce(block, dest_type, operand, src); |
| 3297 | } | 3301 | } |
| 3298 | | 3302 | |
| 3299 | fn zirPtrToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3303 | fn zirPtrToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3300 | const tracy = trace(@src()); | 3304 | const tracy = trace(@src()); |
| 3301 | defer tracy.end(); | 3305 | defer tracy.end(); |
| 3302 | | 3306 | |
| ... | @@ -3312,7 +3316,7 @@ fn zirPtrToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro | ... | @@ -3312,7 +3316,7 @@ fn zirPtrToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 3312 | return block.addUnOp(.ptrtoint, ptr); | 3316 | return block.addUnOp(.ptrtoint, ptr); |
| 3313 | } | 3317 | } |
| 3314 | | 3318 | |
| 3315 | fn zirFieldVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3319 | fn zirFieldVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3316 | const tracy = trace(@src()); | 3320 | const tracy = trace(@src()); |
| 3317 | defer tracy.end(); | 3321 | defer tracy.end(); |
| 3318 | | 3322 | |
| ... | @@ -3330,7 +3334,7 @@ fn zirFieldVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro | ... | @@ -3330,7 +3334,7 @@ fn zirFieldVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 3330 | return sema.analyzeLoad(block, src, result_ptr, result_ptr.src); | 3334 | return sema.analyzeLoad(block, src, result_ptr, result_ptr.src); |
| 3331 | } | 3335 | } |
| 3332 | | 3336 | |
| 3333 | fn zirFieldPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3337 | fn zirFieldPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3334 | const tracy = trace(@src()); | 3338 | const tracy = trace(@src()); |
| 3335 | defer tracy.end(); | 3339 | defer tracy.end(); |
| 3336 | | 3340 | |
| ... | @@ -3343,7 +3347,7 @@ fn zirFieldPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro | ... | @@ -3343,7 +3347,7 @@ fn zirFieldPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 3343 | return sema.namedFieldPtr(block, src, object_ptr, field_name, field_name_src); | 3347 | return sema.namedFieldPtr(block, src, object_ptr, field_name, field_name_src); |
| 3344 | } | 3348 | } |
| 3345 | | 3349 | |
| 3346 | fn zirFieldValNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3350 | fn zirFieldValNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3347 | const tracy = trace(@src()); | 3351 | const tracy = trace(@src()); |
| 3348 | defer tracy.end(); | 3352 | defer tracy.end(); |
| 3349 | | 3353 | |
| ... | @@ -3358,7 +3362,7 @@ fn zirFieldValNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne | ... | @@ -3358,7 +3362,7 @@ fn zirFieldValNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne |
| 3358 | return sema.analyzeLoad(block, src, result_ptr, src); | 3362 | return sema.analyzeLoad(block, src, result_ptr, src); |
| 3359 | } | 3363 | } |
| 3360 | | 3364 | |
| 3361 | fn zirFieldPtrNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3365 | fn zirFieldPtrNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3362 | const tracy = trace(@src()); | 3366 | const tracy = trace(@src()); |
| 3363 | defer tracy.end(); | 3367 | defer tracy.end(); |
| 3364 | | 3368 | |
| ... | @@ -3371,7 +3375,7 @@ fn zirFieldPtrNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne | ... | @@ -3371,7 +3375,7 @@ fn zirFieldPtrNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne |
| 3371 | return sema.namedFieldPtr(block, src, object_ptr, field_name, field_name_src); | 3375 | return sema.namedFieldPtr(block, src, object_ptr, field_name, field_name_src); |
| 3372 | } | 3376 | } |
| 3373 | | 3377 | |
| 3374 | fn zirIntCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3378 | fn zirIntCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3375 | const tracy = trace(@src()); | 3379 | const tracy = trace(@src()); |
| 3376 | defer tracy.end(); | 3380 | defer tracy.end(); |
| 3377 | | 3381 | |
| ... | @@ -3414,7 +3418,7 @@ fn zirIntCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError | ... | @@ -3414,7 +3418,7 @@ fn zirIntCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 3414 | return sema.mod.fail(&block.base, src, "TODO implement analyze widen or shorten int", .{}); | 3418 | return sema.mod.fail(&block.base, src, "TODO implement analyze widen or shorten int", .{}); |
| 3415 | } | 3419 | } |
| 3416 | | 3420 | |
| 3417 | fn zirBitcast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3421 | fn zirBitcast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3418 | const tracy = trace(@src()); | 3422 | const tracy = trace(@src()); |
| 3419 | defer tracy.end(); | 3423 | defer tracy.end(); |
| 3420 | | 3424 | |
| ... | @@ -3428,7 +3432,7 @@ fn zirBitcast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError | ... | @@ -3428,7 +3432,7 @@ fn zirBitcast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 3428 | return sema.bitcast(block, dest_type, operand, operand_src); | 3432 | return sema.bitcast(block, dest_type, operand, operand_src); |
| 3429 | } | 3433 | } |
| 3430 | | 3434 | |
| 3431 | fn zirFloatCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3435 | fn zirFloatCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3432 | const tracy = trace(@src()); | 3436 | const tracy = trace(@src()); |
| 3433 | defer tracy.end(); | 3437 | defer tracy.end(); |
| 3434 | | 3438 | |
| ... | @@ -3471,7 +3475,7 @@ fn zirFloatCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr | ... | @@ -3471,7 +3475,7 @@ fn zirFloatCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 3471 | return sema.mod.fail(&block.base, src, "TODO implement analyze widen or shorten float", .{}); | 3475 | return sema.mod.fail(&block.base, src, "TODO implement analyze widen or shorten float", .{}); |
| 3472 | } | 3476 | } |
| 3473 | | 3477 | |
| 3474 | fn zirElemVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3478 | fn zirElemVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3475 | const tracy = trace(@src()); | 3479 | const tracy = trace(@src()); |
| 3476 | defer tracy.end(); | 3480 | defer tracy.end(); |
| 3477 | | 3481 | |
| ... | @@ -3486,7 +3490,7 @@ fn zirElemVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError | ... | @@ -3486,7 +3490,7 @@ fn zirElemVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 3486 | return sema.analyzeLoad(block, sema.src, result_ptr, sema.src); | 3490 | return sema.analyzeLoad(block, sema.src, result_ptr, sema.src); |
| 3487 | } | 3491 | } |
| 3488 | | 3492 | |
| 3489 | fn zirElemValNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3493 | fn zirElemValNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3490 | const tracy = trace(@src()); | 3494 | const tracy = trace(@src()); |
| 3491 | defer tracy.end(); | 3495 | defer tracy.end(); |
| 3492 | | 3496 | |
| ... | @@ -3504,7 +3508,7 @@ fn zirElemValNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE | ... | @@ -3504,7 +3508,7 @@ fn zirElemValNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE |
| 3504 | return sema.analyzeLoad(block, src, result_ptr, src); | 3508 | return sema.analyzeLoad(block, src, result_ptr, src); |
| 3505 | } | 3509 | } |
| 3506 | | 3510 | |
| 3507 | fn zirElemPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3511 | fn zirElemPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3508 | const tracy = trace(@src()); | 3512 | const tracy = trace(@src()); |
| 3509 | defer tracy.end(); | 3513 | defer tracy.end(); |
| 3510 | | 3514 | |
| ... | @@ -3514,7 +3518,7 @@ fn zirElemPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError | ... | @@ -3514,7 +3518,7 @@ fn zirElemPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 3514 | return sema.elemPtr(block, sema.src, array_ptr, elem_index, sema.src); | 3518 | return sema.elemPtr(block, sema.src, array_ptr, elem_index, sema.src); |
| 3515 | } | 3519 | } |
| 3516 | | 3520 | |
| 3517 | fn zirElemPtrNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3521 | fn zirElemPtrNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3518 | const tracy = trace(@src()); | 3522 | const tracy = trace(@src()); |
| 3519 | defer tracy.end(); | 3523 | defer tracy.end(); |
| 3520 | | 3524 | |
| ... | @@ -3527,7 +3531,7 @@ fn zirElemPtrNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE | ... | @@ -3527,7 +3531,7 @@ fn zirElemPtrNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE |
| 3527 | return sema.elemPtr(block, src, array_ptr, elem_index, elem_index_src); | 3531 | return sema.elemPtr(block, src, array_ptr, elem_index, elem_index_src); |
| 3528 | } | 3532 | } |
| 3529 | | 3533 | |
| 3530 | fn zirSliceStart(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3534 | fn zirSliceStart(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3531 | const tracy = trace(@src()); | 3535 | const tracy = trace(@src()); |
| 3532 | defer tracy.end(); | 3536 | defer tracy.end(); |
| 3533 | | 3537 | |
| ... | @@ -3540,7 +3544,7 @@ fn zirSliceStart(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr | ... | @@ -3540,7 +3544,7 @@ fn zirSliceStart(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 3540 | return sema.analyzeSlice(block, src, array_ptr, start, null, null, .unneeded); | 3544 | return sema.analyzeSlice(block, src, array_ptr, start, null, null, .unneeded); |
| 3541 | } | 3545 | } |
| 3542 | | 3546 | |
| 3543 | fn zirSliceEnd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3547 | fn zirSliceEnd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3544 | const tracy = trace(@src()); | 3548 | const tracy = trace(@src()); |
| 3545 | defer tracy.end(); | 3549 | defer tracy.end(); |
| 3546 | | 3550 | |
| ... | @@ -3554,7 +3558,7 @@ fn zirSliceEnd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro | ... | @@ -3554,7 +3558,7 @@ fn zirSliceEnd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 3554 | return sema.analyzeSlice(block, src, array_ptr, start, end, null, .unneeded); | 3558 | return sema.analyzeSlice(block, src, array_ptr, start, end, null, .unneeded); |
| 3555 | } | 3559 | } |
| 3556 | | 3560 | |
| 3557 | fn zirSliceSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 3561 | fn zirSliceSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3558 | const tracy = trace(@src()); | 3562 | const tracy = trace(@src()); |
| 3559 | defer tracy.end(); | 3563 | defer tracy.end(); |
| 3560 | | 3564 | |
| ... | @@ -3576,7 +3580,7 @@ fn zirSwitchCapture( | ... | @@ -3576,7 +3580,7 @@ fn zirSwitchCapture( |
| 3576 | inst: Zir.Inst.Index, | 3580 | inst: Zir.Inst.Index, |
| 3577 | is_multi: bool, | 3581 | is_multi: bool, |
| 3578 | is_ref: bool, | 3582 | is_ref: bool, |
| 3579 | ) InnerError!Air.Inst.Ref { | 3583 | ) CompileError!Air.Inst.Ref { |
| 3580 | const tracy = trace(@src()); | 3584 | const tracy = trace(@src()); |
| 3581 | defer tracy.end(); | 3585 | defer tracy.end(); |
| 3582 | | 3586 | |
| ... | @@ -3595,7 +3599,7 @@ fn zirSwitchCaptureElse( | ... | @@ -3595,7 +3599,7 @@ fn zirSwitchCaptureElse( |
| 3595 | block: *Scope.Block, | 3599 | block: *Scope.Block, |
| 3596 | inst: Zir.Inst.Index, | 3600 | inst: Zir.Inst.Index, |
| 3597 | is_ref: bool, | 3601 | is_ref: bool, |
| 3598 | ) InnerError!Air.Inst.Ref { | 3602 | ) CompileError!Air.Inst.Ref { |
| 3599 | const tracy = trace(@src()); | 3603 | const tracy = trace(@src()); |
| 3600 | defer tracy.end(); | 3604 | defer tracy.end(); |
| 3601 | | 3605 | |
| ... | @@ -3614,7 +3618,7 @@ fn zirSwitchBlock( | ... | @@ -3614,7 +3618,7 @@ fn zirSwitchBlock( |
| 3614 | inst: Zir.Inst.Index, | 3618 | inst: Zir.Inst.Index, |
| 3615 | is_ref: bool, | 3619 | is_ref: bool, |
| 3616 | special_prong: Zir.SpecialProng, | 3620 | special_prong: Zir.SpecialProng, |
| 3617 | ) InnerError!Air.Inst.Ref { | 3621 | ) CompileError!Air.Inst.Ref { |
| 3618 | const tracy = trace(@src()); | 3622 | const tracy = trace(@src()); |
| 3619 | defer tracy.end(); | 3623 | defer tracy.end(); |
| 3620 | | 3624 | |
| ... | @@ -3647,7 +3651,7 @@ fn zirSwitchBlockMulti( | ... | @@ -3647,7 +3651,7 @@ fn zirSwitchBlockMulti( |
| 3647 | inst: Zir.Inst.Index, | 3651 | inst: Zir.Inst.Index, |
| 3648 | is_ref: bool, | 3652 | is_ref: bool, |
| 3649 | special_prong: Zir.SpecialProng, | 3653 | special_prong: Zir.SpecialProng, |
| 3650 | ) InnerError!Air.Inst.Ref { | 3654 | ) CompileError!Air.Inst.Ref { |
| 3651 | const tracy = trace(@src()); | 3655 | const tracy = trace(@src()); |
| 3652 | defer tracy.end(); | 3656 | defer tracy.end(); |
| 3653 | | 3657 | |
| ... | @@ -3684,7 +3688,7 @@ fn analyzeSwitch( | ... | @@ -3684,7 +3688,7 @@ fn analyzeSwitch( |
| 3684 | multi_cases_len: usize, | 3688 | multi_cases_len: usize, |
| 3685 | switch_inst: Zir.Inst.Index, | 3689 | switch_inst: Zir.Inst.Index, |
| 3686 | src_node_offset: i32, | 3690 | src_node_offset: i32, |
| 3687 | ) InnerError!Air.Inst.Ref { | 3691 | ) CompileError!Air.Inst.Ref { |
| 3688 | const gpa = sema.gpa; | 3692 | const gpa = sema.gpa; |
| 3689 | const mod = sema.mod; | 3693 | const mod = sema.mod; |
| 3690 | | 3694 | |
| ... | @@ -4350,20 +4354,23 @@ fn resolveSwitchItemVal( | ... | @@ -4350,20 +4354,23 @@ fn resolveSwitchItemVal( |
| 4350 | switch_node_offset: i32, | 4354 | switch_node_offset: i32, |
| 4351 | switch_prong_src: Module.SwitchProngSrc, | 4355 | switch_prong_src: Module.SwitchProngSrc, |
| 4352 | range_expand: Module.SwitchProngSrc.RangeExpand, | 4356 | range_expand: Module.SwitchProngSrc.RangeExpand, |
| 4353 | ) InnerError!TypedValue { | 4357 | ) CompileError!TypedValue { |
| 4354 | const item = sema.resolveInst(item_ref); | 4358 | const item = sema.resolveInst(item_ref); |
| 4355 | // We have to avoid the other helper functions here because we cannot construct a LazySrcLoc | 4359 | // Constructing a LazySrcLoc is costly because we only have the switch AST node. |
| 4356 | // because we only have the switch AST node. Only if we know for sure we need to report | 4360 | // Only if we know for sure we need to report a compile error do we resolve the |
| 4357 | // a compile error do we resolve the full source locations. | 4361 | // full source locations. |
| 4358 | if (item.value()) |val| { | 4362 | if (sema.resolveConstValue(block, .unneeded, item)) |val| { |
| 4359 | if (val.isUndef()) { | | |
| 4360 | const src = switch_prong_src.resolve(sema.gpa, block.src_decl, switch_node_offset, range_expand); | | |
| 4361 | return sema.failWithUseOfUndef(block, src); | | |
| 4362 | } | | |
| 4363 | return TypedValue{ .ty = item.ty, .val = val }; | 4363 | return TypedValue{ .ty = item.ty, .val = val }; |
| | 4364 | } else |err| switch (err) { |
| | 4365 | error.NeededSourceLocation => { |
| | 4366 | const src = switch_prong_src.resolve(sema.gpa, block.src_decl, switch_node_offset, range_expand); |
| | 4367 | return TypedValue{ |
| | 4368 | .ty = item.ty, |
| | 4369 | .val = try sema.resolveConstValue(block, src, item), |
| | 4370 | }; |
| | 4371 | }, |
| | 4372 | else => |e| return e, |
| 4364 | } | 4373 | } |
| 4365 | const src = switch_prong_src.resolve(sema.gpa, block.src_decl, switch_node_offset, range_expand); | | |
| 4366 | return sema.failWithNeededComptime(block, src); | | |
| 4367 | } | 4374 | } |
| 4368 | | 4375 | |
| 4369 | fn validateSwitchRange( | 4376 | fn validateSwitchRange( |
| ... | @@ -4374,7 +4381,7 @@ fn validateSwitchRange( | ... | @@ -4374,7 +4381,7 @@ fn validateSwitchRange( |
| 4374 | last_ref: Zir.Inst.Ref, | 4381 | last_ref: Zir.Inst.Ref, |
| 4375 | src_node_offset: i32, | 4382 | src_node_offset: i32, |
| 4376 | switch_prong_src: Module.SwitchProngSrc, | 4383 | switch_prong_src: Module.SwitchProngSrc, |
| 4377 | ) InnerError!void { | 4384 | ) CompileError!void { |
| 4378 | const first_val = (try sema.resolveSwitchItemVal(block, first_ref, src_node_offset, switch_prong_src, .first)).val; | 4385 | const first_val = (try sema.resolveSwitchItemVal(block, first_ref, src_node_offset, switch_prong_src, .first)).val; |
| 4379 | const last_val = (try sema.resolveSwitchItemVal(block, last_ref, src_node_offset, switch_prong_src, .last)).val; | 4386 | const last_val = (try sema.resolveSwitchItemVal(block, last_ref, src_node_offset, switch_prong_src, .last)).val; |
| 4380 | const maybe_prev_src = try range_set.add(first_val, last_val, switch_prong_src); | 4387 | const maybe_prev_src = try range_set.add(first_val, last_val, switch_prong_src); |
| ... | @@ -4388,7 +4395,7 @@ fn validateSwitchItem( | ... | @@ -4388,7 +4395,7 @@ fn validateSwitchItem( |
| 4388 | item_ref: Zir.Inst.Ref, | 4395 | item_ref: Zir.Inst.Ref, |
| 4389 | src_node_offset: i32, | 4396 | src_node_offset: i32, |
| 4390 | switch_prong_src: Module.SwitchProngSrc, | 4397 | switch_prong_src: Module.SwitchProngSrc, |
| 4391 | ) InnerError!void { | 4398 | ) CompileError!void { |
| 4392 | const item_val = (try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none)).val; | 4399 | const item_val = (try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none)).val; |
| 4393 | const maybe_prev_src = try range_set.add(item_val, item_val, switch_prong_src); | 4400 | const maybe_prev_src = try range_set.add(item_val, item_val, switch_prong_src); |
| 4394 | return sema.validateSwitchDupe(block, maybe_prev_src, switch_prong_src, src_node_offset); | 4401 | return sema.validateSwitchDupe(block, maybe_prev_src, switch_prong_src, src_node_offset); |
| ... | @@ -4401,7 +4408,7 @@ fn validateSwitchItemEnum( | ... | @@ -4401,7 +4408,7 @@ fn validateSwitchItemEnum( |
| 4401 | item_ref: Zir.Inst.Ref, | 4408 | item_ref: Zir.Inst.Ref, |
| 4402 | src_node_offset: i32, | 4409 | src_node_offset: i32, |
| 4403 | switch_prong_src: Module.SwitchProngSrc, | 4410 | switch_prong_src: Module.SwitchProngSrc, |
| 4404 | ) InnerError!void { | 4411 | ) CompileError!void { |
| 4405 | const mod = sema.mod; | 4412 | const mod = sema.mod; |
| 4406 | const item_tv = try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none); | 4413 | const item_tv = try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none); |
| 4407 | const field_index = item_tv.ty.enumTagFieldIndex(item_tv.val) orelse { | 4414 | const field_index = item_tv.ty.enumTagFieldIndex(item_tv.val) orelse { |
| ... | @@ -4435,7 +4442,7 @@ fn validateSwitchDupe( | ... | @@ -4435,7 +4442,7 @@ fn validateSwitchDupe( |
| 4435 | maybe_prev_src: ?Module.SwitchProngSrc, | 4442 | maybe_prev_src: ?Module.SwitchProngSrc, |
| 4436 | switch_prong_src: Module.SwitchProngSrc, | 4443 | switch_prong_src: Module.SwitchProngSrc, |
| 4437 | src_node_offset: i32, | 4444 | src_node_offset: i32, |
| 4438 | ) InnerError!void { | 4445 | ) CompileError!void { |
| 4439 | const prev_prong_src = maybe_prev_src orelse return; | 4446 | const prev_prong_src = maybe_prev_src orelse return; |
| 4440 | const mod = sema.mod; | 4447 | const mod = sema.mod; |
| 4441 | const gpa = sema.gpa; | 4448 | const gpa = sema.gpa; |
| ... | @@ -4469,7 +4476,7 @@ fn validateSwitchItemBool( | ... | @@ -4469,7 +4476,7 @@ fn validateSwitchItemBool( |
| 4469 | item_ref: Zir.Inst.Ref, | 4476 | item_ref: Zir.Inst.Ref, |
| 4470 | src_node_offset: i32, | 4477 | src_node_offset: i32, |
| 4471 | switch_prong_src: Module.SwitchProngSrc, | 4478 | switch_prong_src: Module.SwitchProngSrc, |
| 4472 | ) InnerError!void { | 4479 | ) CompileError!void { |
| 4473 | const item_val = (try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none)).val; | 4480 | const item_val = (try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none)).val; |
| 4474 | if (item_val.toBool()) { | 4481 | if (item_val.toBool()) { |
| 4475 | true_count.* += 1; | 4482 | true_count.* += 1; |
| ... | @@ -4491,7 +4498,7 @@ fn validateSwitchItemSparse( | ... | @@ -4491,7 +4498,7 @@ fn validateSwitchItemSparse( |
| 4491 | item_ref: Zir.Inst.Ref, | 4498 | item_ref: Zir.Inst.Ref, |
| 4492 | src_node_offset: i32, | 4499 | src_node_offset: i32, |
| 4493 | switch_prong_src: Module.SwitchProngSrc, | 4500 | switch_prong_src: Module.SwitchProngSrc, |
| 4494 | ) InnerError!void { | 4501 | ) CompileError!void { |
| 4495 | const item_val = (try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none)).val; | 4502 | const item_val = (try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none)).val; |
| 4496 | const kv = (try seen_values.fetchPut(item_val, switch_prong_src)) orelse return; | 4503 | const kv = (try seen_values.fetchPut(item_val, switch_prong_src)) orelse return; |
| 4497 | return sema.validateSwitchDupe(block, kv.value, switch_prong_src, src_node_offset); | 4504 | return sema.validateSwitchDupe(block, kv.value, switch_prong_src, src_node_offset); |
| ... | @@ -4503,7 +4510,7 @@ fn validateSwitchNoRange( | ... | @@ -4503,7 +4510,7 @@ fn validateSwitchNoRange( |
| 4503 | ranges_len: u32, | 4510 | ranges_len: u32, |
| 4504 | operand_ty: Type, | 4511 | operand_ty: Type, |
| 4505 | src_node_offset: i32, | 4512 | src_node_offset: i32, |
| 4506 | ) InnerError!void { | 4513 | ) CompileError!void { |
| 4507 | if (ranges_len == 0) | 4514 | if (ranges_len == 0) |
| 4508 | return; | 4515 | return; |
| 4509 | | 4516 | |
| ... | @@ -4530,7 +4537,7 @@ fn validateSwitchNoRange( | ... | @@ -4530,7 +4537,7 @@ fn validateSwitchNoRange( |
| 4530 | return sema.mod.failWithOwnedErrorMsg(&block.base, msg); | 4537 | return sema.mod.failWithOwnedErrorMsg(&block.base, msg); |
| 4531 | } | 4538 | } |
| 4532 | | 4539 | |
| 4533 | fn zirHasField(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 4540 | fn zirHasField(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4534 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 4541 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 4535 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 4542 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 4536 | _ = extra; | 4543 | _ = extra; |
| ... | @@ -4539,7 +4546,7 @@ fn zirHasField(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro | ... | @@ -4539,7 +4546,7 @@ fn zirHasField(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 4539 | return sema.mod.fail(&block.base, src, "TODO implement zirHasField", .{}); | 4546 | return sema.mod.fail(&block.base, src, "TODO implement zirHasField", .{}); |
| 4540 | } | 4547 | } |
| 4541 | | 4548 | |
| 4542 | fn zirHasDecl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 4549 | fn zirHasDecl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4543 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 4550 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 4544 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 4551 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 4545 | const lhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 4552 | const lhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| ... | @@ -4562,7 +4569,7 @@ fn zirHasDecl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError | ... | @@ -4562,7 +4569,7 @@ fn zirHasDecl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 4562 | return Air.Inst.Ref.bool_false; | 4569 | return Air.Inst.Ref.bool_false; |
| 4563 | } | 4570 | } |
| 4564 | | 4571 | |
| 4565 | fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 4572 | fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4566 | const tracy = trace(@src()); | 4573 | const tracy = trace(@src()); |
| 4567 | defer tracy.end(); | 4574 | defer tracy.end(); |
| 4568 | | 4575 | |
| ... | @@ -4587,13 +4594,13 @@ fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! | ... | @@ -4587,13 +4594,13 @@ fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 4587 | return sema.addType(file_root_decl.ty); | 4594 | return sema.addType(file_root_decl.ty); |
| 4588 | } | 4595 | } |
| 4589 | | 4596 | |
| 4590 | fn zirRetErrValueCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 4597 | fn zirRetErrValueCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4591 | _ = block; | 4598 | _ = block; |
| 4592 | _ = inst; | 4599 | _ = inst; |
| 4593 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirRetErrValueCode", .{}); | 4600 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirRetErrValueCode", .{}); |
| 4594 | } | 4601 | } |
| 4595 | | 4602 | |
| 4596 | fn zirShl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 4603 | fn zirShl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4597 | const tracy = trace(@src()); | 4604 | const tracy = trace(@src()); |
| 4598 | defer tracy.end(); | 4605 | defer tracy.end(); |
| 4599 | | 4606 | |
| ... | @@ -4602,7 +4609,7 @@ fn zirShl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air | ... | @@ -4602,7 +4609,7 @@ fn zirShl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air |
| 4602 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirShl", .{}); | 4609 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirShl", .{}); |
| 4603 | } | 4610 | } |
| 4604 | | 4611 | |
| 4605 | fn zirShr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 4612 | fn zirShr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4606 | const tracy = trace(@src()); | 4613 | const tracy = trace(@src()); |
| 4607 | defer tracy.end(); | 4614 | defer tracy.end(); |
| 4608 | | 4615 | |
| ... | @@ -4615,7 +4622,7 @@ fn zirBitwise( | ... | @@ -4615,7 +4622,7 @@ fn zirBitwise( |
| 4615 | block: *Scope.Block, | 4622 | block: *Scope.Block, |
| 4616 | inst: Zir.Inst.Index, | 4623 | inst: Zir.Inst.Index, |
| 4617 | air_tag: Air.Inst.Tag, | 4624 | air_tag: Air.Inst.Tag, |
| 4618 | ) InnerError!Air.Inst.Ref { | 4625 | ) CompileError!Air.Inst.Ref { |
| 4619 | const tracy = trace(@src()); | 4626 | const tracy = trace(@src()); |
| 4620 | defer tracy.end(); | 4627 | defer tracy.end(); |
| 4621 | | 4628 | |
| ... | @@ -4675,7 +4682,7 @@ fn zirBitwise( | ... | @@ -4675,7 +4682,7 @@ fn zirBitwise( |
| 4675 | return block.addBinOp(air_tag, casted_lhs, casted_rhs); | 4682 | return block.addBinOp(air_tag, casted_lhs, casted_rhs); |
| 4676 | } | 4683 | } |
| 4677 | | 4684 | |
| 4678 | fn zirBitNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 4685 | fn zirBitNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4679 | const tracy = trace(@src()); | 4686 | const tracy = trace(@src()); |
| 4680 | defer tracy.end(); | 4687 | defer tracy.end(); |
| 4681 | | 4688 | |
| ... | @@ -4683,7 +4690,7 @@ fn zirBitNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! | ... | @@ -4683,7 +4690,7 @@ fn zirBitNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 4683 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirBitNot", .{}); | 4690 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirBitNot", .{}); |
| 4684 | } | 4691 | } |
| 4685 | | 4692 | |
| 4686 | fn zirArrayCat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 4693 | fn zirArrayCat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4687 | const tracy = trace(@src()); | 4694 | const tracy = trace(@src()); |
| 4688 | defer tracy.end(); | 4695 | defer tracy.end(); |
| 4689 | | 4696 | |
| ... | @@ -4691,7 +4698,7 @@ fn zirArrayCat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro | ... | @@ -4691,7 +4698,7 @@ fn zirArrayCat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 4691 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirArrayCat", .{}); | 4698 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirArrayCat", .{}); |
| 4692 | } | 4699 | } |
| 4693 | | 4700 | |
| 4694 | fn zirArrayMul(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 4701 | fn zirArrayMul(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4695 | const tracy = trace(@src()); | 4702 | const tracy = trace(@src()); |
| 4696 | defer tracy.end(); | 4703 | defer tracy.end(); |
| 4697 | | 4704 | |
| ... | @@ -4704,7 +4711,7 @@ fn zirNegate( | ... | @@ -4704,7 +4711,7 @@ fn zirNegate( |
| 4704 | block: *Scope.Block, | 4711 | block: *Scope.Block, |
| 4705 | inst: Zir.Inst.Index, | 4712 | inst: Zir.Inst.Index, |
| 4706 | tag_override: Zir.Inst.Tag, | 4713 | tag_override: Zir.Inst.Tag, |
| 4707 | ) InnerError!Air.Inst.Ref { | 4714 | ) CompileError!Air.Inst.Ref { |
| 4708 | const tracy = trace(@src()); | 4715 | const tracy = trace(@src()); |
| 4709 | defer tracy.end(); | 4716 | defer tracy.end(); |
| 4710 | | 4717 | |
| ... | @@ -4718,7 +4725,7 @@ fn zirNegate( | ... | @@ -4718,7 +4725,7 @@ fn zirNegate( |
| 4718 | return sema.analyzeArithmetic(block, tag_override, lhs, rhs, src, lhs_src, rhs_src); | 4725 | return sema.analyzeArithmetic(block, tag_override, lhs, rhs, src, lhs_src, rhs_src); |
| 4719 | } | 4726 | } |
| 4720 | | 4727 | |
| 4721 | fn zirArithmetic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 4728 | fn zirArithmetic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4722 | const tracy = trace(@src()); | 4729 | const tracy = trace(@src()); |
| 4723 | defer tracy.end(); | 4730 | defer tracy.end(); |
| 4724 | | 4731 | |
| ... | @@ -4738,7 +4745,7 @@ fn zirOverflowArithmetic( | ... | @@ -4738,7 +4745,7 @@ fn zirOverflowArithmetic( |
| 4738 | sema: *Sema, | 4745 | sema: *Sema, |
| 4739 | block: *Scope.Block, | 4746 | block: *Scope.Block, |
| 4740 | extended: Zir.Inst.Extended.InstData, | 4747 | extended: Zir.Inst.Extended.InstData, |
| 4741 | ) InnerError!Air.Inst.Ref { | 4748 | ) CompileError!Air.Inst.Ref { |
| 4742 | const tracy = trace(@src()); | 4749 | const tracy = trace(@src()); |
| 4743 | defer tracy.end(); | 4750 | defer tracy.end(); |
| 4744 | | 4751 | |
| ... | @@ -4757,7 +4764,7 @@ fn analyzeArithmetic( | ... | @@ -4757,7 +4764,7 @@ fn analyzeArithmetic( |
| 4757 | src: LazySrcLoc, | 4764 | src: LazySrcLoc, |
| 4758 | lhs_src: LazySrcLoc, | 4765 | lhs_src: LazySrcLoc, |
| 4759 | rhs_src: LazySrcLoc, | 4766 | rhs_src: LazySrcLoc, |
| 4760 | ) InnerError!Air.Inst.Ref { | 4767 | ) CompileError!Air.Inst.Ref { |
| 4761 | const instructions = &[_]Air.Inst.Index{ lhs, rhs }; | 4768 | const instructions = &[_]Air.Inst.Index{ lhs, rhs }; |
| 4762 | const resolved_type = try sema.resolvePeerTypes(block, src, instructions); | 4769 | const resolved_type = try sema.resolvePeerTypes(block, src, instructions); |
| 4763 | const casted_lhs = try sema.coerce(block, resolved_type, lhs, lhs_src); | 4770 | const casted_lhs = try sema.coerce(block, resolved_type, lhs, lhs_src); |
| ... | @@ -4867,7 +4874,7 @@ fn analyzeArithmetic( | ... | @@ -4867,7 +4874,7 @@ fn analyzeArithmetic( |
| 4867 | return block.addBinOp(air_tag, casted_lhs, casted_rhs); | 4874 | return block.addBinOp(air_tag, casted_lhs, casted_rhs); |
| 4868 | } | 4875 | } |
| 4869 | | 4876 | |
| 4870 | fn zirLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 4877 | fn zirLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4871 | const tracy = trace(@src()); | 4878 | const tracy = trace(@src()); |
| 4872 | defer tracy.end(); | 4879 | defer tracy.end(); |
| 4873 | | 4880 | |
| ... | @@ -4882,7 +4889,7 @@ fn zirAsm( | ... | @@ -4882,7 +4889,7 @@ fn zirAsm( |
| 4882 | sema: *Sema, | 4889 | sema: *Sema, |
| 4883 | block: *Scope.Block, | 4890 | block: *Scope.Block, |
| 4884 | extended: Zir.Inst.Extended.InstData, | 4891 | extended: Zir.Inst.Extended.InstData, |
| 4885 | ) InnerError!Air.Inst.Ref { | 4892 | ) CompileError!Air.Inst.Ref { |
| 4886 | const tracy = trace(@src()); | 4893 | const tracy = trace(@src()); |
| 4887 | defer tracy.end(); | 4894 | defer tracy.end(); |
| 4888 | | 4895 | |
| ... | @@ -4966,7 +4973,7 @@ fn zirCmp( | ... | @@ -4966,7 +4973,7 @@ fn zirCmp( |
| 4966 | block: *Scope.Block, | 4973 | block: *Scope.Block, |
| 4967 | inst: Zir.Inst.Index, | 4974 | inst: Zir.Inst.Index, |
| 4968 | op: std.math.CompareOperator, | 4975 | op: std.math.CompareOperator, |
| 4969 | ) InnerError!Air.Inst.Ref { | 4976 | ) CompileError!Air.Inst.Ref { |
| 4970 | const tracy = trace(@src()); | 4977 | const tracy = trace(@src()); |
| 4971 | defer tracy.end(); | 4978 | defer tracy.end(); |
| 4972 | | 4979 | |
| ... | @@ -5091,7 +5098,7 @@ fn zirCmp( | ... | @@ -5091,7 +5098,7 @@ fn zirCmp( |
| 5091 | return block.addBinOp(tag, casted_lhs, casted_rhs); | 5098 | return block.addBinOp(tag, casted_lhs, casted_rhs); |
| 5092 | } | 5099 | } |
| 5093 | | 5100 | |
| 5094 | fn zirSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5101 | fn zirSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5095 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5102 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5096 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 5103 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 5097 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); | 5104 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| ... | @@ -5100,7 +5107,7 @@ fn zirSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! | ... | @@ -5100,7 +5107,7 @@ fn zirSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 5100 | return sema.addIntUnsigned(Type.initTag(.comptime_int), abi_size); | 5107 | return sema.addIntUnsigned(Type.initTag(.comptime_int), abi_size); |
| 5101 | } | 5108 | } |
| 5102 | | 5109 | |
| 5103 | fn zirBitSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5110 | fn zirBitSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5104 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5111 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5105 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 5112 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 5106 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); | 5113 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| ... | @@ -5113,7 +5120,7 @@ fn zirThis( | ... | @@ -5113,7 +5120,7 @@ fn zirThis( |
| 5113 | sema: *Sema, | 5120 | sema: *Sema, |
| 5114 | block: *Scope.Block, | 5121 | block: *Scope.Block, |
| 5115 | extended: Zir.Inst.Extended.InstData, | 5122 | extended: Zir.Inst.Extended.InstData, |
| 5116 | ) InnerError!Air.Inst.Ref { | 5123 | ) CompileError!Air.Inst.Ref { |
| 5117 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; | 5124 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 5118 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirThis", .{}); | 5125 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirThis", .{}); |
| 5119 | } | 5126 | } |
| ... | @@ -5122,7 +5129,7 @@ fn zirRetAddr( | ... | @@ -5122,7 +5129,7 @@ fn zirRetAddr( |
| 5122 | sema: *Sema, | 5129 | sema: *Sema, |
| 5123 | block: *Scope.Block, | 5130 | block: *Scope.Block, |
| 5124 | extended: Zir.Inst.Extended.InstData, | 5131 | extended: Zir.Inst.Extended.InstData, |
| 5125 | ) InnerError!Air.Inst.Ref { | 5132 | ) CompileError!Air.Inst.Ref { |
| 5126 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; | 5133 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 5127 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirRetAddr", .{}); | 5134 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirRetAddr", .{}); |
| 5128 | } | 5135 | } |
| ... | @@ -5131,12 +5138,12 @@ fn zirBuiltinSrc( | ... | @@ -5131,12 +5138,12 @@ fn zirBuiltinSrc( |
| 5131 | sema: *Sema, | 5138 | sema: *Sema, |
| 5132 | block: *Scope.Block, | 5139 | block: *Scope.Block, |
| 5133 | extended: Zir.Inst.Extended.InstData, | 5140 | extended: Zir.Inst.Extended.InstData, |
| 5134 | ) InnerError!Air.Inst.Ref { | 5141 | ) CompileError!Air.Inst.Ref { |
| 5135 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; | 5142 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 5136 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirBuiltinSrc", .{}); | 5143 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirBuiltinSrc", .{}); |
| 5137 | } | 5144 | } |
| 5138 | | 5145 | |
| 5139 | fn zirTypeInfo(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5146 | fn zirTypeInfo(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5140 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5147 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5141 | const src = inst_data.src(); | 5148 | const src = inst_data.src(); |
| 5142 | const ty = try sema.resolveType(block, src, inst_data.operand); | 5149 | const ty = try sema.resolveType(block, src, inst_data.operand); |
| ... | @@ -5179,7 +5186,7 @@ fn zirTypeInfo(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro | ... | @@ -5179,7 +5186,7 @@ fn zirTypeInfo(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 5179 | } | 5186 | } |
| 5180 | } | 5187 | } |
| 5181 | | 5188 | |
| 5182 | fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5189 | fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5183 | _ = block; | 5190 | _ = block; |
| 5184 | const zir_datas = sema.code.instructions.items(.data); | 5191 | const zir_datas = sema.code.instructions.items(.data); |
| 5185 | const inst_data = zir_datas[inst].un_node; | 5192 | const inst_data = zir_datas[inst].un_node; |
| ... | @@ -5187,7 +5194,7 @@ fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! | ... | @@ -5187,7 +5194,7 @@ fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 5187 | return sema.addType(operand.ty); | 5194 | return sema.addType(operand.ty); |
| 5188 | } | 5195 | } |
| 5189 | | 5196 | |
| 5190 | fn zirTypeofElem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5197 | fn zirTypeofElem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5191 | _ = block; | 5198 | _ = block; |
| 5192 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5199 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5193 | const operand_ptr = sema.resolveInst(inst_data.operand); | 5200 | const operand_ptr = sema.resolveInst(inst_data.operand); |
| ... | @@ -5195,13 +5202,13 @@ fn zirTypeofElem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr | ... | @@ -5195,13 +5202,13 @@ fn zirTypeofElem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 5195 | return sema.addType(elem_ty); | 5202 | return sema.addType(elem_ty); |
| 5196 | } | 5203 | } |
| 5197 | | 5204 | |
| 5198 | fn zirTypeofLog2IntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5205 | fn zirTypeofLog2IntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5199 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5206 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5200 | const src = inst_data.src(); | 5207 | const src = inst_data.src(); |
| 5201 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirTypeofLog2IntType", .{}); | 5208 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirTypeofLog2IntType", .{}); |
| 5202 | } | 5209 | } |
| 5203 | | 5210 | |
| 5204 | fn zirLog2IntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5211 | fn zirLog2IntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5205 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5212 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5206 | const src = inst_data.src(); | 5213 | const src = inst_data.src(); |
| 5207 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirLog2IntType", .{}); | 5214 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirLog2IntType", .{}); |
| ... | @@ -5211,7 +5218,7 @@ fn zirTypeofPeer( | ... | @@ -5211,7 +5218,7 @@ fn zirTypeofPeer( |
| 5211 | sema: *Sema, | 5218 | sema: *Sema, |
| 5212 | block: *Scope.Block, | 5219 | block: *Scope.Block, |
| 5213 | extended: Zir.Inst.Extended.InstData, | 5220 | extended: Zir.Inst.Extended.InstData, |
| 5214 | ) InnerError!Air.Inst.Ref { | 5221 | ) CompileError!Air.Inst.Ref { |
| 5215 | const tracy = trace(@src()); | 5222 | const tracy = trace(@src()); |
| 5216 | defer tracy.end(); | 5223 | defer tracy.end(); |
| 5217 | | 5224 | |
| ... | @@ -5230,7 +5237,7 @@ fn zirTypeofPeer( | ... | @@ -5230,7 +5237,7 @@ fn zirTypeofPeer( |
| 5230 | return sema.addType(result_type); | 5237 | return sema.addType(result_type); |
| 5231 | } | 5238 | } |
| 5232 | | 5239 | |
| 5233 | fn zirBoolNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5240 | fn zirBoolNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5234 | const tracy = trace(@src()); | 5241 | const tracy = trace(@src()); |
| 5235 | defer tracy.end(); | 5242 | defer tracy.end(); |
| 5236 | | 5243 | |
| ... | @@ -5256,7 +5263,7 @@ fn zirBoolOp( | ... | @@ -5256,7 +5263,7 @@ fn zirBoolOp( |
| 5256 | block: *Scope.Block, | 5263 | block: *Scope.Block, |
| 5257 | inst: Zir.Inst.Index, | 5264 | inst: Zir.Inst.Index, |
| 5258 | is_bool_or: bool, | 5265 | is_bool_or: bool, |
| 5259 | ) InnerError!Air.Inst.Ref { | 5266 | ) CompileError!Air.Inst.Ref { |
| 5260 | const tracy = trace(@src()); | 5267 | const tracy = trace(@src()); |
| 5261 | defer tracy.end(); | 5268 | defer tracy.end(); |
| 5262 | | 5269 | |
| ... | @@ -5295,7 +5302,7 @@ fn zirBoolBr( | ... | @@ -5295,7 +5302,7 @@ fn zirBoolBr( |
| 5295 | parent_block: *Scope.Block, | 5302 | parent_block: *Scope.Block, |
| 5296 | inst: Zir.Inst.Index, | 5303 | inst: Zir.Inst.Index, |
| 5297 | is_bool_or: bool, | 5304 | is_bool_or: bool, |
| 5298 | ) InnerError!Air.Inst.Ref { | 5305 | ) CompileError!Air.Inst.Ref { |
| 5299 | const tracy = trace(@src()); | 5306 | const tracy = trace(@src()); |
| 5300 | defer tracy.end(); | 5307 | defer tracy.end(); |
| 5301 | | 5308 | |
| ... | @@ -5369,7 +5376,7 @@ fn zirIsNonNull( | ... | @@ -5369,7 +5376,7 @@ fn zirIsNonNull( |
| 5369 | sema: *Sema, | 5376 | sema: *Sema, |
| 5370 | block: *Scope.Block, | 5377 | block: *Scope.Block, |
| 5371 | inst: Zir.Inst.Index, | 5378 | inst: Zir.Inst.Index, |
| 5372 | ) InnerError!Air.Inst.Ref { | 5379 | ) CompileError!Air.Inst.Ref { |
| 5373 | const tracy = trace(@src()); | 5380 | const tracy = trace(@src()); |
| 5374 | defer tracy.end(); | 5381 | defer tracy.end(); |
| 5375 | | 5382 | |
| ... | @@ -5383,7 +5390,7 @@ fn zirIsNonNullPtr( | ... | @@ -5383,7 +5390,7 @@ fn zirIsNonNullPtr( |
| 5383 | sema: *Sema, | 5390 | sema: *Sema, |
| 5384 | block: *Scope.Block, | 5391 | block: *Scope.Block, |
| 5385 | inst: Zir.Inst.Index, | 5392 | inst: Zir.Inst.Index, |
| 5386 | ) InnerError!Air.Inst.Ref { | 5393 | ) CompileError!Air.Inst.Ref { |
| 5387 | const tracy = trace(@src()); | 5394 | const tracy = trace(@src()); |
| 5388 | defer tracy.end(); | 5395 | defer tracy.end(); |
| 5389 | | 5396 | |
| ... | @@ -5394,7 +5401,7 @@ fn zirIsNonNullPtr( | ... | @@ -5394,7 +5401,7 @@ fn zirIsNonNullPtr( |
| 5394 | return sema.analyzeIsNull(block, src, loaded, true); | 5401 | return sema.analyzeIsNull(block, src, loaded, true); |
| 5395 | } | 5402 | } |
| 5396 | | 5403 | |
| 5397 | fn zirIsNonErr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5404 | fn zirIsNonErr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5398 | const tracy = trace(@src()); | 5405 | const tracy = trace(@src()); |
| 5399 | defer tracy.end(); | 5406 | defer tracy.end(); |
| 5400 | | 5407 | |
| ... | @@ -5403,7 +5410,7 @@ fn zirIsNonErr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro | ... | @@ -5403,7 +5410,7 @@ fn zirIsNonErr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 5403 | return sema.analyzeIsNonErr(block, inst_data.src(), operand); | 5410 | return sema.analyzeIsNonErr(block, inst_data.src(), operand); |
| 5404 | } | 5411 | } |
| 5405 | | 5412 | |
| 5406 | fn zirIsNonErrPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5413 | fn zirIsNonErrPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5407 | const tracy = trace(@src()); | 5414 | const tracy = trace(@src()); |
| 5408 | defer tracy.end(); | 5415 | defer tracy.end(); |
| 5409 | | 5416 | |
| ... | @@ -5418,7 +5425,7 @@ fn zirCondbr( | ... | @@ -5418,7 +5425,7 @@ fn zirCondbr( |
| 5418 | sema: *Sema, | 5425 | sema: *Sema, |
| 5419 | parent_block: *Scope.Block, | 5426 | parent_block: *Scope.Block, |
| 5420 | inst: Zir.Inst.Index, | 5427 | inst: Zir.Inst.Index, |
| 5421 | ) InnerError!Zir.Inst.Index { | 5428 | ) CompileError!Zir.Inst.Index { |
| 5422 | const tracy = trace(@src()); | 5429 | const tracy = trace(@src()); |
| 5423 | defer tracy.end(); | 5430 | defer tracy.end(); |
| 5424 | | 5431 | |
| ... | @@ -5461,7 +5468,7 @@ fn zirCondbr( | ... | @@ -5461,7 +5468,7 @@ fn zirCondbr( |
| 5461 | return always_noreturn; | 5468 | return always_noreturn; |
| 5462 | } | 5469 | } |
| 5463 | | 5470 | |
| 5464 | fn zirUnreachable(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Zir.Inst.Index { | 5471 | fn zirUnreachable(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 5465 | const tracy = trace(@src()); | 5472 | const tracy = trace(@src()); |
| 5466 | defer tracy.end(); | 5473 | defer tracy.end(); |
| 5467 | | 5474 | |
| ... | @@ -5482,7 +5489,7 @@ fn zirRetErrValue( | ... | @@ -5482,7 +5489,7 @@ fn zirRetErrValue( |
| 5482 | sema: *Sema, | 5489 | sema: *Sema, |
| 5483 | block: *Scope.Block, | 5490 | block: *Scope.Block, |
| 5484 | inst: Zir.Inst.Index, | 5491 | inst: Zir.Inst.Index, |
| 5485 | ) InnerError!Zir.Inst.Index { | 5492 | ) CompileError!Zir.Inst.Index { |
| 5486 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; | 5493 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; |
| 5487 | const err_name = inst_data.get(sema.code); | 5494 | const err_name = inst_data.get(sema.code); |
| 5488 | const src = inst_data.src(); | 5495 | const src = inst_data.src(); |
| ... | @@ -5507,7 +5514,7 @@ fn zirRetCoerce( | ... | @@ -5507,7 +5514,7 @@ fn zirRetCoerce( |
| 5507 | block: *Scope.Block, | 5514 | block: *Scope.Block, |
| 5508 | inst: Zir.Inst.Index, | 5515 | inst: Zir.Inst.Index, |
| 5509 | need_coercion: bool, | 5516 | need_coercion: bool, |
| 5510 | ) InnerError!Zir.Inst.Index { | 5517 | ) CompileError!Zir.Inst.Index { |
| 5511 | const tracy = trace(@src()); | 5518 | const tracy = trace(@src()); |
| 5512 | defer tracy.end(); | 5519 | defer tracy.end(); |
| 5513 | | 5520 | |
| ... | @@ -5518,7 +5525,7 @@ fn zirRetCoerce( | ... | @@ -5518,7 +5525,7 @@ fn zirRetCoerce( |
| 5518 | return sema.analyzeRet(block, operand, src, need_coercion); | 5525 | return sema.analyzeRet(block, operand, src, need_coercion); |
| 5519 | } | 5526 | } |
| 5520 | | 5527 | |
| 5521 | fn zirRetNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Zir.Inst.Index { | 5528 | fn zirRetNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 5522 | const tracy = trace(@src()); | 5529 | const tracy = trace(@src()); |
| 5523 | defer tracy.end(); | 5530 | defer tracy.end(); |
| 5524 | | 5531 | |
| ... | @@ -5535,7 +5542,7 @@ fn analyzeRet( | ... | @@ -5535,7 +5542,7 @@ fn analyzeRet( |
| 5535 | operand: Air.Inst.Ref, | 5542 | operand: Air.Inst.Ref, |
| 5536 | src: LazySrcLoc, | 5543 | src: LazySrcLoc, |
| 5537 | need_coercion: bool, | 5544 | need_coercion: bool, |
| 5538 | ) InnerError!Zir.Inst.Index { | 5545 | ) CompileError!Zir.Inst.Index { |
| 5539 | if (block.inlining) |inlining| { | 5546 | if (block.inlining) |inlining| { |
| 5540 | // We are inlining a function call; rewrite the `ret` as a `break`. | 5547 | // We are inlining a function call; rewrite the `ret` as a `break`. |
| 5541 | try inlining.merges.results.append(sema.gpa, operand); | 5548 | try inlining.merges.results.append(sema.gpa, operand); |
| ... | @@ -5564,7 +5571,7 @@ fn floatOpAllowed(tag: Zir.Inst.Tag) bool { | ... | @@ -5564,7 +5571,7 @@ fn floatOpAllowed(tag: Zir.Inst.Tag) bool { |
| 5564 | }; | 5571 | }; |
| 5565 | } | 5572 | } |
| 5566 | | 5573 | |
| 5567 | fn zirPtrTypeSimple(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5574 | fn zirPtrTypeSimple(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5568 | const tracy = trace(@src()); | 5575 | const tracy = trace(@src()); |
| 5569 | defer tracy.end(); | 5576 | defer tracy.end(); |
| 5570 | | 5577 | |
| ... | @@ -5585,7 +5592,7 @@ fn zirPtrTypeSimple(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne | ... | @@ -5585,7 +5592,7 @@ fn zirPtrTypeSimple(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne |
| 5585 | return sema.addType(ty); | 5592 | return sema.addType(ty); |
| 5586 | } | 5593 | } |
| 5587 | | 5594 | |
| 5588 | fn zirPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5595 | fn zirPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5589 | const tracy = trace(@src()); | 5596 | const tracy = trace(@src()); |
| 5590 | defer tracy.end(); | 5597 | defer tracy.end(); |
| 5591 | | 5598 | |
| ... | @@ -5639,7 +5646,7 @@ fn zirPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError | ... | @@ -5639,7 +5646,7 @@ fn zirPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 5639 | return sema.addType(ty); | 5646 | return sema.addType(ty); |
| 5640 | } | 5647 | } |
| 5641 | | 5648 | |
| 5642 | fn zirStructInitEmpty(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5649 | fn zirStructInitEmpty(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5643 | const tracy = trace(@src()); | 5650 | const tracy = trace(@src()); |
| 5644 | defer tracy.end(); | 5651 | defer tracy.end(); |
| 5645 | | 5652 | |
| ... | @@ -5653,13 +5660,13 @@ fn zirStructInitEmpty(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In | ... | @@ -5653,13 +5660,13 @@ fn zirStructInitEmpty(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In |
| 5653 | }); | 5660 | }); |
| 5654 | } | 5661 | } |
| 5655 | | 5662 | |
| 5656 | fn zirUnionInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5663 | fn zirUnionInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5657 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 5664 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5658 | const src = inst_data.src(); | 5665 | const src = inst_data.src(); |
| 5659 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirUnionInitPtr", .{}); | 5666 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirUnionInitPtr", .{}); |
| 5660 | } | 5667 | } |
| 5661 | | 5668 | |
| 5662 | fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!Air.Inst.Ref { | 5669 | fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { |
| 5663 | const mod = sema.mod; | 5670 | const mod = sema.mod; |
| 5664 | const gpa = sema.gpa; | 5671 | const gpa = sema.gpa; |
| 5665 | const zir_datas = sema.code.instructions.items(.data); | 5672 | const zir_datas = sema.code.instructions.items(.data); |
| ... | @@ -5772,7 +5779,7 @@ fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: | ... | @@ -5772,7 +5779,7 @@ fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: |
| 5772 | return mod.fail(&block.base, src, "TODO: Sema.zirStructInit for runtime-known struct values", .{}); | 5779 | return mod.fail(&block.base, src, "TODO: Sema.zirStructInit for runtime-known struct values", .{}); |
| 5773 | } | 5780 | } |
| 5774 | | 5781 | |
| 5775 | fn zirStructInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!Air.Inst.Ref { | 5782 | fn zirStructInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { |
| 5776 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 5783 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5777 | const src = inst_data.src(); | 5784 | const src = inst_data.src(); |
| 5778 | | 5785 | |
| ... | @@ -5780,7 +5787,7 @@ fn zirStructInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ | ... | @@ -5780,7 +5787,7 @@ fn zirStructInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ |
| 5780 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirStructInitAnon", .{}); | 5787 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirStructInitAnon", .{}); |
| 5781 | } | 5788 | } |
| 5782 | | 5789 | |
| 5783 | fn zirArrayInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!Air.Inst.Ref { | 5790 | fn zirArrayInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { |
| 5784 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 5791 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5785 | const src = inst_data.src(); | 5792 | const src = inst_data.src(); |
| 5786 | | 5793 | |
| ... | @@ -5788,7 +5795,7 @@ fn zirArrayInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: | ... | @@ -5788,7 +5795,7 @@ fn zirArrayInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: |
| 5788 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirArrayInit", .{}); | 5795 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirArrayInit", .{}); |
| 5789 | } | 5796 | } |
| 5790 | | 5797 | |
| 5791 | fn zirArrayInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!Air.Inst.Ref { | 5798 | fn zirArrayInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { |
| 5792 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 5799 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5793 | const src = inst_data.src(); | 5800 | const src = inst_data.src(); |
| 5794 | | 5801 | |
| ... | @@ -5796,13 +5803,13 @@ fn zirArrayInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_r | ... | @@ -5796,13 +5803,13 @@ fn zirArrayInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_r |
| 5796 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirArrayInitAnon", .{}); | 5803 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirArrayInitAnon", .{}); |
| 5797 | } | 5804 | } |
| 5798 | | 5805 | |
| 5799 | fn zirFieldTypeRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5806 | fn zirFieldTypeRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5800 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 5807 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5801 | const src = inst_data.src(); | 5808 | const src = inst_data.src(); |
| 5802 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFieldTypeRef", .{}); | 5809 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFieldTypeRef", .{}); |
| 5803 | } | 5810 | } |
| 5804 | | 5811 | |
| 5805 | fn zirFieldType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5812 | fn zirFieldType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5806 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 5813 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5807 | const extra = sema.code.extraData(Zir.Inst.FieldType, inst_data.payload_index).data; | 5814 | const extra = sema.code.extraData(Zir.Inst.FieldType, inst_data.payload_index).data; |
| 5808 | const src = inst_data.src(); | 5815 | const src = inst_data.src(); |
| ... | @@ -5824,7 +5831,7 @@ fn zirErrorReturnTrace( | ... | @@ -5824,7 +5831,7 @@ fn zirErrorReturnTrace( |
| 5824 | sema: *Sema, | 5831 | sema: *Sema, |
| 5825 | block: *Scope.Block, | 5832 | block: *Scope.Block, |
| 5826 | extended: Zir.Inst.Extended.InstData, | 5833 | extended: Zir.Inst.Extended.InstData, |
| 5827 | ) InnerError!Air.Inst.Ref { | 5834 | ) CompileError!Air.Inst.Ref { |
| 5828 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; | 5835 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 5829 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirErrorReturnTrace", .{}); | 5836 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirErrorReturnTrace", .{}); |
| 5830 | } | 5837 | } |
| ... | @@ -5833,7 +5840,7 @@ fn zirFrame( | ... | @@ -5833,7 +5840,7 @@ fn zirFrame( |
| 5833 | sema: *Sema, | 5840 | sema: *Sema, |
| 5834 | block: *Scope.Block, | 5841 | block: *Scope.Block, |
| 5835 | extended: Zir.Inst.Extended.InstData, | 5842 | extended: Zir.Inst.Extended.InstData, |
| 5836 | ) InnerError!Air.Inst.Ref { | 5843 | ) CompileError!Air.Inst.Ref { |
| 5837 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; | 5844 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 5838 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrame", .{}); | 5845 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrame", .{}); |
| 5839 | } | 5846 | } |
| ... | @@ -5842,84 +5849,84 @@ fn zirFrameAddress( | ... | @@ -5842,84 +5849,84 @@ fn zirFrameAddress( |
| 5842 | sema: *Sema, | 5849 | sema: *Sema, |
| 5843 | block: *Scope.Block, | 5850 | block: *Scope.Block, |
| 5844 | extended: Zir.Inst.Extended.InstData, | 5851 | extended: Zir.Inst.Extended.InstData, |
| 5845 | ) InnerError!Air.Inst.Ref { | 5852 | ) CompileError!Air.Inst.Ref { |
| 5846 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; | 5853 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 5847 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrameAddress", .{}); | 5854 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrameAddress", .{}); |
| 5848 | } | 5855 | } |
| 5849 | | 5856 | |
| 5850 | fn zirAlignOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5857 | fn zirAlignOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5851 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5858 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5852 | const src = inst_data.src(); | 5859 | const src = inst_data.src(); |
| 5853 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAlignOf", .{}); | 5860 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAlignOf", .{}); |
| 5854 | } | 5861 | } |
| 5855 | | 5862 | |
| 5856 | fn zirBoolToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5863 | fn zirBoolToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5857 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5864 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5858 | const src = inst_data.src(); | 5865 | const src = inst_data.src(); |
| 5859 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBoolToInt", .{}); | 5866 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBoolToInt", .{}); |
| 5860 | } | 5867 | } |
| 5861 | | 5868 | |
| 5862 | fn zirEmbedFile(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5869 | fn zirEmbedFile(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5863 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5870 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5864 | const src = inst_data.src(); | 5871 | const src = inst_data.src(); |
| 5865 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirEmbedFile", .{}); | 5872 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirEmbedFile", .{}); |
| 5866 | } | 5873 | } |
| 5867 | | 5874 | |
| 5868 | fn zirErrorName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5875 | fn zirErrorName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5869 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5876 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5870 | const src = inst_data.src(); | 5877 | const src = inst_data.src(); |
| 5871 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirErrorName", .{}); | 5878 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirErrorName", .{}); |
| 5872 | } | 5879 | } |
| 5873 | | 5880 | |
| 5874 | fn zirUnaryMath(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5881 | fn zirUnaryMath(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5875 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5882 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5876 | const src = inst_data.src(); | 5883 | const src = inst_data.src(); |
| 5877 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirUnaryMath", .{}); | 5884 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirUnaryMath", .{}); |
| 5878 | } | 5885 | } |
| 5879 | | 5886 | |
| 5880 | fn zirTagName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5887 | fn zirTagName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5881 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5888 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5882 | const src = inst_data.src(); | 5889 | const src = inst_data.src(); |
| 5883 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirTagName", .{}); | 5890 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirTagName", .{}); |
| 5884 | } | 5891 | } |
| 5885 | | 5892 | |
| 5886 | fn zirReify(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5893 | fn zirReify(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5887 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5894 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5888 | const src = inst_data.src(); | 5895 | const src = inst_data.src(); |
| 5889 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirReify", .{}); | 5896 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirReify", .{}); |
| 5890 | } | 5897 | } |
| 5891 | | 5898 | |
| 5892 | fn zirTypeName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5899 | fn zirTypeName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5893 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5900 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5894 | const src = inst_data.src(); | 5901 | const src = inst_data.src(); |
| 5895 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirTypeName", .{}); | 5902 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirTypeName", .{}); |
| 5896 | } | 5903 | } |
| 5897 | | 5904 | |
| 5898 | fn zirFrameType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5905 | fn zirFrameType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5899 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5906 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5900 | const src = inst_data.src(); | 5907 | const src = inst_data.src(); |
| 5901 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrameType", .{}); | 5908 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrameType", .{}); |
| 5902 | } | 5909 | } |
| 5903 | | 5910 | |
| 5904 | fn zirFrameSize(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5911 | fn zirFrameSize(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5905 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5912 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5906 | const src = inst_data.src(); | 5913 | const src = inst_data.src(); |
| 5907 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrameSize", .{}); | 5914 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrameSize", .{}); |
| 5908 | } | 5915 | } |
| 5909 | | 5916 | |
| 5910 | fn zirFloatToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5917 | fn zirFloatToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5911 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 5918 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5912 | const src = inst_data.src(); | 5919 | const src = inst_data.src(); |
| 5913 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFloatToInt", .{}); | 5920 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFloatToInt", .{}); |
| 5914 | } | 5921 | } |
| 5915 | | 5922 | |
| 5916 | fn zirIntToFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5923 | fn zirIntToFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5917 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 5924 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5918 | const src = inst_data.src(); | 5925 | const src = inst_data.src(); |
| 5919 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirIntToFloat", .{}); | 5926 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirIntToFloat", .{}); |
| 5920 | } | 5927 | } |
| 5921 | | 5928 | |
| 5922 | fn zirIntToPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5929 | fn zirIntToPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5923 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 5930 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5924 | const src = inst_data.src(); | 5931 | const src = inst_data.src(); |
| 5925 | | 5932 | |
| ... | @@ -5982,199 +5989,199 @@ fn zirIntToPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro | ... | @@ -5982,199 +5989,199 @@ fn zirIntToPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 5982 | return block.addTyOp(.bitcast, type_res, operand_coerced); | 5989 | return block.addTyOp(.bitcast, type_res, operand_coerced); |
| 5983 | } | 5990 | } |
| 5984 | | 5991 | |
| 5985 | fn zirErrSetCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5992 | fn zirErrSetCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5986 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 5993 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5987 | const src = inst_data.src(); | 5994 | const src = inst_data.src(); |
| 5988 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirErrSetCast", .{}); | 5995 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirErrSetCast", .{}); |
| 5989 | } | 5996 | } |
| 5990 | | 5997 | |
| 5991 | fn zirPtrCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 5998 | fn zirPtrCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5992 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 5999 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5993 | const src = inst_data.src(); | 6000 | const src = inst_data.src(); |
| 5994 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirPtrCast", .{}); | 6001 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirPtrCast", .{}); |
| 5995 | } | 6002 | } |
| 5996 | | 6003 | |
| 5997 | fn zirTruncate(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6004 | fn zirTruncate(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5998 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6005 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5999 | const src = inst_data.src(); | 6006 | const src = inst_data.src(); |
| 6000 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirTruncate", .{}); | 6007 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirTruncate", .{}); |
| 6001 | } | 6008 | } |
| 6002 | | 6009 | |
| 6003 | fn zirAlignCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6010 | fn zirAlignCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6004 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6011 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6005 | const src = inst_data.src(); | 6012 | const src = inst_data.src(); |
| 6006 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAlignCast", .{}); | 6013 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAlignCast", .{}); |
| 6007 | } | 6014 | } |
| 6008 | | 6015 | |
| 6009 | fn zirClz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6016 | fn zirClz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6010 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 6017 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6011 | const src = inst_data.src(); | 6018 | const src = inst_data.src(); |
| 6012 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirClz", .{}); | 6019 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirClz", .{}); |
| 6013 | } | 6020 | } |
| 6014 | | 6021 | |
| 6015 | fn zirCtz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6022 | fn zirCtz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6016 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 6023 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6017 | const src = inst_data.src(); | 6024 | const src = inst_data.src(); |
| 6018 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirCtz", .{}); | 6025 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirCtz", .{}); |
| 6019 | } | 6026 | } |
| 6020 | | 6027 | |
| 6021 | fn zirPopCount(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6028 | fn zirPopCount(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6022 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 6029 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6023 | const src = inst_data.src(); | 6030 | const src = inst_data.src(); |
| 6024 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirPopCount", .{}); | 6031 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirPopCount", .{}); |
| 6025 | } | 6032 | } |
| 6026 | | 6033 | |
| 6027 | fn zirByteSwap(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6034 | fn zirByteSwap(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6028 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 6035 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6029 | const src = inst_data.src(); | 6036 | const src = inst_data.src(); |
| 6030 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirByteSwap", .{}); | 6037 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirByteSwap", .{}); |
| 6031 | } | 6038 | } |
| 6032 | | 6039 | |
| 6033 | fn zirBitReverse(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6040 | fn zirBitReverse(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6034 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 6041 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6035 | const src = inst_data.src(); | 6042 | const src = inst_data.src(); |
| 6036 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBitReverse", .{}); | 6043 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBitReverse", .{}); |
| 6037 | } | 6044 | } |
| 6038 | | 6045 | |
| 6039 | fn zirDivExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6046 | fn zirDivExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6040 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6047 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6041 | const src = inst_data.src(); | 6048 | const src = inst_data.src(); |
| 6042 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirDivExact", .{}); | 6049 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirDivExact", .{}); |
| 6043 | } | 6050 | } |
| 6044 | | 6051 | |
| 6045 | fn zirDivFloor(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6052 | fn zirDivFloor(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6046 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6053 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6047 | const src = inst_data.src(); | 6054 | const src = inst_data.src(); |
| 6048 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirDivFloor", .{}); | 6055 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirDivFloor", .{}); |
| 6049 | } | 6056 | } |
| 6050 | | 6057 | |
| 6051 | fn zirDivTrunc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6058 | fn zirDivTrunc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6052 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6059 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6053 | const src = inst_data.src(); | 6060 | const src = inst_data.src(); |
| 6054 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirDivTrunc", .{}); | 6061 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirDivTrunc", .{}); |
| 6055 | } | 6062 | } |
| 6056 | | 6063 | |
| 6057 | fn zirMod(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6064 | fn zirMod(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6058 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6065 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6059 | const src = inst_data.src(); | 6066 | const src = inst_data.src(); |
| 6060 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirMod", .{}); | 6067 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirMod", .{}); |
| 6061 | } | 6068 | } |
| 6062 | | 6069 | |
| 6063 | fn zirRem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6070 | fn zirRem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6064 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6071 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6065 | const src = inst_data.src(); | 6072 | const src = inst_data.src(); |
| 6066 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirRem", .{}); | 6073 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirRem", .{}); |
| 6067 | } | 6074 | } |
| 6068 | | 6075 | |
| 6069 | fn zirShlExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6076 | fn zirShlExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6070 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6077 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6071 | const src = inst_data.src(); | 6078 | const src = inst_data.src(); |
| 6072 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirShlExact", .{}); | 6079 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirShlExact", .{}); |
| 6073 | } | 6080 | } |
| 6074 | | 6081 | |
| 6075 | fn zirShrExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6082 | fn zirShrExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6076 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6083 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6077 | const src = inst_data.src(); | 6084 | const src = inst_data.src(); |
| 6078 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirShrExact", .{}); | 6085 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirShrExact", .{}); |
| 6079 | } | 6086 | } |
| 6080 | | 6087 | |
| 6081 | fn zirBitOffsetOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6088 | fn zirBitOffsetOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6082 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6089 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6083 | const src = inst_data.src(); | 6090 | const src = inst_data.src(); |
| 6084 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBitOffsetOf", .{}); | 6091 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBitOffsetOf", .{}); |
| 6085 | } | 6092 | } |
| 6086 | | 6093 | |
| 6087 | fn zirOffsetOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6094 | fn zirOffsetOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6088 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6095 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6089 | const src = inst_data.src(); | 6096 | const src = inst_data.src(); |
| 6090 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirOffsetOf", .{}); | 6097 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirOffsetOf", .{}); |
| 6091 | } | 6098 | } |
| 6092 | | 6099 | |
| 6093 | fn zirCmpxchg(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6100 | fn zirCmpxchg(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6094 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6101 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6095 | const src = inst_data.src(); | 6102 | const src = inst_data.src(); |
| 6096 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirCmpxchg", .{}); | 6103 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirCmpxchg", .{}); |
| 6097 | } | 6104 | } |
| 6098 | | 6105 | |
| 6099 | fn zirSplat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6106 | fn zirSplat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6100 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6107 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6101 | const src = inst_data.src(); | 6108 | const src = inst_data.src(); |
| 6102 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirSplat", .{}); | 6109 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirSplat", .{}); |
| 6103 | } | 6110 | } |
| 6104 | | 6111 | |
| 6105 | fn zirReduce(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6112 | fn zirReduce(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6106 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6113 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6107 | const src = inst_data.src(); | 6114 | const src = inst_data.src(); |
| 6108 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirReduce", .{}); | 6115 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirReduce", .{}); |
| 6109 | } | 6116 | } |
| 6110 | | 6117 | |
| 6111 | fn zirShuffle(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6118 | fn zirShuffle(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6112 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6119 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6113 | const src = inst_data.src(); | 6120 | const src = inst_data.src(); |
| 6114 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirShuffle", .{}); | 6121 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirShuffle", .{}); |
| 6115 | } | 6122 | } |
| 6116 | | 6123 | |
| 6117 | fn zirAtomicLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6124 | fn zirAtomicLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6118 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6125 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6119 | const src = inst_data.src(); | 6126 | const src = inst_data.src(); |
| 6120 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAtomicLoad", .{}); | 6127 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAtomicLoad", .{}); |
| 6121 | } | 6128 | } |
| 6122 | | 6129 | |
| 6123 | fn zirAtomicRmw(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6130 | fn zirAtomicRmw(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6124 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6131 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6125 | const src = inst_data.src(); | 6132 | const src = inst_data.src(); |
| 6126 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAtomicRmw", .{}); | 6133 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAtomicRmw", .{}); |
| 6127 | } | 6134 | } |
| 6128 | | 6135 | |
| 6129 | fn zirAtomicStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6136 | fn zirAtomicStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6130 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6137 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6131 | const src = inst_data.src(); | 6138 | const src = inst_data.src(); |
| 6132 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAtomicStore", .{}); | 6139 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAtomicStore", .{}); |
| 6133 | } | 6140 | } |
| 6134 | | 6141 | |
| 6135 | fn zirMulAdd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6142 | fn zirMulAdd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6136 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6143 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6137 | const src = inst_data.src(); | 6144 | const src = inst_data.src(); |
| 6138 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirMulAdd", .{}); | 6145 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirMulAdd", .{}); |
| 6139 | } | 6146 | } |
| 6140 | | 6147 | |
| 6141 | fn zirBuiltinCall(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6148 | fn zirBuiltinCall(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6142 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6149 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6143 | const src = inst_data.src(); | 6150 | const src = inst_data.src(); |
| 6144 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBuiltinCall", .{}); | 6151 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBuiltinCall", .{}); |
| 6145 | } | 6152 | } |
| 6146 | | 6153 | |
| 6147 | fn zirFieldPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6154 | fn zirFieldPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6148 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6155 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6149 | const src = inst_data.src(); | 6156 | const src = inst_data.src(); |
| 6150 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFieldPtrType", .{}); | 6157 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFieldPtrType", .{}); |
| 6151 | } | 6158 | } |
| 6152 | | 6159 | |
| 6153 | fn zirFieldParentPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6160 | fn zirFieldParentPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6154 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6161 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6155 | const src = inst_data.src(); | 6162 | const src = inst_data.src(); |
| 6156 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFieldParentPtr", .{}); | 6163 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFieldParentPtr", .{}); |
| 6157 | } | 6164 | } |
| 6158 | | 6165 | |
| 6159 | fn zirMemcpy(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6166 | fn zirMemcpy(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6160 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6167 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6161 | const src = inst_data.src(); | 6168 | const src = inst_data.src(); |
| 6162 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirMemcpy", .{}); | 6169 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirMemcpy", .{}); |
| 6163 | } | 6170 | } |
| 6164 | | 6171 | |
| 6165 | fn zirMemset(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6172 | fn zirMemset(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6166 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6173 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6167 | const src = inst_data.src(); | 6174 | const src = inst_data.src(); |
| 6168 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirMemset", .{}); | 6175 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirMemset", .{}); |
| 6169 | } | 6176 | } |
| 6170 | | 6177 | |
| 6171 | fn zirBuiltinAsyncCall(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6178 | fn zirBuiltinAsyncCall(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6172 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6179 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6173 | const src = inst_data.src(); | 6180 | const src = inst_data.src(); |
| 6174 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBuiltinAsyncCall", .{}); | 6181 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBuiltinAsyncCall", .{}); |
| 6175 | } | 6182 | } |
| 6176 | | 6183 | |
| 6177 | fn zirResume(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { | 6184 | fn zirResume(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6178 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 6185 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6179 | const src = inst_data.src(); | 6186 | const src = inst_data.src(); |
| 6180 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirResume", .{}); | 6187 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirResume", .{}); |
| ... | @@ -6185,7 +6192,7 @@ fn zirAwait( | ... | @@ -6185,7 +6192,7 @@ fn zirAwait( |
| 6185 | block: *Scope.Block, | 6192 | block: *Scope.Block, |
| 6186 | inst: Zir.Inst.Index, | 6193 | inst: Zir.Inst.Index, |
| 6187 | is_nosuspend: bool, | 6194 | is_nosuspend: bool, |
| 6188 | ) InnerError!Air.Inst.Ref { | 6195 | ) CompileError!Air.Inst.Ref { |
| 6189 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 6196 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6190 | const src = inst_data.src(); | 6197 | const src = inst_data.src(); |
| 6191 | | 6198 | |
| ... | @@ -6197,7 +6204,7 @@ fn zirVarExtended( | ... | @@ -6197,7 +6204,7 @@ fn zirVarExtended( |
| 6197 | sema: *Sema, | 6204 | sema: *Sema, |
| 6198 | block: *Scope.Block, | 6205 | block: *Scope.Block, |
| 6199 | extended: Zir.Inst.Extended.InstData, | 6206 | extended: Zir.Inst.Extended.InstData, |
| 6200 | ) InnerError!Air.Inst.Ref { | 6207 | ) CompileError!Air.Inst.Ref { |
| 6201 | const extra = sema.code.extraData(Zir.Inst.ExtendedVar, extended.operand); | 6208 | const extra = sema.code.extraData(Zir.Inst.ExtendedVar, extended.operand); |
| 6202 | const src = sema.src; | 6209 | const src = sema.src; |
| 6203 | const ty_src: LazySrcLoc = src; // TODO add a LazySrcLoc that points at type | 6210 | const ty_src: LazySrcLoc = src; // TODO add a LazySrcLoc that points at type |
| ... | @@ -6263,7 +6270,7 @@ fn zirFuncExtended( | ... | @@ -6263,7 +6270,7 @@ fn zirFuncExtended( |
| 6263 | block: *Scope.Block, | 6270 | block: *Scope.Block, |
| 6264 | extended: Zir.Inst.Extended.InstData, | 6271 | extended: Zir.Inst.Extended.InstData, |
| 6265 | inst: Zir.Inst.Index, | 6272 | inst: Zir.Inst.Index, |
| 6266 | ) InnerError!Air.Inst.Ref { | 6273 | ) CompileError!Air.Inst.Ref { |
| 6267 | const tracy = trace(@src()); | 6274 | const tracy = trace(@src()); |
| 6268 | defer tracy.end(); | 6275 | defer tracy.end(); |
| 6269 | | 6276 | |
| ... | @@ -6330,7 +6337,7 @@ fn zirCUndef( | ... | @@ -6330,7 +6337,7 @@ fn zirCUndef( |
| 6330 | sema: *Sema, | 6337 | sema: *Sema, |
| 6331 | block: *Scope.Block, | 6338 | block: *Scope.Block, |
| 6332 | extended: Zir.Inst.Extended.InstData, | 6339 | extended: Zir.Inst.Extended.InstData, |
| 6333 | ) InnerError!Air.Inst.Ref { | 6340 | ) CompileError!Air.Inst.Ref { |
| 6334 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 6341 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 6335 | const src: LazySrcLoc = .{ .node_offset = extra.node }; | 6342 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 6336 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirCUndef", .{}); | 6343 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirCUndef", .{}); |
| ... | @@ -6340,7 +6347,7 @@ fn zirCInclude( | ... | @@ -6340,7 +6347,7 @@ fn zirCInclude( |
| 6340 | sema: *Sema, | 6347 | sema: *Sema, |
| 6341 | block: *Scope.Block, | 6348 | block: *Scope.Block, |
| 6342 | extended: Zir.Inst.Extended.InstData, | 6349 | extended: Zir.Inst.Extended.InstData, |
| 6343 | ) InnerError!Air.Inst.Ref { | 6350 | ) CompileError!Air.Inst.Ref { |
| 6344 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 6351 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 6345 | const src: LazySrcLoc = .{ .node_offset = extra.node }; | 6352 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 6346 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirCInclude", .{}); | 6353 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirCInclude", .{}); |
| ... | @@ -6350,7 +6357,7 @@ fn zirCDefine( | ... | @@ -6350,7 +6357,7 @@ fn zirCDefine( |
| 6350 | sema: *Sema, | 6357 | sema: *Sema, |
| 6351 | block: *Scope.Block, | 6358 | block: *Scope.Block, |
| 6352 | extended: Zir.Inst.Extended.InstData, | 6359 | extended: Zir.Inst.Extended.InstData, |
| 6353 | ) InnerError!Air.Inst.Ref { | 6360 | ) CompileError!Air.Inst.Ref { |
| 6354 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; | 6361 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; |
| 6355 | const src: LazySrcLoc = .{ .node_offset = extra.node }; | 6362 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 6356 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirCDefine", .{}); | 6363 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirCDefine", .{}); |
| ... | @@ -6360,7 +6367,7 @@ fn zirWasmMemorySize( | ... | @@ -6360,7 +6367,7 @@ fn zirWasmMemorySize( |
| 6360 | sema: *Sema, | 6367 | sema: *Sema, |
| 6361 | block: *Scope.Block, | 6368 | block: *Scope.Block, |
| 6362 | extended: Zir.Inst.Extended.InstData, | 6369 | extended: Zir.Inst.Extended.InstData, |
| 6363 | ) InnerError!Air.Inst.Ref { | 6370 | ) CompileError!Air.Inst.Ref { |
| 6364 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 6371 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 6365 | const src: LazySrcLoc = .{ .node_offset = extra.node }; | 6372 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 6366 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirWasmMemorySize", .{}); | 6373 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirWasmMemorySize", .{}); |
| ... | @@ -6370,7 +6377,7 @@ fn zirWasmMemoryGrow( | ... | @@ -6370,7 +6377,7 @@ fn zirWasmMemoryGrow( |
| 6370 | sema: *Sema, | 6377 | sema: *Sema, |
| 6371 | block: *Scope.Block, | 6378 | block: *Scope.Block, |
| 6372 | extended: Zir.Inst.Extended.InstData, | 6379 | extended: Zir.Inst.Extended.InstData, |
| 6373 | ) InnerError!Air.Inst.Ref { | 6380 | ) CompileError!Air.Inst.Ref { |
| 6374 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; | 6381 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; |
| 6375 | const src: LazySrcLoc = .{ .node_offset = extra.node }; | 6382 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 6376 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirWasmMemoryGrow", .{}); | 6383 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirWasmMemoryGrow", .{}); |
| ... | @@ -6380,7 +6387,7 @@ fn zirBuiltinExtern( | ... | @@ -6380,7 +6387,7 @@ fn zirBuiltinExtern( |
| 6380 | sema: *Sema, | 6387 | sema: *Sema, |
| 6381 | block: *Scope.Block, | 6388 | block: *Scope.Block, |
| 6382 | extended: Zir.Inst.Extended.InstData, | 6389 | extended: Zir.Inst.Extended.InstData, |
| 6383 | ) InnerError!Air.Inst.Ref { | 6390 | ) CompileError!Air.Inst.Ref { |
| 6384 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; | 6391 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; |
| 6385 | const src: LazySrcLoc = .{ .node_offset = extra.node }; | 6392 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 6386 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirBuiltinExtern", .{}); | 6393 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirBuiltinExtern", .{}); |
| ... | @@ -6556,7 +6563,7 @@ fn namedFieldPtr( | ... | @@ -6556,7 +6563,7 @@ fn namedFieldPtr( |
| 6556 | object_ptr: Air.Inst.Ref, | 6563 | object_ptr: Air.Inst.Ref, |
| 6557 | field_name: []const u8, | 6564 | field_name: []const u8, |
| 6558 | field_name_src: LazySrcLoc, | 6565 | field_name_src: LazySrcLoc, |
| 6559 | ) InnerError!Air.Inst.Ref { | 6566 | ) CompileError!Air.Inst.Ref { |
| 6560 | const mod = sema.mod; | 6567 | const mod = sema.mod; |
| 6561 | const arena = sema.arena; | 6568 | const arena = sema.arena; |
| 6562 | | 6569 | |
| ... | @@ -6706,7 +6713,7 @@ fn analyzeNamespaceLookup( | ... | @@ -6706,7 +6713,7 @@ fn analyzeNamespaceLookup( |
| 6706 | src: LazySrcLoc, | 6713 | src: LazySrcLoc, |
| 6707 | namespace: *Scope.Namespace, | 6714 | namespace: *Scope.Namespace, |
| 6708 | decl_name: []const u8, | 6715 | decl_name: []const u8, |
| 6709 | ) InnerError!?Air.Inst.Ref { | 6716 | ) CompileError!?Air.Inst.Ref { |
| 6710 | const mod = sema.mod; | 6717 | const mod = sema.mod; |
| 6711 | const gpa = sema.gpa; | 6718 | const gpa = sema.gpa; |
| 6712 | if (try sema.lookupInNamespace(namespace, decl_name)) |decl| { | 6719 | if (try sema.lookupInNamespace(namespace, decl_name)) |decl| { |
| ... | @@ -6734,7 +6741,7 @@ fn analyzeStructFieldPtr( | ... | @@ -6734,7 +6741,7 @@ fn analyzeStructFieldPtr( |
| 6734 | field_name: []const u8, | 6741 | field_name: []const u8, |
| 6735 | field_name_src: LazySrcLoc, | 6742 | field_name_src: LazySrcLoc, |
| 6736 | unresolved_struct_ty: Type, | 6743 | unresolved_struct_ty: Type, |
| 6737 | ) InnerError!Air.Inst.Ref { | 6744 | ) CompileError!Air.Inst.Ref { |
| 6738 | const mod = sema.mod; | 6745 | const mod = sema.mod; |
| 6739 | const arena = sema.arena; | 6746 | const arena = sema.arena; |
| 6740 | assert(unresolved_struct_ty.zigTypeTag() == .Struct); | 6747 | assert(unresolved_struct_ty.zigTypeTag() == .Struct); |
| ... | @@ -6769,7 +6776,7 @@ fn analyzeUnionFieldPtr( | ... | @@ -6769,7 +6776,7 @@ fn analyzeUnionFieldPtr( |
| 6769 | field_name: []const u8, | 6776 | field_name: []const u8, |
| 6770 | field_name_src: LazySrcLoc, | 6777 | field_name_src: LazySrcLoc, |
| 6771 | unresolved_union_ty: Type, | 6778 | unresolved_union_ty: Type, |
| 6772 | ) InnerError!Air.Inst.Ref { | 6779 | ) CompileError!Air.Inst.Ref { |
| 6773 | const mod = sema.mod; | 6780 | const mod = sema.mod; |
| 6774 | const arena = sema.arena; | 6781 | const arena = sema.arena; |
| 6775 | assert(unresolved_union_ty.zigTypeTag() == .Union); | 6782 | assert(unresolved_union_ty.zigTypeTag() == .Union); |
| ... | @@ -6805,7 +6812,7 @@ fn elemPtr( | ... | @@ -6805,7 +6812,7 @@ fn elemPtr( |
| 6805 | array_ptr: Air.Inst.Ref, | 6812 | array_ptr: Air.Inst.Ref, |
| 6806 | elem_index: Air.Inst.Ref, | 6813 | elem_index: Air.Inst.Ref, |
| 6807 | elem_index_src: LazySrcLoc, | 6814 | elem_index_src: LazySrcLoc, |
| 6808 | ) InnerError!Air.Inst.Ref { | 6815 | ) CompileError!Air.Inst.Ref { |
| 6809 | const array_ty = switch (array_ptr.ty.zigTypeTag()) { | 6816 | const array_ty = switch (array_ptr.ty.zigTypeTag()) { |
| 6810 | .Pointer => array_ptr.ty.elemType(), | 6817 | .Pointer => array_ptr.ty.elemType(), |
| 6811 | else => return sema.mod.fail(&block.base, array_ptr.src, "expected pointer, found '{}'", .{array_ptr.ty}), | 6818 | else => return sema.mod.fail(&block.base, array_ptr.src, "expected pointer, found '{}'", .{array_ptr.ty}), |
| ... | @@ -6832,7 +6839,7 @@ fn elemPtrArray( | ... | @@ -6832,7 +6839,7 @@ fn elemPtrArray( |
| 6832 | array_ptr: Air.Inst.Ref, | 6839 | array_ptr: Air.Inst.Ref, |
| 6833 | elem_index: Air.Inst.Ref, | 6840 | elem_index: Air.Inst.Ref, |
| 6834 | elem_index_src: LazySrcLoc, | 6841 | elem_index_src: LazySrcLoc, |
| 6835 | ) InnerError!Air.Inst.Ref { | 6842 | ) CompileError!Air.Inst.Ref { |
| 6836 | if (array_ptr.value()) |array_ptr_val| { | 6843 | if (array_ptr.value()) |array_ptr_val| { |
| 6837 | if (elem_index.value()) |index_val| { | 6844 | if (elem_index.value()) |index_val| { |
| 6838 | // Both array pointer and index are compile-time known. | 6845 | // Both array pointer and index are compile-time known. |
| ... | @@ -6859,7 +6866,7 @@ fn coerce( | ... | @@ -6859,7 +6866,7 @@ fn coerce( |
| 6859 | dest_type: Type, | 6866 | dest_type: Type, |
| 6860 | inst: Air.Inst.Ref, | 6867 | inst: Air.Inst.Ref, |
| 6861 | inst_src: LazySrcLoc, | 6868 | inst_src: LazySrcLoc, |
| 6862 | ) InnerError!Air.Inst.Ref { | 6869 | ) CompileError!Air.Inst.Ref { |
| 6863 | if (dest_type.tag() == .var_args_param) { | 6870 | if (dest_type.tag() == .var_args_param) { |
| 6864 | return sema.coerceVarArgParam(block, inst, inst_src); | 6871 | return sema.coerceVarArgParam(block, inst, inst_src); |
| 6865 | } | 6872 | } |
| ... | @@ -7041,7 +7048,7 @@ fn coerceInMemoryAllowed(dest_type: Type, src_type: Type) InMemoryCoercionResult | ... | @@ -7041,7 +7048,7 @@ fn coerceInMemoryAllowed(dest_type: Type, src_type: Type) InMemoryCoercionResult |
| 7041 | return .no_match; | 7048 | return .no_match; |
| 7042 | } | 7049 | } |
| 7043 | | 7050 | |
| 7044 | fn coerceNum(sema: *Sema, block: *Scope.Block, dest_type: Type, inst: Air.Inst.Ref) InnerError!?Air.Inst.Index { | 7051 | fn coerceNum(sema: *Sema, block: *Scope.Block, dest_type: Type, inst: Air.Inst.Ref) CompileError!?Air.Inst.Index { |
| 7045 | const val = inst.value() orelse return null; | 7052 | const val = inst.value() orelse return null; |
| 7046 | const src_zig_tag = inst.ty.zigTypeTag(); | 7053 | const src_zig_tag = inst.ty.zigTypeTag(); |
| 7047 | const dst_zig_tag = dest_type.zigTypeTag(); | 7054 | const dst_zig_tag = dest_type.zigTypeTag(); |
| ... | @@ -7153,7 +7160,7 @@ fn bitcast( | ... | @@ -7153,7 +7160,7 @@ fn bitcast( |
| 7153 | dest_type: Type, | 7160 | dest_type: Type, |
| 7154 | inst: Air.Inst.Ref, | 7161 | inst: Air.Inst.Ref, |
| 7155 | inst_src: LazySrcLoc, | 7162 | inst_src: LazySrcLoc, |
| 7156 | ) InnerError!Air.Inst.Ref { | 7163 | ) CompileError!Air.Inst.Ref { |
| 7157 | if (try sema.resolvePossiblyUndefinedValue(block, inst_src, inst)) |val| { | 7164 | if (try sema.resolvePossiblyUndefinedValue(block, inst_src, inst)) |val| { |
| 7158 | // Keep the comptime Value representation; take the new type. | 7165 | // Keep the comptime Value representation; take the new type. |
| 7159 | return sema.addConstant(dest_type, val); | 7166 | return sema.addConstant(dest_type, val); |
| ... | @@ -7163,7 +7170,7 @@ fn bitcast( | ... | @@ -7163,7 +7170,7 @@ fn bitcast( |
| 7163 | return block.addTyOp(.bitcast, dest_type, inst); | 7170 | return block.addTyOp(.bitcast, dest_type, inst); |
| 7164 | } | 7171 | } |
| 7165 | | 7172 | |
| 7166 | fn coerceArrayPtrToSlice(sema: *Sema, block: *Scope.Block, dest_type: Type, inst: Air.Inst.Ref) InnerError!Air.Inst.Ref { | 7173 | fn coerceArrayPtrToSlice(sema: *Sema, block: *Scope.Block, dest_type: Type, inst: Air.Inst.Ref) CompileError!Air.Inst.Ref { |
| 7167 | if (inst.value()) |val| { | 7174 | if (inst.value()) |val| { |
| 7168 | // The comptime Value representation is compatible with both types. | 7175 | // The comptime Value representation is compatible with both types. |
| 7169 | return sema.mod.constInst(sema.arena, inst.src, .{ .ty = dest_type, .val = val }); | 7176 | return sema.mod.constInst(sema.arena, inst.src, .{ .ty = dest_type, .val = val }); |
| ... | @@ -7179,12 +7186,12 @@ fn coerceArrayPtrToMany(sema: *Sema, block: *Scope.Block, dest_type: Type, inst: | ... | @@ -7179,12 +7186,12 @@ fn coerceArrayPtrToMany(sema: *Sema, block: *Scope.Block, dest_type: Type, inst: |
| 7179 | return sema.mod.fail(&block.base, inst.src, "TODO implement coerceArrayPtrToMany runtime instruction", .{}); | 7186 | return sema.mod.fail(&block.base, inst.src, "TODO implement coerceArrayPtrToMany runtime instruction", .{}); |
| 7180 | } | 7187 | } |
| 7181 | | 7188 | |
| 7182 | fn analyzeDeclVal(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl) InnerError!Air.Inst.Ref { | 7189 | fn analyzeDeclVal(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl) CompileError!Air.Inst.Ref { |
| 7183 | const decl_ref = try sema.analyzeDeclRef(block, src, decl); | 7190 | const decl_ref = try sema.analyzeDeclRef(block, src, decl); |
| 7184 | return sema.analyzeLoad(block, src, decl_ref, src); | 7191 | return sema.analyzeLoad(block, src, decl_ref, src); |
| 7185 | } | 7192 | } |
| 7186 | | 7193 | |
| 7187 | fn analyzeDeclRef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl) InnerError!Air.Inst.Ref { | 7194 | fn analyzeDeclRef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl) CompileError!Air.Inst.Ref { |
| 7188 | try sema.mod.declareDeclDependency(sema.owner_decl, decl); | 7195 | try sema.mod.declareDeclDependency(sema.owner_decl, decl); |
| 7189 | sema.mod.ensureDeclAnalyzed(decl) catch |err| { | 7196 | sema.mod.ensureDeclAnalyzed(decl) catch |err| { |
| 7190 | if (sema.func) |func| { | 7197 | if (sema.func) |func| { |
| ... | @@ -7205,7 +7212,7 @@ fn analyzeDeclRef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl | ... | @@ -7205,7 +7212,7 @@ fn analyzeDeclRef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl |
| 7205 | ); | 7212 | ); |
| 7206 | } | 7213 | } |
| 7207 | | 7214 | |
| 7208 | fn analyzeVarRef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, tv: TypedValue) InnerError!Air.Inst.Ref { | 7215 | fn analyzeVarRef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, tv: TypedValue) CompileError!Air.Inst.Ref { |
| 7209 | const variable = tv.val.castTag(.variable).?.data; | 7216 | const variable = tv.val.castTag(.variable).?.data; |
| 7210 | | 7217 | |
| 7211 | const ty = try Module.simplePtrType(sema.arena, tv.ty, variable.is_mutable, .One); | 7218 | const ty = try Module.simplePtrType(sema.arena, tv.ty, variable.is_mutable, .One); |
| ... | @@ -7233,7 +7240,7 @@ fn analyzeRef( | ... | @@ -7233,7 +7240,7 @@ fn analyzeRef( |
| 7233 | block: *Scope.Block, | 7240 | block: *Scope.Block, |
| 7234 | src: LazySrcLoc, | 7241 | src: LazySrcLoc, |
| 7235 | operand: Air.Inst.Ref, | 7242 | operand: Air.Inst.Ref, |
| 7236 | ) InnerError!Air.Inst.Ref { | 7243 | ) CompileError!Air.Inst.Ref { |
| 7237 | const ptr_type = try sema.mod.simplePtrType(sema.arena, operand.ty, false, .One); | 7244 | const ptr_type = try sema.mod.simplePtrType(sema.arena, operand.ty, false, .One); |
| 7238 | | 7245 | |
| 7239 | if (try sema.resolvePossiblyUndefinedValue(block, src, operand)) |val| { | 7246 | if (try sema.resolvePossiblyUndefinedValue(block, src, operand)) |val| { |
| ... | @@ -7253,7 +7260,7 @@ fn analyzeLoad( | ... | @@ -7253,7 +7260,7 @@ fn analyzeLoad( |
| 7253 | src: LazySrcLoc, | 7260 | src: LazySrcLoc, |
| 7254 | ptr: Air.Inst.Ref, | 7261 | ptr: Air.Inst.Ref, |
| 7255 | ptr_src: LazySrcLoc, | 7262 | ptr_src: LazySrcLoc, |
| 7256 | ) InnerError!Air.Inst.Ref { | 7263 | ) CompileError!Air.Inst.Ref { |
| 7257 | const ptr_ty = sema.getTypeOf(ptr); | 7264 | const ptr_ty = sema.getTypeOf(ptr); |
| 7258 | const elem_ty = switch (ptr_ty.zigTypeTag()) { | 7265 | const elem_ty = switch (ptr_ty.zigTypeTag()) { |
| 7259 | .Pointer => ptr_ty.elemType(), | 7266 | .Pointer => ptr_ty.elemType(), |
| ... | @@ -7276,7 +7283,7 @@ fn analyzeIsNull( | ... | @@ -7276,7 +7283,7 @@ fn analyzeIsNull( |
| 7276 | src: LazySrcLoc, | 7283 | src: LazySrcLoc, |
| 7277 | operand: Air.Inst.Ref, | 7284 | operand: Air.Inst.Ref, |
| 7278 | invert_logic: bool, | 7285 | invert_logic: bool, |
| 7279 | ) InnerError!Air.Inst.Ref { | 7286 | ) CompileError!Air.Inst.Ref { |
| 7280 | const result_ty = Type.initTag(.bool); | 7287 | const result_ty = Type.initTag(.bool); |
| 7281 | if (try sema.resolvePossiblyUndefinedValue(block, src, operand)) |opt_val| { | 7288 | if (try sema.resolvePossiblyUndefinedValue(block, src, operand)) |opt_val| { |
| 7282 | if (opt_val.isUndef()) { | 7289 | if (opt_val.isUndef()) { |
| ... | @@ -7300,7 +7307,7 @@ fn analyzeIsNonErr( | ... | @@ -7300,7 +7307,7 @@ fn analyzeIsNonErr( |
| 7300 | block: *Scope.Block, | 7307 | block: *Scope.Block, |
| 7301 | src: LazySrcLoc, | 7308 | src: LazySrcLoc, |
| 7302 | operand: Air.Inst.Ref, | 7309 | operand: Air.Inst.Ref, |
| 7303 | ) InnerError!Air.Inst.Ref { | 7310 | ) CompileError!Air.Inst.Ref { |
| 7304 | const ot = operand.ty.zigTypeTag(); | 7311 | const ot = operand.ty.zigTypeTag(); |
| 7305 | if (ot != .ErrorSet and ot != .ErrorUnion) return Air.Inst.Ref.bool_true; | 7312 | if (ot != .ErrorSet and ot != .ErrorUnion) return Air.Inst.Ref.bool_true; |
| 7306 | if (ot == .ErrorSet) return Air.Inst.Ref.bool_false; | 7313 | if (ot == .ErrorSet) return Air.Inst.Ref.bool_false; |
| ... | @@ -7329,7 +7336,7 @@ fn analyzeSlice( | ... | @@ -7329,7 +7336,7 @@ fn analyzeSlice( |
| 7329 | end_opt: ?Air.Inst.Index, | 7336 | end_opt: ?Air.Inst.Index, |
| 7330 | sentinel_opt: ?Air.Inst.Index, | 7337 | sentinel_opt: ?Air.Inst.Index, |
| 7331 | sentinel_src: LazySrcLoc, | 7338 | sentinel_src: LazySrcLoc, |
| 7332 | ) InnerError!Air.Inst.Ref { | 7339 | ) CompileError!Air.Inst.Ref { |
| 7333 | const ptr_child = switch (array_ptr.ty.zigTypeTag()) { | 7340 | const ptr_child = switch (array_ptr.ty.zigTypeTag()) { |
| 7334 | .Pointer => array_ptr.ty.elemType(), | 7341 | .Pointer => array_ptr.ty.elemType(), |
| 7335 | else => return sema.mod.fail(&block.base, src, "expected pointer, found '{}'", .{array_ptr.ty}), | 7342 | else => return sema.mod.fail(&block.base, src, "expected pointer, found '{}'", .{array_ptr.ty}), |
| ... | @@ -7405,7 +7412,7 @@ fn cmpNumeric( | ... | @@ -7405,7 +7412,7 @@ fn cmpNumeric( |
| 7405 | op: std.math.CompareOperator, | 7412 | op: std.math.CompareOperator, |
| 7406 | lhs_src: LazySrcLoc, | 7413 | lhs_src: LazySrcLoc, |
| 7407 | rhs_src: LazySrcLoc, | 7414 | rhs_src: LazySrcLoc, |
| 7408 | ) InnerError!Air.Inst.Ref { | 7415 | ) CompileError!Air.Inst.Ref { |
| 7409 | const lhs_ty = sema.getTypeOf(lhs); | 7416 | const lhs_ty = sema.getTypeOf(lhs); |
| 7410 | const rhs_ty = sema.getTypeOf(rhs); | 7417 | const rhs_ty = sema.getTypeOf(rhs); |
| 7411 | | 7418 | |
| ... | @@ -7746,7 +7753,7 @@ fn resolvePeerTypes( | ... | @@ -7746,7 +7753,7 @@ fn resolvePeerTypes( |
| 7746 | return chosen.ty; | 7753 | return chosen.ty; |
| 7747 | } | 7754 | } |
| 7748 | | 7755 | |
| 7749 | fn resolveTypeFields(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, ty: Type) InnerError!Type { | 7756 | fn resolveTypeFields(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, ty: Type) CompileError!Type { |
| 7750 | switch (ty.tag()) { | 7757 | switch (ty.tag()) { |
| 7751 | .@"struct" => { | 7758 | .@"struct" => { |
| 7752 | const struct_obj = ty.castTag(.@"struct").?.data; | 7759 | const struct_obj = ty.castTag(.@"struct").?.data; |
| ... | @@ -7798,7 +7805,7 @@ fn resolveBuiltinTypeFields( | ... | @@ -7798,7 +7805,7 @@ fn resolveBuiltinTypeFields( |
| 7798 | block: *Scope.Block, | 7805 | block: *Scope.Block, |
| 7799 | src: LazySrcLoc, | 7806 | src: LazySrcLoc, |
| 7800 | name: []const u8, | 7807 | name: []const u8, |
| 7801 | ) InnerError!Type { | 7808 | ) CompileError!Type { |
| 7802 | const resolved_ty = try sema.getBuiltinType(block, src, name); | 7809 | const resolved_ty = try sema.getBuiltinType(block, src, name); |
| 7803 | return sema.resolveTypeFields(block, src, resolved_ty); | 7810 | return sema.resolveTypeFields(block, src, resolved_ty); |
| 7804 | } | 7811 | } |
| ... | @@ -7808,7 +7815,7 @@ fn getBuiltin( | ... | @@ -7808,7 +7815,7 @@ fn getBuiltin( |
| 7808 | block: *Scope.Block, | 7815 | block: *Scope.Block, |
| 7809 | src: LazySrcLoc, | 7816 | src: LazySrcLoc, |
| 7810 | name: []const u8, | 7817 | name: []const u8, |
| 7811 | ) InnerError!Air.Inst.Ref { | 7818 | ) CompileError!Air.Inst.Ref { |
| 7812 | const mod = sema.mod; | 7819 | const mod = sema.mod; |
| 7813 | const std_pkg = mod.root_pkg.table.get("std").?; | 7820 | const std_pkg = mod.root_pkg.table.get("std").?; |
| 7814 | const std_file = (mod.importPkg(std_pkg) catch unreachable).file; | 7821 | const std_file = (mod.importPkg(std_pkg) catch unreachable).file; |
| ... | @@ -7834,7 +7841,7 @@ fn getBuiltinType( | ... | @@ -7834,7 +7841,7 @@ fn getBuiltinType( |
| 7834 | block: *Scope.Block, | 7841 | block: *Scope.Block, |
| 7835 | src: LazySrcLoc, | 7842 | src: LazySrcLoc, |
| 7836 | name: []const u8, | 7843 | name: []const u8, |
| 7837 | ) InnerError!Type { | 7844 | ) CompileError!Type { |
| 7838 | const ty_inst = try sema.getBuiltin(block, src, name); | 7845 | const ty_inst = try sema.getBuiltin(block, src, name); |
| 7839 | return sema.resolveAirAsType(block, src, ty_inst); | 7846 | return sema.resolveAirAsType(block, src, ty_inst); |
| 7840 | } | 7847 | } |
| ... | @@ -7848,7 +7855,7 @@ fn typeHasOnePossibleValue( | ... | @@ -7848,7 +7855,7 @@ fn typeHasOnePossibleValue( |
| 7848 | block: *Scope.Block, | 7855 | block: *Scope.Block, |
| 7849 | src: LazySrcLoc, | 7856 | src: LazySrcLoc, |
| 7850 | starting_type: Type, | 7857 | starting_type: Type, |
| 7851 | ) InnerError!?Value { | 7858 | ) CompileError!?Value { |
| 7852 | var ty = starting_type; | 7859 | var ty = starting_type; |
| 7853 | while (true) switch (ty.tag()) { | 7860 | while (true) switch (ty.tag()) { |
| 7854 | .f16, | 7861 | .f16, |
| ... | @@ -7986,7 +7993,7 @@ fn typeHasOnePossibleValue( | ... | @@ -7986,7 +7993,7 @@ fn typeHasOnePossibleValue( |
| 7986 | }; | 7993 | }; |
| 7987 | } | 7994 | } |
| 7988 | | 7995 | |
| 7989 | fn getAstTree(sema: *Sema, block: *Scope.Block) InnerError!*const std.zig.ast.Tree { | 7996 | fn getAstTree(sema: *Sema, block: *Scope.Block) CompileError!*const std.zig.ast.Tree { |
| 7990 | return block.src_decl.namespace.file_scope.getTree(sema.gpa) catch |err| { | 7997 | return block.src_decl.namespace.file_scope.getTree(sema.gpa) catch |err| { |
| 7991 | log.err("unable to load AST to report compile error: {s}", .{@errorName(err)}); | 7998 | log.err("unable to load AST to report compile error: {s}", .{@errorName(err)}); |
| 7992 | return error.AnalysisFail; | 7999 | return error.AnalysisFail; |
| ... | @@ -8166,15 +8173,15 @@ pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref { | ... | @@ -8166,15 +8173,15 @@ pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref { |
| 8166 | return indexToRef(@intCast(u32, sema.air_instructions.len - 1)); | 8173 | return indexToRef(@intCast(u32, sema.air_instructions.len - 1)); |
| 8167 | } | 8174 | } |
| 8168 | | 8175 | |
| 8169 | fn addIntUnsigned(sema: *Sema, ty: Type, int: u64) InnerError!Air.Inst.Ref { | 8176 | fn addIntUnsigned(sema: *Sema, ty: Type, int: u64) CompileError!Air.Inst.Ref { |
| 8170 | return sema.addConstant(ty, try Value.Tag.int_u64.create(sema.arena, int)); | 8177 | return sema.addConstant(ty, try Value.Tag.int_u64.create(sema.arena, int)); |
| 8171 | } | 8178 | } |
| 8172 | | 8179 | |
| 8173 | fn addConstUndef(sema: *Sema, ty: Type) InnerError!Air.Inst.Ref { | 8180 | fn addConstUndef(sema: *Sema, ty: Type) CompileError!Air.Inst.Ref { |
| 8174 | return sema.addConstant(ty, Value.initTag(.undef)); | 8181 | return sema.addConstant(ty, Value.initTag(.undef)); |
| 8175 | } | 8182 | } |
| 8176 | | 8183 | |
| 8177 | fn addConstant(sema: *Sema, ty: Type, val: Value) InnerError!Air.Inst.Ref { | 8184 | fn addConstant(sema: *Sema, ty: Type, val: Value) CompileError!Air.Inst.Ref { |
| 8178 | const gpa = sema.gpa; | 8185 | const gpa = sema.gpa; |
| 8179 | const ty_inst = try sema.addType(ty); | 8186 | const ty_inst = try sema.addType(ty); |
| 8180 | try sema.air_values.append(gpa, val); | 8187 | try sema.air_values.append(gpa, val); |