aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2003-02-22 03:17:24 +0000
committerHans-Peter Nilsson <hp@gcc.gnu.org>2003-02-22 03:17:24 +0000
commit5192890754c0137c9a0786630a8f68b60956bcc5 (patch)
tree563adae3927fc19a17b0f17e1a1866a4796c7b4e /gcc
parent9ac121af2a23ff86838f619ae58a6be7cf16d605 (diff)
downloadgcc-5192890754c0137c9a0786630a8f68b60956bcc5.zip
gcc-5192890754c0137c9a0786630a8f68b60956bcc5.tar.gz
gcc-5192890754c0137c9a0786630a8f68b60956bcc5.tar.bz2
regmove.c (optimize_reg_copy_1): Do not replace a hard register in an asm.
* regmove.c (optimize_reg_copy_1): Do not replace a hard register in an asm. From-SVN: r63270
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/regmove.c10
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 17655e6..22309ff 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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)
diff --git a/gcc/regmove.c b/gcc/regmove.c
index 3553a40..2639ebd 100644
--- a/gcc/regmove.c
+++ b/gcc/regmove.c
@@ -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))))