* register variables vs asm? @ 1997-10-09 14:56 Richard Henderson 1997-10-10 8:51 ` Richard Henderson 0 siblings, 1 reply; 2+ messages in thread From: Richard Henderson @ 1997-10-09 14:56 UTC (permalink / raw) To: egcs 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? I'll look at the problem soon, as this also completely screws the kernel. r~ typedef struct _pthread_descr_struct * pthread_descr; struct _pthread_descr_struct { int p_cancelstate; int p_canceltype; int p_canceled; }; static inline pthread_descr thread_self (void) __attribute__ ((const)); static inline pthread_descr thread_self (void) { register pthread_descr __self __asm__("$0"); __asm__ ("call_pal %1 # %0" : "=r"(__self) : "i"(158 )); return __self; } int pthread_setcancelstate(int state, int * oldstate) { pthread_descr self = thread_self(); if (state < 0 || state > 5) return 22 ; if (oldstate != ((void *)0) ) *oldstate = self->p_cancelstate; self->p_cancelstate = state; if (self->p_canceled && self->p_cancelstate == 1 && self->p_canceltype == 2) pthread_exit(((void *) -1) ); return 0; } ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: register variables vs asm? 1997-10-09 14:56 register variables vs asm? Richard Henderson @ 1997-10-10 8:51 ` Richard Henderson 0 siblings, 0 replies; 2+ messages in thread From: Richard Henderson @ 1997-10-10 8:51 UTC (permalink / raw) To: egcs 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. */ ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1997-10-10 8:51 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1997-10-09 14:56 register variables vs asm? Richard Henderson 1997-10-10 8:51 ` Richard Henderson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).