2012/9/30 Georg-Johann Lay <a...@gjlay.de>: >> Denis Chertykov wrote: >> I have tried to use secondary a few years ago (may be 5 or 7). >> I have definitely remember only one thing: secondary reload should be >> avoided as long as possible. > > > Currently each mov has to be decorated with moving the segment to RAMPZ and > (depending on target) restoring RAMPZ afterwards. > > GCC has no concept of a segmented layout and there is no way to describe > that. > > One way is to hack with UNSPEC and bypass ira/reload altogether but IMO that > is no good solution. Besides that is only works because the mov insns have > special constraints (there will be writes to flash, flash does not change > after load time, etc.) > > >> The better way to got a knowledge about it is a GDB ;-) > > > I think reload.c:push_secondary_reload() should be the right place but it > does not call targetm.secondary_reload so that no secondary is generated. > > It's hard to tell where the place is that is responsible for the bypassing > of calling the hook. > > >>> From the internals I don't see why it is skipped and the responsiveness >>> in >>> the gcc-help@ list on such topics is zero :-( >> >> >> IMHO it's a question to gcc@ not to gcc-help@ > > > Ok, I will try my luck again. > > Do you have an idea for a better approach, i.e. not set RAMPZ over and over > again?
May be it's a question similar to "addressing with infinite displacement" optimization that we discuss in long long thread - "[Patch, AVR]: Fix PR46779" Generally, the answer is here: http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01281.html and here: > The biggest problem that I see, from the 950612-1.c test case > with the current handling of the "infinite displacement frame > pointer", is that the adjustments to the frame pointer are > never exposed as separate instructions, so there's never a > chance to optimize them. You can set RAMPZ over and over but you can give GCC a chance to optimize it out in cse or cse-postreload passes. Denis. PS: as you know "GCC has no concept of a segmented layout" may be better just drop it.