{ (const char *)0, "-mtune=", 1, 0 },
};
-/* String variables to hold the various options. */
-static const char *rs6000_sched_insert_nops_str;
-static const char *rs6000_sched_costly_dep_str;
-static const char *rs6000_recip_name;
-
-#ifdef USING_ELFOS_H
-static const char *rs6000_abi_name;
-static const char *rs6000_sdata_name;
-#endif
-
/* Support targetm.vectorize.builtin_mask_for_load. */
static GTY(()) tree altivec_builtin_mask_for_load;
static GTY(()) section *sdata2_section;
static GTY(()) section *toc_section;
-/* True for any options that were explicitly set. */
-static struct {
- bool aix_struct_ret; /* True if -maix-struct-ret was used. */
- bool alignment; /* True if -malign- was used. */
- bool spe_abi; /* True if -mabi=spe/no-spe was used. */
- bool altivec_abi; /* True if -mabi=altivec/no-altivec used. */
- bool spe; /* True if -mspe= was used. */
- bool float_gprs; /* True if -mfloat-gprs= was used. */
- bool long_double; /* True if -mlong-double- was used. */
- bool ieee; /* True if -mabi=ieee/ibmlongdouble used. */
- bool vrsave; /* True if -mvrsave was used. */
- bool cmodel; /* True if -mcmodel was used. */
-} rs6000_explicit_options;
-
struct builtin_description
{
/* mask is not const because we're going to alter it below. This
= ((global_init_p || target_option_default_node == NULL)
? NULL : TREE_TARGET_OPTION (target_option_default_node));
+ /* On 64-bit Darwin, power alignment is ABI-incompatible with some C
+ library functions, so warn about it. The flag may be useful for
+ performance studies from time to time though, so don't disable it
+ entirely. */
+ if (global_options_set.x_rs6000_alignment_flags
+ && rs6000_alignment_flags == MASK_ALIGN_POWER
+ && DEFAULT_ABI == ABI_DARWIN
+ && TARGET_64BIT)
+ warning (0, "-malign-power is not supported for 64-bit Darwin;"
+ " it is incompatible with the installed C and C++ libraries");
+
/* Numerous experiment shows that IRA based loop pressure
calculation works better for RTL loop invariant motion on targets
with enough (>= 32) registers. It is an expensive optimization.
}
}
- if (!rs6000_explicit_options.long_double)
+ if (!global_options_set.x_rs6000_long_double_type_size)
{
if (main_target_opt != NULL
&& (main_target_opt->x_rs6000_long_double_type_size
}
#ifndef POWERPC_LINUX
- if (!rs6000_explicit_options.ieee)
+ if (!global_options_set.x_rs6000_ieeequad)
rs6000_ieeequad = 1;
#endif
be explicitly overridden in either case. */
if (TARGET_ELF)
{
- if (!rs6000_explicit_options.altivec_abi
+ if (!global_options_set.x_rs6000_altivec_abi
&& (TARGET_64BIT || TARGET_ALTIVEC || TARGET_VSX))
{
if (main_target_opt != NULL &&
}
/* Enable VRSAVE for AltiVec ABI, unless explicitly overridden. */
- if (!rs6000_explicit_options.vrsave)
+ if (!global_options_set.x_TARGET_ALTIVEC_VRSAVE)
TARGET_ALTIVEC_VRSAVE = rs6000_altivec_abi;
}
error ("target attribute or pragma changes SPE ABI");
else
{
- if (!rs6000_explicit_options.spe_abi)
+ if (!global_options_set.x_rs6000_spe_abi)
rs6000_spe_abi = 0;
- if (!rs6000_explicit_options.spe)
+ if (!global_options_set.x_rs6000_spe)
rs6000_spe = 0;
- if (!rs6000_explicit_options.float_gprs)
+ if (!global_options_set.x_rs6000_float_gprs)
rs6000_float_gprs = 0;
}
if (!(target_flags_explicit & MASK_ISEL))
/* Set aix_struct_return last, after the ABI is determined.
If -maix-struct-return or -msvr4-struct-return was explicitly
used, don't override with the ABI default. */
- if (!rs6000_explicit_options.aix_struct_ret)
+ if (!global_options_set.x_aix_struct_return)
aix_struct_return = (DEFAULT_ABI != ABI_V4 || DRAFT_V4_STRUCT_RET);
#if 0
set_default_param_value (PARAM_MAX_GROW_COPY_BB_INSNS, 16);
}
-static enum fpu_type_t
-rs6000_parse_fpu_option (const char *option)
-{
- if (!strcmp("none", option)) return FPU_NONE;
- if (!strcmp("sp_lite", option)) return FPU_SF_LITE;
- if (!strcmp("dp_lite", option)) return FPU_DF_LITE;
- if (!strcmp("sp_full", option)) return FPU_SF_FULL;
- if (!strcmp("dp_full", option)) return FPU_DF_FULL;
- error("unknown value %s for -mfpu", option);
- return FPU_NONE;
-}
-
-
/* Handler for the Mathematical Acceleration Subsystem (mass) interface to a
library with vectorized intrinsics. */
static bool
rs6000_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
const struct cl_decoded_option *decoded,
- location_t loc ATTRIBUTE_UNUSED)
+ location_t loc)
{
enum fpu_type_t fpu_type = FPU_NONE;
char *p, *q;
switch (code)
{
case OPT_mno_power:
- target_flags &= ~(MASK_POWER | MASK_POWER2
- | MASK_MULTIPLE | MASK_STRING);
- target_flags_explicit |= (MASK_POWER | MASK_POWER2
+ opts->x_target_flags &= ~(MASK_POWER | MASK_POWER2
| MASK_MULTIPLE | MASK_STRING);
+ opts_set->x_target_flags |= (MASK_POWER | MASK_POWER2
+ | MASK_MULTIPLE | MASK_STRING);
break;
case OPT_mno_powerpc:
- target_flags &= ~(MASK_POWERPC | MASK_PPC_GPOPT
- | MASK_PPC_GFXOPT | MASK_POWERPC64);
- target_flags_explicit |= (MASK_POWERPC | MASK_PPC_GPOPT
+ opts->x_target_flags &= ~(MASK_POWERPC | MASK_PPC_GPOPT
| MASK_PPC_GFXOPT | MASK_POWERPC64);
+ opts_set->x_target_flags |= (MASK_POWERPC | MASK_PPC_GPOPT
+ | MASK_PPC_GFXOPT | MASK_POWERPC64);
break;
case OPT_mfull_toc:
- target_flags &= ~MASK_MINIMAL_TOC;
- TARGET_NO_FP_IN_TOC = 0;
- TARGET_NO_SUM_IN_TOC = 0;
- target_flags_explicit |= MASK_MINIMAL_TOC;
+ opts->x_target_flags &= ~MASK_MINIMAL_TOC;
+ opts->x_TARGET_NO_FP_IN_TOC = 0;
+ opts->x_TARGET_NO_SUM_IN_TOC = 0;
+ opts_set->x_target_flags |= MASK_MINIMAL_TOC;
#ifdef TARGET_USES_SYSV4_OPT
/* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be
just the same as -mminimal-toc. */
- target_flags |= MASK_MINIMAL_TOC;
- target_flags_explicit |= MASK_MINIMAL_TOC;
+ opts->x_target_flags |= MASK_MINIMAL_TOC;
+ opts_set->x_target_flags |= MASK_MINIMAL_TOC;
#endif
break;
#ifdef TARGET_USES_SYSV4_OPT
case OPT_mtoc:
/* Make -mtoc behave like -mminimal-toc. */
- target_flags |= MASK_MINIMAL_TOC;
- target_flags_explicit |= MASK_MINIMAL_TOC;
+ opts->x_target_flags |= MASK_MINIMAL_TOC;
+ opts_set->x_target_flags |= MASK_MINIMAL_TOC;
break;
#endif
#if defined (HAVE_LD_LARGE_TOC) && defined (TARGET_USES_LINUX64_OPT)
case OPT_mcmodel_:
- if (strcmp (arg, "small") == 0)
- rs6000_current_cmodel = CMODEL_SMALL;
- else if (strcmp (arg, "medium") == 0)
- rs6000_current_cmodel = CMODEL_MEDIUM;
- else if (strcmp (arg, "large") == 0)
- rs6000_current_cmodel = CMODEL_LARGE;
- else
- {
- error ("invalid option for -mcmodel: '%s'", arg);
- return false;
- }
- rs6000_explicit_options.cmodel = true;
+ /* Fall through. */
#endif
#ifdef TARGET_USES_AIX64_OPT
#else
case OPT_m64:
#endif
- target_flags |= MASK_POWERPC64 | MASK_POWERPC;
- target_flags |= ~target_flags_explicit & MASK_PPC_GFXOPT;
- target_flags_explicit |= MASK_POWERPC64 | MASK_POWERPC;
+ opts->x_target_flags |= MASK_POWERPC64 | MASK_POWERPC;
+ opts->x_target_flags |= ~opts_set->x_target_flags & MASK_PPC_GFXOPT;
+ opts_set->x_target_flags |= MASK_POWERPC64 | MASK_POWERPC;
break;
#ifdef TARGET_USES_AIX64_OPT
#else
case OPT_m32:
#endif
- target_flags &= ~MASK_POWERPC64;
- target_flags_explicit |= MASK_POWERPC64;
- break;
-
- case OPT_minsert_sched_nops_:
- rs6000_sched_insert_nops_str = arg;
+ opts->x_target_flags &= ~MASK_POWERPC64;
+ opts_set->x_target_flags |= MASK_POWERPC64;
break;
case OPT_mminimal_toc:
if (value == 1)
{
- TARGET_NO_FP_IN_TOC = 0;
- TARGET_NO_SUM_IN_TOC = 0;
+ opts->x_TARGET_NO_FP_IN_TOC = 0;
+ opts->x_TARGET_NO_SUM_IN_TOC = 0;
}
break;
case OPT_mpower:
if (value == 1)
{
- target_flags |= (MASK_MULTIPLE | MASK_STRING);
- target_flags_explicit |= (MASK_MULTIPLE | MASK_STRING);
+ opts->x_target_flags |= (MASK_MULTIPLE | MASK_STRING);
+ opts_set->x_target_flags |= (MASK_MULTIPLE | MASK_STRING);
}
break;
case OPT_mpower2:
if (value == 1)
{
- target_flags |= (MASK_POWER | MASK_MULTIPLE | MASK_STRING);
- target_flags_explicit |= (MASK_POWER | MASK_MULTIPLE | MASK_STRING);
+ opts->x_target_flags |= (MASK_POWER | MASK_MULTIPLE | MASK_STRING);
+ opts_set->x_target_flags |= (MASK_POWER
+ | MASK_MULTIPLE
+ | MASK_STRING);
}
break;
case OPT_mpowerpc_gfxopt:
if (value == 1)
{
- target_flags |= MASK_POWERPC;
- target_flags_explicit |= MASK_POWERPC;
+ opts->x_target_flags |= MASK_POWERPC;
+ opts_set->x_target_flags |= MASK_POWERPC;
}
break;
- case OPT_maix_struct_return:
- case OPT_msvr4_struct_return:
- rs6000_explicit_options.aix_struct_ret = true;
- break;
-
- case OPT_mvrsave:
- rs6000_explicit_options.vrsave = true;
- TARGET_ALTIVEC_VRSAVE = value;
- break;
-
- case OPT_mspe:
- rs6000_explicit_options.spe = true;
- rs6000_spe = value;
- break;
-
case OPT_mdebug_:
p = ASTRDUP (arg);
- rs6000_debug = 0;
+ opts->x_rs6000_debug = 0;
while ((q = strtok (p, ",")) != NULL)
{
else if (! strcmp (q, "target"))
mask = MASK_DEBUG_TARGET;
else
- error ("unknown -mdebug-%s switch", q);
+ error_at (loc, "unknown -mdebug-%s switch", q);
if (invert)
- rs6000_debug &= ~mask;
+ opts->x_rs6000_debug &= ~mask;
else
- rs6000_debug |= mask;
+ opts->x_rs6000_debug |= mask;
}
break;
#ifdef TARGET_USES_SYSV4_OPT
- case OPT_mcall_:
- rs6000_abi_name = arg;
- break;
-
- case OPT_msdata_:
- rs6000_sdata_name = arg;
- break;
-
- case OPT_mtls_size_:
- if (strcmp (arg, "16") == 0)
- rs6000_tls_size = 16;
- else if (strcmp (arg, "32") == 0)
- rs6000_tls_size = 32;
- else if (strcmp (arg, "64") == 0)
- rs6000_tls_size = 64;
- else
- error ("bad value %qs for -mtls-size switch", arg);
- break;
-
case OPT_mrelocatable:
if (value == 1)
{
- target_flags |= MASK_MINIMAL_TOC;
- target_flags_explicit |= MASK_MINIMAL_TOC;
- TARGET_NO_FP_IN_TOC = 1;
+ opts->x_target_flags |= MASK_MINIMAL_TOC;
+ opts_set->x_target_flags |= MASK_MINIMAL_TOC;
+ opts->x_TARGET_NO_FP_IN_TOC = 1;
}
break;
case OPT_mrelocatable_lib:
if (value == 1)
{
- target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC;
- target_flags_explicit |= MASK_RELOCATABLE | MASK_MINIMAL_TOC;
- TARGET_NO_FP_IN_TOC = 1;
+ opts->x_target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC;
+ opts_set->x_target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC;
+ opts->x_TARGET_NO_FP_IN_TOC = 1;
}
else
{
- target_flags &= ~MASK_RELOCATABLE;
- target_flags_explicit |= MASK_RELOCATABLE;
+ opts->x_target_flags &= ~MASK_RELOCATABLE;
+ opts_set->x_target_flags |= MASK_RELOCATABLE;
}
break;
#endif
case OPT_mabi_:
if (!strcmp (arg, "altivec"))
{
- rs6000_explicit_options.altivec_abi = true;
- rs6000_altivec_abi = 1;
+ opts_set->x_rs6000_altivec_abi = true;
+ opts->x_rs6000_altivec_abi = 1;
/* Enabling the AltiVec ABI turns off the SPE ABI. */
- rs6000_spe_abi = 0;
+ opts->x_rs6000_spe_abi = 0;
}
else if (! strcmp (arg, "no-altivec"))
{
- rs6000_explicit_options.altivec_abi = true;
- rs6000_altivec_abi = 0;
+ opts_set->x_rs6000_altivec_abi = true;
+ opts->x_rs6000_altivec_abi = 0;
}
else if (! strcmp (arg, "spe"))
{
- rs6000_explicit_options.spe_abi = true;
- rs6000_spe_abi = 1;
- rs6000_altivec_abi = 0;
+ opts_set->x_rs6000_spe_abi = true;
+ opts->x_rs6000_spe_abi = 1;
+ opts->x_rs6000_altivec_abi = 0;
if (!TARGET_SPE_ABI)
- error ("not configured for ABI: '%s'", arg);
+ error_at (loc, "not configured for ABI: '%s'", arg);
}
else if (! strcmp (arg, "no-spe"))
{
- rs6000_explicit_options.spe_abi = true;
- rs6000_spe_abi = 0;
+ opts_set->x_rs6000_spe_abi = true;
+ opts->x_rs6000_spe_abi = 0;
}
/* These are here for testing during development only, do not
document in the manual please. */
else if (! strcmp (arg, "d64"))
{
- rs6000_darwin64_abi = 1;
- warning (0, "using darwin64 ABI");
+ opts->x_rs6000_darwin64_abi = 1;
+ warning_at (loc, 0, "using darwin64 ABI");
}
else if (! strcmp (arg, "d32"))
{
- rs6000_darwin64_abi = 0;
- warning (0, "using old darwin ABI");
+ opts->x_rs6000_darwin64_abi = 0;
+ warning_at (loc, 0, "using old darwin ABI");
}
else if (! strcmp (arg, "ibmlongdouble"))
{
- rs6000_explicit_options.ieee = true;
- rs6000_ieeequad = 0;
- warning (0, "using IBM extended precision long double");
+ opts_set->x_rs6000_ieeequad = true;
+ opts->x_rs6000_ieeequad = 0;
+ warning_at (loc, 0, "using IBM extended precision long double");
}
else if (! strcmp (arg, "ieeelongdouble"))
{
- rs6000_explicit_options.ieee = true;
- rs6000_ieeequad = 1;
- warning (0, "using IEEE extended precision long double");
+ opts_set->x_rs6000_ieeequad = true;
+ opts->x_rs6000_ieeequad = 1;
+ warning_at (loc, 0, "using IEEE extended precision long double");
}
else
{
- error ("unknown ABI specified: '%s'", arg);
+ error_at (loc, "unknown ABI specified: '%s'", arg);
return false;
}
break;
case OPT_mcpu_:
rs6000_select[1].string = arg;
- rs6000_cpu_index = rs6000_cpu_name_lookup (arg);
- if (rs6000_cpu_index < 0)
- error ("bad value (%s) for -mcpu", arg);
+ opts->x_rs6000_cpu_index = rs6000_cpu_name_lookup (arg);
+ if (opts->x_rs6000_cpu_index < 0)
+ error_at (loc, "bad value (%s) for -mcpu", arg);
break;
case OPT_mtune_:
rs6000_select[2].string = arg;
- rs6000_tune_index = rs6000_cpu_name_lookup (arg);
- if (rs6000_tune_index < 0)
- error ("bad value (%s) for -mtune", arg);
- break;
-
- case OPT_mtraceback_:
- if (! strncmp (arg, "full", 4))
- rs6000_traceback = traceback_full;
- else if (! strncmp (arg, "part", 4))
- rs6000_traceback = traceback_part;
- else if (! strncmp (arg, "no", 2))
- rs6000_traceback = traceback_none;
- else
- error ("unknown -mtraceback arg %qs; expecting %<full%>, "
- "%<partial%> or %<none%>", arg);
- break;
-
- case OPT_mfloat_gprs_:
- rs6000_explicit_options.float_gprs = true;
- if (! strcmp (arg, "yes") || ! strcmp (arg, "single"))
- rs6000_float_gprs = 1;
- else if (! strcmp (arg, "double"))
- rs6000_float_gprs = 2;
- else if (! strcmp (arg, "no"))
- rs6000_float_gprs = 0;
- else
- {
- error ("invalid option for -mfloat-gprs: '%s'", arg);
- return false;
- }
+ opts->x_rs6000_tune_index = rs6000_cpu_name_lookup (arg);
+ if (opts->x_rs6000_tune_index < 0)
+ error_at (loc, "bad value (%s) for -mtune", arg);
break;
case OPT_mlong_double_:
- rs6000_explicit_options.long_double = true;
- rs6000_long_double_type_size = RS6000_DEFAULT_LONG_DOUBLE_SIZE;
if (value != 64 && value != 128)
{
- error ("unknown switch -mlong-double-%s", arg);
- rs6000_long_double_type_size = RS6000_DEFAULT_LONG_DOUBLE_SIZE;
- return false;
- }
- else
- rs6000_long_double_type_size = value;
- break;
-
- case OPT_msched_costly_dep_:
- rs6000_sched_costly_dep_str = arg;
- break;
-
- case OPT_malign_:
- rs6000_explicit_options.alignment = true;
- if (! strcmp (arg, "power"))
- {
- /* On 64-bit Darwin, power alignment is ABI-incompatible with
- some C library functions, so warn about it. The flag may be
- useful for performance studies from time to time though, so
- don't disable it entirely. */
- if (DEFAULT_ABI == ABI_DARWIN && TARGET_64BIT)
- warning (0, "-malign-power is not supported for 64-bit Darwin;"
- " it is incompatible with the installed C and C++ libraries");
- rs6000_alignment_flags = MASK_ALIGN_POWER;
- }
- else if (! strcmp (arg, "natural"))
- rs6000_alignment_flags = MASK_ALIGN_NATURAL;
- else
- {
- error ("unknown -malign-XXXXX option specified: '%s'", arg);
+ error_at (loc, "unknown switch -mlong-double-%s", arg);
+ opts->x_rs6000_long_double_type_size
+ = RS6000_DEFAULT_LONG_DOUBLE_SIZE;
return false;
}
break;
case OPT_msingle_float:
if (!TARGET_SINGLE_FPU)
- warning (0, "-msingle-float option equivalent to -mhard-float");
+ warning_at (loc, 0,
+ "-msingle-float option equivalent to -mhard-float");
/* -msingle-float implies -mno-double-float and TARGET_HARD_FLOAT. */
- rs6000_double_float = 0;
- target_flags &= ~MASK_SOFT_FLOAT;
- target_flags_explicit |= MASK_SOFT_FLOAT;
+ opts->x_rs6000_double_float = 0;
+ opts->x_target_flags &= ~MASK_SOFT_FLOAT;
+ opts_set->x_target_flags |= MASK_SOFT_FLOAT;
break;
case OPT_mdouble_float:
/* -mdouble-float implies -msingle-float and TARGET_HARD_FLOAT. */
- rs6000_single_float = 1;
- target_flags &= ~MASK_SOFT_FLOAT;
- target_flags_explicit |= MASK_SOFT_FLOAT;
+ opts->x_rs6000_single_float = 1;
+ opts->x_target_flags &= ~MASK_SOFT_FLOAT;
+ opts_set->x_target_flags |= MASK_SOFT_FLOAT;
break;
case OPT_msimple_fpu:
if (!TARGET_SINGLE_FPU)
- warning (0, "-msimple-fpu option ignored");
+ warning_at (loc, 0, "-msimple-fpu option ignored");
break;
case OPT_mhard_float:
/* -mhard_float implies -msingle-float and -mdouble-float. */
- rs6000_single_float = rs6000_double_float = 1;
+ opts->x_rs6000_single_float = opts->x_rs6000_double_float = 1;
break;
case OPT_msoft_float:
/* -msoft_float implies -mnosingle-float and -mnodouble-float. */
- rs6000_single_float = rs6000_double_float = 0;
+ opts->x_rs6000_single_float = opts->x_rs6000_double_float = 0;
break;
case OPT_mfpu_:
- fpu_type = rs6000_parse_fpu_option(arg);
- if (fpu_type != FPU_NONE)
- /* If -mfpu is not none, then turn off SOFT_FLOAT, turn on HARD_FLOAT. */
- {
- target_flags &= ~MASK_SOFT_FLOAT;
- target_flags_explicit |= MASK_SOFT_FLOAT;
- rs6000_xilinx_fpu = 1;
- if (fpu_type == FPU_SF_LITE || fpu_type == FPU_SF_FULL)
- rs6000_single_float = 1;
- if (fpu_type == FPU_DF_LITE || fpu_type == FPU_DF_FULL)
- rs6000_single_float = rs6000_double_float = 1;
- if (fpu_type == FPU_SF_LITE || fpu_type == FPU_DF_LITE)
- rs6000_simple_fpu = 1;
- }
+ fpu_type = (enum fpu_type_t) value;
+ if (fpu_type != FPU_NONE)
+ {
+ /* If -mfpu is not none, then turn off SOFT_FLOAT, turn on
+ HARD_FLOAT. */
+ opts->x_target_flags &= ~MASK_SOFT_FLOAT;
+ opts_set->x_target_flags |= MASK_SOFT_FLOAT;
+ opts->x_rs6000_xilinx_fpu = 1;
+ if (fpu_type == FPU_SF_LITE || fpu_type == FPU_SF_FULL)
+ opts->x_rs6000_single_float = 1;
+ if (fpu_type == FPU_DF_LITE || fpu_type == FPU_DF_FULL)
+ opts->x_rs6000_single_float = opts->x_rs6000_double_float = 1;
+ if (fpu_type == FPU_SF_LITE || fpu_type == FPU_DF_LITE)
+ opts->x_rs6000_simple_fpu = 1;
+ }
else
- {
- /* -mfpu=none is equivalent to -msoft-float */
- target_flags |= MASK_SOFT_FLOAT;
- target_flags_explicit |= MASK_SOFT_FLOAT;
- rs6000_single_float = rs6000_double_float = 0;
- }
+ {
+ /* -mfpu=none is equivalent to -msoft-float. */
+ opts->x_target_flags |= MASK_SOFT_FLOAT;
+ opts_set->x_target_flags |= MASK_SOFT_FLOAT;
+ opts->x_rs6000_single_float = opts->x_rs6000_double_float = 0;
+ }
+ /* Fall through. */
case OPT_mrecip:
- rs6000_recip_name = (value) ? "default" : "none";
- break;
-
- case OPT_mrecip_:
- rs6000_recip_name = arg;
+ opts->x_rs6000_recip_name = (value) ? "default" : "none";
break;
}
return true;