diff options
Diffstat (limited to 'src/arch/aarch64/CodeGen.zig')
| -rw-r--r-- | src/arch/aarch64/CodeGen.zig | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig index 4d212148b2..a87845df2e 100644 --- a/src/arch/aarch64/CodeGen.zig +++ b/src/arch/aarch64/CodeGen.zig @@ -845,7 +845,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { .ptr_elem_val => try self.airPtrElemVal(inst), .ptr_elem_ptr => try self.airPtrElemPtr(inst), - .inferred_alloc, .inferred_alloc_comptime, .interned => unreachable, + .inferred_alloc, .inferred_alloc_comptime => unreachable, .unreach => self.finishAirBookkeeping(), .optional_payload => try self.airOptionalPayload(inst), @@ -920,7 +920,6 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { /// Asserts there is already capacity to insert into top branch inst_table. fn processDeath(self: *Self, inst: Air.Inst.Index) void { - assert(self.air.instructions.items(.tag)[inst] != .interned); // When editing this function, note that the logic must synchronize with `reuseOperand`. const prev_value = self.getResolvedInstValue(inst); const branch = &self.branch_stack.items[self.branch_stack.items.len - 1]; @@ -953,9 +952,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live const dies = @as(u1, @truncate(tomb_bits)) != 0; tomb_bits >>= 1; if (!dies) continue; - const op_int = @intFromEnum(op); - if (op_int < Air.ref_start_index) continue; - const op_index = @as(Air.Inst.Index, @intCast(op_int - Air.ref_start_index)); + const op_index = Air.refToIndex(op) orelse continue; self.processDeath(op_index); } const is_used = @as(u1, @truncate(tomb_bits)) == 0; @@ -4696,9 +4693,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { // that death now instead of later as this has an effect on // whether it needs to be spilled in the branches if (self.liveness.operandDies(inst, 0)) { - const op_int = @intFromEnum(pl_op.operand); - if (op_int >= Air.ref_start_index) { - const op_index = @as(Air.Inst.Index, @intCast(op_int - Air.ref_start_index)); + if (Air.refToIndex(pl_op.operand)) |op_index| { self.processDeath(op_index); } } @@ -6149,22 +6144,7 @@ fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue { .val = (try self.air.value(inst, mod)).?, }); - switch (self.air.instructions.items(.tag)[inst_index]) { - .interned => { - // Constants have static lifetimes, so they are always memoized in the outer most table. - const branch = &self.branch_stack.items[0]; - const gop = try branch.inst_table.getOrPut(self.gpa, inst_index); - if (!gop.found_existing) { - const interned = self.air.instructions.items(.data)[inst_index].interned; - gop.value_ptr.* = try self.genTypedValue(.{ - .ty = inst_ty, - .val = interned.toValue(), - }); - } - return gop.value_ptr.*; - }, - else => return self.getResolvedInstValue(inst_index), - } + return self.getResolvedInstValue(inst_index); } fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) MCValue { |
