From d72ffa5d7e24fe17145fcd7d61d8dca6ecc19b66 Mon Sep 17 00:00:00 2001 From: rsandifo Date: Wed, 30 Mar 2005 06:32:52 +0000 Subject: * config/iq2000/iq2000.h (target_flags, MASK_GPOPT, MASK_EMBEDDED_DATA) (MASK_UNINIT_CONST_IN_RODATA, TARGET_EMBEDDED_DATA, TARGET_SWITCHES) (TARGET_DEFAULT, TARGET_CPU_DEFAULT, SUBTARGET_TARGET_OPTIONS) (TARGET_OPTIONS, iq2000_cpu_string, iq2000_arch_string): Delete. (TARGET_DEBUG_MODE, TARGET_DEBUG_A_MODE, TARGET_DEBUG_B_MODE) (TARGET_DEBUG_C_MODE, TARGET_DEBUG_D_MODE): Define to 0 rather than target_flags & 0. * config/iq2000/iq2000.c (iq2000_cpu_string, iq2000_arch_string) (iq2000_arch, iq2000_parse_cpu): Delete. (TARGET_HANDLE_OPTION): Override default. (iq2000_handle_option): New function. (override_options): Remove -march= and -mcpu= handling. * config/iq2000/iq2000.opt: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97240 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/config/iq2000/iq2000.c | 91 ++++++++++++-------------------------------- gcc/config/iq2000/iq2000.h | 69 +++------------------------------ gcc/config/iq2000/iq2000.opt | 45 ++++++++++++++++++++++ 3 files changed, 75 insertions(+), 130 deletions(-) create mode 100644 gcc/config/iq2000/iq2000.opt (limited to 'gcc/config/iq2000') diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index 80f5a4cd7cb..b9fa16ac461 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -125,11 +125,6 @@ rtx branch_cmp[2]; /* What type of branch to use. */ enum cmp_type branch_type; -/* Strings to hold which cpu and instruction set architecture to use. */ -const char * iq2000_cpu_string; /* For -mcpu=. */ -const char * iq2000_arch_string; /* For -march=. */ - - /* Local variables. */ /* The next branch instruction is a branch likely, not branch normal. */ @@ -152,15 +147,13 @@ static rtx iq2000_load_reg2; static rtx iq2000_load_reg3; static rtx iq2000_load_reg4; -/* The target cpu for code generation. */ -static enum processor_type iq2000_arch; - /* Mode used for saving/restoring general purpose registers. */ static enum machine_mode gpr_mode; /* Initialize the GCC target structure. */ static struct machine_function* iq2000_init_machine_status (void); +static bool iq2000_handle_option (size_t, const char *, int); static void iq2000_select_rtx_section (enum machine_mode, rtx, unsigned HOST_WIDE_INT); static void iq2000_init_builtins (void); static rtx iq2000_expand_builtin (tree, rtx, rtx, enum machine_mode, int); @@ -183,6 +176,8 @@ static int iq2000_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode, #define TARGET_EXPAND_BUILTIN iq2000_expand_builtin #undef TARGET_ASM_SELECT_RTX_SECTION #define TARGET_ASM_SELECT_RTX_SECTION iq2000_select_rtx_section +#undef TARGET_HANDLE_OPTION +#define TARGET_HANDLE_OPTION iq2000_handle_option #undef TARGET_RTX_COSTS #define TARGET_RTX_COSTS iq2000_rtx_costs #undef TARGET_ADDRESS_COST @@ -1606,26 +1601,31 @@ iq2000_init_machine_status (void) return f; } -static enum processor_type -iq2000_parse_cpu (const char * cpu_string) -{ - const char *p = cpu_string; - enum processor_type cpu; +/* Implement TARGET_HANDLE_OPTION. */ - cpu = PROCESSOR_DEFAULT; - switch (p[2]) +static bool +iq2000_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED) +{ + switch (code) { - case '1': - if (!strcmp (p, "iq10")) - cpu = PROCESSOR_IQ10; - break; - case '2': - if (!strcmp (p, "iq2000")) - cpu = PROCESSOR_IQ2000; - break; - } + case OPT_mcpu_: + if (strcmp (arg, "iq10") == 0) + iq2000_tune = PROCESSOR_IQ10; + else if (strcmp (arg, "iq2000") == 0) + iq2000_tune = PROCESSOR_IQ2000; + else + return false; + return true; - return cpu; + case OPT_march_: + /* This option has no effect at the moment. */ + return (strcmp (arg, "default") == 0 + || strcmp (arg, "DEFAULT") == 0 + || strcmp (arg, "iq2000") == 0); + + default: + return true; + } } /* Detect any conflicts in the switches. */ @@ -1633,53 +1633,12 @@ iq2000_parse_cpu (const char * cpu_string) void override_options (void) { - enum processor_type iq2000_cpu; - target_flags &= ~MASK_GPOPT; iq2000_isa = IQ2000_ISA_DEFAULT; /* Identify the processor type. */ - if (iq2000_cpu_string != 0) - { - iq2000_cpu = iq2000_parse_cpu (iq2000_cpu_string); - if (iq2000_cpu == PROCESSOR_DEFAULT) - { - error ("bad value (%s) for -mcpu= switch", iq2000_arch_string); - iq2000_cpu_string = "default"; - } - iq2000_arch = iq2000_cpu; - iq2000_tune = iq2000_cpu; - } - - if (iq2000_arch_string == 0 - || ! strcmp (iq2000_arch_string, "default") - || ! strcmp (iq2000_arch_string, "DEFAULT")) - { - switch (iq2000_isa) - { - default: - iq2000_arch_string = "iq2000"; - iq2000_arch = PROCESSOR_IQ2000; - break; - } - } - else - { - iq2000_arch = iq2000_parse_cpu (iq2000_arch_string); - if (iq2000_arch == PROCESSOR_DEFAULT) - { - error ("bad value (%s) for -march= switch", iq2000_arch_string); - iq2000_arch_string = "default"; - } - if (iq2000_arch == PROCESSOR_IQ10) - { - error ("The compiler does not support -march=%s.", iq2000_arch_string); - iq2000_arch_string = "default"; - } - } - iq2000_print_operand_punct['?'] = 1; iq2000_print_operand_punct['#'] = 1; iq2000_print_operand_punct['&'] = 1; diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h index 2011f122d84..eef6285c27b 100644 --- a/gcc/config/iq2000/iq2000.h +++ b/gcc/config/iq2000/iq2000.h @@ -44,73 +44,20 @@ } \ while (0) -extern int target_flags; - -#define MASK_GPOPT 0x00000008 /* Optimize for global pointer. */ -#define MASK_EMBEDDED_DATA 0x00008000 /* Reduce RAM usage, not fast code. */ -#define MASK_UNINIT_CONST_IN_RODATA \ - 0x00800000 /* Store uninitialized - consts in rodata. */ - /* Macros used in the machine description to test the flags. */ #define TARGET_STATS 0 -/* For embedded systems, optimize for reduced RAM space instead of for - fastest code. */ -#define TARGET_EMBEDDED_DATA (target_flags & MASK_EMBEDDED_DATA) - -#define TARGET_DEBUG_MODE (target_flags & 0) -#define TARGET_DEBUG_A_MODE (target_flags & 0) -#define TARGET_DEBUG_B_MODE (target_flags & 0) -#define TARGET_DEBUG_C_MODE (target_flags & 0) -#define TARGET_DEBUG_D_MODE (target_flags & 0) - -#define TARGET_SWITCHES \ -{ \ - {"no-crt0", 0, \ - N_("No default crt0.o") }, \ - {"gpopt", MASK_GPOPT, \ - N_("Use GP relative sdata/sbss sections")}, \ - {"no-gpopt", -MASK_GPOPT, \ - N_("Don't use GP relative sdata/sbss sections")}, \ - {"embedded-data", MASK_EMBEDDED_DATA, \ - N_("Use ROM instead of RAM")}, \ - {"no-embedded-data", -MASK_EMBEDDED_DATA, \ - N_("Don't use ROM instead of RAM")}, \ - {"uninit-const-in-rodata", MASK_UNINIT_CONST_IN_RODATA, \ - N_("Put uninitialized constants in ROM (needs -membedded-data)")}, \ - {"no-uninit-const-in-rodata", -MASK_UNINIT_CONST_IN_RODATA, \ - N_("Don't put uninitialized constants in ROM")}, \ - {"", (TARGET_DEFAULT \ - | TARGET_CPU_DEFAULT), \ - NULL}, \ -} - -/* Default target_flags if no switches are specified. */ - -#define TARGET_DEFAULT 0 - -#ifndef TARGET_CPU_DEFAULT -#define TARGET_CPU_DEFAULT 0 -#endif +#define TARGET_DEBUG_MODE 0 +#define TARGET_DEBUG_A_MODE 0 +#define TARGET_DEBUG_B_MODE 0 +#define TARGET_DEBUG_C_MODE 0 +#define TARGET_DEBUG_D_MODE 0 #ifndef IQ2000_ISA_DEFAULT #define IQ2000_ISA_DEFAULT 1 #endif -#define TARGET_OPTIONS \ -{ \ - SUBTARGET_TARGET_OPTIONS \ - { "cpu=", & iq2000_cpu_string, \ - N_("Specify CPU for scheduling purposes")}, \ - { "arch=", & iq2000_arch_string, \ - N_("Specify CPU for code generation purposes")}, \ -} - -/* This is meant to be redefined in the host dependent files. */ -#define SUBTARGET_TARGET_OPTIONS - #define IQ2000_VERSION "[1.0]" #ifndef MACHINE_TYPE @@ -1167,12 +1114,6 @@ extern rtx branch_cmp[2]; /* What type of branch to use. */ extern enum cmp_type branch_type; -/* Strings to hold which cpu and instruction set architecture to use. */ -extern const char * iq2000_cpu_string; /* For -mcpu=. */ -extern const char * iq2000_arch_string; /* For -march=. */ - - - enum iq2000_builtins { IQ2000_BUILTIN_ADO16, diff --git a/gcc/config/iq2000/iq2000.opt b/gcc/config/iq2000/iq2000.opt new file mode 100644 index 00000000000..3b47f3fa56f --- /dev/null +++ b/gcc/config/iq2000/iq2000.opt @@ -0,0 +1,45 @@ +; Options for the Vitesse IQ2000 port of the compiler. + +; Copyright (C) 2005 Free Software Foundation, Inc. +; +; This file is part of GCC. +; +; GCC is free software; you can redistribute it and/or modify it under +; the terms of the GNU General Public License as published by the Free +; Software Foundation; either version 2, or (at your option) any later +; version. +; +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY +; WARRANTY; without even the implied warranty of MERCHANTABILITY or +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +; for more details. +; +; You should have received a copy of the GNU General Public License +; along with GCC; see the file COPYING. If not, write to the Free +; Software Foundation, 59 Temple Place - Suite 330, Boston, MA +; 02111-1307, USA. + +march= +Target RejectNegative Joined +Specify CPU for code generation purposes + +mcpu= +Target RejectNegative Joined +Specify CPU for scheduling purposes + +membedded-data +Target Mask(EMBEDDED_DATA) +Use ROM instead of RAM + +mgpopt +Target Mask(GPOPT) +Use GP relative sdata/sbss sections + +; Not used by the compiler proper. +mno-crt0 +Target RejectNegative +No default crt0.o + +muninit-const-in-rodata +Target Mask(UNINIT_CONST_IN_RODATA) +Put uninitialized constants in ROM (needs -membedded-data) -- cgit v1.2.1