1 /* Subroutine headers for the gcc driver.
2 Copyright (C) 2021-2025 Free Software Foundation, Inc.
3 Contributed by Loongson Ltd.
5 This file is part of GCC.
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)
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.
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/>. */
21 #ifndef LOONGARCH_DRIVER_H
22 #define LOONGARCH_DRIVER_H
24 #include "loongarch-str.h"
26 #ifndef SUBTARGET_CPP_SPEC
27 #define SUBTARGET_CPP_SPEC ""
30 #ifndef SUBTARGET_CC1_SPEC
31 #define SUBTARGET_CC1_SPEC ""
34 #ifndef SUBTARGET_ASM_SPEC
35 #define SUBTARGET_ASM_SPEC ""
39 {"early_self_spec", ""}, \
40 {"subtarget_cc1_spec", SUBTARGET_CC1_SPEC}, \
41 {"subtarget_cpp_spec", SUBTARGET_CPP_SPEC}, \
42 {"subtarget_asm_spec", SUBTARGET_ASM_SPEC},
47 "%(subtarget_cpp_spec)"
51 "%{G*} %{,ada:-gnatea %{mabi=*} -gnatez} " \
52 "%(subtarget_cc1_spec)"
54 #if HAVE_AS_MRELAX_OPTION && HAVE_AS_COND_BRANCH_RELAXATION
55 #define ASM_MRELAX_DEFAULT "%{!mrelax:%{!mno-relax:-mrelax}}"
57 #define ASM_MRELAX_DEFAULT "%{!mrelax:%{!mno-relax:-mno-relax}}"
60 #if HAVE_AS_MRELAX_OPTION
61 #define ASM_MRELAX_SPEC \
62 "%{!mno-pass-mrelax-to-as:%{mrelax} %{mno-relax} " ASM_MRELAX_DEFAULT "}"
64 #define ASM_MRELAX_SPEC \
65 "%{mpass-mrelax-to-as:%{mrelax} %{mno-relax} " ASM_MRELAX_DEFAULT "}"
70 "%{mabi=*} " ASM_MRELAX_SPEC " %(subtarget_asm_spec)"
74 la_driver_init (int argc
, const char **argv
);
77 driver_set_m_parm (int argc
, const char **argv
);
80 driver_set_no_link (int argc
, const char **argv
);
83 driver_get_normalized_m_opts (int argc
, const char **argv
);
85 #define EXTRA_SPEC_FUNCTIONS \
86 { "driver_init", la_driver_init }, \
87 { "set_m_parm", driver_set_m_parm }, \
88 { "set_no_link", driver_set_no_link }, \
89 { "get_normalized_m_opts", driver_get_normalized_m_opts },
91 /* Pre-process ABI-related options. */
92 #define LA_SET_PARM_SPEC(NAME) \
93 " %{m" OPTSTR_##NAME "=*: %:set_m_parm(" OPTSTR_##NAME " %*)}" \
95 /* For MLIB_SELF_SPECS. */
96 #include "loongarch-multilib.h"
98 #ifndef MLIB_SELF_SPECS
99 #define MLIB_SELF_SPECS ""
102 #define DRIVER_HANDLE_MACHINE_OPTIONS \
103 " %(early_self_spec)", \
106 " %{c|S|E|nostdlib: %:set_no_link()}" \
107 " %{nostartfiles: %{nodefaultlibs: %:set_no_link()}}" \
108 LA_SET_PARM_SPEC (ABI_BASE) \
109 LA_SET_PARM_SPEC (ARCH) \
110 LA_SET_PARM_SPEC (TUNE) \
111 LA_SET_PARM_SPEC (ISA_EXT_FPU) \
112 LA_SET_PARM_SPEC (ISA_EXT_SIMD) \
113 LA_SET_PARM_SPEC (CMODEL) \
114 " %:get_normalized_m_opts()"
116 #define DRIVER_SELF_SPECS \
117 DRIVER_HANDLE_MACHINE_OPTIONS
119 /* ABI spec strings. */
120 #define ABI_GRLEN_SPEC \
124 "%{mabi=lp64d:lp64d}" \
125 "%{mabi=lp64f:lp64f}" \
126 "%{mabi=lp64s:lp64s}" \
128 #endif /* LOONGARCH_DRIVER_H */