aboutsummaryrefslogtreecommitdiff
path: root/src/target.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-10-15 21:28:42 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2024-10-20 09:21:17 +0200
commitef72b91ac2b96ba64a53b08a661e9ad83a828ee4 (patch)
tree03d0c78049441a867629d0534a98face6703e578 /src/target.zig
parentd2f04e919c833288d5cf1efa97c25bbaae101168 (diff)
downloadzig-ef72b91ac2b96ba64a53b08a661e9ad83a828ee4.tar.gz
zig-ef72b91ac2b96ba64a53b08a661e9ad83a828ee4.zip
compiler: Remove uses of defaultFunctionAlignment() in the frontend.
minFunctionAlignment() is something we can know ahead of time for any given target because it's a matter of ABI. However, defaultFunctionAlignment() is a matter of optimization and every backend can do it differently depending on any number of factors. For example, LLVM will base the choice on the CPU model in its aarch64 backend. So just don't use this value in the frontend.
Diffstat (limited to 'src/target.zig')
-rw-r--r--src/target.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/target.zig b/src/target.zig
index cce1787f33..87674cda89 100644
--- a/src/target.zig
+++ b/src/target.zig
@@ -459,7 +459,8 @@ pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 {
}
}
-/// This function returns 1 if function alignment is not observable or settable.
+/// This function returns 1 if function alignment is not observable or settable. Note that this
+/// value will not necessarily match the backend's default function alignment (e.g. for LLVM).
pub fn defaultFunctionAlignment(target: std.Target) Alignment {
// Overrides of the minimum for performance.
return switch (target.cpu.arch) {