diff options
author | Michael Hayes <mhayes@redhat.com> | 2001-01-11 09:13:02 +0000 |
---|---|---|
committer | Michael Hayes <m.hayes@gcc.gnu.org> | 2001-01-11 09:13:02 +0000 |
commit | 0ab409ed42980a740a408a48ec54d715358933d9 (patch) | |
tree | 26948d17a5ada6ec1335c582ada8ab1d0353f991 | |
parent | 9e96a929d06f9986bd1b273950a80a07c5203068 (diff) | |
download | gcc-0ab409ed42980a740a408a48ec54d715358933d9.zip gcc-0ab409ed42980a740a408a48ec54d715358933d9.tar.gz gcc-0ab409ed42980a740a408a48ec54d715358933d9.tar.bz2 |
flow.c (flow_call_edges_add): New.
* flow.c (flow_call_edges_add): New.
* basic_block.h (flow_call_edges_add): New.
From-SVN: r38899
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/basic-block.h | 1 | ||||
-rw-r--r-- | gcc/flow.c | 69 |
3 files changed, 75 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7b0099a..35f1fe0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-01-11 Michael Hayes <mhayes@redhat.com> + + * flow.c (flow_call_edges_add): New. + * basic_block.h (flow_call_edges_add): New. + 2001-01-11 J"orn Rennecke <amylaar@redhat.com> * reload1.c (move2add_note_store): Update reg_set_luid even if diff --git a/gcc/basic-block.h b/gcc/basic-block.h index c48a547..b017546 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -249,6 +249,7 @@ extern void commit_edge_insertions PARAMS ((void)); extern void remove_fake_edges PARAMS ((void)); extern void add_noreturn_fake_exit_edges PARAMS ((void)); extern void connect_infinite_loops_to_exit PARAMS ((void)); +extern int flow_call_edges_add PARAMS ((sbitmap)); extern rtx flow_delete_insn PARAMS ((rtx)); extern void flow_delete_insn_chain PARAMS ((rtx, rtx)); extern void make_edge PARAMS ((sbitmap *, basic_block, @@ -2011,6 +2011,75 @@ commit_edge_insertions () bb = BASIC_BLOCK (i); } } + +/* Add fake edges to the function exit for any non constant calls in + the bitmap of blocks specified by BLOCKS or to the whole CFG if + BLOCKS is zero. Return the nuber of blocks that were split. */ + +int +flow_call_edges_add (blocks) + sbitmap blocks; +{ + int i; + int blocks_split = 0; + int bb_num = 0; + basic_block *bbs; + + /* Map bb indicies into basic block pointers since split_block + will renumber the basic blocks. */ + + bbs = xmalloc (n_basic_blocks * sizeof (*bbs)); + + if (! blocks) + { + for (i = 0; i < n_basic_blocks; i++) + bbs[bb_num++] = BASIC_BLOCK (i); + } + else + { + EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i, + { + bbs[bb_num++] = BASIC_BLOCK (i); + }); + } + + + /* Now add fake edges to the function exit for any non constant + calls since there is no way that we can determine if they will + return or not... */ + + for (i = 0; i < bb_num; i++) + { + basic_block bb = bbs[i]; + rtx insn; + rtx prev_insn; + + for (insn = bb->end; ; insn = prev_insn) + { + prev_insn = PREV_INSN (insn); + if (GET_CODE (insn) == CALL_INSN && ! CONST_CALL_P (insn)) + { + edge e; + + /* Note that the following may create a new basic block + and renumber the existing basic blocks. */ + e = split_block (bb, insn); + if (e) + blocks_split++; + + make_edge (NULL, bb, EXIT_BLOCK_PTR, EDGE_FAKE); + } + if (insn == bb->head) + break; + } + } + + if (blocks_split) + verify_flow_info (); + + free (bbs); + return blocks_split; +} /* Delete all unreachable basic blocks. */ |