diff options
Diffstat (limited to 'gcc/opth-gen.awk')
-rw-r--r-- | gcc/opth-gen.awk | 96 |
1 files changed, 93 insertions, 3 deletions
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index 6cea944bc49..6cec61797c1 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -48,7 +48,8 @@ BEGIN { # Dump out an enumeration into a .h file. # Combine the flags of duplicate options. END { -print "/* This file is auto-generated by opts.sh. */" +# APPLE LOCAL optimization pragmas 3124235/3420242 +print "/* This file is auto-generated by opth-gen.awk. */" print "" print "#ifndef OPTIONS_H" print "#define OPTIONS_H" @@ -61,11 +62,100 @@ for (i = 0; i < n_opts; i++) { print "/* Set by -" opts[i] "." print " " help[i] " */" - print "extern int " name ";" +# APPLE LOCAL begin optimization pragmas 3124235/3420242 + if (!flag_set_p("PerFunc", flags[i])) { + print "extern int " name ";" + } else { + if (flag_set_p("VarExists")) + continue; + print "#define " name " (cl_pf_opts.fld_" name ")" + } print "" - } +print "/* Nonzero means do optimizations. -O." +print " Particular numeric values stand for particular amounts of optimization;" +print " thus, -O2 stores 2 here. However, the optimizations beyond the basic" +print " ones are not controlled directly by this variable. Instead, they are" +print " controlled by individual `flag_...' variables that are defaulted" +print " based on this variable. */" + +print "#define optimize (cl_pf_opts.fld_optimize)" + +print "" +print "/* Nonzero means optimize for size. -Os." +print " The only valid values are zero and nonzero. When optimize_size is" +print " nonzero, optimize defaults to 2, but certain individual code" +print " bloating optimizations are disabled. */" + +print "#define optimize_size (cl_pf_opts.fld_optimize_size)" +print "" + +print "/* Flags which may be changed per function. */" +count = 0 +print "struct cl_perfunc_opts {" + +for (i = 0; i < n_opts; i++) { + name = var_name(flags[i]); + if (name == "") + continue; + if (flag_set_p("VarExists", flags[i])) + continue; + if (!flag_set_p("PerFunc", flags[i])) + continue; + if (!flag_set_p("VarUint", flags[i])) + { + print " unsigned int fld_" name ":1;" + count++ + } +} + +print " unsigned int fld_optimize_size:1;" +count++ + +# Explicit padding so there are no holes, which might be +# handled strangely by the hashing and comparison functions. +# FIXME: A full word of padding is used in the case where we're +# already at a word boundary; this is currently irrelevant. + +print " unsigned int padding: (HOST_BITS_PER_INT-("count"-(" count "/HOST_BITS_PER_INT)*HOST_BITS_PER_INT));" + +for (i = 0; i < n_opts; i++) { + name = var_name(flags[i]); + if (name == "") + continue; + if (flag_set_p("VarExists", flags[i])) + continue; + if (!flag_set_p("PerFunc", flags[i])) + continue; + if (flag_set_p("VarUint", flags[i])) + print " int fld_" name ";" +} + +print " int fld_optimize;" +print "};" +print "" +print "/* cl_pf_opts changes dynamically as pragmas are handled. */" +print "extern struct cl_perfunc_opts cl_pf_opts;" +print "/* " quote "raw" quote " options are before command line parsing. */" +print "extern struct cl_perfunc_opts cl_pf_opts_raw;" +print "/* " quote "cooked" quote " options are after command line parsing. */" +print "extern struct cl_perfunc_opts cl_pf_opts_cooked;" + +for (i = 0; i < n_opts; i++) { + name = var_name(flags[i]); + if (name == "") + continue; + if (flag_set_p("VarExists", flags[i])) + continue; + if (!flag_set_p("PerFunc", flags[i])) + continue; + if (!flag_set_p("VarUint", flags[i])) + print "extern int cl_opt_access_func_" name " (int, unsigned int);" +} + +print "extern int cl_opt_access_func_optimize_size (int, unsigned int);" +# APPLE LOCAL end optimization pragmas 3124235/3420242 for (i = 0; i < n_langs; i++) { macros[i] = "CL_" langs[i] |