diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2025-06-13 04:46:30 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2025-06-19 11:45:06 -0400 |
| commit | 917640810e7f3e18daff9e75b5ecefe761a1896c (patch) | |
| tree | 579e627d695f898d411a3cb1fbc0578d1a763cc2 /src/codegen/c.zig | |
| parent | 16d78bc0c024da307c7ab5f6b94622e6b4b37397 (diff) | |
| download | zig-917640810e7f3e18daff9e75b5ecefe761a1896c.tar.gz zig-917640810e7f3e18daff9e75b5ecefe761a1896c.zip | |
Target: pass and use locals by pointer instead of by value
This struct is larger than 256 bytes and code that copies it
consistently shows up in profiles of the compiler.
Diffstat (limited to 'src/codegen/c.zig')
| -rw-r--r-- | src/codegen/c.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 110c5a3127..7ee33577d8 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -1080,7 +1080,7 @@ pub const DeclGen = struct { }, .enum_tag => |enum_tag| try dg.renderValue(writer, Value.fromInterned(enum_tag.int), location), .float => { - const bits = ty.floatBits(target.*); + const bits = ty.floatBits(target); const f128_val = val.toFloat(f128, zcu); // All unsigned ints matching float types are pre-allocated. @@ -1608,7 +1608,7 @@ pub const DeclGen = struct { .f80_type, .f128_type, => { - const bits = ty.floatBits(target.*); + const bits = ty.floatBits(target); // All unsigned ints matching float types are pre-allocated. const repr_ty = dg.pt.intType(.unsigned, bits) catch unreachable; @@ -6543,7 +6543,7 @@ fn airFloatCast(f: *Function, inst: Air.Inst.Index) !CValue { const scalar_ty = operand_ty.scalarType(zcu); const target = &f.object.dg.mod.resolved_target.result; const operation = if (inst_scalar_ty.isRuntimeFloat() and scalar_ty.isRuntimeFloat()) - if (inst_scalar_ty.floatBits(target.*) < scalar_ty.floatBits(target.*)) "trunc" else "extend" + if (inst_scalar_ty.floatBits(target) < scalar_ty.floatBits(target)) "trunc" else "extend" else if (inst_scalar_ty.isInt(zcu) and scalar_ty.isRuntimeFloat()) if (inst_scalar_ty.isSignedInt(zcu)) "fix" else "fixuns" else if (inst_scalar_ty.isRuntimeFloat() and scalar_ty.isInt(zcu)) @@ -6565,8 +6565,8 @@ fn airFloatCast(f: *Function, inst: Air.Inst.Index) !CValue { } try writer.writeAll("zig_"); try writer.writeAll(operation); - try writer.writeAll(compilerRtAbbrev(scalar_ty, zcu, target.*)); - try writer.writeAll(compilerRtAbbrev(inst_scalar_ty, zcu, target.*)); + try writer.writeAll(compilerRtAbbrev(scalar_ty, zcu, target)); + try writer.writeAll(compilerRtAbbrev(inst_scalar_ty, zcu, target)); try writer.writeByte('('); try f.writeCValue(writer, operand, .FunctionArgument); try v.elem(f, writer); @@ -8073,7 +8073,7 @@ fn signAbbrev(signedness: std.builtin.Signedness) u8 { }; } -fn compilerRtAbbrev(ty: Type, zcu: *Zcu, target: std.Target) []const u8 { +fn compilerRtAbbrev(ty: Type, zcu: *Zcu, target: *const std.Target) []const u8 { return if (ty.isInt(zcu)) switch (ty.intInfo(zcu).bits) { 1...32 => "si", 33...64 => "di", |
