Liveness: modify encoding to support over 32 operands

Prior to this, Liveness encoded `asm`, `call`, and `aggregate_init` with
a single 32-bit integer, allowing up to 35 operands (3 are provided by
the regular tomb_bits). However, the Zig language allows function calls
with more than 35 arguments, inline assembly with more than 35 inputs,
and anonymous tuples with more than 35 elements.

The new encoding stores an index to the extra array instead of the bits
directly, and then as many extra elements as needed to encode all the
operands. The MSB is used as a flag to tell which element is the last
one, allowing for 31 bits per element.

Prior to this, print_air did not bother correctly printing tombstones
for these instructions; now it does.

In addition to updating the BigTomb iteration logic in the machine code
backends, this commit extracts the common logic into the Liveness namespace.
This commit is contained in:
Andrew Kelley
2022-04-12 07:05:58 -07:00
parent 17631cb2d3
commit b0edd8752a
8 changed files with 240 additions and 90 deletions

View File

@@ -1348,7 +1348,7 @@ pub const DeclGen = struct {
return w.writeAll(name);
},
.ErrorSet => {
comptime std.debug.assert(Type.initTag(.anyerror).abiSize(builtin.target) == 2);
comptime assert(Type.initTag(.anyerror).abiSize(builtin.target) == 2);
return w.writeAll("uint16_t");
},
.ErrorUnion => {