From 2d96a59af7f6a6eae5d6e08fcedf27611cb723a6 Mon Sep 17 00:00:00 2001 From: geoffk Date: Thu, 27 Jan 2000 20:46:26 +0000 Subject: [PATCH] * emit-rtl.c (unshare_all_rtl): Unshare virtual parameters too. Use unshare_all_rtl_1. (unshare_all_rtl_again): New function. (unshare_all_rtl_1): New function split out of unshare_all_rtl. * function.c (purge_addressof_1): Use unshare_all_rtl_again rather than resetting the 'used' flags ourself. * toplev.c (rest_of_compilation): Add current_function_decl to the unshare_all_rtl call. * tree.h: Prototype unshare_all_rtl. * rtl.h: Prototype unshare_all_rtl_again here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31651 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 17 ++++++++++++++- gcc/emit-rtl.c | 65 +++++++++++++++++++++++++++++++++++++++++++++------------- gcc/function.c | 8 +------- gcc/rtl.h | 2 +- gcc/toplev.c | 2 +- gcc/tree.h | 1 + 6 files changed, 71 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c2adbce796a..7d1a9af4d68 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,19 @@ -2000-01-24 Geoffrey Keating +2000-01-27 Geoffrey Keating + + * emit-rtl.c (unshare_all_rtl): Unshare virtual parameters too. + Use unshare_all_rtl_1. + (unshare_all_rtl_again): New function. + (unshare_all_rtl_1): New function split out of unshare_all_rtl. + + * function.c (purge_addressof_1): Use unshare_all_rtl_again + rather than resetting the 'used' flags ourself. + + * toplev.c (rest_of_compilation): Add current_function_decl + to the unshare_all_rtl call. + * tree.h: Prototype unshare_all_rtl. + * rtl.h: Prototype unshare_all_rtl_again here. + +2000-01-27 Geoffrey Keating * genoutput.c (output_prologue): Include ggc.h in generated files. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index c8b07a2e73a..7a40b82238b 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -170,6 +170,7 @@ static rtx make_jump_insn_raw PARAMS ((rtx)); static rtx make_call_insn_raw PARAMS ((rtx)); static rtx find_line_note PARAMS ((rtx)); static void mark_sequence_stack PARAMS ((struct sequence_stack *)); +static void unshare_all_rtl_1 PARAMS ((rtx)); /* There are some RTL codes that require special attention; the generation functions do the raw handling. If you add to this list, modify @@ -1610,23 +1611,25 @@ free_emit_status (f) f->emit = NULL; } -/* Go through all the RTL insn bodies and copy any invalid shared structure. - It does not work to do this twice, because the mark bits set here - are not cleared afterwards. */ +/* Go through all the RTL insn bodies and copy any invalid shared + structure. This routine should only be called once. */ void -unshare_all_rtl (insn) - register rtx insn; +unshare_all_rtl (fndecl, insn) + tree fndecl; + rtx insn; { - for (; insn; insn = NEXT_INSN (insn)) - if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN - || GET_CODE (insn) == CALL_INSN) - { - PATTERN (insn) = copy_rtx_if_shared (PATTERN (insn)); - REG_NOTES (insn) = copy_rtx_if_shared (REG_NOTES (insn)); - LOG_LINKS (insn) = copy_rtx_if_shared (LOG_LINKS (insn)); - } + tree decl; + /* Make sure that virtual parameters are not shared. */ + for (decl = DECL_ARGUMENTS (fndecl); decl; decl = TREE_CHAIN (decl)) + { + copy_rtx_if_shared (DECL_RTL (decl)); + } + + /* Unshare just about everything else. */ + unshare_all_rtl_1 (insn); + /* Make sure the addresses of stack slots found outside the insn chain (such as, in DECL_RTL of a variable) are not shared with the insn chain. @@ -1634,10 +1637,44 @@ unshare_all_rtl (insn) This special care is necessary when the stack slot MEM does not actually appear in the insn chain. If it does appear, its address is unshared from all else at that point. */ - copy_rtx_if_shared (stack_slot_list); } +/* Go through all the RTL insn bodies and copy any invalid shared + structure, again. This is a fairly expensive thing to do so it + should be done sparingly. */ + +void +unshare_all_rtl_again (insn) + rtx insn; +{ + rtx p; + for (p = insn; p; p = NEXT_INSN (p)) + if (GET_RTX_CLASS (GET_CODE (p)) == 'i') + { + reset_used_flags (PATTERN (p)); + reset_used_flags (REG_NOTES (p)); + reset_used_flags (LOG_LINKS (p)); + } + unshare_all_rtl_1 (insn); +} + +/* Go through all the RTL insn bodies and copy any invalid shared structure. + Assumes the mark bits are cleared at entry. */ + +static void +unshare_all_rtl_1 (insn) + rtx insn; +{ + for (; insn; insn = NEXT_INSN (insn)) + if (GET_RTX_CLASS (GET_CODE (insn)) == 'i') + { + PATTERN (insn) = copy_rtx_if_shared (PATTERN (insn)); + REG_NOTES (insn) = copy_rtx_if_shared (REG_NOTES (insn)); + LOG_LINKS (insn) = copy_rtx_if_shared (LOG_LINKS (insn)); + } +} + /* Mark ORIG as in use, and return a copy of it if it was already in use. Recursively does the same for subexpressions. */ diff --git a/gcc/function.c b/gcc/function.c index 9006d16dd9b..8339208b3a8 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -2972,13 +2972,7 @@ purge_addressof_1 (loc, insn, force, store, ht) /* Make sure to unshare any shared rtl that store_bit_field might have created. */ - for (p = get_insns(); p; p = NEXT_INSN (p)) - { - reset_used_flags (PATTERN (p)); - reset_used_flags (REG_NOTES (p)); - reset_used_flags (LOG_LINKS (p)); - } - unshare_all_rtl (get_insns ()); + unshare_all_rtl_again (get_insns ()); seq = gen_sequence (); end_sequence (); diff --git a/gcc/rtl.h b/gcc/rtl.h index d286bf86378..0a4652aaad5 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1445,7 +1445,7 @@ extern void reverse_comparison PARAMS ((rtx)); extern void set_new_first_and_last_insn PARAMS ((rtx, rtx)); extern void set_new_first_and_last_label_num PARAMS ((int, int)); extern void set_new_last_label_num PARAMS ((int)); -extern void unshare_all_rtl PARAMS ((rtx)); +extern void unshare_all_rtl_again PARAMS ((rtx)); extern void set_last_insn PARAMS ((rtx)); extern void link_cc0_insns PARAMS ((rtx)); extern void add_insn PARAMS ((rtx)); diff --git a/gcc/toplev.c b/gcc/toplev.c index c77ea7a5313..189c3e71353 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2944,7 +2944,7 @@ rest_of_compilation (decl) /* Copy any shared structure that should not be shared. */ - unshare_all_rtl (insns); + unshare_all_rtl (current_function_decl, insns); init_EXPR_INSN_LIST_cache (); diff --git a/gcc/tree.h b/gcc/tree.h index 976f70f86a2..99f4d2cb754 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2392,6 +2392,7 @@ extern tree reorder_blocks PARAMS ((tree, struct rtx_def *)); extern void free_temps_for_rtl_expr PARAMS ((tree)); extern void instantiate_virtual_regs PARAMS ((tree, struct rtx_def *)); +extern void unshare_all_rtl PARAMS ((tree, struct rtx_def *)); extern int max_parm_reg_num PARAMS ((void)); extern void push_function_context PARAMS ((void)); extern void pop_function_context PARAMS ((void)); -- 2.11.0