OSDN Git Service

PR opt/7409
authoruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 15 Oct 2002 14:38:10 +0000 (14:38 +0000)
committeruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 15 Oct 2002 14:38:10 +0000 (14:38 +0000)
* loop.c (loop_regs_scan): Mark registers used for function
argument passing as MAY_NOT_OPTIMIZE.

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

gcc/ChangeLog
gcc/loop.c

index d045018..85c9451 100644 (file)
@@ -1,3 +1,9 @@
+2002-10-15  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       PR opt/7409
+       * loop.c (loop_regs_scan): Mark registers used for function
+       argument passing as MAY_NOT_OPTIMIZE.
+
 Mon Oct 14 20:33:12 CEST 2002  Jan Hubicka  <jh@suse.cz>
 
        * i386.md (movv2di_internal): New pattern.
index d6b3a80..be4b12d 100644 (file)
@@ -9676,6 +9676,25 @@ loop_regs_scan (loop, extra_size)
 
       if (GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == JUMP_INSN)
        memset (last_set, 0, regs->num * sizeof (rtx));
+
+      /* Invalidate all registers used for function argument passing.
+        We check rtx_varies_p for the same reason as below, to allow
+        optimizing PIC calculations.  */
+      if (GET_CODE (insn) == CALL_INSN)
+       {
+         rtx link;
+         for (link = CALL_INSN_FUNCTION_USAGE (insn); 
+              link; 
+              link = XEXP (link, 1))
+           {
+             rtx op, reg;
+
+             if (GET_CODE (op = XEXP (link, 0)) == USE
+                 && GET_CODE (reg = XEXP (op, 0)) == REG
+                 && rtx_varies_p (reg, 1))
+               regs->array[REGNO (reg)].may_not_optimize = 1;
+           }
+       }
     }
 
   /* Invalidate all hard registers clobbered by calls.  With one exception: