OSDN Git Service

* reload1.c (reload_cse_regs_1): When deleting a no-op move that
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 24 Aug 1998 17:03:34 +0000 (17:03 +0000)
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 24 Aug 1998 17:03:34 +0000 (17:03 +0000)
loads the function result, substitute with a USE.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@21951 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/reload1.c

index d7eaad5..0cc7a23 100644 (file)
@@ -1,3 +1,8 @@
+Tue Aug 25 00:57:54 1998  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+       * reload1.c (reload_cse_regs_1): When deleting a no-op move that
+       loads the function result, substitute with a USE.
+
 Mon Aug 24 15:20:19 1998  David Edelsohn  <edelsohn@mhpcc.edu>
 
        * rs6000.h (GO_IF_LEGITIMATE_ADDRESS): Use TARGET_POWERPC64
index 239afd8..346fbcc 100644 (file)
@@ -8290,9 +8290,27 @@ reload_cse_regs (first)
          int count = 0;
          if (reload_cse_noop_set_p (body, insn))
            {
-             PUT_CODE (insn, NOTE);
-             NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
-             NOTE_SOURCE_FILE (insn) = 0;
+             /* If this sets the return value of the function, we must keep
+                a USE around, in case this is in a different basic block
+                than the final USE.  Otherwise, we could loose important
+                register lifeness information on SMALL_REGISTER_CLASSES
+                machines, where return registers might be used as spills:
+                subsequent passes assume that spill registers are dead at
+                the end of a basic block.  */
+             if (REG_FUNCTION_VALUE_P (SET_DEST (body)))
+               {
+                 pop_obstacks ();
+                 PATTERN (insn) = gen_rtx_USE (VOIDmode, SET_DEST (body));
+                 INSN_CODE (insn) = -1;
+                 REG_NOTES (insn) = NULL_RTX;
+                 push_obstacks (&reload_obstack, &reload_obstack);
+               }
+             else
+               {
+                 PUT_CODE (insn, NOTE);
+                 NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+                 NOTE_SOURCE_FILE (insn) = 0;
+               }
              reload_cse_delete_death_notes (insn);
 
              /* We're done with this insn.  */
@@ -8313,19 +8331,43 @@ reload_cse_regs (first)
       else if (GET_CODE (body) == PARALLEL)
        {
          int count = 0;
+         rtx value = NULL_RTX;
 
          /* If every action in a PARALLEL is a noop, we can delete
              the entire PARALLEL.  */
          for (i = XVECLEN (body, 0) - 1; i >= 0; --i)
-           if ((GET_CODE (XVECEXP (body, 0, i)) != SET
-                || ! reload_cse_noop_set_p (XVECEXP (body, 0, i), insn))
-               && GET_CODE (XVECEXP (body, 0, i)) != CLOBBER)
-             break;
+           {
+             rtx part = XVECEXP (body, 0, i);
+             if (GET_CODE (part) == SET)
+               {
+                 if (! reload_cse_noop_set_p (part, insn))
+                   break;
+                 if (REG_FUNCTION_VALUE_P (SET_DEST (part)))
+                   {
+                     if (value)
+                       break;
+                     value = SET_DEST (part);
+                   }
+               }
+             else if (GET_CODE (part) != CLOBBER)
+               break;
+           }
          if (i < 0)
            {
-             PUT_CODE (insn, NOTE);
-             NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
-             NOTE_SOURCE_FILE (insn) = 0;
+             if (value)
+               {
+                 pop_obstacks ();
+                 PATTERN (insn) = gen_rtx_USE (VOIDmode, value);
+                 INSN_CODE (insn) = -1;
+                 REG_NOTES (insn) = NULL_RTX;
+                 push_obstacks (&reload_obstack, &reload_obstack);
+               }
+             else
+               {
+                 PUT_CODE (insn, NOTE);
+                 NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+                 NOTE_SOURCE_FILE (insn) = 0;
+               }
              reload_cse_delete_death_notes (insn);
 
              /* We're done with this insn.  */