public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [tuples][patch] Fix convert_nl_goto_receiver
@ 2008-04-03  8:27 Oleg Ryjkov
  2008-04-03 13:03 ` Diego Novillo
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Ryjkov @ 2008-04-03  8:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: dnovillo

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

Hi,

This patch modifies convert_nl_goto_receiver to operate on gimples instead
of trees. Also modifies lower_nested_functions to make sure it is called
on gimple statements.
Tested on i686-linux, no new regressions, fixes 132 c tests and 243 fortran
tests.

[-- Attachment #2: 1.diff --]
[-- Type: text/plain, Size: 3107 bytes --]

Index: ChangeLog.tuples
===================================================================
--- ChangeLog.tuples	(revision 133849)
+++ ChangeLog.tuples	(working copy)
@@ -1,3 +1,10 @@
+2008-04-03  Oleg Ryjkov  <olegr@google.com>
+
+	* tree-nested.c (convert_nl_goto_receiver): Changed to hadle gimple
+	statements instead of trees.
+	(lower_nested_functions): Pass convert_nl_goto_receiver as the first
+	parameter to walk_all_functions.
+
 2008-04-02  Doug Kwan  <dougkwan@google.com>
 
 	* tree-complex.c (expand_complex_comparison): Set condition code
Index: tree-nested.c
===================================================================
--- tree-nested.c	(revision 133849)
+++ tree-nested.c	(working copy)
@@ -1591,30 +1591,30 @@ convert_nl_goto_reference (gimple_stmt_i
 }
 
 
-/* Called via walk_function+walk_tree, rewrite all LABEL_EXPRs that 
+/* Called via walk_function+walk_tree, rewrite all GIMPLE_LABELs whose labels
    are referenced via nonlocal goto from a nested function.  The rewrite
    will involve installing a newly generated DECL_NONLOCAL label, and
-   (potentially) a branch around the rtl gunk that is assumed to be 
+   (potentially) a branch around the rtl gunk that is assumed to be
    attached to such a label.  */
 
-static tree
-convert_nl_goto_receiver (tree *tp, int *walk_subtrees, void *data)
+static bool
+convert_nl_goto_receiver (gimple_stmt_iterator *gsi, void *data)
 {
   struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
   struct nesting_info *info = wi->info;
-  tree t = *tp, label, new_label;
+  tree label, new_label;
   gimple_stmt_iterator tmp_gsi;
   void **slot;
-  gimple stmt;
+  gimple stmt = gsi_stmt (*gsi);
 
-  *walk_subtrees = 0;
-  if (TREE_CODE (t) != LABEL_EXPR)
-    return NULL_TREE;
-  label = LABEL_EXPR_LABEL (t);
+  if (gimple_code (stmt) != GIMPLE_LABEL)
+    return false;
+
+  label = gimple_label_label (stmt);
 
   slot = pointer_map_contains (info->var_map, label);
   if (!slot)
-    return NULL_TREE;
+    return false;
 
   /* If there's any possibility that the previous statement falls through,
      then we must branch around the new non-local label.  */
@@ -1623,14 +1623,14 @@ convert_nl_goto_receiver (tree *tp, int 
   if (gsi_end_p (tmp_gsi) || gimple_stmt_may_fallthru (gsi_stmt (tmp_gsi)))
     {
       gimple stmt = gimple_build_goto (label);
-      gsi_insert_before (&wi->gsi, stmt, GSI_SAME_STMT);
+      gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
     }
 
   new_label = (tree) *slot;
   stmt = gimple_build_label (new_label);
-  gsi_insert_before (&wi->gsi, stmt, GSI_SAME_STMT);
+  gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
 
-  return NULL_TREE;
+  return false;
 }
 
 
@@ -2062,7 +2062,7 @@ lower_nested_functions (tree fndecl)
                       convert_local_reference_op,
 		      root);
   walk_all_functions (convert_nl_goto_reference, NULL, root);
-  walk_all_functions (NULL, convert_nl_goto_receiver, root);
+  walk_all_functions (convert_nl_goto_receiver, NULL, root);
   convert_all_function_calls (root);
   finalize_nesting_tree (root);
   unnest_nesting_tree (root);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [tuples][patch] Fix convert_nl_goto_receiver
  2008-04-03  8:27 [tuples][patch] Fix convert_nl_goto_receiver Oleg Ryjkov
@ 2008-04-03 13:03 ` Diego Novillo
  0 siblings, 0 replies; 2+ messages in thread
From: Diego Novillo @ 2008-04-03 13:03 UTC (permalink / raw)
  To: Oleg Ryjkov; +Cc: gcc-patches

On Thu, Apr 3, 2008 at 04:27, Oleg Ryjkov <olegr@google.com> wrote:

>  +2008-04-03  Oleg Ryjkov  <olegr@google.com>
>  +
>  +       * tree-nested.c (convert_nl_goto_receiver): Changed to hadle gimple
>  +       statements instead of trees.
>  +       (lower_nested_functions): Pass convert_nl_goto_receiver as the first
>  +       parameter to walk_all_functions.

OK.

Diego.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-03 13:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-03  8:27 [tuples][patch] Fix convert_nl_goto_receiver Oleg Ryjkov
2008-04-03 13:03 ` Diego Novillo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).