pushing values to memory efficiently during rtl gen?

Jeffrey A Law law@cygnus.com
Tue Sep 15 22:51:00 GMT 1998

  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

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.


More information about the Gcc mailing list