diff options
author | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-30 06:30:13 +0000 |
---|---|---|
committer | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-30 06:30:13 +0000 |
commit | 726aa9eaa7034538190bc3ba2aaf855ee1db2fc3 (patch) | |
tree | f41031068d1ad60d5500d19e957665d281960392 /gcc/config/c4x/c4x.c | |
parent | 7b3936d269b758d4e8b101f71d748341900d0241 (diff) | |
download | gcc-726aa9eaa7034538190bc3ba2aaf855ee1db2fc3.tar.gz |
* config/c4x/c4x-protos.h (c4x_rpts_cycles, c4x_cpu_version): Delete.
* config/c4x/c4x.h (SMALL_MEMORY_FLAG, MPYI_FLAG, FAST_FIX_FLAG)
(RPTS_FLAG, C3X_FLAG, TI_FLAG, PARANOID_FLAG, MEMPARM_FLAG, DEVEL_FLAG)
(RPTB_FLAG, BK_FLAG, DB_FLAG, DEBUG_FLAG, HOIST_FLAG)
(LOOP_UNSIGNED_FLAG, FORCE_FLAG, PRESERVE_FLOAT_FLAG)
(PARALLEL_INSN_FLAG, PARALLEL_MPY_FLAG, ALIASES_FLAG, C30_FLAG)
(C31_FLAG, C32_FLAG, C33_FLAG, C40_FLAG, C44_FLAG, TARGET_SWITCHES)
(TARGET_DEFAULT, TARGET_SMALL, TARGET_MPYI, TARGET_FAST_FIX)
(TARGET_RPTS, TARGET_TI, TARGET_PARANOID, TARGET_MEMPARM, TARGET_DEVEL)
(TARGET_RPTB, TARGET_BK, TARGET_DB, TARGET_DEBUG, TARGET_HOIST)
(TARGET_LOOP_UNSIGNED, TARGET_FORCE, TARGET_PRESERVE_FLOAT)
(TARGET_PARALLEL, TARGET_PARALLEL_MPY, TARGET_ALIASES)
(c4x_rpts_cycles_string, c4x_cpu_version_string)
(TARGET_OPTIONS): Delete.
(c4x_rpts_cycles, c4x_cpu_version): Declare.
(TARGET_C3X, TARGET_C30, TARGET_C31, TARGET_C32, TARGET_C33)
(TARGET_C40, TARGET_C44): Redefine in terms of c4x_cpu_version.
* config/c4x/c4x.c (c4x_rpts_cycles_string): Delete.
(c4x_cpu_version_string): Delete.
(TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Override defaults.
(c4x_handle_option): New function. Map -m3x and -m4x options to the
equivalent -mcpu= option.
(c4x_override_options): Remove -mrpts= and -mcpu= handling from here.
Deal with the extra conditions in the old TARGET_MPYI, TARGET_RPTB,
TARGET_DB, TARGET_PARALLEL and TARGET_PARALLEL_MPY macros by setting
or clearing the appropriate MASK_* bit.
(c4x_file_start): Use c4x_cpu_version.
* config/c4x/c4x.opt: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97239 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/c4x/c4x.c')
-rw-r--r-- | gcc/config/c4x/c4x.c | 115 |
1 files changed, 52 insertions, 63 deletions
diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 22465fc1873..b7f54d97860 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -152,9 +152,7 @@ enum machine_mode c4x_caller_save_map[FIRST_PSEUDO_REGISTER] = rtx c4x_compare_op0; rtx c4x_compare_op1; -const char *c4x_rpts_cycles_string; int c4x_rpts_cycles = 0; /* Max. cycles for RPTS. */ -const char *c4x_cpu_version_string; int c4x_cpu_version = 40; /* CPU version C30/31/32/33/40/44. */ /* Pragma definitions. */ @@ -167,6 +165,7 @@ tree interrupt_tree = NULL_TREE; tree naked_tree = NULL_TREE; /* Forward declarations */ +static bool c4x_handle_option (size_t, const char *, int); static int c4x_isr_reg_used_p (unsigned int); static int c4x_leaf_function_p (void); static int c4x_naked_function_p (void); @@ -221,6 +220,13 @@ static tree c4x_gimplify_va_arg_expr (tree, tree, tree *, tree *); #undef TARGET_ASM_EXTERNAL_LIBCALL #define TARGET_ASM_EXTERNAL_LIBCALL c4x_external_libcall +/* Play safe, not the fastest code. */ +#undef TARGET_DEFAULT_TARGET_FLAGS +#define TARGET_DEFAULT_TARGET_FLAGS (MASK_ALIASES | MASK_PARALLEL \ + | MASK_PARALLEL_MPY | MASK_RPTB) +#undef TARGET_HANDLE_OPTION +#define TARGET_HANDLE_OPTION c4x_handle_option + #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE c4x_attribute_table @@ -258,67 +264,49 @@ static tree c4x_gimplify_va_arg_expr (tree, tree, tree *, tree *); struct gcc_target targetm = TARGET_INITIALIZER; -/* Override command line options. - Called once after all options have been parsed. - Mostly we process the processor - type and sometimes adjust other TARGET_ options. */ +/* Implement TARGET_HANDLE_OPTION. */ -void -c4x_override_options (void) +static bool +c4x_handle_option (size_t code, const char *arg, int value) { - if (c4x_rpts_cycles_string) - c4x_rpts_cycles = atoi (c4x_rpts_cycles_string); - else - c4x_rpts_cycles = 0; - - if (TARGET_C30) - c4x_cpu_version = 30; - else if (TARGET_C31) - c4x_cpu_version = 31; - else if (TARGET_C32) - c4x_cpu_version = 32; - else if (TARGET_C33) - c4x_cpu_version = 33; - else if (TARGET_C40) - c4x_cpu_version = 40; - else if (TARGET_C44) - c4x_cpu_version = 44; - else - c4x_cpu_version = 40; - - /* -mcpu=xx overrides -m40 etc. */ - if (c4x_cpu_version_string) + switch (code) { - const char *p = c4x_cpu_version_string; - - /* Also allow -mcpu=c30 etc. */ - if (*p == 'c' || *p == 'C') - p++; - c4x_cpu_version = atoi (p); - } + case OPT_m30: c4x_cpu_version = 30; return true; + case OPT_m31: c4x_cpu_version = 31; return true; + case OPT_m32: c4x_cpu_version = 32; return true; + case OPT_m33: c4x_cpu_version = 33; return true; + case OPT_m40: c4x_cpu_version = 40; return true; + case OPT_m44: c4x_cpu_version = 44; return true; + + case OPT_mcpu_: + if (arg[0] == 'c' || arg[0] == 'C') + arg++; + value = atoi (arg); + switch (value) + { + case 30: case 31: case 32: case 33: case 40: case 44: + c4x_cpu_version = value; + return true; + } + return false; - target_flags &= ~(C30_FLAG | C31_FLAG | C32_FLAG | C33_FLAG | - C40_FLAG | C44_FLAG); + case OPT_mrpts_: + c4x_rpts_cycles = value; + return true; - switch (c4x_cpu_version) - { - case 30: target_flags |= C30_FLAG; break; - case 31: target_flags |= C31_FLAG; break; - case 32: target_flags |= C32_FLAG; break; - case 33: target_flags |= C33_FLAG; break; - case 40: target_flags |= C40_FLAG; break; - case 44: target_flags |= C44_FLAG; break; default: - warning ("unknown CPU version %d, using 40.\n", c4x_cpu_version); - c4x_cpu_version = 40; - target_flags |= C40_FLAG; + return true; } +} - if (TARGET_C30 || TARGET_C31 || TARGET_C32 || TARGET_C33) - target_flags |= C3X_FLAG; - else - target_flags &= ~C3X_FLAG; +/* Override command line options. + Called once after all options have been parsed. + Mostly we process the processor + type and sometimes adjust other TARGET_ options. */ +void +c4x_override_options (void) +{ /* Convert foo / 8.0 into foo * 0.125, etc. */ set_fast_math_flags (1); @@ -326,6 +314,15 @@ c4x_override_options (void) This provides compatibility with the old -mno-aliases option. */ if (! TARGET_ALIASES && ! flag_argument_noalias) flag_argument_noalias = 1; + + if (!TARGET_C3X) + target_flags |= MASK_MPYI | MASK_DB; + + if (optimize < 2) + target_flags &= ~(MASK_RPTB | MASK_PARALLEL); + + if (!TARGET_PARALLEL) + target_flags &= ~MASK_PARALLEL_MPY; } @@ -4409,16 +4406,8 @@ c4x_external_ref (const char *name) static void c4x_file_start (void) { - int dspversion = 0; - if (TARGET_C30) dspversion = 30; - if (TARGET_C31) dspversion = 31; - if (TARGET_C32) dspversion = 32; - if (TARGET_C33) dspversion = 33; - if (TARGET_C40) dspversion = 40; - if (TARGET_C44) dspversion = 44; - default_file_start (); - fprintf (asm_out_file, "\t.version\t%d\n", dspversion); + fprintf (asm_out_file, "\t.version\t%d\n", c4x_cpu_version); fputs ("\n\t.data\ndata_sec:\n", asm_out_file); } |