Commit 27249135 by Bernd Schmidt Committed by Richard Henderson

flow.c (find_basic_blocks): Emit NOPs after normal calls in this function.

Tue Oct 13 22:12:11 1998  Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
        * flow.c (find_basic_blocks): Emit NOPs after normal calls in this
        function.
        Compute max_uid_for_flow by calling get_max_uid after the scan.
        (find_basic_blocks_1): Don't emit NOPs here.

From-SVN: r23061
parent 56ee9281
Tue Oct 13 22:12:11 1998 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* flow.c (find_basic_blocks): Emit NOPs after normal calls in this
function.
Compute max_uid_for_flow by calling get_max_uid after the scan.
(find_basic_blocks_1): Don't emit NOPs here.
Tue Oct 13 22:05:49 1998 Richard Henderson <rth@cygnus.com> Tue Oct 13 22:05:49 1998 Richard Henderson <rth@cygnus.com>
* alias.c (base_alias_check): Accept new args for the modes of the * alias.c (base_alias_check): Accept new args for the modes of the
......
...@@ -311,18 +311,16 @@ find_basic_blocks (f, nregs, file) ...@@ -311,18 +311,16 @@ find_basic_blocks (f, nregs, file)
register int i; register int i;
rtx nonlocal_label_list = nonlocal_label_rtx_list (); rtx nonlocal_label_list = nonlocal_label_rtx_list ();
int in_libcall_block = 0; int in_libcall_block = 0;
int extra_uids_for_flow = 0;
/* Count the basic blocks. Also find maximum insn uid value used. */ /* Count the basic blocks. Also find maximum insn uid value used. */
{ {
rtx prev_call = 0;
register RTX_CODE prev_code = JUMP_INSN; register RTX_CODE prev_code = JUMP_INSN;
register RTX_CODE code; register RTX_CODE code;
int eh_region = 0; int eh_region = 0;
int call_had_abnormal_edge = 0; int call_had_abnormal_edge = 0;
max_uid_for_flow = 0;
for (insn = f, i = 0; insn; insn = NEXT_INSN (insn)) for (insn = f, i = 0; insn; insn = NEXT_INSN (insn))
{ {
/* Track when we are inside in LIBCALL block. */ /* Track when we are inside in LIBCALL block. */
...@@ -331,44 +329,41 @@ find_basic_blocks (f, nregs, file) ...@@ -331,44 +329,41 @@ find_basic_blocks (f, nregs, file)
in_libcall_block = 1; in_libcall_block = 1;
code = GET_CODE (insn); code = GET_CODE (insn);
if (INSN_UID (insn) > max_uid_for_flow)
max_uid_for_flow = INSN_UID (insn); /* A basic block starts at label, or after something that can jump. */
if (code == CODE_LABEL) if (code == CODE_LABEL
i++; || (GET_RTX_CLASS (code) == 'i'
else if (GET_RTX_CLASS (code) == 'i') && (prev_code == JUMP_INSN
|| (prev_code == CALL_INSN && call_had_abnormal_edge)
|| prev_code == BARRIER)))
{ {
if (prev_code == JUMP_INSN || prev_code == BARRIER) i++;
i++;
else if (prev_code == CALL_INSN) /* If the previous insn was a call that did not create an
abnormal edge, we want to add a nop so that the CALL_INSN
itself is not at basic_block_end. This allows us to easily
distinguish between normal calls and those which create
abnormal edges in the flow graph. */
if (i > 0 && !call_had_abnormal_edge && prev_call != 0)
{ {
if (call_had_abnormal_edge) rtx nop = gen_rtx_USE (VOIDmode, const0_rtx);
i++; emit_insn_after (nop, prev_call);
else
{
/* Else this call does not force a new block to be
created. However, it may still be the end of a basic
block if it is followed by a CODE_LABEL or a BARRIER.
To disambiguate calls which force new blocks to be
created from those which just happen to be at the end
of a block we insert nops during find_basic_blocks_1
after calls which are the last insn in a block by
chance. We must account for such insns in
max_uid_for_flow. */
extra_uids_for_flow++;
}
} }
} }
/* We change the code of the CALL_INSN, so that it won't start a /* We change the code of the CALL_INSN, so that it won't start a
new block. */ new block. */
if (code == CALL_INSN && in_libcall_block) if (code == CALL_INSN && in_libcall_block)
code = INSN; code = INSN;
/* Record whether this call created an edge. */ /* Record whether this call created an edge. */
if (code == CALL_INSN) if (code == CALL_INSN)
call_had_abnormal_edge = (nonlocal_label_list != 0 || eh_region); {
prev_call = insn;
call_had_abnormal_edge = (nonlocal_label_list != 0 || eh_region);
}
else if (code != NOTE && code != BARRIER)
prev_call = 0;
if (code != NOTE) if (code != NOTE)
prev_code = code; prev_code = code;
...@@ -385,12 +380,12 @@ find_basic_blocks (f, nregs, file) ...@@ -385,12 +380,12 @@ find_basic_blocks (f, nregs, file)
n_basic_blocks = i; n_basic_blocks = i;
max_uid_for_flow = get_max_uid ();
#ifdef AUTO_INC_DEC #ifdef AUTO_INC_DEC
/* Leave space for insns life_analysis makes in some cases for auto-inc. /* Leave space for insns life_analysis makes in some cases for auto-inc.
These cases are rare, so we don't need too much space. */ These cases are rare, so we don't need too much space. */
max_uid_for_flow += max_uid_for_flow / 10; max_uid_for_flow += max_uid_for_flow / 10;
#endif #endif
max_uid_for_flow += extra_uids_for_flow;
/* Allocate some tables that last till end of compiling this function /* Allocate some tables that last till end of compiling this function
and some needed only in find_basic_blocks and life_analysis. */ and some needed only in find_basic_blocks and life_analysis. */
...@@ -513,20 +508,6 @@ find_basic_blocks_1 (f, nonlocal_labels) ...@@ -513,20 +508,6 @@ find_basic_blocks_1 (f, nonlocal_labels)
if (LABEL_PRESERVE_P (insn)) if (LABEL_PRESERVE_P (insn))
block_live[i] = 1; block_live[i] = 1;
} }
/* If the previous insn was a call that did not create an
abnormal edge, we want to add a nop so that the CALL_INSN
itself is not at basic_block_end. This allows us to easily
distinguish between normal calls and those which create
abnormal edges in the flow graph. */
if (i > 0 && !call_had_abnormal_edge
&& GET_CODE (basic_block_end[i-1]) == CALL_INSN)
{
rtx nop = gen_rtx_USE (VOIDmode, const0_rtx);
nop = emit_insn_after (nop, basic_block_end[i-1]);
basic_block_end[i-1] = nop;
}
} }
else if (GET_RTX_CLASS (code) == 'i') else if (GET_RTX_CLASS (code) == 'i')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment