diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2025-06-15 11:36:15 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2025-06-15 11:42:03 -0400 |
| commit | 6e72026e3b04586cf44deadeddeb8bf44a42ee99 (patch) | |
| tree | 03524f47e38bd7d150bff083b52aca7c7700073a /src/codegen/c.zig | |
| parent | 1ca213dab02db42c63a6b7e191044c0124f9bfb2 (diff) | |
| download | zig-6e72026e3b04586cf44deadeddeb8bf44a42ee99.tar.gz zig-6e72026e3b04586cf44deadeddeb8bf44a42ee99.zip | |
Legalize: make the feature set comptime-known in zig1
This allows legalizations to be added that aren't used by zig1 without
affecting the size of zig1.
Diffstat (limited to 'src/codegen/c.zig')
| -rw-r--r-- | src/codegen/c.zig | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index f4952d4a58..0fe3f80919 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -23,12 +23,19 @@ const BigIntLimb = std.math.big.Limb; const BigInt = std.math.big.int; pub fn legalizeFeatures(_: *const std.Target) ?*const Air.Legalize.Features { - return if (dev.env.supports(.legalize)) comptime &.initMany(&.{ - .expand_intcast_safe, - .expand_add_safe, - .expand_sub_safe, - .expand_mul_safe, - }) else null; // we don't currently ask zig1 to use safe optimization modes + return comptime switch (dev.env.supports(.legalize)) { + inline false, true => |supports_legalize| &.init(.{ + // we don't currently ask zig1 to use safe optimization modes + .expand_intcast_safe = supports_legalize, + .expand_add_safe = supports_legalize, + .expand_sub_safe = supports_legalize, + .expand_mul_safe = supports_legalize, + + .expand_packed_load = true, + .expand_packed_store = true, + .expand_packed_struct_field_val = true, + }), + }; } /// For most backends, MIR is basically a sequence of machine code instructions, perhaps with some |
