| ... | @@ -119,12 +119,6 @@ const MCValue = union(enum) { | ... | @@ -119,12 +119,6 @@ const MCValue = union(enum) { |
| 119 | stack_offset: u32, | 119 | stack_offset: u32, |
| 120 | /// The value is a pointer to one of the stack variables (payload is stack offset). | 120 | /// The value is a pointer to one of the stack variables (payload is stack offset). |
| 121 | ptr_stack_offset: u32, | 121 | ptr_stack_offset: u32, |
| 122 | /// The value is in the compare flags assuming an unsigned operation, | | |
| 123 | /// with this operator applied on top of it. | | |
| 124 | compare_flags_unsigned: math.CompareOperator, | | |
| 125 | /// The value is in the compare flags assuming a signed operation, | | |
| 126 | /// with this operator applied on top of it. | | |
| 127 | compare_flags_signed: math.CompareOperator, | | |
| 128 | | 122 | |
| 129 | fn isMemory(mcv: MCValue) bool { | 123 | fn isMemory(mcv: MCValue) bool { |
| 130 | return switch (mcv) { | 124 | return switch (mcv) { |
| ... | @@ -149,8 +143,6 @@ const MCValue = union(enum) { | ... | @@ -149,8 +143,6 @@ const MCValue = union(enum) { |
| 149 | .immediate, | 143 | .immediate, |
| 150 | .embedded_in_code, | 144 | .embedded_in_code, |
| 151 | .memory, | 145 | .memory, |
| 152 | .compare_flags_unsigned, | | |
| 153 | .compare_flags_signed, | | |
| 154 | .ptr_stack_offset, | 146 | .ptr_stack_offset, |
| 155 | .ptr_embedded_in_code, | 147 | .ptr_embedded_in_code, |
| 156 | .undef, | 148 | .undef, |
| ... | @@ -844,45 +836,8 @@ fn airBoolToInt(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -844,45 +836,8 @@ fn airBoolToInt(self: *Self, inst: Air.Inst.Index) !void { |
| 844 | | 836 | |
| 845 | fn airNot(self: *Self, inst: Air.Inst.Index) !void { | 837 | fn airNot(self: *Self, inst: Air.Inst.Index) !void { |
| 846 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 838 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 847 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 839 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement NOT for {}", .{self.target.cpu.arch}); |
| 848 | const operand = try self.resolveInst(ty_op.operand); | 840 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 849 | switch (operand) { | | |
| 850 | .dead => unreachable, | | |
| 851 | .unreach => unreachable, | | |
| 852 | .compare_flags_unsigned => |op| { | | |
| 853 | const r = MCValue{ | | |
| 854 | .compare_flags_unsigned = switch (op) { | | |
| 855 | .gte => .lt, | | |
| 856 | .gt => .lte, | | |
| 857 | .neq => .eq, | | |
| 858 | .lt => .gte, | | |
| 859 | .lte => .gt, | | |
| 860 | .eq => .neq, | | |
| 861 | }, | | |
| 862 | }; | | |
| 863 | break :result r; | | |
| 864 | }, | | |
| 865 | .compare_flags_signed => |op| { | | |
| 866 | const r = MCValue{ | | |
| 867 | .compare_flags_signed = switch (op) { | | |
| 868 | .gte => .lt, | | |
| 869 | .gt => .lte, | | |
| 870 | .neq => .eq, | | |
| 871 | .lt => .gte, | | |
| 872 | .lte => .gt, | | |
| 873 | .eq => .neq, | | |
| 874 | }, | | |
| 875 | }; | | |
| 876 | break :result r; | | |
| 877 | }, | | |
| 878 | else => {}, | | |
| 879 | } | | |
| 880 | | | |
| 881 | return self.fail("TODO implement NOT for {}", .{self.target.cpu.arch}); | | |
| 882 | }; | | |
| 883 | | | |
| 884 | _ = result; | | |
| 885 | // return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | | |
| 886 | } | 841 | } |
| 887 | | 842 | |
| 888 | fn airMin(self: *Self, inst: Air.Inst.Index) !void { | 843 | fn airMin(self: *Self, inst: Air.Inst.Index) !void { |
| ... | @@ -1211,8 +1166,6 @@ fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!vo | ... | @@ -1211,8 +1166,6 @@ fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!vo |
| 1211 | .undef => unreachable, | 1166 | .undef => unreachable, |
| 1212 | .unreach => unreachable, | 1167 | .unreach => unreachable, |
| 1213 | .dead => unreachable, | 1168 | .dead => unreachable, |
| 1214 | .compare_flags_unsigned => unreachable, | | |
| 1215 | .compare_flags_signed => unreachable, | | |
| 1216 | .immediate => |imm| try self.setRegOrMem(elem_ty, dst_mcv, .{ .memory = imm }), | 1169 | .immediate => |imm| try self.setRegOrMem(elem_ty, dst_mcv, .{ .memory = imm }), |
| 1217 | .ptr_stack_offset => |off| try self.setRegOrMem(elem_ty, dst_mcv, .{ .stack_offset = off }), | 1170 | .ptr_stack_offset => |off| try self.setRegOrMem(elem_ty, dst_mcv, .{ .stack_offset = off }), |
| 1218 | .ptr_embedded_in_code => |off| { | 1171 | .ptr_embedded_in_code => |off| { |
| ... | @@ -1271,8 +1224,6 @@ fn airStore(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1271,8 +1224,6 @@ fn airStore(self: *Self, inst: Air.Inst.Index) !void { |
| 1271 | .undef => unreachable, | 1224 | .undef => unreachable, |
| 1272 | .unreach => unreachable, | 1225 | .unreach => unreachable, |
| 1273 | .dead => unreachable, | 1226 | .dead => unreachable, |
| 1274 | .compare_flags_unsigned => unreachable, | | |
| 1275 | .compare_flags_signed => unreachable, | | |
| 1276 | .immediate => |imm| { | 1227 | .immediate => |imm| { |
| 1277 | try self.setRegOrMem(elem_ty, .{ .memory = imm }, value); | 1228 | try self.setRegOrMem(elem_ty, .{ .memory = imm }, value); |
| 1278 | }, | 1229 | }, |
| ... | @@ -1427,8 +1378,6 @@ fn airCall(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1427,8 +1378,6 @@ fn airCall(self: *Self, inst: Air.Inst.Index) !void { |
| 1427 | .dead => unreachable, | 1378 | .dead => unreachable, |
| 1428 | .embedded_in_code => unreachable, | 1379 | .embedded_in_code => unreachable, |
| 1429 | .memory => unreachable, | 1380 | .memory => unreachable, |
| 1430 | .compare_flags_signed => unreachable, | | |
| 1431 | .compare_flags_unsigned => unreachable, | | |
| 1432 | .register => |reg| { | 1381 | .register => |reg| { |
| 1433 | try self.register_manager.getReg(reg, null); | 1382 | try self.register_manager.getReg(reg, null); |
| 1434 | try self.genSetReg(arg_ty, reg, arg_mcv); | 1383 | try self.genSetReg(arg_ty, reg, arg_mcv); |