gdb: remove TYPE_FIELD_TYPE macro
[deliverable/binutils-gdb.git] / gdb / mips-tdep.c
index df59f416b8e142d12b29c38c2dd6ebe550f59685..e0f04888808d7641f559e2020c166dd2cce4fc5c 100644 (file)
@@ -4407,8 +4407,8 @@ fp_register_arg_p (struct gdbarch *gdbarch, enum type_code typecode,
           || (MIPS_EABI (gdbarch)
               && (typecode == TYPE_CODE_STRUCT
                   || typecode == TYPE_CODE_UNION)
-              && TYPE_NFIELDS (arg_type) == 1
-              && check_typedef (TYPE_FIELD_TYPE (arg_type, 0))->code ()
+              && arg_type->num_fields () == 1
+              && check_typedef (arg_type->field (0).type ())->code ()
               == TYPE_CODE_FLT))
          && MIPS_FPU_TYPE(gdbarch) != MIPS_FPU_NONE);
 }
@@ -4425,17 +4425,17 @@ mips_type_needs_double_align (struct type *type)
     return 1;
   else if (typecode == TYPE_CODE_STRUCT)
     {
-      if (TYPE_NFIELDS (type) < 1)
+      if (type->num_fields () < 1)
        return 0;
-      return mips_type_needs_double_align (TYPE_FIELD_TYPE (type, 0));
+      return mips_type_needs_double_align (type->field (0).type ());
     }
   else if (typecode == TYPE_CODE_UNION)
     {
       int i, n;
 
-      n = TYPE_NFIELDS (type);
+      n = type->num_fields ();
       for (i = 0; i < n; i++)
-       if (mips_type_needs_double_align (TYPE_FIELD_TYPE (type, i)))
+       if (mips_type_needs_double_align (type->field (i).type ()))
          return 1;
       return 0;
     }
@@ -4788,9 +4788,9 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
         are returned in a floating point register.  */
       if ((type->code () == TYPE_CODE_STRUCT
           || type->code () == TYPE_CODE_UNION)
-         && TYPE_NFIELDS (type) == 1)
+         && type->num_fields () == 1)
        {
-         struct type *fieldtype = TYPE_FIELD_TYPE (type, 0);
+         struct type *fieldtype = type->field (0).type ();
 
          if (check_typedef (fieldtype)->code () == TYPE_CODE_FLT)
            fp_return_type = 1;
@@ -4850,13 +4850,13 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
   if (TYPE_LENGTH (arg_type) < offset + MIPS64_REGSIZE)
     return 0;
 
-  for (i = 0; i < TYPE_NFIELDS (arg_type); i++)
+  for (i = 0; i < arg_type->num_fields (); i++)
     {
       int pos;
       struct type *field_type;
 
       /* We're only looking at normal fields.  */
-      if (field_is_static (&TYPE_FIELD (arg_type, i))
+      if (field_is_static (&arg_type->field (i))
          || (TYPE_FIELD_BITPOS (arg_type, i) % 8) != 0)
        continue;
 
@@ -4865,7 +4865,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
       if (pos > offset)
        return 0;
 
-      field_type = check_typedef (TYPE_FIELD_TYPE (arg_type, i));
+      field_type = check_typedef (arg_type->field (i).type ());
 
       /* If this field is entirely before the requested offset, go
         on to the next one.  */
@@ -5226,15 +5226,15 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
       return RETURN_VALUE_REGISTER_CONVENTION;
     }
   else if (type->code () == TYPE_CODE_STRUCT
-          && TYPE_NFIELDS (type) <= 2
-          && TYPE_NFIELDS (type) >= 1
-          && ((TYPE_NFIELDS (type) == 1
-               && (check_typedef (TYPE_FIELD_TYPE (type, 0))->code ()
+          && type->num_fields () <= 2
+          && type->num_fields () >= 1
+          && ((type->num_fields () == 1
+               && (check_typedef (type->field (0).type ())->code ()
                    == TYPE_CODE_FLT))
-              || (TYPE_NFIELDS (type) == 2
-                  && (check_typedef (TYPE_FIELD_TYPE (type, 0))->code ()
+              || (type->num_fields () == 2
+                  && (check_typedef (type->field (0).type ())->code ()
                       == TYPE_CODE_FLT)
-                  && (check_typedef (TYPE_FIELD_TYPE (type, 1))->code ()
+                  && (check_typedef (type->field (1).type ())->code ()
                       == TYPE_CODE_FLT))))
     {
       /* A struct that contains one or two floats.  Each value is part
@@ -5245,14 +5245,14 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
       for (field = 0, regnum = (tdep->mips_fpu_type != MIPS_FPU_NONE
                                ? mips_regnum (gdbarch)->fp0
                                : MIPS_V0_REGNUM);
-          field < TYPE_NFIELDS (type); field++, regnum += 2)
+          field < type->num_fields (); field++, regnum += 2)
        {
-         int offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field])
+         int offset = (FIELD_BITPOS (type->field (field))
                        / TARGET_CHAR_BIT);
          if (mips_debug)
            fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n",
                                offset);
-         if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)) == 16)
+         if (TYPE_LENGTH (type->field (field).type ()) == 16)
            {
              /* A 16-byte long double field goes in two consecutive
                 registers.  */
@@ -5270,7 +5270,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
          else
            mips_xfer_register (gdbarch, regcache,
                                gdbarch_num_regs (gdbarch) + regnum,
-                               TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)),
+                               TYPE_LENGTH (type->field (field).type ()),
                                gdbarch_byte_order (gdbarch),
                                readbuf, writebuf, offset);
        }
@@ -5779,15 +5779,15 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
     }
 #if 0
   else if (type->code () == TYPE_CODE_STRUCT
-          && TYPE_NFIELDS (type) <= 2
-          && TYPE_NFIELDS (type) >= 1
-          && ((TYPE_NFIELDS (type) == 1
-               && (TYPE_CODE (TYPE_FIELD_TYPE (type, 0))
+          && type->num_fields () <= 2
+          && type->num_fields () >= 1
+          && ((type->num_fields () == 1
+               && (TYPE_CODE (type->field (0).type ())
                    == TYPE_CODE_FLT))
-              || (TYPE_NFIELDS (type) == 2
-                  && (TYPE_CODE (TYPE_FIELD_TYPE (type, 0))
+              || (type->num_fields () == 2
+                  && (TYPE_CODE (type->field (0).type ())
                       == TYPE_CODE_FLT)
-                  && (TYPE_CODE (TYPE_FIELD_TYPE (type, 1))
+                  && (TYPE_CODE (type->field (1).type ())
                       == TYPE_CODE_FLT)))
           && tdep->mips_fpu_type != MIPS_FPU_NONE)
     {
@@ -5797,16 +5797,16 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
       int regnum;
       int field;
       for (field = 0, regnum = mips_regnum (gdbarch)->fp0;
-          field < TYPE_NFIELDS (type); field++, regnum += 2)
+          field < type->num_fields (); field++, regnum += 2)
        {
-         int offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field])
+         int offset = (FIELD_BITPOS (type->fields ()[field])
                        / TARGET_CHAR_BIT);
          if (mips_debug)
            fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n",
                                offset);
          mips_xfer_register (gdbarch, regcache,
                              gdbarch_num_regs (gdbarch) + regnum,
-                             TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)),
+                             TYPE_LENGTH (type->field (field).type ()),
                              gdbarch_byte_order (gdbarch),
                              readbuf, writebuf, offset);
        }
This page took 0.028037 seconds and 4 git commands to generate.