This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

rs6000_handle_option global state avoidance, part 2


This patch continues work on avoiding global state in
rs6000_handle_option by cleaning up the handling of -mabi= options.

The part using global state, a test for TARGET_SPE_ABI, is moved to
rs6000_option_override_internal (so now testing the state after all
options are applied).  The -mabi= option is really several separate
options, setting different variables, and so is most naturally
represented as multiple options in the .opt file (instead of one
option using Enum).  This patch represents it that way in the .opt
file; the only option handler code now needed for these options is to
make -mabi=altivec and -mabi=spe override each other, because all the
other semantics can be described directly in the .opt file.

Tested building cc1 and xgcc for cross to powerpc-eabi.  Will commit
to trunk in the absence of target maintainer objections.

2011-05-05  Joseph Myers  <joseph@codesourcery.com>

	* config/rs6000/rs6000.opt (rs6000_ieeequad, rs6000_altivec_abi,
	rs6000_spe_abi, rs6000_darwin64_abi): Remove TargetVariable
	entries.
	(mabi=): Replace with separate entries for mabi=altivec,
	mabi=no-altivec, mabi=spe, mabi=no-spe, mabi=d64, mabi=d32,
	mabi=ieeelongdouble and mabi=ibmlongdouble.
	* config/rs6000/rs6000.c (rs6000_option_override_internal): Move
	check for -mabi=spe without SPE ABI support here.
	(rs6000_handle_option): Replace OPT_mabi_ handling with
	OPT_mabi_altivec and OPT_mabi_spe handling.

Index: gcc/config/rs6000/rs6000.opt
===================================================================
--- gcc/config/rs6000/rs6000.opt	(revision 173434)
+++ gcc/config/rs6000/rs6000.opt	(working copy)
@@ -47,22 +47,6 @@ enum rs6000_dependence_cost rs6000_sched
 TargetVariable
 enum rs6000_nop_insertion rs6000_sched_insert_nops = sched_finish_none
 
-;; IEEE quad extended precision long double.
-TargetVariable
-unsigned char rs6000_ieeequad
-
-;; Nonzero to use AltiVec ABI.
-TargetVariable
-unsigned char rs6000_altivec_abi
-
-;; Nonzero if we want SPE ABI extensions.
-TargetVariable
-unsigned char rs6000_spe_abi
-
-;; Nonzero if we want Darwin's struct-by-value-in-regs ABI.
-TargetVariable
-unsigned char rs6000_darwin64_abi
-
 ;; Non-zero to allow overriding loop alignment.
 TargetVariable
 unsigned char can_override_loop_align
@@ -385,9 +369,37 @@ mdebug=
 Target RejectNegative Joined
 -mdebug=	Enable debug output
 
-mabi=
-Target RejectNegative Joined
--mabi=	Specify ABI to use
+mabi=altivec
+Target RejectNegative Var(rs6000_altivec_abi) Save
+Use the AltiVec ABI extensions
+
+mabi=no-altivec
+Target RejectNegative Var(rs6000_altivec_abi, 0)
+Do not use the AltiVec ABI extensions
+
+mabi=spe
+Target RejectNegative Var(rs6000_spe_abi) Save
+Use the SPE ABI extensions
+
+mabi=no-spe
+Target RejectNegative Var(rs6000_spe_abi, 0)
+Do not use the SPE ABI extensions
+
+; These are here for testing during development only, do not document
+; in the manual please.
+
+; If we want Darwin's struct-by-value-in-regs ABI.
+mabi=d64
+Target RejectNegative Undocumented Warn(using darwin64 ABI) Var(rs6000_darwin64_abi) Save
+
+mabi=d32
+Target RejectNegative Undocumented Warn(using old darwin ABI) Var(rs6000_darwin64_abi, 0)
+
+mabi=ieeelongdouble
+Target RejectNegative Undocumented Warn(using IEEE extended precision long double) Var(rs6000_ieeequad) Save
+
+mabi=ibmlongdouble
+Target RejectNegative Undocumented Warn(using IBM extended precision long double) Var(rs6000_ieeequad, 0)
 
 mcpu=
 Target RejectNegative Joined
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 173434)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -2665,6 +2665,11 @@ rs6000_option_override_internal (bool gl
     warning (0, "-malign-power is not supported for 64-bit Darwin;"
 	     " it is incompatible with the installed C and C++ libraries");
 
+  if (global_options_set.x_rs6000_spe_abi
+      && rs6000_spe_abi
+      && !TARGET_SPE_ABI)
+    error ("not configured for SPE ABI");
+
   /* 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.
@@ -4340,65 +4345,13 @@ rs6000_handle_option (struct gcc_options
       break;
 #endif
 
-    case OPT_mabi_:
-      if (!strcmp (arg, "altivec"))
-	{
-	  opts_set->x_rs6000_altivec_abi = true;
-	  opts->x_rs6000_altivec_abi = 1;
-
-	  /* Enabling the AltiVec ABI turns off the SPE ABI.  */
-	  opts->x_rs6000_spe_abi = 0;
-	}
-      else if (! strcmp (arg, "no-altivec"))
-	{
-	  opts_set->x_rs6000_altivec_abi = true;
-	  opts->x_rs6000_altivec_abi = 0;
-	}
-      else if (! strcmp (arg, "spe"))
-	{
-	  opts_set->x_rs6000_spe_abi = true;
-	  opts->x_rs6000_spe_abi = 1;
-	  opts->x_rs6000_altivec_abi = 0;
-	  if (!TARGET_SPE_ABI)
-	    error_at (loc, "not configured for ABI: '%s'", arg);
-	}
-      else if (! strcmp (arg, "no-spe"))
-	{
-	  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"))
-	{
-	  opts->x_rs6000_darwin64_abi = 1;
-	  warning_at (loc, 0, "using darwin64 ABI");
-	}
-      else if (! strcmp (arg, "d32"))
-	{
-	  opts->x_rs6000_darwin64_abi = 0;
-	  warning_at (loc, 0, "using old darwin ABI");
-	}
-
-      else if (! strcmp (arg, "ibmlongdouble"))
-	{
-	  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"))
-	{
-	  opts_set->x_rs6000_ieeequad = true;
-	  opts->x_rs6000_ieeequad = 1;
-	  warning_at (loc, 0, "using IEEE extended precision long double");
-	}
+    case OPT_mabi_altivec:
+      /* Enabling the AltiVec ABI turns off the SPE ABI.  */
+      opts->x_rs6000_spe_abi = 0;
+      break;
 
-      else
-	{
-	  error_at (loc, "unknown ABI specified: '%s'", arg);
-	  return false;
-	}
+    case OPT_mabi_spe:
+      opts->x_rs6000_altivec_abi = 0;
       break;
 
     case OPT_mcpu_:

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]