authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-19 21:30:36-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-19 21:30:36-05:00
log84f1893c18c4ef12dbe268ed6d11a11966a9d447
treee2c3e3600464c62589a63c7f1bb0f7ffda3fee16
parent96f45c27b65307fe4abd5d1fb1cf314b1f493d8e
signaturelock-open Commit is signed but in an unrecognized format.

remove the concept of "sub-architecture"

in favor of CPU features. Also rearrange the `std.Target` data structure. * note: `@import("builtin")` was already deprecated in favor of `@import("std").builtin`. * `std.builtin.arch` is now deprecated in favor of `std.builtin.cpu.arch`. * `std.Target.CpuFeatures.Cpu` is now `std.Target.Cpu.Model`. * `std.Target.CpuFeatures` is now `std.Target.Cpu`. * `std.Target` no longer has an `arch` field. Instead it has a `cpu` field, which has `arch`, `model`, and `features`. * `std.Target` no longer has a `cpu_features` field. * `std.Target.Arch` is moved to `std.Target.Cpu.Arch` and it is an enum instead of a tagged union. * `std.Target.parseOs` is moved to `std.Target.Os.parse`. * `std.Target.parseAbi` is moved to `std.Target.Abi.parse`. * `std.Target.parseArchSub` is only for arch now and moved to `std.Target.Cpu.Arch.parse`. * `std.Target.parse` is improved to accept CPU name and features. * `std.Target.Arch.getBaselineCpuFeatures` is moved to `std.Target.Cpu.baseline`. * `std.Target.allCpus` is renamed to `std.Target.allCpuModels`. * `std.Target.defaultAbi` is moved to `std.Target.Abi.default`. * Significant cleanup of aarch64 and arm CPU features, resulting in the needed bit count for cpu feature set going from 174 to 138. * Add `std.Target.Cpu.Feature.Set.addFeatureSet` for merging feature sets together. `-target-feature` and `-target-cpu` are removed in favor of `-mcpu`, to conform to established conventions, and it gains additional power to support cpu features. The syntax is: -mcpu=name+on1+on2-off1-off2 closes #4261

28 files changed, 1739 insertions(+), 2225 deletions(-)

lib/std/builtin.zig+2-5
......@@ -6,8 +6,8 @@ pub const Target = std.Target;
66/// Deprecated: use `std.Target.Os`.
77pub const Os = std.Target.Os;
88
9/// Deprecated: use `std.Target.Arch`.
10pub const Arch = std.Target.Arch;
9/// Deprecated: use `std.Target.Cpu.Arch`.
10pub const Arch = std.Target.Cpu.Arch;
1111
1212/// Deprecated: use `std.Target.Abi`.
1313pub const Abi = std.Target.Abi;
......@@ -18,9 +18,6 @@ pub const ObjectFormat = std.Target.ObjectFormat;
1818/// Deprecated: use `std.Target.SubSystem`.
1919pub const SubSystem = std.Target.SubSystem;
2020
21/// Deprecated: use `std.Target.CpuFeatures`.
22pub const CpuFeatures = std.Target.CpuFeatures;
23
2421/// Deprecated: use `std.Target.Cpu`.
2522pub const Cpu = std.Target.Cpu;
2623
lib/std/target.zig+550-642
......@@ -47,6 +47,18 @@ pub const Target = union(enum) {
4747 emscripten,
4848 uefi,
4949 other,
50
51 pub fn parse(text: []const u8) !Os {
52 if (mem.eql(u8, text, "native")) return builtin.os;
53
54 const info = @typeInfo(Os);
55 inline for (info.Enum.fields) |field| {
56 if (mem.eql(u8, text, field.name)) {
57 return @field(Os, field.name);
58 }
59 }
60 return error.UnknownOperatingSystem;
61 }
5062 };
5163
5264 pub const aarch64 = @import("target/aarch64.zig");
......@@ -65,457 +77,6 @@ pub const Target = union(enum) {
6577 pub const wasm = @import("target/wasm.zig");
6678 pub const x86 = @import("target/x86.zig");
6779
68 pub const Arch = union(enum) {
69 arm: Arm32,
70 armeb: Arm32,
71 aarch64: Arm64,
72 aarch64_be: Arm64,
73 aarch64_32: Arm64,
74 arc,
75 avr,
76 bpfel,
77 bpfeb,
78 hexagon,
79 mips,
80 mipsel,
81 mips64,
82 mips64el,
83 msp430,
84 powerpc,
85 powerpc64,
86 powerpc64le,
87 r600,
88 amdgcn,
89 riscv32,
90 riscv64,
91 sparc,
92 sparcv9,
93 sparcel,
94 s390x,
95 tce,
96 tcele,
97 thumb: Arm32,
98 thumbeb: Arm32,
99 i386,
100 x86_64,
101 xcore,
102 nvptx,
103 nvptx64,
104 le32,
105 le64,
106 amdil,
107 amdil64,
108 hsail,
109 hsail64,
110 spir,
111 spir64,
112 kalimba: Kalimba,
113 shave,
114 lanai,
115 wasm32,
116 wasm64,
117 renderscript32,
118 renderscript64,
119
120 pub const Arm32 = enum {
121 v8_5a,
122 v8_4a,
123 v8_3a,
124 v8_2a,
125 v8_1a,
126 v8a,
127 v8r,
128 v8m_baseline,
129 v8m_mainline,
130 v8_1m_mainline,
131 v7a,
132 v7em,
133 v7m,
134 v7s,
135 v7k,
136 v7ve,
137 v6,
138 v6m,
139 v6k,
140 v6t2,
141 v5,
142 v5te,
143 v4t,
144
145 pub fn version(version: Arm32) comptime_int {
146 return switch (version) {
147 .v8_5a, .v8_4a, .v8_3a, .v8_2a, .v8_1a, .v8a, .v8r, .v8m_baseline, .v8m_mainline, .v8_1m_mainline => 8,
148 .v7a, .v7em, .v7m, .v7s, .v7k, .v7ve => 7,
149 .v6, .v6m, .v6k, .v6t2 => 6,
150 .v5, .v5te => 5,
151 .v4t => 4,
152 };
153 }
154 };
155 pub const Arm64 = enum {
156 v8_5a,
157 v8_4a,
158 v8_3a,
159 v8_2a,
160 v8_1a,
161 v8a,
162 };
163 pub const Kalimba = enum {
164 v5,
165 v4,
166 v3,
167 };
168 pub const Mips = enum {
169 r6,
170 };
171
172 pub fn subArchName(arch: Arch) ?[]const u8 {
173 return switch (arch) {
174 .arm, .armeb, .thumb, .thumbeb => |arm32| @tagName(arm32),
175 .aarch64, .aarch64_be, .aarch64_32 => |arm64| @tagName(arm64),
176 .kalimba => |kalimba| @tagName(kalimba),
177 else => return null,
178 };
179 }
180
181 pub fn subArchFeature(arch: Arch) ?Cpu.Feature.Set.Index {
182 return switch (arch) {
183 .arm, .armeb, .thumb, .thumbeb => |arm32| switch (arm32) {
184 .v8_5a => @enumToInt(arm.Feature.armv8_5_a),
185 .v8_4a => @enumToInt(arm.Feature.armv8_4_a),
186 .v8_3a => @enumToInt(arm.Feature.armv8_3_a),
187 .v8_2a => @enumToInt(arm.Feature.armv8_2_a),
188 .v8_1a => @enumToInt(arm.Feature.armv8_1_a),
189 .v8a => @enumToInt(arm.Feature.armv8_a),
190 .v8r => @enumToInt(arm.Feature.armv8_r),
191 .v8m_baseline => @enumToInt(arm.Feature.armv8_m_base),
192 .v8m_mainline => @enumToInt(arm.Feature.armv8_m_main),
193 .v8_1m_mainline => @enumToInt(arm.Feature.armv8_1_m_main),
194 .v7a => @enumToInt(arm.Feature.armv7_a),
195 .v7em => @enumToInt(arm.Feature.armv7e_m),
196 .v7m => @enumToInt(arm.Feature.armv7_m),
197 .v7s => @enumToInt(arm.Feature.armv7s),
198 .v7k => @enumToInt(arm.Feature.armv7k),
199 .v7ve => @enumToInt(arm.Feature.armv7ve),
200 .v6 => @enumToInt(arm.Feature.armv6),
201 .v6m => @enumToInt(arm.Feature.armv6_m),
202 .v6k => @enumToInt(arm.Feature.armv6k),
203 .v6t2 => @enumToInt(arm.Feature.armv6t2),
204 .v5 => @enumToInt(arm.Feature.armv5t),
205 .v5te => @enumToInt(arm.Feature.armv5te),
206 .v4t => @enumToInt(arm.Feature.armv4t),
207 },
208 .aarch64, .aarch64_be, .aarch64_32 => |arm64| switch (arm64) {
209 .v8_5a => @enumToInt(aarch64.Feature.v8_5a),
210 .v8_4a => @enumToInt(aarch64.Feature.v8_4a),
211 .v8_3a => @enumToInt(aarch64.Feature.v8_3a),
212 .v8_2a => @enumToInt(aarch64.Feature.v8_2a),
213 .v8_1a => @enumToInt(aarch64.Feature.v8_1a),
214 .v8a => @enumToInt(aarch64.Feature.v8a),
215 },
216 else => return null,
217 };
218 }
219
220 pub fn isARM(arch: Arch) bool {
221 return switch (arch) {
222 .arm, .armeb => true,
223 else => false,
224 };
225 }
226
227 pub fn isThumb(arch: Arch) bool {
228 return switch (arch) {
229 .thumb, .thumbeb => true,
230 else => false,
231 };
232 }
233
234 pub fn isWasm(arch: Arch) bool {
235 return switch (arch) {
236 .wasm32, .wasm64 => true,
237 else => false,
238 };
239 }
240
241 pub fn isRISCV(arch: Arch) bool {
242 return switch (arch) {
243 .riscv32, .riscv64 => true,
244 else => false,
245 };
246 }
247
248 pub fn isMIPS(arch: Arch) bool {
249 return switch (arch) {
250 .mips, .mipsel, .mips64, .mips64el => true,
251 else => false,
252 };
253 }
254
255 pub fn parseCpu(arch: Arch, cpu_name: []const u8) !*const Cpu {
256 for (arch.allCpus()) |cpu| {
257 if (mem.eql(u8, cpu_name, cpu.name)) {
258 return cpu;
259 }
260 }
261 return error.UnknownCpu;
262 }
263
264 /// Comma-separated list of features, with + or - in front of each feature. This
265 /// form represents a deviation from baseline CPU, which is provided as a parameter.
266 /// Extra commas are ignored.
267 pub fn parseCpuFeatureSet(arch: Arch, cpu: *const Cpu, features_text: []const u8) !Cpu.Feature.Set {
268 const all_features = arch.allFeaturesList();
269 var set = cpu.features;
270 var it = mem.tokenize(features_text, ",");
271 while (it.next()) |item_text| {
272 var feature_name: []const u8 = undefined;
273 var op: enum {
274 add,
275 sub,
276 } = undefined;
277 if (mem.startsWith(u8, item_text, "+")) {
278 op = .add;
279 feature_name = item_text[1..];
280 } else if (mem.startsWith(u8, item_text, "-")) {
281 op = .sub;
282 feature_name = item_text[1..];
283 } else {
284 return error.InvalidCpuFeatures;
285 }
286 for (all_features) |feature, index_usize| {
287 const index = @intCast(Cpu.Feature.Set.Index, index_usize);
288 if (mem.eql(u8, feature_name, feature.name)) {
289 switch (op) {
290 .add => set.addFeature(index),
291 .sub => set.removeFeature(index),
292 }
293 break;
294 }
295 } else {
296 return error.UnknownCpuFeature;
297 }
298 }
299 return set;
300 }
301
302 pub fn toElfMachine(arch: Arch) std.elf.EM {
303 return switch (arch) {
304 .avr => ._AVR,
305 .msp430 => ._MSP430,
306 .arc => ._ARC,
307 .arm => ._ARM,
308 .armeb => ._ARM,
309 .hexagon => ._HEXAGON,
310 .le32 => ._NONE,
311 .mips => ._MIPS,
312 .mipsel => ._MIPS_RS3_LE,
313 .powerpc => ._PPC,
314 .r600 => ._NONE,
315 .riscv32 => ._RISCV,
316 .sparc => ._SPARC,
317 .sparcel => ._SPARC,
318 .tce => ._NONE,
319 .tcele => ._NONE,
320 .thumb => ._ARM,
321 .thumbeb => ._ARM,
322 .i386 => ._386,
323 .xcore => ._XCORE,
324 .nvptx => ._NONE,
325 .amdil => ._NONE,
326 .hsail => ._NONE,
327 .spir => ._NONE,
328 .kalimba => ._CSR_KALIMBA,
329 .shave => ._NONE,
330 .lanai => ._LANAI,
331 .wasm32 => ._NONE,
332 .renderscript32 => ._NONE,
333 .aarch64_32 => ._AARCH64,
334 .aarch64 => ._AARCH64,
335 .aarch64_be => ._AARCH64,
336 .mips64 => ._MIPS,
337 .mips64el => ._MIPS_RS3_LE,
338 .powerpc64 => ._PPC64,
339 .powerpc64le => ._PPC64,
340 .riscv64 => ._RISCV,
341 .x86_64 => ._X86_64,
342 .nvptx64 => ._NONE,
343 .le64 => ._NONE,
344 .amdil64 => ._NONE,
345 .hsail64 => ._NONE,
346 .spir64 => ._NONE,
347 .wasm64 => ._NONE,
348 .renderscript64 => ._NONE,
349 .amdgcn => ._NONE,
350 .bpfel => ._BPF,
351 .bpfeb => ._BPF,
352 .sparcv9 => ._SPARCV9,
353 .s390x => ._S390,
354 };
355 }
356
357 pub fn endian(arch: Arch) builtin.Endian {
358 return switch (arch) {
359 .avr,
360 .arm,
361 .aarch64_32,
362 .aarch64,
363 .amdgcn,
364 .amdil,
365 .amdil64,
366 .bpfel,
367 .hexagon,
368 .hsail,
369 .hsail64,
370 .kalimba,
371 .le32,
372 .le64,
373 .mipsel,
374 .mips64el,
375 .msp430,
376 .nvptx,
377 .nvptx64,
378 .sparcel,
379 .tcele,
380 .powerpc64le,
381 .r600,
382 .riscv32,
383 .riscv64,
384 .i386,
385 .x86_64,
386 .wasm32,
387 .wasm64,
388 .xcore,
389 .thumb,
390 .spir,
391 .spir64,
392 .renderscript32,
393 .renderscript64,
394 .shave,
395 => .Little,
396
397 .arc,
398 .armeb,
399 .aarch64_be,
400 .bpfeb,
401 .mips,
402 .mips64,
403 .powerpc,
404 .powerpc64,
405 .thumbeb,
406 .sparc,
407 .sparcv9,
408 .tce,
409 .lanai,
410 .s390x,
411 => .Big,
412 };
413 }
414
415 /// Returns a name that matches the lib/std/target/* directory name.
416 pub fn genericName(arch: Arch) []const u8 {
417 return switch (arch) {
418 .arm, .armeb, .thumb, .thumbeb => "arm",
419 .aarch64, .aarch64_be, .aarch64_32 => "aarch64",
420 .avr => "avr",
421 .bpfel, .bpfeb => "bpf",
422 .hexagon => "hexagon",
423 .mips, .mipsel, .mips64, .mips64el => "mips",
424 .msp430 => "msp430",
425 .powerpc, .powerpc64, .powerpc64le => "powerpc",
426 .amdgcn => "amdgpu",
427 .riscv32, .riscv64 => "riscv",
428 .sparc, .sparcv9, .sparcel => "sparc",
429 .s390x => "systemz",
430 .i386, .x86_64 => "x86",
431 .nvptx, .nvptx64 => "nvptx",
432 .wasm32, .wasm64 => "wasm",
433 else => @tagName(arch),
434 };
435 }
436
437 /// All CPU features Zig is aware of, sorted lexicographically by name.
438 pub fn allFeaturesList(arch: Arch) []const Cpu.Feature {
439 return switch (arch) {
440 .arm, .armeb, .thumb, .thumbeb => &arm.all_features,
441 .aarch64, .aarch64_be, .aarch64_32 => &aarch64.all_features,
442 .avr => &avr.all_features,
443 .bpfel, .bpfeb => &bpf.all_features,
444 .hexagon => &hexagon.all_features,
445 .mips, .mipsel, .mips64, .mips64el => &mips.all_features,
446 .msp430 => &msp430.all_features,
447 .powerpc, .powerpc64, .powerpc64le => &powerpc.all_features,
448 .amdgcn => &amdgpu.all_features,
449 .riscv32, .riscv64 => &riscv.all_features,
450 .sparc, .sparcv9, .sparcel => &sparc.all_features,
451 .s390x => &systemz.all_features,
452 .i386, .x86_64 => &x86.all_features,
453 .nvptx, .nvptx64 => &nvptx.all_features,
454 .wasm32, .wasm64 => &wasm.all_features,
455
456 else => &[0]Cpu.Feature{},
457 };
458 }
459
460 /// The "default" set of CPU features for cross-compiling. A conservative set
461 /// of features that is expected to be supported on most available hardware.
462 pub fn getBaselineCpuFeatures(arch: Arch) CpuFeatures {
463 const S = struct {
464 const generic_cpu = Cpu{
465 .name = "generic",
466 .llvm_name = null,
467 .features = Cpu.Feature.Set.empty,
468 };
469 };
470 const cpu = switch (arch) {
471 .arm, .armeb, .thumb, .thumbeb => &arm.cpu.generic,
472 .aarch64, .aarch64_be, .aarch64_32 => &aarch64.cpu.generic,
473 .avr => &avr.cpu.avr1,
474 .bpfel, .bpfeb => &bpf.cpu.generic,
475 .hexagon => &hexagon.cpu.generic,
476 .mips, .mipsel => &mips.cpu.mips32,
477 .mips64, .mips64el => &mips.cpu.mips64,
478 .msp430 => &msp430.cpu.generic,
479 .powerpc, .powerpc64, .powerpc64le => &powerpc.cpu.generic,
480 .amdgcn => &amdgpu.cpu.generic,
481 .riscv32 => &riscv.cpu.baseline_rv32,
482 .riscv64 => &riscv.cpu.baseline_rv64,
483 .sparc, .sparcv9, .sparcel => &sparc.cpu.generic,
484 .s390x => &systemz.cpu.generic,
485 .i386 => &x86.cpu.pentium4,
486 .x86_64 => &x86.cpu.x86_64,
487 .nvptx, .nvptx64 => &nvptx.cpu.sm_20,
488 .wasm32, .wasm64 => &wasm.cpu.generic,
489
490 else => &S.generic_cpu,
491 };
492 return CpuFeatures.initFromCpu(arch, cpu);
493 }
494
495 /// All CPUs Zig is aware of, sorted lexicographically by name.
496 pub fn allCpus(arch: Arch) []const *const Cpu {
497 return switch (arch) {
498 .arm, .armeb, .thumb, .thumbeb => arm.all_cpus,
499 .aarch64, .aarch64_be, .aarch64_32 => aarch64.all_cpus,
500 .avr => avr.all_cpus,
501 .bpfel, .bpfeb => bpf.all_cpus,
502 .hexagon => hexagon.all_cpus,
503 .mips, .mipsel, .mips64, .mips64el => mips.all_cpus,
504 .msp430 => msp430.all_cpus,
505 .powerpc, .powerpc64, .powerpc64le => powerpc.all_cpus,
506 .amdgcn => amdgpu.all_cpus,
507 .riscv32, .riscv64 => riscv.all_cpus,
508 .sparc, .sparcv9, .sparcel => sparc.all_cpus,
509 .s390x => systemz.all_cpus,
510 .i386, .x86_64 => x86.all_cpus,
511 .nvptx, .nvptx64 => nvptx.all_cpus,
512 .wasm32, .wasm64 => wasm.all_cpus,
513
514 else => &[0]*const Cpu{},
515 };
516 }
517 };
518
51980 pub const Abi = enum {
52081 none,
52182 gnu,
......@@ -539,11 +100,104 @@ pub const Target = union(enum) {
539100 coreclr,
540101 simulator,
541102 macabi,
103
104 pub fn default(arch: Cpu.Arch, target_os: Os) Abi {
105 switch (arch) {
106 .wasm32, .wasm64 => return .musl,
107 else => {},
108 }
109 switch (target_os) {
110 .freestanding,
111 .ananas,
112 .cloudabi,
113 .dragonfly,
114 .lv2,
115 .solaris,
116 .haiku,
117 .minix,
118 .rtems,
119 .nacl,
120 .cnk,
121 .aix,
122 .cuda,
123 .nvcl,
124 .amdhsa,
125 .ps4,
126 .elfiamcu,
127 .mesa3d,
128 .contiki,
129 .amdpal,
130 .hermit,
131 .other,
132 => return .eabi,
133 .openbsd,
134 .macosx,
135 .freebsd,
136 .ios,
137 .tvos,
138 .watchos,
139 .fuchsia,
140 .kfreebsd,
141 .netbsd,
142 .hurd,
143 => return .gnu,
144 .windows,
145 .uefi,
146 => return .msvc,
147 .linux,
148 .wasi,
149 .emscripten,
150 => return .musl,
151 }
152 }
153
154 pub fn parse(text: []const u8) !Abi {
155 if (mem.eql(u8, text, "native")) return builtin.abi;
156
157 const info = @typeInfo(Abi);
158 inline for (info.Enum.fields) |field| {
159 if (mem.eql(u8, text, field.name)) {
160 return @field(Abi, field.name);
161 }
162 }
163 return error.UnknownApplicationBinaryInterface;
164 }
165 };
166
167 pub const ObjectFormat = enum {
168 unknown,
169 coff,
170 elf,
171 macho,
172 wasm,
173 };
174
175 pub const SubSystem = enum {
176 Console,
177 Windows,
178 Posix,
179 Native,
180 EfiApplication,
181 EfiBootServiceDriver,
182 EfiRom,
183 EfiRuntimeDriver,
184 };
185
186 pub const Cross = struct {
187 cpu: Cpu,
188 os: Os,
189 abi: Abi,
542190 };
543191
544192 pub const Cpu = struct {
545 name: []const u8,
546 llvm_name: ?[:0]const u8,
193 /// Architecture
194 arch: Arch,
195
196 /// The CPU model to target. It has a set of features
197 /// which are overridden with the `features` field.
198 model: *const Model,
199
200 /// An explicit list of the entire CPU feature set. It may differ from the specific CPU model's features.
547201 features: Feature.Set,
548202
549203 pub const Feature = struct {
......@@ -569,7 +223,7 @@ pub const Target = union(enum) {
569223 pub const Set = struct {
570224 ints: [usize_count]usize,
571225
572 pub const needed_bit_count = 174;
226 pub const needed_bit_count = 138;
573227 pub const byte_count = (needed_bit_count + 7) / 8;
574228 pub const usize_count = (byte_count + (@sizeOf(usize) - 1)) / @sizeOf(usize);
575229 pub const Index = std.math.Log2Int(@IntType(false, usize_count * @bitSizeOf(usize)));
......@@ -593,6 +247,12 @@ pub const Target = union(enum) {
593247 set.ints[usize_index] |= @as(usize, 1) << bit_index;
594248 }
595249
250 /// Adds the specified feature set but not its dependencies.
251 pub fn addFeatureSet(set: *Set, other_set: Set) void {
252 set.ints = @as(@Vector(usize_count, usize), set.ints) |
253 @as(@Vector(usize_count, usize), other_set.ints);
254 }
255
596256 /// Removes the specified feature but not its dependents.
597257 pub fn removeFeature(set: *Set, arch_feature_index: Index) void {
598258 const usize_index = arch_feature_index / @bitSizeOf(usize);
......@@ -608,8 +268,7 @@ pub const Target = union(enum) {
608268 for (all_features_list) |feature, index_usize| {
609269 const index = @intCast(Index, index_usize);
610270 if (set.isEnabled(index)) {
611 set.ints = @as(@Vector(usize_count, usize), set.ints) |
612 @as(@Vector(usize_count, usize), feature.dependencies.ints);
271 set.addFeatureSet(feature.dependencies);
613272 }
614273 }
615274 const nothing_changed = mem.eql(usize, &old, &set.ints);
......@@ -644,77 +303,362 @@ pub const Target = union(enum) {
644303 };
645304 }
646305 };
647 };
648306
649 pub const ObjectFormat = enum {
650 unknown,
651 coff,
652 elf,
653 macho,
654 wasm,
655 };
307 pub const Arch = enum {
308 arm,
309 armeb,
310 aarch64,
311 aarch64_be,
312 aarch64_32,
313 arc,
314 avr,
315 bpfel,
316 bpfeb,
317 hexagon,
318 mips,
319 mipsel,
320 mips64,
321 mips64el,
322 msp430,
323 powerpc,
324 powerpc64,
325 powerpc64le,
326 r600,
327 amdgcn,
328 riscv32,
329 riscv64,
330 sparc,
331 sparcv9,
332 sparcel,
333 s390x,
334 tce,
335 tcele,
336 thumb,
337 thumbeb,
338 i386,
339 x86_64,
340 xcore,
341 nvptx,
342 nvptx64,
343 le32,
344 le64,
345 amdil,
346 amdil64,
347 hsail,
348 hsail64,
349 spir,
350 spir64,
351 kalimba,
352 shave,
353 lanai,
354 wasm32,
355 wasm64,
356 renderscript32,
357 renderscript64,
358
359 pub fn isARM(arch: Arch) bool {
360 return switch (arch) {
361 .arm, .armeb => true,
362 else => false,
363 };
364 }
656365
657 pub const SubSystem = enum {
658 Console,
659 Windows,
660 Posix,
661 Native,
662 EfiApplication,
663 EfiBootServiceDriver,
664 EfiRom,
665 EfiRuntimeDriver,
666 };
366 pub fn isThumb(arch: Arch) bool {
367 return switch (arch) {
368 .thumb, .thumbeb => true,
369 else => false,
370 };
371 }
667372
668 pub const Cross = struct {
669 arch: Arch,
670 os: Os,
671 abi: Abi,
672 cpu_features: CpuFeatures,
673 };
373 pub fn isWasm(arch: Arch) bool {
374 return switch (arch) {
375 .wasm32, .wasm64 => true,
376 else => false,
377 };
378 }
674379
675 pub const CpuFeatures = struct {
676 /// The CPU to target. It has a set of features
677 /// which are overridden with the `features` field.
678 cpu: *const Cpu,
380 pub fn isRISCV(arch: Arch) bool {
381 return switch (arch) {
382 .riscv32, .riscv64 => true,
383 else => false,
384 };
385 }
386
387 pub fn isMIPS(arch: Arch) bool {
388 return switch (arch) {
389 .mips, .mipsel, .mips64, .mips64el => true,
390 else => false,
391 };
392 }
393
394 pub fn parseCpuModel(arch: Arch, cpu_name: []const u8) !*const Cpu.Model {
395 for (arch.allCpuModels()) |cpu| {
396 if (mem.eql(u8, cpu_name, cpu.name)) {
397 return cpu;
398 }
399 }
400 return error.UnknownCpu;
401 }
402
403 pub fn toElfMachine(arch: Arch) std.elf.EM {
404 return switch (arch) {
405 .avr => ._AVR,
406 .msp430 => ._MSP430,
407 .arc => ._ARC,
408 .arm => ._ARM,
409 .armeb => ._ARM,
410 .hexagon => ._HEXAGON,
411 .le32 => ._NONE,
412 .mips => ._MIPS,
413 .mipsel => ._MIPS_RS3_LE,
414 .powerpc => ._PPC,
415 .r600 => ._NONE,
416 .riscv32 => ._RISCV,
417 .sparc => ._SPARC,
418 .sparcel => ._SPARC,
419 .tce => ._NONE,
420 .tcele => ._NONE,
421 .thumb => ._ARM,
422 .thumbeb => ._ARM,
423 .i386 => ._386,
424 .xcore => ._XCORE,
425 .nvptx => ._NONE,
426 .amdil => ._NONE,
427 .hsail => ._NONE,
428 .spir => ._NONE,
429 .kalimba => ._CSR_KALIMBA,
430 .shave => ._NONE,
431 .lanai => ._LANAI,
432 .wasm32 => ._NONE,
433 .renderscript32 => ._NONE,
434 .aarch64_32 => ._AARCH64,
435 .aarch64 => ._AARCH64,
436 .aarch64_be => ._AARCH64,
437 .mips64 => ._MIPS,
438 .mips64el => ._MIPS_RS3_LE,
439 .powerpc64 => ._PPC64,
440 .powerpc64le => ._PPC64,
441 .riscv64 => ._RISCV,
442 .x86_64 => ._X86_64,
443 .nvptx64 => ._NONE,
444 .le64 => ._NONE,
445 .amdil64 => ._NONE,
446 .hsail64 => ._NONE,
447 .spir64 => ._NONE,
448 .wasm64 => ._NONE,
449 .renderscript64 => ._NONE,
450 .amdgcn => ._NONE,
451 .bpfel => ._BPF,
452 .bpfeb => ._BPF,
453 .sparcv9 => ._SPARCV9,
454 .s390x => ._S390,
455 };
456 }
457
458 pub fn endian(arch: Arch) builtin.Endian {
459 return switch (arch) {
460 .avr,
461 .arm,
462 .aarch64_32,
463 .aarch64,
464 .amdgcn,
465 .amdil,
466 .amdil64,
467 .bpfel,
468 .hexagon,
469 .hsail,
470 .hsail64,
471 .kalimba,
472 .le32,
473 .le64,
474 .mipsel,
475 .mips64el,
476 .msp430,
477 .nvptx,
478 .nvptx64,
479 .sparcel,
480 .tcele,
481 .powerpc64le,
482 .r600,
483 .riscv32,
484 .riscv64,
485 .i386,
486 .x86_64,
487 .wasm32,
488 .wasm64,
489 .xcore,
490 .thumb,
491 .spir,
492 .spir64,
493 .renderscript32,
494 .renderscript64,
495 .shave,
496 => .Little,
497
498 .arc,
499 .armeb,
500 .aarch64_be,
501 .bpfeb,
502 .mips,
503 .mips64,
504 .powerpc,
505 .powerpc64,
506 .thumbeb,
507 .sparc,
508 .sparcv9,
509 .tce,
510 .lanai,
511 .s390x,
512 => .Big,
513 };
514 }
515
516 /// Returns a name that matches the lib/std/target/* directory name.
517 pub fn genericName(arch: Arch) []const u8 {
518 return switch (arch) {
519 .arm, .armeb, .thumb, .thumbeb => "arm",
520 .aarch64, .aarch64_be, .aarch64_32 => "aarch64",
521 .avr => "avr",
522 .bpfel, .bpfeb => "bpf",
523 .hexagon => "hexagon",
524 .mips, .mipsel, .mips64, .mips64el => "mips",
525 .msp430 => "msp430",
526 .powerpc, .powerpc64, .powerpc64le => "powerpc",
527 .amdgcn => "amdgpu",
528 .riscv32, .riscv64 => "riscv",
529 .sparc, .sparcv9, .sparcel => "sparc",
530 .s390x => "systemz",
531 .i386, .x86_64 => "x86",
532 .nvptx, .nvptx64 => "nvptx",
533 .wasm32, .wasm64 => "wasm",
534 else => @tagName(arch),
535 };
536 }
679537
680 /// Explicitly provide the entire CPU feature set.
681 features: Cpu.Feature.Set,
538 /// All CPU features Zig is aware of, sorted lexicographically by name.
539 pub fn allFeaturesList(arch: Arch) []const Cpu.Feature {
540 return switch (arch) {
541 .arm, .armeb, .thumb, .thumbeb => &arm.all_features,
542 .aarch64, .aarch64_be, .aarch64_32 => &aarch64.all_features,
543 .avr => &avr.all_features,
544 .bpfel, .bpfeb => &bpf.all_features,
545 .hexagon => &hexagon.all_features,
546 .mips, .mipsel, .mips64, .mips64el => &mips.all_features,
547 .msp430 => &msp430.all_features,
548 .powerpc, .powerpc64, .powerpc64le => &powerpc.all_features,
549 .amdgcn => &amdgpu.all_features,
550 .riscv32, .riscv64 => &riscv.all_features,
551 .sparc, .sparcv9, .sparcel => &sparc.all_features,
552 .s390x => &systemz.all_features,
553 .i386, .x86_64 => &x86.all_features,
554 .nvptx, .nvptx64 => &nvptx.all_features,
555 .wasm32, .wasm64 => &wasm.all_features,
556
557 else => &[0]Cpu.Feature{},
558 };
559 }
560
561 /// All processors Zig is aware of, sorted lexicographically by name.
562 pub fn allCpuModels(arch: Arch) []const *const Cpu.Model {
563 return switch (arch) {
564 .arm, .armeb, .thumb, .thumbeb => arm.all_cpus,
565 .aarch64, .aarch64_be, .aarch64_32 => aarch64.all_cpus,
566 .avr => avr.all_cpus,
567 .bpfel, .bpfeb => bpf.all_cpus,
568 .hexagon => hexagon.all_cpus,
569 .mips, .mipsel, .mips64, .mips64el => mips.all_cpus,
570 .msp430 => msp430.all_cpus,
571 .powerpc, .powerpc64, .powerpc64le => powerpc.all_cpus,
572 .amdgcn => amdgpu.all_cpus,
573 .riscv32, .riscv64 => riscv.all_cpus,
574 .sparc, .sparcv9, .sparcel => sparc.all_cpus,
575 .s390x => systemz.all_cpus,
576 .i386, .x86_64 => x86.all_cpus,
577 .nvptx, .nvptx64 => nvptx.all_cpus,
578 .wasm32, .wasm64 => wasm.all_cpus,
579
580 else => &[0]*const Model{},
581 };
582 }
583
584 pub fn parse(text: []const u8) !Arch {
585 if (mem.eql(u8, text, "native")) return builtin.arch;
586
587 const info = @typeInfo(Arch);
588 inline for (info.Enum.fields) |field| {
589 if (mem.eql(u8, text, field.name)) {
590 return @as(Arch, @field(Arch, field.name));
591 }
592 }
593 return error.UnknownArchitecture;
594 }
595 };
682596
683 pub fn initFromCpu(arch: Arch, cpu: *const Cpu) CpuFeatures {
684 var features = cpu.features;
685 if (arch.subArchFeature()) |sub_arch_index| {
686 features.addFeature(sub_arch_index);
597 pub const Model = struct {
598 name: []const u8,
599 llvm_name: ?[:0]const u8,
600 features: Feature.Set,
601
602 pub fn toCpu(model: *const Model, arch: Arch) Cpu {
603 var features = model.features;
604 features.populateDependencies(arch.allFeaturesList());
605 return .{
606 .arch = arch,
607 .model = model,
608 .features = features,
609 };
687610 }
688 features.populateDependencies(arch.allFeaturesList());
689 return CpuFeatures{
690 .cpu = cpu,
691 .features = features,
611 };
612
613 /// The "default" set of CPU features for cross-compiling. A conservative set
614 /// of features that is expected to be supported on most available hardware.
615 pub fn baseline(arch: Arch) Cpu {
616 const S = struct {
617 const generic_model = Model{
618 .name = "generic",
619 .llvm_name = null,
620 .features = Cpu.Feature.Set.empty,
621 };
622 };
623 const model = switch (arch) {
624 .arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline,
625 .aarch64, .aarch64_be, .aarch64_32 => &aarch64.cpu.generic,
626 .avr => &avr.cpu.avr1,
627 .bpfel, .bpfeb => &bpf.cpu.generic,
628 .hexagon => &hexagon.cpu.generic,
629 .mips, .mipsel => &mips.cpu.mips32,
630 .mips64, .mips64el => &mips.cpu.mips64,
631 .msp430 => &msp430.cpu.generic,
632 .powerpc, .powerpc64, .powerpc64le => &powerpc.cpu.generic,
633 .amdgcn => &amdgpu.cpu.generic,
634 .riscv32 => &riscv.cpu.baseline_rv32,
635 .riscv64 => &riscv.cpu.baseline_rv64,
636 .sparc, .sparcv9, .sparcel => &sparc.cpu.generic,
637 .s390x => &systemz.cpu.generic,
638 .i386 => &x86.cpu.pentium4,
639 .x86_64 => &x86.cpu.x86_64,
640 .nvptx, .nvptx64 => &nvptx.cpu.sm_20,
641 .wasm32, .wasm64 => &wasm.cpu.generic,
642
643 else => &S.generic_model,
692644 };
645 return model.toCpu(arch);
693646 }
694647 };
695648
696649 pub const current = Target{
697650 .Cross = Cross{
698 .arch = builtin.arch,
651 .cpu = builtin.cpu,
699652 .os = builtin.os,
700653 .abi = builtin.abi,
701 .cpu_features = builtin.cpu_features,
702654 },
703655 };
704656
705657 pub const stack_align = 16;
706658
707 pub fn getCpuFeatures(self: Target) CpuFeatures {
708 return switch (self) {
709 .Native => builtin.cpu_features,
710 .Cross => |cross| cross.cpu_features,
711 };
712 }
713
714659 pub fn zigTriple(self: Target, allocator: *mem.Allocator) ![]u8 {
715 return std.fmt.allocPrint(allocator, "{}{}-{}-{}", .{
660 return std.fmt.allocPrint(allocator, "{}-{}-{}", .{
716661 @tagName(self.getArch()),
717 Target.archSubArchName(self.getArch()),
718662 @tagName(self.getOs()),
719663 @tagName(self.getAbi()),
720664 });
......@@ -776,139 +720,81 @@ pub const Target = union(enum) {
776720 });
777721 }
778722
779 /// TODO: Support CPU features here?
780 /// https://github.com/ziglang/zig/issues/4261
781 pub fn parse(text: []const u8) !Target {
782 var it = mem.separate(text, "-");
723 pub const ParseOptions = struct {
724 /// This is sometimes called a "triple". It looks roughly like this:
725 /// riscv64-linux-gnu
726 /// The fields are, respectively:
727 /// * CPU Architecture
728 /// * Operating System
729 /// * C ABI (optional)
730 /// "native" can be used for any of the fields.
731 arch_os_abi: []const u8,
732
733 /// Looks like "name+a+b-c-d+e", where "name" is a CPU Model name, "a", "b", and "e"
734 /// are examples of CPU features to add to the set, and "c" and "d" are examples of CPU features
735 /// to remove from the set.
736 /// The default value of `null` means to use the "baseline" feature set.
737 /// "native" can be used to perform CPU introspection.
738 cpu: ?[]const u8 = null,
739 };
740
741 pub fn parse(args: ParseOptions) !Target {
742 var it = mem.separate(args.arch_os_abi, "-");
783743 const arch_name = it.next() orelse return error.MissingArchitecture;
784744 const os_name = it.next() orelse return error.MissingOperatingSystem;
785745 const abi_name = it.next();
786 const arch = try parseArchSub(arch_name);
746 if (it.next() != null) return error.UnexpectedExtraField;
787747
788 var cross = Cross{
789 .arch = arch,
790 .cpu_features = arch.getBaselineCpuFeatures(),
791 .os = try parseOs(os_name),
792 .abi = undefined,
793 };
794 cross.abi = if (abi_name) |n| try parseAbi(n) else defaultAbi(cross.arch, cross.os);
795 return Target{ .Cross = cross };
796 }
748 const arch = try Cpu.Arch.parse(arch_name);
749 const os = try Os.parse(os_name);
750 const abi = if (abi_name) |n| try Abi.parse(n) else Abi.default(arch, os);
797751
798 pub fn defaultAbi(arch: Arch, target_os: Os) Abi {
799 switch (arch) {
800 .wasm32, .wasm64 => return .musl,
801 else => {},
802 }
803 switch (target_os) {
804 .freestanding,
805 .ananas,
806 .cloudabi,
807 .dragonfly,
808 .lv2,
809 .solaris,
810 .haiku,
811 .minix,
812 .rtems,
813 .nacl,
814 .cnk,
815 .aix,
816 .cuda,
817 .nvcl,
818 .amdhsa,
819 .ps4,
820 .elfiamcu,
821 .mesa3d,
822 .contiki,
823 .amdpal,
824 .hermit,
825 .other,
826 => return .eabi,
827 .openbsd,
828 .macosx,
829 .freebsd,
830 .ios,
831 .tvos,
832 .watchos,
833 .fuchsia,
834 .kfreebsd,
835 .netbsd,
836 .hurd,
837 => return .gnu,
838 .windows,
839 .uefi,
840 => return .msvc,
841 .linux,
842 .wasi,
843 .emscripten,
844 => return .musl,
845 }
846 }
847
848 pub const ParseArchSubError = error{
849 UnknownArchitecture,
850 UnknownSubArchitecture,
851 };
852
853 pub fn parseArchSub(text: []const u8) ParseArchSubError!Arch {
854 const info = @typeInfo(Arch);
855 inline for (info.Union.fields) |field| {
856 if (mem.startsWith(u8, text, field.name)) {
857 if (field.field_type == void) {
858 return @as(Arch, @field(Arch, field.name));
859 } else {
860 const sub_info = @typeInfo(field.field_type);
861 inline for (sub_info.Enum.fields) |sub_field| {
862 const combined = field.name ++ sub_field.name;
863 if (mem.eql(u8, text, combined)) {
864 return @unionInit(Arch, field.name, @field(field.field_type, sub_field.name));
752 const all_features = arch.allFeaturesList();
753 const cpu: Cpu = if (args.cpu) |cpu_text| blk: {
754 var index: usize = 0;
755 while (index < cpu_text.len and cpu_text[index] != '+' and cpu_text[index] != '-') {
756 index += 1;
757 }
758 const cpu_name = cpu_text[0..index];
759 const cpu_model = try arch.parseCpuModel(cpu_name);
760
761 var set = cpu_model.features;
762 while (index < cpu_text.len) {
763 const op = cpu_text[index];
764 index += 1;
765 const start = index;
766 while (index < cpu_text.len and cpu_text[index] != '+' and cpu_text[index] != '-') {
767 index += 1;
768 }
769 const feature_name = cpu_text[start..index];
770 for (all_features) |feature, feat_index_usize| {
771 const feat_index = @intCast(Cpu.Feature.Set.Index, feat_index_usize);
772 if (mem.eql(u8, feature_name, feature.name)) {
773 switch (op) {
774 '+' => set.addFeature(feat_index),
775 '-' => set.removeFeature(feat_index),
776 else => unreachable,
865777 }
778 break;
866779 }
867 return error.UnknownSubArchitecture;
780 } else {
781 return error.UnknownCpuFeature;
868782 }
869783 }
870 }
871 return error.UnknownArchitecture;
872 }
873
874 pub fn parseOs(text: []const u8) !Os {
875 const info = @typeInfo(Os);
876 inline for (info.Enum.fields) |field| {
877 if (mem.eql(u8, text, field.name)) {
878 return @field(Os, field.name);
879 }
880 }
881 return error.UnknownOperatingSystem;
882 }
883
884 pub fn parseAbi(text: []const u8) !Abi {
885 const info = @typeInfo(Abi);
886 inline for (info.Enum.fields) |field| {
887 if (mem.eql(u8, text, field.name)) {
888 return @field(Abi, field.name);
889 }
890 }
891 return error.UnknownApplicationBinaryInterface;
892 }
784 set.populateDependencies(all_features);
785 break :blk .{
786 .arch = arch,
787 .model = cpu_model,
788 .features = set,
789 };
790 } else Cpu.baseline(arch);
893791
894 fn archSubArchName(arch: Arch) []const u8 {
895 return switch (arch) {
896 .arm => |sub| @tagName(sub),
897 .armeb => |sub| @tagName(sub),
898 .thumb => |sub| @tagName(sub),
899 .thumbeb => |sub| @tagName(sub),
900 .aarch64 => |sub| @tagName(sub),
901 .aarch64_be => |sub| @tagName(sub),
902 .kalimba => |sub| @tagName(sub),
903 else => "",
792 var cross = Cross{
793 .cpu = cpu,
794 .os = os,
795 .abi = abi,
904796 };
905 }
906
907 pub fn subArchName(self: Target) []const u8 {
908 switch (self) {
909 .Native => return archSubArchName(builtin.arch),
910 .Cross => |cross| return archSubArchName(cross.arch),
911 }
797 return Target{ .Cross = cross };
912798 }
913799
914800 pub fn oFileExt(self: Target) []const u8 {
......@@ -967,11 +853,15 @@ pub const Target = union(enum) {
967853 };
968854 }
969855
970 pub fn getArch(self: Target) Arch {
971 switch (self) {
972 .Native => return builtin.arch,
973 .Cross => |t| return t.arch,
974 }
856 pub fn getCpu(self: Target) Cpu {
857 return switch (self) {
858 .Native => builtin.cpu,
859 .Cross => |cross| cross.cpu,
860 };
861 }
862
863 pub fn getArch(self: Target) Cpu.Arch {
864 return self.getCpu().arch;
975865 }
976866
977867 pub fn getAbi(self: Target) Abi {
......@@ -1372,14 +1262,32 @@ pub const Target = union(enum) {
13721262 }
13731263};
13741264
1375test "parseCpuFeatureSet" {
1376 const arch: Target.Arch = .x86_64;
1377 const baseline = arch.getBaselineCpuFeatures();
1378 const set = try arch.parseCpuFeatureSet(baseline.cpu, "-sse,-avx,-cx8");
1379 std.testing.expect(!Target.x86.featureSetHas(set, .sse));
1380 std.testing.expect(!Target.x86.featureSetHas(set, .avx));
1381 std.testing.expect(!Target.x86.featureSetHas(set, .cx8));
1382 // These are expected because they are part of the baseline
1383 std.testing.expect(Target.x86.featureSetHas(set, .cmov));
1384 std.testing.expect(Target.x86.featureSetHas(set, .fxsr));
1265test "Target.parse" {
1266 {
1267 const target = (try Target.parse(.{
1268 .arch_os_abi = "x86_64-linux-gnu",
1269 .cpu = "x86_64-sse-avx-cx8",
1270 })).Cross;
1271
1272 std.testing.expect(target.os == .linux);
1273 std.testing.expect(target.abi == .gnu);
1274 std.testing.expect(target.cpu.arch == .x86_64);
1275 std.testing.expect(!Target.x86.featureSetHas(target.cpu.features, .sse));
1276 std.testing.expect(!Target.x86.featureSetHas(target.cpu.features, .avx));
1277 std.testing.expect(!Target.x86.featureSetHas(target.cpu.features, .cx8));
1278 std.testing.expect(Target.x86.featureSetHas(target.cpu.features, .cmov));
1279 std.testing.expect(Target.x86.featureSetHas(target.cpu.features, .fxsr));
1280 }
1281 {
1282 const target = (try Target.parse(.{
1283 .arch_os_abi = "arm-linux-musleabihf",
1284 .cpu = "generic+v8a",
1285 })).Cross;
1286
1287 std.testing.expect(target.os == .linux);
1288 std.testing.expect(target.abi == .musleabihf);
1289 std.testing.expect(target.cpu.arch == .arm);
1290 std.testing.expect(target.cpu.model == &Target.arm.cpu.generic);
1291 std.testing.expect(Target.arm.featureSetHas(target.cpu.features, .v8a));
1292 }
13851293}
lib/std/target/aarch64.zig+189-362
......@@ -1,14 +1,8 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
5 a35,
6 a53,
7 a55,
8 a57,
9 a72,
10 a73,
11 a75,
126 a76,
137 aes,
148 aggressive_fma,
......@@ -40,11 +34,7 @@ pub const Feature = enum {
4034 dit,
4135 dotprod,
4236 exynos_cheap_as_move,
43 exynosm1,
44 exynosm2,
45 exynosm3,
4637 exynosm4,
47 falkor,
4838 fmi,
4939 force_32bit_jump_tables,
5040 fp_armv8,
......@@ -58,7 +48,6 @@ pub const Feature = enum {
5848 fuse_csel,
5949 fuse_literals,
6050 jsconv,
61 kryo,
6251 lor,
6352 lse,
6453 lsl_fast,
......@@ -103,7 +92,6 @@ pub const Feature = enum {
10392 reserve_x6,
10493 reserve_x7,
10594 reserve_x9,
106 saphira,
10795 sb,
10896 sel2,
10997 sha2,
......@@ -122,17 +110,11 @@ pub const Feature = enum {
122110 sve2_bitperm,
123111 sve2_sha3,
124112 sve2_sm4,
125 thunderx,
126 thunderx2t99,
127 thunderxt81,
128 thunderxt83,
129 thunderxt88,
130113 tlb_rmi,
131114 tpidr_el1,
132115 tpidr_el2,
133116 tpidr_el3,
134117 tracev8_4,
135 tsv110,
136118 uaops,
137119 use_aa,
138120 use_postra_scheduler,
......@@ -151,120 +133,20 @@ pub const Feature = enum {
151133 zcz_gp,
152134};
153135
154pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
136pub usingnamespace CpuFeature.feature_set_fns(Feature);
155137
156138pub const all_features = blk: {
157139 @setEvalBranchQuota(2000);
158140 const len = @typeInfo(Feature).Enum.fields.len;
159 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
160 var result: [len]Cpu.Feature = undefined;
161 result[@enumToInt(Feature.a35)] = .{
162 .llvm_name = "a35",
163 .description = "Cortex-A35 ARM processors",
164 .dependencies = featureSet(&[_]Feature{
165 .crc,
166 .crypto,
167 .fp_armv8,
168 .neon,
169 .perfmon,
170 }),
171 };
172 result[@enumToInt(Feature.a53)] = .{
173 .llvm_name = "a53",
174 .description = "Cortex-A53 ARM processors",
175 .dependencies = featureSet(&[_]Feature{
176 .balance_fp_ops,
177 .crc,
178 .crypto,
179 .custom_cheap_as_move,
180 .fp_armv8,
181 .fuse_aes,
182 .neon,
183 .perfmon,
184 .use_aa,
185 .use_postra_scheduler,
186 }),
187 };
188 result[@enumToInt(Feature.a55)] = .{
189 .llvm_name = "a55",
190 .description = "Cortex-A55 ARM processors",
191 .dependencies = featureSet(&[_]Feature{
192 .crypto,
193 .dotprod,
194 .fp_armv8,
195 .fullfp16,
196 .fuse_aes,
197 .neon,
198 .perfmon,
199 .rcpc,
200 .v8_2a,
201 }),
202 };
203 result[@enumToInt(Feature.a57)] = .{
204 .llvm_name = "a57",
205 .description = "Cortex-A57 ARM processors",
206 .dependencies = featureSet(&[_]Feature{
207 .balance_fp_ops,
208 .crc,
209 .crypto,
210 .custom_cheap_as_move,
211 .fp_armv8,
212 .fuse_aes,
213 .fuse_literals,
214 .neon,
215 .perfmon,
216 .predictable_select_expensive,
217 .use_postra_scheduler,
218 }),
219 };
220 result[@enumToInt(Feature.a72)] = .{
221 .llvm_name = "a72",
222 .description = "Cortex-A72 ARM processors",
223 .dependencies = featureSet(&[_]Feature{
224 .crc,
225 .crypto,
226 .fp_armv8,
227 .fuse_aes,
228 .neon,
229 .perfmon,
230 }),
231 };
232 result[@enumToInt(Feature.a73)] = .{
233 .llvm_name = "a73",
234 .description = "Cortex-A73 ARM processors",
235 .dependencies = featureSet(&[_]Feature{
236 .crc,
237 .crypto,
238 .fp_armv8,
239 .fuse_aes,
240 .neon,
241 .perfmon,
242 }),
243 };
244 result[@enumToInt(Feature.a75)] = .{
245 .llvm_name = "a75",
246 .description = "Cortex-A75 ARM processors",
247 .dependencies = featureSet(&[_]Feature{
248 .crypto,
249 .dotprod,
250 .fp_armv8,
251 .fullfp16,
252 .fuse_aes,
253 .neon,
254 .perfmon,
255 .rcpc,
256 .v8_2a,
257 }),
258 };
141 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
142 var result: [len]CpuFeature = undefined;
259143 result[@enumToInt(Feature.a76)] = .{
260144 .llvm_name = "a76",
261145 .description = "Cortex-A76 ARM processors",
262146 .dependencies = featureSet(&[_]Feature{
263147 .crypto,
264148 .dotprod,
265 .fp_armv8,
266149 .fullfp16,
267 .neon,
268150 .rcpc,
269151 .ssbs,
270152 .v8_2a,
......@@ -412,11 +294,10 @@ pub const all_features = blk: {
412294 .arith_cbz_fusion,
413295 .crypto,
414296 .disable_latency_sched_heuristic,
415 .fp_armv8,
416297 .fuse_aes,
417298 .fuse_crypto_eor,
418 .neon,
419299 .perfmon,
300 .v8a,
420301 .zcm,
421302 .zcz,
422303 .zcz_fp_workaround,
......@@ -444,58 +325,6 @@ pub const all_features = blk: {
444325 .custom_cheap_as_move,
445326 }),
446327 };
447 result[@enumToInt(Feature.exynosm1)] = .{
448 .llvm_name = "exynosm1",
449 .description = "Samsung Exynos-M1 processors",
450 .dependencies = featureSet(&[_]Feature{
451 .crc,
452 .crypto,
453 .exynos_cheap_as_move,
454 .force_32bit_jump_tables,
455 .fuse_aes,
456 .perfmon,
457 .slow_misaligned_128store,
458 .slow_paired_128,
459 .use_postra_scheduler,
460 .use_reciprocal_square_root,
461 .zcz_fp,
462 }),
463 };
464 result[@enumToInt(Feature.exynosm2)] = .{
465 .llvm_name = "exynosm2",
466 .description = "Samsung Exynos-M2 processors",
467 .dependencies = featureSet(&[_]Feature{
468 .crc,
469 .crypto,
470 .exynos_cheap_as_move,
471 .force_32bit_jump_tables,
472 .fuse_aes,
473 .perfmon,
474 .slow_misaligned_128store,
475 .slow_paired_128,
476 .use_postra_scheduler,
477 .zcz_fp,
478 }),
479 };
480 result[@enumToInt(Feature.exynosm3)] = .{
481 .llvm_name = "exynosm3",
482 .description = "Samsung Exynos-M3 processors",
483 .dependencies = featureSet(&[_]Feature{
484 .crc,
485 .crypto,
486 .exynos_cheap_as_move,
487 .force_32bit_jump_tables,
488 .fuse_address,
489 .fuse_aes,
490 .fuse_csel,
491 .fuse_literals,
492 .lsl_fast,
493 .perfmon,
494 .predictable_select_expensive,
495 .use_postra_scheduler,
496 .zcz_fp,
497 }),
498 };
499328 result[@enumToInt(Feature.exynosm4)] = .{
500329 .llvm_name = "exynosm4",
501330 .description = "Samsung Exynos-M4 processors",
......@@ -519,24 +348,6 @@ pub const all_features = blk: {
519348 .zcz,
520349 }),
521350 };
522 result[@enumToInt(Feature.falkor)] = .{
523 .llvm_name = "falkor",
524 .description = "Qualcomm Falkor processors",
525 .dependencies = featureSet(&[_]Feature{
526 .crc,
527 .crypto,
528 .custom_cheap_as_move,
529 .fp_armv8,
530 .lsl_fast,
531 .neon,
532 .perfmon,
533 .predictable_select_expensive,
534 .rdm,
535 .slow_strqro_store,
536 .use_postra_scheduler,
537 .zcz,
538 }),
539 };
540351 result[@enumToInt(Feature.fmi)] = .{
541352 .llvm_name = "fmi",
542353 .description = "Enable v8.4-A Flag Manipulation Instructions",
......@@ -608,22 +419,6 @@ pub const all_features = blk: {
608419 .fp_armv8,
609420 }),
610421 };
611 result[@enumToInt(Feature.kryo)] = .{
612 .llvm_name = "kryo",
613 .description = "Qualcomm Kryo processors",
614 .dependencies = featureSet(&[_]Feature{
615 .crc,
616 .crypto,
617 .custom_cheap_as_move,
618 .fp_armv8,
619 .lsl_fast,
620 .neon,
621 .perfmon,
622 .predictable_select_expensive,
623 .use_postra_scheduler,
624 .zcz,
625 }),
626 };
627422 result[@enumToInt(Feature.lor)] = .{
628423 .llvm_name = "lor",
629424 .description = "Enables ARM v8.1 Limited Ordering Regions extension",
......@@ -852,23 +647,6 @@ pub const all_features = blk: {
852647 .description = "Reserve X9, making it unavailable as a GPR",
853648 .dependencies = featureSet(&[_]Feature{}),
854649 };
855 result[@enumToInt(Feature.saphira)] = .{
856 .llvm_name = "saphira",
857 .description = "Qualcomm Saphira processors",
858 .dependencies = featureSet(&[_]Feature{
859 .crypto,
860 .custom_cheap_as_move,
861 .fp_armv8,
862 .lsl_fast,
863 .neon,
864 .perfmon,
865 .predictable_select_expensive,
866 .spe,
867 .use_postra_scheduler,
868 .v8_4a,
869 .zcz,
870 }),
871 };
872650 result[@enumToInt(Feature.sb)] = .{
873651 .llvm_name = "sb",
874652 .description = "Enable v8.5 Speculation Barrier",
......@@ -979,74 +757,6 @@ pub const all_features = blk: {
979757 .sve2,
980758 }),
981759 };
982 result[@enumToInt(Feature.thunderx)] = .{
983 .llvm_name = "thunderx",
984 .description = "Cavium ThunderX processors",
985 .dependencies = featureSet(&[_]Feature{
986 .crc,
987 .crypto,
988 .fp_armv8,
989 .neon,
990 .perfmon,
991 .predictable_select_expensive,
992 .use_postra_scheduler,
993 }),
994 };
995 result[@enumToInt(Feature.thunderx2t99)] = .{
996 .llvm_name = "thunderx2t99",
997 .description = "Cavium ThunderX2 processors",
998 .dependencies = featureSet(&[_]Feature{
999 .aggressive_fma,
1000 .arith_bcc_fusion,
1001 .crc,
1002 .crypto,
1003 .fp_armv8,
1004 .lse,
1005 .neon,
1006 .predictable_select_expensive,
1007 .use_postra_scheduler,
1008 .v8_1a,
1009 }),
1010 };
1011 result[@enumToInt(Feature.thunderxt81)] = .{
1012 .llvm_name = "thunderxt81",
1013 .description = "Cavium ThunderX processors",
1014 .dependencies = featureSet(&[_]Feature{
1015 .crc,
1016 .crypto,
1017 .fp_armv8,
1018 .neon,
1019 .perfmon,
1020 .predictable_select_expensive,
1021 .use_postra_scheduler,
1022 }),
1023 };
1024 result[@enumToInt(Feature.thunderxt83)] = .{
1025 .llvm_name = "thunderxt83",
1026 .description = "Cavium ThunderX processors",
1027 .dependencies = featureSet(&[_]Feature{
1028 .crc,
1029 .crypto,
1030 .fp_armv8,
1031 .neon,
1032 .perfmon,
1033 .predictable_select_expensive,
1034 .use_postra_scheduler,
1035 }),
1036 };
1037 result[@enumToInt(Feature.thunderxt88)] = .{
1038 .llvm_name = "thunderxt88",
1039 .description = "Cavium ThunderX processors",
1040 .dependencies = featureSet(&[_]Feature{
1041 .crc,
1042 .crypto,
1043 .fp_armv8,
1044 .neon,
1045 .perfmon,
1046 .predictable_select_expensive,
1047 .use_postra_scheduler,
1048 }),
1049 };
1050760 result[@enumToInt(Feature.tlb_rmi)] = .{
1051761 .llvm_name = "tlb-rmi",
1052762 .description = "Enable v8.4-A TLB Range and Maintenance Instructions",
......@@ -1072,24 +782,6 @@ pub const all_features = blk: {
1072782 .description = "Enable v8.4-A Trace extension",
1073783 .dependencies = featureSet(&[_]Feature{}),
1074784 };
1075 result[@enumToInt(Feature.tsv110)] = .{
1076 .llvm_name = "tsv110",
1077 .description = "HiSilicon TS-V110 processors",
1078 .dependencies = featureSet(&[_]Feature{
1079 .crypto,
1080 .custom_cheap_as_move,
1081 .dotprod,
1082 .fp_armv8,
1083 .fp16fml,
1084 .fullfp16,
1085 .fuse_aes,
1086 .neon,
1087 .perfmon,
1088 .spe,
1089 .use_postra_scheduler,
1090 .v8_2a,
1091 }),
1092 };
1093785 result[@enumToInt(Feature.uaops)] = .{
1094786 .llvm_name = "uaops",
1095787 .description = "Enable v8.2 UAO PState",
......@@ -1229,190 +921,325 @@ pub const all_features = blk: {
1229921};
1230922
1231923pub const cpu = struct {
1232 pub const apple_latest = Cpu{
924 pub const apple_latest = CpuModel{
1233925 .name = "apple_latest",
1234926 .llvm_name = "apple-latest",
1235927 .features = featureSet(&[_]Feature{
1236928 .cyclone,
1237929 }),
1238930 };
1239 pub const cortex_a35 = Cpu{
931 pub const cortex_a35 = CpuModel{
1240932 .name = "cortex_a35",
1241933 .llvm_name = "cortex-a35",
1242934 .features = featureSet(&[_]Feature{
1243 .a35,
935 .crc,
936 .crypto,
937 .perfmon,
938 .v8a,
1244939 }),
1245940 };
1246 pub const cortex_a53 = Cpu{
941 pub const cortex_a53 = CpuModel{
1247942 .name = "cortex_a53",
1248943 .llvm_name = "cortex-a53",
1249944 .features = featureSet(&[_]Feature{
1250 .a53,
945 .balance_fp_ops,
946 .crc,
947 .crypto,
948 .custom_cheap_as_move,
949 .fuse_aes,
950 .perfmon,
951 .use_aa,
952 .use_postra_scheduler,
953 .v8a,
1251954 }),
1252955 };
1253 pub const cortex_a55 = Cpu{
956 pub const cortex_a55 = CpuModel{
1254957 .name = "cortex_a55",
1255958 .llvm_name = "cortex-a55",
1256959 .features = featureSet(&[_]Feature{
1257 .a55,
960 .crypto,
961 .dotprod,
962 .fullfp16,
963 .fuse_aes,
964 .perfmon,
965 .rcpc,
966 .v8_2a,
1258967 }),
1259968 };
1260 pub const cortex_a57 = Cpu{
969 pub const cortex_a57 = CpuModel{
1261970 .name = "cortex_a57",
1262971 .llvm_name = "cortex-a57",
1263972 .features = featureSet(&[_]Feature{
1264 .a57,
973 .balance_fp_ops,
974 .crc,
975 .crypto,
976 .custom_cheap_as_move,
977 .fuse_aes,
978 .fuse_literals,
979 .perfmon,
980 .predictable_select_expensive,
981 .use_postra_scheduler,
982 .v8a,
1265983 }),
1266984 };
1267 pub const cortex_a72 = Cpu{
985 pub const cortex_a72 = CpuModel{
1268986 .name = "cortex_a72",
1269987 .llvm_name = "cortex-a72",
1270988 .features = featureSet(&[_]Feature{
1271 .a72,
989 .crc,
990 .crypto,
991 .fuse_aes,
992 .perfmon,
993 .v8a,
1272994 }),
1273995 };
1274 pub const cortex_a73 = Cpu{
996 pub const cortex_a73 = CpuModel{
1275997 .name = "cortex_a73",
1276998 .llvm_name = "cortex-a73",
1277999 .features = featureSet(&[_]Feature{
1278 .a73,
1000 .crc,
1001 .crypto,
1002 .fuse_aes,
1003 .perfmon,
1004 .v8a,
12791005 }),
12801006 };
1281 pub const cortex_a75 = Cpu{
1007 pub const cortex_a75 = CpuModel{
12821008 .name = "cortex_a75",
12831009 .llvm_name = "cortex-a75",
12841010 .features = featureSet(&[_]Feature{
1285 .a75,
1011 .crypto,
1012 .dotprod,
1013 .fullfp16,
1014 .fuse_aes,
1015 .perfmon,
1016 .rcpc,
1017 .v8_2a,
12861018 }),
12871019 };
1288 pub const cortex_a76 = Cpu{
1020 pub const cortex_a76 = CpuModel{
12891021 .name = "cortex_a76",
12901022 .llvm_name = "cortex-a76",
12911023 .features = featureSet(&[_]Feature{
12921024 .a76,
12931025 }),
12941026 };
1295 pub const cortex_a76ae = Cpu{
1027 pub const cortex_a76ae = CpuModel{
12961028 .name = "cortex_a76ae",
12971029 .llvm_name = "cortex-a76ae",
12981030 .features = featureSet(&[_]Feature{
12991031 .a76,
13001032 }),
13011033 };
1302 pub const cyclone = Cpu{
1034 pub const cyclone = CpuModel{
13031035 .name = "cyclone",
13041036 .llvm_name = "cyclone",
13051037 .features = featureSet(&[_]Feature{
13061038 .cyclone,
13071039 }),
13081040 };
1309 pub const exynos_m1 = Cpu{
1041 pub const exynos_m1 = CpuModel{
13101042 .name = "exynos_m1",
13111043 .llvm_name = "exynos-m1",
13121044 .features = featureSet(&[_]Feature{
1313 .exynosm1,
1045 .crc,
1046 .crypto,
1047 .exynos_cheap_as_move,
1048 .force_32bit_jump_tables,
1049 .fuse_aes,
1050 .perfmon,
1051 .slow_misaligned_128store,
1052 .slow_paired_128,
1053 .use_postra_scheduler,
1054 .use_reciprocal_square_root,
1055 .v8a,
1056 .zcz_fp,
13141057 }),
13151058 };
1316 pub const exynos_m2 = Cpu{
1059 pub const exynos_m2 = CpuModel{
13171060 .name = "exynos_m2",
13181061 .llvm_name = "exynos-m2",
13191062 .features = featureSet(&[_]Feature{
1320 .exynosm2,
1063 .crc,
1064 .crypto,
1065 .exynos_cheap_as_move,
1066 .force_32bit_jump_tables,
1067 .fuse_aes,
1068 .perfmon,
1069 .slow_misaligned_128store,
1070 .slow_paired_128,
1071 .use_postra_scheduler,
1072 .v8a,
1073 .zcz_fp,
13211074 }),
13221075 };
1323 pub const exynos_m3 = Cpu{
1076 pub const exynos_m3 = CpuModel{
13241077 .name = "exynos_m3",
13251078 .llvm_name = "exynos-m3",
13261079 .features = featureSet(&[_]Feature{
1327 .exynosm3,
1080 .crc,
1081 .crypto,
1082 .exynos_cheap_as_move,
1083 .force_32bit_jump_tables,
1084 .fuse_address,
1085 .fuse_aes,
1086 .fuse_csel,
1087 .fuse_literals,
1088 .lsl_fast,
1089 .perfmon,
1090 .predictable_select_expensive,
1091 .use_postra_scheduler,
1092 .v8a,
1093 .zcz_fp,
13281094 }),
13291095 };
1330 pub const exynos_m4 = Cpu{
1096 pub const exynos_m4 = CpuModel{
13311097 .name = "exynos_m4",
13321098 .llvm_name = "exynos-m4",
13331099 .features = featureSet(&[_]Feature{
13341100 .exynosm4,
13351101 }),
13361102 };
1337 pub const exynos_m5 = Cpu{
1103 pub const exynos_m5 = CpuModel{
13381104 .name = "exynos_m5",
13391105 .llvm_name = "exynos-m5",
13401106 .features = featureSet(&[_]Feature{
13411107 .exynosm4,
13421108 }),
13431109 };
1344 pub const falkor = Cpu{
1110 pub const falkor = CpuModel{
13451111 .name = "falkor",
13461112 .llvm_name = "falkor",
13471113 .features = featureSet(&[_]Feature{
1348 .falkor,
1114 .crc,
1115 .crypto,
1116 .custom_cheap_as_move,
1117 .lsl_fast,
1118 .perfmon,
1119 .predictable_select_expensive,
1120 .rdm,
1121 .slow_strqro_store,
1122 .use_postra_scheduler,
1123 .v8a,
1124 .zcz,
13491125 }),
13501126 };
1351 pub const generic = Cpu{
1127 pub const generic = CpuModel{
13521128 .name = "generic",
13531129 .llvm_name = "generic",
13541130 .features = featureSet(&[_]Feature{
1355 .fp_armv8,
13561131 .fuse_aes,
1357 .neon,
13581132 .perfmon,
13591133 .use_postra_scheduler,
1134 .v8a,
13601135 }),
13611136 };
1362 pub const kryo = Cpu{
1137 pub const kryo = CpuModel{
13631138 .name = "kryo",
13641139 .llvm_name = "kryo",
13651140 .features = featureSet(&[_]Feature{
1366 .kryo,
1141 .crc,
1142 .crypto,
1143 .custom_cheap_as_move,
1144 .lsl_fast,
1145 .perfmon,
1146 .predictable_select_expensive,
1147 .use_postra_scheduler,
1148 .zcz,
1149 .v8a,
13671150 }),
13681151 };
1369 pub const saphira = Cpu{
1152 pub const saphira = CpuModel{
13701153 .name = "saphira",
13711154 .llvm_name = "saphira",
13721155 .features = featureSet(&[_]Feature{
1373 .saphira,
1156 .crypto,
1157 .custom_cheap_as_move,
1158 .lsl_fast,
1159 .perfmon,
1160 .predictable_select_expensive,
1161 .spe,
1162 .use_postra_scheduler,
1163 .v8_4a,
1164 .zcz,
13741165 }),
13751166 };
1376 pub const thunderx = Cpu{
1167 pub const thunderx = CpuModel{
13771168 .name = "thunderx",
13781169 .llvm_name = "thunderx",
13791170 .features = featureSet(&[_]Feature{
1380 .thunderx,
1171 .crc,
1172 .crypto,
1173 .perfmon,
1174 .predictable_select_expensive,
1175 .use_postra_scheduler,
1176 .v8a,
13811177 }),
13821178 };
1383 pub const thunderx2t99 = Cpu{
1179 pub const thunderx2t99 = CpuModel{
13841180 .name = "thunderx2t99",
13851181 .llvm_name = "thunderx2t99",
13861182 .features = featureSet(&[_]Feature{
1387 .thunderx2t99,
1183 .aggressive_fma,
1184 .arith_bcc_fusion,
1185 .crc,
1186 .crypto,
1187 .lse,
1188 .predictable_select_expensive,
1189 .use_postra_scheduler,
1190 .v8_1a,
13881191 }),
13891192 };
1390 pub const thunderxt81 = Cpu{
1193 pub const thunderxt81 = CpuModel{
13911194 .name = "thunderxt81",
13921195 .llvm_name = "thunderxt81",
13931196 .features = featureSet(&[_]Feature{
1394 .thunderxt81,
1197 .crc,
1198 .crypto,
1199 .perfmon,
1200 .predictable_select_expensive,
1201 .use_postra_scheduler,
1202 .v8a,
13951203 }),
13961204 };
1397 pub const thunderxt83 = Cpu{
1205 pub const thunderxt83 = CpuModel{
13981206 .name = "thunderxt83",
13991207 .llvm_name = "thunderxt83",
14001208 .features = featureSet(&[_]Feature{
1401 .thunderxt83,
1209 .crc,
1210 .crypto,
1211 .perfmon,
1212 .predictable_select_expensive,
1213 .use_postra_scheduler,
1214 .v8a,
14021215 }),
14031216 };
1404 pub const thunderxt88 = Cpu{
1217 pub const thunderxt88 = CpuModel{
14051218 .name = "thunderxt88",
14061219 .llvm_name = "thunderxt88",
14071220 .features = featureSet(&[_]Feature{
1408 .thunderxt88,
1221 .crc,
1222 .crypto,
1223 .perfmon,
1224 .predictable_select_expensive,
1225 .use_postra_scheduler,
1226 .v8a,
14091227 }),
14101228 };
1411 pub const tsv110 = Cpu{
1229 pub const tsv110 = CpuModel{
14121230 .name = "tsv110",
14131231 .llvm_name = "tsv110",
14141232 .features = featureSet(&[_]Feature{
1415 .tsv110,
1233 .crypto,
1234 .custom_cheap_as_move,
1235 .dotprod,
1236 .fp16fml,
1237 .fullfp16,
1238 .fuse_aes,
1239 .perfmon,
1240 .spe,
1241 .use_postra_scheduler,
1242 .v8_2a,
14161243 }),
14171244 };
14181245};
......@@ -1420,7 +1247,7 @@ pub const cpu = struct {
14201247/// All aarch64 CPUs, sorted alphabetically by name.
14211248/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
14221249/// compiler has inefficient memory and CPU usage, affecting build times.
1423pub const all_cpus = &[_]*const Cpu{
1250pub const all_cpus = &[_]*const CpuModel{
14241251 &cpu.apple_latest,
14251252 &cpu.cortex_a35,
14261253 &cpu.cortex_a53,
lib/std/target/amdgpu.zig+45-44
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 @"16_bit_insts",
......@@ -111,12 +112,12 @@ pub const Feature = enum {
111112 xnack,
112113};
113114
114pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
115pub usingnamespace CpuFeature.feature_set_fns(Feature);
115116
116117pub const all_features = blk: {
117118 const len = @typeInfo(Feature).Enum.fields.len;
118 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
119 var result: [len]Cpu.Feature = undefined;
119 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
120 var result: [len]CpuFeature = undefined;
120121 result[@enumToInt(Feature.@"16_bit_insts")] = .{
121122 .llvm_name = "16-bit-insts",
122123 .description = "Has i16/f16 instructions",
......@@ -778,7 +779,7 @@ pub const all_features = blk: {
778779};
779780
780781pub const cpu = struct {
781 pub const bonaire = Cpu{
782 pub const bonaire = CpuModel{
782783 .name = "bonaire",
783784 .llvm_name = "bonaire",
784785 .features = featureSet(&[_]Feature{
......@@ -788,7 +789,7 @@ pub const cpu = struct {
788789 .sea_islands,
789790 }),
790791 };
791 pub const carrizo = Cpu{
792 pub const carrizo = CpuModel{
792793 .name = "carrizo",
793794 .llvm_name = "carrizo",
794795 .features = featureSet(&[_]Feature{
......@@ -801,7 +802,7 @@ pub const cpu = struct {
801802 .xnack,
802803 }),
803804 };
804 pub const fiji = Cpu{
805 pub const fiji = CpuModel{
805806 .name = "fiji",
806807 .llvm_name = "fiji",
807808 .features = featureSet(&[_]Feature{
......@@ -812,14 +813,14 @@ pub const cpu = struct {
812813 .volcanic_islands,
813814 }),
814815 };
815 pub const generic = Cpu{
816 pub const generic = CpuModel{
816817 .name = "generic",
817818 .llvm_name = "generic",
818819 .features = featureSet(&[_]Feature{
819820 .wavefrontsize64,
820821 }),
821822 };
822 pub const generic_hsa = Cpu{
823 pub const generic_hsa = CpuModel{
823824 .name = "generic_hsa",
824825 .llvm_name = "generic-hsa",
825826 .features = featureSet(&[_]Feature{
......@@ -827,7 +828,7 @@ pub const cpu = struct {
827828 .wavefrontsize64,
828829 }),
829830 };
830 pub const gfx1010 = Cpu{
831 pub const gfx1010 = CpuModel{
831832 .name = "gfx1010",
832833 .llvm_name = "gfx1010",
833834 .features = featureSet(&[_]Feature{
......@@ -853,7 +854,7 @@ pub const cpu = struct {
853854 .wavefrontsize32,
854855 }),
855856 };
856 pub const gfx1011 = Cpu{
857 pub const gfx1011 = CpuModel{
857858 .name = "gfx1011",
858859 .llvm_name = "gfx1011",
859860 .features = featureSet(&[_]Feature{
......@@ -882,7 +883,7 @@ pub const cpu = struct {
882883 .wavefrontsize32,
883884 }),
884885 };
885 pub const gfx1012 = Cpu{
886 pub const gfx1012 = CpuModel{
886887 .name = "gfx1012",
887888 .llvm_name = "gfx1012",
888889 .features = featureSet(&[_]Feature{
......@@ -912,7 +913,7 @@ pub const cpu = struct {
912913 .wavefrontsize32,
913914 }),
914915 };
915 pub const gfx600 = Cpu{
916 pub const gfx600 = CpuModel{
916917 .name = "gfx600",
917918 .llvm_name = "gfx600",
918919 .features = featureSet(&[_]Feature{
......@@ -924,7 +925,7 @@ pub const cpu = struct {
924925 .southern_islands,
925926 }),
926927 };
927 pub const gfx601 = Cpu{
928 pub const gfx601 = CpuModel{
928929 .name = "gfx601",
929930 .llvm_name = "gfx601",
930931 .features = featureSet(&[_]Feature{
......@@ -934,7 +935,7 @@ pub const cpu = struct {
934935 .southern_islands,
935936 }),
936937 };
937 pub const gfx700 = Cpu{
938 pub const gfx700 = CpuModel{
938939 .name = "gfx700",
939940 .llvm_name = "gfx700",
940941 .features = featureSet(&[_]Feature{
......@@ -944,7 +945,7 @@ pub const cpu = struct {
944945 .sea_islands,
945946 }),
946947 };
947 pub const gfx701 = Cpu{
948 pub const gfx701 = CpuModel{
948949 .name = "gfx701",
949950 .llvm_name = "gfx701",
950951 .features = featureSet(&[_]Feature{
......@@ -956,7 +957,7 @@ pub const cpu = struct {
956957 .sea_islands,
957958 }),
958959 };
959 pub const gfx702 = Cpu{
960 pub const gfx702 = CpuModel{
960961 .name = "gfx702",
961962 .llvm_name = "gfx702",
962963 .features = featureSet(&[_]Feature{
......@@ -967,7 +968,7 @@ pub const cpu = struct {
967968 .sea_islands,
968969 }),
969970 };
970 pub const gfx703 = Cpu{
971 pub const gfx703 = CpuModel{
971972 .name = "gfx703",
972973 .llvm_name = "gfx703",
973974 .features = featureSet(&[_]Feature{
......@@ -977,7 +978,7 @@ pub const cpu = struct {
977978 .sea_islands,
978979 }),
979980 };
980 pub const gfx704 = Cpu{
981 pub const gfx704 = CpuModel{
981982 .name = "gfx704",
982983 .llvm_name = "gfx704",
983984 .features = featureSet(&[_]Feature{
......@@ -987,7 +988,7 @@ pub const cpu = struct {
987988 .sea_islands,
988989 }),
989990 };
990 pub const gfx801 = Cpu{
991 pub const gfx801 = CpuModel{
991992 .name = "gfx801",
992993 .llvm_name = "gfx801",
993994 .features = featureSet(&[_]Feature{
......@@ -1000,7 +1001,7 @@ pub const cpu = struct {
10001001 .xnack,
10011002 }),
10021003 };
1003 pub const gfx802 = Cpu{
1004 pub const gfx802 = CpuModel{
10041005 .name = "gfx802",
10051006 .llvm_name = "gfx802",
10061007 .features = featureSet(&[_]Feature{
......@@ -1012,7 +1013,7 @@ pub const cpu = struct {
10121013 .volcanic_islands,
10131014 }),
10141015 };
1015 pub const gfx803 = Cpu{
1016 pub const gfx803 = CpuModel{
10161017 .name = "gfx803",
10171018 .llvm_name = "gfx803",
10181019 .features = featureSet(&[_]Feature{
......@@ -1023,7 +1024,7 @@ pub const cpu = struct {
10231024 .volcanic_islands,
10241025 }),
10251026 };
1026 pub const gfx810 = Cpu{
1027 pub const gfx810 = CpuModel{
10271028 .name = "gfx810",
10281029 .llvm_name = "gfx810",
10291030 .features = featureSet(&[_]Feature{
......@@ -1033,7 +1034,7 @@ pub const cpu = struct {
10331034 .xnack,
10341035 }),
10351036 };
1036 pub const gfx900 = Cpu{
1037 pub const gfx900 = CpuModel{
10371038 .name = "gfx900",
10381039 .llvm_name = "gfx900",
10391040 .features = featureSet(&[_]Feature{
......@@ -1045,7 +1046,7 @@ pub const cpu = struct {
10451046 .no_xnack_support,
10461047 }),
10471048 };
1048 pub const gfx902 = Cpu{
1049 pub const gfx902 = CpuModel{
10491050 .name = "gfx902",
10501051 .llvm_name = "gfx902",
10511052 .features = featureSet(&[_]Feature{
......@@ -1057,7 +1058,7 @@ pub const cpu = struct {
10571058 .xnack,
10581059 }),
10591060 };
1060 pub const gfx904 = Cpu{
1061 pub const gfx904 = CpuModel{
10611062 .name = "gfx904",
10621063 .llvm_name = "gfx904",
10631064 .features = featureSet(&[_]Feature{
......@@ -1069,7 +1070,7 @@ pub const cpu = struct {
10691070 .no_xnack_support,
10701071 }),
10711072 };
1072 pub const gfx906 = Cpu{
1073 pub const gfx906 = CpuModel{
10731074 .name = "gfx906",
10741075 .llvm_name = "gfx906",
10751076 .features = featureSet(&[_]Feature{
......@@ -1084,7 +1085,7 @@ pub const cpu = struct {
10841085 .no_xnack_support,
10851086 }),
10861087 };
1087 pub const gfx908 = Cpu{
1088 pub const gfx908 = CpuModel{
10881089 .name = "gfx908",
10891090 .llvm_name = "gfx908",
10901091 .features = featureSet(&[_]Feature{
......@@ -1106,7 +1107,7 @@ pub const cpu = struct {
11061107 .sram_ecc,
11071108 }),
11081109 };
1109 pub const gfx909 = Cpu{
1110 pub const gfx909 = CpuModel{
11101111 .name = "gfx909",
11111112 .llvm_name = "gfx909",
11121113 .features = featureSet(&[_]Feature{
......@@ -1117,7 +1118,7 @@ pub const cpu = struct {
11171118 .xnack,
11181119 }),
11191120 };
1120 pub const hainan = Cpu{
1121 pub const hainan = CpuModel{
11211122 .name = "hainan",
11221123 .llvm_name = "hainan",
11231124 .features = featureSet(&[_]Feature{
......@@ -1127,7 +1128,7 @@ pub const cpu = struct {
11271128 .southern_islands,
11281129 }),
11291130 };
1130 pub const hawaii = Cpu{
1131 pub const hawaii = CpuModel{
11311132 .name = "hawaii",
11321133 .llvm_name = "hawaii",
11331134 .features = featureSet(&[_]Feature{
......@@ -1139,7 +1140,7 @@ pub const cpu = struct {
11391140 .sea_islands,
11401141 }),
11411142 };
1142 pub const iceland = Cpu{
1143 pub const iceland = CpuModel{
11431144 .name = "iceland",
11441145 .llvm_name = "iceland",
11451146 .features = featureSet(&[_]Feature{
......@@ -1151,7 +1152,7 @@ pub const cpu = struct {
11511152 .volcanic_islands,
11521153 }),
11531154 };
1154 pub const kabini = Cpu{
1155 pub const kabini = CpuModel{
11551156 .name = "kabini",
11561157 .llvm_name = "kabini",
11571158 .features = featureSet(&[_]Feature{
......@@ -1161,7 +1162,7 @@ pub const cpu = struct {
11611162 .sea_islands,
11621163 }),
11631164 };
1164 pub const kaveri = Cpu{
1165 pub const kaveri = CpuModel{
11651166 .name = "kaveri",
11661167 .llvm_name = "kaveri",
11671168 .features = featureSet(&[_]Feature{
......@@ -1171,7 +1172,7 @@ pub const cpu = struct {
11711172 .sea_islands,
11721173 }),
11731174 };
1174 pub const mullins = Cpu{
1175 pub const mullins = CpuModel{
11751176 .name = "mullins",
11761177 .llvm_name = "mullins",
11771178 .features = featureSet(&[_]Feature{
......@@ -1181,7 +1182,7 @@ pub const cpu = struct {
11811182 .sea_islands,
11821183 }),
11831184 };
1184 pub const oland = Cpu{
1185 pub const oland = CpuModel{
11851186 .name = "oland",
11861187 .llvm_name = "oland",
11871188 .features = featureSet(&[_]Feature{
......@@ -1191,7 +1192,7 @@ pub const cpu = struct {
11911192 .southern_islands,
11921193 }),
11931194 };
1194 pub const pitcairn = Cpu{
1195 pub const pitcairn = CpuModel{
11951196 .name = "pitcairn",
11961197 .llvm_name = "pitcairn",
11971198 .features = featureSet(&[_]Feature{
......@@ -1201,7 +1202,7 @@ pub const cpu = struct {
12011202 .southern_islands,
12021203 }),
12031204 };
1204 pub const polaris10 = Cpu{
1205 pub const polaris10 = CpuModel{
12051206 .name = "polaris10",
12061207 .llvm_name = "polaris10",
12071208 .features = featureSet(&[_]Feature{
......@@ -1212,7 +1213,7 @@ pub const cpu = struct {
12121213 .volcanic_islands,
12131214 }),
12141215 };
1215 pub const polaris11 = Cpu{
1216 pub const polaris11 = CpuModel{
12161217 .name = "polaris11",
12171218 .llvm_name = "polaris11",
12181219 .features = featureSet(&[_]Feature{
......@@ -1223,7 +1224,7 @@ pub const cpu = struct {
12231224 .volcanic_islands,
12241225 }),
12251226 };
1226 pub const stoney = Cpu{
1227 pub const stoney = CpuModel{
12271228 .name = "stoney",
12281229 .llvm_name = "stoney",
12291230 .features = featureSet(&[_]Feature{
......@@ -1233,7 +1234,7 @@ pub const cpu = struct {
12331234 .xnack,
12341235 }),
12351236 };
1236 pub const tahiti = Cpu{
1237 pub const tahiti = CpuModel{
12371238 .name = "tahiti",
12381239 .llvm_name = "tahiti",
12391240 .features = featureSet(&[_]Feature{
......@@ -1245,7 +1246,7 @@ pub const cpu = struct {
12451246 .southern_islands,
12461247 }),
12471248 };
1248 pub const tonga = Cpu{
1249 pub const tonga = CpuModel{
12491250 .name = "tonga",
12501251 .llvm_name = "tonga",
12511252 .features = featureSet(&[_]Feature{
......@@ -1257,7 +1258,7 @@ pub const cpu = struct {
12571258 .volcanic_islands,
12581259 }),
12591260 };
1260 pub const verde = Cpu{
1261 pub const verde = CpuModel{
12611262 .name = "verde",
12621263 .llvm_name = "verde",
12631264 .features = featureSet(&[_]Feature{
......@@ -1272,7 +1273,7 @@ pub const cpu = struct {
12721273/// All amdgpu CPUs, sorted alphabetically by name.
12731274/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
12741275/// compiler has inefficient memory and CPU usage, affecting build times.
1275pub const all_cpus = &[_]*const Cpu{
1276pub const all_cpus = &[_]*const CpuModel{
12761277 &cpu.bonaire,
12771278 &cpu.carrizo,
12781279 &cpu.fiji,
lib/std/target/arm.zig+85-87
......@@ -390,14 +390,14 @@ pub const all_features = blk: {
390390 .llvm_name = "iwmmxt",
391391 .description = "ARMv5te architecture",
392392 .dependencies = featureSet(&[_]Feature{
393 .armv5te,
393 .v5te,
394394 }),
395395 };
396396 result[@enumToInt(Feature.iwmmxt2)] = .{
397397 .llvm_name = "iwmmxt2",
398398 .description = "ARMv5te architecture",
399399 .dependencies = featureSet(&[_]Feature{
400 .armv5te,
400 .v5te,
401401 }),
402402 };
403403 result[@enumToInt(Feature.lob)] = .{
......@@ -1089,7 +1089,7 @@ pub const all_features = blk: {
10891089 .llvm_name = "xscale",
10901090 .description = "ARMv5te architecture",
10911091 .dependencies = featureSet(&[_]Feature{
1092 .armv5te,
1092 .v5te,
10931093 }),
10941094 };
10951095 result[@enumToInt(Feature.zcz)] = .{
......@@ -1110,49 +1110,49 @@ pub const cpu = struct {
11101110 .name = "arm1020e",
11111111 .llvm_name = "arm1020e",
11121112 .features = featureSet(&[_]Feature{
1113 .armv5te,
1113 .v5te,
11141114 }),
11151115 };
11161116 pub const arm1020t = CpuModel{
11171117 .name = "arm1020t",
11181118 .llvm_name = "arm1020t",
11191119 .features = featureSet(&[_]Feature{
1120 .armv5t,
1120 .v5t,
11211121 }),
11221122 };
11231123 pub const arm1022e = CpuModel{
11241124 .name = "arm1022e",
11251125 .llvm_name = "arm1022e",
11261126 .features = featureSet(&[_]Feature{
1127 .armv5te,
1127 .v5te,
11281128 }),
11291129 };
11301130 pub const arm10e = CpuModel{
11311131 .name = "arm10e",
11321132 .llvm_name = "arm10e",
11331133 .features = featureSet(&[_]Feature{
1134 .armv5te,
1134 .v5te,
11351135 }),
11361136 };
11371137 pub const arm10tdmi = CpuModel{
11381138 .name = "arm10tdmi",
11391139 .llvm_name = "arm10tdmi",
11401140 .features = featureSet(&[_]Feature{
1141 .armv5t,
1141 .v5t,
11421142 }),
11431143 };
11441144 pub const arm1136j_s = CpuModel{
11451145 .name = "arm1136j_s",
11461146 .llvm_name = "arm1136j-s",
11471147 .features = featureSet(&[_]Feature{
1148 .armv6,
1148 .v6,
11491149 }),
11501150 };
11511151 pub const arm1136jf_s = CpuModel{
11521152 .name = "arm1136jf_s",
11531153 .llvm_name = "arm1136jf-s",
11541154 .features = featureSet(&[_]Feature{
1155 .armv6,
1155 .v6,
11561156 .slowfpvmlx,
11571157 .vfp2,
11581158 }),
......@@ -1161,14 +1161,14 @@ pub const cpu = struct {
11611161 .name = "arm1156t2_s",
11621162 .llvm_name = "arm1156t2-s",
11631163 .features = featureSet(&[_]Feature{
1164 .armv6t2,
1164 .v6t2,
11651165 }),
11661166 };
11671167 pub const arm1156t2f_s = CpuModel{
11681168 .name = "arm1156t2f_s",
11691169 .llvm_name = "arm1156t2f-s",
11701170 .features = featureSet(&[_]Feature{
1171 .armv6t2,
1171 .v6t2,
11721172 .slowfpvmlx,
11731173 .vfp2,
11741174 }),
......@@ -1177,21 +1177,21 @@ pub const cpu = struct {
11771177 .name = "arm1176j_s",
11781178 .llvm_name = "arm1176j-s",
11791179 .features = featureSet(&[_]Feature{
1180 .armv6kz,
1180 .v6kz,
11811181 }),
11821182 };
11831183 pub const arm1176jz_s = CpuModel{
11841184 .name = "arm1176jz_s",
11851185 .llvm_name = "arm1176jz-s",
11861186 .features = featureSet(&[_]Feature{
1187 .armv6kz,
1187 .v6kz,
11881188 }),
11891189 };
11901190 pub const arm1176jzf_s = CpuModel{
11911191 .name = "arm1176jzf_s",
11921192 .llvm_name = "arm1176jzf-s",
11931193 .features = featureSet(&[_]Feature{
1194 .armv6kz,
1194 .v6kz,
11951195 .slowfpvmlx,
11961196 .vfp2,
11971197 }),
......@@ -1200,134 +1200,133 @@ pub const cpu = struct {
12001200 .name = "arm710t",
12011201 .llvm_name = "arm710t",
12021202 .features = featureSet(&[_]Feature{
1203 .armv4t,
1203 .v4t,
12041204 }),
12051205 };
12061206 pub const arm720t = CpuModel{
12071207 .name = "arm720t",
12081208 .llvm_name = "arm720t",
12091209 .features = featureSet(&[_]Feature{
1210 .armv4t,
1210 .v4t,
12111211 }),
12121212 };
12131213 pub const arm7tdmi = CpuModel{
12141214 .name = "arm7tdmi",
12151215 .llvm_name = "arm7tdmi",
12161216 .features = featureSet(&[_]Feature{
1217 .armv4t,
1217 .v4t,
12181218 }),
12191219 };
12201220 pub const arm7tdmi_s = CpuModel{
12211221 .name = "arm7tdmi_s",
12221222 .llvm_name = "arm7tdmi-s",
12231223 .features = featureSet(&[_]Feature{
1224 .armv4t,
1224 .v4t,
12251225 }),
12261226 };
12271227 pub const arm8 = CpuModel{
12281228 .name = "arm8",
12291229 .llvm_name = "arm8",
12301230 .features = featureSet(&[_]Feature{
1231 .armv4,
1231 .v4,
12321232 }),
12331233 };
12341234 pub const arm810 = CpuModel{
12351235 .name = "arm810",
12361236 .llvm_name = "arm810",
12371237 .features = featureSet(&[_]Feature{
1238 .armv4,
1238 .v4,
12391239 }),
12401240 };
12411241 pub const arm9 = CpuModel{
12421242 .name = "arm9",
12431243 .llvm_name = "arm9",
12441244 .features = featureSet(&[_]Feature{
1245 .armv4t,
1245 .v4t,
12461246 }),
12471247 };
12481248 pub const arm920 = CpuModel{
12491249 .name = "arm920",
12501250 .llvm_name = "arm920",
12511251 .features = featureSet(&[_]Feature{
1252 .armv4t,
1252 .v4t,
12531253 }),
12541254 };
12551255 pub const arm920t = CpuModel{
12561256 .name = "arm920t",
12571257 .llvm_name = "arm920t",
12581258 .features = featureSet(&[_]Feature{
1259 .armv4t,
1259 .v4t,
12601260 }),
12611261 };
12621262 pub const arm922t = CpuModel{
12631263 .name = "arm922t",
12641264 .llvm_name = "arm922t",
12651265 .features = featureSet(&[_]Feature{
1266 .armv4t,
1266 .v4t,
12671267 }),
12681268 };
12691269 pub const arm926ej_s = CpuModel{
12701270 .name = "arm926ej_s",
12711271 .llvm_name = "arm926ej-s",
12721272 .features = featureSet(&[_]Feature{
1273 .armv5te,
1273 .v5te,
12741274 }),
12751275 };
12761276 pub const arm940t = CpuModel{
12771277 .name = "arm940t",
12781278 .llvm_name = "arm940t",
12791279 .features = featureSet(&[_]Feature{
1280 .armv4t,
1280 .v4t,
12811281 }),
12821282 };
12831283 pub const arm946e_s = CpuModel{
12841284 .name = "arm946e_s",
12851285 .llvm_name = "arm946e-s",
12861286 .features = featureSet(&[_]Feature{
1287 .armv5te,
1287 .v5te,
12881288 }),
12891289 };
12901290 pub const arm966e_s = CpuModel{
12911291 .name = "arm966e_s",
12921292 .llvm_name = "arm966e-s",
12931293 .features = featureSet(&[_]Feature{
1294 .armv5te,
1294 .v5te,
12951295 }),
12961296 };
12971297 pub const arm968e_s = CpuModel{
12981298 .name = "arm968e_s",
12991299 .llvm_name = "arm968e-s",
13001300 .features = featureSet(&[_]Feature{
1301 .armv5te,
1301 .v5te,
13021302 }),
13031303 };
13041304 pub const arm9e = CpuModel{
13051305 .name = "arm9e",
13061306 .llvm_name = "arm9e",
13071307 .features = featureSet(&[_]Feature{
1308 .armv5te,
1308 .v5te,
13091309 }),
13101310 };
13111311 pub const arm9tdmi = CpuModel{
13121312 .name = "arm9tdmi",
13131313 .llvm_name = "arm9tdmi",
13141314 .features = featureSet(&[_]Feature{
1315 .armv4t,
1315 .v4t,
13161316 }),
13171317 };
13181318 pub const baseline = CpuModel{
13191319 .name = "baseline",
13201320 .llvm_name = "generic",
13211321 .features = featureSet(&[_]Feature{
1322 .armv6_m,
1322 .v6m,
13231323 }),
13241324 };
13251325 pub const cortex_a12 = CpuModel{
13261326 .name = "cortex_a12",
13271327 .llvm_name = "cortex-a12",
13281328 .features = featureSet(&[_]Feature{
1329 .a12,
1330 .armv7_a,
1329 .v7a,
13311330 .avoid_partial_cpsr,
13321331 .mp,
13331332 .ret_addr_stack,
......@@ -1341,7 +1340,7 @@ pub const cpu = struct {
13411340 .name = "cortex_a15",
13421341 .llvm_name = "cortex-a15",
13431342 .features = featureSet(&[_]Feature{
1344 .armv7_a,
1343 .v7a,
13451344 .avoid_partial_cpsr,
13461345 .dont_widen_vmovs,
13471346 .mp,
......@@ -1358,7 +1357,7 @@ pub const cpu = struct {
13581357 .name = "cortex_a17",
13591358 .llvm_name = "cortex-a17",
13601359 .features = featureSet(&[_]Feature{
1361 .armv7_a,
1360 .v7a,
13621361 .avoid_partial_cpsr,
13631362 .mp,
13641363 .ret_addr_stack,
......@@ -1372,7 +1371,7 @@ pub const cpu = struct {
13721371 .name = "cortex_a32",
13731372 .llvm_name = "cortex-a32",
13741373 .features = featureSet(&[_]Feature{
1375 .armv8_a,
1374 .v8a,
13761375 .crc,
13771376 .crypto,
13781377 .hwdiv,
......@@ -1383,7 +1382,7 @@ pub const cpu = struct {
13831382 .name = "cortex_a35",
13841383 .llvm_name = "cortex-a35",
13851384 .features = featureSet(&[_]Feature{
1386 .armv8_a,
1385 .v8a,
13871386 .crc,
13881387 .crypto,
13891388 .hwdiv,
......@@ -1394,7 +1393,7 @@ pub const cpu = struct {
13941393 .name = "cortex_a5",
13951394 .llvm_name = "cortex-a5",
13961395 .features = featureSet(&[_]Feature{
1397 .armv7_a,
1396 .v7a,
13981397 .mp,
13991398 .ret_addr_stack,
14001399 .slow_fp_brcc,
......@@ -1408,7 +1407,7 @@ pub const cpu = struct {
14081407 .name = "cortex_a53",
14091408 .llvm_name = "cortex-a53",
14101409 .features = featureSet(&[_]Feature{
1411 .armv8_a,
1410 .v8a,
14121411 .crc,
14131412 .crypto,
14141413 .fpao,
......@@ -1420,7 +1419,7 @@ pub const cpu = struct {
14201419 .name = "cortex_a55",
14211420 .llvm_name = "cortex-a55",
14221421 .features = featureSet(&[_]Feature{
1423 .armv8_2_a,
1422 .v8_2a,
14241423 .dotprod,
14251424 .hwdiv,
14261425 .hwdiv_arm,
......@@ -1430,7 +1429,7 @@ pub const cpu = struct {
14301429 .name = "cortex_a57",
14311430 .llvm_name = "cortex-a57",
14321431 .features = featureSet(&[_]Feature{
1433 .armv8_a,
1432 .v8a,
14341433 .avoid_partial_cpsr,
14351434 .cheap_predicable_cpsr,
14361435 .crc,
......@@ -1444,7 +1443,7 @@ pub const cpu = struct {
14441443 .name = "cortex_a7",
14451444 .llvm_name = "cortex-a7",
14461445 .features = featureSet(&[_]Feature{
1447 .armv7_a,
1446 .v7a,
14481447 .mp,
14491448 .ret_addr_stack,
14501449 .slow_fp_brcc,
......@@ -1460,7 +1459,7 @@ pub const cpu = struct {
14601459 .name = "cortex_a72",
14611460 .llvm_name = "cortex-a72",
14621461 .features = featureSet(&[_]Feature{
1463 .armv8_a,
1462 .v8a,
14641463 .crc,
14651464 .crypto,
14661465 .hwdiv,
......@@ -1471,7 +1470,7 @@ pub const cpu = struct {
14711470 .name = "cortex_a73",
14721471 .llvm_name = "cortex-a73",
14731472 .features = featureSet(&[_]Feature{
1474 .armv8_a,
1473 .v8a,
14751474 .crc,
14761475 .crypto,
14771476 .hwdiv,
......@@ -1482,7 +1481,7 @@ pub const cpu = struct {
14821481 .name = "cortex_a75",
14831482 .llvm_name = "cortex-a75",
14841483 .features = featureSet(&[_]Feature{
1485 .armv8_2_a,
1484 .v8_2a,
14861485 .dotprod,
14871486 .hwdiv,
14881487 .hwdiv_arm,
......@@ -1493,7 +1492,7 @@ pub const cpu = struct {
14931492 .llvm_name = "cortex-a76",
14941493 .features = featureSet(&[_]Feature{
14951494 .a76,
1496 .armv8_2_a,
1495 .v8_2a,
14971496 .crc,
14981497 .crypto,
14991498 .dotprod,
......@@ -1507,7 +1506,7 @@ pub const cpu = struct {
15071506 .llvm_name = "cortex-a76ae",
15081507 .features = featureSet(&[_]Feature{
15091508 .a76,
1510 .armv8_2_a,
1509 .v8_2a,
15111510 .crc,
15121511 .crypto,
15131512 .dotprod,
......@@ -1520,7 +1519,7 @@ pub const cpu = struct {
15201519 .name = "cortex_a8",
15211520 .llvm_name = "cortex-a8",
15221521 .features = featureSet(&[_]Feature{
1523 .armv7_a,
1522 .v7a,
15241523 .nonpipelined_vfp,
15251524 .ret_addr_stack,
15261525 .slow_fp_brcc,
......@@ -1534,7 +1533,7 @@ pub const cpu = struct {
15341533 .name = "cortex_a9",
15351534 .llvm_name = "cortex-a9",
15361535 .features = featureSet(&[_]Feature{
1537 .armv7_a,
1536 .v7a,
15381537 .avoid_partial_cpsr,
15391538 .expand_fp_mlx,
15401539 .fp16,
......@@ -1553,28 +1552,28 @@ pub const cpu = struct {
15531552 .name = "cortex_m0",
15541553 .llvm_name = "cortex-m0",
15551554 .features = featureSet(&[_]Feature{
1556 .armv6_m,
1555 .v6m,
15571556 }),
15581557 };
15591558 pub const cortex_m0plus = CpuModel{
15601559 .name = "cortex_m0plus",
15611560 .llvm_name = "cortex-m0plus",
15621561 .features = featureSet(&[_]Feature{
1563 .armv6_m,
1562 .v6m,
15641563 }),
15651564 };
15661565 pub const cortex_m1 = CpuModel{
15671566 .name = "cortex_m1",
15681567 .llvm_name = "cortex-m1",
15691568 .features = featureSet(&[_]Feature{
1570 .armv6_m,
1569 .v6m,
15711570 }),
15721571 };
15731572 pub const cortex_m23 = CpuModel{
15741573 .name = "cortex_m23",
15751574 .llvm_name = "cortex-m23",
15761575 .features = featureSet(&[_]Feature{
1577 .armv8_m_base,
1576 .v8m,
15781577 .no_movt,
15791578 }),
15801579 };
......@@ -1582,7 +1581,7 @@ pub const cpu = struct {
15821581 .name = "cortex_m3",
15831582 .llvm_name = "cortex-m3",
15841583 .features = featureSet(&[_]Feature{
1585 .armv7_m,
1584 .v7m,
15861585 .loop_align,
15871586 .m3,
15881587 .no_branch_predictor,
......@@ -1594,7 +1593,7 @@ pub const cpu = struct {
15941593 .name = "cortex_m33",
15951594 .llvm_name = "cortex-m33",
15961595 .features = featureSet(&[_]Feature{
1597 .armv8_m_main,
1596 .v8m_main,
15981597 .dsp,
15991598 .fp_armv8d16sp,
16001599 .loop_align,
......@@ -1608,7 +1607,7 @@ pub const cpu = struct {
16081607 .name = "cortex_m35p",
16091608 .llvm_name = "cortex-m35p",
16101609 .features = featureSet(&[_]Feature{
1611 .armv8_m_main,
1610 .v8m_main,
16121611 .dsp,
16131612 .fp_armv8d16sp,
16141613 .loop_align,
......@@ -1622,7 +1621,7 @@ pub const cpu = struct {
16221621 .name = "cortex_m4",
16231622 .llvm_name = "cortex-m4",
16241623 .features = featureSet(&[_]Feature{
1625 .armv7e_m,
1624 .v7em,
16261625 .loop_align,
16271626 .no_branch_predictor,
16281627 .slowfpvmlx,
......@@ -1635,7 +1634,7 @@ pub const cpu = struct {
16351634 .name = "cortex_m7",
16361635 .llvm_name = "cortex-m7",
16371636 .features = featureSet(&[_]Feature{
1638 .armv7e_m,
1637 .v7em,
16391638 .fp_armv8d16,
16401639 }),
16411640 };
......@@ -1643,7 +1642,7 @@ pub const cpu = struct {
16431642 .name = "cortex_r4",
16441643 .llvm_name = "cortex-r4",
16451644 .features = featureSet(&[_]Feature{
1646 .armv7_r,
1645 .v7r,
16471646 .avoid_partial_cpsr,
16481647 .r4,
16491648 .ret_addr_stack,
......@@ -1653,7 +1652,7 @@ pub const cpu = struct {
16531652 .name = "cortex_r4f",
16541653 .llvm_name = "cortex-r4f",
16551654 .features = featureSet(&[_]Feature{
1656 .armv7_r,
1655 .v7r,
16571656 .avoid_partial_cpsr,
16581657 .r4,
16591658 .ret_addr_stack,
......@@ -1666,7 +1665,7 @@ pub const cpu = struct {
16661665 .name = "cortex_r5",
16671666 .llvm_name = "cortex-r5",
16681667 .features = featureSet(&[_]Feature{
1669 .armv7_r,
1668 .v7r,
16701669 .avoid_partial_cpsr,
16711670 .hwdiv_arm,
16721671 .ret_addr_stack,
......@@ -1679,7 +1678,7 @@ pub const cpu = struct {
16791678 .name = "cortex_r52",
16801679 .llvm_name = "cortex-r52",
16811680 .features = featureSet(&[_]Feature{
1682 .armv8_r,
1681 .v8r,
16831682 .fpao,
16841683 .use_aa,
16851684 .use_misched,
......@@ -1689,7 +1688,7 @@ pub const cpu = struct {
16891688 .name = "cortex_r7",
16901689 .llvm_name = "cortex-r7",
16911690 .features = featureSet(&[_]Feature{
1692 .armv7_r,
1691 .v7r,
16931692 .avoid_partial_cpsr,
16941693 .fp16,
16951694 .hwdiv_arm,
......@@ -1704,7 +1703,7 @@ pub const cpu = struct {
17041703 .name = "cortex_r8",
17051704 .llvm_name = "cortex-r8",
17061705 .features = featureSet(&[_]Feature{
1707 .armv7_r,
1706 .v7r,
17081707 .avoid_partial_cpsr,
17091708 .fp16,
17101709 .hwdiv_arm,
......@@ -1719,7 +1718,7 @@ pub const cpu = struct {
17191718 .name = "cyclone",
17201719 .llvm_name = "cyclone",
17211720 .features = featureSet(&[_]Feature{
1722 .armv8_a,
1721 .v8a,
17231722 .avoid_movs_shop,
17241723 .avoid_partial_cpsr,
17251724 .crypto,
......@@ -1740,14 +1739,14 @@ pub const cpu = struct {
17401739 .name = "ep9312",
17411740 .llvm_name = "ep9312",
17421741 .features = featureSet(&[_]Feature{
1743 .armv4t,
1742 .v4t,
17441743 }),
17451744 };
17461745 pub const exynos_m1 = CpuModel{
17471746 .name = "exynos_m1",
17481747 .llvm_name = "exynos-m1",
17491748 .features = featureSet(&[_]Feature{
1750 .armv8_a,
1749 .v8a,
17511750 .exynos,
17521751 }),
17531752 };
......@@ -1755,7 +1754,7 @@ pub const cpu = struct {
17551754 .name = "exynos_m2",
17561755 .llvm_name = "exynos-m2",
17571756 .features = featureSet(&[_]Feature{
1758 .armv8_a,
1757 .v8a,
17591758 .exynos,
17601759 }),
17611760 };
......@@ -1763,7 +1762,7 @@ pub const cpu = struct {
17631762 .name = "exynos_m3",
17641763 .llvm_name = "exynos-m3",
17651764 .features = featureSet(&[_]Feature{
1766 .armv8_a,
1765 .v8a,
17671766 .exynos,
17681767 }),
17691768 };
......@@ -1771,7 +1770,7 @@ pub const cpu = struct {
17711770 .name = "exynos_m4",
17721771 .llvm_name = "exynos-m4",
17731772 .features = featureSet(&[_]Feature{
1774 .armv8_2_a,
1773 .v8_2a,
17751774 .dotprod,
17761775 .exynos,
17771776 .fullfp16,
......@@ -1781,10 +1780,10 @@ pub const cpu = struct {
17811780 .name = "exynos_m5",
17821781 .llvm_name = "exynos-m5",
17831782 .features = featureSet(&[_]Feature{
1784 .armv8_2_a,
17851783 .dotprod,
17861784 .exynos,
17871785 .fullfp16,
1786 .v8_2a,
17881787 }),
17891788 };
17901789 pub const generic = CpuModel{
......@@ -1796,20 +1795,20 @@ pub const cpu = struct {
17961795 .name = "iwmmxt",
17971796 .llvm_name = "iwmmxt",
17981797 .features = featureSet(&[_]Feature{
1799 .armv5te,
1798 .v5te,
18001799 }),
18011800 };
18021801 pub const krait = CpuModel{
18031802 .name = "krait",
18041803 .llvm_name = "krait",
18051804 .features = featureSet(&[_]Feature{
1806 .armv7_a,
18071805 .avoid_partial_cpsr,
18081806 .fp16,
18091807 .hwdiv,
18101808 .hwdiv_arm,
18111809 .muxed_units,
18121810 .ret_addr_stack,
1811 .v7a,
18131812 .vfp4,
18141813 .vldn_align,
18151814 .vmlx_forwarding,
......@@ -1819,19 +1818,18 @@ pub const cpu = struct {
18191818 .name = "kryo",
18201819 .llvm_name = "kryo",
18211820 .features = featureSet(&[_]Feature{
1822 .armv8_a,
18231821 .crc,
18241822 .crypto,
18251823 .hwdiv,
18261824 .hwdiv_arm,
1827 .kryo,
1825 .v8a,
18281826 }),
18291827 };
18301828 pub const mpcore = CpuModel{
18311829 .name = "mpcore",
18321830 .llvm_name = "mpcore",
18331831 .features = featureSet(&[_]Feature{
1834 .armv6k,
1832 .v6k,
18351833 .slowfpvmlx,
18361834 .vfp2,
18371835 }),
......@@ -1840,21 +1838,21 @@ pub const cpu = struct {
18401838 .name = "mpcorenovfp",
18411839 .llvm_name = "mpcorenovfp",
18421840 .features = featureSet(&[_]Feature{
1843 .armv6k,
1841 .v6k,
18441842 }),
18451843 };
18461844 pub const sc000 = CpuModel{
18471845 .name = "sc000",
18481846 .llvm_name = "sc000",
18491847 .features = featureSet(&[_]Feature{
1850 .armv6_m,
1848 .v6m,
18511849 }),
18521850 };
18531851 pub const sc300 = CpuModel{
18541852 .name = "sc300",
18551853 .llvm_name = "sc300",
18561854 .features = featureSet(&[_]Feature{
1857 .armv7_m,
1855 .v7m,
18581856 .m3,
18591857 .no_branch_predictor,
18601858 .use_aa,
......@@ -1865,35 +1863,35 @@ pub const cpu = struct {
18651863 .name = "strongarm",
18661864 .llvm_name = "strongarm",
18671865 .features = featureSet(&[_]Feature{
1868 .armv4,
1866 .v4,
18691867 }),
18701868 };
18711869 pub const strongarm110 = CpuModel{
18721870 .name = "strongarm110",
18731871 .llvm_name = "strongarm110",
18741872 .features = featureSet(&[_]Feature{
1875 .armv4,
1873 .v4,
18761874 }),
18771875 };
18781876 pub const strongarm1100 = CpuModel{
18791877 .name = "strongarm1100",
18801878 .llvm_name = "strongarm1100",
18811879 .features = featureSet(&[_]Feature{
1882 .armv4,
1880 .v4,
18831881 }),
18841882 };
18851883 pub const strongarm1110 = CpuModel{
18861884 .name = "strongarm1110",
18871885 .llvm_name = "strongarm1110",
18881886 .features = featureSet(&[_]Feature{
1889 .armv4,
1887 .v4,
18901888 }),
18911889 };
18921890 pub const swift = CpuModel{
18931891 .name = "swift",
18941892 .llvm_name = "swift",
18951893 .features = featureSet(&[_]Feature{
1896 .armv7_a,
1894 .v7a,
18971895 .avoid_movs_shop,
18981896 .avoid_partial_cpsr,
18991897 .disable_postra_scheduler,
......@@ -1920,7 +1918,7 @@ pub const cpu = struct {
19201918 .name = "xscale",
19211919 .llvm_name = "xscale",
19221920 .features = featureSet(&[_]Feature{
1923 .armv5te,
1921 .v5te,
19241922 }),
19251923 };
19261924};
lib/std/target/avr.zig+263-262
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 addsubiw,
......@@ -37,12 +38,12 @@ pub const Feature = enum {
3738 xmegau,
3839};
3940
40pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
41pub usingnamespace CpuFeature.feature_set_fns(Feature);
4142
4243pub const all_features = blk: {
4344 const len = @typeInfo(Feature).Enum.fields.len;
44 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
45 var result: [len]Cpu.Feature = undefined;
45 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
46 var result: [len]CpuFeature = undefined;
4647 result[@enumToInt(Feature.addsubiw)] = .{
4748 .llvm_name = "addsubiw",
4849 .description = "Enable 16-bit register-immediate addition and subtraction instructions",
......@@ -293,28 +294,28 @@ pub const all_features = blk: {
293294};
294295
295296pub const cpu = struct {
296 pub const at43usb320 = Cpu{
297 pub const at43usb320 = CpuModel{
297298 .name = "at43usb320",
298299 .llvm_name = "at43usb320",
299300 .features = featureSet(&[_]Feature{
300301 .avr31,
301302 }),
302303 };
303 pub const at43usb355 = Cpu{
304 pub const at43usb355 = CpuModel{
304305 .name = "at43usb355",
305306 .llvm_name = "at43usb355",
306307 .features = featureSet(&[_]Feature{
307308 .avr3,
308309 }),
309310 };
310 pub const at76c711 = Cpu{
311 pub const at76c711 = CpuModel{
311312 .name = "at76c711",
312313 .llvm_name = "at76c711",
313314 .features = featureSet(&[_]Feature{
314315 .avr3,
315316 }),
316317 };
317 pub const at86rf401 = Cpu{
318 pub const at86rf401 = CpuModel{
318319 .name = "at86rf401",
319320 .llvm_name = "at86rf401",
320321 .features = featureSet(&[_]Feature{
......@@ -323,217 +324,217 @@ pub const cpu = struct {
323324 .movw,
324325 }),
325326 };
326 pub const at90c8534 = Cpu{
327 pub const at90c8534 = CpuModel{
327328 .name = "at90c8534",
328329 .llvm_name = "at90c8534",
329330 .features = featureSet(&[_]Feature{
330331 .avr2,
331332 }),
332333 };
333 pub const at90can128 = Cpu{
334 pub const at90can128 = CpuModel{
334335 .name = "at90can128",
335336 .llvm_name = "at90can128",
336337 .features = featureSet(&[_]Feature{
337338 .avr51,
338339 }),
339340 };
340 pub const at90can32 = Cpu{
341 pub const at90can32 = CpuModel{
341342 .name = "at90can32",
342343 .llvm_name = "at90can32",
343344 .features = featureSet(&[_]Feature{
344345 .avr5,
345346 }),
346347 };
347 pub const at90can64 = Cpu{
348 pub const at90can64 = CpuModel{
348349 .name = "at90can64",
349350 .llvm_name = "at90can64",
350351 .features = featureSet(&[_]Feature{
351352 .avr5,
352353 }),
353354 };
354 pub const at90pwm1 = Cpu{
355 pub const at90pwm1 = CpuModel{
355356 .name = "at90pwm1",
356357 .llvm_name = "at90pwm1",
357358 .features = featureSet(&[_]Feature{
358359 .avr4,
359360 }),
360361 };
361 pub const at90pwm161 = Cpu{
362 pub const at90pwm161 = CpuModel{
362363 .name = "at90pwm161",
363364 .llvm_name = "at90pwm161",
364365 .features = featureSet(&[_]Feature{
365366 .avr5,
366367 }),
367368 };
368 pub const at90pwm2 = Cpu{
369 pub const at90pwm2 = CpuModel{
369370 .name = "at90pwm2",
370371 .llvm_name = "at90pwm2",
371372 .features = featureSet(&[_]Feature{
372373 .avr4,
373374 }),
374375 };
375 pub const at90pwm216 = Cpu{
376 pub const at90pwm216 = CpuModel{
376377 .name = "at90pwm216",
377378 .llvm_name = "at90pwm216",
378379 .features = featureSet(&[_]Feature{
379380 .avr5,
380381 }),
381382 };
382 pub const at90pwm2b = Cpu{
383 pub const at90pwm2b = CpuModel{
383384 .name = "at90pwm2b",
384385 .llvm_name = "at90pwm2b",
385386 .features = featureSet(&[_]Feature{
386387 .avr4,
387388 }),
388389 };
389 pub const at90pwm3 = Cpu{
390 pub const at90pwm3 = CpuModel{
390391 .name = "at90pwm3",
391392 .llvm_name = "at90pwm3",
392393 .features = featureSet(&[_]Feature{
393394 .avr4,
394395 }),
395396 };
396 pub const at90pwm316 = Cpu{
397 pub const at90pwm316 = CpuModel{
397398 .name = "at90pwm316",
398399 .llvm_name = "at90pwm316",
399400 .features = featureSet(&[_]Feature{
400401 .avr5,
401402 }),
402403 };
403 pub const at90pwm3b = Cpu{
404 pub const at90pwm3b = CpuModel{
404405 .name = "at90pwm3b",
405406 .llvm_name = "at90pwm3b",
406407 .features = featureSet(&[_]Feature{
407408 .avr4,
408409 }),
409410 };
410 pub const at90pwm81 = Cpu{
411 pub const at90pwm81 = CpuModel{
411412 .name = "at90pwm81",
412413 .llvm_name = "at90pwm81",
413414 .features = featureSet(&[_]Feature{
414415 .avr4,
415416 }),
416417 };
417 pub const at90s1200 = Cpu{
418 pub const at90s1200 = CpuModel{
418419 .name = "at90s1200",
419420 .llvm_name = "at90s1200",
420421 .features = featureSet(&[_]Feature{
421422 .avr0,
422423 }),
423424 };
424 pub const at90s2313 = Cpu{
425 pub const at90s2313 = CpuModel{
425426 .name = "at90s2313",
426427 .llvm_name = "at90s2313",
427428 .features = featureSet(&[_]Feature{
428429 .avr2,
429430 }),
430431 };
431 pub const at90s2323 = Cpu{
432 pub const at90s2323 = CpuModel{
432433 .name = "at90s2323",
433434 .llvm_name = "at90s2323",
434435 .features = featureSet(&[_]Feature{
435436 .avr2,
436437 }),
437438 };
438 pub const at90s2333 = Cpu{
439 pub const at90s2333 = CpuModel{
439440 .name = "at90s2333",
440441 .llvm_name = "at90s2333",
441442 .features = featureSet(&[_]Feature{
442443 .avr2,
443444 }),
444445 };
445 pub const at90s2343 = Cpu{
446 pub const at90s2343 = CpuModel{
446447 .name = "at90s2343",
447448 .llvm_name = "at90s2343",
448449 .features = featureSet(&[_]Feature{
449450 .avr2,
450451 }),
451452 };
452 pub const at90s4414 = Cpu{
453 pub const at90s4414 = CpuModel{
453454 .name = "at90s4414",
454455 .llvm_name = "at90s4414",
455456 .features = featureSet(&[_]Feature{
456457 .avr2,
457458 }),
458459 };
459 pub const at90s4433 = Cpu{
460 pub const at90s4433 = CpuModel{
460461 .name = "at90s4433",
461462 .llvm_name = "at90s4433",
462463 .features = featureSet(&[_]Feature{
463464 .avr2,
464465 }),
465466 };
466 pub const at90s4434 = Cpu{
467 pub const at90s4434 = CpuModel{
467468 .name = "at90s4434",
468469 .llvm_name = "at90s4434",
469470 .features = featureSet(&[_]Feature{
470471 .avr2,
471472 }),
472473 };
473 pub const at90s8515 = Cpu{
474 pub const at90s8515 = CpuModel{
474475 .name = "at90s8515",
475476 .llvm_name = "at90s8515",
476477 .features = featureSet(&[_]Feature{
477478 .avr2,
478479 }),
479480 };
480 pub const at90s8535 = Cpu{
481 pub const at90s8535 = CpuModel{
481482 .name = "at90s8535",
482483 .llvm_name = "at90s8535",
483484 .features = featureSet(&[_]Feature{
484485 .avr2,
485486 }),
486487 };
487 pub const at90scr100 = Cpu{
488 pub const at90scr100 = CpuModel{
488489 .name = "at90scr100",
489490 .llvm_name = "at90scr100",
490491 .features = featureSet(&[_]Feature{
491492 .avr5,
492493 }),
493494 };
494 pub const at90usb1286 = Cpu{
495 pub const at90usb1286 = CpuModel{
495496 .name = "at90usb1286",
496497 .llvm_name = "at90usb1286",
497498 .features = featureSet(&[_]Feature{
498499 .avr51,
499500 }),
500501 };
501 pub const at90usb1287 = Cpu{
502 pub const at90usb1287 = CpuModel{
502503 .name = "at90usb1287",
503504 .llvm_name = "at90usb1287",
504505 .features = featureSet(&[_]Feature{
505506 .avr51,
506507 }),
507508 };
508 pub const at90usb162 = Cpu{
509 pub const at90usb162 = CpuModel{
509510 .name = "at90usb162",
510511 .llvm_name = "at90usb162",
511512 .features = featureSet(&[_]Feature{
512513 .avr35,
513514 }),
514515 };
515 pub const at90usb646 = Cpu{
516 pub const at90usb646 = CpuModel{
516517 .name = "at90usb646",
517518 .llvm_name = "at90usb646",
518519 .features = featureSet(&[_]Feature{
519520 .avr5,
520521 }),
521522 };
522 pub const at90usb647 = Cpu{
523 pub const at90usb647 = CpuModel{
523524 .name = "at90usb647",
524525 .llvm_name = "at90usb647",
525526 .features = featureSet(&[_]Feature{
526527 .avr5,
527528 }),
528529 };
529 pub const at90usb82 = Cpu{
530 pub const at90usb82 = CpuModel{
530531 .name = "at90usb82",
531532 .llvm_name = "at90usb82",
532533 .features = featureSet(&[_]Feature{
533534 .avr35,
534535 }),
535536 };
536 pub const at94k = Cpu{
537 pub const at94k = CpuModel{
537538 .name = "at94k",
538539 .llvm_name = "at94k",
539540 .features = featureSet(&[_]Feature{
......@@ -543,133 +544,133 @@ pub const cpu = struct {
543544 .mul,
544545 }),
545546 };
546 pub const ata5272 = Cpu{
547 pub const ata5272 = CpuModel{
547548 .name = "ata5272",
548549 .llvm_name = "ata5272",
549550 .features = featureSet(&[_]Feature{
550551 .avr25,
551552 }),
552553 };
553 pub const ata5505 = Cpu{
554 pub const ata5505 = CpuModel{
554555 .name = "ata5505",
555556 .llvm_name = "ata5505",
556557 .features = featureSet(&[_]Feature{
557558 .avr35,
558559 }),
559560 };
560 pub const ata5790 = Cpu{
561 pub const ata5790 = CpuModel{
561562 .name = "ata5790",
562563 .llvm_name = "ata5790",
563564 .features = featureSet(&[_]Feature{
564565 .avr5,
565566 }),
566567 };
567 pub const ata5795 = Cpu{
568 pub const ata5795 = CpuModel{
568569 .name = "ata5795",
569570 .llvm_name = "ata5795",
570571 .features = featureSet(&[_]Feature{
571572 .avr5,
572573 }),
573574 };
574 pub const ata6285 = Cpu{
575 pub const ata6285 = CpuModel{
575576 .name = "ata6285",
576577 .llvm_name = "ata6285",
577578 .features = featureSet(&[_]Feature{
578579 .avr4,
579580 }),
580581 };
581 pub const ata6286 = Cpu{
582 pub const ata6286 = CpuModel{
582583 .name = "ata6286",
583584 .llvm_name = "ata6286",
584585 .features = featureSet(&[_]Feature{
585586 .avr4,
586587 }),
587588 };
588 pub const ata6289 = Cpu{
589 pub const ata6289 = CpuModel{
589590 .name = "ata6289",
590591 .llvm_name = "ata6289",
591592 .features = featureSet(&[_]Feature{
592593 .avr4,
593594 }),
594595 };
595 pub const atmega103 = Cpu{
596 pub const atmega103 = CpuModel{
596597 .name = "atmega103",
597598 .llvm_name = "atmega103",
598599 .features = featureSet(&[_]Feature{
599600 .avr31,
600601 }),
601602 };
602 pub const atmega128 = Cpu{
603 pub const atmega128 = CpuModel{
603604 .name = "atmega128",
604605 .llvm_name = "atmega128",
605606 .features = featureSet(&[_]Feature{
606607 .avr51,
607608 }),
608609 };
609 pub const atmega1280 = Cpu{
610 pub const atmega1280 = CpuModel{
610611 .name = "atmega1280",
611612 .llvm_name = "atmega1280",
612613 .features = featureSet(&[_]Feature{
613614 .avr51,
614615 }),
615616 };
616 pub const atmega1281 = Cpu{
617 pub const atmega1281 = CpuModel{
617618 .name = "atmega1281",
618619 .llvm_name = "atmega1281",
619620 .features = featureSet(&[_]Feature{
620621 .avr51,
621622 }),
622623 };
623 pub const atmega1284 = Cpu{
624 pub const atmega1284 = CpuModel{
624625 .name = "atmega1284",
625626 .llvm_name = "atmega1284",
626627 .features = featureSet(&[_]Feature{
627628 .avr51,
628629 }),
629630 };
630 pub const atmega1284p = Cpu{
631 pub const atmega1284p = CpuModel{
631632 .name = "atmega1284p",
632633 .llvm_name = "atmega1284p",
633634 .features = featureSet(&[_]Feature{
634635 .avr51,
635636 }),
636637 };
637 pub const atmega1284rfr2 = Cpu{
638 pub const atmega1284rfr2 = CpuModel{
638639 .name = "atmega1284rfr2",
639640 .llvm_name = "atmega1284rfr2",
640641 .features = featureSet(&[_]Feature{
641642 .avr51,
642643 }),
643644 };
644 pub const atmega128a = Cpu{
645 pub const atmega128a = CpuModel{
645646 .name = "atmega128a",
646647 .llvm_name = "atmega128a",
647648 .features = featureSet(&[_]Feature{
648649 .avr51,
649650 }),
650651 };
651 pub const atmega128rfa1 = Cpu{
652 pub const atmega128rfa1 = CpuModel{
652653 .name = "atmega128rfa1",
653654 .llvm_name = "atmega128rfa1",
654655 .features = featureSet(&[_]Feature{
655656 .avr51,
656657 }),
657658 };
658 pub const atmega128rfr2 = Cpu{
659 pub const atmega128rfr2 = CpuModel{
659660 .name = "atmega128rfr2",
660661 .llvm_name = "atmega128rfr2",
661662 .features = featureSet(&[_]Feature{
662663 .avr51,
663664 }),
664665 };
665 pub const atmega16 = Cpu{
666 pub const atmega16 = CpuModel{
666667 .name = "atmega16",
667668 .llvm_name = "atmega16",
668669 .features = featureSet(&[_]Feature{
669670 .avr5,
670671 }),
671672 };
672 pub const atmega161 = Cpu{
673 pub const atmega161 = CpuModel{
673674 .name = "atmega161",
674675 .llvm_name = "atmega161",
675676 .features = featureSet(&[_]Feature{
......@@ -680,14 +681,14 @@ pub const cpu = struct {
680681 .spm,
681682 }),
682683 };
683 pub const atmega162 = Cpu{
684 pub const atmega162 = CpuModel{
684685 .name = "atmega162",
685686 .llvm_name = "atmega162",
686687 .features = featureSet(&[_]Feature{
687688 .avr5,
688689 }),
689690 };
690 pub const atmega163 = Cpu{
691 pub const atmega163 = CpuModel{
691692 .name = "atmega163",
692693 .llvm_name = "atmega163",
693694 .features = featureSet(&[_]Feature{
......@@ -698,623 +699,623 @@ pub const cpu = struct {
698699 .spm,
699700 }),
700701 };
701 pub const atmega164a = Cpu{
702 pub const atmega164a = CpuModel{
702703 .name = "atmega164a",
703704 .llvm_name = "atmega164a",
704705 .features = featureSet(&[_]Feature{
705706 .avr5,
706707 }),
707708 };
708 pub const atmega164p = Cpu{
709 pub const atmega164p = CpuModel{
709710 .name = "atmega164p",
710711 .llvm_name = "atmega164p",
711712 .features = featureSet(&[_]Feature{
712713 .avr5,
713714 }),
714715 };
715 pub const atmega164pa = Cpu{
716 pub const atmega164pa = CpuModel{
716717 .name = "atmega164pa",
717718 .llvm_name = "atmega164pa",
718719 .features = featureSet(&[_]Feature{
719720 .avr5,
720721 }),
721722 };
722 pub const atmega165 = Cpu{
723 pub const atmega165 = CpuModel{
723724 .name = "atmega165",
724725 .llvm_name = "atmega165",
725726 .features = featureSet(&[_]Feature{
726727 .avr5,
727728 }),
728729 };
729 pub const atmega165a = Cpu{
730 pub const atmega165a = CpuModel{
730731 .name = "atmega165a",
731732 .llvm_name = "atmega165a",
732733 .features = featureSet(&[_]Feature{
733734 .avr5,
734735 }),
735736 };
736 pub const atmega165p = Cpu{
737 pub const atmega165p = CpuModel{
737738 .name = "atmega165p",
738739 .llvm_name = "atmega165p",
739740 .features = featureSet(&[_]Feature{
740741 .avr5,
741742 }),
742743 };
743 pub const atmega165pa = Cpu{
744 pub const atmega165pa = CpuModel{
744745 .name = "atmega165pa",
745746 .llvm_name = "atmega165pa",
746747 .features = featureSet(&[_]Feature{
747748 .avr5,
748749 }),
749750 };
750 pub const atmega168 = Cpu{
751 pub const atmega168 = CpuModel{
751752 .name = "atmega168",
752753 .llvm_name = "atmega168",
753754 .features = featureSet(&[_]Feature{
754755 .avr5,
755756 }),
756757 };
757 pub const atmega168a = Cpu{
758 pub const atmega168a = CpuModel{
758759 .name = "atmega168a",
759760 .llvm_name = "atmega168a",
760761 .features = featureSet(&[_]Feature{
761762 .avr5,
762763 }),
763764 };
764 pub const atmega168p = Cpu{
765 pub const atmega168p = CpuModel{
765766 .name = "atmega168p",
766767 .llvm_name = "atmega168p",
767768 .features = featureSet(&[_]Feature{
768769 .avr5,
769770 }),
770771 };
771 pub const atmega168pa = Cpu{
772 pub const atmega168pa = CpuModel{
772773 .name = "atmega168pa",
773774 .llvm_name = "atmega168pa",
774775 .features = featureSet(&[_]Feature{
775776 .avr5,
776777 }),
777778 };
778 pub const atmega169 = Cpu{
779 pub const atmega169 = CpuModel{
779780 .name = "atmega169",
780781 .llvm_name = "atmega169",
781782 .features = featureSet(&[_]Feature{
782783 .avr5,
783784 }),
784785 };
785 pub const atmega169a = Cpu{
786 pub const atmega169a = CpuModel{
786787 .name = "atmega169a",
787788 .llvm_name = "atmega169a",
788789 .features = featureSet(&[_]Feature{
789790 .avr5,
790791 }),
791792 };
792 pub const atmega169p = Cpu{
793 pub const atmega169p = CpuModel{
793794 .name = "atmega169p",
794795 .llvm_name = "atmega169p",
795796 .features = featureSet(&[_]Feature{
796797 .avr5,
797798 }),
798799 };
799 pub const atmega169pa = Cpu{
800 pub const atmega169pa = CpuModel{
800801 .name = "atmega169pa",
801802 .llvm_name = "atmega169pa",
802803 .features = featureSet(&[_]Feature{
803804 .avr5,
804805 }),
805806 };
806 pub const atmega16a = Cpu{
807 pub const atmega16a = CpuModel{
807808 .name = "atmega16a",
808809 .llvm_name = "atmega16a",
809810 .features = featureSet(&[_]Feature{
810811 .avr5,
811812 }),
812813 };
813 pub const atmega16hva = Cpu{
814 pub const atmega16hva = CpuModel{
814815 .name = "atmega16hva",
815816 .llvm_name = "atmega16hva",
816817 .features = featureSet(&[_]Feature{
817818 .avr5,
818819 }),
819820 };
820 pub const atmega16hva2 = Cpu{
821 pub const atmega16hva2 = CpuModel{
821822 .name = "atmega16hva2",
822823 .llvm_name = "atmega16hva2",
823824 .features = featureSet(&[_]Feature{
824825 .avr5,
825826 }),
826827 };
827 pub const atmega16hvb = Cpu{
828 pub const atmega16hvb = CpuModel{
828829 .name = "atmega16hvb",
829830 .llvm_name = "atmega16hvb",
830831 .features = featureSet(&[_]Feature{
831832 .avr5,
832833 }),
833834 };
834 pub const atmega16hvbrevb = Cpu{
835 pub const atmega16hvbrevb = CpuModel{
835836 .name = "atmega16hvbrevb",
836837 .llvm_name = "atmega16hvbrevb",
837838 .features = featureSet(&[_]Feature{
838839 .avr5,
839840 }),
840841 };
841 pub const atmega16m1 = Cpu{
842 pub const atmega16m1 = CpuModel{
842843 .name = "atmega16m1",
843844 .llvm_name = "atmega16m1",
844845 .features = featureSet(&[_]Feature{
845846 .avr5,
846847 }),
847848 };
848 pub const atmega16u2 = Cpu{
849 pub const atmega16u2 = CpuModel{
849850 .name = "atmega16u2",
850851 .llvm_name = "atmega16u2",
851852 .features = featureSet(&[_]Feature{
852853 .avr35,
853854 }),
854855 };
855 pub const atmega16u4 = Cpu{
856 pub const atmega16u4 = CpuModel{
856857 .name = "atmega16u4",
857858 .llvm_name = "atmega16u4",
858859 .features = featureSet(&[_]Feature{
859860 .avr5,
860861 }),
861862 };
862 pub const atmega2560 = Cpu{
863 pub const atmega2560 = CpuModel{
863864 .name = "atmega2560",
864865 .llvm_name = "atmega2560",
865866 .features = featureSet(&[_]Feature{
866867 .avr6,
867868 }),
868869 };
869 pub const atmega2561 = Cpu{
870 pub const atmega2561 = CpuModel{
870871 .name = "atmega2561",
871872 .llvm_name = "atmega2561",
872873 .features = featureSet(&[_]Feature{
873874 .avr6,
874875 }),
875876 };
876 pub const atmega2564rfr2 = Cpu{
877 pub const atmega2564rfr2 = CpuModel{
877878 .name = "atmega2564rfr2",
878879 .llvm_name = "atmega2564rfr2",
879880 .features = featureSet(&[_]Feature{
880881 .avr6,
881882 }),
882883 };
883 pub const atmega256rfr2 = Cpu{
884 pub const atmega256rfr2 = CpuModel{
884885 .name = "atmega256rfr2",
885886 .llvm_name = "atmega256rfr2",
886887 .features = featureSet(&[_]Feature{
887888 .avr6,
888889 }),
889890 };
890 pub const atmega32 = Cpu{
891 pub const atmega32 = CpuModel{
891892 .name = "atmega32",
892893 .llvm_name = "atmega32",
893894 .features = featureSet(&[_]Feature{
894895 .avr5,
895896 }),
896897 };
897 pub const atmega323 = Cpu{
898 pub const atmega323 = CpuModel{
898899 .name = "atmega323",
899900 .llvm_name = "atmega323",
900901 .features = featureSet(&[_]Feature{
901902 .avr5,
902903 }),
903904 };
904 pub const atmega324a = Cpu{
905 pub const atmega324a = CpuModel{
905906 .name = "atmega324a",
906907 .llvm_name = "atmega324a",
907908 .features = featureSet(&[_]Feature{
908909 .avr5,
909910 }),
910911 };
911 pub const atmega324p = Cpu{
912 pub const atmega324p = CpuModel{
912913 .name = "atmega324p",
913914 .llvm_name = "atmega324p",
914915 .features = featureSet(&[_]Feature{
915916 .avr5,
916917 }),
917918 };
918 pub const atmega324pa = Cpu{
919 pub const atmega324pa = CpuModel{
919920 .name = "atmega324pa",
920921 .llvm_name = "atmega324pa",
921922 .features = featureSet(&[_]Feature{
922923 .avr5,
923924 }),
924925 };
925 pub const atmega325 = Cpu{
926 pub const atmega325 = CpuModel{
926927 .name = "atmega325",
927928 .llvm_name = "atmega325",
928929 .features = featureSet(&[_]Feature{
929930 .avr5,
930931 }),
931932 };
932 pub const atmega3250 = Cpu{
933 pub const atmega3250 = CpuModel{
933934 .name = "atmega3250",
934935 .llvm_name = "atmega3250",
935936 .features = featureSet(&[_]Feature{
936937 .avr5,
937938 }),
938939 };
939 pub const atmega3250a = Cpu{
940 pub const atmega3250a = CpuModel{
940941 .name = "atmega3250a",
941942 .llvm_name = "atmega3250a",
942943 .features = featureSet(&[_]Feature{
943944 .avr5,
944945 }),
945946 };
946 pub const atmega3250p = Cpu{
947 pub const atmega3250p = CpuModel{
947948 .name = "atmega3250p",
948949 .llvm_name = "atmega3250p",
949950 .features = featureSet(&[_]Feature{
950951 .avr5,
951952 }),
952953 };
953 pub const atmega3250pa = Cpu{
954 pub const atmega3250pa = CpuModel{
954955 .name = "atmega3250pa",
955956 .llvm_name = "atmega3250pa",
956957 .features = featureSet(&[_]Feature{
957958 .avr5,
958959 }),
959960 };
960 pub const atmega325a = Cpu{
961 pub const atmega325a = CpuModel{
961962 .name = "atmega325a",
962963 .llvm_name = "atmega325a",
963964 .features = featureSet(&[_]Feature{
964965 .avr5,
965966 }),
966967 };
967 pub const atmega325p = Cpu{
968 pub const atmega325p = CpuModel{
968969 .name = "atmega325p",
969970 .llvm_name = "atmega325p",
970971 .features = featureSet(&[_]Feature{
971972 .avr5,
972973 }),
973974 };
974 pub const atmega325pa = Cpu{
975 pub const atmega325pa = CpuModel{
975976 .name = "atmega325pa",
976977 .llvm_name = "atmega325pa",
977978 .features = featureSet(&[_]Feature{
978979 .avr5,
979980 }),
980981 };
981 pub const atmega328 = Cpu{
982 pub const atmega328 = CpuModel{
982983 .name = "atmega328",
983984 .llvm_name = "atmega328",
984985 .features = featureSet(&[_]Feature{
985986 .avr5,
986987 }),
987988 };
988 pub const atmega328p = Cpu{
989 pub const atmega328p = CpuModel{
989990 .name = "atmega328p",
990991 .llvm_name = "atmega328p",
991992 .features = featureSet(&[_]Feature{
992993 .avr5,
993994 }),
994995 };
995 pub const atmega329 = Cpu{
996 pub const atmega329 = CpuModel{
996997 .name = "atmega329",
997998 .llvm_name = "atmega329",
998999 .features = featureSet(&[_]Feature{
9991000 .avr5,
10001001 }),
10011002 };
1002 pub const atmega3290 = Cpu{
1003 pub const atmega3290 = CpuModel{
10031004 .name = "atmega3290",
10041005 .llvm_name = "atmega3290",
10051006 .features = featureSet(&[_]Feature{
10061007 .avr5,
10071008 }),
10081009 };
1009 pub const atmega3290a = Cpu{
1010 pub const atmega3290a = CpuModel{
10101011 .name = "atmega3290a",
10111012 .llvm_name = "atmega3290a",
10121013 .features = featureSet(&[_]Feature{
10131014 .avr5,
10141015 }),
10151016 };
1016 pub const atmega3290p = Cpu{
1017 pub const atmega3290p = CpuModel{
10171018 .name = "atmega3290p",
10181019 .llvm_name = "atmega3290p",
10191020 .features = featureSet(&[_]Feature{
10201021 .avr5,
10211022 }),
10221023 };
1023 pub const atmega3290pa = Cpu{
1024 pub const atmega3290pa = CpuModel{
10241025 .name = "atmega3290pa",
10251026 .llvm_name = "atmega3290pa",
10261027 .features = featureSet(&[_]Feature{
10271028 .avr5,
10281029 }),
10291030 };
1030 pub const atmega329a = Cpu{
1031 pub const atmega329a = CpuModel{
10311032 .name = "atmega329a",
10321033 .llvm_name = "atmega329a",
10331034 .features = featureSet(&[_]Feature{
10341035 .avr5,
10351036 }),
10361037 };
1037 pub const atmega329p = Cpu{
1038 pub const atmega329p = CpuModel{
10381039 .name = "atmega329p",
10391040 .llvm_name = "atmega329p",
10401041 .features = featureSet(&[_]Feature{
10411042 .avr5,
10421043 }),
10431044 };
1044 pub const atmega329pa = Cpu{
1045 pub const atmega329pa = CpuModel{
10451046 .name = "atmega329pa",
10461047 .llvm_name = "atmega329pa",
10471048 .features = featureSet(&[_]Feature{
10481049 .avr5,
10491050 }),
10501051 };
1051 pub const atmega32a = Cpu{
1052 pub const atmega32a = CpuModel{
10521053 .name = "atmega32a",
10531054 .llvm_name = "atmega32a",
10541055 .features = featureSet(&[_]Feature{
10551056 .avr5,
10561057 }),
10571058 };
1058 pub const atmega32c1 = Cpu{
1059 pub const atmega32c1 = CpuModel{
10591060 .name = "atmega32c1",
10601061 .llvm_name = "atmega32c1",
10611062 .features = featureSet(&[_]Feature{
10621063 .avr5,
10631064 }),
10641065 };
1065 pub const atmega32hvb = Cpu{
1066 pub const atmega32hvb = CpuModel{
10661067 .name = "atmega32hvb",
10671068 .llvm_name = "atmega32hvb",
10681069 .features = featureSet(&[_]Feature{
10691070 .avr5,
10701071 }),
10711072 };
1072 pub const atmega32hvbrevb = Cpu{
1073 pub const atmega32hvbrevb = CpuModel{
10731074 .name = "atmega32hvbrevb",
10741075 .llvm_name = "atmega32hvbrevb",
10751076 .features = featureSet(&[_]Feature{
10761077 .avr5,
10771078 }),
10781079 };
1079 pub const atmega32m1 = Cpu{
1080 pub const atmega32m1 = CpuModel{
10801081 .name = "atmega32m1",
10811082 .llvm_name = "atmega32m1",
10821083 .features = featureSet(&[_]Feature{
10831084 .avr5,
10841085 }),
10851086 };
1086 pub const atmega32u2 = Cpu{
1087 pub const atmega32u2 = CpuModel{
10871088 .name = "atmega32u2",
10881089 .llvm_name = "atmega32u2",
10891090 .features = featureSet(&[_]Feature{
10901091 .avr35,
10911092 }),
10921093 };
1093 pub const atmega32u4 = Cpu{
1094 pub const atmega32u4 = CpuModel{
10941095 .name = "atmega32u4",
10951096 .llvm_name = "atmega32u4",
10961097 .features = featureSet(&[_]Feature{
10971098 .avr5,
10981099 }),
10991100 };
1100 pub const atmega32u6 = Cpu{
1101 pub const atmega32u6 = CpuModel{
11011102 .name = "atmega32u6",
11021103 .llvm_name = "atmega32u6",
11031104 .features = featureSet(&[_]Feature{
11041105 .avr5,
11051106 }),
11061107 };
1107 pub const atmega406 = Cpu{
1108 pub const atmega406 = CpuModel{
11081109 .name = "atmega406",
11091110 .llvm_name = "atmega406",
11101111 .features = featureSet(&[_]Feature{
11111112 .avr5,
11121113 }),
11131114 };
1114 pub const atmega48 = Cpu{
1115 pub const atmega48 = CpuModel{
11151116 .name = "atmega48",
11161117 .llvm_name = "atmega48",
11171118 .features = featureSet(&[_]Feature{
11181119 .avr4,
11191120 }),
11201121 };
1121 pub const atmega48a = Cpu{
1122 pub const atmega48a = CpuModel{
11221123 .name = "atmega48a",
11231124 .llvm_name = "atmega48a",
11241125 .features = featureSet(&[_]Feature{
11251126 .avr4,
11261127 }),
11271128 };
1128 pub const atmega48p = Cpu{
1129 pub const atmega48p = CpuModel{
11291130 .name = "atmega48p",
11301131 .llvm_name = "atmega48p",
11311132 .features = featureSet(&[_]Feature{
11321133 .avr4,
11331134 }),
11341135 };
1135 pub const atmega48pa = Cpu{
1136 pub const atmega48pa = CpuModel{
11361137 .name = "atmega48pa",
11371138 .llvm_name = "atmega48pa",
11381139 .features = featureSet(&[_]Feature{
11391140 .avr4,
11401141 }),
11411142 };
1142 pub const atmega64 = Cpu{
1143 pub const atmega64 = CpuModel{
11431144 .name = "atmega64",
11441145 .llvm_name = "atmega64",
11451146 .features = featureSet(&[_]Feature{
11461147 .avr5,
11471148 }),
11481149 };
1149 pub const atmega640 = Cpu{
1150 pub const atmega640 = CpuModel{
11501151 .name = "atmega640",
11511152 .llvm_name = "atmega640",
11521153 .features = featureSet(&[_]Feature{
11531154 .avr5,
11541155 }),
11551156 };
1156 pub const atmega644 = Cpu{
1157 pub const atmega644 = CpuModel{
11571158 .name = "atmega644",
11581159 .llvm_name = "atmega644",
11591160 .features = featureSet(&[_]Feature{
11601161 .avr5,
11611162 }),
11621163 };
1163 pub const atmega644a = Cpu{
1164 pub const atmega644a = CpuModel{
11641165 .name = "atmega644a",
11651166 .llvm_name = "atmega644a",
11661167 .features = featureSet(&[_]Feature{
11671168 .avr5,
11681169 }),
11691170 };
1170 pub const atmega644p = Cpu{
1171 pub const atmega644p = CpuModel{
11711172 .name = "atmega644p",
11721173 .llvm_name = "atmega644p",
11731174 .features = featureSet(&[_]Feature{
11741175 .avr5,
11751176 }),
11761177 };
1177 pub const atmega644pa = Cpu{
1178 pub const atmega644pa = CpuModel{
11781179 .name = "atmega644pa",
11791180 .llvm_name = "atmega644pa",
11801181 .features = featureSet(&[_]Feature{
11811182 .avr5,
11821183 }),
11831184 };
1184 pub const atmega644rfr2 = Cpu{
1185 pub const atmega644rfr2 = CpuModel{
11851186 .name = "atmega644rfr2",
11861187 .llvm_name = "atmega644rfr2",
11871188 .features = featureSet(&[_]Feature{
11881189 .avr5,
11891190 }),
11901191 };
1191 pub const atmega645 = Cpu{
1192 pub const atmega645 = CpuModel{
11921193 .name = "atmega645",
11931194 .llvm_name = "atmega645",
11941195 .features = featureSet(&[_]Feature{
11951196 .avr5,
11961197 }),
11971198 };
1198 pub const atmega6450 = Cpu{
1199 pub const atmega6450 = CpuModel{
11991200 .name = "atmega6450",
12001201 .llvm_name = "atmega6450",
12011202 .features = featureSet(&[_]Feature{
12021203 .avr5,
12031204 }),
12041205 };
1205 pub const atmega6450a = Cpu{
1206 pub const atmega6450a = CpuModel{
12061207 .name = "atmega6450a",
12071208 .llvm_name = "atmega6450a",
12081209 .features = featureSet(&[_]Feature{
12091210 .avr5,
12101211 }),
12111212 };
1212 pub const atmega6450p = Cpu{
1213 pub const atmega6450p = CpuModel{
12131214 .name = "atmega6450p",
12141215 .llvm_name = "atmega6450p",
12151216 .features = featureSet(&[_]Feature{
12161217 .avr5,
12171218 }),
12181219 };
1219 pub const atmega645a = Cpu{
1220 pub const atmega645a = CpuModel{
12201221 .name = "atmega645a",
12211222 .llvm_name = "atmega645a",
12221223 .features = featureSet(&[_]Feature{
12231224 .avr5,
12241225 }),
12251226 };
1226 pub const atmega645p = Cpu{
1227 pub const atmega645p = CpuModel{
12271228 .name = "atmega645p",
12281229 .llvm_name = "atmega645p",
12291230 .features = featureSet(&[_]Feature{
12301231 .avr5,
12311232 }),
12321233 };
1233 pub const atmega649 = Cpu{
1234 pub const atmega649 = CpuModel{
12341235 .name = "atmega649",
12351236 .llvm_name = "atmega649",
12361237 .features = featureSet(&[_]Feature{
12371238 .avr5,
12381239 }),
12391240 };
1240 pub const atmega6490 = Cpu{
1241 pub const atmega6490 = CpuModel{
12411242 .name = "atmega6490",
12421243 .llvm_name = "atmega6490",
12431244 .features = featureSet(&[_]Feature{
12441245 .avr5,
12451246 }),
12461247 };
1247 pub const atmega6490a = Cpu{
1248 pub const atmega6490a = CpuModel{
12481249 .name = "atmega6490a",
12491250 .llvm_name = "atmega6490a",
12501251 .features = featureSet(&[_]Feature{
12511252 .avr5,
12521253 }),
12531254 };
1254 pub const atmega6490p = Cpu{
1255 pub const atmega6490p = CpuModel{
12551256 .name = "atmega6490p",
12561257 .llvm_name = "atmega6490p",
12571258 .features = featureSet(&[_]Feature{
12581259 .avr5,
12591260 }),
12601261 };
1261 pub const atmega649a = Cpu{
1262 pub const atmega649a = CpuModel{
12621263 .name = "atmega649a",
12631264 .llvm_name = "atmega649a",
12641265 .features = featureSet(&[_]Feature{
12651266 .avr5,
12661267 }),
12671268 };
1268 pub const atmega649p = Cpu{
1269 pub const atmega649p = CpuModel{
12691270 .name = "atmega649p",
12701271 .llvm_name = "atmega649p",
12711272 .features = featureSet(&[_]Feature{
12721273 .avr5,
12731274 }),
12741275 };
1275 pub const atmega64a = Cpu{
1276 pub const atmega64a = CpuModel{
12761277 .name = "atmega64a",
12771278 .llvm_name = "atmega64a",
12781279 .features = featureSet(&[_]Feature{
12791280 .avr5,
12801281 }),
12811282 };
1282 pub const atmega64c1 = Cpu{
1283 pub const atmega64c1 = CpuModel{
12831284 .name = "atmega64c1",
12841285 .llvm_name = "atmega64c1",
12851286 .features = featureSet(&[_]Feature{
12861287 .avr5,
12871288 }),
12881289 };
1289 pub const atmega64hve = Cpu{
1290 pub const atmega64hve = CpuModel{
12901291 .name = "atmega64hve",
12911292 .llvm_name = "atmega64hve",
12921293 .features = featureSet(&[_]Feature{
12931294 .avr5,
12941295 }),
12951296 };
1296 pub const atmega64m1 = Cpu{
1297 pub const atmega64m1 = CpuModel{
12971298 .name = "atmega64m1",
12981299 .llvm_name = "atmega64m1",
12991300 .features = featureSet(&[_]Feature{
13001301 .avr5,
13011302 }),
13021303 };
1303 pub const atmega64rfr2 = Cpu{
1304 pub const atmega64rfr2 = CpuModel{
13041305 .name = "atmega64rfr2",
13051306 .llvm_name = "atmega64rfr2",
13061307 .features = featureSet(&[_]Feature{
13071308 .avr5,
13081309 }),
13091310 };
1310 pub const atmega8 = Cpu{
1311 pub const atmega8 = CpuModel{
13111312 .name = "atmega8",
13121313 .llvm_name = "atmega8",
13131314 .features = featureSet(&[_]Feature{
13141315 .avr4,
13151316 }),
13161317 };
1317 pub const atmega8515 = Cpu{
1318 pub const atmega8515 = CpuModel{
13181319 .name = "atmega8515",
13191320 .llvm_name = "atmega8515",
13201321 .features = featureSet(&[_]Feature{
......@@ -1325,7 +1326,7 @@ pub const cpu = struct {
13251326 .spm,
13261327 }),
13271328 };
1328 pub const atmega8535 = Cpu{
1329 pub const atmega8535 = CpuModel{
13291330 .name = "atmega8535",
13301331 .llvm_name = "atmega8535",
13311332 .features = featureSet(&[_]Feature{
......@@ -1336,175 +1337,175 @@ pub const cpu = struct {
13361337 .spm,
13371338 }),
13381339 };
1339 pub const atmega88 = Cpu{
1340 pub const atmega88 = CpuModel{
13401341 .name = "atmega88",
13411342 .llvm_name = "atmega88",
13421343 .features = featureSet(&[_]Feature{
13431344 .avr4,
13441345 }),
13451346 };
1346 pub const atmega88a = Cpu{
1347 pub const atmega88a = CpuModel{
13471348 .name = "atmega88a",
13481349 .llvm_name = "atmega88a",
13491350 .features = featureSet(&[_]Feature{
13501351 .avr4,
13511352 }),
13521353 };
1353 pub const atmega88p = Cpu{
1354 pub const atmega88p = CpuModel{
13541355 .name = "atmega88p",
13551356 .llvm_name = "atmega88p",
13561357 .features = featureSet(&[_]Feature{
13571358 .avr4,
13581359 }),
13591360 };
1360 pub const atmega88pa = Cpu{
1361 pub const atmega88pa = CpuModel{
13611362 .name = "atmega88pa",
13621363 .llvm_name = "atmega88pa",
13631364 .features = featureSet(&[_]Feature{
13641365 .avr4,
13651366 }),
13661367 };
1367 pub const atmega8a = Cpu{
1368 pub const atmega8a = CpuModel{
13681369 .name = "atmega8a",
13691370 .llvm_name = "atmega8a",
13701371 .features = featureSet(&[_]Feature{
13711372 .avr4,
13721373 }),
13731374 };
1374 pub const atmega8hva = Cpu{
1375 pub const atmega8hva = CpuModel{
13751376 .name = "atmega8hva",
13761377 .llvm_name = "atmega8hva",
13771378 .features = featureSet(&[_]Feature{
13781379 .avr4,
13791380 }),
13801381 };
1381 pub const atmega8u2 = Cpu{
1382 pub const atmega8u2 = CpuModel{
13821383 .name = "atmega8u2",
13831384 .llvm_name = "atmega8u2",
13841385 .features = featureSet(&[_]Feature{
13851386 .avr35,
13861387 }),
13871388 };
1388 pub const attiny10 = Cpu{
1389 pub const attiny10 = CpuModel{
13891390 .name = "attiny10",
13901391 .llvm_name = "attiny10",
13911392 .features = featureSet(&[_]Feature{
13921393 .avrtiny,
13931394 }),
13941395 };
1395 pub const attiny102 = Cpu{
1396 pub const attiny102 = CpuModel{
13961397 .name = "attiny102",
13971398 .llvm_name = "attiny102",
13981399 .features = featureSet(&[_]Feature{
13991400 .avrtiny,
14001401 }),
14011402 };
1402 pub const attiny104 = Cpu{
1403 pub const attiny104 = CpuModel{
14031404 .name = "attiny104",
14041405 .llvm_name = "attiny104",
14051406 .features = featureSet(&[_]Feature{
14061407 .avrtiny,
14071408 }),
14081409 };
1409 pub const attiny11 = Cpu{
1410 pub const attiny11 = CpuModel{
14101411 .name = "attiny11",
14111412 .llvm_name = "attiny11",
14121413 .features = featureSet(&[_]Feature{
14131414 .avr1,
14141415 }),
14151416 };
1416 pub const attiny12 = Cpu{
1417 pub const attiny12 = CpuModel{
14171418 .name = "attiny12",
14181419 .llvm_name = "attiny12",
14191420 .features = featureSet(&[_]Feature{
14201421 .avr1,
14211422 }),
14221423 };
1423 pub const attiny13 = Cpu{
1424 pub const attiny13 = CpuModel{
14241425 .name = "attiny13",
14251426 .llvm_name = "attiny13",
14261427 .features = featureSet(&[_]Feature{
14271428 .avr25,
14281429 }),
14291430 };
1430 pub const attiny13a = Cpu{
1431 pub const attiny13a = CpuModel{
14311432 .name = "attiny13a",
14321433 .llvm_name = "attiny13a",
14331434 .features = featureSet(&[_]Feature{
14341435 .avr25,
14351436 }),
14361437 };
1437 pub const attiny15 = Cpu{
1438 pub const attiny15 = CpuModel{
14381439 .name = "attiny15",
14391440 .llvm_name = "attiny15",
14401441 .features = featureSet(&[_]Feature{
14411442 .avr1,
14421443 }),
14431444 };
1444 pub const attiny1634 = Cpu{
1445 pub const attiny1634 = CpuModel{
14451446 .name = "attiny1634",
14461447 .llvm_name = "attiny1634",
14471448 .features = featureSet(&[_]Feature{
14481449 .avr35,
14491450 }),
14501451 };
1451 pub const attiny167 = Cpu{
1452 pub const attiny167 = CpuModel{
14521453 .name = "attiny167",
14531454 .llvm_name = "attiny167",
14541455 .features = featureSet(&[_]Feature{
14551456 .avr35,
14561457 }),
14571458 };
1458 pub const attiny20 = Cpu{
1459 pub const attiny20 = CpuModel{
14591460 .name = "attiny20",
14601461 .llvm_name = "attiny20",
14611462 .features = featureSet(&[_]Feature{
14621463 .avrtiny,
14631464 }),
14641465 };
1465 pub const attiny22 = Cpu{
1466 pub const attiny22 = CpuModel{
14661467 .name = "attiny22",
14671468 .llvm_name = "attiny22",
14681469 .features = featureSet(&[_]Feature{
14691470 .avr2,
14701471 }),
14711472 };
1472 pub const attiny2313 = Cpu{
1473 pub const attiny2313 = CpuModel{
14731474 .name = "attiny2313",
14741475 .llvm_name = "attiny2313",
14751476 .features = featureSet(&[_]Feature{
14761477 .avr25,
14771478 }),
14781479 };
1479 pub const attiny2313a = Cpu{
1480 pub const attiny2313a = CpuModel{
14801481 .name = "attiny2313a",
14811482 .llvm_name = "attiny2313a",
14821483 .features = featureSet(&[_]Feature{
14831484 .avr25,
14841485 }),
14851486 };
1486 pub const attiny24 = Cpu{
1487 pub const attiny24 = CpuModel{
14871488 .name = "attiny24",
14881489 .llvm_name = "attiny24",
14891490 .features = featureSet(&[_]Feature{
14901491 .avr25,
14911492 }),
14921493 };
1493 pub const attiny24a = Cpu{
1494 pub const attiny24a = CpuModel{
14941495 .name = "attiny24a",
14951496 .llvm_name = "attiny24a",
14961497 .features = featureSet(&[_]Feature{
14971498 .avr25,
14981499 }),
14991500 };
1500 pub const attiny25 = Cpu{
1501 pub const attiny25 = CpuModel{
15011502 .name = "attiny25",
15021503 .llvm_name = "attiny25",
15031504 .features = featureSet(&[_]Feature{
15041505 .avr25,
15051506 }),
15061507 };
1507 pub const attiny26 = Cpu{
1508 pub const attiny26 = CpuModel{
15081509 .name = "attiny26",
15091510 .llvm_name = "attiny26",
15101511 .features = featureSet(&[_]Feature{
......@@ -1512,602 +1513,602 @@ pub const cpu = struct {
15121513 .lpmx,
15131514 }),
15141515 };
1515 pub const attiny261 = Cpu{
1516 pub const attiny261 = CpuModel{
15161517 .name = "attiny261",
15171518 .llvm_name = "attiny261",
15181519 .features = featureSet(&[_]Feature{
15191520 .avr25,
15201521 }),
15211522 };
1522 pub const attiny261a = Cpu{
1523 pub const attiny261a = CpuModel{
15231524 .name = "attiny261a",
15241525 .llvm_name = "attiny261a",
15251526 .features = featureSet(&[_]Feature{
15261527 .avr25,
15271528 }),
15281529 };
1529 pub const attiny28 = Cpu{
1530 pub const attiny28 = CpuModel{
15301531 .name = "attiny28",
15311532 .llvm_name = "attiny28",
15321533 .features = featureSet(&[_]Feature{
15331534 .avr1,
15341535 }),
15351536 };
1536 pub const attiny4 = Cpu{
1537 pub const attiny4 = CpuModel{
15371538 .name = "attiny4",
15381539 .llvm_name = "attiny4",
15391540 .features = featureSet(&[_]Feature{
15401541 .avrtiny,
15411542 }),
15421543 };
1543 pub const attiny40 = Cpu{
1544 pub const attiny40 = CpuModel{
15441545 .name = "attiny40",
15451546 .llvm_name = "attiny40",
15461547 .features = featureSet(&[_]Feature{
15471548 .avrtiny,
15481549 }),
15491550 };
1550 pub const attiny4313 = Cpu{
1551 pub const attiny4313 = CpuModel{
15511552 .name = "attiny4313",
15521553 .llvm_name = "attiny4313",
15531554 .features = featureSet(&[_]Feature{
15541555 .avr25,
15551556 }),
15561557 };
1557 pub const attiny43u = Cpu{
1558 pub const attiny43u = CpuModel{
15581559 .name = "attiny43u",
15591560 .llvm_name = "attiny43u",
15601561 .features = featureSet(&[_]Feature{
15611562 .avr25,
15621563 }),
15631564 };
1564 pub const attiny44 = Cpu{
1565 pub const attiny44 = CpuModel{
15651566 .name = "attiny44",
15661567 .llvm_name = "attiny44",
15671568 .features = featureSet(&[_]Feature{
15681569 .avr25,
15691570 }),
15701571 };
1571 pub const attiny44a = Cpu{
1572 pub const attiny44a = CpuModel{
15721573 .name = "attiny44a",
15731574 .llvm_name = "attiny44a",
15741575 .features = featureSet(&[_]Feature{
15751576 .avr25,
15761577 }),
15771578 };
1578 pub const attiny45 = Cpu{
1579 pub const attiny45 = CpuModel{
15791580 .name = "attiny45",
15801581 .llvm_name = "attiny45",
15811582 .features = featureSet(&[_]Feature{
15821583 .avr25,
15831584 }),
15841585 };
1585 pub const attiny461 = Cpu{
1586 pub const attiny461 = CpuModel{
15861587 .name = "attiny461",
15871588 .llvm_name = "attiny461",
15881589 .features = featureSet(&[_]Feature{
15891590 .avr25,
15901591 }),
15911592 };
1592 pub const attiny461a = Cpu{
1593 pub const attiny461a = CpuModel{
15931594 .name = "attiny461a",
15941595 .llvm_name = "attiny461a",
15951596 .features = featureSet(&[_]Feature{
15961597 .avr25,
15971598 }),
15981599 };
1599 pub const attiny48 = Cpu{
1600 pub const attiny48 = CpuModel{
16001601 .name = "attiny48",
16011602 .llvm_name = "attiny48",
16021603 .features = featureSet(&[_]Feature{
16031604 .avr25,
16041605 }),
16051606 };
1606 pub const attiny5 = Cpu{
1607 pub const attiny5 = CpuModel{
16071608 .name = "attiny5",
16081609 .llvm_name = "attiny5",
16091610 .features = featureSet(&[_]Feature{
16101611 .avrtiny,
16111612 }),
16121613 };
1613 pub const attiny828 = Cpu{
1614 pub const attiny828 = CpuModel{
16141615 .name = "attiny828",
16151616 .llvm_name = "attiny828",
16161617 .features = featureSet(&[_]Feature{
16171618 .avr25,
16181619 }),
16191620 };
1620 pub const attiny84 = Cpu{
1621 pub const attiny84 = CpuModel{
16211622 .name = "attiny84",
16221623 .llvm_name = "attiny84",
16231624 .features = featureSet(&[_]Feature{
16241625 .avr25,
16251626 }),
16261627 };
1627 pub const attiny84a = Cpu{
1628 pub const attiny84a = CpuModel{
16281629 .name = "attiny84a",
16291630 .llvm_name = "attiny84a",
16301631 .features = featureSet(&[_]Feature{
16311632 .avr25,
16321633 }),
16331634 };
1634 pub const attiny85 = Cpu{
1635 pub const attiny85 = CpuModel{
16351636 .name = "attiny85",
16361637 .llvm_name = "attiny85",
16371638 .features = featureSet(&[_]Feature{
16381639 .avr25,
16391640 }),
16401641 };
1641 pub const attiny861 = Cpu{
1642 pub const attiny861 = CpuModel{
16421643 .name = "attiny861",
16431644 .llvm_name = "attiny861",
16441645 .features = featureSet(&[_]Feature{
16451646 .avr25,
16461647 }),
16471648 };
1648 pub const attiny861a = Cpu{
1649 pub const attiny861a = CpuModel{
16491650 .name = "attiny861a",
16501651 .llvm_name = "attiny861a",
16511652 .features = featureSet(&[_]Feature{
16521653 .avr25,
16531654 }),
16541655 };
1655 pub const attiny87 = Cpu{
1656 pub const attiny87 = CpuModel{
16561657 .name = "attiny87",
16571658 .llvm_name = "attiny87",
16581659 .features = featureSet(&[_]Feature{
16591660 .avr25,
16601661 }),
16611662 };
1662 pub const attiny88 = Cpu{
1663 pub const attiny88 = CpuModel{
16631664 .name = "attiny88",
16641665 .llvm_name = "attiny88",
16651666 .features = featureSet(&[_]Feature{
16661667 .avr25,
16671668 }),
16681669 };
1669 pub const attiny9 = Cpu{
1670 pub const attiny9 = CpuModel{
16701671 .name = "attiny9",
16711672 .llvm_name = "attiny9",
16721673 .features = featureSet(&[_]Feature{
16731674 .avrtiny,
16741675 }),
16751676 };
1676 pub const atxmega128a1 = Cpu{
1677 pub const atxmega128a1 = CpuModel{
16771678 .name = "atxmega128a1",
16781679 .llvm_name = "atxmega128a1",
16791680 .features = featureSet(&[_]Feature{
16801681 .xmega,
16811682 }),
16821683 };
1683 pub const atxmega128a1u = Cpu{
1684 pub const atxmega128a1u = CpuModel{
16841685 .name = "atxmega128a1u",
16851686 .llvm_name = "atxmega128a1u",
16861687 .features = featureSet(&[_]Feature{
16871688 .xmegau,
16881689 }),
16891690 };
1690 pub const atxmega128a3 = Cpu{
1691 pub const atxmega128a3 = CpuModel{
16911692 .name = "atxmega128a3",
16921693 .llvm_name = "atxmega128a3",
16931694 .features = featureSet(&[_]Feature{
16941695 .xmega,
16951696 }),
16961697 };
1697 pub const atxmega128a3u = Cpu{
1698 pub const atxmega128a3u = CpuModel{
16981699 .name = "atxmega128a3u",
16991700 .llvm_name = "atxmega128a3u",
17001701 .features = featureSet(&[_]Feature{
17011702 .xmegau,
17021703 }),
17031704 };
1704 pub const atxmega128a4u = Cpu{
1705 pub const atxmega128a4u = CpuModel{
17051706 .name = "atxmega128a4u",
17061707 .llvm_name = "atxmega128a4u",
17071708 .features = featureSet(&[_]Feature{
17081709 .xmegau,
17091710 }),
17101711 };
1711 pub const atxmega128b1 = Cpu{
1712 pub const atxmega128b1 = CpuModel{
17121713 .name = "atxmega128b1",
17131714 .llvm_name = "atxmega128b1",
17141715 .features = featureSet(&[_]Feature{
17151716 .xmegau,
17161717 }),
17171718 };
1718 pub const atxmega128b3 = Cpu{
1719 pub const atxmega128b3 = CpuModel{
17191720 .name = "atxmega128b3",
17201721 .llvm_name = "atxmega128b3",
17211722 .features = featureSet(&[_]Feature{
17221723 .xmegau,
17231724 }),
17241725 };
1725 pub const atxmega128c3 = Cpu{
1726 pub const atxmega128c3 = CpuModel{
17261727 .name = "atxmega128c3",
17271728 .llvm_name = "atxmega128c3",
17281729 .features = featureSet(&[_]Feature{
17291730 .xmegau,
17301731 }),
17311732 };
1732 pub const atxmega128d3 = Cpu{
1733 pub const atxmega128d3 = CpuModel{
17331734 .name = "atxmega128d3",
17341735 .llvm_name = "atxmega128d3",
17351736 .features = featureSet(&[_]Feature{
17361737 .xmega,
17371738 }),
17381739 };
1739 pub const atxmega128d4 = Cpu{
1740 pub const atxmega128d4 = CpuModel{
17401741 .name = "atxmega128d4",
17411742 .llvm_name = "atxmega128d4",
17421743 .features = featureSet(&[_]Feature{
17431744 .xmega,
17441745 }),
17451746 };
1746 pub const atxmega16a4 = Cpu{
1747 pub const atxmega16a4 = CpuModel{
17471748 .name = "atxmega16a4",
17481749 .llvm_name = "atxmega16a4",
17491750 .features = featureSet(&[_]Feature{
17501751 .xmega,
17511752 }),
17521753 };
1753 pub const atxmega16a4u = Cpu{
1754 pub const atxmega16a4u = CpuModel{
17541755 .name = "atxmega16a4u",
17551756 .llvm_name = "atxmega16a4u",
17561757 .features = featureSet(&[_]Feature{
17571758 .xmegau,
17581759 }),
17591760 };
1760 pub const atxmega16c4 = Cpu{
1761 pub const atxmega16c4 = CpuModel{
17611762 .name = "atxmega16c4",
17621763 .llvm_name = "atxmega16c4",
17631764 .features = featureSet(&[_]Feature{
17641765 .xmegau,
17651766 }),
17661767 };
1767 pub const atxmega16d4 = Cpu{
1768 pub const atxmega16d4 = CpuModel{
17681769 .name = "atxmega16d4",
17691770 .llvm_name = "atxmega16d4",
17701771 .features = featureSet(&[_]Feature{
17711772 .xmega,
17721773 }),
17731774 };
1774 pub const atxmega16e5 = Cpu{
1775 pub const atxmega16e5 = CpuModel{
17751776 .name = "atxmega16e5",
17761777 .llvm_name = "atxmega16e5",
17771778 .features = featureSet(&[_]Feature{
17781779 .xmega,
17791780 }),
17801781 };
1781 pub const atxmega192a3 = Cpu{
1782 pub const atxmega192a3 = CpuModel{
17821783 .name = "atxmega192a3",
17831784 .llvm_name = "atxmega192a3",
17841785 .features = featureSet(&[_]Feature{
17851786 .xmega,
17861787 }),
17871788 };
1788 pub const atxmega192a3u = Cpu{
1789 pub const atxmega192a3u = CpuModel{
17891790 .name = "atxmega192a3u",
17901791 .llvm_name = "atxmega192a3u",
17911792 .features = featureSet(&[_]Feature{
17921793 .xmegau,
17931794 }),
17941795 };
1795 pub const atxmega192c3 = Cpu{
1796 pub const atxmega192c3 = CpuModel{
17961797 .name = "atxmega192c3",
17971798 .llvm_name = "atxmega192c3",
17981799 .features = featureSet(&[_]Feature{
17991800 .xmegau,
18001801 }),
18011802 };
1802 pub const atxmega192d3 = Cpu{
1803 pub const atxmega192d3 = CpuModel{
18031804 .name = "atxmega192d3",
18041805 .llvm_name = "atxmega192d3",
18051806 .features = featureSet(&[_]Feature{
18061807 .xmega,
18071808 }),
18081809 };
1809 pub const atxmega256a3 = Cpu{
1810 pub const atxmega256a3 = CpuModel{
18101811 .name = "atxmega256a3",
18111812 .llvm_name = "atxmega256a3",
18121813 .features = featureSet(&[_]Feature{
18131814 .xmega,
18141815 }),
18151816 };
1816 pub const atxmega256a3b = Cpu{
1817 pub const atxmega256a3b = CpuModel{
18171818 .name = "atxmega256a3b",
18181819 .llvm_name = "atxmega256a3b",
18191820 .features = featureSet(&[_]Feature{
18201821 .xmega,
18211822 }),
18221823 };
1823 pub const atxmega256a3bu = Cpu{
1824 pub const atxmega256a3bu = CpuModel{
18241825 .name = "atxmega256a3bu",
18251826 .llvm_name = "atxmega256a3bu",
18261827 .features = featureSet(&[_]Feature{
18271828 .xmegau,
18281829 }),
18291830 };
1830 pub const atxmega256a3u = Cpu{
1831 pub const atxmega256a3u = CpuModel{
18311832 .name = "atxmega256a3u",
18321833 .llvm_name = "atxmega256a3u",
18331834 .features = featureSet(&[_]Feature{
18341835 .xmegau,
18351836 }),
18361837 };
1837 pub const atxmega256c3 = Cpu{
1838 pub const atxmega256c3 = CpuModel{
18381839 .name = "atxmega256c3",
18391840 .llvm_name = "atxmega256c3",
18401841 .features = featureSet(&[_]Feature{
18411842 .xmegau,
18421843 }),
18431844 };
1844 pub const atxmega256d3 = Cpu{
1845 pub const atxmega256d3 = CpuModel{
18451846 .name = "atxmega256d3",
18461847 .llvm_name = "atxmega256d3",
18471848 .features = featureSet(&[_]Feature{
18481849 .xmega,
18491850 }),
18501851 };
1851 pub const atxmega32a4 = Cpu{
1852 pub const atxmega32a4 = CpuModel{
18521853 .name = "atxmega32a4",
18531854 .llvm_name = "atxmega32a4",
18541855 .features = featureSet(&[_]Feature{
18551856 .xmega,
18561857 }),
18571858 };
1858 pub const atxmega32a4u = Cpu{
1859 pub const atxmega32a4u = CpuModel{
18591860 .name = "atxmega32a4u",
18601861 .llvm_name = "atxmega32a4u",
18611862 .features = featureSet(&[_]Feature{
18621863 .xmegau,
18631864 }),
18641865 };
1865 pub const atxmega32c4 = Cpu{
1866 pub const atxmega32c4 = CpuModel{
18661867 .name = "atxmega32c4",
18671868 .llvm_name = "atxmega32c4",
18681869 .features = featureSet(&[_]Feature{
18691870 .xmegau,
18701871 }),
18711872 };
1872 pub const atxmega32d4 = Cpu{
1873 pub const atxmega32d4 = CpuModel{
18731874 .name = "atxmega32d4",
18741875 .llvm_name = "atxmega32d4",
18751876 .features = featureSet(&[_]Feature{
18761877 .xmega,
18771878 }),
18781879 };
1879 pub const atxmega32e5 = Cpu{
1880 pub const atxmega32e5 = CpuModel{
18801881 .name = "atxmega32e5",
18811882 .llvm_name = "atxmega32e5",
18821883 .features = featureSet(&[_]Feature{
18831884 .xmega,
18841885 }),
18851886 };
1886 pub const atxmega32x1 = Cpu{
1887 pub const atxmega32x1 = CpuModel{
18871888 .name = "atxmega32x1",
18881889 .llvm_name = "atxmega32x1",
18891890 .features = featureSet(&[_]Feature{
18901891 .xmega,
18911892 }),
18921893 };
1893 pub const atxmega384c3 = Cpu{
1894 pub const atxmega384c3 = CpuModel{
18941895 .name = "atxmega384c3",
18951896 .llvm_name = "atxmega384c3",
18961897 .features = featureSet(&[_]Feature{
18971898 .xmegau,
18981899 }),
18991900 };
1900 pub const atxmega384d3 = Cpu{
1901 pub const atxmega384d3 = CpuModel{
19011902 .name = "atxmega384d3",
19021903 .llvm_name = "atxmega384d3",
19031904 .features = featureSet(&[_]Feature{
19041905 .xmega,
19051906 }),
19061907 };
1907 pub const atxmega64a1 = Cpu{
1908 pub const atxmega64a1 = CpuModel{
19081909 .name = "atxmega64a1",
19091910 .llvm_name = "atxmega64a1",
19101911 .features = featureSet(&[_]Feature{
19111912 .xmega,
19121913 }),
19131914 };
1914 pub const atxmega64a1u = Cpu{
1915 pub const atxmega64a1u = CpuModel{
19151916 .name = "atxmega64a1u",
19161917 .llvm_name = "atxmega64a1u",
19171918 .features = featureSet(&[_]Feature{
19181919 .xmegau,
19191920 }),
19201921 };
1921 pub const atxmega64a3 = Cpu{
1922 pub const atxmega64a3 = CpuModel{
19221923 .name = "atxmega64a3",
19231924 .llvm_name = "atxmega64a3",
19241925 .features = featureSet(&[_]Feature{
19251926 .xmega,
19261927 }),
19271928 };
1928 pub const atxmega64a3u = Cpu{
1929 pub const atxmega64a3u = CpuModel{
19291930 .name = "atxmega64a3u",
19301931 .llvm_name = "atxmega64a3u",
19311932 .features = featureSet(&[_]Feature{
19321933 .xmegau,
19331934 }),
19341935 };
1935 pub const atxmega64a4u = Cpu{
1936 pub const atxmega64a4u = CpuModel{
19361937 .name = "atxmega64a4u",
19371938 .llvm_name = "atxmega64a4u",
19381939 .features = featureSet(&[_]Feature{
19391940 .xmegau,
19401941 }),
19411942 };
1942 pub const atxmega64b1 = Cpu{
1943 pub const atxmega64b1 = CpuModel{
19431944 .name = "atxmega64b1",
19441945 .llvm_name = "atxmega64b1",
19451946 .features = featureSet(&[_]Feature{
19461947 .xmegau,
19471948 }),
19481949 };
1949 pub const atxmega64b3 = Cpu{
1950 pub const atxmega64b3 = CpuModel{
19501951 .name = "atxmega64b3",
19511952 .llvm_name = "atxmega64b3",
19521953 .features = featureSet(&[_]Feature{
19531954 .xmegau,
19541955 }),
19551956 };
1956 pub const atxmega64c3 = Cpu{
1957 pub const atxmega64c3 = CpuModel{
19571958 .name = "atxmega64c3",
19581959 .llvm_name = "atxmega64c3",
19591960 .features = featureSet(&[_]Feature{
19601961 .xmegau,
19611962 }),
19621963 };
1963 pub const atxmega64d3 = Cpu{
1964 pub const atxmega64d3 = CpuModel{
19641965 .name = "atxmega64d3",
19651966 .llvm_name = "atxmega64d3",
19661967 .features = featureSet(&[_]Feature{
19671968 .xmega,
19681969 }),
19691970 };
1970 pub const atxmega64d4 = Cpu{
1971 pub const atxmega64d4 = CpuModel{
19711972 .name = "atxmega64d4",
19721973 .llvm_name = "atxmega64d4",
19731974 .features = featureSet(&[_]Feature{
19741975 .xmega,
19751976 }),
19761977 };
1977 pub const atxmega8e5 = Cpu{
1978 pub const atxmega8e5 = CpuModel{
19781979 .name = "atxmega8e5",
19791980 .llvm_name = "atxmega8e5",
19801981 .features = featureSet(&[_]Feature{
19811982 .xmega,
19821983 }),
19831984 };
1984 pub const avr1 = Cpu{
1985 pub const avr1 = CpuModel{
19851986 .name = "avr1",
19861987 .llvm_name = "avr1",
19871988 .features = featureSet(&[_]Feature{
19881989 .avr1,
19891990 }),
19901991 };
1991 pub const avr2 = Cpu{
1992 pub const avr2 = CpuModel{
19921993 .name = "avr2",
19931994 .llvm_name = "avr2",
19941995 .features = featureSet(&[_]Feature{
19951996 .avr2,
19961997 }),
19971998 };
1998 pub const avr25 = Cpu{
1999 pub const avr25 = CpuModel{
19992000 .name = "avr25",
20002001 .llvm_name = "avr25",
20012002 .features = featureSet(&[_]Feature{
20022003 .avr25,
20032004 }),
20042005 };
2005 pub const avr3 = Cpu{
2006 pub const avr3 = CpuModel{
20062007 .name = "avr3",
20072008 .llvm_name = "avr3",
20082009 .features = featureSet(&[_]Feature{
20092010 .avr3,
20102011 }),
20112012 };
2012 pub const avr31 = Cpu{
2013 pub const avr31 = CpuModel{
20132014 .name = "avr31",
20142015 .llvm_name = "avr31",
20152016 .features = featureSet(&[_]Feature{
20162017 .avr31,
20172018 }),
20182019 };
2019 pub const avr35 = Cpu{
2020 pub const avr35 = CpuModel{
20202021 .name = "avr35",
20212022 .llvm_name = "avr35",
20222023 .features = featureSet(&[_]Feature{
20232024 .avr35,
20242025 }),
20252026 };
2026 pub const avr4 = Cpu{
2027 pub const avr4 = CpuModel{
20272028 .name = "avr4",
20282029 .llvm_name = "avr4",
20292030 .features = featureSet(&[_]Feature{
20302031 .avr4,
20312032 }),
20322033 };
2033 pub const avr5 = Cpu{
2034 pub const avr5 = CpuModel{
20342035 .name = "avr5",
20352036 .llvm_name = "avr5",
20362037 .features = featureSet(&[_]Feature{
20372038 .avr5,
20382039 }),
20392040 };
2040 pub const avr51 = Cpu{
2041 pub const avr51 = CpuModel{
20412042 .name = "avr51",
20422043 .llvm_name = "avr51",
20432044 .features = featureSet(&[_]Feature{
20442045 .avr51,
20452046 }),
20462047 };
2047 pub const avr6 = Cpu{
2048 pub const avr6 = CpuModel{
20482049 .name = "avr6",
20492050 .llvm_name = "avr6",
20502051 .features = featureSet(&[_]Feature{
20512052 .avr6,
20522053 }),
20532054 };
2054 pub const avrtiny = Cpu{
2055 pub const avrtiny = CpuModel{
20552056 .name = "avrtiny",
20562057 .llvm_name = "avrtiny",
20572058 .features = featureSet(&[_]Feature{
20582059 .avrtiny,
20592060 }),
20602061 };
2061 pub const avrxmega1 = Cpu{
2062 pub const avrxmega1 = CpuModel{
20622063 .name = "avrxmega1",
20632064 .llvm_name = "avrxmega1",
20642065 .features = featureSet(&[_]Feature{
20652066 .xmega,
20662067 }),
20672068 };
2068 pub const avrxmega2 = Cpu{
2069 pub const avrxmega2 = CpuModel{
20692070 .name = "avrxmega2",
20702071 .llvm_name = "avrxmega2",
20712072 .features = featureSet(&[_]Feature{
20722073 .xmega,
20732074 }),
20742075 };
2075 pub const avrxmega3 = Cpu{
2076 pub const avrxmega3 = CpuModel{
20762077 .name = "avrxmega3",
20772078 .llvm_name = "avrxmega3",
20782079 .features = featureSet(&[_]Feature{
20792080 .xmega,
20802081 }),
20812082 };
2082 pub const avrxmega4 = Cpu{
2083 pub const avrxmega4 = CpuModel{
20832084 .name = "avrxmega4",
20842085 .llvm_name = "avrxmega4",
20852086 .features = featureSet(&[_]Feature{
20862087 .xmega,
20872088 }),
20882089 };
2089 pub const avrxmega5 = Cpu{
2090 pub const avrxmega5 = CpuModel{
20902091 .name = "avrxmega5",
20912092 .llvm_name = "avrxmega5",
20922093 .features = featureSet(&[_]Feature{
20932094 .xmega,
20942095 }),
20952096 };
2096 pub const avrxmega6 = Cpu{
2097 pub const avrxmega6 = CpuModel{
20972098 .name = "avrxmega6",
20982099 .llvm_name = "avrxmega6",
20992100 .features = featureSet(&[_]Feature{
21002101 .xmega,
21012102 }),
21022103 };
2103 pub const avrxmega7 = Cpu{
2104 pub const avrxmega7 = CpuModel{
21042105 .name = "avrxmega7",
21052106 .llvm_name = "avrxmega7",
21062107 .features = featureSet(&[_]Feature{
21072108 .xmega,
21082109 }),
21092110 };
2110 pub const m3000 = Cpu{
2111 pub const m3000 = CpuModel{
21112112 .name = "m3000",
21122113 .llvm_name = "m3000",
21132114 .features = featureSet(&[_]Feature{
......@@ -2119,7 +2120,7 @@ pub const cpu = struct {
21192120/// All avr CPUs, sorted alphabetically by name.
21202121/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
21212122/// compiler has inefficient memory and CPU usage, affecting build times.
2122pub const all_cpus = &[_]*const Cpu{
2123pub const all_cpus = &[_]*const CpuModel{
21232124 &cpu.at43usb320,
21242125 &cpu.at43usb355,
21252126 &cpu.at76c711,
lib/std/target/bpf.zig+11-10
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 alu32,
......@@ -7,12 +8,12 @@ pub const Feature = enum {
78 dwarfris,
89};
910
10pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
11pub usingnamespace CpuFeature.feature_set_fns(Feature);
1112
1213pub const all_features = blk: {
1314 const len = @typeInfo(Feature).Enum.fields.len;
14 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
15 var result: [len]Cpu.Feature = undefined;
15 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
16 var result: [len]CpuFeature = undefined;
1617 result[@enumToInt(Feature.alu32)] = .{
1718 .llvm_name = "alu32",
1819 .description = "Enable ALU32 instructions",
......@@ -37,27 +38,27 @@ pub const all_features = blk: {
3738};
3839
3940pub const cpu = struct {
40 pub const generic = Cpu{
41 pub const generic = CpuModel{
4142 .name = "generic",
4243 .llvm_name = "generic",
4344 .features = featureSet(&[_]Feature{}),
4445 };
45 pub const probe = Cpu{
46 pub const probe = CpuModel{
4647 .name = "probe",
4748 .llvm_name = "probe",
4849 .features = featureSet(&[_]Feature{}),
4950 };
50 pub const v1 = Cpu{
51 pub const v1 = CpuModel{
5152 .name = "v1",
5253 .llvm_name = "v1",
5354 .features = featureSet(&[_]Feature{}),
5455 };
55 pub const v2 = Cpu{
56 pub const v2 = CpuModel{
5657 .name = "v2",
5758 .llvm_name = "v2",
5859 .features = featureSet(&[_]Feature{}),
5960 };
60 pub const v3 = Cpu{
61 pub const v3 = CpuModel{
6162 .name = "v3",
6263 .llvm_name = "v3",
6364 .features = featureSet(&[_]Feature{}),
......@@ -67,7 +68,7 @@ pub const cpu = struct {
6768/// All bpf CPUs, sorted alphabetically by name.
6869/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
6970/// compiler has inefficient memory and CPU usage, affecting build times.
70pub const all_cpus = &[_]*const Cpu{
71pub const all_cpus = &[_]*const CpuModel{
7172 &cpu.generic,
7273 &cpu.probe,
7374 &cpu.v1,
lib/std/target/hexagon.zig+13-12
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 duplex,
......@@ -28,12 +29,12 @@ pub const Feature = enum {
2829 zreg,
2930};
3031
31pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
32pub usingnamespace CpuFeature.feature_set_fns(Feature);
3233
3334pub const all_features = blk: {
3435 const len = @typeInfo(Feature).Enum.fields.len;
35 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
36 var result: [len]Cpu.Feature = undefined;
36 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
37 var result: [len]CpuFeature = undefined;
3738 result[@enumToInt(Feature.duplex)] = .{
3839 .llvm_name = "duplex",
3940 .description = "Enable generation of duplex instruction",
......@@ -186,7 +187,7 @@ pub const all_features = blk: {
186187};
187188
188189pub const cpu = struct {
189 pub const generic = Cpu{
190 pub const generic = CpuModel{
190191 .name = "generic",
191192 .llvm_name = "generic",
192193 .features = featureSet(&[_]Feature{
......@@ -201,7 +202,7 @@ pub const cpu = struct {
201202 .v60,
202203 }),
203204 };
204 pub const hexagonv5 = Cpu{
205 pub const hexagonv5 = CpuModel{
205206 .name = "hexagonv5",
206207 .llvm_name = "hexagonv5",
207208 .features = featureSet(&[_]Feature{
......@@ -214,7 +215,7 @@ pub const cpu = struct {
214215 .v5,
215216 }),
216217 };
217 pub const hexagonv55 = Cpu{
218 pub const hexagonv55 = CpuModel{
218219 .name = "hexagonv55",
219220 .llvm_name = "hexagonv55",
220221 .features = featureSet(&[_]Feature{
......@@ -228,7 +229,7 @@ pub const cpu = struct {
228229 .v55,
229230 }),
230231 };
231 pub const hexagonv60 = Cpu{
232 pub const hexagonv60 = CpuModel{
232233 .name = "hexagonv60",
233234 .llvm_name = "hexagonv60",
234235 .features = featureSet(&[_]Feature{
......@@ -243,7 +244,7 @@ pub const cpu = struct {
243244 .v60,
244245 }),
245246 };
246 pub const hexagonv62 = Cpu{
247 pub const hexagonv62 = CpuModel{
247248 .name = "hexagonv62",
248249 .llvm_name = "hexagonv62",
249250 .features = featureSet(&[_]Feature{
......@@ -259,7 +260,7 @@ pub const cpu = struct {
259260 .v62,
260261 }),
261262 };
262 pub const hexagonv65 = Cpu{
263 pub const hexagonv65 = CpuModel{
263264 .name = "hexagonv65",
264265 .llvm_name = "hexagonv65",
265266 .features = featureSet(&[_]Feature{
......@@ -277,7 +278,7 @@ pub const cpu = struct {
277278 .v65,
278279 }),
279280 };
280 pub const hexagonv66 = Cpu{
281 pub const hexagonv66 = CpuModel{
281282 .name = "hexagonv66",
282283 .llvm_name = "hexagonv66",
283284 .features = featureSet(&[_]Feature{
......@@ -301,7 +302,7 @@ pub const cpu = struct {
301302/// All hexagon CPUs, sorted alphabetically by name.
302303/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
303304/// compiler has inefficient memory and CPU usage, affecting build times.
304pub const all_cpus = &[_]*const Cpu{
305pub const all_cpus = &[_]*const CpuModel{
305306 &cpu.generic,
306307 &cpu.hexagonv5,
307308 &cpu.hexagonv55,
lib/std/target/mips.zig+23-22
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 abs2008,
......@@ -53,12 +54,12 @@ pub const Feature = enum {
5354 virt,
5455};
5556
56pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
57pub usingnamespace CpuFeature.feature_set_fns(Feature);
5758
5859pub const all_features = blk: {
5960 const len = @typeInfo(Feature).Enum.fields.len;
60 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
61 var result: [len]Cpu.Feature = undefined;
61 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
62 var result: [len]CpuFeature = undefined;
6263 result[@enumToInt(Feature.abs2008)] = .{
6364 .llvm_name = "abs2008",
6465 .description = "Disable IEEE 754-2008 abs.fmt mode",
......@@ -372,112 +373,112 @@ pub const all_features = blk: {
372373};
373374
374375pub const cpu = struct {
375 pub const mips1 = Cpu{
376 pub const mips1 = CpuModel{
376377 .name = "mips1",
377378 .llvm_name = "mips1",
378379 .features = featureSet(&[_]Feature{
379380 .mips1,
380381 }),
381382 };
382 pub const mips2 = Cpu{
383 pub const mips2 = CpuModel{
383384 .name = "mips2",
384385 .llvm_name = "mips2",
385386 .features = featureSet(&[_]Feature{
386387 .mips2,
387388 }),
388389 };
389 pub const mips3 = Cpu{
390 pub const mips3 = CpuModel{
390391 .name = "mips3",
391392 .llvm_name = "mips3",
392393 .features = featureSet(&[_]Feature{
393394 .mips3,
394395 }),
395396 };
396 pub const mips32 = Cpu{
397 pub const mips32 = CpuModel{
397398 .name = "mips32",
398399 .llvm_name = "mips32",
399400 .features = featureSet(&[_]Feature{
400401 .mips32,
401402 }),
402403 };
403 pub const mips32r2 = Cpu{
404 pub const mips32r2 = CpuModel{
404405 .name = "mips32r2",
405406 .llvm_name = "mips32r2",
406407 .features = featureSet(&[_]Feature{
407408 .mips32r2,
408409 }),
409410 };
410 pub const mips32r3 = Cpu{
411 pub const mips32r3 = CpuModel{
411412 .name = "mips32r3",
412413 .llvm_name = "mips32r3",
413414 .features = featureSet(&[_]Feature{
414415 .mips32r3,
415416 }),
416417 };
417 pub const mips32r5 = Cpu{
418 pub const mips32r5 = CpuModel{
418419 .name = "mips32r5",
419420 .llvm_name = "mips32r5",
420421 .features = featureSet(&[_]Feature{
421422 .mips32r5,
422423 }),
423424 };
424 pub const mips32r6 = Cpu{
425 pub const mips32r6 = CpuModel{
425426 .name = "mips32r6",
426427 .llvm_name = "mips32r6",
427428 .features = featureSet(&[_]Feature{
428429 .mips32r6,
429430 }),
430431 };
431 pub const mips4 = Cpu{
432 pub const mips4 = CpuModel{
432433 .name = "mips4",
433434 .llvm_name = "mips4",
434435 .features = featureSet(&[_]Feature{
435436 .mips4,
436437 }),
437438 };
438 pub const mips5 = Cpu{
439 pub const mips5 = CpuModel{
439440 .name = "mips5",
440441 .llvm_name = "mips5",
441442 .features = featureSet(&[_]Feature{
442443 .mips5,
443444 }),
444445 };
445 pub const mips64 = Cpu{
446 pub const mips64 = CpuModel{
446447 .name = "mips64",
447448 .llvm_name = "mips64",
448449 .features = featureSet(&[_]Feature{
449450 .mips64,
450451 }),
451452 };
452 pub const mips64r2 = Cpu{
453 pub const mips64r2 = CpuModel{
453454 .name = "mips64r2",
454455 .llvm_name = "mips64r2",
455456 .features = featureSet(&[_]Feature{
456457 .mips64r2,
457458 }),
458459 };
459 pub const mips64r3 = Cpu{
460 pub const mips64r3 = CpuModel{
460461 .name = "mips64r3",
461462 .llvm_name = "mips64r3",
462463 .features = featureSet(&[_]Feature{
463464 .mips64r3,
464465 }),
465466 };
466 pub const mips64r5 = Cpu{
467 pub const mips64r5 = CpuModel{
467468 .name = "mips64r5",
468469 .llvm_name = "mips64r5",
469470 .features = featureSet(&[_]Feature{
470471 .mips64r5,
471472 }),
472473 };
473 pub const mips64r6 = Cpu{
474 pub const mips64r6 = CpuModel{
474475 .name = "mips64r6",
475476 .llvm_name = "mips64r6",
476477 .features = featureSet(&[_]Feature{
477478 .mips64r6,
478479 }),
479480 };
480 pub const octeon = Cpu{
481 pub const octeon = CpuModel{
481482 .name = "octeon",
482483 .llvm_name = "octeon",
483484 .features = featureSet(&[_]Feature{
......@@ -485,7 +486,7 @@ pub const cpu = struct {
485486 .mips64r2,
486487 }),
487488 };
488 pub const p5600 = Cpu{
489 pub const p5600 = CpuModel{
489490 .name = "p5600",
490491 .llvm_name = "p5600",
491492 .features = featureSet(&[_]Feature{
......@@ -497,7 +498,7 @@ pub const cpu = struct {
497498/// All mips CPUs, sorted alphabetically by name.
498499/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
499500/// compiler has inefficient memory and CPU usage, affecting build times.
500pub const all_cpus = &[_]*const Cpu{
501pub const all_cpus = &[_]*const CpuModel{
501502 &cpu.mips1,
502503 &cpu.mips2,
503504 &cpu.mips3,
lib/std/target/msp430.zig+9-8
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 ext,
......@@ -8,12 +9,12 @@ pub const Feature = enum {
89 hwmultf5,
910};
1011
11pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
12pub usingnamespace CpuFeature.feature_set_fns(Feature);
1213
1314pub const all_features = blk: {
1415 const len = @typeInfo(Feature).Enum.fields.len;
15 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
16 var result: [len]Cpu.Feature = undefined;
16 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
17 var result: [len]CpuFeature = undefined;
1718 result[@enumToInt(Feature.ext)] = .{
1819 .llvm_name = "ext",
1920 .description = "Enable MSP430-X extensions",
......@@ -43,17 +44,17 @@ pub const all_features = blk: {
4344};
4445
4546pub const cpu = struct {
46 pub const generic = Cpu{
47 pub const generic = CpuModel{
4748 .name = "generic",
4849 .llvm_name = "generic",
4950 .features = featureSet(&[_]Feature{}),
5051 };
51 pub const msp430 = Cpu{
52 pub const msp430 = CpuModel{
5253 .name = "msp430",
5354 .llvm_name = "msp430",
5455 .features = featureSet(&[_]Feature{}),
5556 };
56 pub const msp430x = Cpu{
57 pub const msp430x = CpuModel{
5758 .name = "msp430x",
5859 .llvm_name = "msp430x",
5960 .features = featureSet(&[_]Feature{
......@@ -65,7 +66,7 @@ pub const cpu = struct {
6566/// All msp430 CPUs, sorted alphabetically by name.
6667/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
6768/// compiler has inefficient memory and CPU usage, affecting build times.
68pub const all_cpus = &[_]*const Cpu{
69pub const all_cpus = &[_]*const CpuModel{
6970 &cpu.generic,
7071 &cpu.msp430,
7172 &cpu.msp430x,
lib/std/target/nvptx.zig+21-20
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 ptx32,
......@@ -29,12 +30,12 @@ pub const Feature = enum {
2930 sm_75,
3031};
3132
32pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
33pub usingnamespace CpuFeature.feature_set_fns(Feature);
3334
3435pub const all_features = blk: {
3536 const len = @typeInfo(Feature).Enum.fields.len;
36 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
37 var result: [len]Cpu.Feature = undefined;
37 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
38 var result: [len]CpuFeature = undefined;
3839 result[@enumToInt(Feature.ptx32)] = .{
3940 .llvm_name = "ptx32",
4041 .description = "Use PTX version 3.2",
......@@ -169,28 +170,28 @@ pub const all_features = blk: {
169170};
170171
171172pub const cpu = struct {
172 pub const sm_20 = Cpu{
173 pub const sm_20 = CpuModel{
173174 .name = "sm_20",
174175 .llvm_name = "sm_20",
175176 .features = featureSet(&[_]Feature{
176177 .sm_20,
177178 }),
178179 };
179 pub const sm_21 = Cpu{
180 pub const sm_21 = CpuModel{
180181 .name = "sm_21",
181182 .llvm_name = "sm_21",
182183 .features = featureSet(&[_]Feature{
183184 .sm_21,
184185 }),
185186 };
186 pub const sm_30 = Cpu{
187 pub const sm_30 = CpuModel{
187188 .name = "sm_30",
188189 .llvm_name = "sm_30",
189190 .features = featureSet(&[_]Feature{
190191 .sm_30,
191192 }),
192193 };
193 pub const sm_32 = Cpu{
194 pub const sm_32 = CpuModel{
194195 .name = "sm_32",
195196 .llvm_name = "sm_32",
196197 .features = featureSet(&[_]Feature{
......@@ -198,14 +199,14 @@ pub const cpu = struct {
198199 .sm_32,
199200 }),
200201 };
201 pub const sm_35 = Cpu{
202 pub const sm_35 = CpuModel{
202203 .name = "sm_35",
203204 .llvm_name = "sm_35",
204205 .features = featureSet(&[_]Feature{
205206 .sm_35,
206207 }),
207208 };
208 pub const sm_37 = Cpu{
209 pub const sm_37 = CpuModel{
209210 .name = "sm_37",
210211 .llvm_name = "sm_37",
211212 .features = featureSet(&[_]Feature{
......@@ -213,7 +214,7 @@ pub const cpu = struct {
213214 .sm_37,
214215 }),
215216 };
216 pub const sm_50 = Cpu{
217 pub const sm_50 = CpuModel{
217218 .name = "sm_50",
218219 .llvm_name = "sm_50",
219220 .features = featureSet(&[_]Feature{
......@@ -221,7 +222,7 @@ pub const cpu = struct {
221222 .sm_50,
222223 }),
223224 };
224 pub const sm_52 = Cpu{
225 pub const sm_52 = CpuModel{
225226 .name = "sm_52",
226227 .llvm_name = "sm_52",
227228 .features = featureSet(&[_]Feature{
......@@ -229,7 +230,7 @@ pub const cpu = struct {
229230 .sm_52,
230231 }),
231232 };
232 pub const sm_53 = Cpu{
233 pub const sm_53 = CpuModel{
233234 .name = "sm_53",
234235 .llvm_name = "sm_53",
235236 .features = featureSet(&[_]Feature{
......@@ -237,7 +238,7 @@ pub const cpu = struct {
237238 .sm_53,
238239 }),
239240 };
240 pub const sm_60 = Cpu{
241 pub const sm_60 = CpuModel{
241242 .name = "sm_60",
242243 .llvm_name = "sm_60",
243244 .features = featureSet(&[_]Feature{
......@@ -245,7 +246,7 @@ pub const cpu = struct {
245246 .sm_60,
246247 }),
247248 };
248 pub const sm_61 = Cpu{
249 pub const sm_61 = CpuModel{
249250 .name = "sm_61",
250251 .llvm_name = "sm_61",
251252 .features = featureSet(&[_]Feature{
......@@ -253,7 +254,7 @@ pub const cpu = struct {
253254 .sm_61,
254255 }),
255256 };
256 pub const sm_62 = Cpu{
257 pub const sm_62 = CpuModel{
257258 .name = "sm_62",
258259 .llvm_name = "sm_62",
259260 .features = featureSet(&[_]Feature{
......@@ -261,7 +262,7 @@ pub const cpu = struct {
261262 .sm_62,
262263 }),
263264 };
264 pub const sm_70 = Cpu{
265 pub const sm_70 = CpuModel{
265266 .name = "sm_70",
266267 .llvm_name = "sm_70",
267268 .features = featureSet(&[_]Feature{
......@@ -269,7 +270,7 @@ pub const cpu = struct {
269270 .sm_70,
270271 }),
271272 };
272 pub const sm_72 = Cpu{
273 pub const sm_72 = CpuModel{
273274 .name = "sm_72",
274275 .llvm_name = "sm_72",
275276 .features = featureSet(&[_]Feature{
......@@ -277,7 +278,7 @@ pub const cpu = struct {
277278 .sm_72,
278279 }),
279280 };
280 pub const sm_75 = Cpu{
281 pub const sm_75 = CpuModel{
281282 .name = "sm_75",
282283 .llvm_name = "sm_75",
283284 .features = featureSet(&[_]Feature{
......@@ -290,7 +291,7 @@ pub const cpu = struct {
290291/// All nvptx CPUs, sorted alphabetically by name.
291292/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
292293/// compiler has inefficient memory and CPU usage, affecting build times.
293pub const all_cpus = &[_]*const Cpu{
294pub const all_cpus = &[_]*const CpuModel{
294295 &cpu.sm_20,
295296 &cpu.sm_21,
296297 &cpu.sm_30,
lib/std/target/powerpc.zig+43-42
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 @"64bit",
......@@ -55,12 +56,12 @@ pub const Feature = enum {
5556 vsx,
5657};
5758
58pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
59pub usingnamespace CpuFeature.feature_set_fns(Feature);
5960
6061pub const all_features = blk: {
6162 const len = @typeInfo(Feature).Enum.fields.len;
62 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
63 var result: [len]Cpu.Feature = undefined;
63 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
64 var result: [len]CpuFeature = undefined;
6465 result[@enumToInt(Feature.@"64bit")] = .{
6566 .llvm_name = "64bit",
6667 .description = "Enable 64-bit instructions",
......@@ -377,7 +378,7 @@ pub const all_features = blk: {
377378};
378379
379380pub const cpu = struct {
380 pub const @"440" = Cpu{
381 pub const @"440" = CpuModel{
381382 .name = "440",
382383 .llvm_name = "440",
383384 .features = featureSet(&[_]Feature{
......@@ -389,7 +390,7 @@ pub const cpu = struct {
389390 .msync,
390391 }),
391392 };
392 pub const @"450" = Cpu{
393 pub const @"450" = CpuModel{
393394 .name = "450",
394395 .llvm_name = "450",
395396 .features = featureSet(&[_]Feature{
......@@ -401,21 +402,21 @@ pub const cpu = struct {
401402 .msync,
402403 }),
403404 };
404 pub const @"601" = Cpu{
405 pub const @"601" = CpuModel{
405406 .name = "601",
406407 .llvm_name = "601",
407408 .features = featureSet(&[_]Feature{
408409 .fpu,
409410 }),
410411 };
411 pub const @"602" = Cpu{
412 pub const @"602" = CpuModel{
412413 .name = "602",
413414 .llvm_name = "602",
414415 .features = featureSet(&[_]Feature{
415416 .fpu,
416417 }),
417418 };
418 pub const @"603" = Cpu{
419 pub const @"603" = CpuModel{
419420 .name = "603",
420421 .llvm_name = "603",
421422 .features = featureSet(&[_]Feature{
......@@ -423,7 +424,7 @@ pub const cpu = struct {
423424 .frsqrte,
424425 }),
425426 };
426 pub const @"603e" = Cpu{
427 pub const @"603e" = CpuModel{
427428 .name = "603e",
428429 .llvm_name = "603e",
429430 .features = featureSet(&[_]Feature{
......@@ -431,7 +432,7 @@ pub const cpu = struct {
431432 .frsqrte,
432433 }),
433434 };
434 pub const @"603ev" = Cpu{
435 pub const @"603ev" = CpuModel{
435436 .name = "603ev",
436437 .llvm_name = "603ev",
437438 .features = featureSet(&[_]Feature{
......@@ -439,7 +440,7 @@ pub const cpu = struct {
439440 .frsqrte,
440441 }),
441442 };
442 pub const @"604" = Cpu{
443 pub const @"604" = CpuModel{
443444 .name = "604",
444445 .llvm_name = "604",
445446 .features = featureSet(&[_]Feature{
......@@ -447,7 +448,7 @@ pub const cpu = struct {
447448 .frsqrte,
448449 }),
449450 };
450 pub const @"604e" = Cpu{
451 pub const @"604e" = CpuModel{
451452 .name = "604e",
452453 .llvm_name = "604e",
453454 .features = featureSet(&[_]Feature{
......@@ -455,7 +456,7 @@ pub const cpu = struct {
455456 .frsqrte,
456457 }),
457458 };
458 pub const @"620" = Cpu{
459 pub const @"620" = CpuModel{
459460 .name = "620",
460461 .llvm_name = "620",
461462 .features = featureSet(&[_]Feature{
......@@ -463,7 +464,7 @@ pub const cpu = struct {
463464 .frsqrte,
464465 }),
465466 };
466 pub const @"7400" = Cpu{
467 pub const @"7400" = CpuModel{
467468 .name = "7400",
468469 .llvm_name = "7400",
469470 .features = featureSet(&[_]Feature{
......@@ -472,7 +473,7 @@ pub const cpu = struct {
472473 .frsqrte,
473474 }),
474475 };
475 pub const @"7450" = Cpu{
476 pub const @"7450" = CpuModel{
476477 .name = "7450",
477478 .llvm_name = "7450",
478479 .features = featureSet(&[_]Feature{
......@@ -481,7 +482,7 @@ pub const cpu = struct {
481482 .frsqrte,
482483 }),
483484 };
484 pub const @"750" = Cpu{
485 pub const @"750" = CpuModel{
485486 .name = "750",
486487 .llvm_name = "750",
487488 .features = featureSet(&[_]Feature{
......@@ -489,7 +490,7 @@ pub const cpu = struct {
489490 .frsqrte,
490491 }),
491492 };
492 pub const @"970" = Cpu{
493 pub const @"970" = CpuModel{
493494 .name = "970",
494495 .llvm_name = "970",
495496 .features = featureSet(&[_]Feature{
......@@ -502,7 +503,7 @@ pub const cpu = struct {
502503 .stfiwx,
503504 }),
504505 };
505 pub const a2 = Cpu{
506 pub const a2 = CpuModel{
506507 .name = "a2",
507508 .llvm_name = "a2",
508509 .features = featureSet(&[_]Feature{
......@@ -527,7 +528,7 @@ pub const cpu = struct {
527528 .stfiwx,
528529 }),
529530 };
530 pub const a2q = Cpu{
531 pub const a2q = CpuModel{
531532 .name = "a2q",
532533 .llvm_name = "a2q",
533534 .features = featureSet(&[_]Feature{
......@@ -553,7 +554,7 @@ pub const cpu = struct {
553554 .stfiwx,
554555 }),
555556 };
556 pub const e500 = Cpu{
557 pub const e500 = CpuModel{
557558 .name = "e500",
558559 .llvm_name = "e500",
559560 .features = featureSet(&[_]Feature{
......@@ -562,7 +563,7 @@ pub const cpu = struct {
562563 .isel,
563564 }),
564565 };
565 pub const e500mc = Cpu{
566 pub const e500mc = CpuModel{
566567 .name = "e500mc",
567568 .llvm_name = "e500mc",
568569 .features = featureSet(&[_]Feature{
......@@ -572,7 +573,7 @@ pub const cpu = struct {
572573 .stfiwx,
573574 }),
574575 };
575 pub const e5500 = Cpu{
576 pub const e5500 = CpuModel{
576577 .name = "e5500",
577578 .llvm_name = "e5500",
578579 .features = featureSet(&[_]Feature{
......@@ -584,7 +585,7 @@ pub const cpu = struct {
584585 .stfiwx,
585586 }),
586587 };
587 pub const g3 = Cpu{
588 pub const g3 = CpuModel{
588589 .name = "g3",
589590 .llvm_name = "g3",
590591 .features = featureSet(&[_]Feature{
......@@ -592,7 +593,7 @@ pub const cpu = struct {
592593 .frsqrte,
593594 }),
594595 };
595 pub const g4 = Cpu{
596 pub const g4 = CpuModel{
596597 .name = "g4",
597598 .llvm_name = "g4",
598599 .features = featureSet(&[_]Feature{
......@@ -601,7 +602,7 @@ pub const cpu = struct {
601602 .frsqrte,
602603 }),
603604 };
604 pub const @"g4+" = Cpu{
605 pub const @"g4+" = CpuModel{
605606 .name = "g4+",
606607 .llvm_name = "g4+",
607608 .features = featureSet(&[_]Feature{
......@@ -610,7 +611,7 @@ pub const cpu = struct {
610611 .frsqrte,
611612 }),
612613 };
613 pub const g5 = Cpu{
614 pub const g5 = CpuModel{
614615 .name = "g5",
615616 .llvm_name = "g5",
616617 .features = featureSet(&[_]Feature{
......@@ -623,28 +624,28 @@ pub const cpu = struct {
623624 .stfiwx,
624625 }),
625626 };
626 pub const generic = Cpu{
627 pub const generic = CpuModel{
627628 .name = "generic",
628629 .llvm_name = "generic",
629630 .features = featureSet(&[_]Feature{
630631 .hard_float,
631632 }),
632633 };
633 pub const ppc = Cpu{
634 pub const ppc = CpuModel{
634635 .name = "ppc",
635636 .llvm_name = "ppc",
636637 .features = featureSet(&[_]Feature{
637638 .hard_float,
638639 }),
639640 };
640 pub const ppc32 = Cpu{
641 pub const ppc32 = CpuModel{
641642 .name = "ppc32",
642643 .llvm_name = "ppc32",
643644 .features = featureSet(&[_]Feature{
644645 .hard_float,
645646 }),
646647 };
647 pub const ppc64 = Cpu{
648 pub const ppc64 = CpuModel{
648649 .name = "ppc64",
649650 .llvm_name = "ppc64",
650651 .features = featureSet(&[_]Feature{
......@@ -657,7 +658,7 @@ pub const cpu = struct {
657658 .stfiwx,
658659 }),
659660 };
660 pub const ppc64le = Cpu{
661 pub const ppc64le = CpuModel{
661662 .name = "ppc64le",
662663 .llvm_name = "ppc64le",
663664 .features = featureSet(&[_]Feature{
......@@ -692,7 +693,7 @@ pub const cpu = struct {
692693 .vsx,
693694 }),
694695 };
695 pub const pwr3 = Cpu{
696 pub const pwr3 = CpuModel{
696697 .name = "pwr3",
697698 .llvm_name = "pwr3",
698699 .features = featureSet(&[_]Feature{
......@@ -704,7 +705,7 @@ pub const cpu = struct {
704705 .stfiwx,
705706 }),
706707 };
707 pub const pwr4 = Cpu{
708 pub const pwr4 = CpuModel{
708709 .name = "pwr4",
709710 .llvm_name = "pwr4",
710711 .features = featureSet(&[_]Feature{
......@@ -717,7 +718,7 @@ pub const cpu = struct {
717718 .stfiwx,
718719 }),
719720 };
720 pub const pwr5 = Cpu{
721 pub const pwr5 = CpuModel{
721722 .name = "pwr5",
722723 .llvm_name = "pwr5",
723724 .features = featureSet(&[_]Feature{
......@@ -732,7 +733,7 @@ pub const cpu = struct {
732733 .stfiwx,
733734 }),
734735 };
735 pub const pwr5x = Cpu{
736 pub const pwr5x = CpuModel{
736737 .name = "pwr5x",
737738 .llvm_name = "pwr5x",
738739 .features = featureSet(&[_]Feature{
......@@ -748,7 +749,7 @@ pub const cpu = struct {
748749 .stfiwx,
749750 }),
750751 };
751 pub const pwr6 = Cpu{
752 pub const pwr6 = CpuModel{
752753 .name = "pwr6",
753754 .llvm_name = "pwr6",
754755 .features = featureSet(&[_]Feature{
......@@ -768,7 +769,7 @@ pub const cpu = struct {
768769 .stfiwx,
769770 }),
770771 };
771 pub const pwr6x = Cpu{
772 pub const pwr6x = CpuModel{
772773 .name = "pwr6x",
773774 .llvm_name = "pwr6x",
774775 .features = featureSet(&[_]Feature{
......@@ -788,7 +789,7 @@ pub const cpu = struct {
788789 .stfiwx,
789790 }),
790791 };
791 pub const pwr7 = Cpu{
792 pub const pwr7 = CpuModel{
792793 .name = "pwr7",
793794 .llvm_name = "pwr7",
794795 .features = featureSet(&[_]Feature{
......@@ -816,7 +817,7 @@ pub const cpu = struct {
816817 .vsx,
817818 }),
818819 };
819 pub const pwr8 = Cpu{
820 pub const pwr8 = CpuModel{
820821 .name = "pwr8",
821822 .llvm_name = "pwr8",
822823 .features = featureSet(&[_]Feature{
......@@ -851,7 +852,7 @@ pub const cpu = struct {
851852 .vsx,
852853 }),
853854 };
854 pub const pwr9 = Cpu{
855 pub const pwr9 = CpuModel{
855856 .name = "pwr9",
856857 .llvm_name = "pwr9",
857858 .features = featureSet(&[_]Feature{
......@@ -897,7 +898,7 @@ pub const cpu = struct {
897898/// All powerpc CPUs, sorted alphabetically by name.
898899/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
899900/// compiler has inefficient memory and CPU usage, affecting build times.
900pub const all_cpus = &[_]*const Cpu{
901pub const all_cpus = &[_]*const CpuModel{
901902 &cpu.@"440",
902903 &cpu.@"450",
903904 &cpu.@"601",
lib/std/target/riscv.zig+10-9
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 @"64bit",
......@@ -12,12 +13,12 @@ pub const Feature = enum {
1213 relax,
1314};
1415
15pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
16pub usingnamespace CpuFeature.feature_set_fns(Feature);
1617
1718pub const all_features = blk: {
1819 const len = @typeInfo(Feature).Enum.fields.len;
19 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
20 var result: [len]Cpu.Feature = undefined;
20 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
21 var result: [len]CpuFeature = undefined;
2122 result[@enumToInt(Feature.@"64bit")] = .{
2223 .llvm_name = "64bit",
2324 .description = "Implements RV64",
......@@ -69,7 +70,7 @@ pub const all_features = blk: {
6970};
7071
7172pub const cpu = struct {
72 pub const baseline_rv32 = Cpu{
73 pub const baseline_rv32 = CpuModel{
7374 .name = "baseline_rv32",
7475 .llvm_name = "generic-rv32",
7576 .features = featureSet(&[_]Feature{
......@@ -81,7 +82,7 @@ pub const cpu = struct {
8182 }),
8283 };
8384
84 pub const baseline_rv64 = Cpu{
85 pub const baseline_rv64 = CpuModel{
8586 .name = "baseline_rv64",
8687 .llvm_name = "generic-rv64",
8788 .features = featureSet(&[_]Feature{
......@@ -94,13 +95,13 @@ pub const cpu = struct {
9495 }),
9596 };
9697
97 pub const generic_rv32 = Cpu{
98 pub const generic_rv32 = CpuModel{
9899 .name = "generic_rv32",
99100 .llvm_name = "generic-rv32",
100101 .features = featureSet(&[_]Feature{}),
101102 };
102103
103 pub const generic_rv64 = Cpu{
104 pub const generic_rv64 = CpuModel{
104105 .name = "generic_rv64",
105106 .llvm_name = "generic-rv64",
106107 .features = featureSet(&[_]Feature{
......@@ -112,7 +113,7 @@ pub const cpu = struct {
112113/// All riscv CPUs, sorted alphabetically by name.
113114/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
114115/// compiler has inefficient memory and CPU usage, affecting build times.
115pub const all_cpus = &[_]*const Cpu{
116pub const all_cpus = &[_]*const CpuModel{
116117 &cpu.baseline_rv32,
117118 &cpu.baseline_rv64,
118119 &cpu.generic_rv32,
lib/std/target/sparc.zig+46-45
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 deprecated_v8,
......@@ -23,12 +24,12 @@ pub const Feature = enum {
2324 vis3,
2425};
2526
26pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
27pub usingnamespace CpuFeature.feature_set_fns(Feature);
2728
2829pub const all_features = blk: {
2930 const len = @typeInfo(Feature).Enum.fields.len;
30 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
31 var result: [len]Cpu.Feature = undefined;
31 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
32 var result: [len]CpuFeature = undefined;
3233 result[@enumToInt(Feature.deprecated_v8)] = .{
3334 .llvm_name = "deprecated-v8",
3435 .description = "Enable deprecated V8 instructions in V9 mode",
......@@ -133,7 +134,7 @@ pub const all_features = blk: {
133134};
134135
135136pub const cpu = struct {
136 pub const at697e = Cpu{
137 pub const at697e = CpuModel{
137138 .name = "at697e",
138139 .llvm_name = "at697e",
139140 .features = featureSet(&[_]Feature{
......@@ -141,7 +142,7 @@ pub const cpu = struct {
141142 .leon,
142143 }),
143144 };
144 pub const at697f = Cpu{
145 pub const at697f = CpuModel{
145146 .name = "at697f",
146147 .llvm_name = "at697f",
147148 .features = featureSet(&[_]Feature{
......@@ -149,17 +150,17 @@ pub const cpu = struct {
149150 .leon,
150151 }),
151152 };
152 pub const f934 = Cpu{
153 pub const f934 = CpuModel{
153154 .name = "f934",
154155 .llvm_name = "f934",
155156 .features = featureSet(&[_]Feature{}),
156157 };
157 pub const generic = Cpu{
158 pub const generic = CpuModel{
158159 .name = "generic",
159160 .llvm_name = "generic",
160161 .features = featureSet(&[_]Feature{}),
161162 };
162 pub const gr712rc = Cpu{
163 pub const gr712rc = CpuModel{
163164 .name = "gr712rc",
164165 .llvm_name = "gr712rc",
165166 .features = featureSet(&[_]Feature{
......@@ -167,7 +168,7 @@ pub const cpu = struct {
167168 .leon,
168169 }),
169170 };
170 pub const gr740 = Cpu{
171 pub const gr740 = CpuModel{
171172 .name = "gr740",
172173 .llvm_name = "gr740",
173174 .features = featureSet(&[_]Feature{
......@@ -178,19 +179,19 @@ pub const cpu = struct {
178179 .leonpwrpsr,
179180 }),
180181 };
181 pub const hypersparc = Cpu{
182 pub const hypersparc = CpuModel{
182183 .name = "hypersparc",
183184 .llvm_name = "hypersparc",
184185 .features = featureSet(&[_]Feature{}),
185186 };
186 pub const leon2 = Cpu{
187 pub const leon2 = CpuModel{
187188 .name = "leon2",
188189 .llvm_name = "leon2",
189190 .features = featureSet(&[_]Feature{
190191 .leon,
191192 }),
192193 };
193 pub const leon3 = Cpu{
194 pub const leon3 = CpuModel{
194195 .name = "leon3",
195196 .llvm_name = "leon3",
196197 .features = featureSet(&[_]Feature{
......@@ -198,7 +199,7 @@ pub const cpu = struct {
198199 .leon,
199200 }),
200201 };
201 pub const leon4 = Cpu{
202 pub const leon4 = CpuModel{
202203 .name = "leon4",
203204 .llvm_name = "leon4",
204205 .features = featureSet(&[_]Feature{
......@@ -207,7 +208,7 @@ pub const cpu = struct {
207208 .leon,
208209 }),
209210 };
210 pub const ma2080 = Cpu{
211 pub const ma2080 = CpuModel{
211212 .name = "ma2080",
212213 .llvm_name = "ma2080",
213214 .features = featureSet(&[_]Feature{
......@@ -215,7 +216,7 @@ pub const cpu = struct {
215216 .leon,
216217 }),
217218 };
218 pub const ma2085 = Cpu{
219 pub const ma2085 = CpuModel{
219220 .name = "ma2085",
220221 .llvm_name = "ma2085",
221222 .features = featureSet(&[_]Feature{
......@@ -223,7 +224,7 @@ pub const cpu = struct {
223224 .leon,
224225 }),
225226 };
226 pub const ma2100 = Cpu{
227 pub const ma2100 = CpuModel{
227228 .name = "ma2100",
228229 .llvm_name = "ma2100",
229230 .features = featureSet(&[_]Feature{
......@@ -231,7 +232,7 @@ pub const cpu = struct {
231232 .leon,
232233 }),
233234 };
234 pub const ma2150 = Cpu{
235 pub const ma2150 = CpuModel{
235236 .name = "ma2150",
236237 .llvm_name = "ma2150",
237238 .features = featureSet(&[_]Feature{
......@@ -239,7 +240,7 @@ pub const cpu = struct {
239240 .leon,
240241 }),
241242 };
242 pub const ma2155 = Cpu{
243 pub const ma2155 = CpuModel{
243244 .name = "ma2155",
244245 .llvm_name = "ma2155",
245246 .features = featureSet(&[_]Feature{
......@@ -247,7 +248,7 @@ pub const cpu = struct {
247248 .leon,
248249 }),
249250 };
250 pub const ma2450 = Cpu{
251 pub const ma2450 = CpuModel{
251252 .name = "ma2450",
252253 .llvm_name = "ma2450",
253254 .features = featureSet(&[_]Feature{
......@@ -255,7 +256,7 @@ pub const cpu = struct {
255256 .leon,
256257 }),
257258 };
258 pub const ma2455 = Cpu{
259 pub const ma2455 = CpuModel{
259260 .name = "ma2455",
260261 .llvm_name = "ma2455",
261262 .features = featureSet(&[_]Feature{
......@@ -263,7 +264,7 @@ pub const cpu = struct {
263264 .leon,
264265 }),
265266 };
266 pub const ma2480 = Cpu{
267 pub const ma2480 = CpuModel{
267268 .name = "ma2480",
268269 .llvm_name = "ma2480",
269270 .features = featureSet(&[_]Feature{
......@@ -271,7 +272,7 @@ pub const cpu = struct {
271272 .leon,
272273 }),
273274 };
274 pub const ma2485 = Cpu{
275 pub const ma2485 = CpuModel{
275276 .name = "ma2485",
276277 .llvm_name = "ma2485",
277278 .features = featureSet(&[_]Feature{
......@@ -279,7 +280,7 @@ pub const cpu = struct {
279280 .leon,
280281 }),
281282 };
282 pub const ma2x5x = Cpu{
283 pub const ma2x5x = CpuModel{
283284 .name = "ma2x5x",
284285 .llvm_name = "ma2x5x",
285286 .features = featureSet(&[_]Feature{
......@@ -287,7 +288,7 @@ pub const cpu = struct {
287288 .leon,
288289 }),
289290 };
290 pub const ma2x8x = Cpu{
291 pub const ma2x8x = CpuModel{
291292 .name = "ma2x8x",
292293 .llvm_name = "ma2x8x",
293294 .features = featureSet(&[_]Feature{
......@@ -295,7 +296,7 @@ pub const cpu = struct {
295296 .leon,
296297 }),
297298 };
298 pub const myriad2 = Cpu{
299 pub const myriad2 = CpuModel{
299300 .name = "myriad2",
300301 .llvm_name = "myriad2",
301302 .features = featureSet(&[_]Feature{
......@@ -303,7 +304,7 @@ pub const cpu = struct {
303304 .leon,
304305 }),
305306 };
306 pub const myriad2_1 = Cpu{
307 pub const myriad2_1 = CpuModel{
307308 .name = "myriad2_1",
308309 .llvm_name = "myriad2.1",
309310 .features = featureSet(&[_]Feature{
......@@ -311,7 +312,7 @@ pub const cpu = struct {
311312 .leon,
312313 }),
313314 };
314 pub const myriad2_2 = Cpu{
315 pub const myriad2_2 = CpuModel{
315316 .name = "myriad2_2",
316317 .llvm_name = "myriad2.2",
317318 .features = featureSet(&[_]Feature{
......@@ -319,7 +320,7 @@ pub const cpu = struct {
319320 .leon,
320321 }),
321322 };
322 pub const myriad2_3 = Cpu{
323 pub const myriad2_3 = CpuModel{
323324 .name = "myriad2_3",
324325 .llvm_name = "myriad2.3",
325326 .features = featureSet(&[_]Feature{
......@@ -327,7 +328,7 @@ pub const cpu = struct {
327328 .leon,
328329 }),
329330 };
330 pub const niagara = Cpu{
331 pub const niagara = CpuModel{
331332 .name = "niagara",
332333 .llvm_name = "niagara",
333334 .features = featureSet(&[_]Feature{
......@@ -337,7 +338,7 @@ pub const cpu = struct {
337338 .vis2,
338339 }),
339340 };
340 pub const niagara2 = Cpu{
341 pub const niagara2 = CpuModel{
341342 .name = "niagara2",
342343 .llvm_name = "niagara2",
343344 .features = featureSet(&[_]Feature{
......@@ -348,7 +349,7 @@ pub const cpu = struct {
348349 .vis2,
349350 }),
350351 };
351 pub const niagara3 = Cpu{
352 pub const niagara3 = CpuModel{
352353 .name = "niagara3",
353354 .llvm_name = "niagara3",
354355 .features = featureSet(&[_]Feature{
......@@ -359,7 +360,7 @@ pub const cpu = struct {
359360 .vis2,
360361 }),
361362 };
362 pub const niagara4 = Cpu{
363 pub const niagara4 = CpuModel{
363364 .name = "niagara4",
364365 .llvm_name = "niagara4",
365366 .features = featureSet(&[_]Feature{
......@@ -371,32 +372,32 @@ pub const cpu = struct {
371372 .vis3,
372373 }),
373374 };
374 pub const sparclet = Cpu{
375 pub const sparclet = CpuModel{
375376 .name = "sparclet",
376377 .llvm_name = "sparclet",
377378 .features = featureSet(&[_]Feature{}),
378379 };
379 pub const sparclite = Cpu{
380 pub const sparclite = CpuModel{
380381 .name = "sparclite",
381382 .llvm_name = "sparclite",
382383 .features = featureSet(&[_]Feature{}),
383384 };
384 pub const sparclite86x = Cpu{
385 pub const sparclite86x = CpuModel{
385386 .name = "sparclite86x",
386387 .llvm_name = "sparclite86x",
387388 .features = featureSet(&[_]Feature{}),
388389 };
389 pub const supersparc = Cpu{
390 pub const supersparc = CpuModel{
390391 .name = "supersparc",
391392 .llvm_name = "supersparc",
392393 .features = featureSet(&[_]Feature{}),
393394 };
394 pub const tsc701 = Cpu{
395 pub const tsc701 = CpuModel{
395396 .name = "tsc701",
396397 .llvm_name = "tsc701",
397398 .features = featureSet(&[_]Feature{}),
398399 };
399 pub const ultrasparc = Cpu{
400 pub const ultrasparc = CpuModel{
400401 .name = "ultrasparc",
401402 .llvm_name = "ultrasparc",
402403 .features = featureSet(&[_]Feature{
......@@ -405,7 +406,7 @@ pub const cpu = struct {
405406 .vis,
406407 }),
407408 };
408 pub const ultrasparc3 = Cpu{
409 pub const ultrasparc3 = CpuModel{
409410 .name = "ultrasparc3",
410411 .llvm_name = "ultrasparc3",
411412 .features = featureSet(&[_]Feature{
......@@ -415,7 +416,7 @@ pub const cpu = struct {
415416 .vis2,
416417 }),
417418 };
418 pub const ut699 = Cpu{
419 pub const ut699 = CpuModel{
419420 .name = "ut699",
420421 .llvm_name = "ut699",
421422 .features = featureSet(&[_]Feature{
......@@ -426,7 +427,7 @@ pub const cpu = struct {
426427 .no_fsmuld,
427428 }),
428429 };
429 pub const v7 = Cpu{
430 pub const v7 = CpuModel{
430431 .name = "v7",
431432 .llvm_name = "v7",
432433 .features = featureSet(&[_]Feature{
......@@ -434,12 +435,12 @@ pub const cpu = struct {
434435 .soft_mul_div,
435436 }),
436437 };
437 pub const v8 = Cpu{
438 pub const v8 = CpuModel{
438439 .name = "v8",
439440 .llvm_name = "v8",
440441 .features = featureSet(&[_]Feature{}),
441442 };
442 pub const v9 = Cpu{
443 pub const v9 = CpuModel{
443444 .name = "v9",
444445 .llvm_name = "v9",
445446 .features = featureSet(&[_]Feature{
......@@ -451,7 +452,7 @@ pub const cpu = struct {
451452/// All sparc CPUs, sorted alphabetically by name.
452453/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
453454/// compiler has inefficient memory and CPU usage, affecting build times.
454pub const all_cpus = &[_]*const Cpu{
455pub const all_cpus = &[_]*const CpuModel{
455456 &cpu.at697e,
456457 &cpu.at697f,
457458 &cpu.f934,
lib/std/target/systemz.zig+18-17
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 deflate_conversion,
......@@ -39,12 +40,12 @@ pub const Feature = enum {
3940 vector_packed_decimal_enhancement,
4041};
4142
42pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
43pub usingnamespace CpuFeature.feature_set_fns(Feature);
4344
4445pub const all_features = blk: {
4546 const len = @typeInfo(Feature).Enum.fields.len;
46 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
47 var result: [len]Cpu.Feature = undefined;
47 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
48 var result: [len]CpuFeature = undefined;
4849 result[@enumToInt(Feature.deflate_conversion)] = .{
4950 .llvm_name = "deflate-conversion",
5051 .description = "Assume that the deflate-conversion facility is installed",
......@@ -229,7 +230,7 @@ pub const all_features = blk: {
229230};
230231
231232pub const cpu = struct {
232 pub const arch10 = Cpu{
233 pub const arch10 = CpuModel{
233234 .name = "arch10",
234235 .llvm_name = "arch10",
235236 .features = featureSet(&[_]Feature{
......@@ -252,7 +253,7 @@ pub const cpu = struct {
252253 .transactional_execution,
253254 }),
254255 };
255 pub const arch11 = Cpu{
256 pub const arch11 = CpuModel{
256257 .name = "arch11",
257258 .llvm_name = "arch11",
258259 .features = featureSet(&[_]Feature{
......@@ -280,7 +281,7 @@ pub const cpu = struct {
280281 .vector,
281282 }),
282283 };
283 pub const arch12 = Cpu{
284 pub const arch12 = CpuModel{
284285 .name = "arch12",
285286 .llvm_name = "arch12",
286287 .features = featureSet(&[_]Feature{
......@@ -315,7 +316,7 @@ pub const cpu = struct {
315316 .vector_packed_decimal,
316317 }),
317318 };
318 pub const arch13 = Cpu{
319 pub const arch13 = CpuModel{
319320 .name = "arch13",
320321 .llvm_name = "arch13",
321322 .features = featureSet(&[_]Feature{
......@@ -356,12 +357,12 @@ pub const cpu = struct {
356357 .vector_packed_decimal_enhancement,
357358 }),
358359 };
359 pub const arch8 = Cpu{
360 pub const arch8 = CpuModel{
360361 .name = "arch8",
361362 .llvm_name = "arch8",
362363 .features = featureSet(&[_]Feature{}),
363364 };
364 pub const arch9 = Cpu{
365 pub const arch9 = CpuModel{
365366 .name = "arch9",
366367 .llvm_name = "arch9",
367368 .features = featureSet(&[_]Feature{
......@@ -377,17 +378,17 @@ pub const cpu = struct {
377378 .reset_reference_bits_multiple,
378379 }),
379380 };
380 pub const generic = Cpu{
381 pub const generic = CpuModel{
381382 .name = "generic",
382383 .llvm_name = "generic",
383384 .features = featureSet(&[_]Feature{}),
384385 };
385 pub const z10 = Cpu{
386 pub const z10 = CpuModel{
386387 .name = "z10",
387388 .llvm_name = "z10",
388389 .features = featureSet(&[_]Feature{}),
389390 };
390 pub const z13 = Cpu{
391 pub const z13 = CpuModel{
391392 .name = "z13",
392393 .llvm_name = "z13",
393394 .features = featureSet(&[_]Feature{
......@@ -415,7 +416,7 @@ pub const cpu = struct {
415416 .vector,
416417 }),
417418 };
418 pub const z14 = Cpu{
419 pub const z14 = CpuModel{
419420 .name = "z14",
420421 .llvm_name = "z14",
421422 .features = featureSet(&[_]Feature{
......@@ -450,7 +451,7 @@ pub const cpu = struct {
450451 .vector_packed_decimal,
451452 }),
452453 };
453 pub const z196 = Cpu{
454 pub const z196 = CpuModel{
454455 .name = "z196",
455456 .llvm_name = "z196",
456457 .features = featureSet(&[_]Feature{
......@@ -466,7 +467,7 @@ pub const cpu = struct {
466467 .reset_reference_bits_multiple,
467468 }),
468469 };
469 pub const zEC12 = Cpu{
470 pub const zEC12 = CpuModel{
470471 .name = "zEC12",
471472 .llvm_name = "zEC12",
472473 .features = featureSet(&[_]Feature{
......@@ -494,7 +495,7 @@ pub const cpu = struct {
494495/// All systemz CPUs, sorted alphabetically by name.
495496/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
496497/// compiler has inefficient memory and CPU usage, affecting build times.
497pub const all_cpus = &[_]*const Cpu{
498pub const all_cpus = &[_]*const CpuModel{
498499 &cpu.arch10,
499500 &cpu.arch11,
500501 &cpu.arch12,
lib/std/target/wasm.zig+9-8
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 atomics,
......@@ -14,12 +15,12 @@ pub const Feature = enum {
1415 unimplemented_simd128,
1516};
1617
17pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
18pub usingnamespace CpuFeature.feature_set_fns(Feature);
1819
1920pub const all_features = blk: {
2021 const len = @typeInfo(Feature).Enum.fields.len;
21 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
22 var result: [len]Cpu.Feature = undefined;
22 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
23 var result: [len]CpuFeature = undefined;
2324 result[@enumToInt(Feature.atomics)] = .{
2425 .llvm_name = "atomics",
2526 .description = "Enable Atomics",
......@@ -81,7 +82,7 @@ pub const all_features = blk: {
8182};
8283
8384pub const cpu = struct {
84 pub const bleeding_edge = Cpu{
85 pub const bleeding_edge = CpuModel{
8586 .name = "bleeding_edge",
8687 .llvm_name = "bleeding-edge",
8788 .features = featureSet(&[_]Feature{
......@@ -92,12 +93,12 @@ pub const cpu = struct {
9293 .simd128,
9394 }),
9495 };
95 pub const generic = Cpu{
96 pub const generic = CpuModel{
9697 .name = "generic",
9798 .llvm_name = "generic",
9899 .features = featureSet(&[_]Feature{}),
99100 };
100 pub const mvp = Cpu{
101 pub const mvp = CpuModel{
101102 .name = "mvp",
102103 .llvm_name = "mvp",
103104 .features = featureSet(&[_]Feature{}),
......@@ -107,7 +108,7 @@ pub const cpu = struct {
107108/// All wasm CPUs, sorted alphabetically by name.
108109/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
109110/// compiler has inefficient memory and CPU usage, affecting build times.
110pub const all_cpus = &[_]*const Cpu{
111pub const all_cpus = &[_]*const CpuModel{
111112 &cpu.bleeding_edge,
112113 &cpu.generic,
113114 &cpu.mvp,
lib/std/target/x86.zig+84-83
......@@ -1,5 +1,6 @@
11const std = @import("../std.zig");
2const Cpu = std.Target.Cpu;
2const CpuFeature = std.Target.Cpu.Feature;
3const CpuModel = std.Target.Cpu.Model;
34
45pub const Feature = enum {
56 @"3dnow",
......@@ -125,12 +126,12 @@ pub const Feature = enum {
125126 xsaves,
126127};
127128
128pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
129pub usingnamespace CpuFeature.feature_set_fns(Feature);
129130
130131pub const all_features = blk: {
131132 const len = @typeInfo(Feature).Enum.fields.len;
132 std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
133 var result: [len]Cpu.Feature = undefined;
133 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
134 var result: [len]CpuFeature = undefined;
134135 result[@enumToInt(Feature.@"3dnow")] = .{
135136 .llvm_name = "3dnow",
136137 .description = "Enable 3DNow! instructions",
......@@ -829,7 +830,7 @@ pub const all_features = blk: {
829830};
830831
831832pub const cpu = struct {
832 pub const amdfam10 = Cpu{
833 pub const amdfam10 = CpuModel{
833834 .name = "amdfam10",
834835 .llvm_name = "amdfam10",
835836 .features = featureSet(&[_]Feature{
......@@ -849,7 +850,7 @@ pub const cpu = struct {
849850 .x87,
850851 }),
851852 };
852 pub const athlon = Cpu{
853 pub const athlon = CpuModel{
853854 .name = "athlon",
854855 .llvm_name = "athlon",
855856 .features = featureSet(&[_]Feature{
......@@ -862,7 +863,7 @@ pub const cpu = struct {
862863 .x87,
863864 }),
864865 };
865 pub const athlon_4 = Cpu{
866 pub const athlon_4 = CpuModel{
866867 .name = "athlon_4",
867868 .llvm_name = "athlon-4",
868869 .features = featureSet(&[_]Feature{
......@@ -877,7 +878,7 @@ pub const cpu = struct {
877878 .x87,
878879 }),
879880 };
880 pub const athlon_fx = Cpu{
881 pub const athlon_fx = CpuModel{
881882 .name = "athlon_fx",
882883 .llvm_name = "athlon-fx",
883884 .features = featureSet(&[_]Feature{
......@@ -894,7 +895,7 @@ pub const cpu = struct {
894895 .x87,
895896 }),
896897 };
897 pub const athlon_mp = Cpu{
898 pub const athlon_mp = CpuModel{
898899 .name = "athlon_mp",
899900 .llvm_name = "athlon-mp",
900901 .features = featureSet(&[_]Feature{
......@@ -909,7 +910,7 @@ pub const cpu = struct {
909910 .x87,
910911 }),
911912 };
912 pub const athlon_tbird = Cpu{
913 pub const athlon_tbird = CpuModel{
913914 .name = "athlon_tbird",
914915 .llvm_name = "athlon-tbird",
915916 .features = featureSet(&[_]Feature{
......@@ -922,7 +923,7 @@ pub const cpu = struct {
922923 .x87,
923924 }),
924925 };
925 pub const athlon_xp = Cpu{
926 pub const athlon_xp = CpuModel{
926927 .name = "athlon_xp",
927928 .llvm_name = "athlon-xp",
928929 .features = featureSet(&[_]Feature{
......@@ -937,7 +938,7 @@ pub const cpu = struct {
937938 .x87,
938939 }),
939940 };
940 pub const athlon64 = Cpu{
941 pub const athlon64 = CpuModel{
941942 .name = "athlon64",
942943 .llvm_name = "athlon64",
943944 .features = featureSet(&[_]Feature{
......@@ -954,7 +955,7 @@ pub const cpu = struct {
954955 .x87,
955956 }),
956957 };
957 pub const athlon64_sse3 = Cpu{
958 pub const athlon64_sse3 = CpuModel{
958959 .name = "athlon64_sse3",
959960 .llvm_name = "athlon64-sse3",
960961 .features = featureSet(&[_]Feature{
......@@ -972,7 +973,7 @@ pub const cpu = struct {
972973 .x87,
973974 }),
974975 };
975 pub const atom = Cpu{
976 pub const atom = CpuModel{
976977 .name = "atom",
977978 .llvm_name = "atom",
978979 .features = featureSet(&[_]Feature{
......@@ -996,7 +997,7 @@ pub const cpu = struct {
996997 .x87,
997998 }),
998999 };
999 pub const barcelona = Cpu{
1000 pub const barcelona = CpuModel{
10001001 .name = "barcelona",
10011002 .llvm_name = "barcelona",
10021003 .features = featureSet(&[_]Feature{
......@@ -1016,7 +1017,7 @@ pub const cpu = struct {
10161017 .x87,
10171018 }),
10181019 };
1019 pub const bdver1 = Cpu{
1020 pub const bdver1 = CpuModel{
10201021 .name = "bdver1",
10211022 .llvm_name = "bdver1",
10221023 .features = featureSet(&[_]Feature{
......@@ -1043,7 +1044,7 @@ pub const cpu = struct {
10431044 .xsave,
10441045 }),
10451046 };
1046 pub const bdver2 = Cpu{
1047 pub const bdver2 = CpuModel{
10471048 .name = "bdver2",
10481049 .llvm_name = "bdver2",
10491050 .features = featureSet(&[_]Feature{
......@@ -1075,7 +1076,7 @@ pub const cpu = struct {
10751076 .xsave,
10761077 }),
10771078 };
1078 pub const bdver3 = Cpu{
1079 pub const bdver3 = CpuModel{
10791080 .name = "bdver3",
10801081 .llvm_name = "bdver3",
10811082 .features = featureSet(&[_]Feature{
......@@ -1109,7 +1110,7 @@ pub const cpu = struct {
11091110 .xsaveopt,
11101111 }),
11111112 };
1112 pub const bdver4 = Cpu{
1113 pub const bdver4 = CpuModel{
11131114 .name = "bdver4",
11141115 .llvm_name = "bdver4",
11151116 .features = featureSet(&[_]Feature{
......@@ -1146,7 +1147,7 @@ pub const cpu = struct {
11461147 .xsaveopt,
11471148 }),
11481149 };
1149 pub const bonnell = Cpu{
1150 pub const bonnell = CpuModel{
11501151 .name = "bonnell",
11511152 .llvm_name = "bonnell",
11521153 .features = featureSet(&[_]Feature{
......@@ -1170,7 +1171,7 @@ pub const cpu = struct {
11701171 .x87,
11711172 }),
11721173 };
1173 pub const broadwell = Cpu{
1174 pub const broadwell = CpuModel{
11741175 .name = "broadwell",
11751176 .llvm_name = "broadwell",
11761177 .features = featureSet(&[_]Feature{
......@@ -1214,7 +1215,7 @@ pub const cpu = struct {
12141215 .xsaveopt,
12151216 }),
12161217 };
1217 pub const btver1 = Cpu{
1218 pub const btver1 = CpuModel{
12181219 .name = "btver1",
12191220 .llvm_name = "btver1",
12201221 .features = featureSet(&[_]Feature{
......@@ -1238,7 +1239,7 @@ pub const cpu = struct {
12381239 .x87,
12391240 }),
12401241 };
1241 pub const btver2 = Cpu{
1242 pub const btver2 = CpuModel{
12421243 .name = "btver2",
12431244 .llvm_name = "btver2",
12441245 .features = featureSet(&[_]Feature{
......@@ -1274,7 +1275,7 @@ pub const cpu = struct {
12741275 .xsaveopt,
12751276 }),
12761277 };
1277 pub const c3 = Cpu{
1278 pub const c3 = CpuModel{
12781279 .name = "c3",
12791280 .llvm_name = "c3",
12801281 .features = featureSet(&[_]Feature{
......@@ -1283,7 +1284,7 @@ pub const cpu = struct {
12831284 .x87,
12841285 }),
12851286 };
1286 pub const c3_2 = Cpu{
1287 pub const c3_2 = CpuModel{
12871288 .name = "c3_2",
12881289 .llvm_name = "c3-2",
12891290 .features = featureSet(&[_]Feature{
......@@ -1296,7 +1297,7 @@ pub const cpu = struct {
12961297 .x87,
12971298 }),
12981299 };
1299 pub const cannonlake = Cpu{
1300 pub const cannonlake = CpuModel{
13001301 .name = "cannonlake",
13011302 .llvm_name = "cannonlake",
13021303 .features = featureSet(&[_]Feature{
......@@ -1355,7 +1356,7 @@ pub const cpu = struct {
13551356 .xsaves,
13561357 }),
13571358 };
1358 pub const cascadelake = Cpu{
1359 pub const cascadelake = CpuModel{
13591360 .name = "cascadelake",
13601361 .llvm_name = "cascadelake",
13611362 .features = featureSet(&[_]Feature{
......@@ -1413,7 +1414,7 @@ pub const cpu = struct {
14131414 .xsaves,
14141415 }),
14151416 };
1416 pub const cooperlake = Cpu{
1417 pub const cooperlake = CpuModel{
14171418 .name = "cooperlake",
14181419 .llvm_name = "cooperlake",
14191420 .features = featureSet(&[_]Feature{
......@@ -1472,7 +1473,7 @@ pub const cpu = struct {
14721473 .xsaves,
14731474 }),
14741475 };
1475 pub const core_avx_i = Cpu{
1476 pub const core_avx_i = CpuModel{
14761477 .name = "core_avx_i",
14771478 .llvm_name = "core-avx-i",
14781479 .features = featureSet(&[_]Feature{
......@@ -1504,7 +1505,7 @@ pub const cpu = struct {
15041505 .xsaveopt,
15051506 }),
15061507 };
1507 pub const core_avx2 = Cpu{
1508 pub const core_avx2 = CpuModel{
15081509 .name = "core_avx2",
15091510 .llvm_name = "core-avx2",
15101511 .features = featureSet(&[_]Feature{
......@@ -1545,7 +1546,7 @@ pub const cpu = struct {
15451546 .xsaveopt,
15461547 }),
15471548 };
1548 pub const core2 = Cpu{
1549 pub const core2 = CpuModel{
15491550 .name = "core2",
15501551 .llvm_name = "core2",
15511552 .features = featureSet(&[_]Feature{
......@@ -1563,7 +1564,7 @@ pub const cpu = struct {
15631564 .x87,
15641565 }),
15651566 };
1566 pub const corei7 = Cpu{
1567 pub const corei7 = CpuModel{
15671568 .name = "corei7",
15681569 .llvm_name = "corei7",
15691570 .features = featureSet(&[_]Feature{
......@@ -1581,7 +1582,7 @@ pub const cpu = struct {
15811582 .x87,
15821583 }),
15831584 };
1584 pub const corei7_avx = Cpu{
1585 pub const corei7_avx = CpuModel{
15851586 .name = "corei7_avx",
15861587 .llvm_name = "corei7-avx",
15871588 .features = featureSet(&[_]Feature{
......@@ -1610,7 +1611,7 @@ pub const cpu = struct {
16101611 .xsaveopt,
16111612 }),
16121613 };
1613 pub const generic = Cpu{
1614 pub const generic = CpuModel{
16141615 .name = "generic",
16151616 .llvm_name = "generic",
16161617 .features = featureSet(&[_]Feature{
......@@ -1619,7 +1620,7 @@ pub const cpu = struct {
16191620 .x87,
16201621 }),
16211622 };
1622 pub const geode = Cpu{
1623 pub const geode = CpuModel{
16231624 .name = "geode",
16241625 .llvm_name = "geode",
16251626 .features = featureSet(&[_]Feature{
......@@ -1629,7 +1630,7 @@ pub const cpu = struct {
16291630 .x87,
16301631 }),
16311632 };
1632 pub const goldmont = Cpu{
1633 pub const goldmont = CpuModel{
16331634 .name = "goldmont",
16341635 .llvm_name = "goldmont",
16351636 .features = featureSet(&[_]Feature{
......@@ -1665,7 +1666,7 @@ pub const cpu = struct {
16651666 .xsaves,
16661667 }),
16671668 };
1668 pub const goldmont_plus = Cpu{
1669 pub const goldmont_plus = CpuModel{
16691670 .name = "goldmont_plus",
16701671 .llvm_name = "goldmont-plus",
16711672 .features = featureSet(&[_]Feature{
......@@ -1703,7 +1704,7 @@ pub const cpu = struct {
17031704 .xsaves,
17041705 }),
17051706 };
1706 pub const haswell = Cpu{
1707 pub const haswell = CpuModel{
17071708 .name = "haswell",
17081709 .llvm_name = "haswell",
17091710 .features = featureSet(&[_]Feature{
......@@ -1744,7 +1745,7 @@ pub const cpu = struct {
17441745 .xsaveopt,
17451746 }),
17461747 };
1747 pub const _i386 = Cpu{
1748 pub const _i386 = CpuModel{
17481749 .name = "_i386",
17491750 .llvm_name = "i386",
17501751 .features = featureSet(&[_]Feature{
......@@ -1752,7 +1753,7 @@ pub const cpu = struct {
17521753 .x87,
17531754 }),
17541755 };
1755 pub const _i486 = Cpu{
1756 pub const _i486 = CpuModel{
17561757 .name = "_i486",
17571758 .llvm_name = "i486",
17581759 .features = featureSet(&[_]Feature{
......@@ -1760,7 +1761,7 @@ pub const cpu = struct {
17601761 .x87,
17611762 }),
17621763 };
1763 pub const _i586 = Cpu{
1764 pub const _i586 = CpuModel{
17641765 .name = "_i586",
17651766 .llvm_name = "i586",
17661767 .features = featureSet(&[_]Feature{
......@@ -1769,7 +1770,7 @@ pub const cpu = struct {
17691770 .x87,
17701771 }),
17711772 };
1772 pub const _i686 = Cpu{
1773 pub const _i686 = CpuModel{
17731774 .name = "_i686",
17741775 .llvm_name = "i686",
17751776 .features = featureSet(&[_]Feature{
......@@ -1779,7 +1780,7 @@ pub const cpu = struct {
17791780 .x87,
17801781 }),
17811782 };
1782 pub const icelake_client = Cpu{
1783 pub const icelake_client = CpuModel{
17831784 .name = "icelake_client",
17841785 .llvm_name = "icelake-client",
17851786 .features = featureSet(&[_]Feature{
......@@ -1847,7 +1848,7 @@ pub const cpu = struct {
18471848 .xsaves,
18481849 }),
18491850 };
1850 pub const icelake_server = Cpu{
1851 pub const icelake_server = CpuModel{
18511852 .name = "icelake_server",
18521853 .llvm_name = "icelake-server",
18531854 .features = featureSet(&[_]Feature{
......@@ -1917,7 +1918,7 @@ pub const cpu = struct {
19171918 .xsaves,
19181919 }),
19191920 };
1920 pub const ivybridge = Cpu{
1921 pub const ivybridge = CpuModel{
19211922 .name = "ivybridge",
19221923 .llvm_name = "ivybridge",
19231924 .features = featureSet(&[_]Feature{
......@@ -1949,7 +1950,7 @@ pub const cpu = struct {
19491950 .xsaveopt,
19501951 }),
19511952 };
1952 pub const k6 = Cpu{
1953 pub const k6 = CpuModel{
19531954 .name = "k6",
19541955 .llvm_name = "k6",
19551956 .features = featureSet(&[_]Feature{
......@@ -1959,7 +1960,7 @@ pub const cpu = struct {
19591960 .x87,
19601961 }),
19611962 };
1962 pub const k6_2 = Cpu{
1963 pub const k6_2 = CpuModel{
19631964 .name = "k6_2",
19641965 .llvm_name = "k6-2",
19651966 .features = featureSet(&[_]Feature{
......@@ -1969,7 +1970,7 @@ pub const cpu = struct {
19691970 .x87,
19701971 }),
19711972 };
1972 pub const k6_3 = Cpu{
1973 pub const k6_3 = CpuModel{
19731974 .name = "k6_3",
19741975 .llvm_name = "k6-3",
19751976 .features = featureSet(&[_]Feature{
......@@ -1979,7 +1980,7 @@ pub const cpu = struct {
19791980 .x87,
19801981 }),
19811982 };
1982 pub const k8 = Cpu{
1983 pub const k8 = CpuModel{
19831984 .name = "k8",
19841985 .llvm_name = "k8",
19851986 .features = featureSet(&[_]Feature{
......@@ -1996,7 +1997,7 @@ pub const cpu = struct {
19961997 .x87,
19971998 }),
19981999 };
1999 pub const k8_sse3 = Cpu{
2000 pub const k8_sse3 = CpuModel{
20002001 .name = "k8_sse3",
20012002 .llvm_name = "k8-sse3",
20022003 .features = featureSet(&[_]Feature{
......@@ -2014,7 +2015,7 @@ pub const cpu = struct {
20142015 .x87,
20152016 }),
20162017 };
2017 pub const knl = Cpu{
2018 pub const knl = CpuModel{
20182019 .name = "knl",
20192020 .llvm_name = "knl",
20202021 .features = featureSet(&[_]Feature{
......@@ -2057,7 +2058,7 @@ pub const cpu = struct {
20572058 .xsaveopt,
20582059 }),
20592060 };
2060 pub const knm = Cpu{
2061 pub const knm = CpuModel{
20612062 .name = "knm",
20622063 .llvm_name = "knm",
20632064 .features = featureSet(&[_]Feature{
......@@ -2101,12 +2102,12 @@ pub const cpu = struct {
21012102 .xsaveopt,
21022103 }),
21032104 };
2104 pub const lakemont = Cpu{
2105 pub const lakemont = CpuModel{
21052106 .name = "lakemont",
21062107 .llvm_name = "lakemont",
21072108 .features = featureSet(&[_]Feature{}),
21082109 };
2109 pub const nehalem = Cpu{
2110 pub const nehalem = CpuModel{
21102111 .name = "nehalem",
21112112 .llvm_name = "nehalem",
21122113 .features = featureSet(&[_]Feature{
......@@ -2124,7 +2125,7 @@ pub const cpu = struct {
21242125 .x87,
21252126 }),
21262127 };
2127 pub const nocona = Cpu{
2128 pub const nocona = CpuModel{
21282129 .name = "nocona",
21292130 .llvm_name = "nocona",
21302131 .features = featureSet(&[_]Feature{
......@@ -2140,7 +2141,7 @@ pub const cpu = struct {
21402141 .x87,
21412142 }),
21422143 };
2143 pub const opteron = Cpu{
2144 pub const opteron = CpuModel{
21442145 .name = "opteron",
21452146 .llvm_name = "opteron",
21462147 .features = featureSet(&[_]Feature{
......@@ -2157,7 +2158,7 @@ pub const cpu = struct {
21572158 .x87,
21582159 }),
21592160 };
2160 pub const opteron_sse3 = Cpu{
2161 pub const opteron_sse3 = CpuModel{
21612162 .name = "opteron_sse3",
21622163 .llvm_name = "opteron-sse3",
21632164 .features = featureSet(&[_]Feature{
......@@ -2175,7 +2176,7 @@ pub const cpu = struct {
21752176 .x87,
21762177 }),
21772178 };
2178 pub const penryn = Cpu{
2179 pub const penryn = CpuModel{
21792180 .name = "penryn",
21802181 .llvm_name = "penryn",
21812182 .features = featureSet(&[_]Feature{
......@@ -2193,7 +2194,7 @@ pub const cpu = struct {
21932194 .x87,
21942195 }),
21952196 };
2196 pub const pentium = Cpu{
2197 pub const pentium = CpuModel{
21972198 .name = "pentium",
21982199 .llvm_name = "pentium",
21992200 .features = featureSet(&[_]Feature{
......@@ -2202,7 +2203,7 @@ pub const cpu = struct {
22022203 .x87,
22032204 }),
22042205 };
2205 pub const pentium_m = Cpu{
2206 pub const pentium_m = CpuModel{
22062207 .name = "pentium_m",
22072208 .llvm_name = "pentium-m",
22082209 .features = featureSet(&[_]Feature{
......@@ -2216,7 +2217,7 @@ pub const cpu = struct {
22162217 .x87,
22172218 }),
22182219 };
2219 pub const pentium_mmx = Cpu{
2220 pub const pentium_mmx = CpuModel{
22202221 .name = "pentium_mmx",
22212222 .llvm_name = "pentium-mmx",
22222223 .features = featureSet(&[_]Feature{
......@@ -2226,7 +2227,7 @@ pub const cpu = struct {
22262227 .x87,
22272228 }),
22282229 };
2229 pub const pentium2 = Cpu{
2230 pub const pentium2 = CpuModel{
22302231 .name = "pentium2",
22312232 .llvm_name = "pentium2",
22322233 .features = featureSet(&[_]Feature{
......@@ -2239,7 +2240,7 @@ pub const cpu = struct {
22392240 .x87,
22402241 }),
22412242 };
2242 pub const pentium3 = Cpu{
2243 pub const pentium3 = CpuModel{
22432244 .name = "pentium3",
22442245 .llvm_name = "pentium3",
22452246 .features = featureSet(&[_]Feature{
......@@ -2253,7 +2254,7 @@ pub const cpu = struct {
22532254 .x87,
22542255 }),
22552256 };
2256 pub const pentium3m = Cpu{
2257 pub const pentium3m = CpuModel{
22572258 .name = "pentium3m",
22582259 .llvm_name = "pentium3m",
22592260 .features = featureSet(&[_]Feature{
......@@ -2267,7 +2268,7 @@ pub const cpu = struct {
22672268 .x87,
22682269 }),
22692270 };
2270 pub const pentium4 = Cpu{
2271 pub const pentium4 = CpuModel{
22712272 .name = "pentium4",
22722273 .llvm_name = "pentium4",
22732274 .features = featureSet(&[_]Feature{
......@@ -2281,7 +2282,7 @@ pub const cpu = struct {
22812282 .x87,
22822283 }),
22832284 };
2284 pub const pentium4m = Cpu{
2285 pub const pentium4m = CpuModel{
22852286 .name = "pentium4m",
22862287 .llvm_name = "pentium4m",
22872288 .features = featureSet(&[_]Feature{
......@@ -2295,7 +2296,7 @@ pub const cpu = struct {
22952296 .x87,
22962297 }),
22972298 };
2298 pub const pentiumpro = Cpu{
2299 pub const pentiumpro = CpuModel{
22992300 .name = "pentiumpro",
23002301 .llvm_name = "pentiumpro",
23012302 .features = featureSet(&[_]Feature{
......@@ -2306,7 +2307,7 @@ pub const cpu = struct {
23062307 .x87,
23072308 }),
23082309 };
2309 pub const prescott = Cpu{
2310 pub const prescott = CpuModel{
23102311 .name = "prescott",
23112312 .llvm_name = "prescott",
23122313 .features = featureSet(&[_]Feature{
......@@ -2320,7 +2321,7 @@ pub const cpu = struct {
23202321 .x87,
23212322 }),
23222323 };
2323 pub const sandybridge = Cpu{
2324 pub const sandybridge = CpuModel{
23242325 .name = "sandybridge",
23252326 .llvm_name = "sandybridge",
23262327 .features = featureSet(&[_]Feature{
......@@ -2349,7 +2350,7 @@ pub const cpu = struct {
23492350 .xsaveopt,
23502351 }),
23512352 };
2352 pub const silvermont = Cpu{
2353 pub const silvermont = CpuModel{
23532354 .name = "silvermont",
23542355 .llvm_name = "silvermont",
23552356 .features = featureSet(&[_]Feature{
......@@ -2377,7 +2378,7 @@ pub const cpu = struct {
23772378 .x87,
23782379 }),
23792380 };
2380 pub const skx = Cpu{
2381 pub const skx = CpuModel{
23812382 .name = "skx",
23822383 .llvm_name = "skx",
23832384 .features = featureSet(&[_]Feature{
......@@ -2434,7 +2435,7 @@ pub const cpu = struct {
24342435 .xsaves,
24352436 }),
24362437 };
2437 pub const skylake = Cpu{
2438 pub const skylake = CpuModel{
24382439 .name = "skylake",
24392440 .llvm_name = "skylake",
24402441 .features = featureSet(&[_]Feature{
......@@ -2485,7 +2486,7 @@ pub const cpu = struct {
24852486 .xsaves,
24862487 }),
24872488 };
2488 pub const skylake_avx512 = Cpu{
2489 pub const skylake_avx512 = CpuModel{
24892490 .name = "skylake_avx512",
24902491 .llvm_name = "skylake-avx512",
24912492 .features = featureSet(&[_]Feature{
......@@ -2542,7 +2543,7 @@ pub const cpu = struct {
25422543 .xsaves,
25432544 }),
25442545 };
2545 pub const slm = Cpu{
2546 pub const slm = CpuModel{
25462547 .name = "slm",
25472548 .llvm_name = "slm",
25482549 .features = featureSet(&[_]Feature{
......@@ -2570,7 +2571,7 @@ pub const cpu = struct {
25702571 .x87,
25712572 }),
25722573 };
2573 pub const tremont = Cpu{
2574 pub const tremont = CpuModel{
25742575 .name = "tremont",
25752576 .llvm_name = "tremont",
25762577 .features = featureSet(&[_]Feature{
......@@ -2613,7 +2614,7 @@ pub const cpu = struct {
26132614 .xsaves,
26142615 }),
26152616 };
2616 pub const westmere = Cpu{
2617 pub const westmere = CpuModel{
26172618 .name = "westmere",
26182619 .llvm_name = "westmere",
26192620 .features = featureSet(&[_]Feature{
......@@ -2632,7 +2633,7 @@ pub const cpu = struct {
26322633 .x87,
26332634 }),
26342635 };
2635 pub const winchip_c6 = Cpu{
2636 pub const winchip_c6 = CpuModel{
26362637 .name = "winchip_c6",
26372638 .llvm_name = "winchip-c6",
26382639 .features = featureSet(&[_]Feature{
......@@ -2641,7 +2642,7 @@ pub const cpu = struct {
26412642 .x87,
26422643 }),
26432644 };
2644 pub const winchip2 = Cpu{
2645 pub const winchip2 = CpuModel{
26452646 .name = "winchip2",
26462647 .llvm_name = "winchip2",
26472648 .features = featureSet(&[_]Feature{
......@@ -2650,7 +2651,7 @@ pub const cpu = struct {
26502651 .x87,
26512652 }),
26522653 };
2653 pub const x86_64 = Cpu{
2654 pub const x86_64 = CpuModel{
26542655 .name = "x86_64",
26552656 .llvm_name = "x86-64",
26562657 .features = featureSet(&[_]Feature{
......@@ -2667,7 +2668,7 @@ pub const cpu = struct {
26672668 .x87,
26682669 }),
26692670 };
2670 pub const yonah = Cpu{
2671 pub const yonah = CpuModel{
26712672 .name = "yonah",
26722673 .llvm_name = "yonah",
26732674 .features = featureSet(&[_]Feature{
......@@ -2681,7 +2682,7 @@ pub const cpu = struct {
26812682 .x87,
26822683 }),
26832684 };
2684 pub const znver1 = Cpu{
2685 pub const znver1 = CpuModel{
26852686 .name = "znver1",
26862687 .llvm_name = "znver1",
26872688 .features = featureSet(&[_]Feature{
......@@ -2725,7 +2726,7 @@ pub const cpu = struct {
27252726 .xsaves,
27262727 }),
27272728 };
2728 pub const znver2 = Cpu{
2729 pub const znver2 = CpuModel{
27292730 .name = "znver2",
27302731 .llvm_name = "znver2",
27312732 .features = featureSet(&[_]Feature{
......@@ -2777,7 +2778,7 @@ pub const cpu = struct {
27772778/// All x86 CPUs, sorted alphabetically by name.
27782779/// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1
27792780/// compiler has inefficient memory and CPU usage, affecting build times.
2780pub const all_cpus = &[_]*const Cpu{
2781pub const all_cpus = &[_]*const CpuModel{
27812782 &cpu.amdfam10,
27822783 &cpu.athlon,
27832784 &cpu.athlon_4,
src-self-hosted/libc_installation.zig+1-2
......@@ -577,10 +577,9 @@ pub fn detectNativeDynamicLinker(allocator: *Allocator) error{
577577 // skip adding it to `ld_info_list`.
578578 const target: Target = .{
579579 .Cross = .{
580 .arch = Target.current.getArch(),
580 .cpu = Target.Cpu.baseline(Target.current.getArch()),
581581 .os = Target.current.getOs(),
582582 .abi = abi,
583 .cpu_features = Target.current.getArch().getBaselineCpuFeatures(),
584583 },
585584 };
586585 const standard_ld_path = target.getStandardDynamicLinkerPath(allocator) catch |err| switch (err) {
src-self-hosted/print_targets.zig+34-50
......@@ -113,37 +113,14 @@ pub fn cmdTargets(
113113 try jws.beginObject();
114114
115115 try jws.objectField("arch");
116 try jws.beginObject();
116 try jws.beginArray();
117117 {
118 inline for (@typeInfo(Target.Arch).Union.fields) |field| {
119 try jws.objectField(field.name);
120 if (field.field_type == void) {
121 try jws.emitNull();
122 } else {
123 try jws.emitString(@typeName(field.field_type));
124 }
125 }
126 }
127 try jws.endObject();
128
129 try jws.objectField("subArch");
130 try jws.beginObject();
131 const sub_arch_list = [_]type{
132 Target.Arch.Arm32,
133 Target.Arch.Arm64,
134 Target.Arch.Kalimba,
135 Target.Arch.Mips,
136 };
137 inline for (sub_arch_list) |SubArch| {
138 try jws.objectField(@typeName(SubArch));
139 try jws.beginArray();
140 inline for (@typeInfo(SubArch).Enum.fields) |field| {
118 inline for (@typeInfo(Target.Cpu.Arch).Enum.fields) |field| {
141119 try jws.arrayElem();
142120 try jws.emitString(field.name);
143121 }
144 try jws.endArray();
145122 }
146 try jws.endObject();
123 try jws.endArray();
147124
148125 try jws.objectField("os");
149126 try jws.beginArray();
......@@ -179,15 +156,15 @@ pub fn cmdTargets(
179156
180157 try jws.objectField("cpus");
181158 try jws.beginObject();
182 inline for (@typeInfo(Target.Arch).Union.fields) |field| {
159 inline for (@typeInfo(Target.Cpu.Arch).Enum.fields) |field| {
183160 try jws.objectField(field.name);
184161 try jws.beginObject();
185 const arch = @unionInit(Target.Arch, field.name, undefined);
186 for (arch.allCpus()) |cpu| {
187 try jws.objectField(cpu.name);
162 const arch = @field(Target.Cpu.Arch, field.name);
163 for (arch.allCpuModels()) |model| {
164 try jws.objectField(model.name);
188165 try jws.beginArray();
189166 for (arch.allFeaturesList()) |feature, i| {
190 if (cpu.features.isEnabled(@intCast(u8, i))) {
167 if (model.features.isEnabled(@intCast(u8, i))) {
191168 try jws.arrayElem();
192169 try jws.emitString(feature.name);
193170 }
......@@ -200,10 +177,10 @@ pub fn cmdTargets(
200177
201178 try jws.objectField("cpuFeatures");
202179 try jws.beginObject();
203 inline for (@typeInfo(Target.Arch).Union.fields) |field| {
180 inline for (@typeInfo(Target.Cpu.Arch).Enum.fields) |field| {
204181 try jws.objectField(field.name);
205182 try jws.beginArray();
206 const arch = @unionInit(Target.Arch, field.name, undefined);
183 const arch = @field(Target.Cpu.Arch, field.name);
207184 for (arch.allFeaturesList()) |feature| {
208185 try jws.arrayElem();
209186 try jws.emitString(feature.name);
......@@ -220,27 +197,34 @@ pub fn cmdTargets(
220197 try jws.objectField("triple");
221198 try jws.emitString(triple);
222199 }
223 try jws.objectField("arch");
224 try jws.emitString(@tagName(native_target.getArch()));
225 try jws.objectField("os");
226 try jws.emitString(@tagName(native_target.getOs()));
227 try jws.objectField("abi");
228 try jws.emitString(@tagName(native_target.getAbi()));
229 try jws.objectField("cpuName");
230 const cpu_features = native_target.getCpuFeatures();
231 try jws.emitString(cpu_features.cpu.name);
232200 {
233 try jws.objectField("cpuFeatures");
234 try jws.beginArray();
235 for (native_target.getArch().allFeaturesList()) |feature, i_usize| {
236 const index = @intCast(Target.Cpu.Feature.Set.Index, i_usize);
237 if (cpu_features.features.isEnabled(index)) {
238 try jws.arrayElem();
239 try jws.emitString(feature.name);
201 try jws.objectField("cpu");
202 try jws.beginObject();
203 try jws.objectField("arch");
204 try jws.emitString(@tagName(native_target.getArch()));
205
206 try jws.objectField("name");
207 const cpu = native_target.getCpu();
208 try jws.emitString(cpu.model.name);
209
210 {
211 try jws.objectField("features");
212 try jws.beginArray();
213 for (native_target.getArch().allFeaturesList()) |feature, i_usize| {
214 const index = @intCast(Target.Cpu.Feature.Set.Index, i_usize);
215 if (cpu.features.isEnabled(index)) {
216 try jws.arrayElem();
217 try jws.emitString(feature.name);
218 }
240219 }
220 try jws.endArray();
241221 }
242 try jws.endArray();
222 try jws.endObject();
243223 }
224 try jws.objectField("os");
225 try jws.emitString(@tagName(native_target.getOs()));
226 try jws.objectField("abi");
227 try jws.emitString(@tagName(native_target.getAbi()));
244228 // TODO implement native glibc version detection in self-hosted
245229 try jws.endObject();
246230
src-self-hosted/stage2.zig+133-262
......@@ -88,7 +88,6 @@ const Error = extern enum {
8888 IsAsync,
8989 ImportOutsidePkgPath,
9090 UnknownCpu,
91 UnknownSubArchitecture,
9291 UnknownCpuFeature,
9392 InvalidCpuFeatures,
9493 InvalidLlvmCpuFeaturesFormat,
......@@ -560,25 +559,26 @@ export fn stage2_progress_update_node(node: *std.Progress.Node, done_count: usiz
560559 node.context.maybeRefresh();
561560}
562561
563fn cpuFeaturesFromLLVM(
564 arch: Target.Arch,
562fn detectNativeCpuWithLLVM(
563 arch: Target.Cpu.Arch,
565564 llvm_cpu_name_z: ?[*:0]const u8,
566565 llvm_cpu_features_opt: ?[*:0]const u8,
567) !Target.CpuFeatures {
568 var result = arch.getBaselineCpuFeatures();
566) !Target.Cpu {
567 var result = Target.Cpu.baseline(arch);
569568
570569 if (llvm_cpu_name_z) |cpu_name_z| {
571570 const llvm_cpu_name = mem.toSliceConst(u8, cpu_name_z);
572571
573 for (arch.allCpus()) |cpu| {
574 const this_llvm_name = cpu.llvm_name orelse continue;
572 for (arch.allCpuModels()) |model| {
573 const this_llvm_name = model.llvm_name orelse continue;
575574 if (mem.eql(u8, this_llvm_name, llvm_cpu_name)) {
576575 // Here we use the non-dependencies-populated set,
577576 // so that subtracting features later in this function
578577 // affect the prepopulated set.
579 result = Target.CpuFeatures{
580 .cpu = cpu,
581 .features = cpu.features,
578 result = Target.Cpu{
579 .arch = arch,
580 .model = model,
581 .features = model.features,
582582 };
583583 break;
584584 }
......@@ -632,12 +632,12 @@ export fn stage2_cmd_targets(zig_triple: [*:0]const u8) c_int {
632632}
633633
634634fn cmdTargets(zig_triple: [*:0]const u8) !void {
635 var target = try Target.parse(mem.toSliceConst(u8, zig_triple));
636 target.Cross.cpu_features = blk: {
635 var target = try Target.parse(.{ .arch_os_abi = mem.toSliceConst(u8, zig_triple) });
636 target.Cross.cpu = blk: {
637637 const llvm = @import("llvm.zig");
638638 const llvm_cpu_name = llvm.GetHostCPUName();
639639 const llvm_cpu_features = llvm.GetNativeFeatures();
640 break :blk try cpuFeaturesFromLLVM(target.Cross.arch, llvm_cpu_name, llvm_cpu_features);
640 break :blk try detectNativeCpuWithLLVM(target.getArch(), llvm_cpu_name, llvm_cpu_features);
641641 };
642642 return @import("print_targets.zig").cmdTargets(
643643 std.heap.c_allocator,
......@@ -647,208 +647,101 @@ fn cmdTargets(zig_triple: [*:0]const u8) !void {
647647 );
648648}
649649
650const Stage2CpuFeatures = struct {
651 allocator: *mem.Allocator,
652 cpu_features: Target.CpuFeatures,
653
654 llvm_features_str: ?[*:0]const u8,
655
656 builtin_str: [:0]const u8,
657 cache_hash: [:0]const u8,
658
659 const Self = @This();
660
661 fn createFromNative(allocator: *mem.Allocator) !*Self {
662 const arch = Target.current.getArch();
663 const llvm = @import("llvm.zig");
664 const llvm_cpu_name = llvm.GetHostCPUName();
665 const llvm_cpu_features = llvm.GetNativeFeatures();
666 const cpu_features = try cpuFeaturesFromLLVM(arch, llvm_cpu_name, llvm_cpu_features);
667 return createFromCpuFeatures(allocator, arch, cpu_features);
668 }
669
670 fn createFromCpuFeatures(
671 allocator: *mem.Allocator,
672 arch: Target.Arch,
673 cpu_features: Target.CpuFeatures,
674 ) !*Self {
675 const self = try allocator.create(Self);
676 errdefer allocator.destroy(self);
677
678 const cache_hash = try std.fmt.allocPrint0(allocator, "{}\n{}", .{
679 cpu_features.cpu.name,
680 cpu_features.features.asBytes(),
681 });
682 errdefer allocator.free(cache_hash);
683
684 const generic_arch_name = arch.genericName();
685 var builtin_str_buffer = try std.Buffer.allocPrint(allocator,
686 \\CpuFeatures{{
687 \\ .cpu = &Target.{}.cpu.{},
688 \\ .features = Target.{}.featureSet(&[_]Target.{}.Feature{{
689 \\
690 , .{
691 generic_arch_name,
692 cpu_features.cpu.name,
693 generic_arch_name,
694 generic_arch_name,
695 });
696 defer builtin_str_buffer.deinit();
697
698 var llvm_features_buffer = try std.Buffer.initSize(allocator, 0);
699 defer llvm_features_buffer.deinit();
700
701 for (arch.allFeaturesList()) |feature, index_usize| {
702 const index = @intCast(Target.Cpu.Feature.Set.Index, index_usize);
703 const is_enabled = cpu_features.features.isEnabled(index);
704
705 if (feature.llvm_name) |llvm_name| {
706 const plus_or_minus = "-+"[@boolToInt(is_enabled)];
707 try llvm_features_buffer.appendByte(plus_or_minus);
708 try llvm_features_buffer.append(llvm_name);
709 try llvm_features_buffer.append(",");
710 }
711
712 if (is_enabled) {
713 // TODO some kind of "zig identifier escape" function rather than
714 // unconditionally using @"" syntax
715 try builtin_str_buffer.append(" .@\"");
716 try builtin_str_buffer.append(feature.name);
717 try builtin_str_buffer.append("\",\n");
718 }
719 }
720
721 try builtin_str_buffer.append(
722 \\ }),
723 \\};
724 \\
725 );
726
727 assert(mem.endsWith(u8, llvm_features_buffer.toSliceConst(), ","));
728 llvm_features_buffer.shrink(llvm_features_buffer.len() - 1);
729
730 self.* = Self{
731 .allocator = allocator,
732 .cpu_features = cpu_features,
733 .llvm_features_str = llvm_features_buffer.toOwnedSlice().ptr,
734 .builtin_str = builtin_str_buffer.toOwnedSlice(),
735 .cache_hash = cache_hash,
736 };
737 return self;
738 }
739
740 fn destroy(self: *Self) void {
741 self.allocator.free(self.cache_hash);
742 self.allocator.free(self.builtin_str);
743 // TODO if (self.llvm_features_str) |llvm_features_str| self.allocator.free(llvm_features_str);
744 self.allocator.destroy(self);
745 }
746};
747
748650// ABI warning
749export fn stage2_cpu_features_parse(
750 result: **Stage2CpuFeatures,
651export fn stage2_target_parse(
652 target: *Stage2Target,
751653 zig_triple: ?[*:0]const u8,
752 cpu_name: ?[*:0]const u8,
753 cpu_features: ?[*:0]const u8,
654 mcpu: ?[*:0]const u8,
754655) Error {
755 result.* = stage2ParseCpuFeatures(zig_triple, cpu_name, cpu_features) catch |err| switch (err) {
656 stage2TargetParse(target, zig_triple, mcpu) catch |err| switch (err) {
756657 error.OutOfMemory => return .OutOfMemory,
757658 error.UnknownArchitecture => return .UnknownArchitecture,
758 error.UnknownSubArchitecture => return .UnknownSubArchitecture,
759659 error.UnknownOperatingSystem => return .UnknownOperatingSystem,
760660 error.UnknownApplicationBinaryInterface => return .UnknownApplicationBinaryInterface,
761661 error.MissingOperatingSystem => return .MissingOperatingSystem,
762662 error.MissingArchitecture => return .MissingArchitecture,
763663 error.InvalidLlvmCpuFeaturesFormat => return .InvalidLlvmCpuFeaturesFormat,
764 error.InvalidCpuFeatures => return .InvalidCpuFeatures,
664 error.UnknownCpu => return .UnknownCpu,
665 error.UnexpectedExtraField => return .SemanticAnalyzeFail,
666 error.UnknownCpuFeature => return .UnknownCpuFeature,
765667 };
766668 return .None;
767669}
768670
769fn stage2ParseCpuFeatures(
671fn stage2TargetParse(
672 stage1_target: *Stage2Target,
770673 zig_triple_oz: ?[*:0]const u8,
771 cpu_name_oz: ?[*:0]const u8,
772 cpu_features_oz: ?[*:0]const u8,
773) !*Stage2CpuFeatures {
774 const zig_triple_z = zig_triple_oz orelse return Stage2CpuFeatures.createFromNative(std.heap.c_allocator);
775 const target = try Target.parse(mem.toSliceConst(u8, zig_triple_z));
776 const arch = target.Cross.arch;
777
778 const cpu = if (cpu_name_oz) |cpu_name_z| blk: {
779 const cpu_name = mem.toSliceConst(u8, cpu_name_z);
780 break :blk arch.parseCpu(cpu_name) catch |err| switch (err) {
781 error.UnknownCpu => {
782 std.debug.warn("Unknown CPU: '{}'\nAvailable CPUs for architecture '{}':\n", .{
783 cpu_name,
784 @tagName(arch),
785 });
786 for (arch.allCpus()) |cpu| {
787 std.debug.warn(" {}\n", .{cpu.name});
788 }
789 process.exit(1);
790 },
791 else => |e| return e,
792 };
793 } else target.Cross.cpu_features.cpu;
794
795 var set = if (cpu_features_oz) |cpu_features_z| blk: {
796 const cpu_features = mem.toSliceConst(u8, cpu_features_z);
797 break :blk arch.parseCpuFeatureSet(cpu, cpu_features) catch |err| switch (err) {
798 error.UnknownCpuFeature => {
799 std.debug.warn(
800 \\Unknown CPU features specified.
801 \\Available CPU features for architecture '{}':
802 \\
803 , .{@tagName(arch)});
804 for (arch.allFeaturesList()) |feature| {
805 std.debug.warn(" {}\n", .{feature.name});
806 }
807 process.exit(1);
808 },
809 else => |e| return e,
810 };
811 } else cpu.features;
674 mcpu_oz: ?[*:0]const u8,
675) !void {
676 const target: Target = if (zig_triple_oz) |zig_triple_z| blk: {
677 const zig_triple = mem.toSliceConst(u8, zig_triple_z);
678 const mcpu = if (mcpu_oz) |mcpu_z| mem.toSliceConst(u8, mcpu_z) else null;
679 break :blk try Target.parse(.{ .arch_os_abi = zig_triple, .cpu = mcpu });
680 } else Target.Native;
812681
813 if (arch.subArchFeature()) |index| {
814 set.addFeature(index);
815 }
816 set.populateDependencies(arch.allFeaturesList());
682 try stage1_target.fromTarget(target);
683}
817684
818 return Stage2CpuFeatures.createFromCpuFeatures(std.heap.c_allocator, arch, .{
819 .cpu = cpu,
820 .features = set,
685fn initStage1TargetCpuFeatures(stage1_target: *Stage2Target, cpu: Target.Cpu) !void {
686 const allocator = std.heap.c_allocator;
687 const cache_hash = try std.fmt.allocPrint0(allocator, "{}\n{}", .{
688 cpu.model.name,
689 cpu.features.asBytes(),
821690 });
822}
691 errdefer allocator.free(cache_hash);
692
693 const generic_arch_name = cpu.arch.genericName();
694 var builtin_str_buffer = try std.Buffer.allocPrint(allocator,
695 \\Cpu{{
696 \\ .arch = .{},
697 \\ .model = &Target.{}.cpu.{},
698 \\ .features = Target.{}.featureSet(&[_]Target.{}.Feature{{
699 \\
700 , .{
701 @tagName(cpu.arch),
702 generic_arch_name,
703 cpu.model.name,
704 generic_arch_name,
705 generic_arch_name,
706 });
707 defer builtin_str_buffer.deinit();
823708
824// ABI warning
825export fn stage2_cpu_features_get_cache_hash(
826 cpu_features: *const Stage2CpuFeatures,
827 ptr: *[*:0]const u8,
828 len: *usize,
829) void {
830 ptr.* = cpu_features.cache_hash.ptr;
831 len.* = cpu_features.cache_hash.len;
832}
709 var llvm_features_buffer = try std.Buffer.initSize(allocator, 0);
710 defer llvm_features_buffer.deinit();
833711
834// ABI warning
835export fn stage2_cpu_features_get_builtin_str(
836 cpu_features: *const Stage2CpuFeatures,
837 ptr: *[*:0]const u8,
838 len: *usize,
839) void {
840 ptr.* = cpu_features.builtin_str.ptr;
841 len.* = cpu_features.builtin_str.len;
842}
712 for (cpu.arch.allFeaturesList()) |feature, index_usize| {
713 const index = @intCast(Target.Cpu.Feature.Set.Index, index_usize);
714 const is_enabled = cpu.features.isEnabled(index);
843715
844// ABI warning
845export fn stage2_cpu_features_get_llvm_cpu(cpu_features: *const Stage2CpuFeatures) ?[*:0]const u8 {
846 return if (cpu_features.cpu_features.cpu.llvm_name) |s| s.ptr else null;
847}
716 if (feature.llvm_name) |llvm_name| {
717 const plus_or_minus = "-+"[@boolToInt(is_enabled)];
718 try llvm_features_buffer.appendByte(plus_or_minus);
719 try llvm_features_buffer.append(llvm_name);
720 try llvm_features_buffer.append(",");
721 }
848722
849// ABI warning
850export fn stage2_cpu_features_get_llvm_features(cpu_features: *const Stage2CpuFeatures) ?[*:0]const u8 {
851 return cpu_features.llvm_features_str;
723 if (is_enabled) {
724 // TODO some kind of "zig identifier escape" function rather than
725 // unconditionally using @"" syntax
726 try builtin_str_buffer.append(" .@\"");
727 try builtin_str_buffer.append(feature.name);
728 try builtin_str_buffer.append("\",\n");
729 }
730 }
731
732 try builtin_str_buffer.append(
733 \\ }),
734 \\};
735 \\
736 );
737
738 assert(mem.endsWith(u8, llvm_features_buffer.toSliceConst(), ","));
739 llvm_features_buffer.shrink(llvm_features_buffer.len() - 1);
740
741 stage1_target.llvm_cpu_name = if (cpu.model.llvm_name) |s| s.ptr else null;
742 stage1_target.llvm_cpu_features = llvm_features_buffer.toOwnedSlice().ptr;
743 stage1_target.builtin_str = builtin_str_buffer.toOwnedSlice().ptr;
744 stage1_target.cache_hash = cache_hash.ptr;
852745}
853746
854747// ABI warning
......@@ -1017,12 +910,55 @@ export fn stage2_libc_render(stage1_libc: *Stage2LibCInstallation, output_file:
1017910const Stage2Target = extern struct {
1018911 arch: c_int,
1019912 sub_arch: c_int,
913
1020914 vendor: c_int,
1021 os: c_int,
1022915 abi: c_int,
1023 glibc_version: ?*Stage2GLibCVersion, // null means default
1024 cpu_features: *Stage2CpuFeatures,
916
917 os: c_int,
1025918 is_native: bool,
919
920 glibc_version: ?*Stage2GLibCVersion, // null means default
921
922 llvm_cpu_name: ?[*:0]const u8,
923 llvm_cpu_features: ?[*:0]const u8,
924 builtin_str: ?[*:0]const u8,
925 cache_hash: ?[*:0]const u8,
926
927 fn toTarget(in_target: Stage2Target) Target {
928 if (in_target.is_native) return .Native;
929
930 const in_arch = in_target.arch - 1; // skip over ZigLLVM_UnknownArch
931 const in_sub_arch = in_target.sub_arch - 1; // skip over ZigLLVM_NoSubArch
932 const in_os = in_target.os;
933 const in_abi = in_target.abi - 1; // skip over ZigLLVM_UnknownEnvironment
934
935 return .{
936 .Cross = .{
937 .cpu = Target.Cpu.baseline(enumInt(Target.Cpu.Arch, in_arch)),
938 .os = enumInt(Target.Os, in_os),
939 .abi = enumInt(Target.Abi, in_abi),
940 },
941 };
942 }
943
944 fn fromTarget(self: *Stage2Target, target: Target) !void {
945 const cpu = switch (target) {
946 .Native => blk: {
947 // TODO self-host CPU model and feature detection instead of relying on LLVM
948 const llvm = @import("llvm.zig");
949 const llvm_cpu_name = llvm.GetHostCPUName();
950 const llvm_cpu_features = llvm.GetNativeFeatures();
951 break :blk try detectNativeCpuWithLLVM(target.getArch(), llvm_cpu_name, llvm_cpu_features);
952 },
953 .Cross => target.getCpu(),
954 };
955 self.arch = @enumToInt(target.getArch()) + 1; // skip over ZigLLVM_UnknownArch
956 self.sub_arch = 0;
957 self.vendor = 0;
958 self.os = @enumToInt(target.getOs());
959 self.abi = @enumToInt(target.getAbi()) + 1; // skip over ZigLLVM_UnknownEnvironment
960 try initStage1TargetCpuFeatures(self, cpu);
961 }
1026962};
1027963
1028964// ABI warning
......@@ -1034,72 +970,7 @@ const Stage2GLibCVersion = extern struct {
1034970
1035971// ABI warning
1036972export fn stage2_detect_dynamic_linker(in_target: *const Stage2Target, out_ptr: *[*:0]u8, out_len: *usize) Error {
1037 const in_arch = in_target.arch - 1; // skip over ZigLLVM_UnknownArch
1038 const in_sub_arch = in_target.sub_arch - 1; // skip over ZigLLVM_NoSubArch
1039 const in_os = in_target.os;
1040 const in_abi = in_target.abi - 1; // skip over ZigLLVM_UnknownEnvironment
1041 const target: Target = if (in_target.is_native) .Native else .{
1042 .Cross = .{
1043 .arch = switch (enumInt(@TagType(Target.Arch), in_arch)) {
1044 .arm => .{ .arm = enumInt(Target.Arch.Arm32, in_sub_arch) },
1045 .armeb => .{ .armeb = enumInt(Target.Arch.Arm32, in_sub_arch) },
1046 .thumb => .{ .thumb = enumInt(Target.Arch.Arm32, in_sub_arch) },
1047 .thumbeb => .{ .thumbeb = enumInt(Target.Arch.Arm32, in_sub_arch) },
1048
1049 .aarch64 => .{ .aarch64 = enumInt(Target.Arch.Arm64, in_sub_arch) },
1050 .aarch64_be => .{ .aarch64_be = enumInt(Target.Arch.Arm64, in_sub_arch) },
1051 .aarch64_32 => .{ .aarch64_32 = enumInt(Target.Arch.Arm64, in_sub_arch) },
1052
1053 .kalimba => .{ .kalimba = enumInt(Target.Arch.Kalimba, in_sub_arch) },
1054
1055 .arc => .arc,
1056 .avr => .avr,
1057 .bpfel => .bpfel,
1058 .bpfeb => .bpfeb,
1059 .hexagon => .hexagon,
1060 .mips => .mips,
1061 .mipsel => .mipsel,
1062 .mips64 => .mips64,
1063 .mips64el => .mips64el,
1064 .msp430 => .msp430,
1065 .powerpc => .powerpc,
1066 .powerpc64 => .powerpc64,
1067 .powerpc64le => .powerpc64le,
1068 .r600 => .r600,
1069 .amdgcn => .amdgcn,
1070 .riscv32 => .riscv32,
1071 .riscv64 => .riscv64,
1072 .sparc => .sparc,
1073 .sparcv9 => .sparcv9,
1074 .sparcel => .sparcel,
1075 .s390x => .s390x,
1076 .tce => .tce,
1077 .tcele => .tcele,
1078 .i386 => .i386,
1079 .x86_64 => .x86_64,
1080 .xcore => .xcore,
1081 .nvptx => .nvptx,
1082 .nvptx64 => .nvptx64,
1083 .le32 => .le32,
1084 .le64 => .le64,
1085 .amdil => .amdil,
1086 .amdil64 => .amdil64,
1087 .hsail => .hsail,
1088 .hsail64 => .hsail64,
1089 .spir => .spir,
1090 .spir64 => .spir64,
1091 .shave => .shave,
1092 .lanai => .lanai,
1093 .wasm32 => .wasm32,
1094 .wasm64 => .wasm64,
1095 .renderscript32 => .renderscript32,
1096 .renderscript64 => .renderscript64,
1097 },
1098 .os = enumInt(Target.Os, in_os),
1099 .abi = enumInt(Target.Abi, in_abi),
1100 .cpu_features = in_target.cpu_features.cpu_features,
1101 },
1102 };
973 const target = in_target.toTarget();
1103974 const result = @import("introspect.zig").detectDynamicLinker(
1104975 std.heap.c_allocator,
1105976 target,
src/codegen.cpp+17-26
......@@ -8624,14 +8624,11 @@ Buf *codegen_generate_builtin_source(CodeGen *g) {
86248624 buf_appendf(contents, "pub const arch = %s;\n", cur_arch);
86258625 buf_appendf(contents, "pub const abi = Abi.%s;\n", cur_abi);
86268626 {
8627 buf_append_str(contents, "pub const cpu_features: CpuFeatures = ");
8628 if (g->zig_target->cpu_features != nullptr) {
8629 const char *ptr;
8630 size_t len;
8631 stage2_cpu_features_get_builtin_str(g->zig_target->cpu_features, &ptr, &len);
8632 buf_append_mem(contents, ptr, len);
8627 buf_append_str(contents, "pub const cpu: Cpu = ");
8628 if (g->zig_target->builtin_str != nullptr) {
8629 buf_append_str(contents, g->zig_target->builtin_str);
86338630 } else {
8634 buf_append_str(contents, "arch.getBaselineCpuFeatures();\n");
8631 buf_append_str(contents, "Target.Cpu.baseline(arch);\n");
86358632 }
86368633 }
86378634 if (g->libc_link_lib != nullptr && g->zig_target->glibc_version != nullptr) {
......@@ -8734,11 +8731,8 @@ static Error define_builtin_compile_vars(CodeGen *g) {
87348731 cache_int(&cache_hash, g->zig_target->vendor);
87358732 cache_int(&cache_hash, g->zig_target->os);
87368733 cache_int(&cache_hash, g->zig_target->abi);
8737 if (g->zig_target->cpu_features != nullptr) {
8738 const char *ptr;
8739 size_t len;
8740 stage2_cpu_features_get_cache_hash(g->zig_target->cpu_features, &ptr, &len);
8741 cache_str(&cache_hash, ptr);
8734 if (g->zig_target->cache_hash != nullptr) {
8735 cache_str(&cache_hash, g->zig_target->cache_hash);
87428736 }
87438737 if (g->zig_target->glibc_version != nullptr) {
87448738 cache_int(&cache_hash, g->zig_target->glibc_version->major);
......@@ -8873,9 +8867,11 @@ static void init(CodeGen *g) {
88738867 }
88748868
88758869 // Override CPU and features if defined by user.
8876 if (g->zig_target->cpu_features != nullptr) {
8877 target_specific_cpu_args = stage2_cpu_features_get_llvm_cpu(g->zig_target->cpu_features);
8878 target_specific_features = stage2_cpu_features_get_llvm_features(g->zig_target->cpu_features);
8870 if (g->zig_target->llvm_cpu_name != nullptr) {
8871 target_specific_cpu_args = g->zig_target->llvm_cpu_name;
8872 }
8873 if (g->zig_target->llvm_cpu_features != nullptr) {
8874 target_specific_features = g->zig_target->llvm_cpu_features;
88798875 }
88808876 if (g->verbose_llvm_cpu_features) {
88818877 fprintf(stderr, "name=%s triple=%s\n", buf_ptr(g->root_out_name), buf_ptr(&g->llvm_triple_str));
......@@ -9190,19 +9186,17 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa
91909186 args.append("-target");
91919187 args.append(buf_ptr(&g->llvm_triple_str));
91929188
9193 const char *llvm_cpu = stage2_cpu_features_get_llvm_cpu(g->zig_target->cpu_features);
9194 if (llvm_cpu != nullptr) {
9189 if (g->zig_target->llvm_cpu_name != nullptr) {
91959190 args.append("-Xclang");
91969191 args.append("-target-cpu");
91979192 args.append("-Xclang");
9198 args.append(llvm_cpu);
9193 args.append(g->zig_target->llvm_cpu_name);
91999194 }
9200 const char *llvm_target_features = stage2_cpu_features_get_llvm_features(g->zig_target->cpu_features);
9201 if (llvm_target_features != nullptr) {
9195 if (g->zig_target->llvm_cpu_features != nullptr) {
92029196 args.append("-Xclang");
92039197 args.append("-target-feature");
92049198 args.append("-Xclang");
9205 args.append(llvm_target_features);
9199 args.append(g->zig_target->llvm_cpu_features);
92069200 }
92079201 }
92089202
......@@ -10406,11 +10400,8 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) {
1040610400 cache_int(ch, g->zig_target->vendor);
1040710401 cache_int(ch, g->zig_target->os);
1040810402 cache_int(ch, g->zig_target->abi);
10409 if (g->zig_target->cpu_features != nullptr) {
10410 const char *ptr;
10411 size_t len;
10412 stage2_cpu_features_get_cache_hash(g->zig_target->cpu_features, &ptr, &len);
10413 cache_str(ch, ptr);
10403 if (g->zig_target->cache_hash != nullptr) {
10404 cache_str(ch, g->zig_target->cache_hash);
1041410405 }
1041510406 if (g->zig_target->glibc_version != nullptr) {
1041610407 cache_int(ch, g->zig_target->glibc_version->major);
src/error.cpp-1
......@@ -59,7 +59,6 @@ const char *err_str(Error err) {
5959 case ErrorIsAsync: return "is async";
6060 case ErrorImportOutsidePkgPath: return "import of file outside package path";
6161 case ErrorUnknownCpu: return "unknown CPU";
62 case ErrorUnknownSubArchitecture: return "unknown sub-architecture";
6362 case ErrorUnknownCpuFeature: return "unknown CPU feature";
6463 case ErrorInvalidCpuFeatures: return "invalid CPU features";
6564 case ErrorInvalidLlvmCpuFeaturesFormat: return "invalid LLVM CPU features format";
src/main.cpp+39-47
......@@ -106,8 +106,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) {
106106 " --override-lib-dir [arg] override path to Zig lib directory\n"
107107 " -ffunction-sections places each function in a separate section\n"
108108 " -D[macro]=[value] define C [macro] to [value] (1 if [value] omitted)\n"
109 " -target-cpu [cpu] target one specific CPU by name\n"
110 " -target-feature [features] specify the set of CPU features to target\n"
109 " -mcpu [cpu] specify target CPU and feature set\n"
111110 " -code-model [default|tiny| set target code model\n"
112111 " small|kernel|\n"
113112 " medium|large]\n"
......@@ -238,6 +237,14 @@ static int zig_error_no_build_file(void) {
238237 return EXIT_FAILURE;
239238}
240239
240static bool str_starts_with(const char *s1, const char *s2) {
241 size_t s2_len = strlen(s2);
242 if (strlen(s1) < s2_len) {
243 return false;
244 }
245 return memcmp(s1, s2, s2_len) == 0;
246}
247
241248extern "C" int ZigClang_main(int argc, char **argv);
242249
243250#ifdef ZIG_ENABLE_MEM_PROFILE
......@@ -447,8 +454,7 @@ static int main0(int argc, char **argv) {
447454 WantStackCheck want_stack_check = WantStackCheckAuto;
448455 WantCSanitize want_sanitize_c = WantCSanitizeAuto;
449456 bool function_sections = false;
450 const char *cpu = nullptr;
451 const char *features = nullptr;
457 const char *mcpu = nullptr;
452458 CodeModel code_model = CodeModelDefault;
453459
454460 ZigList<const char *> llvm_argv = {0};
......@@ -716,6 +722,8 @@ static int main0(int argc, char **argv) {
716722 emit_llvm_ir = true;
717723 } else if (strcmp(arg, "-fno-emit-llvm-ir") == 0) {
718724 emit_llvm_ir = false;
725 } else if (str_starts_with(arg, "-mcpu=")) {
726 mcpu = arg + strlen("-mcpu=");
719727 } else if (i + 1 >= argc) {
720728 fprintf(stderr, "Expected another argument after %s\n", arg);
721729 return print_error_usage(arg0);
......@@ -892,10 +900,8 @@ static int main0(int argc, char **argv) {
892900 , argv[i]);
893901 return EXIT_FAILURE;
894902 }
895 } else if (strcmp(arg, "-target-cpu") == 0) {
896 cpu = argv[i];
897 } else if (strcmp(arg, "-target-feature") == 0) {
898 features = argv[i];
903 } else if (strcmp(arg, "-mcpu") == 0) {
904 mcpu = argv[i];
899905 } else {
900906 fprintf(stderr, "Invalid argument: %s\n", arg);
901907 return print_error_usage(arg0);
......@@ -971,55 +977,41 @@ static int main0(int argc, char **argv) {
971977 init_all_targets();
972978
973979 ZigTarget target;
974 if (target_string == nullptr) {
975 get_native_target(&target);
976 if (target_glibc != nullptr) {
977 fprintf(stderr, "-target-glibc provided but no -target parameter\n");
978 return print_error_usage(arg0);
979 }
980 } else {
981 if ((err = target_parse_triple(&target, target_string))) {
982 if (err == ErrorUnknownArchitecture && target.arch != ZigLLVM_UnknownArch) {
983 fprintf(stderr, "'%s' requires a sub-architecture. Try one of these:\n",
984 target_arch_name(target.arch));
985 SubArchList sub_arch_list = target_subarch_list(target.arch);
986 size_t subarch_count = target_subarch_count(sub_arch_list);
987 for (size_t sub_i = 0; sub_i < subarch_count; sub_i += 1) {
988 ZigLLVM_SubArchType sub = target_subarch_enum(sub_arch_list, sub_i);
989 fprintf(stderr, " %s%s\n", target_arch_name(target.arch), target_subarch_name(sub));
990 }
991 return print_error_usage(arg0);
992 } else {
993 fprintf(stderr, "invalid target: %s\n", err_str(err));
994 return print_error_usage(arg0);
980 if ((err = target_parse_triple(&target, target_string, mcpu))) {
981 if (err == ErrorUnknownArchitecture && target.arch != ZigLLVM_UnknownArch) {
982 fprintf(stderr, "'%s' requires a sub-architecture. Try one of these:\n",
983 target_arch_name(target.arch));
984 SubArchList sub_arch_list = target_subarch_list(target.arch);
985 size_t subarch_count = target_subarch_count(sub_arch_list);
986 for (size_t sub_i = 0; sub_i < subarch_count; sub_i += 1) {
987 ZigLLVM_SubArchType sub = target_subarch_enum(sub_arch_list, sub_i);
988 fprintf(stderr, " %s%s\n", target_arch_name(target.arch), target_subarch_name(sub));
995989 }
990 return print_error_usage(arg0);
991 } else {
992 fprintf(stderr, "invalid target: %s\n", err_str(err));
993 return print_error_usage(arg0);
996994 }
997 if (target_is_glibc(&target)) {
998 target.glibc_version = heap::c_allocator.create<ZigGLibCVersion>();
995 }
996 if (target_is_glibc(&target)) {
997 target.glibc_version = heap::c_allocator.create<ZigGLibCVersion>();
999998
1000 if (target_glibc != nullptr) {
1001 if ((err = target_parse_glibc_version(target.glibc_version, target_glibc))) {
1002 fprintf(stderr, "invalid glibc version '%s': %s\n", target_glibc, err_str(err));
1003 return print_error_usage(arg0);
1004 }
1005 } else {
1006 target_init_default_glibc_version(&target);
999 if (target_glibc != nullptr) {
1000 if ((err = target_parse_glibc_version(target.glibc_version, target_glibc))) {
1001 fprintf(stderr, "invalid glibc version '%s': %s\n", target_glibc, err_str(err));
1002 return print_error_usage(arg0);
10071003 }
1008 } else if (target_glibc != nullptr) {
1009 fprintf(stderr, "'%s' is not a glibc-compatible target", target_string);
1010 return print_error_usage(arg0);
1004 } else {
1005 target_init_default_glibc_version(&target);
10111006 }
1007 } else if (target_glibc != nullptr) {
1008 fprintf(stderr, "'%s' is not a glibc-compatible target", target_string);
1009 return print_error_usage(arg0);
10121010 }
10131011
10141012 Buf zig_triple_buf = BUF_INIT;
10151013 target_triple_zig(&zig_triple_buf, &target);
10161014
1017 const char *stage2_triple_arg = target.is_native ? nullptr : buf_ptr(&zig_triple_buf);
1018 if ((err = stage2_cpu_features_parse(&target.cpu_features, stage2_triple_arg, cpu, features))) {
1019 fprintf(stderr, "unable to initialize CPU features: %s\n", err_str(err));
1020 return main_exit(root_progress_node, EXIT_FAILURE);
1021 }
1022
10231015 // If both output_dir and enable_cache are provided, and doing build-lib, we
10241016 // will just do a file copy at the end. This helps when bootstrapping zig from zig0
10251017 // because we want to pass something like this:
src/stage2.cpp+50-43
......@@ -4,6 +4,7 @@
44#include "stage2.h"
55#include "util.hpp"
66#include "zig_llvm.h"
7#include "target.hpp"
78#include <stdio.h>
89#include <stdlib.h>
910#include <string.h>
......@@ -90,54 +91,60 @@ void stage2_progress_complete_one(Stage2ProgressNode *node) {}
9091void stage2_progress_disable_tty(Stage2Progress *progress) {}
9192void stage2_progress_update_node(Stage2ProgressNode *node, size_t completed_count, size_t estimated_total_items){}
9293
93struct Stage2CpuFeatures {
94 const char *llvm_cpu_name;
95 const char *llvm_cpu_features;
96 const char *builtin_str;
97 const char *cache_hash;
98};
94Error stage2_target_parse(struct ZigTarget *target, const char *zig_triple, const char *mcpu) {
95 Error err;
9996
100Error stage2_cpu_features_parse(struct Stage2CpuFeatures **out, const char *zig_triple,
101 const char *cpu_name, const char *cpu_features)
102{
10397 if (zig_triple == nullptr) {
104 Stage2CpuFeatures *result = heap::c_allocator.create<Stage2CpuFeatures>();
105 result->llvm_cpu_name = ZigLLVMGetHostCPUName();
106 result->llvm_cpu_features = ZigLLVMGetNativeFeatures();
107 result->builtin_str = "arch.getBaselineCpuFeatures();\n";
108 result->cache_hash = "native\n\n";
109 *out = result;
110 return ErrorNone;
111 }
112 if (cpu_name == nullptr && cpu_features == nullptr) {
113 Stage2CpuFeatures *result = heap::c_allocator.create<Stage2CpuFeatures>();
114 result->builtin_str = "arch.getBaselineCpuFeatures();\n";
115 result->cache_hash = "\n\n";
116 *out = result;
117 return ErrorNone;
98 get_native_target(target);
99
100 target->llvm_cpu_name = ZigLLVMGetHostCPUName();
101 target->llvm_cpu_features = ZigLLVMGetNativeFeatures();
102 target->builtin_str = "Target.Cpu.baseline(arch);\n";
103 target->cache_hash = "native\n\n";
104 } else {
105 // first initialize all to zero
106 *target = {};
107
108 SplitIterator it = memSplit(str(zig_triple), str("-"));
109
110 Optional<Slice<uint8_t>> opt_archsub = SplitIterator_next(&it);
111 Optional<Slice<uint8_t>> opt_os = SplitIterator_next(&it);
112 Optional<Slice<uint8_t>> opt_abi = SplitIterator_next(&it);
113
114 if (!opt_archsub.is_some)
115 return ErrorMissingArchitecture;
116
117 if ((err = target_parse_archsub(&target->arch, &target->sub_arch,
118 (char*)opt_archsub.value.ptr, opt_archsub.value.len)))
119 {
120 return err;
121 }
122
123 if (!opt_os.is_some)
124 return ErrorMissingOperatingSystem;
125
126 if ((err = target_parse_os(&target->os, (char*)opt_os.value.ptr, opt_os.value.len))) {
127 return err;
128 }
129
130 if (opt_abi.is_some) {
131 if ((err = target_parse_abi(&target->abi, (char*)opt_abi.value.ptr, opt_abi.value.len))) {
132 return err;
133 }
134 } else {
135 target->abi = target_default_abi(target->arch, target->os);
136 }
137
138 target->builtin_str = "Target.Cpu.baseline(arch);\n";
139 target->cache_hash = "\n\n";
118140 }
119141
120 const char *msg = "stage0 called stage2_cpu_features_parse with non-null cpu name or features";
121 stage2_panic(msg, strlen(msg));
122}
142 if (mcpu != nullptr) {
143 const char *msg = "stage0 can't handle CPU/features in the target";
144 stage2_panic(msg, strlen(msg));
145 }
123146
124void stage2_cpu_features_get_cache_hash(const Stage2CpuFeatures *cpu_features,
125 const char **ptr, size_t *len)
126{
127 *ptr = cpu_features->cache_hash;
128 *len = strlen(cpu_features->cache_hash);
129}
130const char *stage2_cpu_features_get_llvm_cpu(const Stage2CpuFeatures *cpu_features) {
131 return cpu_features->llvm_cpu_name;
132}
133const char *stage2_cpu_features_get_llvm_features(const Stage2CpuFeatures *cpu_features) {
134 return cpu_features->llvm_cpu_features;
135}
136void stage2_cpu_features_get_builtin_str(const Stage2CpuFeatures *cpu_features,
137 const char **ptr, size_t *len)
138{
139 *ptr = cpu_features->builtin_str;
140 *len = strlen(cpu_features->builtin_str);
147 return ErrorNone;
141148}
142149
143150int stage2_cmd_targets(const char *zig_triple) {
src/stage2.h+14-25
......@@ -81,7 +81,6 @@ enum Error {
8181 ErrorIsAsync,
8282 ErrorImportOutsidePkgPath,
8383 ErrorUnknownCpu,
84 ErrorUnknownSubArchitecture,
8584 ErrorUnknownCpuFeature,
8685 ErrorInvalidCpuFeatures,
8786 ErrorInvalidLlvmCpuFeaturesFormat,
......@@ -200,27 +199,6 @@ ZIG_EXTERN_C void stage2_progress_complete_one(Stage2ProgressNode *node);
200199ZIG_EXTERN_C void stage2_progress_update_node(Stage2ProgressNode *node,
201200 size_t completed_count, size_t estimated_total_items);
202201
203// ABI warning
204struct Stage2CpuFeatures;
205
206// ABI warning
207ZIG_EXTERN_C enum Error stage2_cpu_features_parse(struct Stage2CpuFeatures **result,
208 const char *zig_triple, const char *cpu_name, const char *cpu_features);
209
210// ABI warning
211ZIG_EXTERN_C const char *stage2_cpu_features_get_llvm_cpu(const struct Stage2CpuFeatures *cpu_features);
212
213// ABI warning
214ZIG_EXTERN_C const char *stage2_cpu_features_get_llvm_features(const struct Stage2CpuFeatures *cpu_features);
215
216// ABI warning
217ZIG_EXTERN_C void stage2_cpu_features_get_builtin_str(const struct Stage2CpuFeatures *cpu_features,
218 const char **ptr, size_t *len);
219
220// ABI warning
221ZIG_EXTERN_C void stage2_cpu_features_get_cache_hash(const struct Stage2CpuFeatures *cpu_features,
222 const char **ptr, size_t *len);
223
224202// ABI warning
225203ZIG_EXTERN_C int stage2_cmd_targets(const char *zig_triple);
226204
......@@ -296,22 +274,33 @@ struct ZigGLibCVersion {
296274 uint32_t patch;
297275};
298276
277struct Stage2TargetData;
278
299279// ABI warning
300280struct ZigTarget {
301281 enum ZigLLVM_ArchType arch;
302282 enum ZigLLVM_SubArchType sub_arch;
283
303284 enum ZigLLVM_VendorType vendor;
304 Os os;
305285 enum ZigLLVM_EnvironmentType abi;
306 struct ZigGLibCVersion *glibc_version; // null means default
307 struct Stage2CpuFeatures *cpu_features;
286
287 Os os;
308288 bool is_native;
289
290 struct ZigGLibCVersion *glibc_version; // null means default
291
292 const char *llvm_cpu_name;
293 const char *llvm_cpu_features;
294 const char *builtin_str;
295 const char *cache_hash;
309296};
310297
311298// ABI warning
312299ZIG_EXTERN_C enum Error stage2_detect_dynamic_linker(const struct ZigTarget *target,
313300 char **out_ptr, size_t *out_len);
314301
302// ABI warning
303ZIG_EXTERN_C enum Error stage2_target_parse(struct ZigTarget *target, const char *zig_triple, const char *mcpu);
315304
316305
317306// ABI warning
src/target.cpp+2-36
......@@ -776,42 +776,8 @@ Error target_parse_abi(ZigLLVM_EnvironmentType *out_abi, const char *abi_ptr, si
776776 return ErrorUnknownABI;
777777}
778778
779Error target_parse_triple(ZigTarget *target, const char *triple) {
780 Error err;
781
782 // first initialize all to zero
783 *target = {};
784
785 SplitIterator it = memSplit(str(triple), str("-"));
786
787 Optional<Slice<uint8_t>> opt_archsub = SplitIterator_next(&it);
788 Optional<Slice<uint8_t>> opt_os = SplitIterator_next(&it);
789 Optional<Slice<uint8_t>> opt_abi = SplitIterator_next(&it);
790
791 if (!opt_archsub.is_some)
792 return ErrorMissingArchitecture;
793
794 if ((err = target_parse_archsub(&target->arch, &target->sub_arch,
795 (char*)opt_archsub.value.ptr, opt_archsub.value.len)))
796 {
797 return err;
798 }
799
800 if (!opt_os.is_some)
801 return ErrorMissingOperatingSystem;
802
803 if ((err = target_parse_os(&target->os, (char*)opt_os.value.ptr, opt_os.value.len))) {
804 return err;
805 }
806
807 if (opt_abi.is_some) {
808 if ((err = target_parse_abi(&target->abi, (char*)opt_abi.value.ptr, opt_abi.value.len))) {
809 return err;
810 }
811 } else {
812 target->abi = target_default_abi(target->arch, target->os);
813 }
814 return ErrorNone;
779Error target_parse_triple(ZigTarget *target, const char *triple, const char *mcpu) {
780 return stage2_target_parse(target, triple, mcpu);
815781}
816782
817783const char *target_arch_name(ZigLLVM_ArchType arch) {
src/target.hpp+1-1
......@@ -50,7 +50,7 @@ enum CIntType {
5050 CIntTypeCount,
5151};
5252
53Error target_parse_triple(ZigTarget *target, const char *triple);
53Error target_parse_triple(ZigTarget *target, const char *triple, const char *mcpu);
5454Error target_parse_archsub(ZigLLVM_ArchType *arch, ZigLLVM_SubArchType *sub,
5555 const char *archsub_ptr, size_t archsub_len);
5656Error target_parse_os(Os *os, const char *os_ptr, size_t os_len);
test/tests.zig+27-54
......@@ -55,20 +55,18 @@ const test_targets = blk: {
5555 TestTarget{
5656 .target = Target{
5757 .Cross = CrossTarget{
58 .cpu = Target.Cpu.baseline(.x86_64),
5859 .os = .linux,
59 .arch = .x86_64,
6060 .abi = .none,
61 .cpu_features = Target.Arch.x86_64.getBaselineCpuFeatures(),
6261 },
6362 },
6463 },
6564 TestTarget{
6665 .target = Target{
6766 .Cross = CrossTarget{
67 .cpu = Target.Cpu.baseline(.x86_64),
6868 .os = .linux,
69 .arch = .x86_64,
7069 .abi = .gnu,
71 .cpu_features = Target.Arch.x86_64.getBaselineCpuFeatures(),
7270 },
7371 },
7472 .link_libc = true,
......@@ -76,9 +74,8 @@ const test_targets = blk: {
7674 TestTarget{
7775 .target = Target{
7876 .Cross = CrossTarget{
77 .cpu = Target.Cpu.baseline(.x86_64),
7978 .os = .linux,
80 .arch = .x86_64,
81 .cpu_features = Target.Arch.x86_64.getBaselineCpuFeatures(),
8279 .abi = .musl,
8380 },
8481 },
......@@ -88,9 +85,8 @@ const test_targets = blk: {
8885 TestTarget{
8986 .target = Target{
9087 .Cross = CrossTarget{
88 .cpu = Target.Cpu.baseline(.i386),
9189 .os = .linux,
92 .arch = .i386,
93 .cpu_features = Target.Arch.i386.getBaselineCpuFeatures(),
9490 .abi = .none,
9591 },
9692 },
......@@ -98,9 +94,8 @@ const test_targets = blk: {
9894 TestTarget{
9995 .target = Target{
10096 .Cross = CrossTarget{
97 .cpu = Target.Cpu.baseline(.i386),
10198 .os = .linux,
102 .arch = .i386,
103 .cpu_features = Target.Arch.i386.getBaselineCpuFeatures(),
10499 .abi = .musl,
105100 },
106101 },
......@@ -110,9 +105,8 @@ const test_targets = blk: {
110105 TestTarget{
111106 .target = Target{
112107 .Cross = CrossTarget{
108 .cpu = Target.Cpu.baseline(.aarch64),
113109 .os = .linux,
114 .arch = Target.Arch{ .aarch64 = .v8a },
115 .cpu_features = (Target.Arch{ .aarch64 = .v8a }).getBaselineCpuFeatures(),
116110 .abi = .none,
117111 },
118112 },
......@@ -120,9 +114,8 @@ const test_targets = blk: {
120114 TestTarget{
121115 .target = Target{
122116 .Cross = CrossTarget{
117 .cpu = Target.Cpu.baseline(.aarch64),
123118 .os = .linux,
124 .arch = Target.Arch{ .aarch64 = .v8a },
125 .cpu_features = (Target.Arch{ .aarch64 = .v8a }).getBaselineCpuFeatures(),
126119 .abi = .musl,
127120 },
128121 },
......@@ -131,9 +124,8 @@ const test_targets = blk: {
131124 TestTarget{
132125 .target = Target{
133126 .Cross = CrossTarget{
127 .cpu = Target.Cpu.baseline(.aarch64),
134128 .os = .linux,
135 .arch = Target.Arch{ .aarch64 = .v8a },
136 .cpu_features = (Target.Arch{ .aarch64 = .v8a }).getBaselineCpuFeatures(),
137129 .abi = .gnu,
138130 },
139131 },
......@@ -141,45 +133,32 @@ const test_targets = blk: {
141133 },
142134
143135 TestTarget{
144 .target = Target{
145 .Cross = CrossTarget{
146 .os = .linux,
147 .arch = Target.Arch{ .arm = .v8a },
148 .cpu_features = (Target.Arch{ .arm = .v8a }).getBaselineCpuFeatures(),
149 .abi = .none,
150 },
151 },
136 .target = Target.parse(.{
137 .arch_os_abi = "arm-linux-none",
138 .cpu = "generic+v8a",
139 }) catch unreachable,
152140 },
153141 TestTarget{
154 .target = Target{
155 .Cross = CrossTarget{
156 .os = .linux,
157 .arch = Target.Arch{ .arm = .v8a },
158 .cpu_features = (Target.Arch{ .arm = .v8a }).getBaselineCpuFeatures(),
159 .abi = .musleabihf,
160 },
161 },
142 .target = Target.parse(.{
143 .arch_os_abi = "arm-linux-musleabihf",
144 .cpu = "generic+v8a",
145 }) catch unreachable,
162146 .link_libc = true,
163147 },
164148 // TODO https://github.com/ziglang/zig/issues/3287
165149 //TestTarget{
166 // .target = Target{
167 // .Cross = CrossTarget{
168 // .os = .linux,
169 // .arch = Target.Arch{ .arm = .v8a },
170 // .cpu_features = (Target.Arch{ .arm = .v8a }).getBaselineCpuFeatures(),
171 // .abi = .gnueabihf,
172 // },
173 // },
150 // .target = Target.parse(.{
151 // .arch_os_abi = "arm-linux-gnueabihf",
152 // .cpu = "generic+v8a",
153 // }) catch unreachable,
174154 // .link_libc = true,
175155 //},
176156
177157 TestTarget{
178158 .target = Target{
179159 .Cross = CrossTarget{
160 .cpu = Target.Cpu.baseline(.mipsel),
180161 .os = .linux,
181 .arch = .mipsel,
182 .cpu_features = Target.Arch.mipsel.getBaselineCpuFeatures(),
183162 .abi = .none,
184163 },
185164 },
......@@ -187,9 +166,8 @@ const test_targets = blk: {
187166 TestTarget{
188167 .target = Target{
189168 .Cross = CrossTarget{
169 .cpu = Target.Cpu.baseline(.mipsel),
190170 .os = .linux,
191 .arch = .mipsel,
192 .cpu_features = Target.Arch.mipsel.getBaselineCpuFeatures(),
193171 .abi = .musl,
194172 },
195173 },
......@@ -199,9 +177,8 @@ const test_targets = blk: {
199177 TestTarget{
200178 .target = Target{
201179 .Cross = CrossTarget{
180 .cpu = Target.Cpu.baseline(.x86_64),
202181 .os = .macosx,
203 .arch = .x86_64,
204 .cpu_features = Target.Arch.x86_64.getBaselineCpuFeatures(),
205182 .abi = .gnu,
206183 },
207184 },
......@@ -212,9 +189,8 @@ const test_targets = blk: {
212189 TestTarget{
213190 .target = Target{
214191 .Cross = CrossTarget{
192 .cpu = Target.Cpu.baseline(.i386),
215193 .os = .windows,
216 .arch = .i386,
217 .cpu_features = Target.Arch.i386.getBaselineCpuFeatures(),
218194 .abi = .msvc,
219195 },
220196 },
......@@ -223,9 +199,8 @@ const test_targets = blk: {
223199 TestTarget{
224200 .target = Target{
225201 .Cross = CrossTarget{
202 .cpu = Target.Cpu.baseline(.x86_64),
226203 .os = .windows,
227 .arch = .x86_64,
228 .cpu_features = Target.Arch.x86_64.getBaselineCpuFeatures(),
229204 .abi = .msvc,
230205 },
231206 },
......@@ -234,9 +209,8 @@ const test_targets = blk: {
234209 TestTarget{
235210 .target = Target{
236211 .Cross = CrossTarget{
212 .cpu = Target.Cpu.baseline(.i386),
237213 .os = .windows,
238 .arch = .i386,
239 .cpu_features = Target.Arch.i386.getBaselineCpuFeatures(),
240214 .abi = .gnu,
241215 },
242216 },
......@@ -246,9 +220,8 @@ const test_targets = blk: {
246220 TestTarget{
247221 .target = Target{
248222 .Cross = CrossTarget{
223 .cpu = Target.Cpu.baseline(.x86_64),
249224 .os = .windows,
250 .arch = .x86_64,
251 .cpu_features = Target.Arch.x86_64.getBaselineCpuFeatures(),
252225 .abi = .gnu,
253226 },
254227 },