cfglayout.c (scope_to_insns_initialize): Call set_block_levels.
authorJan Hubicka <jh@suse.cz>
Fri, 21 Jun 2002 02:09:11 +0000 (04:09 +0200)
committerJeff Law <law@gcc.gnu.org>
Fri, 21 Jun 2002 02:09:11 +0000 (20:09 -0600)
        * cfglayout.c (scope_to_insns_initialize): Call set_block_levels.
        (scope_to_insns_finalize): Do not call set_block_levels; handle
        sequences.
        (choose_inner_scope): New.
        * rtl.h (choose_inner_scope): Declare.

From-SVN: r54868

gcc/ChangeLog
gcc/cfglayout.c
gcc/rtl.h

index 33b331bc48dff9f8c9f3051bec58964c5d6f8387..efe3e9df8083066afb590cdf951f5b587218d3e0 100644 (file)
@@ -1,3 +1,11 @@
+2002-06-20 Jan Hubicka  <jh@suse.cz>
+
+       * cfglayout.c (scope_to_insns_initialize): Call set_block_levels.
+       (scope_to_insns_finalize): Do not call set_block_levels; handle
+       sequences.
+       (choose_inner_scope): New.
+       * rtl.h (choose_inner_scope): Declare.
+
 2002-06-20  John David Anglin  <dave@hiauly1.hia.nrc.ca>
 
        * pa-protos.h (pa_asm_output_mi_thunk): Change third argument to
index 83bc6b71d9772bf9792acbb9501029f3ff3a6108..bd589728bdfa80f441b24b31778fd17d45610d22 100644 (file)
@@ -241,6 +241,10 @@ scope_to_insns_initialize ()
            }
        }
     }
+
+  /* Tag the blocks with a depth number so that change_scope can find
+     the common parent easily.  */
+  set_block_levels (DECL_INITIAL (cfun->decl), 0);
 }
 
 /* For each lexical block, set BLOCK_NUMBER to the depth at which it is
@@ -259,6 +263,20 @@ set_block_levels (block, level)
     }
 }
 \f
+/* Return sope resulting from combination of S1 and S2.  */
+tree
+choose_inner_scope (s1, s2)
+     tree s1, s2;
+{
+   if (!s1)
+     return s2;
+   if (!s2)
+     return s1;
+   if (BLOCK_NUMBER (s1) > BLOCK_NUMBER (s2))
+     return s1;
+   return s2;
+}
+\f
 /* Emit lexical block notes needed to change scope from S1 to S2.  */
 
 static void
@@ -315,10 +333,6 @@ scope_to_insns_finalize ()
   tree cur_block = DECL_INITIAL (cfun->decl);
   rtx insn, note;
 
-  /* Tag the blocks with a depth number so that change_scope can find
-     the common parent easily.  */
-  set_block_levels (cur_block, 0);
-
   insn = get_insns ();
   if (!active_insn_p (insn))
     insn = next_active_insn (insn);
@@ -327,6 +341,18 @@ scope_to_insns_finalize ()
       tree this_block;
 
       this_block = INSN_SCOPE (insn);
+      /* For sequences compute scope resulting from merging all scopes
+         of instructions nested inside. */
+      if (GET_CODE (PATTERN (insn)) == SEQUENCE)
+       {
+         int i;
+         rtx body = PATTERN (insn);
+
+         this_block = NULL;
+         for (i = 0; i < XVECLEN (body, 0); i++)
+           this_block = choose_inner_scope (this_block,
+                                        INSN_SCOPE (XVECEXP (body, 0, i)));
+       }
       if (! this_block)
        continue;
 
index 0b7a874ee8419af48951eb4190d340c6bfe9c778..0fba875aa031f16db23a3d0686ae9e87f5d6465c 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1414,6 +1414,9 @@ extern rtx next_label                     PARAMS ((rtx));
 extern rtx next_cc0_user               PARAMS ((rtx));
 extern rtx prev_cc0_setter             PARAMS ((rtx));
 
+/* In cfglayout.c  */
+extern tree choose_inner_scope         PARAMS ((tree, tree));
+
 /* In jump.c */
 extern rtx next_nondeleted_insn                PARAMS ((rtx));
 extern enum rtx_code reverse_condition PARAMS ((enum rtx_code));