This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH to use NOTE_EH_HANDLER
- To: gcc-patches at gcc dot gnu dot org
- Subject: PATCH to use NOTE_EH_HANDLER
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 14 Sep 1999 16:53:58 -0700
- Reply-to: mark at codesourcery dot com
A lot of places in the code used NOTE_BLOCK_NUMBER instead of
the (synonymous, but much clearer) NOTE_EH_HANDLER. This patch
cleans that up.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
Tue Sep 14 16:47:08 1999 Mark Mitchell <mark@codesourcery.com>
* except.c (expand_eh_region_start_for_decl): Use NOTE_EH_HANDLER,
not NOTE_BLOCK_NUMBER.
(expand_eh_region_end): Likewise.
(find_exception_handler_labels): Likewise.
(scan_region): Likewise.
(exception_optimize): Likewise.
(update_rethrow_references): Likewise.
(set_insn_eh_region): Likewise.
* final.c (final_scan_insn): Likewise.
* flow.c (make_edges): Likewise.
* integrate.c (expand_inline_function): Likewise.
* print-rtl.c (print_rtx): Likewise.
Index: except.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/except.c,v
retrieving revision 1.98
diff -c -p -r1.98 except.c
*** except.c 1999/09/10 20:28:12 1.98
--- except.c 1999/09/14 23:45:13
*************** expand_eh_region_start_for_decl (decl)
*** 1437,1443 ****
push_eh_entry (&ehstack);
note = emit_note (NULL_PTR, NOTE_INSN_EH_REGION_BEG);
! NOTE_BLOCK_NUMBER (note)
= CODE_LABEL_NUMBER (ehstack.top->entry->exception_handler_label);
if (exceptions_via_longjmp)
start_dynamic_handler ();
--- 1437,1443 ----
push_eh_entry (&ehstack);
note = emit_note (NULL_PTR, NOTE_INSN_EH_REGION_BEG);
! NOTE_EH_HANDLER (note)
= CODE_LABEL_NUMBER (ehstack.top->entry->exception_handler_label);
if (exceptions_via_longjmp)
start_dynamic_handler ();
*************** expand_eh_region_end (handler)
*** 1476,1482 ****
entry = pop_eh_entry (&ehstack);
note = emit_note (NULL_PTR, NOTE_INSN_EH_REGION_END);
! ret = NOTE_BLOCK_NUMBER (note)
= CODE_LABEL_NUMBER (entry->exception_handler_label);
if (exceptions_via_longjmp == 0 && ! flag_new_exceptions
/* We share outer_context between regions; only emit it once. */
--- 1476,1482 ----
entry = pop_eh_entry (&ehstack);
note = emit_note (NULL_PTR, NOTE_INSN_EH_REGION_END);
! ret = NOTE_EH_HANDLER (note)
= CODE_LABEL_NUMBER (entry->exception_handler_label);
if (exceptions_via_longjmp == 0 && ! flag_new_exceptions
/* We share outer_context between regions; only emit it once. */
*************** expand_eh_region_end (handler)
*** 1498,1504 ****
entry->finalization = handler;
/* create region entry in final exception table */
! r = new_eh_region_entry (NOTE_BLOCK_NUMBER (note), entry->rethrow_label);
enqueue_eh_entry (&ehqueue, entry);
--- 1498,1504 ----
entry->finalization = handler;
/* create region entry in final exception table */
! r = new_eh_region_entry (NOTE_EH_HANDLER (note), entry->rethrow_label);
enqueue_eh_entry (&ehqueue, entry);
*************** static int eh_table_max_size = 0;
*** 2018,2024 ****
Called from final_scan_insn when a NOTE_INSN_EH_REGION_BEG is seen.
(Or NOTE_INSN_EH_REGION_END sometimes)
! N is the NOTE_BLOCK_NUMBER of the note, which comes from the code
label number of the exception handler for the region. */
void
--- 2018,2024 ----
Called from final_scan_insn when a NOTE_INSN_EH_REGION_BEG is seen.
(Or NOTE_INSN_EH_REGION_END sometimes)
! N is the NOTE_EH_HANDLER of the note, which comes from the code
label number of the exception handler for the region. */
void
*************** find_exception_handler_labels ()
*** 2289,2295 ****
if (GET_CODE (insn) == NOTE
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
{
! ptr = get_first_handler (NOTE_BLOCK_NUMBER (insn));
for ( ; ptr; ptr = ptr->next)
{
/* make sure label isn't in the list already */
--- 2289,2295 ----
if (GET_CODE (insn) == NOTE
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
{
! ptr = get_first_handler (NOTE_EH_HANDLER (insn));
for ( ; ptr; ptr = ptr->next)
{
/* make sure label isn't in the list already */
*************** scan_region (insn, n, delete_outer)
*** 2560,2566 ****
if (insn == NULL_RTX
|| GET_CODE (insn) != NOTE
|| NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_BEG
! || NOTE_BLOCK_NUMBER (insn) != n
|| delete_outer == NULL)
abort ();
--- 2560,2566 ----
if (insn == NULL_RTX
|| GET_CODE (insn) != NOTE
|| NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_BEG
! || NOTE_EH_HANDLER (insn) != n
|| delete_outer == NULL)
abort ();
*************** scan_region (insn, n, delete_outer)
*** 2580,2593 ****
if (GET_CODE (insn) == NOTE
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
{
! insn = scan_region (insn, NOTE_BLOCK_NUMBER (insn), &delete);
}
insn = NEXT_INSN (insn);
}
/* The _BEG/_END NOTEs must match and nest. */
! if (NOTE_BLOCK_NUMBER (insn) != n)
abort ();
/* If anything in this exception region can throw, we can throw. */
--- 2580,2593 ----
if (GET_CODE (insn) == NOTE
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
{
! insn = scan_region (insn, NOTE_EH_HANDLER (insn), &delete);
}
insn = NEXT_INSN (insn);
}
/* The _BEG/_END NOTEs must match and nest. */
! if (NOTE_EH_HANDLER (insn) != n)
abort ();
/* If anything in this exception region can throw, we can throw. */
*************** exception_optimize ()
*** 2665,2671 ****
inbetween. We are also guaranteed that the value of insn
returned will be valid, as otherwise scan_region won't
return. */
! insn = scan_region (insn, NOTE_BLOCK_NUMBER (insn), &n);
}
}
}
--- 2665,2671 ----
inbetween. We are also guaranteed that the value of insn
returned will be valid, as otherwise scan_region won't
return. */
! insn = scan_region (insn, NOTE_EH_HANDLER (insn), &n);
}
}
}
*************** update_rethrow_references ()
*** 2706,2712 ****
{
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
{
! region = find_func_region (NOTE_BLOCK_NUMBER (insn));
saw_region[region] = 1;
}
}
--- 2706,2712 ----
{
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
{
! region = find_func_region (NOTE_EH_HANDLER (insn));
saw_region[region] = 1;
}
}
*************** set_insn_eh_region (first, region_num)
*** 2946,2955 ****
for (insn = *first; insn; insn = NEXT_INSN (insn))
{
! if ((GET_CODE (insn) == NOTE) &&
! (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG))
{
! rnum = NOTE_BLOCK_NUMBER (insn);
insn_eh_region[INSN_UID (insn)] = rnum;
insn = NEXT_INSN (insn);
set_insn_eh_region (&insn, rnum);
--- 2946,2955 ----
for (insn = *first; insn; insn = NEXT_INSN (insn))
{
! if ((GET_CODE (insn) == NOTE)
! && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG))
{
! rnum = NOTE_EH_HANDLER (insn);
insn_eh_region[INSN_UID (insn)] = rnum;
insn = NEXT_INSN (insn);
set_insn_eh_region (&insn, rnum);
*************** init_eh_nesting_info ()
*** 3147,3158 ****
{
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
{
! int block = NOTE_BLOCK_NUMBER (insn);
region_count++;
info->region_index[block] = region_count;
if (eh_note)
nested_eh_region [block] =
! NOTE_BLOCK_NUMBER (XEXP (eh_note, 0));
else
nested_eh_region [block] = 0;
eh_note = gen_rtx_EXPR_LIST (VOIDmode, insn, eh_note);
--- 3147,3158 ----
{
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
{
! int block = NOTE_EH_HANDLER (insn);
region_count++;
info->region_index[block] = region_count;
if (eh_note)
nested_eh_region [block] =
! NOTE_EH_HANDLER (XEXP (eh_note, 0));
else
nested_eh_region [block] = 0;
eh_note = gen_rtx_EXPR_LIST (VOIDmode, insn, eh_note);
Index: final.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/final.c,v
retrieving revision 1.93
diff -c -p -r1.93 final.c
*** final.c 1999/09/07 08:10:42 1.93
--- final.c 1999/09/14 23:45:16
*************** final_scan_insn (insn, file, optimize, p
*** 2078,2088 ****
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
&& ! exceptions_via_longjmp)
{
! ASM_OUTPUT_INTERNAL_LABEL (file, "LEHB", NOTE_BLOCK_NUMBER (insn));
if (! flag_new_exceptions)
! add_eh_table_entry (NOTE_BLOCK_NUMBER (insn));
#ifdef ASM_OUTPUT_EH_REGION_BEG
! ASM_OUTPUT_EH_REGION_BEG (file, NOTE_BLOCK_NUMBER (insn));
#endif
break;
}
--- 2078,2088 ----
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
&& ! exceptions_via_longjmp)
{
! ASM_OUTPUT_INTERNAL_LABEL (file, "LEHB", NOTE_EH_HANDLER (insn));
if (! flag_new_exceptions)
! add_eh_table_entry (NOTE_EH_HANDLER (insn));
#ifdef ASM_OUTPUT_EH_REGION_BEG
! ASM_OUTPUT_EH_REGION_BEG (file, NOTE_EH_HANDLER (insn));
#endif
break;
}
*************** final_scan_insn (insn, file, optimize, p
*** 2090,2100 ****
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END
&& ! exceptions_via_longjmp)
{
! ASM_OUTPUT_INTERNAL_LABEL (file, "LEHE", NOTE_BLOCK_NUMBER (insn));
if (flag_new_exceptions)
! add_eh_table_entry (NOTE_BLOCK_NUMBER (insn));
#ifdef ASM_OUTPUT_EH_REGION_END
! ASM_OUTPUT_EH_REGION_END (file, NOTE_BLOCK_NUMBER (insn));
#endif
break;
}
--- 2090,2100 ----
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END
&& ! exceptions_via_longjmp)
{
! ASM_OUTPUT_INTERNAL_LABEL (file, "LEHE", NOTE_EH_HANDLER (insn));
if (flag_new_exceptions)
! add_eh_table_entry (NOTE_EH_HANDLER (insn));
#ifdef ASM_OUTPUT_EH_REGION_END
! ASM_OUTPUT_EH_REGION_END (file, NOTE_EH_HANDLER (insn));
#endif
break;
}
Index: flow.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/flow.c,v
retrieving revision 1.149
diff -c -p -r1.149 flow.c
*** flow.c 1999/09/08 23:42:18 1.149
--- flow.c 1999/09/14 23:45:19
*************** make_edges (label_value_list, bb_eh_end)
*** 990,996 ****
int num;
if (eh_list)
! eh_region = NOTE_BLOCK_NUMBER (XEXP (eh_list, 0));
num = reachable_handlers (eh_region, eh_nest_info,
insn, &handler_list);
--- 990,996 ----
int num;
if (eh_list)
! eh_region = NOTE_EH_HANDLER (XEXP (eh_list, 0));
num = reachable_handlers (eh_region, eh_nest_info,
insn, &handler_list);
Index: integrate.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/integrate.c,v
retrieving revision 1.65
diff -c -p -r1.65 integrate.c
*** integrate.c 1999/09/07 05:47:55 1.65
--- integrate.c 1999/09/14 23:45:21
*************** expand_inline_function (fndecl, parms, t
*** 1217,1223 ****
|| NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_END))
{
rtx label
! = get_label_from_map (map, NOTE_BLOCK_NUMBER (copy));
/* we have to duplicate the handlers for the original */
if (NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_BEG)
--- 1217,1223 ----
|| NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_END))
{
rtx label
! = get_label_from_map (map, NOTE_EH_HANDLER (copy));
/* we have to duplicate the handlers for the original */
if (NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_BEG)
*************** expand_inline_function (fndecl, parms, t
*** 1225,1238 ****
/* We need to duplicate the handlers for the EH region
and we need to indicate where the label map is */
eif_eh_map = map;
! duplicate_eh_handlers (NOTE_BLOCK_NUMBER (copy),
CODE_LABEL_NUMBER (label),
expand_inline_function_eh_labelmap);
}
/* We have to forward these both to match the new exception
region. */
! NOTE_BLOCK_NUMBER (copy) = CODE_LABEL_NUMBER (label);
}
}
else
--- 1225,1238 ----
/* We need to duplicate the handlers for the EH region
and we need to indicate where the label map is */
eif_eh_map = map;
! duplicate_eh_handlers (NOTE_EH_HANDLER (copy),
CODE_LABEL_NUMBER (label),
expand_inline_function_eh_labelmap);
}
/* We have to forward these both to match the new exception
region. */
! NOTE_EH_HANDLER (copy) = CODE_LABEL_NUMBER (label);
}
}
else
Index: print-rtl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/print-rtl.c,v
retrieving revision 1.32
diff -c -p -r1.32 print-rtl.c
*** print-rtl.c 1999/09/07 05:47:59 1.32
--- print-rtl.c 1999/09/14 23:45:21
*************** print_rtx (in_rtx)
*** 162,170 ****
if (i == 3 && GET_CODE (in_rtx) == NOTE)
{
if (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_EH_REGION_BEG
! || NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_EH_REGION_END
! || NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_BLOCK_BEG
! || NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_BLOCK_END)
{
fprintf (outfile, " %d", NOTE_BLOCK_NUMBER (in_rtx));
sawclose = 1;
--- 162,174 ----
if (i == 3 && GET_CODE (in_rtx) == NOTE)
{
if (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_EH_REGION_BEG
! || NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_EH_REGION_END)
! {
! fprintf (outfile, " %d", NOTE_EH_HANDLER (in_rtx));
! sawclose = 1;
! }
! else if (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_BLOCK_BEG
! || NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_BLOCK_END)
{
fprintf (outfile, " %d", NOTE_BLOCK_NUMBER (in_rtx));
sawclose = 1;