Fix support for theassembler's new ".nop" directive on the IA64 target.
[deliverable/binutils-gdb.git] / gdb / gdbtypes.c
index b5a13107ede0425ca22a350718af1fba20637511..5a3f18ee3518f75eba1c4f863d80700ba79bb18b 100644 (file)
@@ -115,6 +115,10 @@ const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN] = {
   &floatformat_ibm_long_double_big,
   &floatformat_ibm_long_double_little
 };
+const struct floatformat *floatformats_bfloat16[BFD_ENDIAN_UNKNOWN] = {
+  &floatformat_bfloat16_big,
+  &floatformat_bfloat16_little
+};
 
 /* Should opaque types be resolved?  */
 
@@ -371,7 +375,7 @@ make_pointer_type (struct type *type, struct type **typeptr)
   /* Mark pointers as unsigned.  The target converts between pointers
      and addresses (CORE_ADDRs) using gdbarch_pointer_to_address and
      gdbarch_address_to_pointer.  */
-  TYPE_UNSIGNED (ntype) = 1;
+  ntype->set_is_unsigned (true);
 
   /* Update the length of all the other variants of this type.  */
   chain = TYPE_CHAIN (ntype);
@@ -548,7 +552,7 @@ lookup_function_type_with_arguments (struct type *type,
       if (param_types[nparams - 1] == NULL)
        {
          --nparams;
-         TYPE_VARARGS (fn) = 1;
+         fn->set_has_varargs (true);
        }
       else if (check_typedef (param_types[nparams - 1])->code ()
               == TYPE_CODE_VOID)
@@ -556,10 +560,10 @@ lookup_function_type_with_arguments (struct type *type,
          --nparams;
          /* Caller should have ensured this.  */
          gdb_assert (nparams == 0);
-         TYPE_PROTOTYPED (fn) = 1;
+         fn->set_is_prototyped (true);
        }
       else
-       TYPE_PROTOTYPED (fn) = 1;
+       fn->set_is_prototyped (true);
     }
 
   fn->set_num_fields (nparams);
@@ -863,7 +867,7 @@ allocate_stub_method (struct type *type)
   mtype = alloc_type_copy (type);
   mtype->set_code (TYPE_CODE_METHOD);
   TYPE_LENGTH (mtype) = 1;
-  TYPE_STUB (mtype) = 1;
+  mtype->set_is_stub (true);
   TYPE_TARGET_TYPE (mtype) = type;
   /* TYPE_SELF_TYPE (mtype) = unknown yet */
   return mtype;
@@ -874,23 +878,23 @@ allocate_stub_method (struct type *type)
 bool
 operator== (const dynamic_prop &l, const dynamic_prop &r)
 {
-  if (l.kind != r.kind)
+  if (l.kind () != r.kind ())
     return false;
 
-  switch (l.kind)
+  switch (l.kind ())
     {
     case PROP_UNDEFINED:
       return true;
     case PROP_CONST:
-      return l.data.const_val == r.data.const_val;
+      return l.const_val () == r.const_val ();
     case PROP_ADDR_OFFSET:
     case PROP_LOCEXPR:
     case PROP_LOCLIST:
-      return l.data.baton == r.data.baton;
+      return l.baton () == r.baton ();
     case PROP_VARIANT_PARTS:
-      return l.data.variant_parts == r.data.variant_parts;
+      return l.variant_parts () == r.variant_parts ();
     case PROP_TYPE:
-      return l.data.original_type == r.data.original_type;
+      return l.original_type () == r.original_type ();
     }
 
   gdb_assert_not_reached ("unhandled dynamic_prop kind");
@@ -930,33 +934,32 @@ create_range_type (struct type *result_type, struct type *index_type,
     result_type = alloc_type_copy (index_type);
   result_type->set_code (TYPE_CODE_RANGE);
   TYPE_TARGET_TYPE (result_type) = index_type;
-  if (TYPE_STUB (index_type))
-    TYPE_TARGET_STUB (result_type) = 1;
+  if (index_type->is_stub ())
+    result_type->set_target_is_stub (true);
   else
     TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type));
 
-  TYPE_RANGE_DATA (result_type) = (struct range_bounds *)
-    TYPE_ZALLOC (result_type, sizeof (struct range_bounds));
-  TYPE_RANGE_DATA (result_type)->low = *low_bound;
-  TYPE_RANGE_DATA (result_type)->high = *high_bound;
-  TYPE_RANGE_DATA (result_type)->bias = bias;
+  range_bounds *bounds
+    = (struct range_bounds *) TYPE_ZALLOC (result_type, sizeof (range_bounds));
+  bounds->low = *low_bound;
+  bounds->high = *high_bound;
+  bounds->bias = bias;
+  bounds->stride.set_const_val (0);
 
-  /* Initialize the stride to be a constant, the value will already be zero
-     thanks to the use of TYPE_ZALLOC above.  */
-  TYPE_RANGE_DATA (result_type)->stride.kind = PROP_CONST;
+  result_type->set_bounds (bounds);
 
-  if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0)
-    TYPE_UNSIGNED (result_type) = 1;
+  if (low_bound->kind () == PROP_CONST && low_bound->const_val () >= 0)
+    result_type->set_is_unsigned (true);
 
   /* Ada allows the declaration of range types whose upper bound is
      less than the lower bound, so checking the lower bound is not
      enough.  Make sure we do not mark a range type whose upper bound
      is negative as unsigned.  */
-  if (high_bound->kind == PROP_CONST && high_bound->data.const_val < 0)
-    TYPE_UNSIGNED (result_type) = 0;
+  if (high_bound->kind () == PROP_CONST && high_bound->const_val () < 0)
+    result_type->set_is_unsigned (false);
 
-  TYPE_ENDIANITY_NOT_DEFAULT (result_type)
-    = TYPE_ENDIANITY_NOT_DEFAULT (index_type);
+  result_type->set_endianity_is_not_default
+    (index_type->endianity_is_not_default ());
 
   return result_type;
 }
@@ -976,8 +979,8 @@ create_range_type_with_stride (struct type *result_type,
                                   high_bound, bias);
 
   gdb_assert (stride != nullptr);
-  TYPE_RANGE_DATA (result_type)->stride = *stride;
-  TYPE_RANGE_DATA (result_type)->flag_is_byte_stride = byte_stride_p;
+  result_type->bounds ()->stride = *stride;
+  result_type->bounds ()->flag_is_byte_stride = byte_stride_p;
 
   return result_type;
 }
@@ -1000,11 +1003,8 @@ create_static_range_type (struct type *result_type, struct type *index_type,
 {
   struct dynamic_prop low, high;
 
-  low.kind = PROP_CONST;
-  low.data.const_val = low_bound;
-
-  high.kind = PROP_CONST;
-  high.data.const_val = high_bound;
+  low.set_const_val (low_bound);
+  high.set_const_val (high_bound);
 
   result_type = create_range_type (result_type, index_type, &low, &high, 0);
 
@@ -1019,15 +1019,18 @@ has_static_range (const struct range_bounds *bounds)
 {
   /* If the range doesn't have a defined stride then its stride field will
      be initialized to the constant 0.  */
-  return (bounds->low.kind == PROP_CONST
-         && bounds->high.kind == PROP_CONST
-         && bounds->stride.kind == PROP_CONST);
+  return (bounds->low.kind () == PROP_CONST
+         && bounds->high.kind () == PROP_CONST
+         && bounds->stride.kind () == PROP_CONST);
 }
 
 
 /* Set *LOWP and *HIGHP to the lower and upper bounds of discrete type
-   TYPE.  Return 1 if type is a range type, 0 if it is discrete (and
-   bounds will fit in LONGEST), or -1 otherwise.  */
+   TYPE.
+
+   Return 1 if type is a range type with two defined, constant bounds.
+   Else, return 0 if it is discrete (and bounds will fit in LONGEST).
+   Else, return -1.  */
 
 int
 get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
@@ -1036,8 +1039,15 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
   switch (type->code ())
     {
     case TYPE_CODE_RANGE:
-      *lowp = TYPE_LOW_BOUND (type);
-      *highp = TYPE_HIGH_BOUND (type);
+      /* This function currently only works for ranges with two defined,
+         constant bounds.  */
+      if (type->bounds ()->low.kind () != PROP_CONST
+         || type->bounds ()->high.kind () != PROP_CONST)
+       return -1;
+
+      *lowp = type->bounds ()->low.const_val ();
+      *highp = type->bounds ()->high.const_val ();
+
       if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ENUM)
        {
          if (!discrete_position (TYPE_TARGET_TYPE (type), *lowp, lowp)
@@ -1063,9 +1073,7 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
 
          /* Set unsigned indicator if warranted.  */
          if (*lowp >= 0)
-           {
-             TYPE_UNSIGNED (type) = 1;
-           }
+           type->set_is_unsigned (true);
        }
       else
        {
@@ -1080,7 +1088,7 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
     case TYPE_CODE_INT:
       if (TYPE_LENGTH (type) > sizeof (LONGEST))       /* Too big */
        return -1;
-      if (!TYPE_UNSIGNED (type))
+      if (!type->is_unsigned ())
        {
          *lowp = -(1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1));
          *highp = -*lowp - 1;
@@ -1105,14 +1113,7 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
    Save the high bound into HIGH_BOUND if not NULL.
 
    Return 1 if the operation was successful.  Return zero otherwise,
-   in which case the values of LOW_BOUND and HIGH_BOUNDS are unmodified.
-
-   We now simply use get_discrete_bounds call to get the values
-   of the low and high bounds.
-   get_discrete_bounds can return three values:
-   1, meaning that index is a range,
-   0, meaning that index is a discrete type,
-   or -1 for failure.  */
+   in which case the values of LOW_BOUND and HIGH_BOUNDS are unmodified.  */
 
 int
 get_array_bounds (struct type *type, LONGEST *low_bound, LONGEST *high_bound)
@@ -1129,12 +1130,6 @@ get_array_bounds (struct type *type, LONGEST *low_bound, LONGEST *high_bound)
   if (res == -1)
     return 0;
 
-  /* Check if the array bounds are undefined.  */
-  if (res == 1
-      && ((low_bound && TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type))
-         || (high_bound && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))))
-    return 0;
-
   if (low_bound)
     *low_bound = low;
 
@@ -1198,7 +1193,7 @@ update_static_array_size (struct type *type)
   struct type *range_type = type->index_type ();
 
   if (type->dyn_prop (DYN_PROP_BYTE_STRIDE) == nullptr
-      && has_static_range (TYPE_RANGE_DATA (range_type))
+      && has_static_range (range_type->bounds ())
       && (!type_not_associated (type)
          && !type_not_allocated (type)))
     {
@@ -1212,7 +1207,7 @@ update_static_array_size (struct type *type)
         arrays bit size field.  */
       stride = TYPE_FIELD_BITSIZE (type, 0);
       if (stride == 0)
-       stride = TYPE_BIT_STRIDE (range_type);
+       stride = range_type->bit_stride ();
 
       if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
        low_bound = high_bound = 0;
@@ -1274,13 +1269,13 @@ create_array_type_with_stride (struct type *result_type,
                               unsigned int bit_stride)
 {
   if (byte_stride_prop != NULL
-      && byte_stride_prop->kind == PROP_CONST)
+      && byte_stride_prop->kind () == PROP_CONST)
     {
       /* The byte stride is actually not dynamic.  Pretend we were
         called with bit_stride set instead of byte_stride_prop.
         This will give us the same result type, while avoiding
         the need to handle this as a special case.  */
-      bit_stride = byte_stride_prop->data.const_val * 8;
+      bit_stride = byte_stride_prop->const_val () * 8;
       byte_stride_prop = NULL;
     }
 
@@ -1312,7 +1307,7 @@ create_array_type_with_stride (struct type *result_type,
 
   /* TYPE_TARGET_STUB will take care of zero length arrays.  */
   if (TYPE_LENGTH (result_type) == 0)
-    TYPE_TARGET_STUB (result_type) = 1;
+    result_type->set_target_is_stub (true);
 
   return result_type;
 }
@@ -1393,7 +1388,7 @@ create_set_type (struct type *result_type, struct type *domain_type)
   result_type->set_fields
     ((struct field *) TYPE_ZALLOC (result_type, sizeof (struct field)));
 
-  if (!TYPE_STUB (domain_type))
+  if (!domain_type->is_stub ())
     {
       LONGEST low_bound, high_bound, bit_length;
 
@@ -1403,7 +1398,7 @@ create_set_type (struct type *result_type, struct type *domain_type)
       TYPE_LENGTH (result_type)
        = (bit_length + TARGET_CHAR_BIT - 1) / TARGET_CHAR_BIT;
       if (low_bound >= 0)
-       TYPE_UNSIGNED (result_type) = 1;
+       result_type->set_is_unsigned (true);
     }
   result_type->field (0).set_type (domain_type);
 
@@ -1433,7 +1428,7 @@ make_vector_type (struct type *array_type)
       TYPE_TARGET_TYPE (inner_array) = elt_type;
     }
 
-  TYPE_VECTOR (array_type) = 1;
+  array_type->set_is_vector (true);
 }
 
 struct type *
@@ -1561,7 +1556,7 @@ smash_to_method_type (struct type *type, struct type *self_type,
   type->set_fields (args);
   type->set_num_fields (nargs);
   if (varargs)
-    TYPE_VARARGS (type) = 1;
+    type->set_has_varargs (true);
   TYPE_LENGTH (type) = 1;      /* In practice, this is never needed.  */
 }
 
@@ -1816,7 +1811,7 @@ get_unsigned_type_max (struct type *type, ULONGEST *max)
   unsigned int n;
 
   type = check_typedef (type);
-  gdb_assert (type->code () == TYPE_CODE_INT && TYPE_UNSIGNED (type));
+  gdb_assert (type->code () == TYPE_CODE_INT && type->is_unsigned ());
   gdb_assert (TYPE_LENGTH (type) <= sizeof (ULONGEST));
 
   /* Written this way to avoid overflow.  */
@@ -1833,7 +1828,7 @@ get_signed_type_minmax (struct type *type, LONGEST *min, LONGEST *max)
   unsigned int n;
 
   type = check_typedef (type);
-  gdb_assert (type->code () == TYPE_CODE_INT && !TYPE_UNSIGNED (type));
+  gdb_assert (type->code () == TYPE_CODE_INT && !type->is_unsigned ());
   gdb_assert (TYPE_LENGTH (type) <= sizeof (LONGEST));
 
   n = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
@@ -1968,7 +1963,7 @@ array_type_has_dynamic_stride (struct type *type)
 {
   struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_BYTE_STRIDE);
 
-  return (prop != NULL && prop->kind != PROP_CONST);
+  return (prop != NULL && prop->kind () != PROP_CONST);
 }
 
 /* Worker for is_dynamic_type.  */
@@ -2000,7 +1995,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
     return 1;
 
   struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_VARIANT_PARTS);
-  if (prop != nullptr && prop->kind != PROP_TYPE)
+  if (prop != nullptr && prop->kind () != PROP_TYPE)
     return 1;
 
   if (TYPE_HAS_DYNAMIC_LENGTH (type))
@@ -2015,7 +2010,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
           dynamic when its subtype is dynamic, even if the bounds
           of the range type are static.  It allows us to assume that
           the subtype of a static range type is also static.  */
-       return (!has_static_range (TYPE_RANGE_DATA (type))
+       return (!has_static_range (type->bounds ())
                || is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0));
       }
 
@@ -2092,45 +2087,33 @@ resolve_dynamic_range (struct type *dyn_range_type,
 {
   CORE_ADDR value;
   struct type *static_range_type, *static_target_type;
-  const struct dynamic_prop *prop;
   struct dynamic_prop low_bound, high_bound, stride;
 
   gdb_assert (dyn_range_type->code () == TYPE_CODE_RANGE);
 
-  prop = &TYPE_RANGE_DATA (dyn_range_type)->low;
+  const struct dynamic_prop *prop = &dyn_range_type->bounds ()->low;
   if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
-    {
-      low_bound.kind = PROP_CONST;
-      low_bound.data.const_val = value;
-    }
+    low_bound.set_const_val (value);
   else
-    {
-      low_bound.kind = PROP_UNDEFINED;
-      low_bound.data.const_val = 0;
-    }
+    low_bound.set_undefined ();
 
-  prop = &TYPE_RANGE_DATA (dyn_range_type)->high;
+  prop = &dyn_range_type->bounds ()->high;
   if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
     {
-      high_bound.kind = PROP_CONST;
-      high_bound.data.const_val = value;
+      high_bound.set_const_val (value);
 
-      if (TYPE_RANGE_DATA (dyn_range_type)->flag_upper_bound_is_count)
-       high_bound.data.const_val
-         = low_bound.data.const_val + high_bound.data.const_val - 1;
+      if (dyn_range_type->bounds ()->flag_upper_bound_is_count)
+       high_bound.set_const_val
+         (low_bound.const_val () + high_bound.const_val () - 1);
     }
   else
-    {
-      high_bound.kind = PROP_UNDEFINED;
-      high_bound.data.const_val = 0;
-    }
+    high_bound.set_undefined ();
 
-  bool byte_stride_p = TYPE_RANGE_DATA (dyn_range_type)->flag_is_byte_stride;
-  prop = &TYPE_RANGE_DATA (dyn_range_type)->stride;
+  bool byte_stride_p = dyn_range_type->bounds ()->flag_is_byte_stride;
+  prop = &dyn_range_type->bounds ()->stride;
   if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
     {
-      stride.kind = PROP_CONST;
-      stride.data.const_val = value;
+      stride.set_const_val (value);
 
       /* If we have a bit stride that is not an exact number of bytes then
         I really don't think this is going to work with current GDB, the
@@ -2144,19 +2127,18 @@ resolve_dynamic_range (struct type *dyn_range_type,
     }
   else
     {
-      stride.kind = PROP_UNDEFINED;
-      stride.data.const_val = 0;
+      stride.set_undefined ();
       byte_stride_p = true;
     }
 
   static_target_type
     = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (dyn_range_type),
                                     addr_stack, 0);
-  LONGEST bias = TYPE_RANGE_DATA (dyn_range_type)->bias;
+  LONGEST bias = dyn_range_type->bounds ()->bias;
   static_range_type = create_range_type_with_stride
     (copy_type (dyn_range_type), static_target_type,
      &low_bound, &high_bound, bias, &stride, byte_stride_p);
-  TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1;
+  static_range_type->bounds ()->flag_bound_evaluated = 1;
   return static_range_type;
 }
 
@@ -2190,16 +2172,11 @@ resolve_dynamic_array_or_string (struct type *type,
      will update the length of the array accordingly.  */
   prop = TYPE_ALLOCATED_PROP (type);
   if (prop != NULL && dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
-    {
-      TYPE_DYN_PROP_ADDR (prop) = value;
-      TYPE_DYN_PROP_KIND (prop) = PROP_CONST;
-    }
+    prop->set_const_val (value);
+
   prop = TYPE_ASSOCIATED_PROP (type);
   if (prop != NULL && dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
-    {
-      TYPE_DYN_PROP_ADDR (prop) = value;
-      TYPE_DYN_PROP_KIND (prop) = PROP_CONST;
-    }
+    prop->set_const_val (value);
 
   ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type));
 
@@ -2264,8 +2241,10 @@ resolve_dynamic_union (struct type *type,
       t = resolve_dynamic_type_internal (resolved_type->field (i).type (),
                                         addr_stack, 0);
       resolved_type->field (i).set_type (t);
-      if (TYPE_LENGTH (t) > max_len)
-       max_len = TYPE_LENGTH (t);
+
+      struct type *real_type = check_typedef (t);
+      if (TYPE_LENGTH (real_type) > max_len)
+       max_len = TYPE_LENGTH (real_type);
     }
 
   TYPE_LENGTH (resolved_type) = max_len;
@@ -2447,14 +2426,13 @@ resolve_dynamic_struct (struct type *type,
   resolved_type = copy_type (type);
 
   dynamic_prop *variant_prop = resolved_type->dyn_prop (DYN_PROP_VARIANT_PARTS);
-  if (variant_prop != nullptr && variant_prop->kind == PROP_VARIANT_PARTS)
+  if (variant_prop != nullptr && variant_prop->kind () == PROP_VARIANT_PARTS)
     {
       compute_variant_fields (type, resolved_type, addr_stack,
-                             *variant_prop->data.variant_parts);
+                             *variant_prop->variant_parts ());
       /* We want to leave the property attached, so that the Rust code
         can tell whether the type was originally an enum.  */
-      variant_prop->kind = PROP_TYPE;
-      variant_prop->data.original_type = type;
+      variant_prop->set_original_type (type);
     }
   else
     {
@@ -2483,8 +2461,7 @@ resolve_dynamic_struct (struct type *type,
          baton.locexpr = *TYPE_FIELD_DWARF_BLOCK (resolved_type, i);
 
          struct dynamic_prop prop;
-         prop.kind = PROP_LOCEXPR;
-         prop.data.baton = &baton;
+         prop.set_locexpr (&baton);
 
          CORE_ADDR addr;
          if (dwarf2_evaluate_property (&prop, nullptr, addr_stack, &addr,
@@ -2521,8 +2498,12 @@ resolve_dynamic_struct (struct type *type,
       if (TYPE_FIELD_BITSIZE (resolved_type, i) != 0)
        new_bit_length += TYPE_FIELD_BITSIZE (resolved_type, i);
       else
-       new_bit_length += (TYPE_LENGTH (resolved_type->field (i).type ())
-                          * TARGET_CHAR_BIT);
+       {
+         struct type *real_type
+           = check_typedef (resolved_type->field (i).type ());
+
+         new_bit_length += (TYPE_LENGTH (real_type) * TARGET_CHAR_BIT);
+       }
 
       /* Normally, we would use the position and size of the last field
         to determine the size of the enclosing structure.  But GCC seems
@@ -2638,10 +2619,7 @@ resolve_dynamic_type_internal (struct type *type,
   prop = TYPE_DATA_LOCATION (resolved_type);
   if (prop != NULL
       && dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
-    {
-      TYPE_DYN_PROP_ADDR (prop) = value;
-      TYPE_DYN_PROP_KIND (prop) = PROP_CONST;
-    }
+    prop->set_const_val (value);
 
   return resolved_type;
 }
@@ -2859,7 +2837,7 @@ check_typedef (struct type *type)
     }
   /* Otherwise, rely on the stub flag being set for opaque/stubbed
      types.  */
-  else if (TYPE_STUB (type) && !currently_reading_symtab)
+  else if (type->is_stub () && !currently_reading_symtab)
     {
       const char *name = type->name ();
       /* FIXME: shouldn't we look in STRUCT_DOMAIN and/or VAR_DOMAIN
@@ -2886,22 +2864,22 @@ check_typedef (struct type *type)
         }
     }
 
-  if (TYPE_TARGET_STUB (type))
+  if (type->target_is_stub ())
     {
       struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
 
-      if (TYPE_STUB (target_type) || TYPE_TARGET_STUB (target_type))
+      if (target_type->is_stub () || target_type->target_is_stub ())
        {
          /* Nothing we can do.  */
        }
       else if (type->code () == TYPE_CODE_RANGE)
        {
          TYPE_LENGTH (type) = TYPE_LENGTH (target_type);
-         TYPE_TARGET_STUB (type) = 0;
+         type->set_target_is_stub (false);
        }
       else if (type->code () == TYPE_CODE_ARRAY
               && update_static_array_size (type))
-       TYPE_TARGET_STUB (type) = 0;
+       type->set_target_is_stub (false);
     }
 
   type = make_qualified_type (type, instance_flags, NULL);
@@ -3055,7 +3033,7 @@ check_stub_method (struct type *type, int method_id, int signature_id)
      We want a method (TYPE_CODE_METHOD).  */
   smash_to_method_type (mtype, type, TYPE_TARGET_TYPE (mtype),
                        argtypes, argcount, p[-2] == '.');
-  TYPE_STUB (mtype) = 0;
+  mtype->set_is_stub (false);
   TYPE_FN_FIELD_STUB (f, signature_id) = 0;
 
   xfree (demangled_name);
@@ -3211,7 +3189,7 @@ init_integer_type (struct objfile *objfile,
 
   t = init_type (objfile, TYPE_CODE_INT, bit, name);
   if (unsigned_p)
-    TYPE_UNSIGNED (t) = 1;
+    t->set_is_unsigned (true);
 
   return t;
 }
@@ -3228,7 +3206,7 @@ init_character_type (struct objfile *objfile,
 
   t = init_type (objfile, TYPE_CODE_CHAR, bit, name);
   if (unsigned_p)
-    TYPE_UNSIGNED (t) = 1;
+    t->set_is_unsigned (true);
 
   return t;
 }
@@ -3245,7 +3223,7 @@ init_boolean_type (struct objfile *objfile,
 
   t = init_type (objfile, TYPE_CODE_BOOL, bit, name);
   if (unsigned_p)
-    TYPE_UNSIGNED (t) = 1;
+    t->set_is_unsigned (true);
 
   return t;
 }
@@ -3339,7 +3317,7 @@ init_pointer_type (struct objfile *objfile,
 
   t = init_type (objfile, TYPE_CODE_PTR, bit, name);
   TYPE_TARGET_TYPE (t) = target_type;
-  TYPE_UNSIGNED (t) = 1;
+  t->set_is_unsigned (true);
   return t;
 }
 
@@ -3727,7 +3705,7 @@ enum bfd_endian
 type_byte_order (const struct type *type)
 {
   bfd_endian byteorder = gdbarch_byte_order (get_type_arch (type));
-  if (TYPE_ENDIANITY_NOT_DEFAULT (type))
+  if (type->endianity_is_not_default ())
     {
       if (byteorder == BFD_ENDIAN_BIG)
         return BFD_ENDIAN_LITTLE;
@@ -4011,11 +3989,11 @@ check_types_equal (struct type *type1, struct type *type2,
 
   if (type1->code () != type2->code ()
       || TYPE_LENGTH (type1) != TYPE_LENGTH (type2)
-      || TYPE_UNSIGNED (type1) != TYPE_UNSIGNED (type2)
-      || TYPE_NOSIGN (type1) != TYPE_NOSIGN (type2)
-      || TYPE_ENDIANITY_NOT_DEFAULT (type1) != TYPE_ENDIANITY_NOT_DEFAULT (type2)
-      || TYPE_VARARGS (type1) != TYPE_VARARGS (type2)
-      || TYPE_VECTOR (type1) != TYPE_VECTOR (type2)
+      || type1->is_unsigned () != type2->is_unsigned ()
+      || type1->has_no_signedness () != type2->has_no_signedness ()
+      || type1->endianity_is_not_default () != type2->endianity_is_not_default ()
+      || type1->has_varargs () != type2->has_varargs ()
+      || type1->is_vector () != type2->is_vector ()
       || TYPE_NOTTEXT (type1) != TYPE_NOTTEXT (type2)
       || TYPE_INSTANCE_FLAGS (type1) != TYPE_INSTANCE_FLAGS (type2)
       || type1->num_fields () != type2->num_fields ())
@@ -4028,7 +4006,7 @@ check_types_equal (struct type *type1, struct type *type2,
 
   if (type1->code () == TYPE_CODE_RANGE)
     {
-      if (*TYPE_RANGE_DATA (type1) != *TYPE_RANGE_DATA (type2))
+      if (*type1->bounds () != *type2->bounds ())
        return false;
     }
   else
@@ -4112,7 +4090,7 @@ check_types_worklist (std::vector<type_equality_entry> *worklist,
 {
   while (!worklist->empty ())
     {
-      int added;
+      bool added;
 
       struct type_equality_entry entry = std::move (worklist->back ());
       worklist->pop_back ();
@@ -4157,8 +4135,8 @@ type_not_allocated (const struct type *type)
 {
   struct dynamic_prop *prop = TYPE_ALLOCATED_PROP (type);
 
-  return (prop && TYPE_DYN_PROP_KIND (prop) == PROP_CONST
-         && !TYPE_DYN_PROP_ADDR (prop));
+  return (prop != nullptr && prop->kind () == PROP_CONST
+         && prop->const_val () == 0);
 }
 
 /* Associated status of type TYPE.  Return zero if type TYPE is associated.
@@ -4169,8 +4147,8 @@ type_not_associated (const struct type *type)
 {
   struct dynamic_prop *prop = TYPE_ASSOCIATED_PROP (type);
 
-  return (prop && TYPE_DYN_PROP_KIND (prop) == PROP_CONST
-         && !TYPE_DYN_PROP_ADDR (prop));
+  return (prop != nullptr && prop->kind () == PROP_CONST
+         && prop->const_val () == 0);
 }
 
 /* rank_one_type helper for when PARM's type code is TYPE_CODE_PTR.  */
@@ -4286,17 +4264,17 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
        {
          /* Deal with signed, unsigned, and plain chars and
             signed and unsigned ints.  */
-         if (TYPE_NOSIGN (parm))
+         if (parm->has_no_signedness ())
            {
              /* This case only for character types.  */
-             if (TYPE_NOSIGN (arg))
+             if (arg->has_no_signedness ())
                return EXACT_MATCH_BADNESS;     /* plain char -> plain char */
              else              /* signed/unsigned char -> plain char */
                return INTEGER_CONVERSION_BADNESS;
            }
-         else if (TYPE_UNSIGNED (parm))
+         else if (parm->is_unsigned ())
            {
-             if (TYPE_UNSIGNED (arg))
+             if (arg->is_unsigned ())
                {
                  /* unsigned int -> unsigned int, or
                     unsigned long -> unsigned long */
@@ -4326,7 +4304,7 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
                    return INTEGER_CONVERSION_BADNESS;
                }
            }
-         else if (!TYPE_NOSIGN (arg) && !TYPE_UNSIGNED (arg))
+         else if (!arg->has_no_signedness () && !arg->is_unsigned ())
            {
              if (integer_types_same_name_p (parm->name (),
                                             arg->name ()))
@@ -4409,21 +4387,21 @@ rank_one_type_parm_char (struct type *parm, struct type *arg, struct value *valu
     case TYPE_CODE_CHAR:
       /* Deal with signed, unsigned, and plain chars for C++ and
         with int cases falling through from previous case.  */
-      if (TYPE_NOSIGN (parm))
+      if (parm->has_no_signedness ())
        {
-         if (TYPE_NOSIGN (arg))
+         if (arg->has_no_signedness ())
            return EXACT_MATCH_BADNESS;
          else
            return INTEGER_CONVERSION_BADNESS;
        }
-      else if (TYPE_UNSIGNED (parm))
+      else if (parm->is_unsigned ())
        {
-         if (TYPE_UNSIGNED (arg))
+         if (arg->is_unsigned ())
            return EXACT_MATCH_BADNESS;
          else
            return INTEGER_PROMOTION_BADNESS;
        }
-      else if (!TYPE_NOSIGN (arg) && !TYPE_UNSIGNED (arg))
+      else if (!arg->has_no_signedness () && !arg->is_unsigned ())
        return EXACT_MATCH_BADNESS;
       else
        return INTEGER_CONVERSION_BADNESS;
@@ -4880,6 +4858,29 @@ print_gnat_stuff (struct type *type, int spaces)
 
 static struct obstack dont_print_type_obstack;
 
+/* Print the dynamic_prop PROP.  */
+
+static void
+dump_dynamic_prop (dynamic_prop const& prop)
+{
+  switch (prop.kind ())
+    {
+    case PROP_CONST:
+      printf_filtered ("%s", plongest (prop.const_val ()));
+      break;
+    case PROP_UNDEFINED:
+      printf_filtered ("(undefined)");
+      break;
+    case PROP_LOCEXPR:
+    case PROP_LOCLIST:
+      printf_filtered ("(dynamic)");
+      break;
+    default:
+      gdb_assert_not_reached ("unhandled prop kind");
+      break;
+    }
+}
+
 void
 recursive_dump_type (struct type *type, int spaces)
 {
@@ -5063,46 +5064,46 @@ recursive_dump_type (struct type *type, int spaces)
   puts_filtered ("\n");
 
   printfi_filtered (spaces, "flags");
-  if (TYPE_UNSIGNED (type))
+  if (type->is_unsigned ())
     {
       puts_filtered (" TYPE_UNSIGNED");
     }
-  if (TYPE_NOSIGN (type))
+  if (type->has_no_signedness ())
     {
       puts_filtered (" TYPE_NOSIGN");
     }
-  if (TYPE_ENDIANITY_NOT_DEFAULT (type))
+  if (type->endianity_is_not_default ())
     {
       puts_filtered (" TYPE_ENDIANITY_NOT_DEFAULT");
     }
-  if (TYPE_STUB (type))
+  if (type->is_stub ())
     {
       puts_filtered (" TYPE_STUB");
     }
-  if (TYPE_TARGET_STUB (type))
+  if (type->target_is_stub ())
     {
       puts_filtered (" TYPE_TARGET_STUB");
     }
-  if (TYPE_PROTOTYPED (type))
+  if (type->is_prototyped ())
     {
       puts_filtered (" TYPE_PROTOTYPED");
     }
-  if (TYPE_VARARGS (type))
+  if (type->has_varargs ())
     {
       puts_filtered (" TYPE_VARARGS");
     }
   /* This is used for things like AltiVec registers on ppc.  Gcc emits
      an attribute for the array type, which tells whether or not we
      have a vector, instead of a regular array.  */
-  if (TYPE_VECTOR (type))
+  if (type->is_vector ())
     {
       puts_filtered (" TYPE_VECTOR");
     }
-  if (TYPE_FIXED_INSTANCE (type))
+  if (type->is_fixed_instance ())
     {
       puts_filtered (" TYPE_FIXED_INSTANCE");
     }
-  if (TYPE_STUB_SUPPORTED (type))
+  if (type->stub_is_supported ())
     {
       puts_filtered (" TYPE_STUB_SUPPORTED");
     }
@@ -5139,12 +5140,11 @@ recursive_dump_type (struct type *type, int spaces)
     }
   if (type->code () == TYPE_CODE_RANGE)
     {
-      printfi_filtered (spaces, "low %s%s  high %s%s\n",
-                       plongest (TYPE_LOW_BOUND (type)), 
-                       TYPE_LOW_BOUND_UNDEFINED (type) ? " (undefined)" : "",
-                       plongest (TYPE_HIGH_BOUND (type)),
-                       TYPE_HIGH_BOUND_UNDEFINED (type) 
-                       ? " (undefined)" : "");
+      printfi_filtered (spaces, "low ");
+      dump_dynamic_prop (type->bounds ()->low);
+      printf_filtered ("  high ");
+      dump_dynamic_prop (type->bounds ()->high);
+      printf_filtered ("\n");
     }
 
   switch (TYPE_SPECIFIC_FIELD (type))
@@ -5357,9 +5357,12 @@ copy_type_recursive (struct objfile *objfile,
   /* For range types, copy the bounds information.  */
   if (type->code () == TYPE_CODE_RANGE)
     {
-      TYPE_RANGE_DATA (new_type) = (struct range_bounds *)
-        TYPE_ALLOC (new_type, sizeof (struct range_bounds));
-      *TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type);
+      range_bounds *bounds
+        = ((struct range_bounds *) TYPE_ALLOC
+          (new_type, sizeof (struct range_bounds)));
+
+      *bounds = *type->bounds ();
+      new_type->set_bounds (bounds);
     }
 
   if (type->main_type->dyn_prop_list != NULL)
@@ -5472,7 +5475,7 @@ arch_integer_type (struct gdbarch *gdbarch,
 
   t = arch_type (gdbarch, TYPE_CODE_INT, bit, name);
   if (unsigned_p)
-    TYPE_UNSIGNED (t) = 1;
+    t->set_is_unsigned (true);
 
   return t;
 }
@@ -5489,7 +5492,7 @@ arch_character_type (struct gdbarch *gdbarch,
 
   t = arch_type (gdbarch, TYPE_CODE_CHAR, bit, name);
   if (unsigned_p)
-    TYPE_UNSIGNED (t) = 1;
+    t->set_is_unsigned (true);
 
   return t;
 }
@@ -5506,7 +5509,7 @@ arch_boolean_type (struct gdbarch *gdbarch,
 
   t = arch_type (gdbarch, TYPE_CODE_BOOL, bit, name);
   if (unsigned_p)
-    TYPE_UNSIGNED (t) = 1;
+    t->set_is_unsigned (true);
 
   return t;
 }
@@ -5556,7 +5559,7 @@ arch_pointer_type (struct gdbarch *gdbarch,
 
   t = arch_type (gdbarch, TYPE_CODE_PTR, bit, name);
   TYPE_TARGET_TYPE (t) = target_type;
-  TYPE_UNSIGNED (t) = 1;
+  t->set_is_unsigned (true);
   return t;
 }
 
@@ -5569,7 +5572,7 @@ arch_flags_type (struct gdbarch *gdbarch, const char *name, int bit)
   struct type *type;
 
   type = arch_type (gdbarch, TYPE_CODE_FLAGS, bit, name);
-  TYPE_UNSIGNED (type) = 1;
+  type->set_is_unsigned (true);
   type->set_num_fields (0);
   /* Pre-allocate enough space assuming every field is one bit.  */
   type->set_fields
@@ -5722,7 +5725,7 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
   builtin_type->builtin_char
     = arch_integer_type (gdbarch, TARGET_CHAR_BIT,
                         !gdbarch_char_signed (gdbarch), "char");
-  TYPE_NOSIGN (builtin_type->builtin_char) = 1;
+  builtin_type->builtin_char->set_has_no_signedness (true);
   builtin_type->builtin_signed_char
     = arch_integer_type (gdbarch, TARGET_CHAR_BIT,
                         0, "signed char");
@@ -5759,6 +5762,9 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
   builtin_type->builtin_float
     = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
                       "float", gdbarch_float_format (gdbarch));
+  builtin_type->builtin_bfloat16
+    = arch_float_type (gdbarch, gdbarch_bfloat16_bit (gdbarch),
+                      "bfloat16", gdbarch_bfloat16_format (gdbarch));
   builtin_type->builtin_double
     = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
                       "double", gdbarch_double_format (gdbarch));
@@ -5878,7 +5884,7 @@ objfile_type (struct objfile *objfile)
   objfile_type->builtin_char
     = init_integer_type (objfile, TARGET_CHAR_BIT,
                         !gdbarch_char_signed (gdbarch), "char");
-  TYPE_NOSIGN (objfile_type->builtin_char) = 1;
+  objfile_type->builtin_char->set_has_no_signedness (true);
   objfile_type->builtin_signed_char
     = init_integer_type (objfile, TARGET_CHAR_BIT,
                         0, "signed char");
@@ -5928,10 +5934,12 @@ objfile_type (struct objfile *objfile)
   objfile_type->nodebug_text_symbol
     = init_type (objfile, TYPE_CODE_FUNC, TARGET_CHAR_BIT,
                 "<text variable, no debug info>");
+
   objfile_type->nodebug_text_gnu_ifunc_symbol
     = init_type (objfile, TYPE_CODE_FUNC, TARGET_CHAR_BIT,
                 "<text gnu-indirect-function variable, no debug info>");
-  TYPE_GNU_IFUNC (objfile_type->nodebug_text_gnu_ifunc_symbol) = 1;
+  objfile_type->nodebug_text_gnu_ifunc_symbol->set_is_gnu_ifunc (true);
+
   objfile_type->nodebug_got_plt_symbol
     = init_pointer_type (objfile, gdbarch_addr_bit (gdbarch),
                         "<text from jump slot in .got.plt, no debug info>",
This page took 0.03902 seconds and 4 git commands to generate.