function.c (purge_addressof_1): For ADDRESSOF...
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Fri, 18 Apr 2003 22:39:23 +0000 (22:39 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Fri, 18 Apr 2003 22:39:23 +0000 (18:39 -0400)
* function.c (purge_addressof_1): For ADDRESSOF, see if SUB is a
hard or virtual register and copy into pseudo if replacement fails.

From-SVN: r65798

gcc/ChangeLog
gcc/function.c

index 894ea5658f00a6e9b44e929b870d6603408e9056..a4681a711150769dd24867d882d758f2860cfb14 100644 (file)
@@ -1,6 +1,9 @@
 2003-04-18  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
-       * cfgcleanup.c (flow_find_cross_jump): Use INSN_P,not active_insn_p.
+       * function.c (purge_addressof_1): For ADDRESSOF, see if SUB is a
+       hard or virtual register and copy into pseudo if replacement fails.
+
+       * cfgcleanup.c (flow_find_cross_jump): Use INSN_P, not active_insn_p.
 
        * expmed.c (mask_rtx): Avoid undefined shifts for BITSIZE of 0.
 
index 699fd21e6d477399081ff3dfe97af5a06cd422f8..b75a07e15a6f8c4453a5ad366c06c4c6edd73a7b 100644 (file)
@@ -3052,7 +3052,15 @@ purge_addressof_1 (loc, insn, force, store, may_postpone, ht)
        return true;
 
       start_sequence ();
-      sub = force_operand (sub, NULL_RTX);
+
+      /* If SUB is a or virtual register, try it as a pseudo-register. 
+        Otherwise, perhaps SUB is an expression, so generate code to compute
+        it.  */
+      if (GET_CODE (sub) == REG && REGNO (sub) <= LAST_VIRTUAL_REGISTER)
+       sub = copy_to_reg (sub);
+      else
+       sub = force_operand (sub, NULL_RTX);
+
       if (! validate_change (insn, loc, sub, 0)
          && ! validate_replace_rtx (x, sub, insn))
        abort ();