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


Richard Sandiford wrote:-

> The aim of this patch is to extend the front- and middle-end
> options-handling machinery so that it can be used for target
> options as well.  In other words, it lets you specify target
> options using target-specific .opt files.

Cool.

> Sometimes a TARGET_SWITCHES entry will set or clear more than one mask,
> but I haven't added any .opt flags for that.  I think the current set-up
> is mostly a result of the fact that, when using TARGET_SWITCHES, the
> back-end will only get to see the final state of target_flags.  With the
> new target hook (described below), the back-end will have a chance to
> set and clear flags (and do other stuff) as each option is processed.

This seems OK.

> The initial state of target_flags is currently set as follows:
> 
>     target_flags = 0;
>     set_target_switch ("");
> 
> 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?

> 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?

> 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?

Otherwise it looks good to me.

Neil.


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