regmove.c (optimize_reg_copy_1): Do not replace a hard register in an asm.
authorHans-Peter Nilsson <hp@axis.com>
Sat, 22 Feb 2003 03:17:24 +0000 (03:17 +0000)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Sat, 22 Feb 2003 03:17:24 +0000 (03:17 +0000)
* regmove.c (optimize_reg_copy_1): Do not replace a hard register
in an asm.

From-SVN: r63270

gcc/ChangeLog
gcc/regmove.c

index 17655e6afa3d1b6eaaf96bd0a72f3ece45066540..22309ff35f0210fd81aa6ff181ec6d422d720003 100644 (file)
@@ -1,3 +1,8 @@
+2003-02-22  Hans-Peter Nilsson  <hp@axis.com>
+
+       * regmove.c (optimize_reg_copy_1): Do not replace a hard register
+       in an asm.
+
 2003-02-21  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * Makefile.in (ggc-common.o): Depend on $(PARAMS_H)
index 3553a40bc3a418cb7c302742b2c0441162fd42c7..2639ebd54f418003265eafb50b80abe5e45f67de 100644 (file)
@@ -433,6 +433,16 @@ optimize_reg_copy_1 (insn, dest, src)
        continue;
 
       if (reg_set_p (src, p) || reg_set_p (dest, p)
+         /* If SRC is an asm-declared register, it must not be replaced
+            in any asm.  Unfortunately, the REG_EXPR tree for the asm
+            variable may be absent in the SRC rtx, so we can't check the
+            actual register declaration easily (the asm operand will have
+            it, though).  To avoid complicating the test for a rare case,
+            we just don't perform register replacement for a hard reg
+            mentioned in an asm.  */
+         || (sregno < FIRST_PSEUDO_REGISTER
+             && asm_noperands (PATTERN (p)) >= 0
+             && reg_overlap_mentioned_p (src, PATTERN (p)))
          /* Don't change a USE of a register.  */
          || (GET_CODE (PATTERN (p)) == USE
              && reg_overlap_mentioned_p (src, XEXP (PATTERN (p), 0))))