This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: register variables vs asm?
- To: egcs at cygnus dot com
- Subject: Re: register variables vs asm?
- From: Richard Henderson <rth at cygnus dot com>
- Date: Thu, 9 Oct 1997 22:44:49 -0700
- References: <19971009120812.15403@dot.cygnus.com>
- Reply-To: Richard Henderson <rth at cygnus dot com>
On Thu, Oct 09, 1997 at 12:08:12PM -0700, Richard Henderson wrote:
> EGCS is not respecting the register assigned to the variable in the
> appended example on Alpha. Unlike the previous nonsense with longjmp,
> I should be able to expect this to work, yes?
The following patch fixes the problem.
I wonder if there is something similar with input operands, since
I don't see anything to prevent them from being substituted away,
but I can't put together something that triggers it either.
r~
Thu Oct 9 22:38:06 1997 Richard Henderson <rth@cygnus.com>
* combine.c (can_combine_p): Don't combine with an asm whose
output is a hard register.
Index: combine.c
===================================================================
RCS file: /cvs/cvsfiles/egcs/gcc/combine.c,v
retrieving revision 1.3
diff -u -p -d -r1.3 combine.c
--- combine.c 1997/09/22 17:41:11 1.3
+++ combine.c 1997/10/10 05:37:42
@@ -1003,6 +1003,13 @@ can_combine_p (insn, i3, pred, succ, pde
&& p != succ && volatile_refs_p (PATTERN (p)))
return 0;
+ /* If INSN is an asm and DEST is a hard register, reject, since it has
+ to be an explicit register variable and was chosen for a reason. */
+
+ if (GET_CODE (src) == ASM_OPERANDS
+ && GET_CODE (dest) == REG && REGNO (dest) < FIRST_PSEUDO_REGISTER)
+ return 0;
+
/* If there are any volatile insns between INSN and I3, reject, because
they might affect machine state. */