aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfglayout.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2002-06-21 04:09:11 +0200
committerJeff Law <law@gcc.gnu.org>2002-06-20 20:09:11 -0600
commit1292ec0ce0781a96b58d6a465dfc0fe77ad3e7b5 (patch)
treefa827424c64695a60e9c17f4a7dce7f0632079d6 /gcc/cfglayout.c
parent0f8e3849609032a71f93d9c4835d586888938d63 (diff)
downloadgcc-1292ec0ce0781a96b58d6a465dfc0fe77ad3e7b5.zip
gcc-1292ec0ce0781a96b58d6a465dfc0fe77ad3e7b5.tar.gz
gcc-1292ec0ce0781a96b58d6a465dfc0fe77ad3e7b5.tar.bz2
cfglayout.c (scope_to_insns_initialize): Call set_block_levels.
* 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
Diffstat (limited to 'gcc/cfglayout.c')
-rw-r--r--gcc/cfglayout.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 83bc6b7..bd58972 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -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)
}
}
+/* 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;
+}
+
/* 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;