From eea7b156e468e98de691a60ad941e694d063f82a Mon Sep 17 00:00:00 2001 From: steven Date: Sat, 25 Nov 2006 10:53:06 +0000 Subject: [PATCH] * jump.c (mark_all_labels): Work in cfglayout mode. * cfgcleanup.c (cleanup_cfg): Do not call delete_dead_jumptables when in cfglayout mode, because there are no dead jumptables visible. * cfgrtl.c (commit_one_edge_insertion): Don't set bb->aux when in cfglayout mode. (commit_edge_insertions): Do not allow insertion of instructions with control flow insns when in cfglayout mode. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119191 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 ++++++++++++- gcc/cfgcleanup.c | 12 +++++++++--- gcc/cfgrtl.c | 10 +++++++++- gcc/jump.c | 25 +++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c43316eb8db..7e2e0db3eb2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2006-11-25 Steven Bosscher + + * jump.c (mark_all_labels): Work in cfglayout mode. + * cfgcleanup.c (cleanup_cfg): Do not call delete_dead_jumptables + when in cfglayout mode, because there are no dead jumptables + visible. + * cfgrtl.c (commit_one_edge_insertion): Don't set bb->aux when + in cfglayout mode. + (commit_edge_insertions): Do not allow insertion of instructions + with control flow insns when in cfglayout mode. + 2006-11-25 Zdenek Dvorak * tree-vrp.c (execute_vrp): Do not pass loops structure through @@ -1467,7 +1478,7 @@ 2006-11-11 Jan Hubicka - * extended.texi (__builtin_expect): We no longer require second argument + * extend.texi (__builtin_expect): We no longer require second argument to be constant. * gengtype.c (adjust_field_rtx_def): Drop NOTE_INSN_EXPECTED_VALUE. * builtins.c (expand_builtin_expect): Simplify. diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 046ee779fe7..ad9ae4f8f3b 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -763,8 +763,6 @@ merge_blocks_move (edge e, basic_block b, basic_block c, int mode) if (BB_PARTITION (b) != BB_PARTITION (c)) return NULL; - - /* If B has a fallthru edge to C, no need to move anything. */ if (e->flags & EDGE_FALLTHRU) { @@ -2260,7 +2258,15 @@ cleanup_cfg (int mode) } else break; - delete_dead_jumptables (); + + /* Don't call delete_dead_jumptables in cfglayout mode, because + that function assumes that jump tables are in the insns stream. + But we also don't _have_ to delete dead jumptables in cfglayout + mode because we shouldn't even be looking at things that are + not in a basic block. Dead jumptables are cleaned up when + going out of cfglayout mode. */ + if (!(mode & CLEANUP_CFGLAYOUT)) + delete_dead_jumptables (); } timevar_pop (TV_CLEANUP_CFG); diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 3934d9297df..6f474c0441d 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -1477,7 +1477,8 @@ commit_one_edge_insertion (edge e, int watch_calls) gcc_assert (!JUMP_P (last)); /* Mark the basic block for find_many_sub_basic_blocks. */ - bb->aux = &bb->aux; + if (current_ir_type () != IR_RTL_CFGLAYOUT) + bb->aux = &bb->aux; } /* Update the CFG for all queued instructions. */ @@ -1509,6 +1510,13 @@ commit_edge_insertions (void) if (!changed) return; + /* In the old rtl CFG API, it was OK to insert control flow on an + edge, apparently? In cfglayout mode, this will *not* work, and + the caller is responsible for making sure that control flow is + valid at all times. */ + if (current_ir_type () == IR_RTL_CFGLAYOUT) + return; + blocks = sbitmap_alloc (last_basic_block); sbitmap_zero (blocks); FOR_EACH_BB (bb) diff --git a/gcc/jump.c b/gcc/jump.c index f42ee5a43ab..127e8a800c3 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -202,6 +202,31 @@ mark_all_labels (rtx f) } } } + + /* If we are in cfglayout mode, there may be non-insns between the + basic blocks. If those non-insns represent tablejump data, they + contain label references that we must record. */ + if (current_ir_type () == IR_RTL_CFGLAYOUT) + { + basic_block bb; + rtx insn; + FOR_EACH_BB (bb) + { + for (insn = bb->il.rtl->header; insn; insn = NEXT_INSN (insn)) + if (INSN_P (insn)) + { + gcc_assert (JUMP_TABLE_DATA_P (insn)); + mark_jump_label (PATTERN (insn), insn, 0); + } + + for (insn = bb->il.rtl->footer; insn; insn = NEXT_INSN (insn)) + if (INSN_P (insn)) + { + gcc_assert (JUMP_TABLE_DATA_P (insn)); + mark_jump_label (PATTERN (insn), insn, 0); + } + } + } } /* Move all block-beg, block-end and loop-beg notes between START and END out -- 2.11.4.GIT