gdb: add type::is_vector / type::set_is_vector
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 14 Sep 2020 15:08:02 +0000 (11:08 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 14 Sep 2020 15:08:02 +0000 (11:08 -0400)
Add the `is_vector` and `set_is_vector` methods on `struct type`, in
order to remove the `TYPE_VECTOR` macro.  In this patch, the macro is
changed to use the getter, so all the call sites of the macro that are
used as a setter are changed to use the setter method directly.  The
next patch will remove the macro completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <is_vector, set_is_vector>: New methods.
(TYPE_VECTOR): Use type::is_vector, change all write call sites to
use type::set_is_vector.

Change-Id: I415e8d169f058662e0750329bfa4017bea3ca0cb

gdb/ChangeLog
gdb/arm-tdep.c
gdb/csky-tdep.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/i386-tdep.c
gdb/riscv-tdep.c
gdb/rs6000-tdep.c
gdb/target-descriptions.c

index cde84e1159ff92e710744a5d5d728fccdd96e845..b28de5b6ad01f24684e414abc483cc077d10dc6a 100644 (file)
@@ -1,3 +1,9 @@
+2020-09-14  Simon Marchi  <simon.marchi@efficios.com>
+
+       * gdbtypes.h (struct type) <is_vector, set_is_vector>: New methods.
+       (TYPE_VECTOR): Use type::is_vector, change all write call sites to
+       use type::set_is_vector.
+
 2020-09-14  Simon Marchi  <simon.marchi@efficios.com>
 
        * gdbtypes.h (TYPE_VARARGS): Remove, replace all
index 1eeaea32dc66e2071b7333d30449a787cfc768b3..ecf65f24a19578373a482e80ad1ccce812781381 100644 (file)
@@ -4030,7 +4030,7 @@ arm_neon_double_type (struct gdbarch *gdbarch)
       elem = builtin_type (gdbarch)->builtin_double;
       append_composite_type_field (t, "f64", elem);
 
-      TYPE_VECTOR (t) = 1;
+      t->set_is_vector (true);
       t->set_name ("neon_d");
       tdep->neon_double_type = t;
     }
@@ -4069,7 +4069,7 @@ arm_neon_quad_type (struct gdbarch *gdbarch)
       elem = builtin_type (gdbarch)->builtin_double;
       append_composite_type_field (t, "f64", init_vector_type (elem, 2));
 
-      TYPE_VECTOR (t) = 1;
+      t->set_is_vector (true);
       t->set_name ("neon_q");
       tdep->neon_quad_type = t;
     }
index 7e5b71eece0f497f0c44ed89c522d8e0a8bb1135..c9245fc4ac7763a16cce05789aed65664fd652a4 100644 (file)
@@ -266,7 +266,7 @@ csky_vector_type (struct gdbarch *gdbarch)
   append_composite_type_field (t, "u8",
                               init_vector_type (bt->builtin_int8, 16));
 
-  TYPE_VECTOR (t) = 1;
+  t->set_is_vector (true);
   t->set_name ("builtin_type_vec128i");
 
   return t;
index 5927f5007812775f1dd7e558c380a6d8dd69f6a5..d8229309dc8ad6a4620142a38e18162cc3219720 100644 (file)
@@ -1428,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 *
index 86d2f8cd9032115eb638904537827e769100e1c8..760d536dd041d494af252633e7fbcc29b5a073ad 100644 (file)
@@ -219,7 +219,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
 /* * Identify a vector type.  Gcc is handling this by adding an extra
    attribute to the array type.  We slurp that in as a new flag of a
    type.  This is used only in dwarf2read.c.  */
-#define TYPE_VECTOR(t)         (TYPE_MAIN_TYPE (t)->flag_vector)
+#define TYPE_VECTOR(t)         ((t)->is_vector ())
 
 /* * The debugging formats (especially STABS) do not contain enough
    information to represent all Ada types---especially those whose
@@ -824,7 +824,7 @@ struct main_type
   unsigned int m_flag_target_stub : 1;
   unsigned int m_flag_prototyped : 1;
   unsigned int m_flag_varargs : 1;
-  unsigned int flag_vector : 1;
+  unsigned int m_flag_vector : 1;
   unsigned int flag_stub_supported : 1;
   unsigned int flag_gnu_ifunc : 1;
   unsigned int flag_fixed_instance : 1;
@@ -1116,6 +1116,16 @@ struct type
     this->main_type->m_flag_varargs = has_varargs;
   }
 
+  bool is_vector () const
+  {
+    return this->main_type->m_flag_vector;
+  }
+
+  void set_is_vector (bool is_vector)
+  {
+    this->main_type->m_flag_vector = is_vector;
+  }
+
   /* * Return the dynamic property of the requested KIND from this type's
      list of dynamic properties.  */
   dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
index 1b7971c4528bb16bd5c25f3a1bd125c674529ed4..98aaa1408583e5987cf74b2abd119eb27d2f03f3 100644 (file)
@@ -3137,7 +3137,7 @@ i386_zmm_type (struct gdbarch *gdbarch)
       append_composite_type_field (t, "v4_int128",
                                   init_vector_type (bt->builtin_int128, 4));
 
-      TYPE_VECTOR (t) = 1;
+      t->set_is_vector (true);
       t->set_name ("builtin_type_vec512i");
       tdep->i386_zmm_type = t;
     }
@@ -3193,7 +3193,7 @@ i386_ymm_type (struct gdbarch *gdbarch)
       append_composite_type_field (t, "v2_int128",
                                   init_vector_type (bt->builtin_int128, 2));
 
-      TYPE_VECTOR (t) = 1;
+      t->set_is_vector (true);
       t->set_name ("builtin_type_vec256i");
       tdep->i386_ymm_type = t;
     }
@@ -3235,7 +3235,7 @@ i386_mmx_type (struct gdbarch *gdbarch)
       append_composite_type_field (t, "v8_int8",
                                   init_vector_type (bt->builtin_int8, 8));
 
-      TYPE_VECTOR (t) = 1;
+      t->set_is_vector (true);
       t->set_name ("builtin_type_vec64i");
       tdep->i386_mmx_type = t;
     }
index a79b5f5b0cf628e9207a22c496f14bac4647efa6..0e8cf38e50c1c2ff4589b33b0919bdab72bbfeb4 100644 (file)
@@ -674,7 +674,7 @@ riscv_fpreg_d_type (struct gdbarch *gdbarch)
                               "__gdb_builtin_type_fpreg_d", TYPE_CODE_UNION);
       append_composite_type_field (t, "float", bt->builtin_float);
       append_composite_type_field (t, "double", bt->builtin_double);
-      TYPE_VECTOR (t) = 1;
+      t->set_is_vector (true);
       t->set_name ("builtin_type_fpreg_d");
       tdep->riscv_fpreg_d_type = t;
     }
index 84278e708e79ccd48c9786ac4156ad4be29b9f95..adb39d90d1118af9c71c0ce6cfabddb051021fac 100644 (file)
@@ -2273,7 +2273,7 @@ rs6000_builtin_type_vec64 (struct gdbarch *gdbarch)
       append_composite_type_field (t, "v8_int8",
                                   init_vector_type (bt->builtin_int8, 8));
 
-      TYPE_VECTOR (t) = 1;
+      t->set_is_vector (true);
       t->set_name ("ppc_builtin_type_vec64");
       tdep->ppc_builtin_type_vec64 = t;
     }
@@ -2320,7 +2320,7 @@ rs6000_builtin_type_vec128 (struct gdbarch *gdbarch)
       append_composite_type_field (t, "v16_int8",
                                   init_vector_type (bt->builtin_int8, 16));
 
-      TYPE_VECTOR (t) = 1;
+      t->set_is_vector (true);
       t->set_name ("ppc_builtin_type_vec128");
       tdep->ppc_builtin_type_vec128 = t;
     }
index 611cb9c05b19afdaa1682aad62d39fadfa9ad7a7..9d2d053545c287c8b04fe74fc0f081862834aee5 100644 (file)
@@ -264,7 +264,7 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
             union as a vector also.  This allows e.g. a union of two
             vector types to show up automatically in "info vector".  */
          if (TYPE_VECTOR (field_gdb_type))
-           TYPE_VECTOR (m_type) = 1;
+           m_type->set_is_vector (true);
        }
     }
 
This page took 0.041478 seconds and 4 git commands to generate.