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]

Re: rs6000_handle_option global state avoidance, part 1


David Edelsohn wrote:
On Wed, May 4, 2011 at 7:54 AM, Joseph S. Myers <joseph@codesourcery.com> wrote:

Two options, -mcmodel= and -mfpu=, had cases that fell through to the
next case without comments to indicate if this was intended.  I added
comments to make the semantics explicit.  Given the documentation, it
may well be intentional for -mcmodel= but is more doubtful for -mfpu=.

I doubt that either of the fall through cases was intended.


Alan, is mcmodel suppose to set m64?

Michael, is mfpu suppose to set mrecip?

No. There was a break statement at the end of case OPT_mfpu which disappeared when OPT_mrecip was added.


The rest of the patch looks like a faithful translation.


Thanks, David

 #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
@@ -4261,9 +4224,9 @@ rs6000_handle_option (struct gcc_options
 #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;

    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.  */



--
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


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