File tree Expand file tree Collapse file tree 5 files changed +13
-4
lines changed Expand file tree Collapse file tree 5 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -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 ,
Original file line number Diff line number Diff line change @@ -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 ,
Original file line number Diff line number Diff line change @@ -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" );
Original file line number Diff line number Diff line change @@ -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 ,
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments