annotate gcc/config/riscv/multilib-generator @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 #!/usr/bin/env python
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 # RISC-V multilib list generator.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
4 # Copyright (C) 2011-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
5 # Contributed by Andrew Waterman (andrew@sifive.com).
kono
parents:
diff changeset
6 #
kono
parents:
diff changeset
7 # This file is part of GCC.
kono
parents:
diff changeset
8 #
kono
parents:
diff changeset
9 # GCC is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
10 # it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
11 # the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
12 # any later version.
kono
parents:
diff changeset
13 #
kono
parents:
diff changeset
14 # GCC is distributed in the hope that it will be useful,
kono
parents:
diff changeset
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
17 # GNU General Public License for more details.
kono
parents:
diff changeset
18 #
kono
parents:
diff changeset
19 # You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
20 # along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
21 # <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 # Each argument to this script is of the form
kono
parents:
diff changeset
24 # <primary arch>-<abi>-<additional arches>-<extensions>
kono
parents:
diff changeset
25 # For example,
kono
parents:
diff changeset
26 # rv32imafd-ilp32d-rv32g-c,v
kono
parents:
diff changeset
27 # means that, in addition to rv32imafd, these configurations can also use the
kono
parents:
diff changeset
28 # rv32imafd-ilp32d libraries: rv32imafdc, rv32imafdv, rv32g, rv32gc, rv32gv
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 from __future__ import print_function
kono
parents:
diff changeset
31 import sys
kono
parents:
diff changeset
32 import collections
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 arches = collections.OrderedDict()
kono
parents:
diff changeset
35 abis = collections.OrderedDict()
kono
parents:
diff changeset
36 required = []
kono
parents:
diff changeset
37 reuse = []
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 for cfg in sys.argv[1:]:
kono
parents:
diff changeset
40 (arch, abi, extra, ext) = cfg.split('-')
kono
parents:
diff changeset
41 arches[arch] = 1
kono
parents:
diff changeset
42 abis[abi] = 1
kono
parents:
diff changeset
43 extra = list(filter(None, extra.split(',')))
kono
parents:
diff changeset
44 ext = list(filter(None, ext.split(',')))
kono
parents:
diff changeset
45 alts = sum([[x] + [x + y for y in ext] for x in [arch] + extra], [])
kono
parents:
diff changeset
46 alts = alts + [x.replace('imafd', 'g') for x in alts if 'imafd' in x]
kono
parents:
diff changeset
47 for alt in alts[1:]:
kono
parents:
diff changeset
48 arches[alt] = 1
kono
parents:
diff changeset
49 reuse.append('march.%s/mabi.%s=march.%s/mabi.%s' % (arch, abi, alt, abi))
kono
parents:
diff changeset
50 required.append('march=%s/mabi=%s' % (arch, abi))
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 arch_options = '/'.join(['march=%s' % x for x in arches.keys()])
kono
parents:
diff changeset
53 arch_dirnames = ' \\\n'.join(arches.keys())
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 abi_options = '/'.join(['mabi=%s' % x for x in abis.keys()])
kono
parents:
diff changeset
56 abi_dirnames = ' \\\n'.join(abis.keys())
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 prog = sys.argv[0].split('/')[-1]
kono
parents:
diff changeset
59 print('# This file was generated by %s with the command:' % prog)
kono
parents:
diff changeset
60 print('# %s' % ' '.join(sys.argv))
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 print('MULTILIB_OPTIONS = %s %s' % (arch_options, abi_options))
kono
parents:
diff changeset
63 print('MULTILIB_DIRNAMES = %s %s' % (arch_dirnames, abi_dirnames))
kono
parents:
diff changeset
64 print('MULTILIB_REQUIRED = %s' % ' \\\n'.join(required))
kono
parents:
diff changeset
65 print('MULTILIB_REUSE = %s' % ' \\\n'.join(reuse))