| 1 |
/* Common hooks for Motorola 68000 family. |
| 2 |
Copyright (C) 1987-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 |
/* Implement TARGET_HANDLE_OPTION. */ |
| 31 |
|
| 32 |
static bool |
| 33 |
m68k_handle_option (struct gcc_options *opts, |
| 34 |
struct gcc_options *opts_set, |
| 35 |
const struct cl_decoded_option *decoded, |
| 36 |
location_t loc) |
| 37 |
{ |
| 38 |
size_t code = decoded->opt_index; |
| 39 |
const char *arg = decoded->arg; |
| 40 |
int value = decoded->value; |
| 41 |
|
| 42 |
switch (code) |
| 43 |
{ |
| 44 |
case OPT_m68020_40: |
| 45 |
opts->x_m68k_tune_option = u68020_40; |
| 46 |
opts_set->x_m68k_tune_option = (uarch_type) 1; |
| 47 |
opts->x_m68k_cpu_option = m68020; |
| 48 |
opts_set->x_m68k_cpu_option = (target_device) 1; |
| 49 |
return true; |
| 50 |
|
| 51 |
case OPT_m68020_60: |
| 52 |
opts->x_m68k_tune_option = u68020_60; |
| 53 |
opts_set->x_m68k_tune_option = (uarch_type) 1; |
| 54 |
opts->x_m68k_cpu_option = m68020; |
| 55 |
opts_set->x_m68k_cpu_option = (target_device) 1; |
| 56 |
return true; |
| 57 |
|
| 58 |
case OPT_mshared_library_id_: |
| 59 |
if (value > MAX_LIBRARY_ID) |
| 60 |
error_at (loc, "%<-mshared-library-id=%s%> is not between 0 and %d", |
| 61 |
arg, MAX_LIBRARY_ID); |
| 62 |
else |
| 63 |
{ |
| 64 |
char *tmp; |
| 65 |
asprintf (&tmp, "%d", (value * -4) - 4); |
| 66 |
opts->x_m68k_library_id_string = tmp; |
| 67 |
} |
| 68 |
return true; |
| 69 |
|
| 70 |
default: |
| 71 |
return true; |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
#undef TARGET_HANDLE_OPTION |
| 76 |
#define TARGET_HANDLE_OPTION m68k_handle_option |
| 77 |
|
| 78 |
struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; |