]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
regmove.c (optimize_reg_copy_1): Do not replace a hard register in an asm.
authorHans-Peter Nilsson <hp@axis.com>
Sun, 23 Feb 2003 17:06:26 +0000 (17:06 +0000)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Sun, 23 Feb 2003 17:06:26 +0000 (17:06 +0000)
* regmove.c (optimize_reg_copy_1): Do not replace a hard register
in an asm.

From-SVN: r63326

gcc/ChangeLog
gcc/regmove.c

index c1476f4fd6b20c0743294269da7a68e23df7f6d4..ee3e03669cf602309eea3931faaa8513fed118a3 100644 (file)
@@ -1,3 +1,8 @@
+2003-02-23  Hans-Peter Nilsson  <hp@axis.com>
+
+       * regmove.c (optimize_reg_copy_1): Do not replace a hard register
+       in an asm.
+
 2003-02-22  Steven Bosscher  <s.bosscher@student.tudelft.nl>
 
        PR other/3782
index 048cfb60ba22f4c624f836e571b0e0fe0dbdd09f..df4ba089cad50b16ec5644e99f9b687bd4da3596 100644 (file)
@@ -431,6 +431,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))))