xref: /netbsd-src/external/gpl3/gcc/dist/gcc/config/loongarch/loongarch-driver.h (revision b1e838363e3c6fc78a55519254d99869742dd33c)
1 /* Subroutine headers for the gcc driver.
2    Copyright (C) 2021-2022 Free Software Foundation, Inc.
3    Contributed by Loongson Ltd.
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 #ifndef LOONGARCH_DRIVER_H
22 #define LOONGARCH_DRIVER_H
23 
24 #include "loongarch-str.h"
25 
26 extern const char*
27 driver_set_m_flag (int argc, const char **argv);
28 
29 extern const char*
30 driver_get_normalized_m_opts (int argc, const char **argv);
31 
32 #define EXTRA_SPEC_FUNCTIONS \
33   { "set_m_flag", driver_set_m_flag  }, \
34   { "get_normalized_m_opts", driver_get_normalized_m_opts  },
35 
36 /* Pre-process ABI-related options.  */
37 #define LA_SET_PARM_SPEC(NAME) \
38   " %{m" OPTSTR_##NAME  "=*: %:set_m_flag(" OPTSTR_##NAME "=%*)}" \
39 
40 #define LA_SET_FLAG_SPEC(NAME) \
41   " %{m" OPTSTR_##NAME  ": %:set_m_flag(" OPTSTR_##NAME ")}" \
42 
43 #define DRIVER_HANDLE_MACHINE_OPTIONS			      \
44   " %{c|S|E|nostdlib: %:set_m_flag(no_link)}"		      \
45   " %{nostartfiles: %{nodefaultlibs: %:set_m_flag(no_link)}}" \
46   LA_SET_PARM_SPEC (ABI_BASE)				      \
47   LA_SET_PARM_SPEC (ARCH)				      \
48   LA_SET_PARM_SPEC (TUNE)				      \
49   LA_SET_PARM_SPEC (ISA_EXT_FPU)			      \
50   LA_SET_PARM_SPEC (CMODEL)				      \
51   LA_SET_FLAG_SPEC (SOFT_FLOAT)				      \
52   LA_SET_FLAG_SPEC (SINGLE_FLOAT)			      \
53   LA_SET_FLAG_SPEC (DOUBLE_FLOAT)			      \
54   " %:get_normalized_m_opts()"
55 
56 #define DRIVER_SELF_SPECS \
57   DRIVER_HANDLE_MACHINE_OPTIONS
58 
59 /* ABI spec strings.  */
60 #define ABI_GRLEN_SPEC \
61   "%{mabi=lp64*:64}"   \
62 
63 #define ABI_SPEC \
64   "%{mabi=lp64d:lp64d}" \
65   "%{mabi=lp64f:lp64f}" \
66   "%{mabi=lp64s:lp64s}" \
67 
68 #endif /* LOONGARCH_DRIVER_H */
69