This is the mail archive of the
mailing list for the GCC project.
RegRegname vs. Explicit Local Register Variables ...
- From: Craig Newell <craign at ieee dot org>
- To: gcc at gcc dot gnu dot org, <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 23 May 2002 22:05:47 -0400 (EDT)
- Subject: RegRegname vs. Explicit Local Register Variables ...
I am using explicit register variables to place arguments and return
values in the correct registers for system calls. eg.
static inline int
register unsigned int arg0 __asm__ ("r0");
register unsigned int rc __asm__ ("r0");
arg0 = (unsigned int)sem;
__asm__ __volatile__ (
: "=r" (rc) : "0" (arg0)
: "r1", "r2", "r3, "r12", "lr", "memory"
The problem here is that regrename.c does not know that it is not good
to move "arg0" from the specified "r0" and sometimes ends up doing so.
I see a few solutions and would like to know what is seen as the best
solution to implement:
1. Prevent regrename from renaming arguments to asm blocks just like
it knows not to rename arguments to calls. This could be all
arguments or just ones with a new constraint.
2. Somehow be able to mark the asm block as a "call" and hence have
the current regrename exception for calls handle this. Other
optimisation passes might also like to know that this asm block is
effectively a "call".
3. Give up and increase the already large overhead of the syscall with
extra "mov" instructions that in a lot of cases are not needed.
I think that 2. might be the best for this exact case if other passes
can easily use the call knowledge but 1. would be the most flexable when
used with the addition of a constraint.
Any ideas before I waste too much time figuring out more about the
internals of GCC than I really need to know?
Craig Newell email: CraigN@ieee.org
Free Spirit icbm: N 42°38'47" W 71°18'19"