1 # Manipulate the CPU, FPU and architecture descriptions for ARM.
2 # Copyright (C) 2017-2025 Free Software Foundation, Inc.
4 # This file is part of GCC.
6 # GCC is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3, or (at your option)
11 # GCC is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GCC; see the file COPYING3. If not see
18 # <http://www.gnu.org/licenses/>.
20 # Invoke this with '-v cmd=<cmd>"
21 # where <cmd> is one of:
22 # data: Print the standard 'C' data tables for the CPUs
23 # common-data: Print the 'C' data for shared driver/compiler files
24 # native: Print the data structures used by the native driver
25 # headers: Print the standard 'C' headers for the CPUs
26 # isa: Generate the arm-isa.h header
27 # md: Print the machine description fragment
28 # opt: Print the option tables fragment
29 # chkcpu <name>: Checks that <name> is a valid CPU
30 # chktune <name>: Checks that <name> is a valid CPU
31 # chkfpu <name>: Checks that <name> is a valid FPU
32 # chkarch <name>: Checks that <arch> is a valid architecture
35 print "error ("lineno
"): " m
> "/dev/stderr"
37 if (parse_done
) exit 1
40 function toplevel
() {
41 if (cpu_name
!= "") fatal
("missing \"end cpu\"")
42 if (arch_name
!= "") fatal
("missing \"end arch\"")
43 if (fpu_name
!= "") fatal
("missing \"end fpu\"")
46 function boilerplate
(style
) {
52 } else if (style ==
"md") {
55 } else if (style ==
"sh") {
58 } else fatal
("Unknown comment style: "style
)
60 print cs
"-*- buffer-read-only: t -*-"
62 print cc
"Generated automatically by parsecpu.awk from arm-cpus.in."
63 print cc
"Do not edit."
65 print cc
"Copyright (C) 2011-2025 Free Software Foundation, Inc."
67 print cc
"This file is part of GCC."
69 print cc
"GCC is free software; you can redistribute it and/or modify"
70 print cc
"it under the terms of the GNU General Public License as"
71 print cc
"published by the Free Software Foundation; either version 3,"
72 print cc
"or (at your option) any later version."
74 print cc
"GCC is distributed in the hope that it will be useful,"
75 print cc
"but WITHOUT ANY WARRANTY; without even the implied warranty of"
76 print cc
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
77 print cc
"GNU General Public License for more details."
79 print cc
"You should have received a copy of the GNU General Public"
80 print cc
"License along with GCC; see the file COPYING3. If not see"
81 print cc
"<http://www.gnu.org/licenses/>." ce
85 function tune_flag_pfx
(f
) {
89 # Print out the bits for the features in FLIST, which may be a
90 # mixture of fgroup and individual bits. Print each feature needed
91 # exactly once. Terminate the list with isa_nobit. Prefix each line by
92 # INDENT. Does not print a new line at the end.
93 function print_isa_bits_for
(flist
, indent
) {
94 nbits =
split (flist
, bits
)
96 for (bit =
1; bit
<= nbits
; bit
++) {
97 if (bits
[bit
] in features
) {
99 } else if (bits
[bit
] in fgroup
) {
100 for (gbits in fgrp_bits
) {
101 split (gbits
, bitsep
, SUBSEP
)
102 if (bitsep
[1] == bits
[bit
]) {
106 } else fatal
("feature " bits
[bit
] " not declared")
110 print indent
"{\n" indent
" "
113 for (bname in pbit
) {
114 print "isa_bit_" bname
119 print "\n" indent
" "
124 print "isa_nobit\n" indent
"}"
129 function gen_headers
() {
132 print "enum processor_type"
135 ncpus =
split (cpu_list
, cpus
)
137 for (n =
1; n
<= ncpus
; n
++) {
138 print " TARGET_CPU_"cpu_cnames
[cpus
[n
]]","
140 print " TARGET_CPU_arm_none"
143 print "enum arch_type"
146 narchs =
split (arch_list
, archs
)
148 for (n =
1; n
<= narchs
; n
++) {
149 print " TARGET_ARCH_"arch_cnames
[archs
[n
]]","
151 print " TARGET_ARCH_arm_none"
154 print "enum fpu_type"
157 nfpus =
split (fpu_list
, fpus
)
159 for (n =
1; n
<= nfpus
; n
++) {
160 print " TARGET_FPU_"fpu_cnames
[fpus
[n
]]","
162 print " TARGET_FPU_auto"
166 function gen_isa
() {
168 print "enum isa_feature {"
169 print " isa_nobit = 0,"
170 for (fbit in features
) {
171 print " isa_bit_" fbit
","
173 print " isa_num_bits"
176 for (fgrp in fgroup
) {
177 print "#define ISA_"fgrp
" \\"
181 for (bitcomb in fgrp_bits
) {
182 split (bitcomb
, bitsep
, SUBSEP
)
183 if (bitsep
[1] == fgrp
) {
186 } else print ", \\\n"
187 print " isa_bit_" bitsep
[2]
194 print "struct fbit_implication {"
195 print " /* Represents a feature implication, where:"
196 print " ante IMPLIES cons"
197 print " meaning that if ante is enabled then we should"
198 print " also implicitly enable cons. */"
199 print " enum isa_feature ante;"
200 print " enum isa_feature cons;"
202 print "static const struct fbit_implication all_implied_fbits[] ="
204 for (impl in implied_bits
) {
205 split (impl
, impl_parts
, SUBSEP
)
206 print " { isa_bit_" impl_parts
[2] ", isa_bit_" impl_parts
[1] " },"
208 print " { isa_nobit, isa_nobit }"
212 function gen_data
() {
215 print "static const cpu_tune all_tunes[] ="
218 ncpus =
split (cpu_list
, cpus
)
220 for (n =
1; n
<= ncpus
; n
++) {
221 print " { /* " cpus
[n
] ". */"
223 if (cpus
[n
] in cpu_tune_for
) {
224 if (!
(cpu_tune_for
[cpus
[n
]] in cpu_cnames
)) {
225 fatal
("unknown \"tune for\" target " cpu_tune_for
[cpus
[n
]] \
228 print " TARGET_CPU_" cpu_cnames
[cpu_tune_for
[cpus
[n
]]] ","
230 print " TARGET_CPU_" cpu_cnames
[cpus
[n
]] ","
233 if (cpus
[n
] in cpu_tune_flags
) {
234 print " (" cpu_tune_flags
[cpus
[n
]] "),"
237 print " &arm_" cpu_cost
[cpus
[n
]] "_tune"
240 print " {TARGET_CPU_arm_none, 0, NULL}"
244 function gen_comm_data
() {
247 ncpus =
split (cpu_list
, cpus
)
249 for (n =
1; n
<= ncpus
; n
++) {
250 if (cpus
[n
] in cpu_opts
) {
251 print "static const cpu_arch_extension cpu_opttab_" \
252 cpu_cnames
[cpus
[n
]] "[] = {"
253 nopts =
split (cpu_opts
[cpus
[n
]], opts
)
254 for (opt =
1; opt
<= nopts
; opt
++) {
256 print " \"" opts
[opt
] "\", " \
257 cpu_opt_remove
[cpus
[n
],opts
[opt
]] ", false,"
258 print_isa_bits_for
(cpu_opt_isa
[cpus
[n
],opts
[opt
]], " ")
261 if (cpus
[n
] in cpu_optaliases
) {
262 naliases =
split (cpu_optaliases
[cpus
[n
]], aliases
)
263 for (alias =
1; alias
<= naliases
; alias
++) {
265 cpu_opt_alias
[cpus
[n
],aliases
[alias
]]) in \
267 fatal
("Alias " aliases
[alias
] " target not defined " \
270 equiv=cpu_opt_alias
[cpus
[n
],aliases
[alias
]]
272 print " \"" aliases
[alias
] "\", " \
273 cpu_opt_remove
[cpus
[n
],equiv
] ", true, "
274 print_isa_bits_for
(cpu_opt_isa
[cpus
[n
],equiv
], " ")
278 print " { NULL, false, false, {isa_nobit}}"
282 if (cpus
[n
] in cpu_aliases
) {
283 print "static const cpu_alias cpu_aliastab_" \
284 cpu_cnames
[cpus
[n
]] "[] = {"
285 naliases =
split (cpu_aliases
[cpus
[n
]], aliases
)
286 for (alias =
1; alias
<= naliases
; alias
++) {
287 print " { \"" aliases
[alias
] "\", " \
288 cpu_alias_visible
[cpus
[n
],aliases
[alias
]] "},"
290 print " { NULL, false}"
295 print "const cpu_option all_cores[] ="
298 for (n =
1; n
<= ncpus
; n
++) {
302 print " \"" cpus
[n
] "\","
304 if (cpus
[n
] in cpu_opts
) {
305 print " cpu_opttab_" cpu_cnames
[cpus
[n
]] ","
306 } else print " NULL,"
308 nfeats =
split (cpu_arch
[cpus
[n
]], feats
, "+")
309 if (!
(feats
[1] in arch_isa
)) {
310 fatal
("unknown arch " feats
[1] " for cpu " cpus
[n
])
312 all_isa_bits = arch_isa
[feats
[1]]
313 for (m =
2; m
<= nfeats
; m
++) {
314 if (!
((feats
[1], feats
[m
]) in arch_opt_isa
)) {
315 fatal
("unknown feature " feats
[m
] " for architecture " feats
[1])
317 if (arch_opt_remove
[feats
[1],feats
[m
]] ==
"true") {
318 fatal
("cannot remove features from architecture specs")
320 all_isa_bits = all_isa_bits
" " arch_opt_isa
[feats
[1],feats
[m
]]
322 if (cpus
[n
] in cpu_isa
) {
323 all_isa_bits = all_isa_bits
" " cpu_isa
[cpus
[n
]]
325 print_isa_bits_for
(all_isa_bits
, " ")
328 if (cpus
[n
] in cpu_aliases
) {
329 print " cpu_aliastab_" cpu_cnames
[cpus
[n
]] ","
330 } else print " NULL,"
332 print " TARGET_ARCH_" arch_cnames
[feats
[1]]
336 print " {{NULL, NULL, {isa_nobit}}, NULL, TARGET_ARCH_arm_none}"
339 narchs =
split (arch_list
, archs
)
341 for (n =
1; n
<= narchs
; n
++) {
342 if (archs
[n
] in arch_opts
) {
343 print "static const struct cpu_arch_extension arch_opttab_" \
344 arch_cnames
[archs
[n
]] "[] = {"
345 nopts =
split (arch_opts
[archs
[n
]], opts
)
346 for (opt =
1; opt
<= nopts
; opt
++) {
348 print " \"" opts
[opt
] "\", " \
349 arch_opt_remove
[archs
[n
],opts
[opt
]] ", false,"
350 print_isa_bits_for
(arch_opt_isa
[archs
[n
],opts
[opt
]], " ")
353 if (archs
[n
] in arch_optaliases
) {
354 naliases =
split (arch_optaliases
[archs
[n
]], aliases
)
355 for (alias =
1; alias
<= naliases
; alias
++) {
357 arch_opt_alias
[archs
[n
],aliases
[alias
]]) in \
359 fatal
("Alias " aliases
[alias
] " target not defined " \
360 "for architecture " archs
[n
])
362 equiv=arch_opt_alias
[archs
[n
],aliases
[alias
]]
364 print " \"" aliases
[alias
] "\", " \
365 arch_opt_remove
[archs
[n
],equiv
] ", true, "
366 print_isa_bits_for
(arch_opt_isa
[archs
[n
],equiv
], " ")
370 print " { NULL, false, false, {isa_nobit}}"
372 } else if (archs
[n
] in arch_optaliases
) {
373 fatal
("Architecture " archs
[n
] " has option aliases but no options")
377 print "const arch_option all_architectures[] ="
380 for (n =
1; n
<= narchs
; n
++) {
382 if (!
(arch_tune_for
[archs
[n
]] in cpu_cnames
)) {
383 fatal
("unknown \"tune for\" target " arch_tune_for
[archs
[n
]] \
384 " for architecture " archs
[n
])
387 print " \"" archs
[n
] "\","
389 if (archs
[n
] in arch_opts
) {
390 print " arch_opttab_" arch_cnames
[archs
[n
]] ","
391 } else print " NULL,"
393 print_isa_bits_for
(arch_isa
[archs
[n
]], " ")
396 print " \"" arch_base
[archs
[n
]] "\", BASE_ARCH_" \
397 arch_base
[archs
[n
]] ","
398 # profile letter code, or zero if none.
399 if (archs
[n
] in arch_prof
) {
400 print " '" arch_prof
[archs
[n
]] "',"
405 print " TARGET_CPU_" cpu_cnames
[arch_tune_for
[archs
[n
]]] ","
409 print " {{NULL, NULL, {isa_nobit}},"
410 print " NULL, BASE_ARCH_0, 0, TARGET_CPU_arm_none}"
413 print "const arm_fpu_desc all_fpus[] ="
416 nfpus =
split (fpu_list
, fpus
)
418 for (n =
1; n
<= nfpus
; n
++) {
420 print " \"" fpus
[n
] "\","
421 print_isa_bits_for
(fpu_isa
[fpus
[n
]], " ")
428 function gen_native
() {
431 for (vendor in vendor_ids
) {
432 print "static struct vendor_cpu vendor"vendor
"_cpu_table[] = {"
433 ncpus =
split (cpu_list
, cpus
)
435 for (n =
1; n
<= ncpus
; n
++) {
436 if ((cpus
[n
] in cpu_vendor
) && (cpus
[n
] in cpu_part
) \
437 && cpu_vendor
[cpus
[n
]] == vendor
) {
438 print " {\"0x"cpu_part
[cpus
[n
]]"\", \""cpu_arch
[cpus
[n
]]"\", \""cpus
[n
]"\"},"
441 print " {NULL, NULL, NULL}"
445 print "\nstatic struct vendor vendors_table[] = {"
446 for (vendor in vendor_ids
) {
447 print " {\"0x"vendor
"\", vendor"vendor
"_cpu_table},"
449 print " {NULL, NULL}"
458 print "(define_attr \"tune\"\n\t\""
460 ncpus =
split (cpu_list
, cpus
)
462 for (n =
1; n
< ncpus
; n
++) {
466 print cpu_cnames
[cpus
[n
]]
469 print cpu_cnames
[cpus
[ncpus
]]"\""
470 print "\t(const (symbol_ref \"((enum attr_tune) arm_tune)\")))"
473 function gen_opt
() {
477 print "Name(processor_type) Type(enum processor_type)"
478 print "Known ARM CPUs (for use with the -mcpu= and -mtune= options):\n"
480 ncpus =
split (cpu_list
, cpus
)
482 for (n =
1; n
<= ncpus
; n
++) {
484 print "Enum(processor_type) String(" cpus
[n
] \
485 ") Value( TARGET_CPU_"cpu_cnames
[cpus
[n
]]")"
490 print "Name(arm_arch) Type(int)"
491 print "Known ARM architectures (for use with the -march= option):\n"
493 narchs =
split (arch_list
, archs
)
495 for (n =
1; n
<= narchs
; n
++) {
497 print "Enum(arm_arch) String(" archs
[n
] \
503 print "Name(arm_fpu) Type(enum fpu_type)"
504 print "Known ARM FPUs (for use with the -mfpu= option):\n"
506 nfpus =
split (fpu_list
, fpus
)
508 for (n =
1; n
<= nfpus
; n
++) {
510 print "Enum(arm_fpu) String(" fpus
[n
] \
511 ") Value(TARGET_FPU_"fpu_cnames
[fpus
[n
]]")"
516 print "Enum(arm_fpu) String(auto) Value(TARGET_FPU_auto)"
519 function check_cpu
(name
) {
520 exts =
split (name
, extensions
, "+")
522 cpu_name = extensions
[1]
523 if (!
(cpu_name in cpu_cnames
)) {
524 if (!
(cpu_name in cpu_all_aliases
)) {
527 cpu_name = cpu_all_aliases
[cpu_name
]
530 for (n =
2; n
<= exts
; n
++) {
531 if (!
((cpu_name
, extensions
[n
]) in cpu_opt_remove
) \
532 && !
((cpu_name
, extensions
[n
]) in cpu_opt_alias
)) {
539 function check_fpu
(name
) {
540 if (!
(name in fpu_cnames
)) {
543 return fpu_cnames
[name
]
546 function check_arch
(name
) {
547 exts =
split (name
, extensions
, "+")
549 if (!
(extensions
[1] in arch_isa
)) {
553 for (n =
2; n
<= exts
; n
++) {
554 if (!
((extensions
[1], extensions
[n
]) in arch_opt_remove
) \
555 && !
((extensions
[1], extensions
[n
]) in arch_opt_alias
)) {
569 if (cmd ==
"") fatal
("Usage parsecpu.awk -v cmd=<xyz>")
572 # New line. Reset parse status and increment line count for error messages
578 # Comments must be on a line on their own.
584 if (NF != 3) fatal
("syntax: define feature <name>")
587 if (fbit in features
) fatal
("feature " fbit
" already defined")
593 if (NF < 4) fatal
("syntax: define fgroup <name> <feature> [<feature>]*")
596 if (fgrp in fgroup
) fatal
("feature group " fgrp
" already defined")
597 if (fgrp in features
) fatal
("feature group " fgrp
" aliases a feature")
599 for (n =
4; n
<= fcount
; n
++) {
601 if (feat in features
) {
602 fgrp_bits
[fgrp
,feat
] =
1
603 } else if (feat in fgroup
) {
604 # fgroups may reference other fgroups, copy their bits
605 # to our bits. To avoid recursion we don't set fgroup[fgrp]
606 # until after we have done this, so such attempts will result
607 # in an invalid group definition.
608 for (bitcomb in fgrp_bits
) {
609 split (bitcomb
, bitsep
, SUBSEP
)
610 if (bitsep
[1] == feat
) {
611 fgrp_bits
[fgrp
,bitsep
[2]] =
1
614 } else fatal
("feature group member " feat
" unrecognized")
621 if (NF < 4) fatal
("syntax: define implied <name> [<feature-or-fgroup>]+\n" \
622 "Implied bits must be defined with at least one antecedent.")
625 if (fbit in features
) fatal
("implied feature " fbit
" aliases a real feature")
626 if (fbit in fgroup
) fatal
("implied feature " fbit
" aliases a feature group")
629 for (n =
4; n
<= fcount
; n
++) {
631 if (fbit == ante
) fatal
("feature cannot imply itself")
632 else if (ante in features
) {
633 for (impl in implied_bits
) {
634 split(impl
, impl_sep
, SUBSEP
)
635 if (ante == impl_sep
[1])
636 fatal
(ante
" implies implied bit " fbit \
637 ". Chained implications not currently supported")
639 implied_bits
[fbit
, ante
] =
1
640 } else if (ante in fgroup
) {
641 for (bitcomb in fgrp_bits
) {
642 split(bitcomb
, bitsep
, SUBSEP
)
643 if (bitsep
[1] == ante
) {
644 implied_bits
[fbit
, bitsep
[2]] =
1
648 fatal
("implied bit antecedent " ante
" unrecognized")
655 if (NF != 3) fatal
("syntax: begin fpu <name>")
662 if (NF != 3) fatal
("syntax: end fpu <name>")
663 if (fpu_name
!= $
3) fatal
("mimatched end fpu")
664 if (!
(fpu_name in fpu_isa
)) {
665 fatal
("fpu definition \"" fpu_name
"\" lacks an \"isa\" statement")
667 fpu_cnames
[fpu_name
] = fpu_name
668 gsub(/[-+.
]/, "_", fpu_cnames
[fpu_name
])
669 fpu_list = fpu_list
" " fpu_name
675 if (NF != 3) fatal
("syntax: begin arch <name>")
682 if (NF != 2) fatal
("syntax: base <architecture-base-name>")
683 if (arch_name ==
"") fatal
("\"base\" statement outside of arch block")
684 arch_base
[arch_name
] = $
2
689 if (NF != 2) fatal
("syntax: profile <profile-name>")
690 if (arch_name ==
"") fatal
("\"profile\" statement outside of arch block")
691 arch_prof
[arch_name
] = $
2
696 if (NF != 3) fatal
("syntax: end arch <name>")
697 if (arch_name
!= $
3) fatal
("mimatched end arch")
698 if (!
(arch_name in arch_tune_for
)) {
699 fatal
("arch definition lacks a \"tune for\" statement")
701 if (!
(arch_name in arch_isa
)) {
702 fatal
("arch definition lacks an \"isa\" statement")
704 arch_list = arch_list
" " arch_name
705 arch_cnames
[arch_name
] = arch_name
706 gsub(/[-+.
]/, "_", arch_cnames
[arch_name
])
712 if (NF != 3) fatal
("syntax: begin cpu <name>")
716 if (cpu_name in cpu_cnames
) {
717 fatal
(cpu_name
" is already defined")
719 if (cpu_name in cpu_all_aliases
) {
720 fatal
(cpu_name
" has already been defined as an alias")
725 if (NF != 2) fatal
("syntax: cname <identifier>")
726 if (cpu_name ==
"") fatal
("\"cname\" outside of cpu block")
727 cpu_cnames
[cpu_name
] = $
2
732 if (NF < 2) fatal
("syntax: alias <name>+")
733 if (cpu_name ==
"") fatal
("\"alias\" outside of cpu block")
735 for (n =
2; n
<= alias_count
; n
++) {
738 if (alias ~
/^!.
*/) {
740 gsub(/^!
/, "", alias
)
742 if (alias in cpu_cnames
) {
743 fatal
(alias
" is already defined as a cpu name")
746 cpu_aliases
[cpu_name
] = alias
747 } else cpu_aliases
[cpu_name
] = cpu_aliases
[cpu_name
] " " alias
748 cpu_alias_visible
[cpu_name
,alias
] = visible
749 if (alias in cpu_all_aliases
) {
750 fatal
(alias
" is already an alias for " cpu_all_aliases
[alias
])
752 cpu_all_aliases
[alias
] = cpu_name
758 if (NF != 3) fatal
("syntax: tune for <cpu-name>")
759 if (cpu_name
!= "") {
760 cpu_tune_for
[cpu_name
] = $
3
761 } else if (arch_name
!= "") {
762 arch_tune_for
[arch_name
] = $
3
763 } else fatal
("\"tune for\" outside of cpu or arch block")
768 if (NF < 3) fatal
("syntax: tune flags <flag> [<flag>]*")
771 for (n =
3; n
<= flag_count
; n
++) {
773 flags = tune_flag_pfx
($n
)
774 } else flags = flags
" | " tune_flag_pfx
($n
)
776 if (cpu_name
!= "") {
777 cpu_tune_flags
[cpu_name
] = flags
778 } else if (arch_name
!= "") {
779 arch_tune_flags
[arch_name
] = flags
780 } else fatal
("\"tune flags\" outside of cpu or arch block")
784 /^
[ ]*architecture
/ {
785 if (NF != 2) fatal
("syntax: architecture <arch-name>")
786 if (cpu_name ==
"") fatal
("\"architecture\" outside of cpu block")
787 cpu_arch
[cpu_name
] = $
2
792 if (NF < 2) fatal
("syntax: isa <feature-or-fgroup> [<feature-or-fgroup>]*")
795 for (n =
2; n
<= flag_count
; n
++) {
798 } else flags = flags
" " $n
800 if (cpu_name
!= "") {
801 cpu_isa
[cpu_name
] = flags
802 } else if (arch_name
!= "") {
803 arch_isa
[arch_name
] = flags
804 } else if (fpu_name
!= "") {
805 fpu_isa
[fpu_name
] = flags
806 } else fatal
("\"isa\" outside of cpu, fpu or arch block")
811 if (NF < 4) fatal
("syntax: option <name> add|remove <feature-or-fgroup>+")
815 } else if ($
3 ==
"remove") {
817 } else fatal
("syntax: option <name> add|remove isa-list")
820 for (n =
4; n
<= flag_count
; n
++) {
823 } else flags = flags
" " $n
825 if (cpu_name
!= "") {
826 cpu_opts
[cpu_name
] = cpu_opts
[cpu_name
] " " name
827 cpu_opt_remove
[cpu_name
,name
] = remove
828 cpu_opt_isa
[cpu_name
,name
] = flags
829 } else if (arch_name
!= "") {
830 arch_opts
[arch_name
] = arch_opts
[arch_name
] " " name
831 arch_opt_remove
[arch_name
,name
] = remove
832 arch_opt_isa
[arch_name
,name
] = flags
833 } else fatal
("\"option\" outside of cpu or arch block")
838 if (NF != 3) fatal
("syntax: optalias <name> <option-name>")
841 if (cpu_name
!= "") {
842 cpu_optaliases
[cpu_name
] = cpu_optaliases
[cpu_name
] " " name
843 cpu_opt_alias
[cpu_name
,name
] = alias
844 } else if (arch_name
!= "") {
845 arch_optaliases
[arch_name
] = arch_optaliases
[arch_name
] " " name
846 arch_opt_alias
[arch_name
,name
] = alias
847 } else fatal
("\"optalias\" outside of cpu or arch block")
852 if (NF != 2) fatal
("syntax: costs <identifier>")
853 if (cpu_name ==
"") fatal
("\"costs\" outside of cpu block")
854 cpu_cost
[cpu_name
] = $
2
859 if (NF != 2) fatal
("syntax: vendor <vendor-id>")
860 if (cpu_name ==
"") fatal
("\"vendor\" outside of cpu block")
861 cpu_vendor
[cpu_name
] = $
2
867 if (NF < 2 || NF > 4) fatal
("syntax: part <part-id> [minrev [maxrev]]")
868 if (cpu_name ==
"") fatal
("\"part\" outside of cpu block")
869 cpu_part
[cpu_name
] = $
2
870 if (NF > 2) cpu_minrev
[cpu_name
] = $
3
871 if (NF ==
4) cpu_maxrev
[cpu_name
] = $
4
876 if (NF != 3) fatal
("syntax: end cpu <name>")
877 if (cpu_name
!= $
3) fatal
("mimatched end cpu")
878 if (!
(cpu_name in cpu_cnames
)) {
879 cpu_cnames
[cpu_name
] = cpu_name
880 gsub(/[-+.
]/, "_", cpu_cnames
[cpu_name
])
882 if (!
(cpu_name in cpu_arch
)) fatal
("cpu definition lacks an architecture")
883 if ((cpu_name in cpu_part
) && !
(cpu_name in cpu_vendor
)) {
884 fatal
("part number specified for " cpu_name
" but no vendor")
886 cpu_list = cpu_list
" " cpu_name
892 if (! parse_ok
) fatal
("Unrecognized statement: " $
0)
897 if (fatal_err
) exit 1
901 } else if (cmd ==
"common-data") {
903 } else if (cmd ==
"native") {
905 } else if (cmd ==
"headers") {
907 } else if (cmd ==
"isa") {
909 } else if (cmd ==
"md") {
911 } else if (cmd ==
"opt") {
913 } else if (cmd ~
/^chk
(cpu
|tune
) /) {
915 print check_cpu
(target
[2])
916 } else if (cmd ~
/^chkarch
/) {
918 print check_arch
(target
[2])
919 } else if (cmd ~
/^chkfpu
/) {
921 print check_fpu
(target
[2])
922 } else fatal
("unrecognized command: "cmd
)