pushing values to memory efficiently during rtl gen?

Ken Raeburn raeburn@cygnus.com
Tue Sep 15 14:14:00 GMT 1998


>       void foo(long double *a, long double *b, long double *c)
>       {
> 	*a = *b + *c;
>       }
> 
> Ideally I'd like this to result in directly passing foo's pointer
> parameters into the _Qp_add() libcall.

What about aliasing issues -- if it's called as

	foo (&accum, &accum, &x)

?  Can some bits of the output be written before some bits of the
input are read (for the last time)?  Is it safe not to use a temporary
for the output?  The definition of foo clearly requires it to behave
as if there is a temporary; your description of _Qp_add doesn't
indicate how it behaves.

>	  I am fairly certain the
> ADDRESSOF mechanism would get this optimization, but for the normal
> stack temporary scheme I am not so sure.

Almost certainly not, I think.  Even if the compiler were that clever,
I think it'd have to keep temporaries (at least for output) in case
the library routine did clobber the output space early on unless you
could tell it a lot about how the library routine worked.



More information about the Gcc mailing list