]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/genrecog.c
PR fortran/95090 - ICE: identifier overflow
[thirdparty/gcc.git] / gcc / genrecog.c
index 31bf0fe7b2e727a239f90d8b6ceb461b752fc854..bc371b1903c65197dc5c42e0f5b655041dc260d7 100644 (file)
@@ -1,5 +1,5 @@
 /* Generate code from machine description to recognize rtl as insns.
-   Copyright (C) 1987-2018 Free Software Foundation, Inc.
+   Copyright (C) 1987-2020 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -746,14 +746,20 @@ validate_pattern (rtx pattern, md_rtx_info *info, rtx set, int set_code)
            = VECTOR_MODE_P (mode) ? GET_MODE_INNER (mode) : mode;
          if (GET_CODE (XEXP (pattern, 1)) == PARALLEL)
            {
-             int expected = VECTOR_MODE_P (mode) ? GET_MODE_NUNITS (mode) : 1;
-             if (XVECLEN (XEXP (pattern, 1), 0) != expected)
+             int expected = 1;
+             unsigned int nelems;
+             if (VECTOR_MODE_P (mode)
+                 && !GET_MODE_NUNITS (mode).is_constant (&expected))
+               error_at (info->loc,
+                         "vec_select with variable-sized mode %s",
+                         GET_MODE_NAME (mode));
+             else if (XVECLEN (XEXP (pattern, 1), 0) != expected)
                error_at (info->loc,
                          "vec_select parallel with %d elements, expected %d",
                          XVECLEN (XEXP (pattern, 1), 0), expected);
-             else if (VECTOR_MODE_P (imode))
+             else if (VECTOR_MODE_P (imode)
+                      && GET_MODE_NUNITS (imode).is_constant (&nelems))
                {
-                 unsigned int nelems = GET_MODE_NUNITS (imode);
                  int i;
                  for (i = 0; i < expected; ++i)
                    if (CONST_INT_P (XVECEXP (XEXP (pattern, 1), 0, i))
@@ -811,11 +817,13 @@ validate_pattern (rtx pattern, md_rtx_info *info, rtx set, int set_code)
    to "T *prev, *next;" and a function "void set_parent (list_head <T> *)"
    to set the parent list.  */
 template <typename T>
-struct list_head
+class list_head
 {
+public:
   /* A range of linked items.  */
-  struct range
+  class range
   {
+  public:
     range (T *);
     range (T *, T *);
 
@@ -941,7 +949,7 @@ list_head <T>::singleton () const
   return first == last ? first : 0;
 }
 \f
-struct state;
+class state;
 
 /* Describes a possible successful return from a routine.  */
 struct acceptance_type
@@ -1001,8 +1009,9 @@ operator != (const acceptance_type &a, const acceptance_type &b)
 }
 
 /* Represents a parameter to a pattern routine.  */
-struct parameter
+class parameter
 {
+public:
   /* The C type of parameter.  */
   enum type_enum {
     /* Represents an invalid parameter.  */
@@ -1062,8 +1071,9 @@ operator != (const parameter &param1, const parameter &param2)
    an ad-hoc enum value on success and -1 on failure.  The routine can
    be used by any subroutine type.  The match can be parameterized by
    things like mode, code and UNSPEC number.  */
-struct pattern_routine
+class pattern_routine
 {
+public:
   /* The state that implements the pattern.  */
   state *s;
 
@@ -1089,8 +1099,9 @@ struct pattern_routine
 static vec <pattern_routine *> patterns;
 
 /* Represents one use of a pattern routine.  */
-struct pattern_use
+class pattern_use
 {
+public:
   /* The pattern routine to use.  */
   pattern_routine *routine;
 
@@ -1100,8 +1111,9 @@ struct pattern_use
 };
 
 /* Represents a test performed by a decision.  */
-struct rtx_test
+class rtx_test
 {
+public:
   rtx_test ();
 
   /* The types of test that can be performed.  Most of them take as input
@@ -1420,8 +1432,9 @@ operator != (const rtx_test &a, const rtx_test &b)
 
 /* A simple set of transition labels.  Most transitions have a singleton
    label, so try to make that case as efficient as possible.  */
-struct int_set : public auto_vec <uint64_t, 1>
+class int_set : public auto_vec <uint64_t, 1>
 {
+public:
   typedef uint64_t *iterator;
 
   int_set ();
@@ -1485,12 +1498,13 @@ operator != (const int_set &a, const int_set &b)
   return !operator == (a, b);
 }
 
-struct decision;
+class decision;
 
 /* Represents a transition between states, dependent on the result of
    a test T.  */
-struct transition
+class transition
 {
+public:
   transition (const int_set &, state *, bool);
 
   void set_parent (list_head <transition> *);
@@ -1529,8 +1543,9 @@ struct transition
    to the transition's target state.  If no suitable transition exists,
    the machine either falls through to the next decision or, if there are no
    more decisions to try, fails the match.  */
-struct decision : list_head <transition>
+class decision : public list_head <transition>
 {
+public:
   decision (const rtx_test &);
 
   void set_parent (list_head <decision> *s);
@@ -1549,8 +1564,9 @@ struct decision : list_head <transition>
 /* Represents one machine state.  For each state the machine tries a list
    of decisions, in order, and acts on the first match.  It fails without
    further backtracking if no decisions match.  */
-struct state : list_head <decision>
+class state : public list_head <decision>
 {
+public:
   void set_parent (list_head <state> *) {}
 };
 
@@ -1760,8 +1776,9 @@ const unsigned char TESTED_CODE = 1;
 const unsigned char TESTED_VECLEN = 2;
 
 /* Represents a set of conditions that are known to hold.  */
-struct known_conditions
+class known_conditions
 {
+public:
   /* A mask of TESTED_ values for each position, indexed by the position's
      id field.  */
   auto_vec <unsigned char> position_tests;
@@ -2088,8 +2105,9 @@ find_operand_positions (state *s, vec <int> &operand_pos)
 }
 
 /* Statistics about a matching routine.  */
-struct stats
+class stats
 {
+public:
   stats ();
 
   /* The total number of decisions in the routine, excluding trivial
@@ -2225,11 +2243,12 @@ optimize_subroutine_group (const char *type, state *root)
           st.longest_backtrack, st.longest_backtrack_code);
 }
 
-struct merge_pattern_info;
+class merge_pattern_info;
 
 /* Represents a transition from one pattern to another.  */
-struct merge_pattern_transition
+class merge_pattern_transition
 {
+public:
   merge_pattern_transition (merge_pattern_info *);
 
   /* The target pattern.  */
@@ -2249,8 +2268,9 @@ merge_pattern_transition::merge_pattern_transition (merge_pattern_info *to_in)
 /* Represents a pattern that can might match several states.  The pattern
    may replace parts of the test with a parameter value.  It may also
    replace transition labels with parameters.  */
-struct merge_pattern_info
+class merge_pattern_info
 {
+public:
   merge_pattern_info (unsigned int);
 
   /* If PARAM_TEST_P, the state's singleton test should be generalized
@@ -2322,8 +2342,9 @@ merge_pattern_info::merge_pattern_info (unsigned int num_transitions)
 
 /* Describes one way of matching a particular state to a particular
    pattern.  */
-struct merge_state_result
+class merge_state_result
 {
+public:
   merge_state_result (merge_pattern_info *, position *, merge_state_result *);
 
   /* A pattern that matches the state.  */
@@ -2353,8 +2374,9 @@ merge_state_result::merge_state_result (merge_pattern_info *pattern_in,
 
 /* Information about a state, used while trying to match it against
    a pattern.  */
-struct merge_state_info
+class merge_state_info
 {
+public:
   merge_state_info (state *);
 
   /* The state itself.  */
@@ -3853,7 +3875,8 @@ merge_into_state (state *s1, state *s2)
 
 /* Pairs a pattern that needs to be matched with the rtx position at
    which the pattern should occur.  */
-struct pattern_pos {
+class pattern_pos {
+public:
   pattern_pos () {}
   pattern_pos (rtx, position *);
 
@@ -4377,8 +4400,9 @@ enum exit_state {
 
 /* Information used while writing out code.  */
 
-struct output_state
+class output_state
 {
+public:
   /* The type of routine that we're generating.  */
   routine_type type;