]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/nds32-tdep.c
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / gdb / nds32-tdep.c
index 220ad1e968d7ab7f8426dfc97042483c51c084dd..e30a016c5e338be7f3972d4840df2477057b08f9 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for the NDS32 architecture, for GDB.
 
-   Copyright (C) 2013-2020 Free Software Foundation, Inc.
+   Copyright (C) 2013-2021 Free Software Foundation, Inc.
    Contributed by Andes Technology Corporation.
 
    This file is part of GDB.
@@ -1402,13 +1402,13 @@ nds32_check_calling_use_fpr (struct type *type)
   while (1)
     {
       t = check_typedef (t);
-      typecode = TYPE_CODE (t);
+      typecode = t->code ();
       if (typecode != TYPE_CODE_STRUCT)
        break;
-      else if (TYPE_NFIELDS (t) != 1)
+      else if (t->num_fields () != 1)
        return 0;
       else
-       t = TYPE_FIELD_TYPE (t, 0);
+       t = t->field (0).type ();
     }
 
   return typecode == TYPE_CODE_FLT;
@@ -1495,8 +1495,8 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
         For ABI2FP+, the caller pushes only named arguments in registers
         and pushes all unnamed arguments in stack.  */
 
-      if (abi_use_fpr && TYPE_VARARGS (func_type)
-         && i >= TYPE_NFIELDS (func_type))
+      if (abi_use_fpr && func_type->has_varargs ()
+         && i >= func_type->num_fields ())
        goto use_stack;
 
       /* Try to use FPRs to pass arguments only when
@@ -1955,7 +1955,7 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   struct gdbarch *gdbarch;
   struct gdbarch_tdep *tdep;
   struct gdbarch_list *best_arch;
-  struct tdesc_arch_data *tdesc_data = NULL;
+  tdesc_arch_data_up tdesc_data;
   const struct target_desc *tdesc = info.target_desc;
   int elf_abi = E_NDS_ABI_AABI;
   int fpu_freg = -1;
@@ -1988,11 +1988,9 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   tdesc_data = tdesc_data_alloc ();
 
-  if (!nds32_validate_tdesc_p (tdesc, tdesc_data, &fpu_freg, &use_pseudo_fsrs))
-    {
-      tdesc_data_cleanup (tdesc_data);
-      return NULL;
-    }
+  if (!nds32_validate_tdesc_p (tdesc, tdesc_data.get (), &fpu_freg,
+                              &use_pseudo_fsrs))
+    return NULL;
 
   /* Allocate space for the new architecture.  */
   tdep = XCNEW (struct gdbarch_tdep);
@@ -2022,7 +2020,7 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     num_regs = NDS32_NUM_REGS + num_fdr_map[fpu_freg] + num_fsr_map[fpu_freg];
 
   set_gdbarch_num_regs (gdbarch, num_regs);
-  tdesc_use_registers (gdbarch, tdesc, tdesc_data);
+  tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
 
   /* Cache the register number of fs0.  */
   if (fpu_freg != -1)
@@ -2061,7 +2059,7 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   nds32_add_reggroups (gdbarch);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
-  info.tdesc_data = tdesc_data;
+  info.tdesc_data = tdesc_data.get ();
   gdbarch_init_osabi (info, gdbarch);
 
   /* Override tdesc_register callbacks for system registers.  */