authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-17 01:48:37+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-26 21:59:58+02:00
log8282f3be960137e74c44827aea2436d3ff9fec30
tree257a4679d6b7beb53db65ecac669783101289c87
parent4b78dbe068445eb37cb28f2f8d1faf5836dc1175
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.Target: Add doc comments for Cpu.Arch.generic() and baseline().


1 files changed, 11 insertions(+), 0 deletions(-)

lib/std/Target.zig+11
...@@ -1785,6 +1785,9 @@ pub const Cpu = struct {...@@ -1785,6 +1785,9 @@ pub const Cpu = struct {
1785 };1785 };
1786 }1786 }
17871787
1788 /// Returns the most bare-bones CPU model that is valid for `arch`. Note that this function
1789 /// can return CPU models that are understood by LLVM, but *not* understood by Clang. If
1790 /// Clang compatibility is important, consider using `baseline` instead.
1788 pub fn generic(arch: Arch) *const Model {1791 pub fn generic(arch: Arch) *const Model {
1789 const S = struct {1792 const S = struct {
1790 const generic_model = Model{1793 const generic_model = Model{
...@@ -1835,6 +1838,14 @@ pub const Cpu = struct {...@@ -1835,6 +1838,14 @@ pub const Cpu = struct {
1835 };1838 };
1836 }1839 }
18371840
1841 /// Returns a conservative CPU model for `arch` that is expected to be compatible with the
1842 /// vast majority of hardware available. This function is guaranteed to return CPU models
1843 /// that are understood by both LLVM and Clang, unlike `generic`.
1844 ///
1845 /// For certain `os` values, this function will additionally bump the baseline higher than
1846 /// the baseline would be for `arch` in isolation; for example, for `aarch64-macos`, the
1847 /// baseline is considered to be `apple_m1`. To avoid this behavior entirely, pass
1848 /// `Os.Tag.freestanding`.
1838 pub fn baseline(arch: Arch, os: Os) *const Model {1849 pub fn baseline(arch: Arch, os: Os) *const Model {
1839 return switch (arch) {1850 return switch (arch) {
1840 .arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline,1851 .arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline,