authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-06-19 21:35:17+07:00
committergravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-06-24 21:19:33+07:00
logdd57729299dea8d388e2e76c79b8c090b7e4164e
treeaeca8639159038f501dc4d096e82a580483a66b0
parente2cb25358e312009fef2d24b80a1e286e0494ee6

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.

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

src/arch/sparc64/CodeGen.zig+5-21
...@@ -236,26 +236,12 @@ const CallMCValues = struct {...@@ -236,26 +236,12 @@ const CallMCValues = struct {
236const BigTomb = struct {236const BigTomb = struct {
237 function: *Self,237 function: *Self,
238 inst: Air.Inst.Index,238 inst: Air.Inst.Index,
239 tomb_bits: Liveness.Bpi,239 lbt: Liveness.BigTomb,
240 big_tomb_bits: u32,
241 bit_index: usize,
242240
243 fn feed(bt: *BigTomb, op_ref: Air.Inst.Ref) void {241 fn feed(bt: *BigTomb, op_ref: Air.Inst.Ref) void {
244 const this_bit_index = bt.bit_index;242 const dies = bt.lbt.feed();
245 bt.bit_index += 1;243 const op_index = Air.refToIndex(op_ref) orelse return;
246244 if (!dies) return;
247 const op_int = @enumToInt(op_ref);
248 if (op_int < Air.Inst.Ref.typed_value_map.len) return;
249 const op_index = @intCast(Air.Inst.Index, op_int - Air.Inst.Ref.typed_value_map.len);
250
251 if (this_bit_index < Liveness.bpi - 1) {
252 const dies = @truncate(u1, bt.tomb_bits >> @intCast(Liveness.OperandInt, this_bit_index)) != 0;
253 if (!dies) return;
254 } else {
255 const big_bit_index = @intCast(u5, this_bit_index - (Liveness.bpi - 1));
256 const dies = @truncate(u1, bt.big_tomb_bits >> big_bit_index) != 0;
257 if (!dies) return;
258 }
259 bt.function.processDeath(op_index);245 bt.function.processDeath(op_index);
260 }246 }
261247
...@@ -3360,9 +3346,7 @@ fn iterateBigTomb(self: *Self, inst: Air.Inst.Index, operand_count: usize) !BigT...@@ -3360,9 +3346,7 @@ fn iterateBigTomb(self: *Self, inst: Air.Inst.Index, operand_count: usize) !BigT
3360 return BigTomb{3346 return BigTomb{
3361 .function = self,3347 .function = self,
3362 .inst = inst,3348 .inst = inst,
3363 .tomb_bits = self.liveness.getTombBits(inst),3349 .lbt = self.liveness.iterateBigTomb(inst),
3364 .big_tomb_bits = self.liveness.special.get(inst) orelse 0,
3365 .bit_index = 0,
3366 };3350 };
3367}3351}
33683352