diff --git a/lib/std/target.zig b/lib/std/target.zig index 110b7a088f50..f20bec421ead 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -903,25 +903,34 @@ pub const Target = struct { /// All processors Zig is aware of, sorted lexicographically by name. pub fn allCpuModels(arch: Arch) []const *const Cpu.Model { return switch (arch) { - .arm, .armeb, .thumb, .thumbeb => arm.all_cpus, - .aarch64, .aarch64_be, .aarch64_32 => aarch64.all_cpus, - .avr => avr.all_cpus, - .bpfel, .bpfeb => bpf.all_cpus, - .hexagon => hexagon.all_cpus, - .mips, .mipsel, .mips64, .mips64el => mips.all_cpus, - .msp430 => msp430.all_cpus, - .powerpc, .powerpc64, .powerpc64le => powerpc.all_cpus, - .amdgcn => amdgpu.all_cpus, - .riscv32, .riscv64 => riscv.all_cpus, - .sparc, .sparcv9, .sparcel => sparc.all_cpus, - .s390x => systemz.all_cpus, - .i386, .x86_64 => x86.all_cpus, - .nvptx, .nvptx64 => nvptx.all_cpus, - .wasm32, .wasm64 => wasm.all_cpus, + .arm, .armeb, .thumb, .thumbeb => comptime allCpusFromDecls(arm.cpu), + .aarch64, .aarch64_be, .aarch64_32 => comptime allCpusFromDecls(aarch64.cpu), + .avr => comptime allCpusFromDecls(avr.cpu), + .bpfel, .bpfeb => comptime allCpusFromDecls(bpf.cpu), + .hexagon => comptime allCpusFromDecls(hexagon.cpu), + .mips, .mipsel, .mips64, .mips64el => comptime allCpusFromDecls(mips.cpu), + .msp430 => comptime allCpusFromDecls(msp430.cpu), + .powerpc, .powerpc64, .powerpc64le => comptime allCpusFromDecls(powerpc.cpu), + .amdgcn => comptime allCpusFromDecls(amdgpu.cpu), + .riscv32, .riscv64 => comptime allCpusFromDecls(riscv.cpu), + .sparc, .sparcv9, .sparcel => comptime allCpusFromDecls(sparc.cpu), + .s390x => comptime allCpusFromDecls(systemz.cpu), + .i386, .x86_64 => comptime allCpusFromDecls(x86.cpu), + .nvptx, .nvptx64 => comptime allCpusFromDecls(nvptx.cpu), + .wasm32, .wasm64 => comptime allCpusFromDecls(wasm.cpu), else => &[0]*const Model{}, }; } + + fn allCpusFromDecls(comptime cpus: type) []const *const Cpu.Model { + const decls = std.meta.declarations(cpus); + var array: [decls.len]*const Cpu.Model = undefined; + for (decls) |decl, i| { + array[i] = &@field(cpus, decl.name); + } + return &array; + } }; pub const Model = struct { diff --git a/lib/std/target/aarch64.zig b/lib/std/target/aarch64.zig index 5c49d4acfcf9..9af95dfadad0 100644 --- a/lib/std/target/aarch64.zig +++ b/lib/std/target/aarch64.zig @@ -1505,48 +1505,3 @@ pub const cpu = struct { }), }; }; - -/// All aarch64 CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.apple_a10, - &cpu.apple_a11, - &cpu.apple_a12, - &cpu.apple_a13, - &cpu.apple_a7, - &cpu.apple_a8, - &cpu.apple_a9, - &cpu.apple_latest, - &cpu.apple_s4, - &cpu.apple_s5, - &cpu.cortex_a35, - &cpu.cortex_a53, - &cpu.cortex_a55, - &cpu.cortex_a57, - &cpu.cortex_a65, - &cpu.cortex_a65ae, - &cpu.cortex_a72, - &cpu.cortex_a73, - &cpu.cortex_a75, - &cpu.cortex_a76, - &cpu.cortex_a76ae, - &cpu.cyclone, - &cpu.exynos_m1, - &cpu.exynos_m2, - &cpu.exynos_m3, - &cpu.exynos_m4, - &cpu.exynos_m5, - &cpu.falkor, - &cpu.generic, - &cpu.kryo, - &cpu.neoverse_e1, - &cpu.neoverse_n1, - &cpu.saphira, - &cpu.thunderx, - &cpu.thunderx2t99, - &cpu.thunderxt81, - &cpu.thunderxt83, - &cpu.thunderxt88, - &cpu.tsv110, -}; diff --git a/lib/std/target/amdgpu.zig b/lib/std/target/amdgpu.zig index 962e3073cf8b..4b3f83bbc317 100644 --- a/lib/std/target/amdgpu.zig +++ b/lib/std/target/amdgpu.zig @@ -1276,48 +1276,3 @@ pub const cpu = struct { }), }; }; - -/// All amdgpu CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.bonaire, - &cpu.carrizo, - &cpu.fiji, - &cpu.generic, - &cpu.generic_hsa, - &cpu.gfx1010, - &cpu.gfx1011, - &cpu.gfx1012, - &cpu.gfx600, - &cpu.gfx601, - &cpu.gfx700, - &cpu.gfx701, - &cpu.gfx702, - &cpu.gfx703, - &cpu.gfx704, - &cpu.gfx801, - &cpu.gfx802, - &cpu.gfx803, - &cpu.gfx810, - &cpu.gfx900, - &cpu.gfx902, - &cpu.gfx904, - &cpu.gfx906, - &cpu.gfx908, - &cpu.gfx909, - &cpu.hainan, - &cpu.hawaii, - &cpu.iceland, - &cpu.kabini, - &cpu.kaveri, - &cpu.mullins, - &cpu.oland, - &cpu.pitcairn, - &cpu.polaris10, - &cpu.polaris11, - &cpu.stoney, - &cpu.tahiti, - &cpu.tonga, - &cpu.verde, -}; diff --git a/lib/std/target/arm.zig b/lib/std/target/arm.zig index aab8e9d068a9..90b060c03ff4 100644 --- a/lib/std/target/arm.zig +++ b/lib/std/target/arm.zig @@ -2145,92 +2145,3 @@ pub const cpu = struct { }), }; }; - -/// All arm CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.arm1020e, - &cpu.arm1020t, - &cpu.arm1022e, - &cpu.arm10e, - &cpu.arm10tdmi, - &cpu.arm1136j_s, - &cpu.arm1136jf_s, - &cpu.arm1156t2_s, - &cpu.arm1156t2f_s, - &cpu.arm1176j_s, - &cpu.arm1176jz_s, - &cpu.arm1176jzf_s, - &cpu.arm710t, - &cpu.arm720t, - &cpu.arm7tdmi, - &cpu.arm7tdmi_s, - &cpu.arm8, - &cpu.arm810, - &cpu.arm9, - &cpu.arm920, - &cpu.arm920t, - &cpu.arm922t, - &cpu.arm926ej_s, - &cpu.arm940t, - &cpu.arm946e_s, - &cpu.arm966e_s, - &cpu.arm968e_s, - &cpu.arm9e, - &cpu.arm9tdmi, - &cpu.cortex_a12, - &cpu.cortex_a15, - &cpu.cortex_a17, - &cpu.cortex_a32, - &cpu.cortex_a35, - &cpu.cortex_a5, - &cpu.cortex_a53, - &cpu.cortex_a55, - &cpu.cortex_a57, - &cpu.cortex_a7, - &cpu.cortex_a72, - &cpu.cortex_a73, - &cpu.cortex_a75, - &cpu.cortex_a76, - &cpu.cortex_a76ae, - &cpu.cortex_a8, - &cpu.cortex_a9, - &cpu.cortex_m0, - &cpu.cortex_m0plus, - &cpu.cortex_m1, - &cpu.cortex_m23, - &cpu.cortex_m3, - &cpu.cortex_m33, - &cpu.cortex_m35p, - &cpu.cortex_m4, - &cpu.cortex_m7, - &cpu.cortex_r4, - &cpu.cortex_r4f, - &cpu.cortex_r5, - &cpu.cortex_r52, - &cpu.cortex_r7, - &cpu.cortex_r8, - &cpu.cyclone, - &cpu.ep9312, - &cpu.exynos_m1, - &cpu.exynos_m2, - &cpu.exynos_m3, - &cpu.exynos_m4, - &cpu.exynos_m5, - &cpu.generic, - &cpu.iwmmxt, - &cpu.krait, - &cpu.kryo, - &cpu.mpcore, - &cpu.mpcorenovfp, - &cpu.neoverse_n1, - &cpu.sc000, - &cpu.sc300, - &cpu.strongarm, - &cpu.strongarm110, - &cpu.strongarm1100, - &cpu.strongarm1110, - &cpu.swift, - &cpu.xscale, -}; diff --git a/lib/std/target/avr.zig b/lib/std/target/avr.zig index 4d0da9b2c382..af4f5ba5be97 100644 --- a/lib/std/target/avr.zig +++ b/lib/std/target/avr.zig @@ -2116,266 +2116,3 @@ pub const cpu = struct { }), }; }; - -/// All avr CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.at43usb320, - &cpu.at43usb355, - &cpu.at76c711, - &cpu.at86rf401, - &cpu.at90c8534, - &cpu.at90can128, - &cpu.at90can32, - &cpu.at90can64, - &cpu.at90pwm1, - &cpu.at90pwm161, - &cpu.at90pwm2, - &cpu.at90pwm216, - &cpu.at90pwm2b, - &cpu.at90pwm3, - &cpu.at90pwm316, - &cpu.at90pwm3b, - &cpu.at90pwm81, - &cpu.at90s1200, - &cpu.at90s2313, - &cpu.at90s2323, - &cpu.at90s2333, - &cpu.at90s2343, - &cpu.at90s4414, - &cpu.at90s4433, - &cpu.at90s4434, - &cpu.at90s8515, - &cpu.at90s8535, - &cpu.at90scr100, - &cpu.at90usb1286, - &cpu.at90usb1287, - &cpu.at90usb162, - &cpu.at90usb646, - &cpu.at90usb647, - &cpu.at90usb82, - &cpu.at94k, - &cpu.ata5272, - &cpu.ata5505, - &cpu.ata5790, - &cpu.ata5795, - &cpu.ata6285, - &cpu.ata6286, - &cpu.ata6289, - &cpu.atmega103, - &cpu.atmega128, - &cpu.atmega1280, - &cpu.atmega1281, - &cpu.atmega1284, - &cpu.atmega1284p, - &cpu.atmega1284rfr2, - &cpu.atmega128a, - &cpu.atmega128rfa1, - &cpu.atmega128rfr2, - &cpu.atmega16, - &cpu.atmega161, - &cpu.atmega162, - &cpu.atmega163, - &cpu.atmega164a, - &cpu.atmega164p, - &cpu.atmega164pa, - &cpu.atmega165, - &cpu.atmega165a, - &cpu.atmega165p, - &cpu.atmega165pa, - &cpu.atmega168, - &cpu.atmega168a, - &cpu.atmega168p, - &cpu.atmega168pa, - &cpu.atmega169, - &cpu.atmega169a, - &cpu.atmega169p, - &cpu.atmega169pa, - &cpu.atmega16a, - &cpu.atmega16hva, - &cpu.atmega16hva2, - &cpu.atmega16hvb, - &cpu.atmega16hvbrevb, - &cpu.atmega16m1, - &cpu.atmega16u2, - &cpu.atmega16u4, - &cpu.atmega2560, - &cpu.atmega2561, - &cpu.atmega2564rfr2, - &cpu.atmega256rfr2, - &cpu.atmega32, - &cpu.atmega323, - &cpu.atmega324a, - &cpu.atmega324p, - &cpu.atmega324pa, - &cpu.atmega325, - &cpu.atmega3250, - &cpu.atmega3250a, - &cpu.atmega3250p, - &cpu.atmega3250pa, - &cpu.atmega325a, - &cpu.atmega325p, - &cpu.atmega325pa, - &cpu.atmega328, - &cpu.atmega328p, - &cpu.atmega329, - &cpu.atmega3290, - &cpu.atmega3290a, - &cpu.atmega3290p, - &cpu.atmega3290pa, - &cpu.atmega329a, - &cpu.atmega329p, - &cpu.atmega329pa, - &cpu.atmega32a, - &cpu.atmega32c1, - &cpu.atmega32hvb, - &cpu.atmega32hvbrevb, - &cpu.atmega32m1, - &cpu.atmega32u2, - &cpu.atmega32u4, - &cpu.atmega32u6, - &cpu.atmega406, - &cpu.atmega48, - &cpu.atmega48a, - &cpu.atmega48p, - &cpu.atmega48pa, - &cpu.atmega64, - &cpu.atmega640, - &cpu.atmega644, - &cpu.atmega644a, - &cpu.atmega644p, - &cpu.atmega644pa, - &cpu.atmega644rfr2, - &cpu.atmega645, - &cpu.atmega6450, - &cpu.atmega6450a, - &cpu.atmega6450p, - &cpu.atmega645a, - &cpu.atmega645p, - &cpu.atmega649, - &cpu.atmega6490, - &cpu.atmega6490a, - &cpu.atmega6490p, - &cpu.atmega649a, - &cpu.atmega649p, - &cpu.atmega64a, - &cpu.atmega64c1, - &cpu.atmega64hve, - &cpu.atmega64m1, - &cpu.atmega64rfr2, - &cpu.atmega8, - &cpu.atmega8515, - &cpu.atmega8535, - &cpu.atmega88, - &cpu.atmega88a, - &cpu.atmega88p, - &cpu.atmega88pa, - &cpu.atmega8a, - &cpu.atmega8hva, - &cpu.atmega8u2, - &cpu.attiny10, - &cpu.attiny102, - &cpu.attiny104, - &cpu.attiny11, - &cpu.attiny12, - &cpu.attiny13, - &cpu.attiny13a, - &cpu.attiny15, - &cpu.attiny1634, - &cpu.attiny167, - &cpu.attiny20, - &cpu.attiny22, - &cpu.attiny2313, - &cpu.attiny2313a, - &cpu.attiny24, - &cpu.attiny24a, - &cpu.attiny25, - &cpu.attiny26, - &cpu.attiny261, - &cpu.attiny261a, - &cpu.attiny28, - &cpu.attiny4, - &cpu.attiny40, - &cpu.attiny4313, - &cpu.attiny43u, - &cpu.attiny44, - &cpu.attiny44a, - &cpu.attiny45, - &cpu.attiny461, - &cpu.attiny461a, - &cpu.attiny48, - &cpu.attiny5, - &cpu.attiny828, - &cpu.attiny84, - &cpu.attiny84a, - &cpu.attiny85, - &cpu.attiny861, - &cpu.attiny861a, - &cpu.attiny87, - &cpu.attiny88, - &cpu.attiny9, - &cpu.atxmega128a1, - &cpu.atxmega128a1u, - &cpu.atxmega128a3, - &cpu.atxmega128a3u, - &cpu.atxmega128a4u, - &cpu.atxmega128b1, - &cpu.atxmega128b3, - &cpu.atxmega128c3, - &cpu.atxmega128d3, - &cpu.atxmega128d4, - &cpu.atxmega16a4, - &cpu.atxmega16a4u, - &cpu.atxmega16c4, - &cpu.atxmega16d4, - &cpu.atxmega16e5, - &cpu.atxmega192a3, - &cpu.atxmega192a3u, - &cpu.atxmega192c3, - &cpu.atxmega192d3, - &cpu.atxmega256a3, - &cpu.atxmega256a3b, - &cpu.atxmega256a3bu, - &cpu.atxmega256a3u, - &cpu.atxmega256c3, - &cpu.atxmega256d3, - &cpu.atxmega32a4, - &cpu.atxmega32a4u, - &cpu.atxmega32c4, - &cpu.atxmega32d4, - &cpu.atxmega32e5, - &cpu.atxmega32x1, - &cpu.atxmega384c3, - &cpu.atxmega384d3, - &cpu.atxmega64a1, - &cpu.atxmega64a1u, - &cpu.atxmega64a3, - &cpu.atxmega64a3u, - &cpu.atxmega64a4u, - &cpu.atxmega64b1, - &cpu.atxmega64b3, - &cpu.atxmega64c3, - &cpu.atxmega64d3, - &cpu.atxmega64d4, - &cpu.atxmega8e5, - &cpu.avr1, - &cpu.avr2, - &cpu.avr25, - &cpu.avr3, - &cpu.avr31, - &cpu.avr35, - &cpu.avr4, - &cpu.avr5, - &cpu.avr51, - &cpu.avr6, - &cpu.avrtiny, - &cpu.avrxmega1, - &cpu.avrxmega2, - &cpu.avrxmega3, - &cpu.avrxmega4, - &cpu.avrxmega5, - &cpu.avrxmega6, - &cpu.avrxmega7, - &cpu.m3000, -}; diff --git a/lib/std/target/bpf.zig b/lib/std/target/bpf.zig index 6b548ac031d5..ddb12d3d8515 100644 --- a/lib/std/target/bpf.zig +++ b/lib/std/target/bpf.zig @@ -64,14 +64,3 @@ pub const cpu = struct { .features = featureSet(&[_]Feature{}), }; }; - -/// All bpf CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.generic, - &cpu.probe, - &cpu.v1, - &cpu.v2, - &cpu.v3, -}; diff --git a/lib/std/target/hexagon.zig b/lib/std/target/hexagon.zig index b0558908e35a..f429099d882f 100644 --- a/lib/std/target/hexagon.zig +++ b/lib/std/target/hexagon.zig @@ -298,16 +298,3 @@ pub const cpu = struct { }), }; }; - -/// All hexagon CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.generic, - &cpu.hexagonv5, - &cpu.hexagonv55, - &cpu.hexagonv60, - &cpu.hexagonv62, - &cpu.hexagonv65, - &cpu.hexagonv66, -}; diff --git a/lib/std/target/mips.zig b/lib/std/target/mips.zig index 21211ae20eb5..fc95b2dee8e7 100644 --- a/lib/std/target/mips.zig +++ b/lib/std/target/mips.zig @@ -524,28 +524,3 @@ pub const cpu = struct { }), }; }; - -/// All mips CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.generic, - &cpu.mips1, - &cpu.mips2, - &cpu.mips3, - &cpu.mips32, - &cpu.mips32r2, - &cpu.mips32r3, - &cpu.mips32r5, - &cpu.mips32r6, - &cpu.mips4, - &cpu.mips5, - &cpu.mips64, - &cpu.mips64r2, - &cpu.mips64r3, - &cpu.mips64r5, - &cpu.mips64r6, - &cpu.octeon, - &cpu.@"octeon+", - &cpu.p5600, -}; diff --git a/lib/std/target/msp430.zig b/lib/std/target/msp430.zig index e1b858341f50..947137b3e28c 100644 --- a/lib/std/target/msp430.zig +++ b/lib/std/target/msp430.zig @@ -62,12 +62,3 @@ pub const cpu = struct { }), }; }; - -/// All msp430 CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.generic, - &cpu.msp430, - &cpu.msp430x, -}; diff --git a/lib/std/target/nvptx.zig b/lib/std/target/nvptx.zig index 6a79aea1dae3..d719a6bb7196 100644 --- a/lib/std/target/nvptx.zig +++ b/lib/std/target/nvptx.zig @@ -287,24 +287,3 @@ pub const cpu = struct { }), }; }; - -/// All nvptx CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.sm_20, - &cpu.sm_21, - &cpu.sm_30, - &cpu.sm_32, - &cpu.sm_35, - &cpu.sm_37, - &cpu.sm_50, - &cpu.sm_52, - &cpu.sm_53, - &cpu.sm_60, - &cpu.sm_61, - &cpu.sm_62, - &cpu.sm_70, - &cpu.sm_72, - &cpu.sm_75, -}; diff --git a/lib/std/target/powerpc.zig b/lib/std/target/powerpc.zig index c06b82f02a30..ffea7344fcbf 100644 --- a/lib/std/target/powerpc.zig +++ b/lib/std/target/powerpc.zig @@ -944,47 +944,3 @@ pub const cpu = struct { }), }; }; - -/// All powerpc CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.@"440", - &cpu.@"450", - &cpu.@"601", - &cpu.@"602", - &cpu.@"603", - &cpu.@"603e", - &cpu.@"603ev", - &cpu.@"604", - &cpu.@"604e", - &cpu.@"620", - &cpu.@"7400", - &cpu.@"7450", - &cpu.@"750", - &cpu.@"970", - &cpu.a2, - &cpu.a2q, - &cpu.e500, - &cpu.e500mc, - &cpu.e5500, - &cpu.future, - &cpu.g3, - &cpu.g4, - &cpu.@"g4+", - &cpu.g5, - &cpu.generic, - &cpu.ppc, - &cpu.ppc32, - &cpu.ppc64, - &cpu.ppc64le, - &cpu.pwr3, - &cpu.pwr4, - &cpu.pwr5, - &cpu.pwr5x, - &cpu.pwr6, - &cpu.pwr6x, - &cpu.pwr7, - &cpu.pwr8, - &cpu.pwr9, -}; diff --git a/lib/std/target/riscv.zig b/lib/std/target/riscv.zig index ff8921eaf2ff..dbdb10702451 100644 --- a/lib/std/target/riscv.zig +++ b/lib/std/target/riscv.zig @@ -303,13 +303,3 @@ pub const cpu = struct { }), }; }; - -/// All riscv CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.baseline_rv32, - &cpu.baseline_rv64, - &cpu.generic_rv32, - &cpu.generic_rv64, -}; diff --git a/lib/std/target/sparc.zig b/lib/std/target/sparc.zig index 3ec6cc7c2041..e1cbc845fca2 100644 --- a/lib/std/target/sparc.zig +++ b/lib/std/target/sparc.zig @@ -448,49 +448,3 @@ pub const cpu = struct { }), }; }; - -/// All sparc CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.at697e, - &cpu.at697f, - &cpu.f934, - &cpu.generic, - &cpu.gr712rc, - &cpu.gr740, - &cpu.hypersparc, - &cpu.leon2, - &cpu.leon3, - &cpu.leon4, - &cpu.ma2080, - &cpu.ma2085, - &cpu.ma2100, - &cpu.ma2150, - &cpu.ma2155, - &cpu.ma2450, - &cpu.ma2455, - &cpu.ma2480, - &cpu.ma2485, - &cpu.ma2x5x, - &cpu.ma2x8x, - &cpu.myriad2, - &cpu.myriad2_1, - &cpu.myriad2_2, - &cpu.myriad2_3, - &cpu.niagara, - &cpu.niagara2, - &cpu.niagara3, - &cpu.niagara4, - &cpu.sparclet, - &cpu.sparclite, - &cpu.sparclite86x, - &cpu.supersparc, - &cpu.tsc701, - &cpu.ultrasparc, - &cpu.ultrasparc3, - &cpu.ut699, - &cpu.v7, - &cpu.v8, - &cpu.v9, -}; diff --git a/lib/std/target/systemz.zig b/lib/std/target/systemz.zig index 453ce8887f08..f065a8b16947 100644 --- a/lib/std/target/systemz.zig +++ b/lib/std/target/systemz.zig @@ -532,22 +532,3 @@ pub const cpu = struct { }), }; }; - -/// All systemz CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.arch10, - &cpu.arch11, - &cpu.arch12, - &cpu.arch13, - &cpu.arch8, - &cpu.arch9, - &cpu.generic, - &cpu.z10, - &cpu.z13, - &cpu.z14, - &cpu.z15, - &cpu.z196, - &cpu.zEC12, -}; diff --git a/lib/std/target/wasm.zig b/lib/std/target/wasm.zig index 066282f3c6cc..72b2b6d4312a 100644 --- a/lib/std/target/wasm.zig +++ b/lib/std/target/wasm.zig @@ -104,12 +104,3 @@ pub const cpu = struct { .features = featureSet(&[_]Feature{}), }; }; - -/// All wasm CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.bleeding_edge, - &cpu.generic, - &cpu.mvp, -}; diff --git a/lib/std/target/x86.zig b/lib/std/target/x86.zig index 5eccd61c7e46..bfcd1abc1a33 100644 --- a/lib/std/target/x86.zig +++ b/lib/std/target/x86.zig @@ -2943,88 +2943,3 @@ pub const cpu = struct { }), }; }; - -/// All x86 CPUs, sorted alphabetically by name. -/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 -/// compiler has inefficient memory and CPU usage, affecting build times. -pub const all_cpus = &[_]*const CpuModel{ - &cpu.amdfam10, - &cpu.athlon, - &cpu.athlon_4, - &cpu.athlon_fx, - &cpu.athlon_mp, - &cpu.athlon_tbird, - &cpu.athlon_xp, - &cpu.athlon64, - &cpu.athlon64_sse3, - &cpu.atom, - &cpu.barcelona, - &cpu.bdver1, - &cpu.bdver2, - &cpu.bdver3, - &cpu.bdver4, - &cpu.bonnell, - &cpu.broadwell, - &cpu.btver1, - &cpu.btver2, - &cpu.c3, - &cpu.c3_2, - &cpu.cannonlake, - &cpu.cascadelake, - &cpu.cooperlake, - &cpu.core_avx_i, - &cpu.core_avx2, - &cpu.core2, - &cpu.corei7, - &cpu.corei7_avx, - &cpu.generic, - &cpu.geode, - &cpu.goldmont, - &cpu.goldmont_plus, - &cpu.haswell, - &cpu._i386, - &cpu._i486, - &cpu._i586, - &cpu._i686, - &cpu.icelake_client, - &cpu.icelake_server, - &cpu.ivybridge, - &cpu.k6, - &cpu.k6_2, - &cpu.k6_3, - &cpu.k8, - &cpu.k8_sse3, - &cpu.knl, - &cpu.knm, - &cpu.lakemont, - &cpu.nehalem, - &cpu.nocona, - &cpu.opteron, - &cpu.opteron_sse3, - &cpu.penryn, - &cpu.pentium, - &cpu.pentium_m, - &cpu.pentium_mmx, - &cpu.pentium2, - &cpu.pentium3, - &cpu.pentium3m, - &cpu.pentium4, - &cpu.pentium4m, - &cpu.pentiumpro, - &cpu.prescott, - &cpu.sandybridge, - &cpu.silvermont, - &cpu.skx, - &cpu.skylake, - &cpu.skylake_avx512, - &cpu.slm, - &cpu.tigerlake, - &cpu.tremont, - &cpu.westmere, - &cpu.winchip_c6, - &cpu.winchip2, - &cpu.x86_64, - &cpu.yonah, - &cpu.znver1, - &cpu.znver2, -}; diff --git a/test/stage1/behavior/type_info.zig b/test/stage1/behavior/type_info.zig index 2685a3552e3e..9da1da6e875b 100644 --- a/test/stage1/behavior/type_info.zig +++ b/test/stage1/behavior/type_info.zig @@ -409,3 +409,19 @@ test "type info: value is correctly copied" { expect(@typeInfo([]u32).Pointer.size == .Slice); } } + +test "Declarations are returned in declaration order" { + const S = struct { + const a = 1; + const b = 2; + const c = 3; + const d = 4; + const e = 5; + }; + const d = @typeInfo(S).Struct.decls; + expect(std.mem.eql(u8, d[0].name, "a")); + expect(std.mem.eql(u8, d[1].name, "b")); + expect(std.mem.eql(u8, d[2].name, "c")); + expect(std.mem.eql(u8, d[3].name, "d")); + expect(std.mem.eql(u8, d[4].name, "e")); +}