This is the mail archive of the gcc@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]

proposal: extend TARGET_OPTIONS structure



Given that multiple targets are now running short of mask bits in
TARGET_SWITCHES, I propose we extend the TARGET_OPTIONS structure to
allow it to be used as a replacement.

Currently, TARGET_OPTIONS takes a switch prefix, and sets the given
variable to the remainder of the switch.  For example, "-mcpu=" would
match "-mcpu=foo" and set the variable to "foo".

I propose we add a new field, defaulting to zero to minimize changes
to existing backends, which contains the "remainder" part.  If this
field is zero, the option acts as before.  If nonzero, the prefix must
match the option *exactly* (like TARGET_SWITCHES), and when it does,
the variable is set to the string in the new field.  This also allows
mixing "-mfoo" (new way) with "-mfoo=" (old way) (example:
-malign-loops defaults to 8, but you can -malign-loops=4).

Example:

extern char *foo_feature_switch;
#define TARGET_FEATURE	foo_feature_switch[0]

#define TARGET_OPTIONS						\
{ { "feature",		&foo_feature_switch,			\
    N_("Enable FOO feature"), "1"},				\
  { "no-feature",	&foo_feature_switch,			\
    N_("Disable FOO feature"), ""},				\



/* The only possible values are "" (-mno-feature, default) or "1"
   (-mfeature).  */
char *foo_feature_switch = "";


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