From 6af57aae0ec4bdac7a33edac214c10f94fe946c1 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Tue, 27 Apr 1999 17:08:37 +0000 Subject: [PATCH] rtl.h (REG_EH_REGION): Update comment to indicate a value of -1 indicates no throw and no nonlocal gotos. Tue Apr 27 19:50:25 EDT 1999 Andrew MacLeod * rtl.h (REG_EH_REGION): Update comment to indicate a value of -1 indicates no throw and no nonlocal gotos. * optabs.c (emit_libcall_block): Emit REG_EH_REGION with a value of -1 instead of 0 to indicate a nonlocal goto won't happen either. * flow.c (count_basic_blocks, find_basic_blocks_1): Ignore libcall blocks, look for REG_EH_REGION note exclusively. (make_edges): Check for REG_EH_REGION > 0 for specified handlers. From-SVN: r26680 --- gcc/ChangeLog | 12 +++++++++++- gcc/flow.c | 52 +++++++++++++++++++++++---------------------------- gcc/optabs.c | 2 +- gcc/rtl.h | 8 +++++--- 4 files changed, 40 insertions(+), 34 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e8c0f043597..d2c81274e0c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +Tue Apr 27 19:50:25 EDT 1999 Andrew MacLeod + + * rtl.h (REG_EH_REGION): Update comment to indicate a value of -1 + indicates no throw and no nonlocal gotos. + * optabs.c (emit_libcall_block): Emit REG_EH_REGION with a value + of -1 instead of 0 to indicate a nonlocal goto won't happen either. + * flow.c (count_basic_blocks, find_basic_blocks_1): Ignore libcall + blocks, look for REG_EH_REGION note exclusively. + (make_edges): Check for REG_EH_REGION > 0 for specified handlers. + Tue Apr 27 15:33:42 1999 David Edelsohn * rs6000.h (read_only_data_section, private_data_section, @@ -124,7 +134,7 @@ Mon Apr 26 15:27:33 1999 Mark Mitchell * fixinc/inclhack.tpl: Remove unnecessary character quote * fixinc/fixincl.sh, fixinc/inclhack.sh: Regenerate -Mon Apr 26 10:41:42 EDT 1999 +Mon Apr 26 10:41:42 EDT 1999 Andrew MacLeod * alpha.md (builtin_setjmp_receiver): Use a label_ref instead of a code label. diff --git a/gcc/flow.c b/gcc/flow.c index 9b2151e86a5..b46c87ea46a 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -435,7 +435,6 @@ count_basic_blocks (f) register RTX_CODE prev_code; register int count = 0; int eh_region = 0; - int in_libcall_block = 0; int call_had_abnormal_edge = 0; rtx prev_call = NULL_RTX; @@ -444,11 +443,6 @@ count_basic_blocks (f) { register RTX_CODE code = GET_CODE (insn); - /* Track when we are inside in LIBCALL block. */ - if (GET_RTX_CLASS (code) == 'i' - && find_reg_note (insn, REG_LIBCALL, NULL_RTX)) - in_libcall_block = 1; - if (code == CODE_LABEL || (GET_RTX_CLASS (code) == 'i' && (prev_code == JUMP_INSN @@ -473,14 +467,20 @@ count_basic_blocks (f) /* Record whether this call created an edge. */ if (code == CALL_INSN) { + rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX); + int region = (note ? XINT (XEXP (note, 0), 0) : 1); prev_call = insn; call_had_abnormal_edge = 0; - if (nonlocal_goto_handler_labels) - call_had_abnormal_edge = !in_libcall_block; - else if (eh_region) + + /* If there is a specified EH region, we have an edge. */ + if (eh_region && region > 0) + call_had_abnormal_edge = 1; + else { - rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX); - if (!note || XINT (XEXP (note, 0), 0) != 0) + /* If there is a nonlocal goto label and the specified + region number isn't -1, we have an edge. (0 means + no throw, but might have a nonlocal goto). */ + if (nonlocal_goto_handler_labels && region >= 0) call_had_abnormal_edge = 1; } } @@ -494,9 +494,6 @@ count_basic_blocks (f) else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END) --eh_region; - if (GET_RTX_CLASS (GET_CODE (insn)) == 'i' - && find_reg_note (insn, REG_RETVAL, NULL_RTX)) - in_libcall_block = 0; } /* The rest of the compiler works a bit smoother when we don't have to @@ -527,7 +524,6 @@ find_basic_blocks_1 (f, bb_eh_end) rtx *bb_eh_end; { register rtx insn, next; - int in_libcall_block = 0; int call_has_abnormal_edge = 0; int i = 0; rtx bb_note = NULL_RTX; @@ -548,21 +544,22 @@ find_basic_blocks_1 (f, bb_eh_end) next = NEXT_INSN (insn); - /* Track when we are inside in LIBCALL block. */ - if (GET_RTX_CLASS (code) == 'i' - && find_reg_note (insn, REG_LIBCALL, NULL_RTX)) - in_libcall_block = 1; - if (code == CALL_INSN) { /* Record whether this call created an edge. */ + rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX); + int region = (note ? XINT (XEXP (note, 0), 0) : 1); call_has_abnormal_edge = 0; - if (nonlocal_goto_handler_labels) - call_has_abnormal_edge = !in_libcall_block; - else if (eh_list) + + /* If there is an EH region, we have an edge. */ + if (eh_list && region > 0) + call_has_abnormal_edge = 1; + else { - rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX); - if (!note || XINT (XEXP (note, 0), 0) != 0) + /* If there is a nonlocal goto label and the specified + region number isn't -1, we have an edge. (0 means + no throw, but might have a nonlocal goto). */ + if (nonlocal_goto_handler_labels && region >= 0) call_has_abnormal_edge = 1; } } @@ -722,9 +719,6 @@ find_basic_blocks_1 (f, bb_eh_end) = gen_rtx_EXPR_LIST (VOIDmode, XEXP (note, 0), label_value_list); } - - if (find_reg_note (insn, REG_RETVAL, NULL_RTX)) - in_libcall_block = 0; } } @@ -996,7 +990,7 @@ make_edges (label_value_list, bb_eh_end) x = find_reg_note (insn, REG_EH_REGION, 0); if (x) { - if (XINT (XEXP (x, 0), 0) != 0) + if (XINT (XEXP (x, 0), 0) > 0) { ptr = get_first_handler (XINT (XEXP (x, 0), 0)); while (ptr) diff --git a/gcc/optabs.c b/gcc/optabs.c index 00ce961743a..541471e0910 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -2604,7 +2604,7 @@ emit_libcall_block (insns, target, result, equiv) { rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX); if (note == NULL_RTX) - REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EH_REGION, GEN_INT (0), + REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EH_REGION, GEN_INT (-1), REG_NOTES (insn)); } } diff --git a/gcc/rtl.h b/gcc/rtl.h index 964a8abd99d..8eba5eab5d9 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -343,12 +343,14 @@ typedef struct rtvec_def{ but are too complex for DWARF to interpret what they imply. The attached rtx is used instead of intuition. */ /* REG_EH_REGION is used to indicate what exception region an INSN - belongs in. This can be used to indicate what region a call may throw - to. a REGION of 0 indicates that a call cannot throw at all. + belongs in. This can be used to indicate what region a call may throw + to. A REGION of 0 indicates that a call cannot throw at all. + A REGION of -1 indicates that it cannot throw, nor will it execute + a non-local goto. REG_EH_RETHROW is used to indicate what that a call is actually a call to rethrow, and specifies which region the rethrow is targetting. This provides a way to generate the non standard flow edges required - for a rethrow. */ + for a rethrow. */ #define REG_NOTES(INSN) ((INSN)->fld[6].rtx)