This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: SMALL_REGISTER_CLASSES
- To: Mike Stump <mrs at wrs dot com>
- Subject: Re: SMALL_REGISTER_CLASSES
- From: Jan Hubicka <hubicka at atrey dot karlin dot mff dot cuni dot cz>
- Date: Sun, 29 Nov 1998 16:23:44 +0100
- Cc: law at cygnus dot com, m dot hayes at elec dot canterbury dot ac dot nz, egcs at cygnus dot com
- References: <199811251608.IAA28589@kankakee.wrs.com>
> > Date: Mon, 23 Nov 1998 22:58:32 -0700
> > From: Jeffrey A Law <law@cygnus.com>
>
> > > With Bernd's changes to reload, is SMALL_REGISTER_CLASSES required,
> >
> > I suspect it is no longer required.
>
> > In fact, one of my todos is to remove the SMALL_REGISTER_CLASSES
> > define for the mn102 and mn103 ports and see what happens :-)
>
> Since x86 defines it, and since we have a bizzilion people with x86,
> would it make sense for people to try it out on x86 and inspect code
> differences and do performace reviews on the various code they have?!
Well, I am not expert, but I don't think it will work. I believe that insns
explicitly using eax register (divmod patterns) will cause lots of troubles.
I am getting them even with SMALL_REGISTER_CLASSES enabled (and with my patch).
Compiler quite often crases in cases where function is called, division
is done later, haifa is enabled and my scheduling patch is active.
Insns from code are approx folowing:
call_function
mov eax, register_for_returned_value
divmod (use eax)
in case this is done in one basic block (function must have const attribute I believe)
haifa moves divmod between call and mov and that makes reload crashing (it can't spill
eax register, because it is explicitly used).
This sounds to me like haifa is not SMALL_REGISTER_CLASSES conforming.
Haifa don't seems to contain any code to handle SMALL_REGISTER_CLASSES correctly.
Similar problems will be much more common if you undefine it, so I believe compiler
will not bootstrap.
One of solution should be to change all patterns using registers explicitly
to expands in call style (so do something like that:)
(set (reg eax) (operand))
(div (reg eax) (operand2))
this should prevent compiler from mixing such insns. I don't know how bad effects
it should have to generated code, but I believe that alpha is using
it happily for its div patterns.
But this IMO just moves problem to cases where insn accepts one of the two registers
and both registers are explicitly used. Similar case should happend for all registers
too.
Other solution that comes into mind is to let reload spill explicitly used registers,
but it should break some gcc design invariant and result in suboptimal code
(moving returned value to other register, then back to eax and then to right register)
Last solution I was thinking about is to prohibit using hard registers in i386.md at all.
But this seems to be quite hard to implement, because gcc expect functions to be returing
values in hard registers....
Honza
--
OK. Lets make a signature file.
+-------------------------------------------------------------------------+
| Jan Hubicka (Jan Hubi\v{c}ka in TeX) hubicka@freesoft.cz |
| Czech free software foundation: http://www.freesoft.cz |
|AA project - the new way for computer graphics - http://www.ta.jcu.cz/aa |
| homepage: http://www.paru.cas.cz/~hubicka/, games koules, Xonix, fast |
| fractal zoomer XaoS, index of Czech GNU/Linux/UN*X documentation etc. |
+-------------------------------------------------------------------------+