diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-05-22 04:29:40 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-11-11 13:02:52 -0800 |
commit | 9e0fbc8403cee8eb9a5a8089cc459ae2be53d1c3 (patch) | |
tree | 79428d4449e79a5e13a67a71bb89544c20c5e573 | |
parent | df24635342323b3a01896d4866e2be6151174f2a (diff) | |
download | gcc-hjl/pr66250.tar.gz |
Add a file to make machine mode adjustmentshjl/pr66250
machmode.def has
/* Allow the target to specify additional modes of various kinds. */
/* Complex modes. */
COMPLEX_MODES (INT);
COMPLEX_MODES (FLOAT);
/* Decimal floating point modes. */
DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format);
DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format);
DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format);
We can't adjust any complex nor DFP modes in i386-modes.def since they
aren't available yet. But we need to include i386-modes.def before
COMPLEX_MODES (INT);
COMPLEX_MODES (FLOAT);
to get extra modes. This patch adds EXTRA_ADJUSTMENTS_FILE containing
adjustments to machine modes and includes it after all modes have been
created.
PR other/66250
* Makefile.in (extra_adjustments_file): New.
(build/genmodes.o): Depend on $(extra_adjustments_file).
* config.gcc (extra_adjustments): New. Set to
${cpu_type}/${cpu_type}-adjustments.def if available.
* configure.ac (extra_adjustments): AC_SUBST and
AC_DEFINE_UNQUOTED if set.
* genmodes.c (HAVE_EXTRA_ADJUSTMENTS): New.
(EXTRA_ADJUSTMENTS_FILE): Likewise.
(emit_autogen_header): Likewise.
(emit_insn_modes_h): Call emit_autogen_header.
(emit_insn_modes_c_header): Likewise.
(emit_min_insn_modes_c_header): Likewise.
* machmode.def: Include EXTRA_ADJUSTMENTS_FILE if
HAVE_EXTRA_ADJUSTMENTS is 1.
* config.in: Regenerated.
* configure: Likewise.
* config/i386/i386-modes.def (ADJUST_FLOAT_FORMAT,
ADJUST_BYTESIZE, ADJUST_ALIGNMENT): Moved to ...
* config/i386/i386-adjustments.def: Here. New file.
-rw-r--r-- | gcc/Makefile.in | 3 | ||||
-rw-r--r-- | gcc/config.gcc | 9 | ||||
-rw-r--r-- | gcc/config.in | 7 | ||||
-rw-r--r-- | gcc/config/i386/i386-adjustments.def | 28 | ||||
-rw-r--r-- | gcc/config/i386/i386-modes.def | 12 | ||||
-rwxr-xr-x | gcc/configure | 16 | ||||
-rw-r--r-- | gcc/configure.ac | 9 | ||||
-rw-r--r-- | gcc/genmodes.c | 34 | ||||
-rw-r--r-- | gcc/machmode.def | 5 |
9 files changed, 97 insertions, 26 deletions
diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 34d23565f89..d863267c93a 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -548,6 +548,7 @@ lang_tree_files=@lang_tree_files@ target_cpu_default=@target_cpu_default@ OBJC_BOEHM_GC=@objc_boehm_gc@ extra_modes_file=@extra_modes_file@ +extra_adjustments_file=@extra_adjustments_file@ extra_opt_files=@extra_opt_files@ host_hook_obj=@out_host_hook_obj@ @@ -2558,7 +2559,7 @@ CFLAGS-errors.o += -DHOST_GENERATOR_FILE build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \ errors.h $(READ_MD_H) build/genmodes.o : genmodes.c $(BCONFIG_H) $(SYSTEM_H) errors.h \ - $(HASHTAB_H) machmode.def $(extra_modes_file) + $(HASHTAB_H) machmode.def $(extra_modes_file) $(extra_adjustments_file) build/genopinit.o : genopinit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ coretypes.h $(GTM_H) errors.h gensupport.h optabs.def build/genoutput.o : genoutput.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ diff --git a/gcc/config.gcc b/gcc/config.gcc index 59aee2cfdcd..6cec7131ab6 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -103,6 +103,10 @@ # machine modes, if necessary and different from # "$cpu_type/$cpu_type-modes.def". # +# extra_adjustments The name of the file containing adjustments to +# machine modes, if necessary and different from +# "$cpu_type/$cpu_type-adjustments.def". +# # extra_objs List of extra objects that should be linked into # the compiler proper (cc1, cc1obj, cc1plus) # depending on target. @@ -497,6 +501,11 @@ if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def then extra_modes=${cpu_type}/${cpu_type}-modes.def fi +extra_adjustments= +if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-adjustments.def +then + extra_adjustments=${cpu_type}/${cpu_type}-adjustments.def +fi if test -f ${srcdir}/config/${cpu_type}/${cpu_type}.opt then extra_options="${extra_options} ${cpu_type}/${cpu_type}.opt" diff --git a/gcc/config.in b/gcc/config.in index bb0d22053e9..75c7c891307 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -234,6 +234,13 @@ #endif +/* Define to the name of a file containing adjustments to machine modes for + this architecture. */ +#ifndef USED_FOR_TARGET +#undef EXTRA_ADJUSTMENTS_FILE +#endif + + /* Define to the name of a file containing a list of extra machine modes for this architecture. */ #ifndef USED_FOR_TARGET diff --git a/gcc/config/i386/i386-adjustments.def b/gcc/config/i386/i386-adjustments.def new file mode 100644 index 00000000000..690201ec6f3 --- /dev/null +++ b/gcc/config/i386/i386-adjustments.def @@ -0,0 +1,28 @@ +/* Definitions of target adjustments for GCC for x86. + Copyright (C) 2015 Free Software Foundation, Inc. + +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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +/* If TARGET_128BIT_LONG_DOUBLE is true, XFmode has size and alignment 16. + Otherwise, XFmode has size 12 and alignment 4. */ +ADJUST_FLOAT_FORMAT (XF, (TARGET_128BIT_LONG_DOUBLE + ? &ieee_extended_intel_128_format + : TARGET_96_ROUND_53_LONG_DOUBLE + ? &ieee_extended_intel_96_round_53_format + : &ieee_extended_intel_96_format)); +ADJUST_BYTESIZE (XF, TARGET_128BIT_LONG_DOUBLE ? 16 : 12); +ADJUST_ALIGNMENT (XF, TARGET_128BIT_LONG_DOUBLE ? 16 : 4); diff --git a/gcc/config/i386/i386-modes.def b/gcc/config/i386/i386-modes.def index 714c138cc6a..9be0941da4b 100644 --- a/gcc/config/i386/i386-modes.def +++ b/gcc/config/i386/i386-modes.def @@ -1,4 +1,4 @@ -/* Definitions of target machine for GCC for IA-32. +/* Definitions of target machine for GCC for x86. Copyright (C) 2002-2015 Free Software Foundation, Inc. This file is part of GCC. @@ -24,16 +24,6 @@ along with GCC; see the file COPYING3. If not see FRACTIONAL_FLOAT_MODE (XF, 80, 12, ieee_extended_intel_96_format); FLOAT_MODE (TF, 16, ieee_quad_format); -/* In ILP32 mode, XFmode has size 12 and alignment 4. - In LP64 mode, XFmode has size and alignment 16. */ -ADJUST_FLOAT_FORMAT (XF, (TARGET_128BIT_LONG_DOUBLE - ? &ieee_extended_intel_128_format - : TARGET_96_ROUND_53_LONG_DOUBLE - ? &ieee_extended_intel_96_round_53_format - : &ieee_extended_intel_96_format)); -ADJUST_BYTESIZE (XF, TARGET_128BIT_LONG_DOUBLE ? 16 : 12); -ADJUST_ALIGNMENT (XF, TARGET_128BIT_LONG_DOUBLE ? 16 : 4); - /* Add any extra modes needed to represent the condition code. For the i386, we need separate modes when floating-point diff --git a/gcc/configure b/gcc/configure index 4b4e72457a7..51c34ba8a3f 100755 --- a/gcc/configure +++ b/gcc/configure @@ -734,6 +734,7 @@ LIBINTL_DEP LIBINTL USE_NLS extra_opt_files +extra_adjustments_file extra_modes_file NATIVE_SYSTEM_HEADER_DIR objext @@ -11709,6 +11710,17 @@ _ACEOF fi +# Look for a file containing extra machine mode adjustments. +if test -n "$extra_adjustments" && test -f $srcdir/config/$extra_adjustments; then + extra_adjustments_file='$(srcdir)'/config/${extra_adjustments} + + +cat >>confdefs.h <<_ACEOF +#define EXTRA_ADJUSTMENTS_FILE "config/$extra_adjustments" +_ACEOF + +fi + # Convert extra_options into a form suitable for Makefile use. extra_opt_files= all_opt_files= @@ -18402,7 +18414,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18405 "configure" +#line 18417 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18508,7 +18520,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18511 "configure" +#line 18523 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 42d8f136e9c..8551b63b8bd 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1622,6 +1622,15 @@ if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then for this architecture.]) fi +# Look for a file containing extra machine mode adjustments. +if test -n "$extra_adjustments" && test -f $srcdir/config/$extra_adjustments; then + extra_adjustments_file='$(srcdir)'/config/${extra_adjustments} + AC_SUBST(extra_adjustments_file) + AC_DEFINE_UNQUOTED(EXTRA_ADJUSTMENTS_FILE, "config/$extra_adjustments", + [Define to the name of a file containing adjustments to machine modes + for this architecture.]) +fi + # Convert extra_options into a form suitable for Makefile use. extra_opt_files= all_opt_files= diff --git a/gcc/genmodes.c b/gcc/genmodes.c index 15d62a0f405..f498c8f7a99 100644 --- a/gcc/genmodes.c +++ b/gcc/genmodes.c @@ -45,6 +45,13 @@ static const char *const mode_class_names[MAX_MODE_CLASS] = # define EXTRA_MODES_FILE "" #endif +#ifdef EXTRA_ADJUSTMENTS_FILE +# define HAVE_EXTRA_ADJUSTMENTS 1 +#else +# define HAVE_EXTRA_ADJUSTMENTS 0 +# define EXTRA_ADJUSTMENTS_FILE "" +#endif + /* Data structure for building up what we know about a mode. They're clustered by mode class. */ struct mode_data @@ -1122,18 +1129,27 @@ mode_unit_precision_inline (machine_mode mode)\n\ } static void +emit_autogen_header (void) +{ + puts ("/* Generated automatically from"); + puts ("\tmachmode.def"); + if (HAVE_EXTRA_MODES) + printf ("\t%s\n", EXTRA_MODES_FILE); + if (HAVE_EXTRA_ADJUSTMENTS) + printf ("\t%s\n", EXTRA_ADJUSTMENTS_FILE); + puts (" by genmodes. */"); +} + +static void emit_insn_modes_h (void) { int c; struct mode_data *m, *first, *last; int n_int_n_ents = 0; - printf ("/* Generated automatically from machmode.def%s%s\n", - HAVE_EXTRA_MODES ? " and " : "", - EXTRA_MODES_FILE); + emit_autogen_header (); puts ("\ - by genmodes. */\n\ \n\ #ifndef GCC_INSN_MODES_H\n\ #define GCC_INSN_MODES_H\n\ @@ -1212,12 +1228,9 @@ enum machine_mode\n{"); static void emit_insn_modes_c_header (void) { - printf ("/* Generated automatically from machmode.def%s%s\n", - HAVE_EXTRA_MODES ? " and " : "", - EXTRA_MODES_FILE); + emit_autogen_header (); puts ("\ - by genmodes. */\n\ \n\ #include \"config.h\"\n\ #include \"system.h\"\n\ @@ -1230,12 +1243,9 @@ emit_insn_modes_c_header (void) static void emit_min_insn_modes_c_header (void) { - printf ("/* Generated automatically from machmode.def%s%s\n", - HAVE_EXTRA_MODES ? " and " : "", - EXTRA_MODES_FILE); + emit_autogen_header (); puts ("\ - by genmodes. */\n\ \n\ #include \"bconfig.h\"\n\ #include \"system.h\"\n\ diff --git a/gcc/machmode.def b/gcc/machmode.def index c07a1351d9d..0fa0c29ab19 100644 --- a/gcc/machmode.def +++ b/gcc/machmode.def @@ -250,6 +250,11 @@ DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format); DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format); DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format); +/* Allow the target to make various adjustments to modes. */ +#if HAVE_EXTRA_ADJUSTMENTS +# include EXTRA_ADJUSTMENTS_FILE +#endif + /* The symbol Pmode stands for one of the above machine modes (usually SImode). The tm.h file specifies which one. It is not a distinct mode. */ |