This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using .opt files for target options


Neil Booth <neil@daikokuya.co.uk> writes:
>> with the "cute" idiom that the "" entry in TARGET_SWITCHES specifies
>> the default flags.  Since the idea of this patch is to allow us to
>> move away from TARGET_SWITCHES, we need a new way of initialising
>> target_flags, so the patch adds a new targetm.default_target_flags
>> variable.  The variable's default setting is 0 and the code above
>> then becomes:
>> 
>>     target_flags = targetm.default_target_flags;
>>     set_target_switch ("");
>
> Why is the hack with "" still necessary?

The idea is that the new machinery will work alongside TARGET_SWITCHES
and TARGET_OPTIONS for the time being.  We can remove things like the
"" hack if (when?) we remove support for TARGET_SWITCHES and
TARGET_OPTIONS.

The alternative would be to remove all "" entries from TARGET_SWITCHES
on-masse, but I'd much rather move each port individually.

>> At the moment, the options parser looks for and removes "no-" prefixes
>> before looking up an option in the database.  The patch makes it look
>> up the original option first and only try removing "no-" if that first
>> look-up fails.
>
> I don't see why you needed to change this.  I believe the existing
> code only does this for -f and -W flags, so -m should be unaffected.
> Can you explain?

I forgot to mention this in the covering note, but the patch extends the
same behaviour to -m.  Most -m flags have the same kind of negatives as
the -f flags; certainly most of the MIPS ones do.

The point I was trying to make was that the automatic negative of
"-mips16" would be "-mno-ips16", not "-mno-mips16", so we need the
flexibility to list unusually-spelt "-mno-" options separately.
Normal -f, -m and -W negatives will still work OK.

FWIW, I don't think the overhead of two look-ups is going to be
significant.  It also doesn't need much extra code (+3 lines, -1 line).

>> Picking up the option files
>> ===========================
>> 
>> Targets can add new option files by listing them in the config.gcc
>> "extra_options" variable.  Any config/FOO/FOO.opt file will be picked
>> up automatically, but other OS-specific files could be added as well
>> (e.g. for cygwin and darwin).
>
> Is there a good reason you don't simply enforce it being called
> target.opt?  Wouldn't that be simpler?

The idea is that you'd put options that apply to all i386 targets
in i386.opt and those that apply only to cygwin (such as -mcygwin)
in cygwin.opt.

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]