* c-ada-spec.c (dump_number): Add FLOAT_P parameter.
[official-gcc.git] / gcc / config / arc / genmultilib.awk
blob9cfbd12fda45a1d58e973839f6ed9bd9f9097207
1 # Copyright (C) 2016-2018 Free Software Foundation, Inc.
3 # This file is part of GCC.
5 # GCC is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License as published by the Free
7 # Software Foundation; either version 3, or (at your option) any later
8 # version.
10 # GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with GCC; see the file COPYING3. If not see
17 # <http://www.gnu.org/licenses/>.
19 ##################################################################
21 # This file is using AVR's genmultilib.awk idea.
22 # Transform CPU Information from arc-cpu.def to a
23 # Representation that is understood by GCC's multilib Machinery.
25 # The Script works as a Filter from STDIN to STDOUT.
27 # FORMAT = "Makefile": Generate Makefile Snipet that sets some
28 # MULTILIB_* Variables as needed.
30 ##################################################################
32 BEGIN {
33 FS ="[(, \t)]+"
34 comment = 1
35 n_cores = 0
36 n_reuse = 0
39 ##################################################################
40 # Add some Comments to the generated Files and copy-paste
41 # Copyright Notice from above.
42 ##################################################################
43 /^#/ {
44 if (!comment)
45 next
46 else if (comment == 1)
48 if (FORMAT == "Makefile")
50 print "# Auto-generated Makefile Snip"
51 print "# Generated by : ./gcc/config/arc/genmultilib.awk"
52 print "# Generated from : ./gcc/config/arc/arc-cpu.def"
53 print "# Used by : tmake_file from Makefile and genmultilib"
54 print ""
58 comment = 2;
60 print
63 /^$/ {
64 # The first empty line stops copy-pasting the GPL comments
65 # from this file to the generated file.
67 comment = 0
71 /^ARC_CPU/ {
72 name = $2
73 # gsub ("\"", "", name)
75 if ($4 != "0")
77 arch = $3
78 if (arch == "6xx")
79 arch = 601
81 n = split ($4, cpu_flg, "|")
83 line = "mcpu." arch
84 for (i = 1; i <= n; i++)
86 if (cpu_flg[i] == "FL_MPYOPT_0")
87 line = line "/mmpy-option.0"
88 else if (cpu_flg[i] == "FL_MPYOPT_1")
89 line = line "/mmpy-option.1"
90 else if (cpu_flg[i] == "FL_MPYOPT_2")
91 line = line "/mmpy-option.2"
92 else if (cpu_flg[i] == "FL_MPYOPT_3")
93 line = line "/mmpy-option.3"
94 else if (cpu_flg[i] == "FL_MPYOPT_4")
95 line = line "/mmpy-option.4"
96 else if (cpu_flg[i] == "FL_MPYOPT_5")
97 line = line "/mmpy-option.5"
98 else if (cpu_flg[i] == "FL_MPYOPT_6")
99 line = line "/mmpy-option.6"
100 else if (cpu_flg[i] == "FL_MPYOPT_7")
101 line = line "/mmpy-option.7"
102 else if (cpu_flg[i] == "FL_MPYOPT_8")
103 line = line "/mmpy-option.8"
104 else if (cpu_flg[i] == "FL_MPYOPT_9")
105 line = line "/mmpy-option.9"
106 else if (cpu_flg[i] == "FL_CD")
107 line = line "/mcode-density"
108 else if (cpu_flg[i] == "FL_BS")
109 line = line "/mbarrel-shifter"
110 else if (cpu_flg[i] == "FL_DIVREM")
111 line = line "/mdiv-rem"
112 else if (cpu_flg[i] == "FL_NORM" \
113 || cpu_flg[i] == "FL_SWAP")
114 line = line "/mnorm"
115 else if (cpu_flg[i] == "FL_FPU_FPUS")
116 line = line "/mfpu.fpus"
117 else if (cpu_flg[i] == "FL_FPU_FPUDA")
118 line = line "/mfpu.fpuda"
119 else if (cpu_flg[i] == "FL_FPU_FPUD_ALL")
120 line = line "/mfpu.fpud_all"
121 else if (cpu_flg[i] == "FL_LL64")
122 line = line "/mll64"
123 else if (cpu_flg[i] == "FL_MUL64")
124 line = line "/mmul64"
125 else if (cpu_flg[i] == "FL_MUL32x16")
126 line = line "/mmul32x16"
127 else if (cpu_flg[i] == "FL_FPX_QUARK")
128 line = line "/quark"
129 else if (cpu_flg[i] == "FL_SPFP")
130 line = line "/spfp"
131 else if (cpu_flg[i] == "FL_DPFP")
132 line = line "/dpfp"
133 else
135 print "Don't know the flag " cpu_flg[i] > "/dev/stderr"
136 exit 1
139 line = "mcpu." name "=" line
140 reuse[n_reuse] = line
141 n_reuse++
144 core = name
145 cores[n_cores] = core
146 n_cores++
149 ##################################################################
151 # We gathered all the Information, now build/output the following:
153 # awk Variable target Variable FORMAT
154 # -----------------------------------------------------------
155 # m_options <-> MULTILIB_OPTIONS Makefile
156 # m_dirnames <-> MULTILIB_DIRNAMES "
158 ##################################################################
160 END {
161 m_options = "\nMULTILIB_OPTIONS = "
162 m_dirnames = "\nMULTILIB_DIRNAMES ="
163 m_reuse = "\nMULTILIB_REUSE ="
165 sep = ""
166 for (c = 0; c < n_cores; c++)
168 m_options = m_options sep "mcpu=" cores[c]
169 m_dirnames = m_dirnames " " cores[c]
170 sep = "/"
173 sep = ""
174 for (c = 0; c < n_reuse; c++)
176 m_reuse = m_reuse sep reuse[c]
177 sep = "\nMULTILIB_REUSE +="
179 ############################################################
180 # Output that Stuff
181 ############################################################
183 if (FORMAT == "Makefile")
185 # Intended Target: ./gcc/config/arc/t-multilib
187 print m_options
188 print m_dirnames
190 ############################################################
191 # Legacy Aliases
192 ############################################################
194 print ""
195 print "# Aliases:"
196 print "MULTILIB_MATCHES = mcpu?arc600=mcpu?ARC600"
197 print "MULTILIB_MATCHES += mcpu?arc600=mARC600"
198 print "MULTILIB_MATCHES += mcpu?arc600=mA6"
199 print "MULTILIB_MATCHES += mcpu?arc601=mcpu?ARC601"
200 print "MULTILIB_MATCHES += mcpu?arc700=mA7"
201 print "MULTILIB_MATCHES += mcpu?arc700=mARC700"