aboutsummaryrefslogtreecommitdiff
path: root/src/Type.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2025-06-13 04:46:30 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2025-06-19 11:45:06 -0400
commit917640810e7f3e18daff9e75b5ecefe761a1896c (patch)
tree579e627d695f898d411a3cb1fbc0578d1a763cc2 /src/Type.zig
parent16d78bc0c024da307c7ab5f6b94622e6b4b37397 (diff)
downloadzig-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/Type.zig')
-rw-r--r--src/Type.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Type.zig b/src/Type.zig
index eafdd65531..219ef4a383 100644
--- a/src/Type.zig
+++ b/src/Type.zig
@@ -1602,7 +1602,7 @@ fn abiSizeInnerOptional(
};
}
-pub fn ptrAbiAlignment(target: Target) Alignment {
+pub fn ptrAbiAlignment(target: *const Target) Alignment {
return Alignment.fromNonzeroByteUnits(@divExact(target.ptrBitWidth(), 8));
}
@@ -2395,7 +2395,7 @@ pub fn isAnyFloat(ty: Type) bool {
/// Asserts the type is a fixed-size float or comptime_float.
/// Returns 128 for comptime_float types.
-pub fn floatBits(ty: Type, target: Target) u16 {
+pub fn floatBits(ty: Type, target: *const Target) u16 {
return switch (ty.toIntern()) {
.f16_type => 16,
.f32_type => 32,
@@ -4188,6 +4188,6 @@ pub fn smallestUnsignedBits(max: u64) u16 {
/// to packed struct layout to find out all the places in the codebase you need to edit!
pub const packed_struct_layout_version = 2;
-fn cTypeAlign(target: Target, c_type: Target.CType) Alignment {
+fn cTypeAlign(target: *const Target, c_type: Target.CType) Alignment {
return Alignment.fromByteUnits(target.cTypeAlignment(c_type));
}