Flow analysis confused by exception handling
Jason Merrill
jason@cygnus.com
Tue Dec 2 02:25:00 GMT 1997
>>>>> Teemu Torma <tot@trema.com> writes:
> The problem I sent few days ago about register being clobbered
> in sparc while throwing seems to be actually flow analysis problem.
> In the following code, the initial assignment to `i' gets deleted
> because the next instruction also assigns it.
Does this fix the problem?
Tue Dec 2 01:42:33 1997 Jason Merrill <jason@yorick.cygnus.com>
* flow.c (find_basic_blocks): A CALL_INSN that can throw starts
a new basic block.
(find_basic_blocks_1): Likewise.
Index: flow.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/flow.c,v
retrieving revision 1.100
diff -c -r1.100 flow.c
*** flow.c 1997/11/28 04:44:47 1.100
--- flow.c 1997/12/02 09:25:06
***************
*** 304,309 ****
--- 304,310 ----
{
register RTX_CODE prev_code = JUMP_INSN;
register RTX_CODE code;
+ int eh_region = 0;
max_uid_for_flow = 0;
***************
*** 316,322 ****
|| (GET_RTX_CLASS (code) == 'i'
&& (prev_code == JUMP_INSN
|| (prev_code == CALL_INSN
! && nonlocal_label_list != 0)
|| prev_code == BARRIER)))
i++;
--- 317,323 ----
|| (GET_RTX_CLASS (code) == 'i'
&& (prev_code == JUMP_INSN
|| (prev_code == CALL_INSN
! && (nonlocal_label_list != 0 || eh_region))
|| prev_code == BARRIER)))
i++;
***************
*** 325,330 ****
--- 326,335 ----
if (code != NOTE)
prev_code = code;
+ else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
+ ++eh_region;
+ else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END)
+ --eh_region;
}
}
***************
*** 420,426 ****
|| (GET_RTX_CLASS (code) == 'i'
&& (prev_code == JUMP_INSN
|| (prev_code == CALL_INSN
! && nonlocal_label_list != 0
&& ! find_reg_note (insn, REG_RETVAL, NULL_RTX))
|| prev_code == BARRIER)))
{
--- 425,431 ----
|| (GET_RTX_CLASS (code) == 'i'
&& (prev_code == JUMP_INSN
|| (prev_code == CALL_INSN
! && (nonlocal_label_list != 0 || eh_note)
&& ! find_reg_note (insn, REG_RETVAL, NULL_RTX))
|| prev_code == BARRIER)))
{
More information about the Gcc
mailing list