summaryrefslogtreecommitdiff
path: root/gcc/cfglayout.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-29 20:01:15 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-29 20:01:15 +0000
commit3e9e574b8927ea9866fe689658096a6b960b2a10 (patch)
tree67e8d4070f4ecd07fce69ac4d97b24b9109d106f /gcc/cfglayout.c
parenta6d340178368ec5c609e1c0be39a5d372f622f4b (diff)
downloadgcc-3e9e574b8927ea9866fe689658096a6b960b2a10.tar.gz
* cfglayout.c (insert_intra_before_1): New.
(insert_inter_bb_scope_notes): Emit sibling block notes which don't span multiple basic blocks. * gcc.dg/debug-3.c: New test. * gcc.dg/debug-4.c: New test. * gcc.dg/debug-5.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48380 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfglayout.c')
-rw-r--r--gcc/cfglayout.c69
1 files changed, 57 insertions, 12 deletions
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index e0adb53c71a..8ddce1479a3 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -95,6 +95,7 @@ static void relate_bbs_with_scopes PARAMS ((scope));
static scope make_new_scope PARAMS ((int, rtx));
static void build_scope_forest PARAMS ((scope_forest_info *));
static void remove_scope_notes PARAMS ((void));
+static void insert_intra_before_1 PARAMS ((scope, rtx *, basic_block));
static void insert_intra_1 PARAMS ((scope, rtx *, basic_block));
static void insert_intra_bb_scope_notes PARAMS ((basic_block));
static void insert_inter_bb_scope_notes PARAMS ((basic_block, basic_block));
@@ -578,6 +579,32 @@ insert_intra_1 (s, ip, bb)
}
}
+/* Insert scope note pairs for a contained scope tree S before insn IP. */
+
+static void
+insert_intra_before_1 (s, ip, bb)
+ scope s;
+ rtx *ip;
+ basic_block bb;
+{
+ scope p;
+
+ if (NOTE_BLOCK (s->note_beg))
+ {
+ *ip = emit_note_before (NOTE_INSN_BLOCK_END, *ip);
+ NOTE_BLOCK (*ip) = NOTE_BLOCK (s->note_end);
+ }
+
+ for (p = s->inner; p; p = p->next)
+ insert_intra_before_1 (p, ip, bb);
+
+ if (NOTE_BLOCK (s->note_beg))
+ {
+ *ip = emit_note_before (NOTE_INSN_BLOCK_BEG, *ip);
+ NOTE_BLOCK (*ip) = NOTE_BLOCK (s->note_beg);
+ }
+}
+
/* Insert NOTE_INSN_BLOCK_END notes and NOTE_INSN_BLOCK_BEG notes for
scopes that are contained within BB. */
@@ -661,15 +688,24 @@ insert_inter_bb_scope_notes (bb1, bb2)
if (bb1)
{
rtx end = bb1->end;
- scope s;
+ scope s, p;
ip = RBI (bb1)->eff_end;
for (s = RBI (bb1)->scope; s != com; s = s->outer)
- if (NOTE_BLOCK (s->note_beg))
- {
- ip = emit_note_after (NOTE_INSN_BLOCK_END, ip);
- NOTE_BLOCK (ip) = NOTE_BLOCK (s->note_end);
- }
+ {
+ if (NOTE_BLOCK (s->note_beg))
+ {
+ ip = emit_note_after (NOTE_INSN_BLOCK_END, ip);
+ NOTE_BLOCK (ip) = NOTE_BLOCK (s->note_end);
+ }
+
+ /* Now emit all sibling scopes which don't span any basic
+ blocks. */
+ if (s->outer)
+ for (p = s->outer->inner; p; p = p->next)
+ if (p != s && p->bb_beg == bb1 && p->bb_beg == p->bb_end)
+ insert_intra_1 (p, &ip, bb1);
+ }
/* Emitting note may move the end of basic block to unwanted place. */
bb1->end = end;
@@ -678,15 +714,24 @@ insert_inter_bb_scope_notes (bb1, bb2)
/* Open scopes. */
if (bb2)
{
- scope s;
+ scope s, p;
ip = bb2->head;
for (s = RBI (bb2)->scope; s != com; s = s->outer)
- if (NOTE_BLOCK (s->note_beg))
- {
- ip = emit_note_before (NOTE_INSN_BLOCK_BEG, ip);
- NOTE_BLOCK (ip) = NOTE_BLOCK (s->note_beg);
- }
+ {
+ if (NOTE_BLOCK (s->note_beg))
+ {
+ ip = emit_note_before (NOTE_INSN_BLOCK_BEG, ip);
+ NOTE_BLOCK (ip) = NOTE_BLOCK (s->note_beg);
+ }
+
+ /* Now emit all sibling scopes which don't span any basic
+ blocks. */
+ if (s->outer)
+ for (p = s->outer->inner; p; p = p->next)
+ if (p != s && p->bb_beg == bb2 && p->bb_beg == p->bb_end)
+ insert_intra_before_1 (p, &ip, bb2);
+ }
}
}