From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernd Schmidt To: egcs@cygnus.com Subject: Re: Reload patch to improve 386 code Date: Tue, 19 Aug 1997 08:08:21 -0000 Message-ID: <199708190621.IAA04731@haegar.physiol.med.tu-muenchen.de> In-reply-to: 199708181517.LAA23280@tweedledumb.cygnus.com X-SW-Source: 1997-08/0138.html Message-ID: <19970819080821.AuRKay0Wf9ttwEfLjxCPC1ws9H_pELzzq6Fv7FMeWfo@z> > My comment on reload is meant for more > reload as we currently know it. I think it is an horrible kludge that reload > is run as a pass after global-alloc, and that it forces reload registers not to > be used for any other purpose (which is murder on the x86 with each register > being special purpose in some way). That problem can be solved; actually it is mostly solved in my patch. > I think it should be integrated into global-alloc, taking lifetimes, ranges, > etc. into consideration, possibly leaving the fossil reload for when you are > not optimizing. Given that reload has pretty much been the place where we all > fear to tread, at least since RMS handed over the gcc2 reigns to Kenner (and > even in the 1.3x time frame, I got the sense that RMS no longer had a good > handle on reload anymore), I think it is time for a rethought. Now, given > it is a rather critical piece of the compiler, it may take months if not > years to get it better than it currently is. I have some ideas for changing reload that could go on top of what I have. I'll describe what I'm planning to do, if you have any additional ideas I'd be happy to hear about them. First, I'd like to eliminate the code that counts the needs for registers globally. The patch I sent is a first step in that direction; it could probably easily be extended to spill registers locally for every instruction. This would require a slightly different way of calculating the possible damage from spilling a register, but I think it would not be hard to do. It would be nice to have code that detects that an insn needs a spill reg in a one-register class (like ecx for variable shifts on the 386), but a different register is free. In that case, reload should move ecx to the free register before the instruction, and back afterwards, if this is profitable. I'm not sure how hard that would be, and I haven't experimented with that kind of thing yet. Then, there are some simplifications that could be done. I don't like the inheritance code, find_equiv_reg and all that. IMHO reload shouldn't try to be very clever about this sort of thing - the reload_cse_regs pass can be made more clever. I've already submitted a patch to Kenner that enables reload_cse_regs to generate optional reloads. If we could add some more cleverness (e.g. deleting redundant stores into spill slots or eliminating register-register copies), quite a bit of code in reload could be deleted. I've already made some experiments in this direction which indicate that this approach may be feasible. Another way of simplifying reload would be to try to generate auto-inc addressing after reload has run, not before. That would eliminate some more special-case code (and it might make other parts of the compiler simpler as well). Bernd