This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: Use .opt files for the m68k port
On Fri, Apr 15, 2005 at 02:34:31PM +0100, Richard Sandiford wrote:
> Gunther Nikl <gni@gecko.de> writes:
> > But I have question to the new option handling. In this message
> >
> > http://gcc.gnu.org/ml/gcc-patches/2004-06/msg02053.html
> >
> > you can find a proposal for a target option -mregparm for m68k. Its an
> > option *and* a switch. Is that still possible? Having it an option and
> > switch had problems with the option before the no- switch. since the
> > option was handled after the switch.
>
> Yes, this should work. You should also be able to avoid the problem
> you mention.
Yes, it looks like the problem is gone.
> First initialise m68k_regparm like this:
>
> int m68k_regparm = M68K_DEFAULT_REGPARM;
Seems I need some code in override_options to clear this variable because
later code checks for zero to decide whether arguments should be passed
through registers. If I want to keep it that way I added this code to
override_options:
if (!TARGET_REGPARM)
m68k_regparm = 0;
> then add two target option entries like this:
>
> mregparm
> Target Mask(REGPARM)
> Help string...
That was the easy one.
> mregparm=
> Target RejectNegative Joined UInteger
> Help string...
Thats the one I would have had problems with. Thank you!
> and then add something like this to handle_option:
>
> case OPT_mregparm_:
> target_flags |= MASK_REGPARM;
> if (value < 1 || value > M68K_MAX_REGPARM)
> error ("-mregparm=%d is not between 1 and %d",
> value, M68K_MAX_REGPARM);
> else
> m68k_regparm = value;
> return true;
>
> (All untested of course. ;)
Its almost correct (see above). Many, many thanks for your help!
I just had another look at the m68k change and I noticed that
TARGET_DEFAULT_TARGET_FLAGS contains MASK_STRICT_ALIGNMENT. I must
admit that I never noticed the strange old defintions for it. Do
I read that correctly that this is the old default value?
BTW, there seems to be a bug in handle_option/OPT_mshared_library_id_:
the error message passes arg but should pass value.
And I have further question: Is it possible to have an option (switch?)
that clears several other flags at once? And how is a subtarget supposed
to handle own options? With something like a SUBTARGET_OPTIONS call in
the target option handler?
Gunther