| author | |
| committer | |
| log | d9b6d1ed33d18eb13fa2cb39da3e7a381742975b |
| tree | afdfcb8ec66c779f9afc064f27befa3ce8036c63 |
| parent | 4c4dacf81a5da85a1f7d1550ed45f5cb20fd1524 |
| signature |
This is valid if the bootstrap dev env doesn't need to support runtime
safety. Another solution can always be implemented if needs change.5 files changed, 13 insertions(+), 4 deletions(-)
src/arch/riscv64/CodeGen.zig+1-1| ... | ... | @@ -51,7 +51,7 @@ const Instruction = encoding.Instruction; |
| 51 | 51 | |
| 52 | 52 | const InnerError = CodeGenError || error{OutOfRegisters}; |
| 53 | 53 | |
| 54 | pub fn legalizeFeatures(_: *const std.Target) ?*const Air.Legalize.Features { | |
| 54 | pub fn legalizeFeatures(_: *const std.Target) *const Air.Legalize.Features { | |
| 55 | 55 | return comptime &.initMany(&.{ |
| 56 | 56 | .expand_intcast_safe, |
| 57 | 57 | .expand_add_safe, |
src/arch/wasm/CodeGen.zig+1-1| ... | ... | @@ -31,7 +31,7 @@ const libcFloatSuffix = target_util.libcFloatSuffix; |
| 31 | 31 | const compilerRtFloatAbbrev = target_util.compilerRtFloatAbbrev; |
| 32 | 32 | const compilerRtIntAbbrev = target_util.compilerRtIntAbbrev; |
| 33 | 33 | |
| 34 | pub fn legalizeFeatures(_: *const std.Target) ?*const Air.Legalize.Features { | |
| 34 | pub fn legalizeFeatures(_: *const std.Target) *const Air.Legalize.Features { | |
| 35 | 35 | return comptime &.initMany(&.{ |
| 36 | 36 | .expand_intcast_safe, |
| 37 | 37 | .expand_add_safe, |
src/codegen/c.zig+7-1| ... | ... | @@ -4,6 +4,7 @@ const assert = std.debug.assert; |
| 4 | 4 | const mem = std.mem; |
| 5 | 5 | const log = std.log.scoped(.c); |
| 6 | 6 | |
| 7 | const dev = @import("../dev.zig"); | |
| 7 | 8 | const link = @import("../link.zig"); |
| 8 | 9 | const Zcu = @import("../Zcu.zig"); |
| 9 | 10 | const Module = @import("../Package/Module.zig"); |
| ... | ... | @@ -21,7 +22,12 @@ const BigIntLimb = std.math.big.Limb; |
| 21 | 22 | const BigInt = std.math.big.int; |
| 22 | 23 | |
| 23 | 24 | pub fn legalizeFeatures(_: *const std.Target) ?*const Air.Legalize.Features { |
| 24 | return null; | |
| 25 | return if (dev.env.supports(.legalize)) comptime &.initMany(&.{ | |
| 26 | .expand_intcast_safe, | |
| 27 | .expand_add_safe, | |
| 28 | .expand_sub_safe, | |
| 29 | .expand_mul_safe, | |
| 30 | }) else null; // we don't currently ask zig1 to use safe optimization modes | |
| 25 | 31 | } |
| 26 | 32 | |
| 27 | 33 | pub const CType = @import("c/Type.zig"); |
src/codegen/spirv.zig+1-1| ... | ... | @@ -28,7 +28,7 @@ const SpvAssembler = @import("spirv/Assembler.zig"); |
| 28 | 28 | |
| 29 | 29 | const InstMap = std.AutoHashMapUnmanaged(Air.Inst.Index, IdRef); |
| 30 | 30 | |
| 31 | pub fn legalizeFeatures(_: *const std.Target) ?*const Air.Legalize.Features { | |
| 31 | pub fn legalizeFeatures(_: *const std.Target) *const Air.Legalize.Features { | |
| 32 | 32 | return comptime &.initMany(&.{ |
| 33 | 33 | .expand_intcast_safe, |
| 34 | 34 | .expand_add_safe, |
src/dev.zig+3| ... | ... | @@ -1,5 +1,8 @@ |
| 1 | 1 | pub const Env = enum { |
| 2 | 2 | /// zig1 features |
| 3 | /// - `-ofmt=c` only | |
| 4 | /// - `-OReleaseFast` or `-OReleaseSmall` only | |
| 5 | /// - no `@setRuntimeSafety(true)` | |
| 3 | 6 | bootstrap, |
| 4 | 7 | |
| 5 | 8 | /// zig2 features |