| 1 |
/* Common hooks for Renesas RX. |
| 2 |
Copyright (C) 2008-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is part of GCC. |
| 5 |
|
| 6 |
GCC is free software; you can redistribute it and/or modify |
| 7 |
it under the terms of the GNU General Public License as published by |
| 8 |
the Free Software Foundation; either version 3, or (at your option) |
| 9 |
any later version. |
| 10 |
|
| 11 |
GCC is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
GNU General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with GCC; see the file COPYING3. If not see |
| 18 |
<http://www.gnu.org/licenses/>. */ |
| 19 |
|
| 20 |
#include "config.h" |
| 21 |
#include "system.h" |
| 22 |
#include "coretypes.h" |
| 23 |
#include "diagnostic-core.h" |
| 24 |
#include "tm.h" |
| 25 |
#include "common/common-target.h" |
| 26 |
#include "common/common-target-def.h" |
| 27 |
#include "opts.h" |
| 28 |
#include "flags.h" |
| 29 |
|
| 30 |
/* Extra processing for target specific command line options. */ |
| 31 |
|
| 32 |
static bool |
| 33 |
rx_handle_option (struct gcc_options *opts, |
| 34 |
struct gcc_options *opts_set ATTRIBUTE_UNUSED, |
| 35 |
const struct cl_decoded_option *decoded, |
| 36 |
location_t loc) |
| 37 |
{ |
| 38 |
size_t code = decoded->opt_index; |
| 39 |
int value = decoded->value; |
| 40 |
|
| 41 |
switch (code) |
| 42 |
{ |
| 43 |
case OPT_mint_register_: |
| 44 |
/* Make sure that the -mint-register option is in range. Other |
| 45 |
handling in rx_option_override. */ |
| 46 |
return value >= 0 && value <= 4; |
| 47 |
break; |
| 48 |
|
| 49 |
case OPT_mmax_constant_size_: |
| 50 |
/* Make sure that the -mmax-constant_size option is in range. */ |
| 51 |
return value >= 0 && value <= 4; |
| 52 |
|
| 53 |
case OPT_mcpu_: |
| 54 |
if ((enum rx_cpu_types) value == RX200 || |
| 55 |
(enum rx_cpu_types) value == RX100) |
| 56 |
opts->x_target_flags |= MASK_NO_USE_FPU; |
| 57 |
break; |
| 58 |
|
| 59 |
case OPT_fpu: |
| 60 |
if (opts->x_rx_cpu_type == RX200) |
| 61 |
error_at (loc, "the RX200 cpu does not have FPU hardware"); |
| 62 |
else if (opts->x_rx_cpu_type == RX100) |
| 63 |
error_at (loc, "the RX100 cpu does not have FPU hardware"); |
| 64 |
break; |
| 65 |
|
| 66 |
default: |
| 67 |
break; |
| 68 |
} |
| 69 |
|
| 70 |
return true; |
| 71 |
} |
| 72 |
|
| 73 |
#undef TARGET_HANDLE_OPTION |
| 74 |
#define TARGET_HANDLE_OPTION rx_handle_option |
| 75 |
|
| 76 |
#undef TARGET_EXCEPT_UNWIND_INFO |
| 77 |
#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info |
| 78 |
|
| 79 |
struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; |