OSDN Git Service

* emit-rtl.c (unshare_all_rtl): Unshare virtual parameters too.
authorgeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 27 Jan 2000 20:46:26 +0000 (20:46 +0000)
committergeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 27 Jan 2000 20:46:26 +0000 (20:46 +0000)
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
gcc/emit-rtl.c
gcc/function.c
gcc/rtl.h
gcc/toplev.c
gcc/tree.h

index c2adbce..7d1a9af 100644 (file)
@@ -1,4 +1,19 @@
-2000-01-24  Geoffrey Keating  <geoffk@cygnus.com>
+2000-01-27  Geoffrey Keating  <geoffk@cygnus.com>
+
+       * 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  <geoffk@cygnus.com>
 
        * genoutput.c (output_prologue): Include ggc.h in generated
        files.
index c8b07a2..7a40b82 100644 (file)
@@ -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));
 \f
 /* 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;
 }
 \f
-/* 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.  */
 
index 9006d16..8339208 100644 (file)
@@ -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 ();
index d286bf8..0a4652a 100644 (file)
--- 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));
index c77ea7a..189c3e7 100644 (file)
@@ -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 ();
 
index 976f70f..99f4d2c 100644 (file)
@@ -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));