[PATCH] target/37283: Fix -fno-unit-at-a-time and ?-fno-toplevel-reorder handling

Janis Johnson janis187@us.ibm.com
Thu Sep 4 23:29:00 GMT 2008


On Wed, 2008-09-03 at 02:34 +0200, Samuel Tardieu wrote:
> * Janis Johnson <janis187@us.ibm.com> [2008-09-02 15:12:53 -0700]
> 
> | It does, and with that your change to rs6000.c is fine.
> 
> Ok. Would you have a chance to get it in? I'm leaving in a few hours
> (and I have to sleep before that) and won't be connected until next
> Monday.
> 
> | On more nit, though, with this patch if I say -fsection-anchors with
> | no other options then it's silently ignored rather than getting an
> | error.
> 
> Feel free to fix it :)
> 

This is like Samuel's latest version but rearranged to report errors
for conflicting options.  I just noticed that the new nested if
statements (!optimized and the following one) can be combined into
one; if the patch is approved I'll first do some testing again with
that change.

Bootstrapped (all languages but Ada) on powerpc64-linux, tested with
-m32/-m64; OK for mainline?

2008-09-04  Janis Johnson  <janis187@us.ibm.com>
	    Samuel Tardieu  <sam@rfc1149.net>

	PR target/37283
	* opts.c (decode_options): Handle more relationships among
	-funit-at-a-time, -ftoplevel-reorder, and -fsection-anchors.

Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 139991)
+++ gcc/opts.c	(working copy)
@@ -1008,21 +1008,35 @@ decode_options (unsigned int argc, const
 
   handle_options (argc, argv, lang_mask);
 
-  /* -fno-unit-at-a-time and -fno-toplevel-reorder handling.  */
+  /* Handle related options for unit-at-a-time, toplevel-reorder, and
+     section-anchors.  */
   if (!flag_unit_at_a_time)
     {
+      if (flag_section_anchors == 1)
+	error ("Section anchors must be disabled when unit-at-a-time "
+	       "is disabled.");
       flag_section_anchors = 0;
+      if (flag_toplevel_reorder == 1)
+	error ("Toplevel reorder must be disabled when unit-at-a-time "
+	       "is disabled.");
       flag_toplevel_reorder = 0;
     }
-  else if (!optimize && flag_toplevel_reorder == 2)
-    /* We disable toplevel reordering at -O0 to disable transformations that
-       might be surprising to end users and to get -fno-toplevel-reorder
-       tested, but we keep section anchors.  */
-    flag_toplevel_reorder = 0;
-  else if (!flag_toplevel_reorder)
+  if (!optimize)
+    {
+      /* Unless the user has asked for section anchors, we disable toplevel
+	 reordering at -O0 to disable transformations that might be surprising
+	 to end users and to get -fno-toplevel-reorder tested.  */
+      if (flag_toplevel_reorder == 2 && flag_section_anchors != 1)
+	{
+	  flag_toplevel_reorder = 0;
+	  flag_section_anchors = 0;
+	}
+    }
+  if (!flag_toplevel_reorder)
     {
       if (flag_section_anchors == 1)
-        error ("section anchors must be disabled when toplevel reorder is disabled");
+	error ("section anchors must be disabled when toplevel reorder"
+	       " is disabled");
       flag_section_anchors = 0;
     }
 




More information about the Gcc-patches mailing list