aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKoakuma <koachan@protonmail.com>2022-06-19 21:35:17 +0700
committerKoakuma <koachan@protonmail.com>2022-06-24 21:19:33 +0700
commitdd57729299dea8d388e2e76c79b8c090b7e4164e (patch)
treeaeca8639159038f501dc4d096e82a580483a66b0 /src
parente2cb25358e312009fef2d24b80a1e286e0494ee6 (diff)
downloadzig-dd57729299dea8d388e2e76c79b8c090b7e4164e.tar.gz
zig-dd57729299dea8d388e2e76c79b8c090b7e4164e.zip
stage2: sparc64: Update BigTomb implementation to use Liveness
Change BigTomb implementation to call to Liveness' implementation rather than implementing feed() in itself. This is modelled after the AArch64 backend.
Diffstat (limited to 'src')
-rw-r--r--src/arch/sparc64/CodeGen.zig26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/arch/sparc64/CodeGen.zig b/src/arch/sparc64/CodeGen.zig
index f4387f066a..d8e46d4bf5 100644
--- a/src/arch/sparc64/CodeGen.zig
+++ b/src/arch/sparc64/CodeGen.zig
@@ -236,26 +236,12 @@ const CallMCValues = struct {
const BigTomb = struct {
function: *Self,
inst: Air.Inst.Index,
- tomb_bits: Liveness.Bpi,
- big_tomb_bits: u32,
- bit_index: usize,
+ lbt: Liveness.BigTomb,
fn feed(bt: *BigTomb, op_ref: Air.Inst.Ref) void {
- const this_bit_index = bt.bit_index;
- bt.bit_index += 1;
-
- const op_int = @enumToInt(op_ref);
- if (op_int < Air.Inst.Ref.typed_value_map.len) return;
- const op_index = @intCast(Air.Inst.Index, op_int - Air.Inst.Ref.typed_value_map.len);
-
- if (this_bit_index < Liveness.bpi - 1) {
- const dies = @truncate(u1, bt.tomb_bits >> @intCast(Liveness.OperandInt, this_bit_index)) != 0;
- if (!dies) return;
- } else {
- const big_bit_index = @intCast(u5, this_bit_index - (Liveness.bpi - 1));
- const dies = @truncate(u1, bt.big_tomb_bits >> big_bit_index) != 0;
- if (!dies) return;
- }
+ const dies = bt.lbt.feed();
+ const op_index = Air.refToIndex(op_ref) orelse return;
+ if (!dies) return;
bt.function.processDeath(op_index);
}
@@ -3360,9 +3346,7 @@ fn iterateBigTomb(self: *Self, inst: Air.Inst.Index, operand_count: usize) !BigT
return BigTomb{
.function = self,
.inst = inst,
- .tomb_bits = self.liveness.getTombBits(inst),
- .big_tomb_bits = self.liveness.special.get(inst) orelse 0,
- .bit_index = 0,
+ .lbt = self.liveness.iterateBigTomb(inst),
};
}