diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-08-27 20:37:06 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-08-27 20:37:06 +0000 |
commit | 0e3985ee94e443c759ddcde286885cbcc71e7da0 (patch) | |
tree | 0f423580e9aa14c0c796b441ff0df89475c8d5e1 /gcc | |
parent | 3a15f22f6aef35dbcc3324d1e14c51574baf1687 (diff) | |
download | gcc-0e3985ee94e443c759ddcde286885cbcc71e7da0.tar.gz |
1999-08-27 13:27 -0700 Zack Weinberg <zack@bitmover.com>
* rtl.c: Define CONST_DOUBLE_FORMAT to the appropriate format
for a CONST_DOUBLE, at compile time. Initialize rtx_length
and class_narrowest_mode at compile time. Kill init_rtl.
Mark rtx_length, mode_class, mode_size, mode_unit_size,
mode_wider_mode, mode_mask_array, class_narrowest_mode, and
rtx_format as const. Kill all references to EXTRA_CC_MODES or
EXTRA_CC_NAMES.
* rtl.def (CONST_DOUBLE): Use CONST_DOUBLE_FORMAT macro for
format.
* rtl.h: Declare rtx_length and rtx_format as const.
* machmode.def: Define CC(). Use CC() to define CCmode. If
EXTRA_CC_MODES is defined, expand it here.
* machmode.h: Declare mode_class, mode_size, mode_unit_size,
mode_wider_mode, mode_mask_array, and class_narrowest_mode as
const. Kill all references to EXTRA_CC_MODES.
* toplev.c: Don't prototype or call init_rtl.
* optabs.c: Don't call init_mov_optab.
* genemit.c: Don't generate init_mov_optab. Don't call
init_rtl.
* gengenrtl.c: Duplicate calculation of CONST_DOUBLE_FORMAT
here.
* genattr.c, genattrtab.c, gencodes.c, genconfig.c,
genextract.c, genflags.c, genopinit.c, genoutput.c, genpeep.c,
genrecog.c: Don't call init_rtl.
* arc.h, arm.h, c4x.h, i386.h, i960.h, m88k.h, pa.h, pdp11.h,
rs6000.h, sparc.h: Don't define EXTRA_CC_NAMES. Use CC() in
definition of EXTRA_CC_MODES.
* md.texi: Kill ref to EXTRA_CC_NAMES.
* tm.texi: Document new way to define EXTRA_CC_MODES.
* genrecog.c: Do not look up the name of a define_split.
(Unrelated bugfix.)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28937 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 38 | ||||
-rw-r--r-- | gcc/config/arc/arc.h | 6 | ||||
-rw-r--r-- | gcc/config/arm/arm.h | 25 | ||||
-rw-r--r-- | gcc/config/c4x/c4x.h | 6 | ||||
-rw-r--r-- | gcc/config/i386/i386.h | 5 | ||||
-rw-r--r-- | gcc/config/i960/i960.h | 7 | ||||
-rw-r--r-- | gcc/config/m88k/m88k.h | 4 | ||||
-rw-r--r-- | gcc/config/pa/pa.h | 5 | ||||
-rw-r--r-- | gcc/config/pdp11/pdp11.h | 5 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.h | 8 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.h | 11 | ||||
-rw-r--r-- | gcc/genattr.c | 2 | ||||
-rw-r--r-- | gcc/genattrtab.c | 2 | ||||
-rw-r--r-- | gcc/gencodes.c | 2 | ||||
-rw-r--r-- | gcc/genconfig.c | 2 | ||||
-rw-r--r-- | gcc/genemit.c | 39 | ||||
-rw-r--r-- | gcc/genextract.c | 2 | ||||
-rw-r--r-- | gcc/genflags.c | 2 | ||||
-rw-r--r-- | gcc/gengenrtl.c | 21 | ||||
-rw-r--r-- | gcc/genopinit.c | 2 | ||||
-rw-r--r-- | gcc/genoutput.c | 6 | ||||
-rw-r--r-- | gcc/genpeep.c | 2 | ||||
-rw-r--r-- | gcc/genrecog.c | 6 | ||||
-rw-r--r-- | gcc/machmode.def | 17 | ||||
-rw-r--r-- | gcc/machmode.h | 16 | ||||
-rw-r--r-- | gcc/md.texi | 1 | ||||
-rw-r--r-- | gcc/optabs.c | 4 | ||||
-rw-r--r-- | gcc/rtl.c | 131 | ||||
-rw-r--r-- | gcc/rtl.def | 17 | ||||
-rw-r--r-- | gcc/rtl.h | 4 | ||||
-rw-r--r-- | gcc/tm.texi | 29 | ||||
-rw-r--r-- | gcc/toplev.c | 2 |
32 files changed, 192 insertions, 237 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2da2a690ac7..636608ab8de 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,41 @@ +1999-08-27 13:27 -0700 Zack Weinberg <zack@bitmover.com> + + * rtl.c: Define CONST_DOUBLE_FORMAT to the appropriate format + for a CONST_DOUBLE, at compile time. Initialize rtx_length + and class_narrowest_mode at compile time. Kill init_rtl. + Mark rtx_length, mode_class, mode_size, mode_unit_size, + mode_wider_mode, mode_mask_array, class_narrowest_mode, and + rtx_format as const. Kill all references to EXTRA_CC_MODES or + EXTRA_CC_NAMES. + * rtl.def (CONST_DOUBLE): Use CONST_DOUBLE_FORMAT macro for + format. + * rtl.h: Declare rtx_length and rtx_format as const. + * machmode.def: Define CC(). Use CC() to define CCmode. If + EXTRA_CC_MODES is defined, expand it here. + * machmode.h: Declare mode_class, mode_size, mode_unit_size, + mode_wider_mode, mode_mask_array, and class_narrowest_mode as + const. Kill all references to EXTRA_CC_MODES. + + * toplev.c: Don't prototype or call init_rtl. + * optabs.c: Don't call init_mov_optab. + * genemit.c: Don't generate init_mov_optab. Don't call + init_rtl. + * gengenrtl.c: Duplicate calculation of CONST_DOUBLE_FORMAT + here. + * genattr.c, genattrtab.c, gencodes.c, genconfig.c, + genextract.c, genflags.c, genopinit.c, genoutput.c, genpeep.c, + genrecog.c: Don't call init_rtl. + + * arc.h, arm.h, c4x.h, i386.h, i960.h, m88k.h, pa.h, pdp11.h, + rs6000.h, sparc.h: Don't define EXTRA_CC_NAMES. Use CC() in + definition of EXTRA_CC_MODES. + + * md.texi: Kill ref to EXTRA_CC_NAMES. + * tm.texi: Document new way to define EXTRA_CC_MODES. + + * genrecog.c: Do not look up the name of a define_split. + (Unrelated bugfix.) + Fri Aug 27 17:03:42 1999 Nick Clifton <nickc@cygnus.com> * config/v850/v850.md: Fix typo introduced by previous delta. diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index 6eee0381989..10a163bad9a 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -1047,9 +1047,9 @@ do { \ /* Some insns set all condition code flags, some only set the ZNC flags, and some only set the ZN flags. */ -#define EXTRA_CC_MODES CCZNCmode, CCZNmode - -#define EXTRA_CC_NAMES "CCZNC", "CCZN" +#define EXTRA_CC_MODES \ + CC(CCZNCmode, "CCZNC") \ + CC(CCZNmode, "CCZN") /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, return the mode to be used for the comparison. */ diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 127dc75cc2a..e5c89e78fbf 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1889,14 +1889,23 @@ extern int making_const_table; CC_Zmode should be used if only the Z flag is set correctly CCmode should be used otherwise. */ -#define EXTRA_CC_MODES CC_NOOVmode, CC_Zmode, CC_SWPmode, \ - CCFPmode, CCFPEmode, CC_DNEmode, CC_DEQmode, CC_DLEmode, \ - CC_DLTmode, CC_DGEmode, CC_DGTmode, CC_DLEUmode, CC_DLTUmode, \ - CC_DGEUmode, CC_DGTUmode, CC_Cmode - -#define EXTRA_CC_NAMES "CC_NOOV", "CC_Z", "CC_SWP", "CCFP", "CCFPE", \ - "CC_DNE", "CC_DEQ", "CC_DLE", "CC_DLT", "CC_DGE", "CC_DGT", "CC_DLEU", \ - "CC_DLTU", "CC_DGEU", "CC_DGTU", "CC_C" +#define EXTRA_CC_MODES \ + CC(CC_NOOVmode, "CC_NOOV") \ + CC(CC_Zmode, "CC_Z") \ + CC(CC_SWPmode, "CC_SWP") \ + CC(CCFPmode, "CCFP") \ + CC(CCFPEmode, "CCFPE") \ + CC(CC_DNEmode, "CC_DNE") \ + CC(CC_DEQmode, "CC_DEQ") \ + CC(CC_DLEmode, "CC_DLE") \ + CC(CC_DLTmode, "CC_DLT") \ + CC(CC_DGEmode, "CC_DGE") \ + CC(CC_DGTmode, "CC_DGT") \ + CC(CC_DLEUmode, "CC_DLEU") \ + CC(CC_DLTUmode, "CC_DLTU") \ + CC(CC_DGEUmode, "CC_DGEU") \ + CC(CC_DGTUmode, "CC_DGTU") \ + CC(CC_Cmode, "CC_C") #define SELECT_CC_MODE(OP,X,Y) arm_select_cc_mode ((OP), (X), (Y)) diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 02f5cbf977f..2d019b5304e 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -1532,11 +1532,7 @@ extern struct rtx_def *c4x_function_arg(); load instructions after an add, subtract, neg, abs or multiply. We must emit a compare insn to check the result against 0. */ -#define EXTRA_CC_MODES CC_NOOVmode - -/* Define the names for the modes specified above. */ - -#define EXTRA_CC_NAMES "CC_NOOV" +#define EXTRA_CC_MODES CC(CC_NOOVmode, "CC_NOOV") /* CC_NOOVmode should be used when the first operand is a PLUS, MINUS, NEG or MULT. diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 7fbfede46ff..827d021e5fe 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2299,10 +2299,7 @@ while (0) For the i386, we need separate modes when floating-point equality comparisons are being done. */ -#define EXTRA_CC_MODES CCFPEQmode - -/* Define the names for the modes specified above. */ -#define EXTRA_CC_NAMES "CCFPEQ" +#define EXTRA_CC_MODES CC(CCFPEQmode, "CCFPEQ") /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, return the mode to be used for the comparison. diff --git a/gcc/config/i960/i960.h b/gcc/config/i960/i960.h index 357ccdc80a7..e273438ca28 100644 --- a/gcc/config/i960/i960.h +++ b/gcc/config/i960/i960.h @@ -1237,10 +1237,9 @@ extern struct rtx_def *gen_compare_reg (); Also, signed and unsigned comparisons are distinguished, as are operations which are compatible with chkbit insns. */ -#define EXTRA_CC_MODES CC_UNSmode, CC_CHKmode - -/* Define the names for the modes specified above. */ -#define EXTRA_CC_NAMES "CC_UNS", "CC_CHK" +#define EXTRA_CC_MODES \ + CC(CC_UNSmode, "CC_UNS") \ + CC(CC_CHKmode, "CC_CHK") /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, return the mode to be used for the comparison. For floating-point, CCFPmode diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h index 068db8498e9..5017d8d901b 100644 --- a/gcc/config/m88k/m88k.h +++ b/gcc/config/m88k/m88k.h @@ -1252,9 +1252,7 @@ extern struct rtx_def *m88k_va_arg (); /*** Addressing Modes ***/ -#define EXTRA_CC_MODES CCEVENmode - -#define EXTRA_CC_NAMES "CCEVEN" +#define EXTRA_CC_MODES CC(CCEVENmode, "CCEVEN") #define SELECT_CC_MODE(OP,X,Y) CCmode diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 17115382938..3f993e11971 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -1710,10 +1710,7 @@ while (0) /* Add any extra modes needed to represent the condition code. HPPA floating comparisons produce condition codes. */ -#define EXTRA_CC_MODES CCFPmode - -/* Define the names for the modes specified above. */ -#define EXTRA_CC_NAMES "CCFP" +#define EXTRA_CC_MODES CC(CCFPmode, "CCFP") /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, return the mode to be used for the comparison. For floating-point, CCFPmode diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h index 746a8e4d27c..2a1d936f6e4 100644 --- a/gcc/config/pdp11/pdp11.h +++ b/gcc/config/pdp11/pdp11.h @@ -944,10 +944,7 @@ extern int may_call_alloca; /* Add any extra modes needed to represent the condition code. CCFPmode is used for FPU, but should we use a separate reg? */ -#define EXTRA_CC_MODES CCFPmode - -/* the name for the mode above */ -#define EXTRA_CC_NAMES "CCFPmode" +#define EXTRA_CC_MODES CC(CCFPmode, "CCFP") /* Give a comparison code (EQ, NE etc) and the first operand of a COMPARE, return the mode to be used for the comparison. For floating-point, CCFPmode diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 22cf7f2572d..79ab635c2eb 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -2412,10 +2412,10 @@ do { \ use a mode for the case when we are comparing the results of two comparisons. */ -#define EXTRA_CC_MODES CCUNSmode, CCFPmode, CCEQmode - -/* Define the names for the modes specified above. */ -#define EXTRA_CC_NAMES "CCUNS", "CCFP", "CCEQ" +#define EXTRA_CC_MODES \ + CC(CCUNSmode, "CCUNS") \ + CC(CCFPmode, "CCFP") \ + CC(CCEQmode, "CCEQ") /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, return the mode to be used for the comparison. For floating-point, CCFPmode diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 82e3727c8c5..20ba7dca730 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -2566,11 +2566,12 @@ do { \ CCXmode and CCX_NOOVmode are only used by v9. */ -#define EXTRA_CC_MODES CCXmode, CC_NOOVmode, CCX_NOOVmode, CCFPmode, CCFPEmode - -/* Define the names for the modes specified above. */ - -#define EXTRA_CC_NAMES "CCX", "CC_NOOV", "CCX_NOOV", "CCFP", "CCFPE" +#define EXTRA_CC_MODES \ + CC(CCXmode, "CCX") \ + CC(CC_NOOVmode, "CC_NOOV") \ + CC(CCX_NOOVmode, "CCX_NOOV") \ + CC(CCFPmode, "CCFP") \ + CC(CCFPEmode, "CCFPE") /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, return the mode to be used for the comparison. For floating-point, diff --git a/gcc/genattr.c b/gcc/genattr.c index 02e0be8e8e3..60dc73aefc2 100644 --- a/gcc/genattr.c +++ b/gcc/genattr.c @@ -258,8 +258,6 @@ main (argc, argv) exit (FATAL_EXIT_CODE); } - init_rtl (); - printf ("/* Generated automatically by the program `genattr'\n\ from the machine description file `md'. */\n\n"); diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index 4b362750662..5c1a3be73ec 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -5982,8 +5982,6 @@ main (argc, argv) exit (FATAL_EXIT_CODE); } - init_rtl (); - /* Set up true and false rtx's */ true_rtx = rtx_alloc (CONST_INT); XWINT (true_rtx, 0) = 1; diff --git a/gcc/gencodes.c b/gcc/gencodes.c index 1fa8700dd33..c737e2a6d30 100644 --- a/gcc/gencodes.c +++ b/gcc/gencodes.c @@ -101,8 +101,6 @@ main (argc, argv) exit (FATAL_EXIT_CODE); } - init_rtl (); - printf ("/* Generated automatically by the program `gencodes'\n\ from the machine description file `md'. */\n\n"); diff --git a/gcc/genconfig.c b/gcc/genconfig.c index bbe707cf029..8f4568d37ad 100644 --- a/gcc/genconfig.c +++ b/gcc/genconfig.c @@ -290,8 +290,6 @@ main (argc, argv) exit (FATAL_EXIT_CODE); } - init_rtl (); - printf ("/* Generated automatically by the program `genconfig'\n\ from the machine description file `md'. */\n\n"); diff --git a/gcc/genemit.c b/gcc/genemit.c index 161aeff6da6..dc9a49af9d6 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -643,40 +643,6 @@ output_add_clobbers () printf ("}\n"); } -/* Write a function, init_mov_optab, that is called to set up entries - in mov_optab for EXTRA_CC_MODES. */ - -static void -output_init_mov_optab () -{ -#ifdef EXTRA_CC_NAMES - static char *cc_names[] = { EXTRA_CC_NAMES }; - char *p; - size_t i; - - printf ("\nvoid\ninit_mov_optab ()\n{\n"); - - for (i = 0; i < sizeof cc_names / sizeof cc_names[0]; i++) - { - printf ("#ifdef HAVE_mov"); - for (p = cc_names[i]; *p; p++) - printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p); - printf ("\n"); - printf (" if (HAVE_mov"); - for (p = cc_names[i]; *p; p++) - printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p); - printf (")\n"); - printf (" mov_optab->handlers[(int) %smode].insn_code = CODE_FOR_mov", - cc_names[i]); - for (p = cc_names[i]; *p; p++) - printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p); - printf (";\n#endif\n"); - } - - printf ("}\n"); -#endif -} - PTR xmalloc (size) size_t size; @@ -726,8 +692,6 @@ main (argc, argv) exit (FATAL_EXIT_CODE); } - init_rtl (); - /* Assign sequential codes to all entries in the machine description in parallel with the tables in insn-output.c. */ @@ -790,9 +754,6 @@ from the machine description file `md'. */\n\n"); /* Write out the routine to add CLOBBERs to a pattern. */ output_add_clobbers (); - /* Write the routine to initialize mov_optab for the EXTRA_CC_MODES. */ - output_init_mov_optab (); - fflush (stdout); exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); /* NOTREACHED */ diff --git a/gcc/genextract.c b/gcc/genextract.c index 2f791a35198..d3b2061ba4e 100644 --- a/gcc/genextract.c +++ b/gcc/genextract.c @@ -402,8 +402,6 @@ main (argc, argv) exit (FATAL_EXIT_CODE); } - init_rtl (); - /* Assign sequential codes to all entries in the machine description in parallel with the tables in insn-output.c. */ diff --git a/gcc/genflags.c b/gcc/genflags.c index 4602ea404dc..b1fa6bb8424 100644 --- a/gcc/genflags.c +++ b/gcc/genflags.c @@ -227,8 +227,6 @@ main (argc, argv) exit (FATAL_EXIT_CODE); } - init_rtl (); - printf ("/* Generated automatically by the program `genflags'\n\ from the machine description file `md'. */\n\n"); diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c index e07b9402c88..762c96fa4e4 100644 --- a/gcc/gengenrtl.c +++ b/gcc/gengenrtl.c @@ -26,6 +26,27 @@ Boston, MA 02111-1307, USA. */ #include "rtl.h" #undef abort +#include "real.h" + +/* Calculate the format for CONST_DOUBLE. This depends on the relative + widths of HOST_WIDE_INT and REAL_VALUE_TYPE. + We only need to go out to e0wwww, since min(HOST_WIDE_INT)==32 and + max(LONG_DOUBLE_TYPE_SIZE)==128. + This is duplicated in rtl.c. + A number of places assume that there are always at least two 'w' + slots in a CONST_DOUBLE, so we provide them even if one would suffice. */ +#if HOST_BITS_PER_WIDE_INT >= LONG_DOUBLE_TYPE_SIZE +#define CONST_DOUBLE_FORMAT "e0ww" +#elif HOST_BITS_PER_WIDE_INT*2 >= LONG_DOUBLE_TYPE_SIZE +#define CONST_DOUBLE_FORMAT "e0ww" +#elif HOST_BITS_PER_WIDE_INT*3 >= LONG_DOUBLE_TYPE_SIZE +#define CONST_DOUBLE_FORMAT "e0www" +#elif HOST_BITS_PER_WIDE_INT*4 >= LONG_DOUBLE_TYPE_SIZE +#define CONST_DOUBLE_FORMAT "e0wwww" +#else +#define CONST_DOUBLE_FORMAT /* nothing - will cause syntax error */ +#endif + struct rtx_definition { diff --git a/gcc/genopinit.c b/gcc/genopinit.c index a68c27b2720..249500549e9 100644 --- a/gcc/genopinit.c +++ b/gcc/genopinit.c @@ -326,8 +326,6 @@ main (argc, argv) exit (FATAL_EXIT_CODE); } - init_rtl (); - printf ("/* Generated automatically by the program `genopinit'\n\ from the machine description file `md'. */\n\n"); diff --git a/gcc/genoutput.c b/gcc/genoutput.c index ecdc304f4c8..c0a4cf58163 100644 --- a/gcc/genoutput.c +++ b/gcc/genoutput.c @@ -162,10 +162,6 @@ struct data *end_of_insn_data; int have_constraints; -/* Nonzero if some error has occurred. We will make all errors fatal, but - might as well continue until we see all of them. */ - -static int have_error; static char * name_for_index PROTO((int)); static void output_prologue PROTO((void)); @@ -951,8 +947,6 @@ main (argc, argv) exit (FATAL_EXIT_CODE); } - init_rtl (); - output_prologue (); next_code_number = 0; next_index_number = 0; diff --git a/gcc/genpeep.c b/gcc/genpeep.c index 9b6c4920e77..3a877fe6cc0 100644 --- a/gcc/genpeep.c +++ b/gcc/genpeep.c @@ -431,8 +431,6 @@ main (argc, argv) exit (FATAL_EXIT_CODE); } - init_rtl (); - printf ("/* Generated automatically by the program `genpeep'\n\ from the machine description file `md'. */\n\n"); diff --git a/gcc/genrecog.c b/gcc/genrecog.c index d8bd74a2f0c..166fc7a0e25 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -213,7 +213,7 @@ make_insn_sequence (insn, type) { static const char *last_real_name = "insn"; static int last_real_code = 0; - char *name; + char *name = 0; if (insn_name_ptr_size <= next_insn_code) { @@ -226,7 +226,8 @@ make_insn_sequence (insn, type) insn_name_ptr_size = new_size; } - name = XSTR (insn, 0); + if (type == RECOG) + name = XSTR (insn, 0); if (!name || name[0] == '\0') { name = xmalloc (strlen (last_real_name) + 10); @@ -1733,7 +1734,6 @@ main (argc, argv) exit (FATAL_EXIT_CODE); } - init_rtl (); next_insn_code = 0; next_index = 0; diff --git a/gcc/machmode.def b/gcc/machmode.def index ab2215ed8c0..a2258aae371 100644 --- a/gcc/machmode.def +++ b/gcc/machmode.def @@ -106,11 +106,20 @@ DEF_MACHMODE (BLKmode, "BLK", MODE_RANDOM, 0, 0, VOIDmode) /* The modes for representing the condition codes come last. CCmode is always defined. Additional modes for the condition code can be specified - in the EXTRA_CC_MODES macro. Everything but the names of the modes - are copied from CCmode. For these modes, GET_MODE_WIDER_MODE points - to the next defined CC mode, if any. */ + in the EXTRA_CC_MODES macro. + All MODE_CC modes are the same width as SImode and have VOIDmode as their + next wider mode. +*/ + +#define CC(E, M) DEF_MACHMODE (E, M, MODE_CC, 4, 4, VOIDmode) + +CC (CCmode, "CC") + +#ifdef EXTRA_CC_MODES +EXTRA_CC_MODES +#endif -DEF_MACHMODE (CCmode, "CC", MODE_CC, 4, 4, VOIDmode) +#undef CC /* The symbol Pmode stands for one of the above machine modes (usually SImode). The tm file specifies which one. It is not a distinct mode. */ diff --git a/gcc/machmode.h b/gcc/machmode.h index 756559181ea..79ab7b046eb 100644 --- a/gcc/machmode.h +++ b/gcc/machmode.h @@ -42,10 +42,6 @@ Boston, MA 02111-1307, USA. */ enum machine_mode { #include "machmode.def" - -#ifdef EXTRA_CC_MODES - EXTRA_CC_MODES, -#endif MAX_MACHINE_MODE }; #undef DEF_MACHMODE @@ -65,7 +61,7 @@ enum mode_class { MODE_RANDOM, MODE_INT, MODE_FLOAT, MODE_PARTIAL_INT, MODE_CC, /* Get the general kind of object that mode MODE represents (integer, floating, complex, etc.) */ -extern enum mode_class mode_class[]; +extern const enum mode_class mode_class[]; #define GET_MODE_CLASS(MODE) (mode_class[(int) (MODE)]) /* Nonzero if MODE is an integral mode. */ @@ -86,12 +82,12 @@ extern enum mode_class mode_class[]; /* Get the size in bytes of an object of mode MODE. */ -extern int mode_size[]; +extern const int mode_size[]; #define GET_MODE_SIZE(MODE) (mode_size[(int) (MODE)]) /* Get the size in bytes of the basic parts of an object of mode MODE. */ -extern int mode_unit_size[]; +extern const int mode_unit_size[]; #define GET_MODE_UNIT_SIZE(MODE) (mode_unit_size[(int) (MODE)]) /* Get the number of units in the object. */ @@ -109,7 +105,7 @@ extern int mode_unit_size[]; /* Get a bitmask containing 1 for all bits in a word that fit within mode MODE. */ -extern unsigned HOST_WIDE_INT mode_mask_array[]; +extern const unsigned HOST_WIDE_INT mode_mask_array[]; #define GET_MODE_MASK(MODE) mode_mask_array[(int) (MODE)] @@ -117,7 +113,7 @@ extern unsigned HOST_WIDE_INT mode_mask_array[]; /* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI). */ -extern unsigned char mode_wider_mode[]; +extern const unsigned char mode_wider_mode[]; #define GET_MODE_WIDER_MODE(MODE) ((enum machine_mode)mode_wider_mode[(int) (MODE)]) /* Return the mode for data of a given size SIZE and mode class CLASS. @@ -149,7 +145,7 @@ extern enum machine_mode get_best_mode PROTO((int, int, int, enum machine_mode, /* For each class, get the narrowest mode in that class. */ -extern enum machine_mode class_narrowest_mode[]; +extern const enum machine_mode class_narrowest_mode[]; #define GET_CLASS_NARROWEST_MODE(CLASS) class_narrowest_mode[(int) (CLASS)] /* Define the integer modes whose sizes are BITS_PER_UNIT and BITS_PER_WORD diff --git a/gcc/md.texi b/gcc/md.texi index 13dc4421ae6..c300c299ef7 100644 --- a/gcc/md.texi +++ b/gcc/md.texi @@ -2787,7 +2787,6 @@ is in class @code{MODE_CC}. Normally, it will be @code{CCmode}. If additional modes are required (as for the add example mentioned above in the Sparc), define the macro @code{EXTRA_CC_MODES} to list the additional modes required (@pxref{Condition Code}). Also define -@code{EXTRA_CC_NAMES} to list the names of those modes and @code{SELECT_CC_MODE} to choose a mode given an operand of a compare. If it is known during RTL generation that a different mode will be diff --git a/gcc/optabs.c b/gcc/optabs.c index f8409374409..82bfc6a4e12 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -4612,10 +4612,6 @@ init_optabs () fixtrunctab[i][j][1] = fixtrunctab[i][j][0]; #endif -#ifdef EXTRA_CC_MODES - init_mov_optab (); -#endif - /* Initialize the optabs with the names of the library functions. */ init_integral_libfuncs (add_optab, "add", '3'); init_floating_libfuncs (add_optab, "add", '3'); diff --git a/gcc/rtl.c b/gcc/rtl.c index e50d5a759c7..e13e4d2bfb0 100644 --- a/gcc/rtl.c +++ b/gcc/rtl.c @@ -41,11 +41,36 @@ Boston, MA 02111-1307, USA. */ extern struct obstack *rtl_obstack; + +/* Calculate the format for CONST_DOUBLE. This depends on the relative + widths of HOST_WIDE_INT and REAL_VALUE_TYPE. + We only need to go out to e0wwww, since min(HOST_WIDE_INT)==32 and + max(LONG_DOUBLE_TYPE_SIZE)==128. + This is duplicated in gengenrtl.c. + A number of places assume that there are always at least two 'w' + slots in a CONST_DOUBLE, so we provide them even if one would suffice. */ +#if HOST_BITS_PER_WIDE_INT >= LONG_DOUBLE_TYPE_SIZE +#define CONST_DOUBLE_FORMAT "e0ww" +#elif HOST_BITS_PER_WIDE_INT*2 >= LONG_DOUBLE_TYPE_SIZE +#define CONST_DOUBLE_FORMAT "e0ww" +#elif HOST_BITS_PER_WIDE_INT*3 >= LONG_DOUBLE_TYPE_SIZE +#define CONST_DOUBLE_FORMAT "e0www" +#elif HOST_BITS_PER_WIDE_INT*4 >= LONG_DOUBLE_TYPE_SIZE +#define CONST_DOUBLE_FORMAT "e0wwww" +#else +#define CONST_DOUBLE_FORMAT /* nothing - will cause syntax error */ +#endif + /* Indexed by rtx code, gives number of operands for an rtx with that code. - Does NOT include rtx header data (code and links). - This array is initialized in init_rtl. */ + Does NOT include rtx header data (code and links). */ -int rtx_length[NUM_RTX_CODE + 1]; +#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) sizeof FORMAT - 1 , + +const int rtx_length[NUM_RTX_CODE + 1] = { +#include "rtl.def" +}; + +#undef DEF_RTL_EXPR /* Indexed by rtx code, gives the name of that kind of rtx, as a C string. */ @@ -64,10 +89,6 @@ const char * const rtx_name[] = { const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = { #include "machmode.def" - -#ifdef EXTRA_CC_MODES - EXTRA_CC_NAMES, -#endif /* Add an extra field to avoid a core dump if someone tries to convert MAX_MACHINE_MODE to a string. */ "" @@ -80,7 +101,7 @@ const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = { #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) CLASS, -enum mode_class mode_class[(int) MAX_MACHINE_MODE] = { +const enum mode_class mode_class[(int) MAX_MACHINE_MODE] = { #include "machmode.def" }; @@ -91,7 +112,7 @@ enum mode_class mode_class[(int) MAX_MACHINE_MODE] = { #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) SIZE, -int mode_size[(int) MAX_MACHINE_MODE] = { +const int mode_size[(int) MAX_MACHINE_MODE] = { #include "machmode.def" }; @@ -102,7 +123,7 @@ int mode_size[(int) MAX_MACHINE_MODE] = { #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) UNIT, -int mode_unit_size[(int) MAX_MACHINE_MODE] = { +const int mode_unit_size[(int) MAX_MACHINE_MODE] = { #include "machmode.def" /* machine modes are documented here */ }; @@ -115,7 +136,7 @@ int mode_unit_size[(int) MAX_MACHINE_MODE] = { #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) \ (unsigned char) WIDER, -unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = { +const unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = { #include "machmode.def" /* machine modes are documented here */ }; @@ -126,19 +147,30 @@ unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = { /* Indexed by machine mode, gives mask of significant bits in mode. */ -unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = { +const unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = { #include "machmode.def" }; -/* Indexed by mode class, gives the narrowest mode for each class. */ - -enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS]; +/* Indexed by mode class, gives the narrowest mode for each class. + The Q modes are always of width 1 (2 for complex) - it is impossible + for any mode to be narrower. */ + +const enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS] = { + /* MODE_RANDOM */ VOIDmode, + /* MODE_INT */ QImode, + /* MODE_FLOAT */ QFmode, + /* MODE_PARTIAL_INT */ PQImode, + /* MODE_CC */ CCmode, + /* MODE_COMPLEX_INT */ CQImode, + /* MODE_COMPLEX_FLOAT */ QCmode +}; + /* Indexed by rtx code, gives a sequence of operand-types for rtx's of that code. The sequence is a C string in which each character describes one operand. */ -const char *rtx_format[] = { +const char * const rtx_format[] = { /* "*" undefined. can cause a warning message "0" field is unused (or used in a phase-dependent manner) @@ -901,71 +933,6 @@ read_rtx (infile) return return_rtx; } - -/* This is called once per compilation, before any rtx's are constructed. - It initializes the vector `rtx_length', the extra CC modes, if any, - and computes certain commonly-used modes. */ - -void -init_rtl () -{ - int min_class_size[(int) MAX_MODE_CLASS]; - enum machine_mode mode; - int i; - - for (i = 0; i < NUM_RTX_CODE; i++) - rtx_length[i] = strlen (GET_RTX_FORMAT(i)); - - /* Make CONST_DOUBLE bigger, if real values are bigger than - it normally expects to have room for. - Note that REAL_VALUE_TYPE is not defined by default, - since tree.h is not included. But the default dfn as `double' - would do no harm. */ -#ifdef REAL_VALUE_TYPE - i = sizeof (REAL_VALUE_TYPE) / sizeof (rtunion) + 2; - if (rtx_length[(int) CONST_DOUBLE] < i) - { - char *s = (char *) xmalloc (i + 1); - rtx_length[(int) CONST_DOUBLE] = i; - rtx_format[(int) CONST_DOUBLE] = s; - *s++ = 'e'; - *s++ = '0'; - /* Set the GET_RTX_FORMAT of CONST_DOUBLE to a string - of as many `w's as we now have elements. Subtract two from - the size to account for the 'e' and the '0'. */ - for (i = 2; i < rtx_length[(int) CONST_DOUBLE]; i++) - *s++ = 'w'; - *s++ = 0; - } -#endif - -#ifdef EXTRA_CC_MODES - for (i = (int) CCmode + 1; i < (int) MAX_MACHINE_MODE; i++) - { - mode_class[i] = MODE_CC; - mode_mask_array[i] = mode_mask_array[(int) CCmode]; - mode_size[i] = mode_size[(int) CCmode]; - mode_unit_size[i] = mode_unit_size[(int) CCmode]; - mode_wider_mode[i - 1] = i; - mode_wider_mode[i] = (unsigned char)VOIDmode; - } -#endif - - /* Find the narrowest mode for each class. */ - - for (i = 0; i < (int) MAX_MODE_CLASS; i++) - min_class_size[i] = 1000; - - for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE; - mode = (enum machine_mode) ((int) mode + 1)) - { - if (GET_MODE_SIZE (mode) < min_class_size[(int) GET_MODE_CLASS (mode)]) - { - class_narrowest_mode[(int) GET_MODE_CLASS (mode)] = mode; - min_class_size[(int) GET_MODE_CLASS (mode)] = GET_MODE_SIZE (mode); - } - } -} /* These are utility functions used by fatal-error functions all over the code. rtl.c happens to be linked by all the programs that need them, @@ -980,7 +947,7 @@ static const char * trim_filename (name) const char *name; { - static const char *this_file = __FILE__; + static const char this_file[] = __FILE__; const char *p = name, *q = this_file; while (*p == *q && *p != 0 && *q != 0) p++, q++; diff --git a/gcc/rtl.def b/gcc/rtl.def index 4a8e8d6fa1b..357585e37f9 100644 --- a/gcc/rtl.def +++ b/gcc/rtl.def @@ -509,14 +509,15 @@ DEF_RTL_EXPR(TRAP_IF, "trap_if", "ee", 'x') /* numeric integer constant */ DEF_RTL_EXPR(CONST_INT, "const_int", "w", 'o') -/* numeric double constant. - Operand 0 is the MEM that stores this constant in memory, - or various other things (see comments at immed_double_const in varasm.c). - Operand 1 is a chain of all CONST_DOUBLEs in use in the current function. - Remaining operands hold the actual value. - The number of operands may be more than 2 if cross-compiling; - see init_rtl. */ -DEF_RTL_EXPR(CONST_DOUBLE, "const_double", "e0ww", 'o') +/* numeric floating point constant. + Operand 0 ('e') is the MEM that stores this constant in memory, or + various other things (see comments at immed_double_const in + varasm.c). + Operand 1 ('0') is a chain of all CONST_DOUBLEs in use in the + current function. + Remaining operands hold the actual value. They are all 'w' and + there may be from 1 to 4; see rtl.c. */ +DEF_RTL_EXPR(CONST_DOUBLE, "const_double", CONST_DOUBLE_FORMAT, 'o') /* String constant. Used only for attributes right now. */ DEF_RTL_EXPR(CONST_STRING, "const_string", "s", 'o') diff --git a/gcc/rtl.h b/gcc/rtl.h index c8c25d4e4fb..837dad1af6d 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -48,13 +48,13 @@ enum rtx_code { #define NUM_RTX_CODE ((int)LAST_AND_UNUSED_RTX_CODE) /* The cast here, saves many elsewhere. */ -extern int rtx_length[]; +extern const int rtx_length[]; #define GET_RTX_LENGTH(CODE) (rtx_length[(int) (CODE)]) extern const char * const rtx_name[]; #define GET_RTX_NAME(CODE) (rtx_name[(int) (CODE)]) -extern const char *rtx_format[]; +extern const char * const rtx_format[]; #define GET_RTX_FORMAT(CODE) (rtx_format[(int) (CODE)]) extern const char rtx_class[]; diff --git a/gcc/tm.texi b/gcc/tm.texi index c3e3c271f68..0ed550a5163 100644 --- a/gcc/tm.texi +++ b/gcc/tm.texi @@ -4498,27 +4498,24 @@ two places, the @file{md} file and in @code{NOTICE_UPDATE_CC}. @findex EXTRA_CC_MODES @item EXTRA_CC_MODES -A list of names to be used for additional modes for condition code -values in registers (@pxref{Jump Patterns}). These names are added -to @code{enum machine_mode} and all have class @code{MODE_CC}. By -convention, they should start with @samp{CC} and end with @samp{mode}. +A list of additional modes for condition code values in registers +(@pxref{Jump Patterns}). This macro should expand to a sequence of +calls of the macro @code{CC} separated by white space. @code{CC} takes +two arguments. The first is the enumeration name of the mode, which +should begin with @samp{CC} and end with @samp{mode}. The second is a C +string giving the printable name of the mode; it should be the same as +the first argument, but with the trailing @samp{mode} removed. -You should only define this macro if your machine does not use @code{cc0} -and only if additional modes are required. - -@findex EXTRA_CC_NAMES -@item EXTRA_CC_NAMES -A list of C strings giving the names for the modes listed in -@code{EXTRA_CC_MODES}. For example, the Sparc defines this macro and -@code{EXTRA_CC_MODES} as +You should only define this macro if additional modes are required. +A sample definition of @code{EXTRA_CC_MODES} is: @smallexample -#define EXTRA_CC_MODES CC_NOOVmode, CCFPmode, CCFPEmode -#define EXTRA_CC_NAMES "CC_NOOV", "CCFP", "CCFPE" +#define EXTRA_CC_MODES \ + CC(CC_NOOVmode, "CC_NOOV") \ + CC(CCFPmode, "CCFP") \ + CC(CCFPEmode, "CCFPE") @end smallexample -This macro is not required if @code{EXTRA_CC_MODES} is not defined. - @findex SELECT_CC_MODE @item SELECT_CC_MODE (@var{op}, @var{x}, @var{y}) Returns a mode from class @code{MODE_CC} to be used when comparison diff --git a/gcc/toplev.c b/gcc/toplev.c index 5acf1312d83..112c89133b4 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -153,7 +153,6 @@ extern void finish_parse (); extern void init_decl_processing (); extern void init_obstacks (); extern void init_tree_codes (); -extern void init_rtl (); extern void init_regs (); extern void init_optabs (); extern void init_stmt (); @@ -2895,7 +2894,6 @@ compile_file (name) init_obstacks (); init_tree_codes (); name = init_parse (name); - init_rtl (); init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL || debug_info_level == DINFO_LEVEL_VERBOSE || flag_test_coverage |