From patchwork Fri Oct 8 22:20:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 67304 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id E2E0AB6EEC for ; Sat, 9 Oct 2010 09:21:21 +1100 (EST) Received: (qmail 2905 invoked by alias); 8 Oct 2010 22:21:18 -0000 Received: (qmail 2867 invoked by uid 22791); 8 Oct 2010 22:21:08 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL, BAYES_00, NO_DNS_FOR_FROM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e38.co.us.ibm.com (HELO e38.co.us.ibm.com) (32.97.110.159) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Oct 2010 22:20:58 +0000 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e38.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o98MD4Eb027396; Fri, 8 Oct 2010 16:13:04 -0600 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id o98MKtq7250238; Fri, 8 Oct 2010 16:20:55 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o98MKtNP026223; Fri, 8 Oct 2010 16:20:55 -0600 Received: from hungry-tiger.westford.ibm.com (dyn9033037152.westford.ibm.com [9.33.37.152]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o98MKsmn026207; Fri, 8 Oct 2010 16:20:54 -0600 Received: by hungry-tiger.westford.ibm.com (Postfix, from userid 500) id 6683AF81F1; Fri, 8 Oct 2010 18:20:53 -0400 (EDT) Date: Fri, 8 Oct 2010 18:20:52 -0400 From: Michael Meissner To: "Joseph S. Myers" , Michael Meissner , gcc-patches@gcc.gnu.org, dje.gcc@gmail.com Subject: Re: [PATCH] RFC, start to add attribute target support to powerpc Message-ID: <20101008222052.GA368@hungry-tiger.westford.ibm.com> Mail-Followup-To: Michael Meissner , "Joseph S. Myers" , Michael Meissner , gcc-patches@gcc.gnu.org, dje.gcc@gmail.com References: <20101007171830.GA4572@hungry-tiger.westford.ibm.com> <20101007202554.GA12835@hungry-tiger.westford.ibm.com> <20101007213542.GA15401@hungry-tiger.westford.ibm.com> <20101008002011.GA24300@hungry-tiger.westford.ibm.com> <20101008003412.GA24758@hungry-tiger.westford.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20101008003412.GA24758@hungry-tiger.westford.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Here is a rewritten patch that pushes the target variables to the opt files. In the opt files, I added 3 new directives: TargetVariable ============== Declare target variables that are in the global options, and also automatically saved and restored by the cl_option_target* functions. Unlike yesterday's patch, this one handles enums normally, without converting them to int. HeaderInclude ============= Add include files that must be included by options.h This is where the enum definitions are pushed too. SourceInclude ============= I don't need this particular one, but I added it for symmetry with HeaderInclude, in case there are #ifdef's or builtin functions needed by the options.c code. I updated configure and configure.ac so that it automatically adds the include files specified by the HeaderInclude and SourceInclude options. I moved most of the rs6000.c variables into the rs6000.opt definition, except for things that will be recalculated instead of saved/restored. So far, I haven't moved any pointers into the structure. I moved the enum's to the new file rs6000-opts.h. I did have to rename the cmodel variable, as using a define for the name plays havoc with using the same name as a structure tag or a structure member. This patch is a lot less invasive as the previous patch. It touches fewer files, and is about 1/2 the size in terms of bytes. I just did a full bootstrap run on ppc64, and it worked fine. 2010-10-08 Michael Meissner * doc/options.texi (Option file format): Document TargetVariable, HeaderInclude, and SourceInclude. * optc-gen.awk: Add support for TargetVariable, HeaderInclude, and SourceInclude. Add GTY(()) on main option structure for the compiler proper, but not in the driver file. * opth-gen.awk: Ditto. * configure.ac: Figure out the additional include files specified by the HeaderInclude and SourceInclude options directives. * configure: Regenerate. * Makefile.in (OPTIONS_H_EXTRA): New make variable for HeaderInclude. (OPTIONS_C_EXTRA): New make variable for SourceInclude. (@options_include@): Add the include files if any specified by the various .opt files. (OPTIONS_H): New make variable for options.h and any files it includes. (TREE_H): Use $(OPTIONS_H) instead of options.h. (FLAGS_H): Ditto. (c-family/c-opts.o): Ditto. (lto-opts.o): Ditto. (opts.o): Ditto. (opts-common.o): Ditto. (options.o): Add $(OPTIONS_C_EXTRA) to the dependencies. (gcc-options.o): Ditto. * opt-include.awk: New awk script to output the include files specified by option HeaderInclude and SourceInclude options. * config/rs6000/rs6000.opt (HeaderInclude): Include rs6000-opts.h. (rs6000_cpu): Move definition here as a TargetVariable, from rs6000.c. (rs6000_always_hint): Ditto. (rs6000_sched_groups): Ditto. (rs6000_align_branch_targets): Ditto. (rs6000_sched_costly_dep): Ditto. (rs6000_sched_insert_nops): Ditto. (rs6000_long_double_type_size): Ditto. (rs6000_ieeequad): Ditto. (rs6000_spe): Ditto. (rs6000_spe_abi): Ditto. (rs6000_float_gprs): Ditto. (rs6000_darwin64_abi): Ditto. (rs6000_sdata): Ditto. (rs6000_tls_size): Ditto. (rs6000_current_abi): Ditto. (rs6000_tracebback): Ditto. (rs6000_alignment_flags): Ditto. (rs6000_recip_control): Ditto. (rs6000_current_cmode): Rename from cmodel. Move definition here as a TargetVariable, from rs6000.c. (rs6000_debug): Combine separate debug flags to a single variable. * config/rs6000/linux64.h (cmodel): Delete. (TARGET_CMODE): Change cmodel to rs6000_current_cmodel. (SUBSUBTARGET_OVERRIDE_OPTIONS): Ditto. * config/rs6000/rs6000.c (rs6000_cpu): Move definition to rs6000.opt as TargetVariables. (rs6000_always_hint): Ditto. (rs6000_sched_groups): Ditto. (rs6000_align_branch_targets): Ditto. (rs6000_sched_costly_dep): Ditto. (rs6000_sched_insert_nops): Ditto. (rs6000_long_double_type_size): Ditto. (rs6000_ieeequad): Ditto. (rs6000_spe): Ditto. (rs6000_spe_abi): Ditto. (rs6000_float_gprs): Ditto. (rs6000_darwin64_abi): Ditto. (rs6000_sdata): Ditto. (rs6000_tls_size): Ditto. (rs6000_current_abi): Ditto. (rs6000_tracebback): Ditto. (rs6000_alignment_flags): Ditto. (rs6000_recip_control): Ditto. (rs6000_current_cmode): Rename from cmodel. Move to rs6000.opt. (rs6000_sched_insert_nops_str): Make static. (rs6000_sched_costly_dep_str): Ditto. (rs6000_tls_size_string): Ditto. (rs6000_debug_name): Ditto. (rs6000_traceback_name): Ditto. (rs6000_recip_name): Ditto. (rs6000_debug_stack): Delete, combine debug flags into a single variable. Allow -mdebug=foo,bar. (rs6000_debug_arg): Ditto. (rs6000_debug_reg): Ditto. (rs6000_debug_addr): Ditto. (rs6000_debug_cost): Ditto. (rs6000_option_override_internal): Ditto. (traceback enum): Move to rs6000-opts.h. (rs6000_handle_option): Rename cmodel to rs6000_current_cmodel. * gcc/config/rs6000/rs6000.h (toplevel): Include rs6000-opts.h if it hasn't already been included. (enum rs6000_cmodel): Move enumerations to rs6000-opts.h so they can be used by target variables. (enum processor_type): Ditto. (enum fpu_type_t): Ditto. (enum rs6000_dependence_cost): Ditto. (enum rs6000_nop_insertion): Ditto. (enum group_formation): Ditto. (enum rs6000_vector): Ditto. (enum rs6000_abi): Ditto. (TARGET_DEBUG_*): Use a single rs6000_debug variable instead of having a separate variable for each debug flag. (rs6000_cpu): Delete variable definitons that are now defined as TargetVariables in rs6000.opt. (rs6000_long_double_type_size): Ditto. (rs6000_ieeequad): Ditto. (rs6000_altivec_abi): Ditto. (rs6000_spe_abi): Ditto. (rs6000_spe): Ditto. (rs6000_float_gprs): Ditto. (rs6000_alignment_flags): Ditto. (rs6000_current_abi): Ditto. (rs6000_sched_insert_nop_str): Delete. * gcc/config/rs6000/rs6000-opts.h: New file. Move all enums here from rs6000.h and sysv4.h to allow target variables to be declared as enums. * gcc/config/rs6000/sysv4.h (enum rs6000_sdata_type): Move to rs6000-opts.h. (rs6000_sdata): Delete, this is now a TargetVariable. (rs6000_tls_size_string): Ditto. (rs6000_abi_name): Delete. (rs6000_sdata_name): Ditto. Index: gcc/configure =================================================================== --- gcc/configure (revision 165188) +++ gcc/configure (working copy) @@ -853,7 +853,8 @@ PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' -ac_subst_files='language_hooks' +ac_subst_files='option_includes +language_hooks' ac_user_opts=' enable_option_checking with_build_libsubdir @@ -10498,8 +10499,10 @@ fi # Convert extra_options into a form suitable for Makefile use. extra_opt_files= +all_opt_files= for f in $extra_options; do extra_opt_files="$extra_opt_files \$(srcdir)/config/$f" + all_opt_files="$all_opt_files $srcdir/config/$f" done @@ -17133,7 +17136,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17136 "configure" +#line 17139 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17239,7 +17242,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17242 "configure" +#line 17245 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -25475,6 +25478,7 @@ do all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$gcc_subdir/Make-lang.in" if test -f $srcdir/$gcc_subdir/lang.opt; then lang_opt_files="$lang_opt_files $srcdir/$gcc_subdir/lang.opt" + all_opt_files="$all_opt_files $srcdir/$gcc_subdir/lang.opt" fi if test -f $srcdir/$gcc_subdir/$subdir-tree.def; then lang_tree_files="$lang_tree_files $srcdir/$gcc_subdir/$subdir-tree.def" @@ -25538,6 +25542,14 @@ do done # -------- +# Option include files +# -------- + +${AWK} -f $srcdir/opt-include.awk $all_opt_files > option-includes.mk +option_includes="option-includes.mk" + + +# -------- # UNSORTED # -------- @@ -27206,3 +27218,4 @@ if test -n "$ac_unrecognized_opts" && te $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + Index: gcc/optc-gen.awk =================================================================== --- gcc/optc-gen.awk (revision 165188) +++ gcc/optc-gen.awk (working copy) @@ -31,7 +31,10 @@ BEGIN { n_langs = 0 n_target_save = 0 n_extra_vars = 0 - quote = "\042" + n_extra_target_vars = 0 + n_extra_c_includes = 0 + n_extra_h_includes = 0 + quote = "\042" comma = "," FS=SUBSEP # Default the name of header created from opth-gen.awk to options.h @@ -53,6 +56,30 @@ BEGIN { extra_vars[n_extra_vars] = $2 n_extra_vars++ } + else if ($1 == "TargetVariable") { + # Combination of TargetSave and Variable + extra_vars[n_extra_vars] = $2 + n_extra_vars++ + + var = $2 + sub(" *=.*", "", var) + orig_var = var + name = var + type = var + sub("^.*[ *]", "", name) + sub(" *" name "$", "", type) + target_save_decl[n_target_save] = type " x_" name + n_target_save++ + + extra_target_vars[n_extra_target_vars] = name + n_extra_target_vars++; + } + else if ($1 == "HeaderInclude") { + extra_h_includes[n_extra_h_includes++] = $2; + } + else if ($1 == "SourceInclude") { + extra_c_includes[n_extra_c_includes++] = $2; + } else { name = opt_args("Mask", $1) if (name == "") { @@ -82,7 +109,17 @@ print "#include " quote "target.h" quote print "#endif /* GCC_DRIVER */" print "" +if (n_extra_c_includes > 0) { + for (i = 0; i < n_extra_c_includes; i++) { + print "#include " quote extra_c_includes[i] quote + } + print "" +} + have_save = 0; +if (n_extra_target_vars) + have_save = 1 + print "struct gcc_options global_options =\n{" for (i = 0; i < n_extra_vars; i++) { var = extra_vars[i] @@ -303,6 +340,7 @@ print "{"; n_opt_char = 2; n_opt_short = 0; n_opt_int = 0; +n_opt_enum = 0; n_opt_other = 0; var_opt_char[0] = "optimize"; var_opt_char[1] = "optimize_size"; @@ -329,6 +367,9 @@ for (i = 0; i < n_opts; i++) { else if (otype ~ "^((un)?signed +)?short *$") var_opt_short[n_opt_short++] = name; + else if (otype ~ "^enum +[a-zA-Z0-9_]+ *") + var_opt_enum[n_opt_enum++] = name; + else if (otype ~ "^((un)?signed +)?char *$") { var_opt_char[n_opt_char++] = name; if (otype ~ "^unsigned +char *$") @@ -352,6 +393,10 @@ for (i = 0; i < n_opt_other; i++) { print " ptr->x_" var_opt_other[i] " = opts->x_" var_opt_other[i] ";"; } +for (i = 0; i < n_opt_enum; i++) { + print " ptr->x_" var_opt_enum[i] " = opts->x_" var_opt_enum[i] ";"; +} + for (i = 0; i < n_opt_int; i++) { print " ptr->x_" var_opt_int[i] " = opts->x_" var_opt_int[i] ";"; } @@ -376,6 +421,10 @@ for (i = 0; i < n_opt_other; i++) { print " opts->x_" var_opt_other[i] " = ptr->x_" var_opt_other[i] ";"; } +for (i = 0; i < n_opt_enum; i++) { + print " ptr->x_" var_opt_enum[i] " = opts->x_" var_opt_enum[i] ";"; +} + for (i = 0; i < n_opt_int; i++) { print " opts->x_" var_opt_int[i] " = ptr->x_" var_opt_int[i] ";"; } @@ -409,6 +458,15 @@ for (i = 0; i < n_opt_other; i++) { print ""; } +for (i = 0; i < n_opt_enum; i++) { + print " if (ptr->x_" var_opt_enum[i] ")"; + print " fprintf (file, \"%*s%s (%#x)\\n\","; + print " indent_to, \"\","; + print " \"" var_opt_enum[i] "\","; + print " ptr->x_" var_opt_enum[i] ");"; + print ""; +} + for (i = 0; i < n_opt_int; i++) { print " if (ptr->x_" var_opt_int[i] ")"; print " fprintf (file, \"%*s%s (%#x)\\n\","; @@ -447,6 +505,7 @@ print "{"; n_target_char = 0; n_target_short = 0; n_target_int = 0; +n_target_enum = 0; n_target_other = 0; if (have_save) { @@ -467,6 +526,9 @@ if (have_save) { else if (otype ~ "^((un)?signed +)?short *$") var_target_short[n_target_short++] = name; + else if (otype ~ "^enum +[_a-zA-Z0-9]+ *$") + var_target_enum[n_target_enum++] = name; + else if (otype ~ "^((un)?signed +)?char *$") { var_target_char[n_target_char++] = name; if (otype ~ "^unsigned +char *$") @@ -498,10 +560,18 @@ print " if (targetm.target_option.save) print " targetm.target_option.save (ptr);"; print ""; +for (i = 0; i < n_extra_target_vars; i++) { + print " ptr->x_" extra_target_vars[i] " = opts->x_" extra_target_vars[i] ";"; +} + for (i = 0; i < n_target_other; i++) { print " ptr->x_" var_target_other[i] " = opts->x_" var_target_other[i] ";"; } +for (i = 0; i < n_target_enum; i++) { + print " ptr->x_" var_target_enum[i] " = opts->x_" var_target_enum[i] ";"; +} + for (i = 0; i < n_target_int; i++) { print " ptr->x_" var_target_int[i] " = opts->x_" var_target_int[i] ";"; } @@ -522,10 +592,18 @@ print "void"; print "cl_target_option_restore (struct gcc_options *opts, struct cl_target_option *ptr)"; print "{"; +for (i = 0; i < n_extra_target_vars; i++) { + print " opts->x_" extra_target_vars[i] " = ptr->x_" extra_target_vars[i] ";"; +} + for (i = 0; i < n_target_other; i++) { print " opts->x_" var_target_other[i] " = ptr->x_" var_target_other[i] ";"; } +for (i = 0; i < n_target_enum; i++) { + print " opts->x_" var_target_enum[i] " = ptr->x_" var_target_enum[i] ";"; +} + for (i = 0; i < n_target_int; i++) { print " opts->x_" var_target_int[i] " = ptr->x_" var_target_int[i] ";"; } @@ -564,6 +642,15 @@ for (i = 0; i < n_target_other; i++) { print ""; } +for (i = 0; i < n_target_enum; i++) { + print " if (ptr->x_" var_target_enum[i] ")"; + print " fprintf (file, \"%*s%s (%#x)\\n\","; + print " indent, \"\","; + print " \"" var_target_enum[i] "\","; + print " ptr->x_" var_target_enum[i] ");"; + print ""; +} + for (i = 0; i < n_target_int; i++) { print " if (ptr->x_" var_target_int[i] ")"; print " fprintf (file, \"%*s%s (%#x)\\n\","; Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (revision 165188) +++ gcc/configure.ac (working copy) @@ -1396,8 +1396,10 @@ fi # Convert extra_options into a form suitable for Makefile use. extra_opt_files= +all_opt_files= for f in $extra_options; do extra_opt_files="$extra_opt_files \$(srcdir)/config/$f" + all_opt_files="$all_opt_files $srcdir/config/$f" done AC_SUBST(extra_opt_files) @@ -4440,6 +4442,7 @@ changequote([,])dnl all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$gcc_subdir/Make-lang.in" if test -f $srcdir/$gcc_subdir/lang.opt; then lang_opt_files="$lang_opt_files $srcdir/$gcc_subdir/lang.opt" + all_opt_files="$all_opt_files $srcdir/$gcc_subdir/lang.opt" fi if test -f $srcdir/$gcc_subdir/$subdir-tree.def; then lang_tree_files="$lang_tree_files $srcdir/$gcc_subdir/$subdir-tree.def" @@ -4501,6 +4504,14 @@ do done # -------- +# Option include files +# -------- + +${AWK} -f $srcdir/opt-include.awk $all_opt_files > option-includes.mk +option_includes="option-includes.mk" +AC_SUBST_FILE(option_includes) + +# -------- # UNSORTED # -------- @@ -4763,3 +4774,4 @@ done ], [subdirs='$subdirs']) AC_OUTPUT + Index: gcc/opth-gen.awk =================================================================== --- gcc/opth-gen.awk (revision 165188) +++ gcc/opth-gen.awk (working copy) @@ -29,7 +29,12 @@ BEGIN { n_langs = 0 n_target_save = 0 n_extra_vars = 0 + n_extra_target_vars = 0 n_extra_masks = 0 + n_extra_c_includes = 0 + n_extra_h_includes = 0 + have_save = 0; + quote = "\042" FS=SUBSEP } @@ -48,6 +53,30 @@ BEGIN { extra_vars[n_extra_vars] = $2 n_extra_vars++ } + else if ($1 == "TargetVariable") { + # Combination of TargetSave and Variable + extra_vars[n_extra_vars] = $2 + n_extra_vars++ + + var = $2 + sub(" *=.*", "", var) + orig_var = var + name = var + type = var + sub("^.*[ *]", "", name) + sub(" *" name "$", "", type) + target_save_decl[n_target_save] = type " x_" name + n_target_save++ + + extra_target_vars[n_extra_target_vars] = name + n_extra_target_vars++ + } + else if ($1 == "HeaderInclude") { + extra_h_includes[n_extra_h_includes++] = $2; + } + else if ($1 == "SourceInclude") { + extra_c_includes[n_extra_c_includes++] = $2; + } else { name = opt_args("Mask", $1) if (name == "") { @@ -71,10 +100,20 @@ print "#ifndef OPTIONS_H" print "#define OPTIONS_H" print "" -have_save = 0; +if (n_extra_h_includes > 0) { + for (i = 0; i < n_extra_h_includes; i++) { + print "#include " quote extra_h_includes[i] quote + } + print "" +} print "#ifndef GENERATOR_FILE" -print "struct gcc_options\n{" +print "#if !defined(GCC_DRIVER) && !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS)" +print "struct GTY(()) gcc_options" +print "#else" +print "struct gcc_options" +print "#endif" +print "{" print "#endif" for (i = 0; i < n_extra_vars; i++) { @@ -146,6 +185,7 @@ print "{"; n_opt_char = 2; n_opt_short = 0; n_opt_int = 0; +n_opt_enum = 0; n_opt_other = 0; var_opt_char[0] = "unsigned char x_optimize"; var_opt_char[1] = "unsigned char x_optimize_size"; @@ -170,6 +210,9 @@ for (i = 0; i < n_opts; i++) { else if (otype ~ "^((un)?signed +)?char *$") var_opt_char[n_opt_char++] = otype "x_" name; + else if (otype ~ "^enum +[a-zA-Z0-9_]+ *$") + var_opt_enum[n_opt_enum++] = otype "x_" name; + else var_opt_other[n_opt_other++] = otype "x_" name; } @@ -179,6 +222,10 @@ for (i = 0; i < n_opt_other; i++) { print " " var_opt_other[i] ";"; } +for (i = 0; i < n_opt_enum; i++) { + print " " var_opt_enum[i] ";"; +} + for (i = 0; i < n_opt_int; i++) { print " " var_opt_int[i] ";"; } @@ -202,6 +249,7 @@ print "{"; n_target_char = 0; n_target_short = 0; n_target_int = 0; +n_target_enum = 0; n_target_other = 0; for (i = 0; i < n_target_save; i++) { @@ -214,6 +262,9 @@ for (i = 0; i < n_target_save; i++) { else if (target_save_decl[i] ~ "^((un)?signed +)?char +[_a-zA-Z0-9]+$") var_target_char[n_target_char++] = target_save_decl[i]; + else if (target_save_decl[i] ~ "^enum +[_a-zA-Z0-9]+ +[_a-zA-Z0-9]+$") { + var_target_enum[n_target_enum++] = target_save_decl[i]; + } else var_target_other[n_target_other++] = target_save_decl[i]; } @@ -239,6 +290,9 @@ if (have_save) { else if (otype ~ "^((un)?signed +)?char *$") var_target_char[n_target_char++] = otype "x_" name; + else if (otype ~ "^enum +[_a-zA-Z0-9]+ +[_a-zA-Z0-9]+") + var_target_enum[n_target_enum++] = otype "x_" name; + else var_target_other[n_target_other++] = otype "x_" name; } @@ -251,6 +305,10 @@ for (i = 0; i < n_target_other; i++) { print " " var_target_other[i] ";"; } +for (i = 0; i < n_target_enum; i++) { + print " " var_target_enum[i] ";"; +} + for (i = 0; i < n_target_int; i++) { print " " var_target_int[i] ";"; } Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 165188) +++ gcc/Makefile.in (working copy) @@ -813,6 +813,16 @@ T_TARGET : $(T_TARGET) # at build time. SPECS = specs +# Extra include files that are defined by HeaderInclude directives in +# the .opt files +OPTIONS_H_EXTRA = + +# Extra include files that are defined by SourceInclude directives in +# the .opt files +OPTIONS_C_EXTRA = + +@option_includes@ + # End of variables for you to override. # GTM_H lists the config files that the generator files depend on, @@ -823,7 +833,8 @@ CONFIG_H = config.h $(host_xm_file_lis TCONFIG_H = tconfig.h $(xm_file_list) TM_P_H = tm_p.h $(tm_p_file_list) GTM_H = tm.h $(tm_file_list) insn-constants.h -TM_H = $(GTM_H) insn-flags.h options.h +OPTIONS_H = options.h $(OPTIONS_H_EXTRA) +TM_H = $(GTM_H) insn-flags.h $(OPTIONS_H) # Variables for version information. BASEVER := $(srcdir)/BASE-VER # 4.x.y @@ -884,7 +895,7 @@ BUILTINS_DEF = builtins.def sync-builtin TREE_H = tree.h all-tree.def tree.def c-family/c-common.def \ $(lang_tree_files) $(MACHMODE_H) tree-check.h $(BUILTINS_DEF) \ $(INPUT_H) statistics.h $(VEC_H) treestruct.def $(HASHTAB_H) \ - double-int.h alias.h $(SYMTAB_H) options.h vecir.h \ + double-int.h alias.h $(SYMTAB_H) $(OPTIONS_H) vecir.h \ $(REAL_H) $(FIXED_VALUE_H) REGSET_H = regset.h $(BITMAP_H) hard-reg-set.h BASIC_BLOCK_H = basic-block.h $(PREDICT_H) $(VEC_H) $(FUNCTION_H) cfghooks.h @@ -897,7 +908,7 @@ DEMANGLE_H = $(srcdir)/../include/demang RECOG_H = recog.h ALIAS_H = alias.h coretypes.h EMIT_RTL_H = emit-rtl.h -FLAGS_H = flags.h coretypes.h options.h +FLAGS_H = flags.h coretypes.h $(OPTIONS_H) FUNCTION_H = function.h $(TREE_H) $(HASHTAB_H) vecprim.h $(TM_H) EXPR_H = expr.h insn-config.h $(FUNCTION_H) $(RTL_H) $(FLAGS_H) $(TREE_H) $(MACHMODE_H) $(EMIT_RTL_H) OPTABS_H = optabs.h insn-codes.h @@ -2123,7 +2134,7 @@ c-family/c-omp.o : c-family/c-omp.c $(CO c-family/c-opts.o : c-family/c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) $(TOPLEV_H) langhooks.h \ $(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H) \ - opts.h options.h $(MKDEPS_H) incpath.h cppdefault.h + opts.h $(OPTIONS_H) $(MKDEPS_H) incpath.h cppdefault.h $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \ $< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@ @@ -2237,9 +2248,10 @@ s-options-h: optionlist $(srcdir)/opt-fu $(STAMP) $@ options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TARGET_H) $(FLAGS_H) \ - $(TM_H) opts.h intl.h + $(TM_H) opts.h intl.h $(OPTIONS_C_EXTRA) -gcc-options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) opts.h intl.h +gcc-options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) opts.h intl.h \ + $(OPTIONS_C_EXTRA) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(OUTPUT_OPTION) \ -DGCC_DRIVER options.c @@ -2324,7 +2336,7 @@ lto-symtab.o: lto-symtab.c $(CONFIG_H) $ toplev.h $(TREE_H) $(GIMPLE_H) $(GGC_H) $(LAMBDA_H) $(HASHTAB_H) \ $(LTO_STREAMER_H) $(LINKER_PLUGIN_API_H) gt-lto-symtab.h lto-opts.o: lto-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ - $(HASHTAB_H) $(GGC_H) $(BITMAP_H) $(FLAGS_H) opts.h options.h \ + $(HASHTAB_H) $(GGC_H) $(BITMAP_H) $(FLAGS_H) opts.h $(OPTIONS_H) \ $(TARGET_H) $(TOPLEV_H) $(DIAGNOSTIC_H) $(LTO_STREAMER_H) lto-streamer.o: lto-streamer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(TREE_H) $(GIMPLE_H) $(BITMAP_H) $(LTO_STREAMER_H) $(FLAGS_H) \ @@ -2816,12 +2828,12 @@ fold-const.o : fold-const.c $(CONFIG_H) $(GIMPLE_H) realmpfr.h $(TREE_FLOW_H) diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ version.h $(INPUT_H) intl.h $(DIAGNOSTIC_H) diagnostic.def -opts.o : opts.c opts.h options.h $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_H) $(SYSTEM_H) \ +opts.o : opts.c opts.h $(OPTIONS_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(EXPR_H) $(RTL_H) \ output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \ $(FLAGS_H) $(PARAMS_H) $(TREE_PASS_H) $(DBGCNT_H) debug.h \ $(PLUGIN_H) $(EXCEPT_H) $(LTO_STREAMER_H) opts-diagnostic.h -opts-common.o : opts-common.c opts.h options.h $(CONFIG_H) $(SYSTEM_H) \ +opts-common.o : opts-common.c opts.h $(OPTIONS_H) $(CONFIG_H) $(SYSTEM_H) \ coretypes.h intl.h $(DIAGNOSTIC_H) $(TM_H) targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ $(EXPR_H) $(TM_H) $(RTL_H) $(TM_P_H) $(FUNCTION_H) output.h $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) \ Index: gcc/opt-include.awk =================================================================== --- gcc/opt-include.awk (revision 0) +++ gcc/opt-include.awk (revision 0) @@ -0,0 +1,30 @@ +# Copyright (C) 2010 +# Free Software Foundation, Inc. +# Contributed by Michael Meissner (meissner@linux.vnet.ibm.com) +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING3. If not see +# . + +# This Awk script reads in the option records and emits the include files +# listed by the HeaderInclude directive. + +BEGIN { + h_next = 0 + c_next = 0 +} + +(h_next != 0) { print "OPTIONS_H_EXTRA += $(srcdir)/" $1; h_next = 0 } +(c_next != 0) { print "OPTIONS_C_EXTRA += $(srcdir)/" $1; c_next = 0 } +/^HeaderInclude$/ { h_next = 1; c_next = 0 } +/^SourceInclude$/ { h_next = 0; c_next = 1 } Index: gcc/config/rs6000/rs6000.opt =================================================================== --- gcc/config/rs6000/rs6000.opt (revision 165188) +++ gcc/config/rs6000/rs6000.opt (working copy) @@ -20,6 +20,93 @@ ; along with GCC; see the file COPYING3. If not see ; . +HeaderInclude +config/rs6000/rs6000-opts.h + +;; Current processor +TargetVariable +enum processor_type rs6000_cpu = PROCESSOR_RIOS1 + +;; Always emit branch hint bits. +TargetVariable +unsigned char rs6000_always_hint + +;; Schedule instructions for group formation. +TargetVariable +unsigned char rs6000_sched_groups + +;; Align branch targets. +TargetVariable +unsigned char rs6000_align_branch_targets + +;; Support for -msched-costly-dep option. +TargetVariable +enum rs6000_dependence_cost rs6000_sched_costly_dep = no_dep_costly + +;; Support for -minsert-sched-nops option. +TargetVariable +enum rs6000_nop_insertion rs6000_sched_insert_nops = sched_finish_none + +;; Size of long double. +TargetVariable +unsigned char rs6000_long_double_type_size + +;; IEEE quad extended precision long double. +TargetVariable +unsigned char rs6000_ieeequad + +;; Nonzero to use AltiVec ABI. +TargetVariable +unsigned char rs6000_altivec_abi + +;; Nonzero if we want SPE SIMD instructions. +TargetVariable +int rs6000_spe + +;; Nonzero if we want SPE ABI extensions. +TargetVariable +unsigned char rs6000_spe_abi + +;; Nonzero if floating point operations are done in the GPRs. +TargetVariable +unsigned char rs6000_float_gprs + +;; Nonzero if we want Darwin's struct-by-value-in-regs ABI. +TargetVariable +unsigned char rs6000_darwin64_abi + +;; Which small data model to use (for System V targets only) +TargetVariable +enum rs6000_sdata_type rs6000_sdata = SDATA_DATA + +;; Bit size of immediate TLS offsets and string from which it is decoded. +TargetVariable +int rs6000_tls_size = 32 + +;; ABI enumeration available for subtarget to use. +TargetVariable +enum rs6000_abi rs6000_current_abi = ABI_NONE + +;; Type of traceback to use. +TargetVariable +enum rs6000_traceback_type rs6000_traceback = traceback_default + +;; Control alignment for fields within structures. +TargetVariable +unsigned char rs6000_alignment_flags + +;; Code model for 64-bit linux. +TargetVariable +enum rs6000_cmodel rs6000_current_cmodel = CMODEL_SMALL + +;; What type of reciprocal estimation instructions to generate +TargetVariable +unsigned int rs6000_recip_control + +;; Debug flags +TargetVariable +unsigned int rs6000_debug + mpower Target Report RejectNegative Mask(POWER) Use POWER instruction set Index: gcc/config/rs6000/linux64.h =================================================================== --- gcc/config/rs6000/linux64.h (revision 165188) +++ gcc/config/rs6000/linux64.h (working copy) @@ -65,10 +65,9 @@ extern int dot_symbols; #define TARGET_USES_LINUX64_OPT 1 #ifdef HAVE_LD_LARGE_TOC -extern enum rs6000_cmodel cmodel; #undef TARGET_CMODEL -#define TARGET_CMODEL cmodel -#define SET_CMODEL(opt) cmodel = opt +#define TARGET_CMODEL rs6000_current_cmodel +#define SET_CMODEL(opt) rs6000_current_cmodel = opt #else #define SET_CMODEL(opt) do {} while (0) #endif @@ -127,7 +126,7 @@ extern enum rs6000_cmodel cmodel; if ((target_flags_explicit & MASK_MINIMAL_TOC) != 0) \ { \ if (rs6000_explicit_options.cmodel \ - && cmodel != CMODEL_SMALL) \ + && rs6000_current_cmodel != CMODEL_SMALL) \ error ("-mcmodel incompatible with other toc options"); \ SET_CMODEL (CMODEL_SMALL); \ } \ @@ -135,7 +134,7 @@ extern enum rs6000_cmodel cmodel; { \ if (!rs6000_explicit_options.cmodel) \ SET_CMODEL (CMODEL_MEDIUM); \ - if (cmodel != CMODEL_SMALL) \ + if (rs6000_current_cmodel != CMODEL_SMALL) \ { \ TARGET_NO_FP_IN_TOC = 0; \ TARGET_NO_SUM_IN_TOC = 0; \ Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 165188) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -136,7 +136,6 @@ typedef struct GTY(()) machine_function /* Target cpu type */ -enum processor_type rs6000_cpu; struct rs6000_cpu_select rs6000_select[3] = { /* switch name, tune arch */ @@ -145,47 +144,22 @@ struct rs6000_cpu_select rs6000_select[3 { (const char *)0, "-mtune=", 1, 0 }, }; -/* Always emit branch hint bits. */ -static GTY(()) bool rs6000_always_hint; - -/* Schedule instructions for group formation. */ -static GTY(()) bool rs6000_sched_groups; - -/* Align branch targets. */ -static GTY(()) bool rs6000_align_branch_targets; +/* String variables to hold the various options. */ +static const char *rs6000_sched_insert_nops_str; +static const char *rs6000_sched_costly_dep_str; +static const char *rs6000_tls_size_string; +static const char *rs6000_debug_name; +static const char *rs6000_traceback_name; +static const char *rs6000_recip_name; -/* Support for -msched-costly-dep option. */ -const char *rs6000_sched_costly_dep_str; -enum rs6000_dependence_cost rs6000_sched_costly_dep; - -/* Support for -minsert-sched-nops option. */ -const char *rs6000_sched_insert_nops_str; -enum rs6000_nop_insertion rs6000_sched_insert_nops; +#ifdef USING_ELFOS_H +static const char *rs6000_abi_name; +static const char *rs6000_sdata_name; +#endif /* Support targetm.vectorize.builtin_mask_for_load. */ static GTY(()) tree altivec_builtin_mask_for_load; -/* Size of long double. */ -int rs6000_long_double_type_size; - -/* IEEE quad extended precision long double. */ -int rs6000_ieeequad; - -/* Nonzero to use AltiVec ABI. */ -int rs6000_altivec_abi; - -/* Nonzero if we want SPE SIMD instructions. */ -int rs6000_spe; - -/* Nonzero if we want SPE ABI extensions. */ -int rs6000_spe_abi; - -/* Nonzero if floating point operations are done in the GPRs. */ -int rs6000_float_gprs = 0; - -/* Nonzero if we want Darwin's struct-by-value-in-regs ABI. */ -int rs6000_darwin64_abi; - /* Set to nonzero once AIX common-mode calls have been defined. */ static GTY(()) int common_mode_defined; @@ -194,37 +168,13 @@ static GTY(()) int common_mode_defined; int rs6000_pic_labelno; #ifdef USING_ELFOS_H -/* Which abi to adhere to */ -const char *rs6000_abi_name; - -/* Semantics of the small data area */ -enum rs6000_sdata_type rs6000_sdata = SDATA_DATA; - -/* Which small data model to use */ -const char *rs6000_sdata_name = (char *)0; - /* Counter for labels which are to be placed in .fixup. */ int fixuplabelno = 0; #endif -/* Bit size of immediate TLS offsets and string from which it is decoded. */ -int rs6000_tls_size = 32; -const char *rs6000_tls_size_string; - -/* ABI enumeration available for subtarget to use. */ -enum rs6000_abi rs6000_current_abi; - /* Whether to use variant of AIX ABI for PowerPC64 Linux. */ int dot_symbols; -/* Debug flags */ -const char *rs6000_debug_name; -int rs6000_debug_stack; /* debug stack applications */ -int rs6000_debug_arg; /* debug argument handling */ -int rs6000_debug_reg; /* debug register classes */ -int rs6000_debug_addr; /* debug memory addressing */ -int rs6000_debug_cost; /* debug rtx_costs */ - /* Specify the machine mode that pointers have. After generation of rtl, the compiler makes no further distinction between pointers and any other objects of this machine mode. The type is unsigned since not all things that @@ -254,14 +204,6 @@ static enum insn_code rs6000_vector_relo tree rs6000_builtin_types[RS6000_BTI_MAX]; tree rs6000_builtin_decls[RS6000_BUILTIN_COUNT]; -const char *rs6000_traceback_name; -static enum { - traceback_default = 0, - traceback_none, - traceback_part, - traceback_full -} rs6000_traceback; - /* Flag to say the TOC is initialized */ int toc_initialized; char toc_label_name[10]; @@ -276,13 +218,6 @@ static GTY(()) section *read_only_privat static GTY(()) section *sdata2_section; static GTY(()) section *toc_section; -/* Control alignment for fields within structures. */ -/* String from -malign-XXXXX. */ -int rs6000_alignment_flags; - -/* Code model for 64-bit linux. */ -enum rs6000_cmodel cmodel; - /* True for any options that were explicitly set. */ static struct { bool aix_struct_ret; /* True if -maix-struct-ret was used. */ @@ -352,9 +287,6 @@ enum rs6000_recip_mask { RECIP_LOW_PRECISION = (RECIP_ALL & ~(RECIP_DF_RSQRT | RECIP_V2DF_RSQRT)) }; -static unsigned int rs6000_recip_control; -static const char *rs6000_recip_name; - /* -mrecip options. */ static struct { @@ -2753,21 +2685,27 @@ rs6000_option_override_internal (const c /* Set debug flags */ if (rs6000_debug_name) { - if (! strcmp (rs6000_debug_name, "all")) - rs6000_debug_stack = rs6000_debug_arg = rs6000_debug_reg - = rs6000_debug_addr = rs6000_debug_cost = 1; - else if (! strcmp (rs6000_debug_name, "stack")) - rs6000_debug_stack = 1; - else if (! strcmp (rs6000_debug_name, "arg")) - rs6000_debug_arg = 1; - else if (! strcmp (rs6000_debug_name, "reg")) - rs6000_debug_reg = 1; - else if (! strcmp (rs6000_debug_name, "addr")) - rs6000_debug_addr = 1; - else if (! strcmp (rs6000_debug_name, "cost")) - rs6000_debug_cost = 1; - else - error ("unknown -mdebug-%s switch", rs6000_debug_name); + char *p = ASTRDUP (rs6000_debug_name); + char *q; + rs6000_debug = 0; + + while ((q = strtok (p, ",")) != NULL) + { + if (! strcmp (q, "all")) + rs6000_debug |= MASK_DEBUG_ALL; + else if (! strcmp (q, "stack")) + rs6000_debug |= MASK_DEBUG_STACK; + else if (! strcmp (q, "arg")) + rs6000_debug |= MASK_DEBUG_ARG; + else if (! strcmp (q, "reg")) + rs6000_debug |= MASK_DEBUG_REG; + else if (! strcmp (q, "addr")) + rs6000_debug |= MASK_DEBUG_ADDR; + else if (! strcmp (q, "cost")) + rs6000_debug |= MASK_DEBUG_COST; + else + error ("unknown -mdebug-%s switch", q); + } /* If the appropriate debug option is enabled, replace the target hooks with debug versions that call the real version and then prints @@ -4062,11 +4000,11 @@ rs6000_handle_option (size_t code, const #if defined (HAVE_LD_LARGE_TOC) && defined (TARGET_USES_LINUX64_OPT) case OPT_mcmodel_: if (strcmp (arg, "small") == 0) - cmodel = CMODEL_SMALL; + rs6000_current_cmodel = CMODEL_SMALL; else if (strcmp (arg, "medium") == 0) - cmodel = CMODEL_MEDIUM; + rs6000_current_cmodel = CMODEL_MEDIUM; else if (strcmp (arg, "large") == 0) - cmodel = CMODEL_LARGE; + rs6000_current_cmodel = CMODEL_LARGE; else { error ("invalid option for -mcmodel: '%s'", arg); Index: gcc/config/rs6000/rs6000.h =================================================================== --- gcc/config/rs6000/rs6000.h (revision 165188) +++ gcc/config/rs6000/rs6000.h (working copy) @@ -29,6 +29,10 @@ /* Note that some other tm.h files include this one and then override many of the definitions. */ +#ifndef RS6000_OPTS_H +#include "config/rs6000/rs6000-opts.h" +#endif + /* Definitions for the object file format. These are set at compile-time. */ @@ -299,16 +303,6 @@ extern const char *host_detect_local_cpu #define TARGET_SECURE_PLT 0 #endif -/* Code model for 64-bit linux. - small: 16-bit toc offsets. - medium: 32-bit toc offsets, static data and code within 2G of TOC pointer. - large: 32-bit toc offsets, no limit on static data and code. */ -enum rs6000_cmodel { - CMODEL_SMALL, - CMODEL_MEDIUM, - CMODEL_LARGE -}; - #ifndef TARGET_CMODEL #define TARGET_CMODEL CMODEL_SMALL #endif @@ -338,40 +332,6 @@ enum rs6000_cmodel { #define TARGET_DEFAULT (MASK_POWER | MASK_MULTIPLE | MASK_STRING) -/* Processor type. Order must match cpu attribute in MD file. */ -enum processor_type - { - PROCESSOR_RIOS1, - PROCESSOR_RIOS2, - PROCESSOR_RS64A, - PROCESSOR_MPCCORE, - PROCESSOR_PPC403, - PROCESSOR_PPC405, - PROCESSOR_PPC440, - PROCESSOR_PPC476, - PROCESSOR_PPC601, - PROCESSOR_PPC603, - PROCESSOR_PPC604, - PROCESSOR_PPC604e, - PROCESSOR_PPC620, - PROCESSOR_PPC630, - PROCESSOR_PPC750, - PROCESSOR_PPC7400, - PROCESSOR_PPC7450, - PROCESSOR_PPC8540, - PROCESSOR_PPCE300C2, - PROCESSOR_PPCE300C3, - PROCESSOR_PPCE500MC, - PROCESSOR_PPCE500MC64, - PROCESSOR_POWER4, - PROCESSOR_POWER5, - PROCESSOR_POWER6, - PROCESSOR_POWER7, - PROCESSOR_CELL, - PROCESSOR_PPCA2, - PROCESSOR_TITAN -}; - /* FPU operations supported. Each use of TARGET_SINGLE_FLOAT or TARGET_DOUBLE_FLOAT must also test TARGET_HARD_FLOAT. */ @@ -381,8 +341,6 @@ enum processor_type #define TARGET_SIMPLE_FPU 0 #define TARGET_XILINX_FPU 0 -extern enum processor_type rs6000_cpu; - /* Recast the processor type to the cpu attribute. */ #define rs6000_cpu_attr ((enum attr_cpu)rs6000_cpu) @@ -396,47 +354,12 @@ extern enum processor_type rs6000_cpu; #define PROCESSOR_DEFAULT PROCESSOR_RIOS1 #define PROCESSOR_DEFAULT64 PROCESSOR_RS64A -/* FP processor type. */ -enum fpu_type_t -{ - FPU_NONE, /* No FPU */ - FPU_SF_LITE, /* Limited Single Precision FPU */ - FPU_DF_LITE, /* Limited Double Precision FPU */ - FPU_SF_FULL, /* Full Single Precision FPU */ - FPU_DF_FULL /* Full Double Single Precision FPU */ -}; - extern enum fpu_type_t fpu_type; /* Specify the dialect of assembler to use. New mnemonics is dialect one and the old mnemonics are dialect zero. */ #define ASSEMBLER_DIALECT (TARGET_NEW_MNEMONICS ? 1 : 0) -/* Types of costly dependences. */ -enum rs6000_dependence_cost - { - max_dep_latency = 1000, - no_dep_costly, - all_deps_costly, - true_store_to_load_dep_costly, - store_to_load_dep_costly - }; - -/* Types of nop insertion schemes in sched target hook sched_finish. */ -enum rs6000_nop_insertion - { - sched_finish_regroup_exact = 1000, - sched_finish_pad_groups, - sched_finish_none - }; - -/* Dispatch group termination caused by an insn. */ -enum group_termination - { - current_group, - previous_group - }; - /* rs6000_select[0] is reserved for the default cpu defined via --with-cpu */ struct rs6000_cpu_select { @@ -449,42 +372,22 @@ struct rs6000_cpu_select extern struct rs6000_cpu_select rs6000_select[]; /* Debug support */ -extern const char *rs6000_debug_name; /* Name for -mdebug-xxxx option */ -extern int rs6000_debug_stack; /* debug stack applications */ -extern int rs6000_debug_arg; /* debug argument handling */ -extern int rs6000_debug_reg; /* debug register handling */ -extern int rs6000_debug_addr; /* debug memory addressing */ -extern int rs6000_debug_cost; /* debug rtx_costs */ - -#define TARGET_DEBUG_STACK rs6000_debug_stack -#define TARGET_DEBUG_ARG rs6000_debug_arg -#define TARGET_DEBUG_REG rs6000_debug_reg -#define TARGET_DEBUG_ADDR rs6000_debug_addr -#define TARGET_DEBUG_COST rs6000_debug_cost - -extern const char *rs6000_traceback_name; /* Type of traceback table. */ - -/* These are separate from target_flags because we've run out of bits - there. */ -extern int rs6000_long_double_type_size; -extern int rs6000_ieeequad; -extern int rs6000_altivec_abi; -extern int rs6000_spe_abi; -extern int rs6000_spe; -extern int rs6000_float_gprs; -extern int rs6000_alignment_flags; -extern const char *rs6000_sched_insert_nops_str; -extern enum rs6000_nop_insertion rs6000_sched_insert_nops; - -/* Describe which vector unit to use for a given machine mode. */ -enum rs6000_vector { - VECTOR_NONE, /* Type is not a vector or not supported */ - VECTOR_ALTIVEC, /* Use altivec for vector processing */ - VECTOR_VSX, /* Use VSX for vector processing */ - VECTOR_PAIRED, /* Use paired floating point for vectors */ - VECTOR_SPE, /* Use SPE for vector processing */ - VECTOR_OTHER /* Some other vector unit */ -}; +#define MASK_DEBUG_STACK 0x01 /* debug stack applications */ +#define MASK_DEBUG_ARG 0x02 /* debug argument handling */ +#define MASK_DEBUG_REG 0x04 /* debug register handling */ +#define MASK_DEBUG_ADDR 0x08 /* debug memory addressing */ +#define MASK_DEBUG_COST 0x10 /* debug rtx codes */ +#define MASK_DEBUG_ALL (MASK_DEBUG_STACK \ + | MASK_DEBUG_ARG \ + | MASK_DEBUG_REG \ + | MASK_DEBUG_ADDR \ + | MASK_DEBUG_COST) + +#define TARGET_DEBUG_STACK (rs6000_debug & MASK_DEBUG_STACK) +#define TARGET_DEBUG_ARG (rs6000_debug & MASK_DEBUG_ARG) +#define TARGET_DEBUG_REG (rs6000_debug & MASK_DEBUG_REG) +#define TARGET_DEBUG_ADDR (rs6000_debug & MASK_DEBUG_ADDR) +#define TARGET_DEBUG_COST (rs6000_debug & MASK_DEBUG_COST) extern enum rs6000_vector rs6000_vector_unit[]; @@ -1468,16 +1371,6 @@ extern enum reg_class rs6000_constraints /* Stack layout; function entry, exit and calling. */ -/* Enumeration to give which calling sequence to use. */ -enum rs6000_abi { - ABI_NONE, - ABI_AIX, /* IBM's AIX */ - ABI_V4, /* System V.4/eabi */ - ABI_DARWIN /* Apple's Darwin (OS X kernel) */ -}; - -extern enum rs6000_abi rs6000_current_abi; /* available for use by subtarget */ - /* Define this if pushing a word on the stack makes the stack pointer a smaller address. */ #define STACK_GROWS_DOWNWARD Index: gcc/config/rs6000/rs6000-opts.h =================================================================== --- gcc/config/rs6000/rs6000-opts.h (revision 0) +++ gcc/config/rs6000/rs6000-opts.h (revision 0) @@ -0,0 +1,144 @@ +/* Definitions of target machine needed for option handling for GNU compiler, + for IBM RS/6000. + Copyright (C) 2010 + Free Software Foundation, Inc. + Contributed by Michael Meissner (meissner@linux.vnet.ibm.com) + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#ifndef RS6000_OPTS_H +#define RS6000_OPTS_H + +/* Processor type. Order must match cpu attribute in MD file. */ +enum processor_type + { + PROCESSOR_RIOS1, + PROCESSOR_RIOS2, + PROCESSOR_RS64A, + PROCESSOR_MPCCORE, + PROCESSOR_PPC403, + PROCESSOR_PPC405, + PROCESSOR_PPC440, + PROCESSOR_PPC476, + PROCESSOR_PPC601, + PROCESSOR_PPC603, + PROCESSOR_PPC604, + PROCESSOR_PPC604e, + PROCESSOR_PPC620, + PROCESSOR_PPC630, + PROCESSOR_PPC750, + PROCESSOR_PPC7400, + PROCESSOR_PPC7450, + PROCESSOR_PPC8540, + PROCESSOR_PPCE300C2, + PROCESSOR_PPCE300C3, + PROCESSOR_PPCE500MC, + PROCESSOR_PPCE500MC64, + PROCESSOR_POWER4, + PROCESSOR_POWER5, + PROCESSOR_POWER6, + PROCESSOR_POWER7, + PROCESSOR_CELL, + PROCESSOR_PPCA2, + PROCESSOR_TITAN +}; + +/* FP processor type. */ +enum fpu_type_t +{ + FPU_NONE, /* No FPU */ + FPU_SF_LITE, /* Limited Single Precision FPU */ + FPU_DF_LITE, /* Limited Double Precision FPU */ + FPU_SF_FULL, /* Full Single Precision FPU */ + FPU_DF_FULL /* Full Double Single Precision FPU */ +}; + +/* Types of costly dependences. */ +enum rs6000_dependence_cost +{ + max_dep_latency = 1000, + no_dep_costly, + all_deps_costly, + true_store_to_load_dep_costly, + store_to_load_dep_costly +}; + +/* Types of nop insertion schemes in sched target hook sched_finish. */ +enum rs6000_nop_insertion +{ + sched_finish_regroup_exact = 1000, + sched_finish_pad_groups, + sched_finish_none +}; + +/* Dispatch group termination caused by an insn. */ +enum group_termination +{ + current_group, + previous_group +}; + +/* Enumeration to give which calling sequence to use. */ +enum rs6000_abi { + ABI_NONE, + ABI_AIX, /* IBM's AIX */ + ABI_V4, /* System V.4/eabi */ + ABI_DARWIN /* Apple's Darwin (OS X kernel) */ +}; + +/* Small data support types. */ +enum rs6000_sdata_type { + SDATA_NONE, /* No small data support. */ + SDATA_DATA, /* Just put data in .sbss/.sdata, don't use relocs. */ + SDATA_SYSV, /* Use r13 to point to .sdata/.sbss. */ + SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2. */ +}; + +/* Type of traceback to use. */ +enum rs6000_traceback_type { + traceback_default = 0, + traceback_none, + traceback_part, + traceback_full +}; + +/* Code model for 64-bit linux. + small: 16-bit toc offsets. + medium: 32-bit toc offsets, static data and code within 2G of TOC pointer. + large: 32-bit toc offsets, no limit on static data and code. */ +enum rs6000_cmodel { + CMODEL_SMALL, + CMODEL_MEDIUM, + CMODEL_LARGE +}; + +/* Describe which vector unit to use for a given machine mode. */ +enum rs6000_vector { + VECTOR_NONE, /* Type is not a vector or not supported */ + VECTOR_ALTIVEC, /* Use altivec for vector processing */ + VECTOR_VSX, /* Use VSX for vector processing */ + VECTOR_PAIRED, /* Use paired floating point for vectors */ + VECTOR_SPE, /* Use SPE for vector processing */ + VECTOR_OTHER /* Some other vector unit */ +}; + +#endif Index: gcc/config/rs6000/sysv4.h =================================================================== --- gcc/config/rs6000/sysv4.h (revision 165188) +++ gcc/config/rs6000/sysv4.h (working copy) @@ -41,16 +41,6 @@ #undef ASM_DEFAULT_SPEC #define ASM_DEFAULT_SPEC "-mppc" -/* Small data support types. */ -enum rs6000_sdata_type { - SDATA_NONE, /* No small data support. */ - SDATA_DATA, /* Just put data in .sbss/.sdata, don't use relocs. */ - SDATA_SYSV, /* Use r13 to point to .sdata/.sbss. */ - SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2. */ -}; - -extern enum rs6000_sdata_type rs6000_sdata; - #define TARGET_TOC ((target_flags & MASK_64BIT) \ || ((target_flags & (MASK_RELOCATABLE \ | MASK_MINIMAL_TOC)) \ @@ -70,10 +60,6 @@ extern enum rs6000_sdata_type rs6000_sda #define TARGET_SECURE_PLT secure_plt #endif -extern const char *rs6000_abi_name; -extern const char *rs6000_sdata_name; -extern const char *rs6000_tls_size_string; /* For -mtls-size= */ - #define SDATA_DEFAULT_SIZE 8 /* The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to Index: gcc/doc/options.texi =================================================================== --- gcc/doc/options.texi (.../svn+ssh://meissner@gcc.gnu.org/svn/gcc/trunk/gcc/doc/options.texi) (revision 165188) +++ gcc/doc/options.texi (.../gcc/doc/options.texi) (working copy) @@ -52,6 +52,32 @@ for variables set in option handlers rat @code{Var} properties. @item +A variable record to define a variable used to store option +information. These records have two fields: the string +@samp{TargetVariable}, and a declaration of the type and name of the +variable, optionally with an initializer (but without any trailing +@samp{;}). @samp{TargetVariable} are a combination of @samp{Variable} +and @samp{TargetSave} records in that the variable is defined in the +@code{gcc_options} structure, but these variables are also stored in +@code{cl_target_option} structure. The variables are saved in the +target save code and restored in the target restore code. + +@item +A variable record to record any additional files that the +@file{options.h} file should include. This is useful to provide +enumeration or structure definitions needed for target variables. +These records have two fields: the string @samp{HeaderInclude} and the +name of the include file. + +@item +A variable record to record any additional files that the +@file{options.c} file should include. This is useful to provide +inline functions needed for target variables and/or @code{#ifdef} +sequences to properly set up the initialization. These records have +two fields: the string @samp{SourceInclude} and the name of the +include file. + +@item An option definition record. These records have the following fields: @enumerate @item