Get the modes right when setting reg_values for a reg to reg copy
authorIan Lance Taylor <ian@gcc.gnu.org>
Sun, 13 Apr 1997 22:45:30 +0000 (22:45 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Sun, 13 Apr 1997 22:45:30 +0000 (22:45 +0000)
From-SVN: r13896

gcc/reload1.c

index 119e51a..702ebd8 100644 (file)
@@ -8215,7 +8215,29 @@ reload_cse_record_set (set, body)
       /* This is an assignment to a register.  Update the value we
          have stored for the register.  */
       if (sreg >= 0)
-       reg_values[dreg] = reg_values[sreg];
+       {
+         rtx x;
+
+         /* This is a copy from one register to another.  Any values
+            which were valid for SREG are now valid for DREG.  If the
+            mode changes, we use gen_lowpart_common to extract only
+            the part of the value that is copied.  */
+         reg_values[dreg] = 0;
+         for (x = reg_values[sreg]; x; x = XEXP (x, 1))
+           {
+             rtx tmp;
+
+             if (XEXP (x, 0) == 0)
+               continue;
+             if (dest_mode == GET_MODE (XEXP (x, 0)))
+               tmp = XEXP (x, 0);
+             else
+               tmp = gen_lowpart_common (dest_mode, XEXP (x, 0));
+             if (tmp)
+               reg_values[dreg] = gen_rtx (EXPR_LIST, dest_mode, tmp,
+                                           reg_values[dreg]);
+           }         
+       }
       else
        reg_values[dreg] = gen_rtx (EXPR_LIST, dest_mode, src, NULL_RTX);