Begin integrating new liveness analysis into remaining backends

This commit is contained in:
mlugg 2023-04-19 01:58:39 +01:00
parent e088650653
commit 6f09a7041e
No known key found for this signature in database
GPG key ID: 58978E823BDE3EF9
6 changed files with 30 additions and 0 deletions

View file

@ -655,6 +655,11 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
const air_tags = self.air.instructions.items(.tag); const air_tags = self.air.instructions.items(.tag);
for (body) |inst| { for (body) |inst| {
// TODO: remove now-redundant isUnused calls from AIR handler functions
if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) {
continue;
}
const old_air_bookkeeping = self.air_bookkeeping; const old_air_bookkeeping = self.air_bookkeeping;
try self.ensureProcessDeathCapacity(Liveness.bpi); try self.ensureProcessDeathCapacity(Liveness.bpi);

View file

@ -639,6 +639,11 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
const air_tags = self.air.instructions.items(.tag); const air_tags = self.air.instructions.items(.tag);
for (body) |inst| { for (body) |inst| {
// TODO: remove now-redundant isUnused calls from AIR handler functions
if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) {
continue;
}
const old_air_bookkeeping = self.air_bookkeeping; const old_air_bookkeeping = self.air_bookkeeping;
try self.ensureProcessDeathCapacity(Liveness.bpi); try self.ensureProcessDeathCapacity(Liveness.bpi);

View file

@ -473,6 +473,11 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
const air_tags = self.air.instructions.items(.tag); const air_tags = self.air.instructions.items(.tag);
for (body) |inst| { for (body) |inst| {
// TODO: remove now-redundant isUnused calls from AIR handler functions
if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) {
continue;
}
const old_air_bookkeeping = self.air_bookkeeping; const old_air_bookkeeping = self.air_bookkeeping;
try self.ensureProcessDeathCapacity(Liveness.bpi); try self.ensureProcessDeathCapacity(Liveness.bpi);

View file

@ -489,6 +489,11 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
const air_tags = self.air.instructions.items(.tag); const air_tags = self.air.instructions.items(.tag);
for (body) |inst| { for (body) |inst| {
// TODO: remove now-redundant isUnused calls from AIR handler functions
if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) {
continue;
}
const old_air_bookkeeping = self.air_bookkeeping; const old_air_bookkeeping = self.air_bookkeeping;
try self.ensureProcessDeathCapacity(Liveness.bpi); try self.ensureProcessDeathCapacity(Liveness.bpi);

View file

@ -905,6 +905,11 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
const air_tags = self.air.instructions.items(.tag); const air_tags = self.air.instructions.items(.tag);
for (body) |inst| { for (body) |inst| {
// TODO: remove now-redundant isUnused calls from AIR handler functions
if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) {
continue;
}
const old_air_bookkeeping = self.air_bookkeeping; const old_air_bookkeeping = self.air_bookkeeping;
try self.ensureProcessDeathCapacity(Liveness.bpi); try self.ensureProcessDeathCapacity(Liveness.bpi);
if (builtin.mode == .Debug) { if (builtin.mode == .Debug) {

View file

@ -1507,6 +1507,11 @@ pub const DeclGen = struct {
} }
fn genInst(self: *DeclGen, inst: Air.Inst.Index) !void { fn genInst(self: *DeclGen, inst: Air.Inst.Index) !void {
// TODO: remove now-redundant isUnused calls from AIR handler functions
if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) {
return;
}
const air_tags = self.air.instructions.items(.tag); const air_tags = self.air.instructions.items(.tag);
const maybe_result_id: ?IdRef = switch (air_tags[inst]) { const maybe_result_id: ?IdRef = switch (air_tags[inst]) {
// zig fmt: off // zig fmt: off