Debian Codegraph @

gcc/config/nvptx/gen-opt.sh

raw
1 #!/bin/sh
2
3 # Copyright (C) 2022-2025 Free Software Foundation, Inc.
4 #
5 # This file is part of GCC.
6 #
7 # GCC is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3, or (at your option)
10 # any later version.
11 #
12 # GCC is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with GCC; see the file COPYING3. If not see
19 # <http://www.gnu.org/licenses/>.
20
21
22 nvptx_dir=$(dirname "$0")
23
24
25 nvptx_sm_def="$nvptx_dir/nvptx-sm.def"
26 gen_copyright_sh="$nvptx_dir/gen-copyright.sh"
27
28 sms=$(grep ^NVPTX_SM $nvptx_sm_def | sed 's/.*(//;s/,.*//')
29
30 last=
31 for sm in $sms; do
32 last="$sm"
33 done
34
35 cat <<EOF
36 ; -*- buffer-read-only: t -*-
37 ; Generated automatically by gen-opt.sh from nvptx-sm.def.
38 EOF
39
40 # Separator.
41 echo
42
43 . $gen_copyright_sh opt
44
45 # Not emitting the following here (in addition to having it in 'nvptx.opt'), as
46 # we'll otherwise run into:
47 #
48 # gtyp-input.list:10: file [...]/gcc/config/nvptx/nvptx-opts.h specified more than once for language (all)
49 # make[2]: *** [Makefile:2981: s-gtype] Error 1
50 : ||
51 cat <<EOF
52
53 HeaderInclude
54 config/nvptx/nvptx-opts.h
55 EOF
56
57 # Separator.
58 echo
59
60 cat <<EOF
61 Enum
62 Name(ptx_isa) Type(enum ptx_isa)
63 Known PTX ISA target architectures (for use with the -misa= option):
64 EOF
65
66 # Separator.
67 echo
68
69 for sm in $sms; do
70 cat <<EOF
71 EnumValue
72 Enum(ptx_isa) String(sm_$sm) Value(PTX_ISA_SM$sm)
73 EOF
74
75 if [ "$sm" = "$last" ]; then
76 # Don't end with trailing empty line.
77 continue
78 fi
79
80 # Separator.
81 echo
82 done