diff options
Diffstat (limited to 'gcc/opth-gen.awk')
-rw-r--r-- | gcc/opth-gen.awk | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index b5a4c57..92c0e7e 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -75,24 +75,43 @@ for (i = 0; i < n_opts; i++) { } -masknum = 0 for (i = 0; i < n_opts; i++) { name = opt_args("Mask", flags[i]) + vname = var_name(flags[i]) + mask = "MASK_" + if (vname != "") { + mask = "OPTION_MASK_" + } if (name != "" && !flag_set_p("MaskExists", flags[i])) - print "#define MASK_" name " (1 << " masknum++ ")" + print "#define " mask name " (1 << " masknum[vname]++ ")" } for (i = 0; i < n_extra_masks; i++) { - print "#define MASK_" extra_masks[i] " (1 << " masknum++ ")" + print "#define MASK_" extra_masks[i] " (1 << " masknum[""]++ ")" +} + +for (var in masknum) { + if (masknum[var] > 31) { + if (var == "") + print "#error too many target masks" + else + print "#error too many masks for " var + } } -if (masknum > 31) - print "#error too many target masks" print "" for (i = 0; i < n_opts; i++) { name = opt_args("Mask", flags[i]) + vname = var_name(flags[i]) + macro = "OPTION_" + mask = "OPTION_MASK_" + if (vname == "") { + vname = "target_flags" + macro = "TARGET_" + mask = "MASK_" + } if (name != "" && !flag_set_p("MaskExists", flags[i])) - print "#define TARGET_" name \ - " ((target_flags & MASK_" name ") != 0)" + print "#define " macro name \ + " ((" vname " & " mask name ") != 0)" } for (i = 0; i < n_extra_masks; i++) { print "#define TARGET_" extra_masks[i] \ |