X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fmode-switching.c;h=407ae76a8c6b2f3ee843c08a1de1f30d9cf79429;hb=2f603cf0eb135bf67ff0bb570452df725a43c9ce;hp=30ad3a833576c9753cf794f233a142fc1dcf3372;hpb=3743074509eb2c642c077fba1dd9da326c927f33;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c index 30ad3a83357..407ae76a8c6 100644 --- a/gcc/mode-switching.c +++ b/gcc/mode-switching.c @@ -104,7 +104,7 @@ static struct seginfo * new_seginfo (int mode, rtx insn, int bb, HARD_REG_SET regs_live) { struct seginfo *ptr; - ptr = xmalloc (sizeof (struct seginfo)); + ptr = XNEW (struct seginfo); ptr->mode = mode; ptr->insn_ptr = insn; ptr->bbnum = bb; @@ -382,8 +382,8 @@ create_pre_exit (int n_entities, int *entity_map, const int *num_modes) /* Find all insns that need a particular mode setting, and insert the necessary mode switches. Return true if we did work. */ -int -optimize_mode_switching (FILE *file) +static int +optimize_mode_switching (void) { rtx insn; int e; @@ -415,7 +415,7 @@ optimize_mode_switching (FILE *file) entry_exit_extra = 3; #endif bb_info[n_entities] - = xcalloc (last_basic_block + entry_exit_extra, sizeof **bb_info); + = XCNEWVEC (struct bb_info, last_basic_block + entry_exit_extra); entity_map[n_entities++] = e; if (num_modes[e] > max_num_modes) max_num_modes = num_modes[e]; @@ -465,7 +465,11 @@ optimize_mode_switching (FILE *file) if (e->flags & EDGE_COMPLEX) break; if (e) - RESET_BIT (transp[bb->index], j); + { + ptr = new_seginfo (no_mode, BB_HEAD (bb), bb->index, live_now); + add_seginfo (info + bb->index, ptr); + RESET_BIT (transp[bb->index], j); + } } for (insn = BB_HEAD (bb); @@ -563,7 +567,7 @@ optimize_mode_switching (FILE *file) FOR_EACH_BB (bb) sbitmap_not (kill[bb->index], transp[bb->index]); - edge_list = pre_edge_lcm (file, n_entities, transp, comp, antic, + edge_list = pre_edge_lcm (n_entities, transp, comp, antic, kill, &insert, &delete); for (j = n_entities - 1; j >= 0; j--) @@ -608,38 +612,11 @@ optimize_mode_switching (FILE *file) if (mode_set == NULL_RTX) continue; - /* If this is an abnormal edge, we'll insert at the end - of the previous block. */ - if (eg->flags & EDGE_ABNORMAL) - { - emited = true; - if (JUMP_P (BB_END (src_bb))) - emit_insn_before (mode_set, BB_END (src_bb)); - else - { - /* It doesn't make sense to switch to normal - mode after a CALL_INSN. The cases in which a - CALL_INSN may have an abnormal edge are - sibcalls and EH edges. In the case of - sibcalls, the dest basic-block is the - EXIT_BLOCK, that runs in normal mode; it is - assumed that a sibcall insn requires normal - mode itself, so no mode switch would be - required after the call (it wouldn't make - sense, anyway). In the case of EH edges, EH - entry points also start in normal mode, so a - similar reasoning applies. */ - gcc_assert (NONJUMP_INSN_P (BB_END (src_bb))); - emit_insn_after (mode_set, BB_END (src_bb)); - } - bb_info[j][src_bb->index].computing = mode; - RESET_BIT (transp[src_bb->index], j); - } - else - { - need_commit = 1; - insert_insn_on_edge (mode_set, eg); - } + /* We should not get an abnormal edge here. */ + gcc_assert (! (eg->flags & EDGE_ABNORMAL)); + + need_commit = 1; + insert_insn_on_edge (mode_set, eg); } FOR_EACH_BB_REVERSE (bb) @@ -735,14 +712,15 @@ gate_mode_switching (void) #endif } -static void +static unsigned int rest_of_handle_mode_switching (void) { #ifdef OPTIMIZE_MODE_SWITCHING no_new_pseudos = 0; - optimize_mode_switching (NULL); + optimize_mode_switching (); no_new_pseudos = 1; #endif /* OPTIMIZE_MODE_SWITCHING */ + return 0; }