authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-06-01 08:45:51+07:00
committergravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-06-06 20:34:53+07:00
log2dfe307d6003f36279742621b8da29a162a7149e
treec0ee1112d2a7449d86e7098a08073f4b3d096b49
parent89b4195c69c53e8b1fdd3f5ddd2c9658a61daaac

stage2: sparc64: Some bookkeeping fixes


1 files changed, 5 insertions(+), 3 deletions(-)

src/arch/sparc64/CodeGen.zig+5-3
...@@ -686,6 +686,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {...@@ -686,6 +686,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
686 // zig fmt: on686 // zig fmt: on
687 }687 }
688688
689 assert(!self.register_manager.lockedRegsExist());
690
689 if (std.debug.runtime_safety) {691 if (std.debug.runtime_safety) {
690 if (self.air_bookkeeping < old_air_bookkeeping + 1) {692 if (self.air_bookkeeping < old_air_bookkeeping + 1) {
691 std.debug.panic("in codegen.zig, handling of AIR instruction %{d} ('{}') did not do proper bookkeeping. Look for a missing call to finishAir.", .{ inst, air_tags[inst] });693 std.debug.panic("in codegen.zig, handling of AIR instruction %{d} ('{}') did not do proper bookkeeping. Look for a missing call to finishAir.", .{ inst, air_tags[inst] });
...@@ -2915,7 +2917,7 @@ fn isNonErr(self: *Self, ty: Type, operand: MCValue) !MCValue {...@@ -2915,7 +2917,7 @@ fn isNonErr(self: *Self, ty: Type, operand: MCValue) !MCValue {
2915 switch (is_err_result) {2917 switch (is_err_result) {
2916 .compare_flags_unsigned => |op| {2918 .compare_flags_unsigned => |op| {
2917 assert(op.cmp == .gt);2919 assert(op.cmp == .gt);
2918 return MCValue{ .compare_flags_unsigned = .{ .cmp = .gt, .ccr = op.ccr } };2920 return MCValue{ .compare_flags_unsigned = .{ .cmp = .lte, .ccr = op.ccr } };
2919 },2921 },
2920 .immediate => |imm| {2922 .immediate => |imm| {
2921 assert(imm == 0);2923 assert(imm == 0);
...@@ -3176,7 +3178,7 @@ fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue {...@@ -3176,7 +3178,7 @@ fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue {
3176 const ref_int = @enumToInt(inst);3178 const ref_int = @enumToInt(inst);
3177 if (ref_int < Air.Inst.Ref.typed_value_map.len) {3179 if (ref_int < Air.Inst.Ref.typed_value_map.len) {
3178 const tv = Air.Inst.Ref.typed_value_map[ref_int];3180 const tv = Air.Inst.Ref.typed_value_map[ref_int];
3179 if (!tv.ty.hasRuntimeBits()) {3181 if (!tv.ty.hasRuntimeBits() and !tv.ty.isError()) {
3180 return MCValue{ .none = {} };3182 return MCValue{ .none = {} };
3181 }3183 }
3182 return self.genTypedValue(tv);3184 return self.genTypedValue(tv);
...@@ -3184,7 +3186,7 @@ fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue {...@@ -3184,7 +3186,7 @@ fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue {
31843186
3185 // If the type has no codegen bits, no need to store it.3187 // If the type has no codegen bits, no need to store it.
3186 const inst_ty = self.air.typeOf(inst);3188 const inst_ty = self.air.typeOf(inst);
3187 if (!inst_ty.hasRuntimeBits())3189 if (!inst_ty.hasRuntimeBits() and !inst_ty.isError())
3188 return MCValue{ .none = {} };3190 return MCValue{ .none = {} };
31893191
3190 const inst_index = @intCast(Air.Inst.Index, ref_int - Air.Inst.Ref.typed_value_map.len);3192 const inst_index = @intCast(Air.Inst.Index, ref_int - Air.Inst.Ref.typed_value_map.len);