From c14f7160a1403c21443013a8af8a29e1ddbfe488 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sun, 19 Mar 2000 18:25:27 +0000 Subject: [PATCH] emit-rtl.c (push_to_full_sequence, [...]): New functions. * emit-rtl.c (push_to_full_sequence, end_full_sequence): New functions. * except.c (emit_cleanup_handler): Use them. (expand_end_all_catch): Likewise. * function.c (fixup_var_refs): Likewise. (expand_function_end): Clear catch_clauses_last. * rtl.h (push_to_full_sequence, end_full_sequence): Declare. * except.h (struct eh_status): New field x_catch_clauses_last. (catch_clauses_last): New define. * cp/except.c (expand_exception_blocks): Clear catch_clauses_last. * java/except.c (emit_handlers): Clear catch_clauses_last. From-SVN: r32643 --- gcc/ChangeLog | 11 ++++++++++- gcc/cp/ChangeLog | 4 ++++ gcc/cp/except.c | 4 ++-- gcc/emit-rtl.c | 26 ++++++++++++++++++++++++++ gcc/except.c | 10 ++++------ gcc/except.h | 3 +++ gcc/function.c | 6 +++--- gcc/java/ChangeLog | 4 ++++ gcc/java/except.c | 2 +- gcc/rtl.h | 2 ++ 10 files changed, 59 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3dce7cf..7f6c40c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,13 @@ -2000-03-18 Martin v. Löwis +2000-03-19 Martin v. Löwis + + * emit-rtl.c (push_to_full_sequence, end_full_sequence): New functions. + * except.c (emit_cleanup_handler): Use them. + (expand_end_all_catch): Likewise. + * function.c (fixup_var_refs): Likewise. + (expand_function_end): Clear catch_clauses_last. + * rtl.h (push_to_full_sequence, end_full_sequence): Declare. + * except.h (struct eh_status): New field x_catch_clauses_last. + (catch_clauses_last): New define. * Makefile.in (tree.o): Depend on HASHTAB_H. * tree.c: Include hashtab.h. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fbaaad9..83cec30 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2000-03-19 Martin v. Löwis + + * except.c (expand_exception_blocks): Clear catch_clauses_last. + 2000-03-18 Mark Mitchell * cp-tree.h (CLEAR_DECL_C_BIT_FIELD): New macro. diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 12523dc..8e32659 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -796,13 +796,13 @@ expand_exception_blocks () expand_eh_region_start (); emit_insns (catch_clauses); - catch_clauses = NULL_RTX; + catch_clauses = catch_clauses_last = NULL_RTX; if (exceptions_via_longjmp == 0) expand_eh_region_end (build_terminate_handler ()); emit_insns (catch_clauses); - catch_clauses = NULL_RTX; + catch_clauses = catch_clauses_last = NULL_RTX; emit_label (funcend); } } diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 764a5ad..e238cfa 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3422,6 +3422,20 @@ push_to_sequence (first) last_insn = last; } +/* Set up the insn chain from a chain stort in FIRST to LAST. */ + +void +push_to_full_sequence (first, last) + rtx first, last; +{ + start_sequence (); + first_insn = first; + last_insn = last; + /* We really should have the end of the insn chain here. */ + if (last && NEXT_INSN (last)) + abort (); +} + /* Set up the outer-level insn chain as the current sequence, saving the previously current one. */ @@ -3484,6 +3498,18 @@ end_sequence () free (tem); } +/* This works like end_sequence, but records the old sequence in FIRST + and LAST. */ + +void +end_full_sequence (first, last) + rtx *first, *last; +{ + *first = first_insn; + *last = last_insn; + end_sequence(); +} + /* Return 1 if currently emitting into a sequence. */ int diff --git a/gcc/except.c b/gcc/except.c index 44507f8..3146778 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -1865,10 +1865,9 @@ emit_cleanup_handler (entry) end_sequence (); /* And add it to the CATCH_CLAUSES. */ - push_to_sequence (catch_clauses); + push_to_full_sequence (catch_clauses, catch_clauses_last); emit_insns (handler_insns); - catch_clauses = get_insns (); - end_sequence (); + end_full_sequence (&catch_clauses, &catch_clauses_last); /* Now we've left the handler. */ pop_ehqueue (); @@ -1990,10 +1989,9 @@ expand_end_all_catch () pop_label_entry (&outer_context_label_stack); /* Add the new sequence of catches to the main one for this function. */ - push_to_sequence (catch_clauses); + push_to_full_sequence (catch_clauses, catch_clauses_last); emit_insns (new_catch_clause); - catch_clauses = get_insns (); - end_sequence (); + end_full_sequence (&catch_clauses, &catch_clauses_last); /* Here we fall through into the continuation code. */ } diff --git a/gcc/except.h b/gcc/except.h index 1087bc1..ee9ea60 100644 --- a/gcc/except.h +++ b/gcc/except.h @@ -120,6 +120,8 @@ struct eh_status /* Insns for all of the exception handlers for the current function. They are currently emitted by the frontend code. */ rtx x_catch_clauses; + /* End of exception handler insn sequence. */ + rtx x_catch_clauses_last; /* A random data area for the front end's own use. */ struct label_node *x_false_label_stack; /* Keeps track of the label to resume to should one want to resume @@ -142,6 +144,7 @@ struct eh_status #define catchstack (cfun->eh->x_catchstack) #define ehqueue (cfun->eh->x_ehqueue) #define catch_clauses (cfun->eh->x_catch_clauses) +#define catch_clauses_last (cfun->eh->x_catch_clauses_last) #define false_label_stack (cfun->eh->x_false_label_stack) #define caught_return_label_stack (cfun->eh->x_caught_return_label_stack) #define protect_list (cfun->eh->x_protect_list) diff --git a/gcc/function.c b/gcc/function.c index e994558..aed4c60 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -1548,10 +1548,10 @@ fixup_var_refs (var, promoted_mode, unsignedp, ht) } /* Scan the catch clauses for exception handling too. */ - push_to_sequence (catch_clauses); + push_to_full_sequence (catch_clauses, catch_clauses_last); fixup_var_refs_insns (var, promoted_mode, unsignedp, catch_clauses, 0, 0); - end_sequence (); + end_full_sequence (&catch_clauses, &catch_clauses_last); /* Scan sequences saved in CALL_PLACEHOLDERS too. */ for (insn = first_insn; insn; insn = NEXT_INSN (insn)) @@ -6549,7 +6549,7 @@ expand_function_end (filename, line, end_bindings) /* If there are any catch_clauses remaining, output them now. */ emit_insns (catch_clauses); - catch_clauses = NULL_RTX; + catch_clauses = catch_clauses_last = NULL_RTX; /* If the above emitted any code, may sure we jump around it. */ if (last != get_last_insn ()) { diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 5d58d88..f96e287 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2000-03-19 Martin v. Löwis + + * except.c (emit_handlers): Clear catch_clauses_last. + Fri Mar 17 08:09:14 2000 Richard Kenner * class.c (make_field_value): Properly handle sizes. diff --git a/gcc/java/except.c b/gcc/java/except.c index 0b1590f..80f24f8 100644 --- a/gcc/java/except.c +++ b/gcc/java/except.c @@ -433,7 +433,7 @@ emit_handlers () emit_jump (funcend); emit_insns (catch_clauses); - catch_clauses = NULL_RTX; + catch_clauses = catch_clauses_last = NULL_RTX; expand_leftover_cleanups (); emit_label (funcend); diff --git a/gcc/rtl.h b/gcc/rtl.h index 46750ac..fc344ce 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1012,6 +1012,8 @@ extern rtx get_last_insn_anywhere PARAMS ((void)); extern void start_sequence PARAMS ((void)); extern void push_to_sequence PARAMS ((rtx)); extern void end_sequence PARAMS ((void)); +extern void push_to_full_sequence PARAMS ((rtx, rtx)); +extern void end_full_sequence PARAMS ((rtx*, rtx*)); extern rtx gen_sequence PARAMS ((void)); extern rtx immed_double_const PARAMS ((HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode)); extern rtx force_const_mem PARAMS ((enum machine_mode, rtx)); -- 2.7.4