This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: pushing values to memory efficiently during rtl gen?
- To: "David S. Miller" <davem at dm dot cobaltmicro dot com>
- Subject: Re: pushing values to memory efficiently during rtl gen?
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Tue, 15 Sep 1998 17:24:00 -0600
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
In message <199809150147.SAA05688@dm.cobaltmicro.com>you write:
> One neat trick which has been pointed out to me, and looks promising,
> is to wrap the REGs in an ADDRESSOF. As I look it seems that I have
> to tack on the tree code for the value into there for this to work
> correctly. Or can I forego the tree code and just stick NULL there?
Interesting idea. I don't know if you can forgo the tree stuff, if
not there's some code which will take simple hunks of RTL and build
a minimal tree node for it. make_tree or something like that.
> Else, are there other ways? I suppose I could allocate stack
> temporaries each time, but that seems like it wouldn't result in very
> good code generation in the end. For example, if I did it this way
> would the compiler later be able to optimize it all away, as in:
>
> void foo(long double *a, long double *b, long double *c)
> {
> *a = *b + *c;
> }
Err, do you want to pass a pointer to the long double to the libcall
or do you need to pass the long double itself in memory?
If you need to pass the pointer then I would think either scheme would
work reasonably well. My gut tells me the ADDRESSOF scheme is a bit
of a kludge, given equal performance, I'd go with th expanders forcing
stuff into the stack if they aren't presented with a pointer to begin
with.
Also note if you use ADDRESSOF you can't call the expanders after
cse1 -- the expanders must call FAIL in that case, which may disable
some optimizations.
jeff