[33/47] Turn remaining value_contents functions into methods

Message ID 20230209-submit-value-fixups-2023-v1-33-55dc2794dbb9@tromey.com
State New
Headers
Series Use methods for struct value |

Commit Message

Tom Tromey Feb. 9, 2023, 9:38 p.m. UTC
  This turns the remaining value_contents functions -- value_contents,
value_contents_all, value_contents_for_printing, and
value_contents_for_printing_const -- into methods of value.  It also
converts the static functions require_not_optimized_out and
require_available to be private methods.
---
 gdb/aarch64-tdep.c                | 12 +++----
 gdb/ada-lang.c                    | 28 ++++++++--------
 gdb/ada-tasks.c                   |  2 +-
 gdb/ada-valprint.c                | 10 +++---
 gdb/alpha-tdep.c                  |  8 ++---
 gdb/amd64-tdep.c                  |  4 +--
 gdb/amd64-windows-tdep.c          |  6 ++--
 gdb/arc-tdep.c                    |  4 +--
 gdb/arm-tdep.c                    |  2 +-
 gdb/avr-tdep.c                    |  2 +-
 gdb/bfin-tdep.c                   |  2 +-
 gdb/breakpoint.c                  |  2 +-
 gdb/c-lang.c                      |  2 +-
 gdb/c-valprint.c                  |  8 ++---
 gdb/cli/cli-cmds.c                |  2 +-
 gdb/cli/cli-dump.c                |  4 +--
 gdb/compile/compile-object-load.c |  2 +-
 gdb/cp-valprint.c                 |  4 +--
 gdb/cris-tdep.c                   |  2 +-
 gdb/csky-tdep.c                   |  2 +-
 gdb/d-valprint.c                  |  2 +-
 gdb/dwarf2/expr.c                 | 12 +++----
 gdb/eval.c                        |  4 +--
 gdb/f-lang.c                      | 22 ++++++-------
 gdb/f-valprint.c                  |  2 +-
 gdb/findcmd.c                     |  2 +-
 gdb/frame.c                       | 12 +++----
 gdb/frv-tdep.c                    |  4 +--
 gdb/gdbtypes.c                    |  2 +-
 gdb/gnu-v3-abi.c                  |  2 +-
 gdb/go-valprint.c                 |  2 +-
 gdb/guile/scm-value.c             |  4 +--
 gdb/h8300-tdep.c                  |  2 +-
 gdb/hppa-tdep.c                   | 16 ++++-----
 gdb/i386-darwin-tdep.c            |  4 +--
 gdb/i386-tdep.c                   |  4 +--
 gdb/i387-tdep.c                   |  2 +-
 gdb/ia64-tdep.c                   | 28 ++++++++--------
 gdb/infcall.c                     |  2 +-
 gdb/infcmd.c                      |  2 +-
 gdb/iq2000-tdep.c                 |  2 +-
 gdb/lm32-tdep.c                   |  2 +-
 gdb/loongarch-tdep.c              |  2 +-
 gdb/m2-valprint.c                 |  4 +--
 gdb/m32c-tdep.c                   |  2 +-
 gdb/m32r-tdep.c                   |  4 +--
 gdb/m68hc11-tdep.c                |  4 +--
 gdb/m68k-tdep.c                   |  2 +-
 gdb/mep-tdep.c                    |  4 +--
 gdb/mips-tdep.c                   | 10 +++---
 gdb/mn10300-tdep.c                |  2 +-
 gdb/msp430-tdep.c                 |  2 +-
 gdb/nds32-tdep.c                  |  2 +-
 gdb/nios2-tdep.c                  |  2 +-
 gdb/opencl-lang.c                 |  8 ++---
 gdb/or1k-tdep.c                   |  6 ++--
 gdb/p-valprint.c                  |  4 +--
 gdb/ppc-sysv-tdep.c               |  4 +--
 gdb/printcmd.c                    | 10 +++---
 gdb/python/py-inferior.c          |  2 +-
 gdb/python/py-unwind.c            |  4 +--
 gdb/python/py-value.c             |  4 +--
 gdb/riscv-tdep.c                  |  6 ++--
 gdb/rl78-tdep.c                   |  2 +-
 gdb/rs6000-aix-tdep.c             | 14 ++++----
 gdb/rs6000-lynx178-tdep.c         | 12 +++----
 gdb/rust-lang.c                   |  8 ++---
 gdb/rx-tdep.c                     |  4 +--
 gdb/s390-tdep.c                   | 20 ++++++------
 gdb/sh-tdep.c                     |  6 ++--
 gdb/sparc-tdep.c                  |  4 +--
 gdb/sparc64-tdep.c                |  4 +--
 gdb/stack.c                       |  4 +--
 gdb/tic6x-tdep.c                  |  2 +-
 gdb/tilegx-tdep.c                 |  4 +--
 gdb/v850-tdep.c                   |  2 +-
 gdb/valarith.c                    | 40 +++++++++++------------
 gdb/valops.c                      | 46 +++++++++++++-------------
 gdb/valprint.c                    | 24 +++++++-------
 gdb/value.c                       | 68 +++++++++++++++++++--------------------
 gdb/value.h                       | 53 +++++++++++++++---------------
 gdb/vax-tdep.c                    |  2 +-
 gdb/xstormy16-tdep.c              |  4 +--
 gdb/xtensa-tdep.c                 |  4 +--
 84 files changed, 329 insertions(+), 328 deletions(-)
  

Comments

Simon Marchi Feb. 10, 2023, 2:24 a.m. UTC | #1
> diff --git a/gdb/value.h b/gdb/value.h
> index 2d1c489e245..7b034bba1e2 100644
> --- a/gdb/value.h
> +++ b/gdb/value.h
> @@ -282,7 +282,7 @@ struct value
>  
>       When we store the entire object, `enclosing_type' is the run-time
>       type -- the complete object -- and `embedded_offset' is the offset
> -     of `type' within that larger type, in bytes.  The value_contents()
> +     of `type' within that larger type, in bytes.  The ->contents()
>       macro takes `embedded_offset' into account, so most GDB code

I randomly spotted this oddity, "->contents()".  I think there are other
instances too.  Also, it still talks about a macro... that could
probably be updated while at it.

Simon
  
Tom Tromey Feb. 10, 2023, 5:46 p.m. UTC | #2
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

>> diff --git a/gdb/value.h b/gdb/value.h
>> index 2d1c489e245..7b034bba1e2 100644
>> --- a/gdb/value.h
>> +++ b/gdb/value.h
>> @@ -282,7 +282,7 @@ struct value
>> 
>> When we store the entire object, `enclosing_type' is the run-time
>> type -- the complete object -- and `embedded_offset' is the offset
>> -     of `type' within that larger type, in bytes.  The value_contents()
>> +     of `type' within that larger type, in bytes.  The ->contents()
>> macro takes `embedded_offset' into account, so most GDB code

Simon> I randomly spotted this oddity, "->contents()".  I think there are other
Simon> instances too.  Also, it still talks about a macro... that could
Simon> probably be updated while at it.

I fixed this, then looked at the final combined patch for other
instances of " ->" and didn't see any.

I also fixed the macro thing, which must be from very long ago.

Tom
  

Patch

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 1a6fdbebc76..0aaa746760e 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1622,7 +1622,7 @@  pass_in_x (struct gdbarch *gdbarch, struct regcache *regcache,
   int len = type->length ();
   enum type_code typecode = type->code ();
   int regnum = AARCH64_X0_REGNUM + info->ngrn;
-  const bfd_byte *buf = value_contents (arg).data ();
+  const bfd_byte *buf = arg->contents ().data ();
 
   info->argnum++;
 
@@ -1692,7 +1692,7 @@  static void
 pass_on_stack (struct aarch64_call_info *info, struct type *type,
 	       struct value *arg)
 {
-  const bfd_byte *buf = value_contents (arg).data ();
+  const bfd_byte *buf = arg->contents ().data ();
   int len = type->length ();
   int align;
   stack_item_t item;
@@ -1769,12 +1769,12 @@  pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
     case TYPE_CODE_FLT:
     case TYPE_CODE_DECFLOAT:
       return pass_in_v (gdbarch, regcache, info, arg_type->length (),
-			value_contents (arg).data ());
+			arg->contents ().data ());
       break;
 
     case TYPE_CODE_COMPLEX:
       {
-	const bfd_byte *buf = value_contents (arg).data ();
+	const bfd_byte *buf = arg->contents ().data ();
 	struct type *target_type = check_typedef (arg_type->target_type ());
 
 	if (!pass_in_v (gdbarch, regcache, info, target_type->length (),
@@ -1788,7 +1788,7 @@  pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
     case TYPE_CODE_ARRAY:
       if (arg_type->is_vector ())
 	return pass_in_v (gdbarch, regcache, info, arg_type->length (),
-			  value_contents (arg).data ());
+			  arg->contents ().data ());
       /* fall through.  */
 
     case TYPE_CODE_STRUCT:
@@ -1930,7 +1930,7 @@  aarch64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	      sp = align_down (sp - len, 16);
 
 	      /* Write the real data into the stack.  */
-	      write_memory (sp, value_contents (arg).data (), len);
+	      write_memory (sp, arg->contents ().data (), len);
 
 	      /* Construct the indirection.  */
 	      arg_type = lookup_pointer_type (arg_type);
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 7f962200a1f..c11182a5a0f 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -2516,7 +2516,7 @@  decode_constrained_packed_array (struct value *arr)
      bounds may be variable and were not passed to that function.  So,
      we further resolve the array bounds here and then update the
      sizes.  */
-  const gdb_byte *valaddr = value_contents_for_printing (arr).data ();
+  const gdb_byte *valaddr = arr->contents_for_printing ().data ();
   CORE_ADDR address = arr->address ();
   gdb::array_view<const gdb_byte> view
     = gdb::make_array_view (valaddr, type->length ());
@@ -2773,7 +2773,7 @@  ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
   if (obj == NULL)
     src = valaddr + offset;
   else
-    src = value_contents (obj).data () + offset;
+    src = obj->contents ().data () + offset;
 
   if (is_dynamic_type (type))
     {
@@ -2823,7 +2823,7 @@  ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
   else
     {
       v = value::allocate (type);
-      src = value_contents (obj).data () + offset;
+      src = obj->contents ().data () + offset;
     }
 
   if (obj != NULL)
@@ -2916,13 +2916,13 @@  ada_value_assign (struct value *toval, struct value *fromval)
       if (is_big_endian && is_scalar_type (fromval->type ()))
 	from_offset = from_size - bits;
       copy_bitwise (buffer, toval->bitpos (),
-		    value_contents (fromval).data (), from_offset,
+		    fromval->contents ().data (), from_offset,
 		    bits, is_big_endian);
       write_memory_with_notification (to_addr, buffer, len);
 
       val = value_copy (toval);
       memcpy (val->contents_raw ().data (),
-	      value_contents (fromval).data (),
+	      fromval->contents ().data (),
 	      type->length ());
       val->deprecated_set_type (type);
 
@@ -2973,13 +2973,13 @@  value_assign_to_component (struct value *container, struct value *component,
       copy_bitwise ((container->contents_writeable ().data ()
 		     + offset_in_container),
 		    container->bitpos () + bit_offset_in_container,
-		    value_contents (val).data (), src_offset, bits, 1);
+		    val->contents ().data (), src_offset, bits, 1);
     }
   else
     copy_bitwise ((container->contents_writeable ().data ()
 		   + offset_in_container),
 		  container->bitpos () + bit_offset_in_container,
-		  value_contents (val).data (), 0, bits, 0);
+		  val->contents ().data (), 0, bits, 0);
 }
 
 /* Determine if TYPE is an access to an unconstrained array.  */
@@ -4358,7 +4358,7 @@  ensure_lval (struct value *val)
 
       VALUE_LVAL (val) = lval_memory;
       val->set_address (addr);
-      write_memory (addr, value_contents (val).data (), len);
+      write_memory (addr, val->contents ().data (), len);
     }
 
   return val;
@@ -4529,7 +4529,7 @@  ada_convert_actual (struct value *actual, struct type *formal_type0)
 
 	      actual_type = ada_check_typedef (actual->type ());
 	      val = value::allocate (actual_type);
-	      copy (value_contents (actual), val->contents_raw ());
+	      copy (actual->contents (), val->contents_raw ());
 	      actual = ensure_lval (val);
 	    }
 	  result = value_addr (actual);
@@ -6924,7 +6924,7 @@  ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
       int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno);
 
       return ada_value_primitive_packed_val (arg1,
-					     value_contents (arg1).data (),
+					     arg1->contents ().data (),
 					     offset + bit_pos / 8,
 					     bit_pos % 8, bit_size, type);
     }
@@ -8846,7 +8846,7 @@  ada_to_fixed_value_create (struct type *type0, CORE_ADDR address,
       /* Our value does not live in memory; it could be a convenience
 	 variable, for instance.  Create a not_lval value using val0's
 	 contents.  */
-      return value_from_contents (type, value_contents (val0).data ());
+      return value_from_contents (type, val0->contents ().data ());
     }
 
   return value_from_contents_and_address (type, 0, address);
@@ -9290,7 +9290,7 @@  ada_promote_array_of_integrals (struct type *type, struct value *val)
       struct value *elt = value_cast (elt_type, value_subscript (val, lo + i));
       int elt_len = elt_type->length ();
 
-      copy (value_contents_all (elt), res_contents.slice (elt_len * i, elt_len));
+      copy (elt->contents_all (), res_contents.slice (elt_len * i, elt_len));
     }
 
   return res;
@@ -9436,8 +9436,8 @@  ada_value_equal (struct value *arg1, struct value *arg2)
 	 representations use all bits (no padding or undefined bits)
 	 and do not have user-defined equality.  */
       return (arg1_type->length () == arg2_type->length ()
-	      && memcmp (value_contents (arg1).data (),
-			 value_contents (arg2).data (),
+	      && memcmp (arg1->contents ().data (),
+			 arg2->contents ().data (),
 			 arg1_type->length ()) == 0);
     }
   return value_equal (arg1, arg2);
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 671ad7af603..b14d159df14 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -430,7 +430,7 @@  iterate_over_live_ada_tasks (ada_task_list_iterator_ftype iterator)
 static void
 value_as_string (char *dest, struct value *val, int length)
 {
-  memcpy (dest, value_contents (val).data (), length);
+  memcpy (dest, val->contents ().data (), length);
   dest[length] = '\0';
 }
 
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 491346b450d..a56c8a1de81 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -759,7 +759,7 @@  ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
 		     const struct value_print_options *options)
 {
   struct type *type = ada_check_typedef (val->type ());
-  const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+  const gdb_byte *valaddr = val->contents_for_printing ().data ();
 
   if (type->code () == TYPE_CODE_RANGE
       && (type->target_type ()->code () == TYPE_CODE_ENUM
@@ -839,7 +839,7 @@  ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
     }
 
   struct type *type = ada_check_typedef (value->type ());
-  const gdb_byte *valaddr = value_contents_for_printing (value).data ();
+  const gdb_byte *valaddr = value->contents_for_printing ().data ();
   int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
 
   len = type->num_fields ();
@@ -907,7 +907,7 @@  ada_value_print_array (struct value *val, struct ui_file *stream, int recurse,
   if (ada_is_string_type (type)
       && (options->format == 0 || options->format == 's'))
     {
-      const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+      const gdb_byte *valaddr = val->contents_for_printing ().data ();
       int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
 
       ada_val_print_string (type, valaddr, offset_aligned, stream, recurse,
@@ -922,7 +922,7 @@  ada_value_print_array (struct value *val, struct ui_file *stream, int recurse,
     val_print_optimized_out (val, stream);
   else if (TYPE_FIELD_BITSIZE (type, 0) > 0)
     {
-      const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+      const gdb_byte *valaddr = val->contents_for_printing ().data ();
       int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
       val_print_packed_array_elements (type, valaddr, offset_aligned,
 				       stream, recurse, options);
@@ -1021,7 +1021,7 @@  ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
   type = val->type ();
   struct type *saved_type = type;
 
-  const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+  const gdb_byte *valaddr = val->contents_for_printing ().data ();
   CORE_ADDR address = val->address ();
   gdb::array_view<const gdb_byte> view
     = gdb::make_array_view (valaddr, type->length ());
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 5edde7abcae..0d51ff73b3d 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -253,7 +253,7 @@  alpha_register_to_value (frame_info_ptr frame, int regnum,
   /* Convert to VALTYPE.  */
 
   gdb_assert (valtype->length () == 4);
-  alpha_sts (gdbarch, out, value_contents_all (value).data ());
+  alpha_sts (gdbarch, out, value->contents_all ().data ());
 
   release_value (value);
   return 1;
@@ -360,7 +360,7 @@  alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	      sp = (sp & -16) - 16;
 
 	      /* Write the real data into the stack.  */
-	      write_memory (sp, value_contents (arg).data (), 16);
+	      write_memory (sp, arg->contents ().data (), 16);
 
 	      /* Construct the indirection.  */
 	      arg_type = lookup_pointer_type (arg_type);
@@ -381,7 +381,7 @@  alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	      sp = (sp & -16) - 16;
 
 	      /* Write the real data into the stack.  */
-	      write_memory (sp, value_contents (arg).data (), 32);
+	      write_memory (sp, arg->contents ().data (), 32);
 
 	      /* Construct the indirection.  */
 	      arg_type = lookup_pointer_type (arg_type);
@@ -395,7 +395,7 @@  alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       m_arg->len = arg_type->length ();
       m_arg->offset = accumulate_size;
       accumulate_size = (accumulate_size + m_arg->len + 7) & ~7;
-      m_arg->contents = value_contents (arg).data ();
+      m_arg->contents = arg->contents ().data ();
     }
 
   /* Determine required argument register loads, loading an argument register
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 085e5327a75..9c4a90287bc 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -995,7 +995,7 @@  if (return_method == return_method_struct)
       else
 	{
 	  /* The argument will be passed in registers.  */
-	  const gdb_byte *valbuf = value_contents (args[i]).data ();
+	  const gdb_byte *valbuf = args[i]->contents ().data ();
 	  gdb_byte buf[8];
 
 	  gdb_assert (len <= 16);
@@ -1047,7 +1047,7 @@  if (return_method == return_method_struct)
   for (i = 0; i < num_stack_args; i++)
     {
       struct type *type = stack_args[i]->type ();
-      const gdb_byte *valbuf = value_contents (stack_args[i]).data ();
+      const gdb_byte *valbuf = stack_args[i]->contents ().data ();
       int len = type->length ();
 
       write_memory (sp + element * 8, valbuf, len);
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index 7a7fbbb9859..07df64bed60 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -179,7 +179,7 @@  amd64_windows_adjust_args_passed_by_pointer (struct value **args,
     if (amd64_windows_passed_by_pointer (args[i]->type ()))
       {
 	struct type *type = args[i]->type ();
-	const gdb_byte *valbuf = value_contents (args[i]).data ();
+	const gdb_byte *valbuf = args[i]->contents ().data ();
 	const int len = type->length ();
 
 	/* Store a copy of that argument on the stack, aligned to
@@ -205,7 +205,7 @@  amd64_windows_store_arg_in_reg (struct regcache *regcache,
 				struct value *arg, int regno)
 {
   struct type *type = arg->type ();
-  const gdb_byte *valbuf = value_contents (arg).data ();
+  const gdb_byte *valbuf = arg->contents ().data ();
   gdb_byte buf[8];
 
   gdb_assert (type->length () <= 8);
@@ -295,7 +295,7 @@  amd64_windows_push_arguments (struct regcache *regcache, int nargs,
   for (i = 0; i < num_stack_args; i++)
     {
       struct type *type = stack_args[i]->type ();
-      const gdb_byte *valbuf = value_contents (stack_args[i]).data ();
+      const gdb_byte *valbuf = stack_args[i]->contents ().data ();
 
       write_memory (sp + element * 8, valbuf, type->length ());
       element += ((type->length () + 7) / 8);
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index f42abc2ec42..bbdcb8d4ce6 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -779,9 +779,9 @@  arc_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	  unsigned int len = args[i]->type ()->length ();
 	  unsigned int space = align_up (len, 4);
 
-	  memcpy (data, value_contents (args[i]).data (), (size_t) len);
+	  memcpy (data, args[i]->contents ().data (), (size_t) len);
 	  arc_debug_printf ("copying arg %d, val 0x%08x, len %d to mem",
-			    i, *((int *) value_contents (args[i]).data ()),
+			    i, *((int *) args[i]->contents ().data ()),
 			    len);
 
 	  data += space;
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index bf38880c247..03df41a64b3 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -4682,7 +4682,7 @@  arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       len = arg_type->length ();
       target_type = arg_type->target_type ();
       typecode = arg_type->code ();
-      val = value_contents (args[argnum]).data ();
+      val = args[argnum]->contents ().data ();
 
       align = type_align (arg_type);
       /* Round alignment up to a whole number of words.  */
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 023ebc37efb..ba98fbf6f82 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1299,7 +1299,7 @@  avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       int j;
       struct value *arg = args[i];
       struct type *type = check_typedef (arg->type ());
-      const bfd_byte *contents = value_contents (arg).data ();
+      const bfd_byte *contents = arg->contents ().data ();
       int len = type->length ();
 
       /* Calculate the potential last register needed.
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index e1be4b77071..4b9067a2d0f 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -530,7 +530,7 @@  bfin_push_dummy_call (struct gdbarch *gdbarch,
       int container_len = align_up (arg_type->length (), 4);
 
       sp -= container_len;
-      write_memory (sp, value_contents (args[i]).data (), container_len);
+      write_memory (sp, args[i]->contents ().data (), container_len);
     }
 
   /* Initialize R0, R1, and R2 to the first 3 words of parameters.  */
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 07f616338a6..c3524a9c9a1 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1861,7 +1861,7 @@  extract_bitfield_from_watchpoint_value (struct watchpoint *w, struct value *val)
   unpack_value_bitfield (bit_val,
 			 w->val_bitpos,
 			 w->val_bitsize,
-			 value_contents_for_printing (val).data (),
+			 val->contents_for_printing ().data (),
 			 val->offset (),
 			 val);
 
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index ec2e06027d2..e4027d8ee96 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -301,7 +301,7 @@  c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
       && (*length < 0 || *length <= fetchlimit))
     {
       int i;
-      const gdb_byte *contents = value_contents (value).data ();
+      const gdb_byte *contents = value->contents ().data ();
 
       /* If a length is specified, use that.  */
       if (*length >= 0)
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 63f3e50d350..55ba02996f3 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -237,7 +237,7 @@  c_value_print_array (struct value *val,
 {
   struct type *type = check_typedef (val->type ());
   CORE_ADDR address = val->address ();
-  const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+  const gdb_byte *valaddr = val->contents_for_printing ().data ();
   struct type *unresolved_elttype = type->target_type ();
   struct type *elttype = check_typedef (unresolved_elttype);
 
@@ -334,7 +334,7 @@  c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
     }
 
   struct type *type = check_typedef (val->type ());
-  const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+  const gdb_byte *valaddr = val->contents_for_printing ().data ();
 
   if (options->vtblprint && cp_is_vtbl_ptr_type (type))
     {
@@ -375,7 +375,7 @@  c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
 	 TYPE_CODE_PTR.)  */
       int offset = type->field (VTBL_FNADDR_OFFSET).loc_bitpos () / 8;
       struct type *field_type = type->field (VTBL_FNADDR_OFFSET).type ();
-      const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+      const gdb_byte *valaddr = val->contents_for_printing ().data ();
       CORE_ADDR addr = extract_typed_address (valaddr + offset, field_type);
 
       print_function_pointer_address (options, type->arch (), addr, stream);
@@ -406,7 +406,7 @@  c_value_print_int (struct value *val, struct ui_file *stream,
 	 intended to be used as an integer or a character, print
 	 the character equivalent as well.  */
       struct type *type = val->type ();
-      const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+      const gdb_byte *valaddr = val->contents_for_printing ().data ();
       if (c_textual_element_type (type, options->format))
 	{
 	  gdb_puts (" ", stream);
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index ce4bf6bc9cd..871785d8886 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2196,7 +2196,7 @@  setting_cmd (const char *fnname, struct cmd_list_element *showlist,
       && type0->code () != TYPE_CODE_STRING)
     error (_("First argument of %s must be a string."), fnname);
 
-  const char *a0 = (const char *) value_contents (argv[0]).data ();
+  const char *a0 = (const char *) argv[0]->contents ().data ();
   cmd_list_element *cmd = lookup_cmd (&a0, showlist, "", NULL, -1, 0);
 
   if (cmd == nullptr || cmd->type != show_cmd)
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 1e0051757f6..769f6a589b6 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -224,7 +224,7 @@  dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
 
   /* Have everything.  Open/write the data.  */
   if (file_format == NULL || strcmp (file_format, "binary") == 0)
-    dump_binary_file (filename.get (), mode, value_contents (val).data (),
+    dump_binary_file (filename.get (), mode, val->contents ().data (),
 		      val->type ()->length ());
   else
     {
@@ -241,7 +241,7 @@  dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
 	}
 
       dump_bfd_file (filename.get (), mode, file_format, vaddr,
-		     value_contents (val).data (), 
+		     val->contents ().data (), 
 		     val->type ()->length ());
     }
 }
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 83b97f13105..af4f6e2c2ef 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -585,7 +585,7 @@  store_regs (struct type *regs_type, CORE_ADDR regs_base)
 
       inferior_addr = regs_base + reg_offset;
       if (0 != target_write_memory (inferior_addr,
-				    value_contents (regval).data (),
+				    regval->contents ().data (),
 				    reg_size))
 	error (_("Cannot write register \"%s\" to inferior memory at %s."),
 	       reg_name, paddress (gdbarch, inferior_addr));
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 5f18d372aa3..687be9d4bd6 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -189,7 +189,7 @@  cp_print_value_fields (struct value *val, struct ui_file *stream,
       vptr_fieldno = get_vptr_fieldno (type, &vptr_basetype);
       for (i = n_baseclasses; i < len; i++)
 	{
-	  const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+	  const gdb_byte *valaddr = val->contents_for_printing ().data ();
 
 	  /* If requested, skip printing of static fields.  */
 	  if (!options->static_field_print
@@ -395,7 +395,7 @@  cp_print_value (struct value *val, struct ui_file *stream,
     = (struct type **) obstack_next_free (&dont_print_vb_obstack);
   struct obstack tmp_obstack = dont_print_vb_obstack;
   int i, n_baseclasses = TYPE_N_BASECLASSES (type);
-  const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+  const gdb_byte *valaddr = val->contents_for_printing ().data ();
 
   if (dont_print_vb == 0)
     {
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index cc8d7634c9d..af8fb95a5d2 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -822,7 +822,7 @@  cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       int i;
       
       len = args[argnum]->type ()->length ();
-      val = value_contents (args[argnum]).data ();
+      val = args[argnum]->contents ().data ();
       
       /* How may registers worth of storage do we need for this argument?  */
       reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0);
diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
index 9fa1fb37154..8fd68bab7a6 100644
--- a/gdb/csky-tdep.c
+++ b/gdb/csky-tdep.c
@@ -808,7 +808,7 @@  csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
       arg_type = check_typedef (args[argnum]->type ());
       len = arg_type->length ();
-      val = value_contents (args[argnum]).data ();
+      val = args[argnum]->contents ().data ();
 
       /* Copy the argument to argument registers or the dummy stack.
 	 Large arguments are split between registers and stack.
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index 173623ea028..b5e981874c1 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -48,7 +48,7 @@  dynamic_array_type (struct type *type,
       struct type *ptr_type;
       struct value *ival;
       int length;
-      const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+      const gdb_byte *valaddr = val->contents_for_printing ().data ();
 
       length = unpack_field_as_long (type, valaddr + embedded_offset, 0);
 
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index f2a1305713a..a1119e16c23 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -156,7 +156,7 @@  rw_pieced_value (value *v, value *from, bool check_optimized)
   gdb_assert (!check_optimized || from == nullptr);
   if (from != nullptr)
     {
-      from_contents = value_contents (from).data ();
+      from_contents = from->contents ().data ();
       v_contents = nullptr;
     }
   else
@@ -377,7 +377,7 @@  rw_pieced_value (value *v, value *from, bool check_optimized)
 	      bits_to_skip += p->offset;
 
 	    copy_bitwise (v_contents, offset,
-			  value_contents_all (p->v.value).data (),
+			  p->v.value->contents_all ().data (),
 			  bits_to_skip,
 			  this_size_bits, bits_big_endian);
 	  }
@@ -560,7 +560,7 @@  indirect_pieced_value (value *value)
      encode address spaces and other things in CORE_ADDR.  */
   bfd_endian byte_order = gdbarch_byte_order (get_frame_arch (frame));
   LONGEST byte_offset
-    = extract_signed_integer (value_contents (value), byte_order);
+    = extract_signed_integer (value->contents (), byte_order);
   byte_offset += piece->v.ptr.offset;
 
   return indirect_synthetic_pointer (piece->v.ptr.die_sect_off,
@@ -1025,7 +1025,7 @@  dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
 	    if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
 	      subobj_offset += n - max;
 
-	    copy (value_contents_all (val).slice (subobj_offset, len),
+	    copy (val->contents_all ().slice (subobj_offset, len),
 		  retval->contents_raw ());
 	  }
 	  break;
@@ -1145,7 +1145,7 @@  dwarf_expr_context::fetch_address (int n)
   ULONGEST result;
 
   dwarf_require_integral (result_val->type ());
-  result = extract_unsigned_integer (value_contents (result_val), byte_order);
+  result = extract_unsigned_integer (result_val->contents (), byte_order);
 
   /* For most architectures, calling extract_unsigned_integer() alone
      is sufficient for extracting an address.  However, some
@@ -2351,7 +2351,7 @@  dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	    else
 	      result_val
 		= value_from_contents (type,
-				       value_contents_all (result_val).data ());
+				       result_val->contents_all ().data ());
 	  }
 	  break;
 
diff --git a/gdb/eval.c b/gdb/eval.c
index 74ce57ac70c..dca98d07fbe 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -2418,7 +2418,7 @@  array_operation::evaluate_struct_tuple (struct value *struct_val,
 	modify_field (struct_type, addr,
 		      value_as_long (val), bitpos % 8, bitsize);
       else
-	memcpy (addr, value_contents (val).data (),
+	memcpy (addr, val->contents ().data (),
 		val->type ()->length ());
 
     }
@@ -2475,7 +2475,7 @@  array_operation::evaluate (struct type *expect_type,
 	    error (_("Too many array elements"));
 	  memcpy (array->contents_raw ().data ()
 		  + (index - low_bound) * element_size,
-		  value_contents (element).data (),
+		  element->contents ().data (),
 		  element_size);
 	  index++;
 	}
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 10c46fa0c29..f883b08e2ae 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -778,7 +778,7 @@  eval_op_f_abs (struct type *expect_type, struct expression *exp,
     case TYPE_CODE_FLT:
       {
 	double d
-	  = fabs (target_float_to_host_double (value_contents (arg1).data (),
+	  = fabs (target_float_to_host_double (arg1->contents ().data (),
 					       arg1->type ()));
 	return value_from_host_double (type, d);
       }
@@ -808,10 +808,10 @@  eval_op_f_mod (struct type *expect_type, struct expression *exp,
     case TYPE_CODE_FLT:
       {
 	double d1
-	  = target_float_to_host_double (value_contents (arg1).data (),
+	  = target_float_to_host_double (arg1->contents ().data (),
 					 arg1->type ());
 	double d2
-	  = target_float_to_host_double (value_contents (arg2).data (),
+	  = target_float_to_host_double (arg2->contents ().data (),
 					 arg2->type ());
 	double d3 = fmod (d1, d2);
 	return value_from_host_double (type, d3);
@@ -838,7 +838,7 @@  fortran_ceil_operation (value *arg1, type *result_type)
 {
   if (arg1->type ()->code () != TYPE_CODE_FLT)
     error (_("argument to CEILING must be of type float"));
-  double val = target_float_to_host_double (value_contents (arg1).data (),
+  double val = target_float_to_host_double (arg1->contents ().data (),
 					    arg1->type ());
   val = ceil (val);
   return value_from_longest (result_type, val);
@@ -877,7 +877,7 @@  fortran_floor_operation (value *arg1, type *result_type)
 {
   if (arg1->type ()->code () != TYPE_CODE_FLT)
     error (_("argument to FLOOR must be of type float"));
-  double val = target_float_to_host_double (value_contents (arg1).data (),
+  double val = target_float_to_host_double (arg1->contents ().data (),
 					    arg1->type ());
   val = floor (val);
   return value_from_longest (result_type, val);
@@ -933,10 +933,10 @@  eval_op_f_modulo (struct type *expect_type, struct expression *exp,
     case TYPE_CODE_FLT:
       {
 	double a
-	  = target_float_to_host_double (value_contents (arg1).data (),
+	  = target_float_to_host_double (arg1->contents ().data (),
 					 arg1->type ());
 	double p
-	  = target_float_to_host_double (value_contents (arg2).data (),
+	  = target_float_to_host_double (arg2->contents ().data (),
 					 arg2->type ());
 	double result = fmod (a, p);
 	if (result != 0 && (a < 0.0) != (p < 0.0))
@@ -1473,7 +1473,7 @@  fortran_undetermined::value_subarray (value *array,
 				   array->address () + total_offset);
 	  else
 	    array = value_from_contents_and_address
-	      (array_slice_type, value_contents (array).data () + total_offset,
+	      (array_slice_type, array->contents ().data () + total_offset,
 	       array->address () + total_offset);
 	}
       else if (!array->lazy ())
@@ -1631,7 +1631,7 @@  fortran_structop_operation::evaluate (struct type *expect_type,
       struct type *elt_type = elt->type ();
       if (is_dynamic_type (elt_type))
 	{
-	  const gdb_byte *valaddr = value_contents_for_printing (elt).data ();
+	  const gdb_byte *valaddr = elt->contents_for_printing ().data ();
 	  CORE_ADDR address = elt->address ();
 	  gdb::array_view<const gdb_byte> view
 	    = gdb::make_array_view (valaddr, elt_type->length ());
@@ -1878,9 +1878,9 @@  fortran_argument_convert (struct value *value, bool is_artificial)
 	  const int length = type->length ();
 	  const CORE_ADDR addr
 	    = value_as_long (value_allocate_space_in_inferior (length));
-	  write_memory (addr, value_contents (value).data (), length);
+	  write_memory (addr, value->contents ().data (), length);
 	  struct value *val = value_from_contents_and_address
-	    (type, value_contents (value).data (), addr);
+	    (type, value->contents ().data (), addr);
 	  return value_addr (val);
 	}
       else
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 8d4177f3243..4d42b22d960 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -438,7 +438,7 @@  f_language::value_print_inner (struct value *val, struct ui_file *stream,
   struct type *elttype;
   CORE_ADDR addr;
   int index;
-  const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+  const gdb_byte *valaddr = val->contents_for_printing ().data ();
   const CORE_ADDR address = val->address ();
 
   switch (type->code ())
diff --git a/gdb/findcmd.c b/gdb/findcmd.c
index 42604b1e85e..16a5fdd525b 100644
--- a/gdb/findcmd.c
+++ b/gdb/findcmd.c
@@ -185,7 +185,7 @@  parse_find_args (const char *args, ULONGEST *max_countp,
 	}
       else
 	{
-	  const gdb_byte *contents = value_contents (v).data ();
+	  const gdb_byte *contents = v->contents ().data ();
 	  pattern_buf.insert (pattern_buf.end (), contents,
 			      contents + t->length ());
 	}
diff --git a/gdb/frame.c b/gdb/frame.c
index 0fcf3f43492..2ca2a6b30fc 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1201,7 +1201,7 @@  frame_register_unwind (frame_info_ptr next_frame, int regnum,
   if (bufferp)
     {
       if (!*optimizedp && !*unavailablep)
-	memcpy (bufferp, value_contents_all (value).data (),
+	memcpy (bufferp, value->contents_all ().data (),
 		value->type ()->length ());
       else
 	memset (bufferp, 0, value->type ()->length ());
@@ -1311,7 +1311,7 @@  frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
 	  else
 	    {
 	      int i;
-	      gdb::array_view<const gdb_byte> buf = value_contents (value);
+	      gdb::array_view<const gdb_byte> buf = value->contents ();
 
 	      gdb_printf (&debug_file, " bytes=");
 	      gdb_printf (&debug_file, "[");
@@ -1353,7 +1353,7 @@  frame_unwind_register_signed (frame_info_ptr next_frame, int regnum)
 		   _("Register %d is not available"), regnum);
     }
 
-  LONGEST r = extract_signed_integer (value_contents_all (value), byte_order);
+  LONGEST r = extract_signed_integer (value->contents_all (), byte_order);
 
   release_value (value);
   return r;
@@ -1386,7 +1386,7 @@  frame_unwind_register_unsigned (frame_info_ptr next_frame, int regnum)
 		   _("Register %d is not available"), regnum);
     }
 
-  ULONGEST r = extract_unsigned_integer (value_contents_all (value).data (),
+  ULONGEST r = extract_unsigned_integer (value->contents_all ().data (),
 					 size, byte_order);
 
   release_value (value);
@@ -1412,7 +1412,7 @@  read_frame_register_unsigned (frame_info_ptr frame, int regnum,
       enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
       int size = register_size (gdbarch, VALUE_REGNUM (regval));
 
-      *val = extract_unsigned_integer (value_contents (regval).data (), size,
+      *val = extract_unsigned_integer (regval->contents ().data (), size,
 				       byte_order);
       return true;
     }
@@ -1546,7 +1546,7 @@  get_frame_register_bytes (frame_info_ptr frame, int regnum,
 	      return false;
 	    }
 
-	  memcpy (myaddr, value_contents_all (value).data () + offset,
+	  memcpy (myaddr, value->contents_all ().data () + offset,
 		  curr_len);
 	  release_value (value);
 	}
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index e9c9a9cd392..6c6050a919a 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1251,7 +1251,7 @@  frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	  /* The FDPIC ABI requires function descriptors to be passed instead
 	     of entry points.  */
 	  CORE_ADDR addr = extract_unsigned_integer
-			     (value_contents (arg).data (), 4, byte_order);
+	    (arg->contents ().data (), 4, byte_order);
 	  addr = find_func_descr (gdbarch, addr);
 	  store_unsigned_integer (valbuf, 4, byte_order, addr);
 	  typecode = TYPE_CODE_PTR;
@@ -1260,7 +1260,7 @@  frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	}
       else
 	{
-	  val = value_contents (arg).data ();
+	  val = arg->contents ().data ();
 	}
 
       while (len > 0)
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index ff8de6b2b49..73ccd1cf3f8 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4007,7 +4007,7 @@  is_unique_ancestor (struct type *base, struct value *val)
   int offset = -1;
 
   return is_unique_ancestor_worker (base, val->type (), &offset,
-				    value_contents_for_printing (val).data (),
+				    val->contents_for_printing ().data (),
 				    val->embedded_offset (),
 				    val->address (), val) == 1;
 }
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 2fa40085f49..6d1a36623f8 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -734,7 +734,7 @@  static struct value *
 gnuv3_method_ptr_to_value (struct value **this_p, struct value *method_ptr)
 {
   struct gdbarch *gdbarch;
-  const gdb_byte *contents = value_contents (method_ptr).data ();
+  const gdb_byte *contents = method_ptr->contents ().data ();
   CORE_ADDR ptr_value;
   struct type *self_type, *final_type, *method_type;
   LONGEST adjustment;
diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c
index 8f6c8849fd9..05788af15a6 100644
--- a/gdb/go-valprint.c
+++ b/gdb/go-valprint.c
@@ -52,7 +52,7 @@  print_go_string (struct type *type,
      unpack_value_field_as_pointer.  Do this until we can get
      unpack_value_field_as_pointer.  */
   LONGEST addr;
-  const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+  const gdb_byte *valaddr = val->contents_for_printing ().data ();
 
 
   if (! unpack_value_field_as_long (type, valaddr, embedded_offset, 0,
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index 09b1ce30024..df76f8a49d1 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -828,7 +828,7 @@  gdbscm_value_to_bytevector (SCM self)
     {
       type = check_typedef (type);
       length = type->length ();
-      contents = value_contents (value).data ();
+      contents = value->contents ().data ();
     }
   catch (const gdb_exception &except)
     {
@@ -978,7 +978,7 @@  gdbscm_value_to_real (SCM self)
     {
       if (is_floating_value (value))
 	{
-	  d = target_float_to_host_double (value_contents (value).data (),
+	  d = target_float_to_host_double (value->contents ().data (),
 					   type);
 	  check = value_from_host_double (type, d);
 	}
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index d53b6857ba5..d1494916f59 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -647,7 +647,7 @@  h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
     {
       struct type *type = args[argument]->type ();
       int len = type->length ();
-      char *contents = (char *) value_contents (args[argument]).data ();
+      char *contents = (char *) args[argument]->contents ().data ();
 
       /* Pad the argument appropriately.  */
       int padded_len = align_up (len, wordsize);
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 08fea0c091b..d054e8011e8 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -745,7 +745,7 @@  hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	      struct_ptr += align_up (type->length (), 8);
 	      if (write_pass)
 		write_memory (struct_end - struct_ptr,
-			      value_contents (arg).data (), type->length ());
+			      arg->contents ().data (), type->length ());
 	      store_unsigned_integer (param_val, 4, byte_order,
 				      struct_end - struct_ptr);
 	    }
@@ -757,13 +757,13 @@  hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	      param_len = align_up (type->length (), 4);
 	      store_unsigned_integer
 		(param_val, param_len, byte_order,
-		 unpack_long (type, value_contents (arg).data ()));
+		 unpack_long (type, arg->contents ().data ()));
 	    }
 	  else if (type->code () == TYPE_CODE_FLT)
 	    {
 	      /* Floating point value store, right aligned.  */
 	      param_len = align_up (type->length (), 4);
-	      memcpy (param_val, value_contents (arg).data (), param_len);
+	      memcpy (param_val, arg->contents ().data (), param_len);
 	    }
 	  else
 	    {
@@ -771,7 +771,7 @@  hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
 	      /* Small struct value are stored right-aligned.  */
 	      memcpy (param_val + param_len - type->length (),
-		      value_contents (arg).data (), type->length ());
+		      arg->contents ().data (), type->length ());
 
 	      /* Structures of size 5, 6 and 7 bytes are special in that
 		 the higher-ordered word is stored in the lower-ordered
@@ -1027,7 +1027,7 @@  hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		     the right halves of the floating point registers;
 		     the left halves are unused."  */
 		  regcache->cooked_write_part (regnum, offset % 8, len,
-					       value_contents (arg).data ());
+					       arg->contents ().data ());
 		}
 	    }
 	}
@@ -1051,7 +1051,7 @@  hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	{
 	  ULONGEST codeptr, fptr;
 
-	  codeptr = unpack_long (type, value_contents (arg).data ());
+	  codeptr = unpack_long (type, arg->contents ().data ());
 	  fptr = hppa64_convert_code_addr_to_fptr (gdbarch, codeptr);
 	  store_unsigned_integer (fptrbuf, type->length (), byte_order,
 				  fptr);
@@ -1059,7 +1059,7 @@  hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	}
       else
 	{
-	  valbuf = value_contents (arg).data ();
+	  valbuf = arg->contents ().data ();
 	}
 
       /* Always store the argument in memory.  */
@@ -2722,7 +2722,7 @@  hppa_frame_prev_register_helper (frame_info_ptr this_frame,
 	trad_frame_get_prev_register (this_frame, saved_regs,
 				      HPPA_PCOQ_HEAD_REGNUM);
 
-      pc = extract_unsigned_integer (value_contents_all (pcoq_val).data (),
+      pc = extract_unsigned_integer (pcoq_val->contents_all ().data (),
 				     size, byte_order);
       return frame_unwind_got_constant (this_frame, regnum, pc + 4);
     }
diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c
index abf68ef7c39..34de8e72918 100644
--- a/gdb/i386-darwin-tdep.c
+++ b/gdb/i386-darwin-tdep.c
@@ -189,7 +189,7 @@  i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	    {
 	      if (write_pass)
 		{
-		  const gdb_byte *val = value_contents_all (args[i]).data ();
+		  const gdb_byte *val = args[i]->contents_all ().data ();
 		  regcache->raw_write (I387_MM0_REGNUM(tdep) + num_m128, val);
 		}
 	      num_m128++;
@@ -200,7 +200,7 @@  i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 				     i386_darwin_arg_type_alignment (arg_type));
 	      if (write_pass)
 		write_memory (sp + args_space,
-			      value_contents_all (args[i]).data (),
+			      args[i]->contents_all ().data (),
 			      arg_type->length ());
 
 	      /* The System V ABI says that:
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index c6078e726ab..f12b9038f9e 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2733,7 +2733,7 @@  i386_thiscall_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		args_space_used = align_up (args_space_used, 16);
 
 	      write_memory (sp + args_space_used,
-			    value_contents_all (args[i]).data (), len);
+			    args[i]->contents_all ().data (), len);
 	      /* The System V ABI says that:
 
 	      "An argument's size is increased, if necessary, to make it a
@@ -2778,7 +2778,7 @@  i386_thiscall_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   /* The 'this' pointer needs to be in ECX.  */
   if (thiscall)
     regcache->cooked_write (I386_ECX_REGNUM,
-			    value_contents_all (args[0]).data ());
+			    args[0]->contents_all ().data ());
 
   /* If the PLT is position-independent, the SYSTEM V ABI requires %ebx to be
      set to the address of the GOT when doing a call to a PLT address.
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 04bbf71952b..e1cbab580eb 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -284,7 +284,7 @@  i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
 
 	  if (value_entirely_available (regval))
 	    {
-	      const gdb_byte *raw = value_contents (regval).data ();
+	      const gdb_byte *raw = regval->contents ().data ();
 
 	      gdb_puts ("0x", file);
 	      for (i = 9; i >= 0; i--)
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 7f09ce4b835..f714c98d8d4 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -1934,7 +1934,7 @@  ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
 	 that frame by adding the size of output:
 	    (sof (size of frame) - sol (size of locals)).  */
       val = ia64_frame_prev_register (this_frame, this_cache, IA64_CFM_REGNUM);
-      prev_cfm = extract_unsigned_integer (value_contents_all (val).data (),
+      prev_cfm = extract_unsigned_integer (val->contents_all ().data (),
 					   8, byte_order);
       bsp = rse_address_add (cache->bsp, -(cache->sof));
       prev_bsp =
@@ -1984,7 +1984,7 @@  ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
 	  /* Adjust the register number to account for register rotation.  */
 	  regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
 	}
-      prN = extract_bit_field (value_contents_all (pr_val).data (),
+      prN = extract_bit_field (pr_val->contents_all ().data (),
 			       regnum - VP0_REGNUM, 1);
       return frame_unwind_got_constant (this_frame, regnum, prN);
     }
@@ -1995,7 +1995,7 @@  ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
       ULONGEST unatN;
       unat_val = ia64_frame_prev_register (this_frame, this_cache,
 					   IA64_UNAT_REGNUM);
-      unatN = extract_bit_field (value_contents_all (unat_val).data (),
+      unatN = extract_bit_field (unat_val->contents_all ().data (),
 				 regnum - IA64_NAT0_REGNUM, 1);
       return frame_unwind_got_constant (this_frame, regnum, unatN);
     }
@@ -2118,11 +2118,11 @@  ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
 	  reg_val = ia64_frame_prev_register (this_frame, this_cache,
 					      IA64_CFM_REGNUM);
 	  prev_cfm = extract_unsigned_integer
-	    (value_contents_all (reg_val).data (), 8, byte_order);
+	    (reg_val->contents_all ().data (), 8, byte_order);
 	  reg_val = ia64_frame_prev_register (this_frame, this_cache,
 					      IA64_BSP_REGNUM);
 	  prev_bsp = extract_unsigned_integer
-	    (value_contents_all (reg_val).data (), 8, byte_order);
+	    (reg_val->contents_all ().data (), 8, byte_order);
 	  prev_bof = rse_address_add (prev_bsp, -(prev_cfm & 0x7f));
 
 	  addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM));
@@ -2957,7 +2957,7 @@  ia64_libunwind_frame_prev_register (frame_info_ptr this_frame,
 	  /* Adjust the register number to account for register rotation.  */
 	  regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
 	}
-      prN_val = extract_bit_field (value_contents_all (val).data (),
+      prN_val = extract_bit_field (val->contents_all ().data (),
 				   regnum - VP0_REGNUM, 1);
       return frame_unwind_got_constant (this_frame, regnum, prN_val);
     }
@@ -2966,7 +2966,7 @@  ia64_libunwind_frame_prev_register (frame_info_ptr this_frame,
     {
       ULONGEST unatN_val;
 
-      unatN_val = extract_bit_field (value_contents_all (val).data (),
+      unatN_val = extract_bit_field (val->contents_all ().data (),
 				     regnum - IA64_NAT0_REGNUM, 1);
       return frame_unwind_got_constant (this_frame, regnum, unatN_val);
     }
@@ -2981,11 +2981,11 @@  ia64_libunwind_frame_prev_register (frame_info_ptr this_frame,
 	 register will be if we pop the frame back which is why we might
 	 have been called.  We know that libunwind will pass us back the
 	 beginning of the current frame so we should just add sof to it.  */
-      prev_bsp = extract_unsigned_integer (value_contents_all (val).data (),
+      prev_bsp = extract_unsigned_integer (val->contents_all ().data (),
 					   8, byte_order);
       cfm_val = libunwind_frame_prev_register (this_frame, this_cache,
 					       IA64_CFM_REGNUM);
-      prev_cfm = extract_unsigned_integer (value_contents_all (cfm_val).data (),
+      prev_cfm = extract_unsigned_integer (cfm_val->contents_all ().data (),
 					   8, byte_order);
       prev_bsp = rse_address_add (prev_bsp, (prev_cfm & 0x7f));
 
@@ -3068,7 +3068,7 @@  ia64_libunwind_sigtramp_frame_prev_register (frame_info_ptr this_frame,
      method of getting previous registers.  */
   prev_ip_val = libunwind_frame_prev_register (this_frame, this_cache,
 					       IA64_IP_REGNUM);
-  prev_ip = extract_unsigned_integer (value_contents_all (prev_ip_val).data (),
+  prev_ip = extract_unsigned_integer (prev_ip_val->contents_all ().data (),
 				      8, byte_order);
 
   if (prev_ip == 0)
@@ -3750,7 +3750,7 @@  ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	{
 	  gdb_byte val_buf[8];
 	  ULONGEST faddr = extract_unsigned_integer
-	    (value_contents (arg).data (), 8, byte_order);
+	    (arg->contents ().data (), 8, byte_order);
 	  store_unsigned_integer (val_buf, 8, byte_order,
 				  find_func_descr (regcache, faddr,
 						   &funcdescaddr));
@@ -3782,7 +3782,7 @@  ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		 This is why we use store_unsigned_integer.  */
 	      store_unsigned_integer
 		(val_buf, 8, byte_order,
-		 extract_unsigned_integer (value_contents (arg).data (), len,
+		 extract_unsigned_integer (arg->contents ().data (), len,
 					   byte_order));
 	    }
 	  else
@@ -3796,7 +3796,7 @@  ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		 In this case, the data is Byte0-aligned.  Happy news,
 		 this means that we don't need to differentiate the
 		 handling of 8byte blocks and less-than-8bytes blocks.  */
-	      memcpy (val_buf, value_contents (arg).data () + argoffset,
+	      memcpy (val_buf, arg->contents ().data () + argoffset,
 		      (len > 8) ? 8 : len);
 	    }
 
@@ -3820,7 +3820,7 @@  ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	  while (len > 0 && floatreg < IA64_FR16_REGNUM)
 	    {
 	      gdb_byte to[IA64_FP_REGISTER_SIZE];
-	      target_float_convert (value_contents (arg).data () + argoffset,
+	      target_float_convert (arg->contents ().data () + argoffset,
 				    float_elt_type, to,
 				    ia64_ext_type (gdbarch));
 	      regcache->cooked_write (floatreg, to);
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 05ae1638857..d6992228498 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -1130,7 +1130,7 @@  call_function_by_hand_dummy (struct value *function,
       if (info.trivially_copy_constructible)
 	{
 	  int length = param_type->length ();
-	  write_memory (addr, value_contents (args[i]).data (), length);
+	  write_memory (addr, args[i]->contents ().data (), length);
 	}
       else
 	{
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 32d30c2a3e8..50378b111c0 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2181,7 +2181,7 @@  default_print_one_register_info (struct ui_file *file,
       || regtype->code () == TYPE_CODE_DECFLOAT)
     {
       struct value_print_options opts;
-      const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+      const gdb_byte *valaddr = val->contents_for_printing ().data ();
       enum bfd_endian byte_order = type_byte_order (regtype);
 
       get_user_print_options (&opts);
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index f2af69e46cd..d4509f93b74 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -711,7 +711,7 @@  iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
     {
       type = args[i]->type ();
       typelen = type->length ();
-      val = value_contents (args[i]).data ();
+      val = args[i]->contents ().data ();
       if (typelen <= 4)
 	{
 	  /* Char, short, int, float, pointer, and structs <= four bytes.  */
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 93e2ad940b5..23998f85dd8 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -260,7 +260,7 @@  lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
       /* FIXME: Handle structures.  */
 
-      contents = (gdb_byte *) value_contents (arg).data ();
+      contents = (gdb_byte *) arg->contents ().data ();
       val = extract_unsigned_integer (contents, arg_type->length (),
 				      byte_order);
 
diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
index f40a7b4912e..5f7a8a00ce7 100644
--- a/gdb/loongarch-tdep.c
+++ b/gdb/loongarch-tdep.c
@@ -565,7 +565,7 @@  loongarch_push_dummy_call (struct gdbarch *gdbarch,
   for (int i = 0; i < nargs; i++)
     {
       struct value *arg = args[i];
-      const gdb_byte *val = value_contents (arg).data ();
+      const gdb_byte *val = arg->contents ().data ();
       struct type *type = check_typedef (arg->type ());
       size_t len = type->length ();
       int align = type_align (type);
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index 73f9e37aee3..96a566fb810 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -165,7 +165,7 @@  m2_print_unbounded_array (struct value *value,
   struct value *val;
 
   struct type *type = check_typedef (value->type ());
-  const gdb_byte *valaddr = value_contents_for_printing (value).data ();
+  const gdb_byte *valaddr = value->contents_for_printing ().data ();
 
   addr = unpack_pointer (type->field (0).type (),
 			 (type->field (0).loc_bitpos () / 8) +
@@ -305,7 +305,7 @@  m2_language::value_print_inner (struct value *val, struct ui_file *stream,
   unsigned len;
   struct type *elttype;
   CORE_ADDR addr;
-  const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+  const gdb_byte *valaddr = val->contents_for_printing ().data ();
   const CORE_ADDR address = val->address ();
 
   struct type *type = check_typedef (val->type ());
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 23add82ae90..2899c9aef90 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -2061,7 +2061,7 @@  m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   for (i = nargs - 1; i >= 0; i--)
     {
       struct value *arg = args[i];
-      const gdb_byte *arg_bits = value_contents (arg).data ();
+      const gdb_byte *arg_bits = arg->contents ().data ();
       struct type *arg_type = arg->type ();
       ULONGEST arg_size = arg_type->length ();
 
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index a1d2ad6da80..ba525998e0c 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -707,11 +707,11 @@  m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	{
 	  /* Value gets right-justified in the register or stack word.  */
 	  memcpy (valbuf + (register_size (gdbarch, argreg) - len),
-		  (gdb_byte *) value_contents (args[argnum]).data (), len);
+		  (gdb_byte *) args[argnum]->contents ().data (), len);
 	  val = valbuf;
 	}
       else
-	val = (gdb_byte *) value_contents (args[argnum]).data ();
+	val = (gdb_byte *) args[argnum]->contents ().data ();
 
       while (len > 0)
 	{
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 86af4521edd..1257c55ce66 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -1177,7 +1177,7 @@  m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	{
 	  ULONGEST v;
 
-	  v = extract_unsigned_integer (value_contents (args[0]).data (),
+	  v = extract_unsigned_integer (args[0]->contents ().data (),
 					type->length (), byte_order);
 	  first_stack_argnum = 1;
 
@@ -1201,7 +1201,7 @@  m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	  sp--;
 	  write_memory (sp, &zero, 1);
 	}
-      val = value_contents (args[argnum]).data ();
+      val = args[argnum]->contents ().data ();
       sp -= type->length ();
       write_memory (sp, val, type->length ());
     }
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index e776060935c..cbd79765ab9 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -559,7 +559,7 @@  m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       else
 	offset = container_len - len;
       sp -= container_len;
-      write_memory (sp + offset, value_contents_all (args[i]).data (), len);
+      write_memory (sp + offset, args[i]->contents_all ().data (), len);
     }
 
   /* Store struct value address.  */
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index c70699d1c3d..fc786f09e44 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -2235,7 +2235,7 @@  push_large_arguments (CORE_ADDR sp, int argc, struct value **argv,
 	  /* Reserve space for the copy, and then round the SP down, to
 	     make sure it's all aligned properly.  */
 	  sp = (sp - arg_len) & -4;
-	  write_memory (sp, value_contents (argv[i]).data (), arg_len);
+	  write_memory (sp, argv[i]->contents ().data (), arg_len);
 	  copy[i] = sp;
 	}
     }
@@ -2289,7 +2289,7 @@  mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
       /* Arguments that fit in a GPR get expanded to fill the GPR.  */
       if (argv[i]->type ()->length () <= MEP_GPR_SIZE)
-	value = extract_unsigned_integer (value_contents (argv[i]).data (),
+	value = extract_unsigned_integer (argv[i]->contents ().data (),
 					  argv[i]->type ()->length (),
 					  byte_order);
 
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 349a89eb23d..19e0fdcf81e 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -4612,7 +4612,7 @@  mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	    gdb_printf (gdb_stdlog, " push");
 	}
       else
-	val = value_contents (arg).data ();
+	val = arg->contents ().data ();
 
       /* 32-bit ABIs always start floating point arguments in an
 	 even-numbered floating point register.  Round the FP register
@@ -4988,7 +4988,7 @@  mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		    "mips_n32n64_push_dummy_call: %d len=%d type=%d",
 		    argnum + 1, len, (int) typecode);
 
-      val = value_contents (arg).data ();
+      val = arg->contents ().data ();
 
       /* A 128-bit long double value requires an even-odd pair of
 	 floating-point registers.  */
@@ -5468,7 +5468,7 @@  mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		    "mips_o32_push_dummy_call: %d len=%d type=%d",
 		    argnum + 1, len, (int) typecode);
 
-      val = value_contents (arg).data ();
+      val = arg->contents ().data ();
 
       /* 32-bit ABIs always start floating point arguments in an
 	 even-numbered floating point register.  Round the FP register
@@ -5989,7 +5989,7 @@  mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		    "mips_o64_push_dummy_call: %d len=%d type=%d",
 		    argnum + 1, len, (int) typecode);
 
-      val = value_contents (arg).data ();
+      val = arg->contents ().data ();
 
       /* Floating point arguments passed in registers have to be
 	 treated specially.  On 32-bit architectures, doubles are
@@ -6595,7 +6595,7 @@  print_gp_register_row (struct ui_file *file, frame_info_ptr frame,
 	  col++;
 	  continue;
 	}
-      raw_buffer = value_contents_all (value).data ();
+      raw_buffer = value->contents_all ().data ();
       /* pad small registers */
       for (byte = 0;
 	   byte < (mips_abi_regsize (gdbarch)
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index aade7c3af07..f52b6990a60 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1218,7 +1218,7 @@  mn10300_push_dummy_call (struct gdbarch *gdbarch,
       else
 	{
 	  arg_len = (*args)->type ()->length ();
-	  val = value_contents (*args).data ();
+	  val = (*args)->contents ().data ();
 	}
 
       while (regs_used < 2 && arg_len > 0)
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index d4a40d4cd10..2768e4e3a21 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -689,7 +689,7 @@  msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       for (i = 0; i < nargs; i++)
 	{
 	  struct value *arg = args[i];
-	  const gdb_byte *arg_bits = value_contents_all (arg).data ();
+	  const gdb_byte *arg_bits = arg->contents_all ().data ();
 	  struct type *arg_type = check_typedef (arg->type ());
 	  ULONGEST arg_size = arg_type->length ();
 	  int offset;
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index 858b72c2509..c65bc1a47c5 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -1470,7 +1470,7 @@  nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       calling_use_fpr = nds32_check_calling_use_fpr (type);
       len = type->length ();
       align = type_align (type);
-      val = value_contents (args[i]).data ();
+      val = args[i]->contents ().data ();
 
       /* The size of a composite type larger than 4 bytes will be rounded
 	 up to the nearest multiple of 4.  */
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index e7ec4552827..40d65b64b18 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1839,7 +1839,7 @@  nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       struct type *arg_type = check_typedef (arg->type ());
       int len = arg_type->length ();
 
-      val = value_contents (arg).data ();
+      val = arg->contents ().data ();
 
       /* Copy the argument to general registers or the stack in
 	 register-sized pieces.  Large arguments are split between
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 81889b97e95..b3e82f4a6ae 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -140,7 +140,7 @@  lval_func_read (struct value *v)
 
   for (i = offset; i < n; i++)
     memcpy (v->contents_raw ().data () + j++ * elsize,
-	    value_contents (c->val).data () + c->indices[i] * elsize,
+	    c->val->contents ().data () + c->indices[i] * elsize,
 	    elsize);
 }
 
@@ -181,7 +181,7 @@  lval_func_write (struct value *v, struct value *fromval)
       struct value *to_elm_val = value_subscript (c->val, c->indices[i]);
 
       memcpy (from_elm_val->contents_writeable ().data (),
-	      value_contents (fromval).data () + j++ * elsize,
+	      fromval->contents ().data () + j++ * elsize,
 	      elsize);
       value_assign (to_elm_val, from_elm_val);
     }
@@ -315,7 +315,7 @@  create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside,
 	      for (i = 0; i < n; i++)
 		memcpy (ret->contents_writeable ().data ()
 			+ (i * elm_type->length ()),
-			value_contents (val).data ()
+			val->contents ().data ()
 			+ (indices[i] * elm_type->length ()),
 			elm_type->length ());
 	    }
@@ -837,7 +837,7 @@  Cannot perform conditional operation on vectors with different sizes"));
 	  tmp = value_logical_not (value_subscript (arg1, i)) ?
 	    value_subscript (arg3, i) : value_subscript (arg2, i);
 	  memcpy (ret->contents_writeable ().data () +
-		  i * eltype2->length (), value_contents_all (tmp).data (),
+		  i * eltype2->length (), tmp->contents_all ().data (),
 		  eltype2->length ());
 	}
 
diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index d485d552102..0d520661f09 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -685,7 +685,7 @@  or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	      heap_offset += align_up (len, bpw);
 	      valaddr = heap_sp + heap_offset;
 
-	      write_memory (valaddr, value_contents (arg).data (), len);
+	      write_memory (valaddr, arg->contents ().data (), len);
 	    }
 
 	  /* The ABI passes all structures by reference, so get its
@@ -697,7 +697,7 @@  or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       else
 	{
 	  /* Everything else, we just get the value.  */
-	  val = value_contents (arg).data ();
+	  val = arg->contents ().data ();
 	}
 
       /* Stick the value in a register.  */
@@ -797,7 +797,7 @@  or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	  val = valbuf;
 	}
       else
-	val = value_contents (arg).data ();
+	val = arg->contents ().data ();
 
       while (len > 0)
 	{
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 4b84ec1c43f..10d41523851 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -80,7 +80,7 @@  pascal_language::value_print_inner (struct value *val,
   struct type *char_type;
   CORE_ADDR addr;
   int want_space = 0;
-  const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+  const gdb_byte *valaddr = val->contents_for_printing ().data ();
 
   switch (type->code ())
     {
@@ -539,7 +539,7 @@  pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
     {
       struct obstack tmp_obstack = dont_print_statmem_obstack;
       int fields_seen = 0;
-      const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+      const gdb_byte *valaddr = val->contents_for_printing ().data ();
 
       if (dont_print_statmem == 0)
 	{
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 69cc784c558..3d270a4f7ac 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -124,7 +124,7 @@  ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	  struct value *arg = args[argno];
 	  struct type *type = check_typedef (arg->type ());
 	  int len = type->length ();
-	  const bfd_byte *val = value_contents (arg).data ();
+	  const bfd_byte *val = arg->contents ().data ();
 
 	  if (type->code () == TYPE_CODE_FLT && len <= 8
 	      && !tdep->soft_float)
@@ -1692,7 +1692,7 @@  ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
 	{
 	  struct value *arg = args[argno];
 	  struct type *type = check_typedef (arg->type ());
-	  const bfd_byte *val = value_contents (arg).data ();
+	  const bfd_byte *val = arg->contents ().data ();
 
 	  if (type->code () == TYPE_CODE_COMPLEX)
 	    {
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index bd442fe2855..94e531df446 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2441,7 +2441,7 @@  printf_c_string (struct ui_file *stream, const char *format,
 	 null terminated) to be printed without problems.  */
       gdb_byte *tem_str = (gdb_byte *) alloca (len + 1);
 
-      memcpy (tem_str, value_contents (value).data (), len);
+      memcpy (tem_str, value->contents ().data (), len);
       tem_str [len] = 0;
       str = tem_str;
     }
@@ -2505,7 +2505,7 @@  printf_wide_c_string (struct ui_file *stream, const char *format,
   if (VALUE_LVAL (value) == lval_internalvar
       && c_is_string_type_p (value->type ()))
     {
-      str = value_contents (value).data ();
+      str = value->contents ().data ();
       len = value->type ()->length ();
     }
   else
@@ -2615,14 +2615,14 @@  printf_floating (struct ui_file *stream, const char *format,
       param_type = float_type_from_length (param_type);
       if (param_type != value->type ())
 	value = value_from_contents (param_type,
-				     value_contents (value).data ());
+				     value->contents ().data ());
     }
 
   value = value_cast (fmt_type, value);
 
   /* Convert the value to a string and print it.  */
   std::string str
-    = target_float_to_string (value_contents (value).data (), fmt_type, format);
+    = target_float_to_string (value->contents ().data (), fmt_type, format);
   gdb_puts (str.c_str (), stream);
 }
 
@@ -2783,7 +2783,7 @@  ui_printf (const char *arg, struct ui_file *stream)
 		  || valtype->code () != TYPE_CODE_INT)
 		error (_("expected wchar_t argument for %%lc"));
 
-	      bytes = value_contents (val_args[i]).data ();
+	      bytes = val_args[i]->contents ().data ();
 
 	      auto_obstack output;
 
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 1a3dcc23aa3..8b21f28afbe 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -714,7 +714,7 @@  infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
   else if (gdbpy_is_value_object (handle_obj))
     {
       struct value *val = value_object_to_value (handle_obj);
-      bytes = value_contents_all (val).data ();
+      bytes = val->contents_all ().data ();
       bytes_len = val->type ()->length ();
     }
   else
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index 442251201f2..97b472f25b1 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -131,7 +131,7 @@  pyuw_value_obj_to_pointer (PyObject *pyo_value, CORE_ADDR *addr)
       if ((value = value_object_to_value (pyo_value)) != NULL)
 	{
 	  *addr = unpack_pointer (value->type (),
-				  value_contents (value).data ());
+				  value->contents ().data ());
 	  rc = 1;
 	}
     }
@@ -624,7 +624,7 @@  pyuw_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame,
 
 	cached_frame->reg[i].data = (gdb_byte *) xmalloc (data_size);
 	memcpy (cached_frame->reg[i].data,
-		value_contents (value).data (), data_size);
+		value->contents ().data (), data_size);
       }
   }
 
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index c2db2d58b0d..26cbac3586c 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -1537,7 +1537,7 @@  valpy_nonzero (PyObject *self)
 	nonzero = !!value_as_long (self_value->value);
       else if (is_floating_value (self_value->value))
 	nonzero = !target_float_is_zero
-	  (value_contents (self_value->value).data (), type);
+	  (self_value->value->contents ().data (), type);
       else
 	/* All other values are True.  */
 	nonzero = 1;
@@ -1755,7 +1755,7 @@  valpy_float (PyObject *self)
       type = check_typedef (type);
 
       if (type->code () == TYPE_CODE_FLT && is_floating_value (value))
-	d = target_float_to_host_double (value_contents (value).data (), type);
+	d = target_float_to_host_double (value->contents ().data (), type);
       else if (type->code () == TYPE_CODE_INT)
 	{
 	  /* Note that valpy_long accepts TYPE_CODE_PTR and some
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index f8be46c9fb6..78c23ee86fc 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1141,7 +1141,7 @@  riscv_print_one_register_info (struct gdbarch *gdbarch,
 	  && regtype->field (2).type ()->code () == TYPE_CODE_FLT))
     {
       struct value_print_options opts;
-      const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+      const gdb_byte *valaddr = val->contents_for_printing ().data ();
       enum bfd_endian byte_order = type_byte_order (regtype);
 
       get_user_print_options (&opts);
@@ -3070,7 +3070,7 @@  riscv_push_dummy_call (struct gdbarch *gdbarch,
 
       if (info->type != arg_type)
 	arg_value = value_cast (info->type, arg_value);
-      info->contents = value_contents (arg_value).data ();
+      info->contents = arg_value->contents ().data ();
     }
 
   /* Adjust the stack pointer and align it.  */
@@ -3405,7 +3405,7 @@  riscv_return_value (struct gdbarch  *gdbarch,
 		 is unscaled.  */
 	      gdb_mpz unscaled;
 
-	      unscaled.read (value_contents (abi_val),
+	      unscaled.read (abi_val->contents (),
 			     type_byte_order (info.type),
 			     info.type->is_unsigned ());
 	      *read_value = value::allocate (arg_type);
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index cd846669169..1af78d9c652 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -1346,7 +1346,7 @@  rl78_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
       sp -= container_len;
       write_memory (rl78_make_data_address (sp),
-		    value_contents_all (args[i]).data (), len);
+		    args[i]->contents_all ().data (), len);
     }
 
   /* Store struct value address.  */
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 579f85f3870..15602c80b00 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -367,7 +367,7 @@  rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
 	  gdb_assert (len <= 8);
 
-	  target_float_convert (value_contents (arg).data (), type, reg_val,
+	  target_float_convert (arg->contents ().data (), type, reg_val,
 				reg_type);
 	  regcache->cooked_write (fp_regnum, reg_val);
 	  ++f_argno;
@@ -382,7 +382,7 @@  rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	      gdb_byte word[PPC_MAX_REGISTER_SIZE];
 	      memset (word, 0, reg_size);
 	      memcpy (word,
-		      ((char *) value_contents (arg).data ()) + argbytes,
+		      ((char *) arg->contents ().data ()) + argbytes,
 		      (len - argbytes) > reg_size
 			? reg_size : len - argbytes);
 	      regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
@@ -406,9 +406,9 @@  rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	     || type->code () == TYPE_CODE_CHAR)
 	    /* Sign or zero extend the "int" into a "word".  */
 	    store_unsigned_integer (word, reg_size, byte_order,
-				    unpack_long (type, value_contents (arg).data ()));
+				    unpack_long (type, arg->contents ().data ()));
 	  else
-	    memcpy (word, value_contents (arg).data (), len);
+	    memcpy (word, arg->contents ().data (), len);
 	  regcache->cooked_write (tdep->ppc_gp0_regnum + 3 +ii, word);
 	}
       ++argno;
@@ -469,7 +469,7 @@  rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       if (argbytes)
 	{
 	  write_memory (sp + 24 + (ii * 4),
-			value_contents (arg).data () + argbytes,
+			arg->contents ().data () + argbytes,
 			len - argbytes);
 	  ++argno;
 	  ii += ((len - argbytes + 3) & -4) / 4;
@@ -492,11 +492,11 @@  rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	      gdb_assert (len <= 8);
 
 	      regcache->cooked_write (tdep->ppc_fp0_regnum + 1 + f_argno,
-				      value_contents (arg).data ());
+				      arg->contents ().data ());
 	      ++f_argno;
 	    }
 
-	  write_memory (sp + 24 + (ii * 4), value_contents (arg).data (), len);
+	  write_memory (sp + 24 + (ii * 4), arg->contents ().data (), len);
 	  ii += ((len + 3) & -4) / 4;
 	}
     }
diff --git a/gdb/rs6000-lynx178-tdep.c b/gdb/rs6000-lynx178-tdep.c
index 4d210737535..c5ae38f9200 100644
--- a/gdb/rs6000-lynx178-tdep.c
+++ b/gdb/rs6000-lynx178-tdep.c
@@ -111,7 +111,7 @@  rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
 
 	  gdb_assert (len <= 8);
 
-	  target_float_convert (value_contents (arg).data (), type, reg_val,
+	  target_float_convert (arg->contents ().data (), type, reg_val,
 				reg_type);
 	  regcache->cooked_write (fp_regnum, reg_val);
 	  ++f_argno;
@@ -126,7 +126,7 @@  rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
 	      gdb_byte word[PPC_MAX_REGISTER_SIZE];
 	      memset (word, 0, reg_size);
 	      memcpy (word,
-		      ((char *) value_contents (arg).data ()) + argbytes,
+		      ((char *) arg->contents ().data ()) + argbytes,
 		      (len - argbytes) > reg_size
 			? reg_size : len - argbytes);
 	      regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
@@ -144,7 +144,7 @@  rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
 	  gdb_byte word[PPC_MAX_REGISTER_SIZE];
 
 	  memset (word, 0, reg_size);
-	  memcpy (word, value_contents (arg).data (), len);
+	  memcpy (word, arg->contents ().data (), len);
 	  regcache->cooked_write (tdep->ppc_gp0_regnum + 3 +ii, word);
 	}
       ++argno;
@@ -206,7 +206,7 @@  rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
       if (argbytes)
 	{
 	  write_memory (sp + 24 + (ii * 4),
-			value_contents (arg).data () + argbytes,
+			arg->contents ().data () + argbytes,
 			len - argbytes);
 	  ++argno;
 	  ii += align_up (len - argbytes, 4) / 4;
@@ -229,11 +229,11 @@  rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
 	      gdb_assert (len <= 8);
 
 	      regcache->cooked_write (tdep->ppc_fp0_regnum + 1 + f_argno,
-				      value_contents (arg).data ());
+				      arg->contents ().data ());
 	      ++f_argno;
 	    }
 
-	  write_memory (sp + 24 + (ii * 4), value_contents (arg).data (), len);
+	  write_memory (sp + 24 + (ii * 4), arg->contents ().data (), len);
 	  ii += align_up (len, 4) / 4;
 	}
     }
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index cca2baa6f63..a5be110a33b 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -456,7 +456,7 @@  rust_language::print_enum (struct value *val, struct ui_file *stream,
 
   gdb_assert (rust_enum_p (type));
   gdb::array_view<const gdb_byte> view
-    (value_contents_for_printing (val).data (),
+    (val->contents_for_printing ().data (),
      val->type ()->length ());
   type = resolve_dynamic_type (type, view, val->address ());
 
@@ -585,7 +585,7 @@  rust_language::value_print_inner
 	   encoding.  */
 	gdb_puts ("b", stream);
 	printstr (stream, type->target_type (),
-		  value_contents_for_printing (val).data (),
+		  val->contents_for_printing ().data (),
 		  high_bound - low_bound + 1, "ASCII", 0, &opts);
       }
       break;
@@ -1374,7 +1374,7 @@  rust_struct_anon::evaluate (struct type *expect_type,
 
       if (rust_enum_p (type))
 	{
-	  type = resolve_dynamic_type (type, value_contents (lhs),
+	  type = resolve_dynamic_type (type, lhs->contents (),
 				       lhs->address ());
 
 	  if (rust_empty_enum_p (type))
@@ -1437,7 +1437,7 @@  rust_structop::evaluate (struct type *expect_type,
   struct type *type = lhs->type ();
   if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type))
     {
-      type = resolve_dynamic_type (type, value_contents (lhs),
+      type = resolve_dynamic_type (type, lhs->contents (),
 				   lhs->address ());
 
       if (rust_empty_enum_p (type))
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 67db30ace88..7bd469d5185 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -520,7 +520,7 @@  rx_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
 	  psw_val = rx_frame_prev_register (this_frame, this_cache,
 					    RX_PSW_REGNUM);
 	  psw = extract_unsigned_integer
-	    (value_contents_all (psw_val).data (), 4,
+	    (psw_val->contents_all ().data (), 4,
 	     gdbarch_byte_order (get_frame_arch (this_frame)));
 
 	  if ((psw & 0x20000 /* U bit */) != 0)
@@ -725,7 +725,7 @@  rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       for (i = 0; i < nargs; i++)
 	{
 	  struct value *arg = args[i];
-	  const gdb_byte *arg_bits = value_contents_all (arg).data ();
+	  const gdb_byte *arg_bits = arg->contents_all ().data ();
 	  struct type *arg_type = check_typedef (arg->type ());
 	  ULONGEST arg_size = arg_type->length ();
 
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 822f66dfc3c..7d2cdf2a873 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -1764,7 +1764,7 @@  s390_handle_arg (struct s390_arg_state *as, struct value *arg,
 	     it occupies the leftmost bits.  */
 	  if (write_mode)
 	    as->regcache->cooked_write_part (S390_F0_REGNUM + as->fr, 0, length,
-					     value_contents (arg).data ());
+					     arg->contents ().data ());
 	  as->fr += 2;
 	}
       else
@@ -1773,7 +1773,7 @@  s390_handle_arg (struct s390_arg_state *as, struct value *arg,
 	     it occupies the rightmost bits.  */
 	  as->argp = align_up (as->argp + length, word_size);
 	  if (write_mode)
-	    write_memory (as->argp - length, value_contents (arg).data (),
+	    write_memory (as->argp - length, arg->contents ().data (),
 			  length);
 	}
     }
@@ -1788,13 +1788,13 @@  s390_handle_arg (struct s390_arg_state *as, struct value *arg,
 
 	  if (write_mode)
 	    as->regcache->cooked_write_part (regnum, 0, length,
-					     value_contents (arg).data ());
+					     arg->contents ().data ());
 	  as->vr++;
 	}
       else
 	{
 	  if (write_mode)
-	    write_memory (as->argp, value_contents (arg).data (), length);
+	    write_memory (as->argp, arg->contents ().data (), length);
 	  as->argp = align_up (as->argp + length, word_size);
 	}
     }
@@ -1809,9 +1809,9 @@  s390_handle_arg (struct s390_arg_state *as, struct value *arg,
 	     memory word and sign- or zero-extend to full word size.
 	     This also applies to a struct or union.  */
 	  val = type->is_unsigned ()
-	    ? extract_unsigned_integer (value_contents (arg).data (),
+	    ? extract_unsigned_integer (arg->contents ().data (),
 					length, byte_order)
-	    : extract_signed_integer (value_contents (arg).data (),
+	    : extract_signed_integer (arg->contents ().data (),
 				      length, byte_order);
 	}
 
@@ -1838,10 +1838,10 @@  s390_handle_arg (struct s390_arg_state *as, struct value *arg,
 	  if (write_mode)
 	    {
 	      as->regcache->cooked_write (S390_R0_REGNUM + as->gr,
-					  value_contents (arg).data ());
+					  arg->contents ().data ());
 	      as->regcache->cooked_write
 		(S390_R0_REGNUM + as->gr + 1,
-		 value_contents (arg).data () + word_size);
+		 arg->contents ().data () + word_size);
 	    }
 	  as->gr += 2;
 	}
@@ -1852,7 +1852,7 @@  s390_handle_arg (struct s390_arg_state *as, struct value *arg,
 	  as->gr = 7;
 
 	  if (write_mode)
-	    write_memory (as->argp, value_contents (arg).data (), length);
+	    write_memory (as->argp, arg->contents ().data (), length);
 	  as->argp += length;
 	}
     }
@@ -1863,7 +1863,7 @@  s390_handle_arg (struct s390_arg_state *as, struct value *arg,
 	 alignment as a conservative assumption.  */
       as->copy = align_down (as->copy - length, 8);
       if (write_mode)
-	write_memory (as->copy, value_contents (arg).data (), length);
+	write_memory (as->copy, arg->contents ().data (), length);
 
       if (as->gr <= 6)
 	{
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index c98df0223e9..60f15f1b58e 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -883,12 +883,12 @@  sh_justify_value_in_reg (struct gdbarch *gdbarch, struct value *val, int len)
     {
       /* value gets right-justified in the register or stack word.  */
       if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
-	memcpy (valbuf + (4 - len), value_contents (val).data (), len);
+	memcpy (valbuf + (4 - len), val->contents ().data (), len);
       else
-	memcpy (valbuf, value_contents (val).data (), len);
+	memcpy (valbuf, val->contents ().data (), len);
       return valbuf;
     }
-  return value_contents (val).data ();
+  return val->contents ().data ();
 }
 
 /* Helper function to eval number of bytes to allocate on stack.  */
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 5e582c7b77a..78f240db04e 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -633,7 +633,7 @@  sparc32_store_arguments (struct regcache *regcache, int nargs,
 	     correct, and wasting a few bytes shouldn't be a problem.  */
 	  sp &= ~0x7;
 
-	  write_memory (sp, value_contents (args[i]).data (), len);
+	  write_memory (sp, args[i]->contents ().data (), len);
 	  args[i] = value_from_pointer (lookup_pointer_type (type), sp);
 	  num_elements++;
 	}
@@ -664,7 +664,7 @@  sparc32_store_arguments (struct regcache *regcache, int nargs,
 
   for (i = 0; i < nargs; i++)
     {
-      const bfd_byte *valbuf = value_contents (args[i]).data ();
+      const bfd_byte *valbuf = args[i]->contents ().data ();
       struct type *type = args[i]->type ();
       int len = type->length ();
       gdb_byte buf[4];
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index eb6a66315c0..19534fc7379 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -1411,7 +1411,7 @@  sparc64_store_arguments (struct regcache *regcache, int nargs,
 		 a problem.  */
 	      sp &= ~0xf;
 
-	      write_memory (sp, value_contents (args[i]).data (), len);
+	      write_memory (sp, args[i]->contents ().data (), len);
 	      args[i] = value_from_pointer (lookup_pointer_type (type), sp);
 	      num_elements++;
 	    }
@@ -1480,7 +1480,7 @@  sparc64_store_arguments (struct regcache *regcache, int nargs,
 
   for (i = 0; i < nargs; i++)
     {
-      const gdb_byte *valbuf = value_contents (args[i]).data ();
+      const gdb_byte *valbuf = args[i]->contents ().data ();
       struct type *type = args[i]->type ();
       int len = type->length ();
       int regnum = -1;
diff --git a/gdb/stack.c b/gdb/stack.c
index cd5e391debe..576947c5dac 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1717,7 +1717,7 @@  info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
 		int sp_size = register_size (gdbarch, sp_regnum);
 
 		sp = extract_unsigned_integer
-		  (value_contents_all (value).data (), sp_size, byte_order);
+		  (value->contents_all ().data (), sp_size, byte_order);
 
 		gdb_printf (" Previous frame's sp is ");
 		gdb_puts (paddress (gdbarch, sp));
@@ -2825,7 +2825,7 @@  return_command (const char *retval_exp, int from_tty)
       gdbarch_return_value_as_value
 	(cache_arch, function, return_type,
 	 get_current_regcache (), NULL /*read*/,
-	 value_contents (return_value).data () /*write*/);
+	 return_value->contents ().data () /*write*/);
     }
 
   /* If we are at the end of a call dummy now, pop the dummy frame
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index 000a2a9aaa5..568e5a233db 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -917,7 +917,7 @@  tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       int len = arg_type->length ();
       enum type_code typecode = arg_type->code ();
 
-      val = value_contents (arg).data ();
+      val = arg->contents ().data ();
 
       /* Copy the argument to general registers or the stack in
 	 register-sized pieces.  */
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 8f005e81dcc..1ec37d45d79 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -304,7 +304,7 @@  tilegx_push_dummy_call (struct gdbarch *gdbarch,
 	break;
 
       /* Put argument into registers wordwise.	*/
-      val = value_contents (args[i]).data ();
+      val = args[i]->contents ().data ();
       for (j = 0; j < typelen; j += tilegx_reg_size)
 	{
 	  /* ISSUE: Why special handling for "typelen = 4x + 1"?
@@ -323,7 +323,7 @@  tilegx_push_dummy_call (struct gdbarch *gdbarch,
      the stack, word aligned.  */
   for (j = nargs - 1; j >= i; j--)
     {
-      const gdb_byte *contents = value_contents (args[j]).data ();
+      const gdb_byte *contents = args[j]->contents ().data ();
 
       typelen = args[j]->enclosing_type ()->length ();
       slacklen = align_up (typelen, 8) - typelen;
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 74451bbaa9b..240536805d7 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1066,7 +1066,7 @@  v850_push_dummy_call (struct gdbarch *gdbarch,
       else
 	{
 	  len = (*args)->type ()->length ();
-	  val = (gdb_byte *) value_contents (*args).data ();
+	  val = (gdb_byte *) (*args)->contents ().data ();
 	}
 
       if (tdep->eight_byte_align
diff --git a/gdb/valarith.c b/gdb/valarith.c
index adc7da76b65..a453eb1f40d 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -703,8 +703,8 @@  value_concat (struct value *arg1, struct value *arg2)
 
   struct value *result = value::allocate (atype);
   gdb::array_view<gdb_byte> contents = result->contents_raw ();
-  gdb::array_view<const gdb_byte> lhs_contents = value_contents (arg1);
-  gdb::array_view<const gdb_byte> rhs_contents = value_contents (arg2);
+  gdb::array_view<const gdb_byte> lhs_contents = arg1->contents ();
+  gdb::array_view<const gdb_byte> rhs_contents = arg2->contents ();
   gdb::copy (lhs_contents, contents.slice (0, lhs_contents.size ()));
   gdb::copy (rhs_contents, contents.slice (lhs_contents.size ()));
 
@@ -770,7 +770,7 @@  value_args_as_target_float (struct value *arg1, struct value *arg2,
   if (is_floating_type (type1))
     {
       *eff_type_x = type1;
-      memcpy (x, value_contents (arg1).data (), type1->length ());
+      memcpy (x, arg1->contents ().data (), type1->length ());
     }
   else if (is_integral_type (type1))
     {
@@ -789,7 +789,7 @@  value_args_as_target_float (struct value *arg1, struct value *arg2,
   if (is_floating_type (type2))
     {
       *eff_type_y = type2;
-      memcpy (y, value_contents (arg2).data (), type2->length ());
+      memcpy (y, arg2->contents ().data (), type2->length ());
     }
   else if (is_integral_type (type2))
     {
@@ -844,10 +844,10 @@  fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
 	  type2 = type1;
 	}
 
-      v1.read_fixed_point (value_contents (arg1),
+      v1.read_fixed_point (arg1->contents (),
 			   type_byte_order (type1), type1->is_unsigned (),
 			   type1->fixed_point_scaling_factor ());
-      v2.read_fixed_point (value_contents (arg2),
+      v2.read_fixed_point (arg2->contents (),
 			   type_byte_order (type2), type2->is_unsigned (),
 			   type2->fixed_point_scaling_factor ());
     }
@@ -1572,7 +1572,7 @@  value_vector_widen (struct value *scalar_value, struct type *vector_type)
 
   for (i = 0; i < high_bound - low_bound + 1; i++)
     /* Duplicate the contents of elval into the destination vector.  */
-    copy (value_contents_all (elval),
+    copy (elval->contents_all (),
 	  val_contents.slice (i * elt_len, elt_len));
 
   return val;
@@ -1620,7 +1620,7 @@  vector_binop (struct value *val1, struct value *val2, enum exp_opcode op)
     {
       value *tmp = value_binop (value_subscript (val1, i),
 				value_subscript (val2, i), op);
-      copy (value_contents_all (tmp),
+      copy (tmp->contents_all (),
 	    val_contents.slice (i * elsize, elsize));
      }
 
@@ -1677,10 +1677,10 @@  value_logical_not (struct value *arg1)
   type1 = check_typedef (arg1->type ());
 
   if (is_floating_value (arg1))
-    return target_float_is_zero (value_contents (arg1).data (), type1);
+    return target_float_is_zero (arg1->contents ().data (), type1);
 
   len = type1->length ();
-  p = value_contents (arg1).data ();
+  p = arg1->contents ().data ();
 
   while (--len >= 0)
     {
@@ -1699,8 +1699,8 @@  value_strcmp (struct value *arg1, struct value *arg2)
 {
   int len1 = arg1->type ()->length ();
   int len2 = arg2->type ()->length ();
-  const gdb_byte *s1 = value_contents (arg1).data ();
-  const gdb_byte *s2 = value_contents (arg2).data ();
+  const gdb_byte *s1 = arg1->contents ().data ();
+  const gdb_byte *s2 = arg2->contents ().data ();
   int i, len = len1 < len2 ? len1 : len2;
 
   for (i = 0; i < len; i++)
@@ -1775,8 +1775,8 @@  value_equal (struct value *arg1, struct value *arg2)
 	   && ((len = (int) type1->length ())
 	       == (int) type2->length ()))
     {
-      p1 = value_contents (arg1).data ();
-      p2 = value_contents (arg2).data ();
+      p1 = arg1->contents ().data ();
+      p2 = arg2->contents ().data ();
       while (--len >= 0)
 	{
 	  if (*p1++ != *p2++)
@@ -1806,8 +1806,8 @@  value_equal_contents (struct value *arg1, struct value *arg2)
 
   return (type1->code () == type2->code ()
 	  && type1->length () == type2->length ()
-	  && memcmp (value_contents (arg1).data (),
-		     value_contents (arg2).data (),
+	  && memcmp (arg1->contents ().data (),
+		     arg2->contents ().data (),
 		     type1->length ()) == 0);
 }
 
@@ -1882,7 +1882,7 @@  value_pos (struct value *arg1)
   if (is_integral_type (type) || is_floating_value (arg1)
       || (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
       || type->code () == TYPE_CODE_COMPLEX)
-    return value_from_contents (type, value_contents (arg1).data ());
+    return value_from_contents (type, arg1->contents ().data ());
   else
     error (_("Argument to positive operation not a number."));
 }
@@ -1915,7 +1915,7 @@  value_neg (struct value *arg1)
       for (i = 0; i < high_bound - low_bound + 1; i++)
 	{
 	  value *tmp = value_neg (value_subscript (arg1, i));
-	  copy (value_contents_all (tmp),
+	  copy (tmp->contents_all (),
 		val_contents.slice (i * elt_len, elt_len));
 	}
       return val;
@@ -1960,7 +1960,7 @@  value_complement (struct value *arg1)
       for (i = 0; i < high_bound - low_bound + 1; i++)
 	{
 	  value *tmp = value_complement (value_subscript (arg1, i));
-	  copy (value_contents_all (tmp),
+	  copy (tmp->contents_all (),
 		val_contents.slice (i * elt_len, elt_len));
 	}
     }
@@ -2022,7 +2022,7 @@  value_in (struct value *element, struct value *set)
       && eltype->code () != TYPE_CODE_ENUM
       && eltype->code () != TYPE_CODE_BOOL)
     error (_("First argument of 'IN' has wrong type"));
-  member = value_bit_index (settype, value_contents (set).data (),
+  member = value_bit_index (settype, set->contents ().data (),
 			    value_as_long (element));
   if (member < 0)
     error (_("First argument of 'IN' not in range"));
diff --git a/gdb/valops.c b/gdb/valops.c
index d2249d79b15..efe75e12da6 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -342,7 +342,7 @@  value_to_gdb_mpq (struct value *value)
   gdb_mpq result;
   if (is_floating_type (type))
     {
-      double d = target_float_to_host_double (value_contents (value).data (),
+      double d = target_float_to_host_double (value->contents ().data (),
 					      type);
       mpq_set_d (result.val, d);
     }
@@ -352,7 +352,7 @@  value_to_gdb_mpq (struct value *value)
 		  || is_fixed_point_type (type));
 
       gdb_mpz vz;
-      vz.read (value_contents (value), type_byte_order (type),
+      vz.read (value->contents (), type_byte_order (type),
 	       type->is_unsigned ());
       mpq_set_z (result.val, vz.val);
 
@@ -544,7 +544,7 @@  value_cast (struct type *type, struct value *arg2)
       if (is_floating_value (arg2))
 	{
 	  struct value *v = value::allocate (to_type);
-	  target_float_convert (value_contents (arg2).data (), type2,
+	  target_float_convert (arg2->contents ().data (), type2,
 				v->contents_raw ().data (), type);
 	  return v;
 	}
@@ -552,7 +552,7 @@  value_cast (struct type *type, struct value *arg2)
 	{
 	  gdb_mpq fp_val;
 
-	  fp_val.read_fixed_point (value_contents (arg2),
+	  fp_val.read_fixed_point (arg2->contents (),
 				   type_byte_order (type2),
 				   type2->is_unsigned (),
 				   type2->fixed_point_scaling_factor ());
@@ -584,7 +584,7 @@  value_cast (struct type *type, struct value *arg2)
 	 bits.  */
       if (code2 == TYPE_CODE_PTR)
 	longest = extract_unsigned_integer
-		    (value_contents (arg2), type_byte_order (type2));
+	  (arg2->contents (), type_byte_order (type2));
       else
 	longest = value_as_long (arg2);
       return value_from_longest (to_type, convert_to_boolean ?
@@ -902,7 +902,7 @@  value_dynamic_cast (struct type *type, struct value *arg)
 	return tem;
       result = NULL;
       if (dynamic_cast_check_1 (resolved_type->target_type (),
-				value_contents_for_printing (tem).data (),
+				tem->contents_for_printing ().data (),
 				tem->embedded_offset (),
 				tem->address (), tem,
 				rtti_type, addr,
@@ -918,7 +918,7 @@  value_dynamic_cast (struct type *type, struct value *arg)
   result = NULL;
   if (is_public_ancestor (arg_type, rtti_type)
       && dynamic_cast_check_2 (resolved_type->target_type (),
-			       value_contents_for_printing (tem).data (),
+			       tem->contents_for_printing ().data (),
 			       tem->embedded_offset (),
 			       tem->address (), tem,
 			       rtti_type, &result) == 1)
@@ -961,7 +961,7 @@  value_one (struct type *type)
       for (i = 0; i < high_bound - low_bound + 1; i++)
 	{
 	  value *tmp = value_one (eltype);
-	  copy (value_contents_all (tmp),
+	  copy (tmp->contents_all (),
 		val_contents.slice (i * elt_len, elt_len));
 	}
     }
@@ -1183,7 +1183,7 @@  value_assign (struct value *toval, struct value *fromval)
 	  {
 	    changed_addr = toval->address ();
 	    changed_len = type_length_units (type);
-	    dest_buffer = value_contents (fromval).data ();
+	    dest_buffer = fromval->contents ().data ();
 	  }
 
 	write_memory_with_notification (changed_addr, dest_buffer, changed_len);
@@ -1259,12 +1259,12 @@  value_assign (struct value *toval, struct value *fromval)
 		   format.  */
 		gdbarch_value_to_register (gdbarch, frame,
 					   VALUE_REGNUM (toval), type,
-					   value_contents (fromval).data ());
+					   fromval->contents ().data ());
 	      }
 	    else
 	      put_frame_register_bytes (frame, value_reg,
 					toval->offset (),
-					value_contents (fromval));
+					fromval->contents ());
 	  }
 
 	gdb::observers::register_changed.notify (frame, value_reg);
@@ -1344,7 +1344,7 @@  value_assign (struct value *toval, struct value *fromval)
      implies the returned value is not lazy, even if TOVAL was.  */
   val = value_copy (toval);
   val->set_lazy (0);
-  copy (value_contents (fromval), val->contents_raw ());
+  copy (fromval->contents (), val->contents_raw ());
 
   /* We copy over the enclosing type and pointed-to offset from FROMVAL
      in the case of pointer types.  For object types, the enclosing type
@@ -1485,7 +1485,7 @@  value_coerce_to_target (struct value *val)
 
   length = check_typedef (val->type ())->length ();
   addr = allocate_space_in_inferior (length);
-  write_memory (addr, value_contents (val).data (), length);
+  write_memory (addr, val->contents ().data (), length);
   return value_at_lazy (val->type (), addr);
 }
 
@@ -2083,7 +2083,7 @@  struct_field_searcher::search (struct value *arg1, LONGEST offset,
 	  struct value *v2;
 
 	  boffset = baseclass_offset (type, i,
-				      value_contents_for_printing (arg1).data (),
+				      arg1->contents_for_printing ().data (),
 				      arg1->embedded_offset () + offset,
 				      arg1->address (),
 				      arg1);
@@ -2287,13 +2287,13 @@  search_struct_method (const char *name, struct value **arg1p,
 	      base_val = value_from_contents_and_address (baseclass,
 							  tmp.data (),
 							  address + offset);
-	      base_valaddr = value_contents_for_printing (base_val).data ();
+	      base_valaddr = base_val->contents_for_printing ().data ();
 	      this_offset = 0;
 	    }
 	  else
 	    {
 	      base_val = *arg1p;
-	      base_valaddr = value_contents_for_printing (*arg1p).data ();
+	      base_valaddr = (*arg1p)->contents_for_printing ().data ();
 	      this_offset = offset;
 	    }
 
@@ -2558,7 +2558,7 @@  find_method_list (struct value **argp, const char *method,
       if (BASETYPE_VIA_VIRTUAL (type, i))
 	{
 	  base_offset = baseclass_offset (type, i,
-					  value_contents_for_printing (*argp).data (),
+					  (*argp)->contents_for_printing ().data (),
 					  (*argp)->offset () + offset,
 					  (*argp)->address (), *argp);
 	}
@@ -3529,7 +3529,7 @@  get_baseclass_offset (struct type *vt, struct type *cls,
 	{
 	  if (BASETYPE_VIA_VIRTUAL (vt, i))
 	    {
-	      const gdb_byte *adr = value_contents_for_printing (v).data ();
+	      const gdb_byte *adr = v->contents_for_printing ().data ();
 	      *boffs = baseclass_offset (vt, i, adr, v->offset (),
 					 value_as_long (v), v);
 	      *isvirt = true;
@@ -3543,7 +3543,7 @@  get_baseclass_offset (struct type *vt, struct type *cls,
 	{
 	  if (*isvirt == false)	/* Add non-virtual base offset.  */
 	    {
-	      const gdb_byte *adr = value_contents_for_printing (v).data ();
+	      const gdb_byte *adr = v->contents_for_printing ().data ();
 	      *boffs += baseclass_offset (vt, i, adr, v->offset (),
 					  value_as_long (v), v);
 	    }
@@ -4110,9 +4110,9 @@  value_literal_complex (struct value *arg1,
 
   int len = real_type->length ();
 
-  copy (value_contents (arg1),
+  copy (arg1->contents (),
 	val->contents_raw ().slice (0, len));
-  copy (value_contents (arg2),
+  copy (arg2->contents (),
 	val->contents_raw ().slice (len, len));
 
   return val;
@@ -4157,9 +4157,9 @@  cast_into_complex (struct type *type, struct value *val)
       struct value *im_val = value::allocate (val_real_type);
       int len = val_real_type->length ();
 
-      copy (value_contents (val).slice (0, len),
+      copy (val->contents ().slice (0, len),
 	    re_val->contents_raw ());
-      copy (value_contents (val).slice (len, len),
+      copy (val->contents ().slice (len, len),
 	    im_val->contents_raw ());
 
       return value_literal_complex (re_val, im_val, type);
diff --git a/gdb/valprint.c b/gdb/valprint.c
index d94121edd29..89d3bbf066c 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -513,7 +513,7 @@  generic_value_print_ptr (struct value *val, struct ui_file *stream,
     {
       struct type *type = check_typedef (val->type ());
       struct type *elttype = check_typedef (type->target_type ());
-      const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+      const gdb_byte *valaddr = val->contents_for_printing ().data ();
       CORE_ADDR addr = unpack_pointer (type, valaddr);
 
       print_unpacked_pointer (type, elttype, addr, stream, options);
@@ -549,7 +549,7 @@  get_value_addr_contents (struct value *deref_val)
   gdb_assert (deref_val != NULL);
 
   if (deref_val->lval () == lval_memory)
-    return value_contents_for_printing_const (value_addr (deref_val)).data ();
+    return value_addr (deref_val)->contents_for_printing ().data ();
   else
     {
       /* We have a non-addressable value, such as a DW_AT_const_value.  */
@@ -573,7 +573,7 @@  generic_val_print_ref (struct type *type,
   const int must_coerce_ref = ((options->addressprint && value_is_synthetic)
 			       || options->deref_ref);
   const int type_is_defined = elttype->code () != TYPE_CODE_UNDEF;
-  const gdb_byte *valaddr = value_contents_for_printing (original_value).data ();
+  const gdb_byte *valaddr = original_value->contents_for_printing ().data ();
 
   if (must_coerce_ref && type_is_defined)
     {
@@ -721,7 +721,7 @@  generic_val_print_enum (struct type *type,
 
   gdb_assert (!options->format);
 
-  const gdb_byte *valaddr = value_contents_for_printing (original_value).data ();
+  const gdb_byte *valaddr = original_value->contents_for_printing ().data ();
 
   val = unpack_long (type, valaddr + embedded_offset * unit_size);
 
@@ -768,7 +768,7 @@  generic_value_print_bool
     }
   else
     {
-      const gdb_byte *valaddr = value_contents_for_printing (value).data ();
+      const gdb_byte *valaddr = value->contents_for_printing ().data ();
       struct type *type = check_typedef (value->type ());
       LONGEST val = unpack_long (type, valaddr);
       if (val == 0)
@@ -811,7 +811,7 @@  generic_value_print_char (struct value *value, struct ui_file *stream,
     {
       struct type *unresolved_type = value->type ();
       struct type *type = check_typedef (unresolved_type);
-      const gdb_byte *valaddr = value_contents_for_printing (value).data ();
+      const gdb_byte *valaddr = value->contents_for_printing ().data ();
 
       LONGEST val = unpack_long (type, valaddr);
       if (type->is_unsigned ())
@@ -832,7 +832,7 @@  generic_val_print_float (struct type *type, struct ui_file *stream,
 {
   gdb_assert (!options->format);
 
-  const gdb_byte *valaddr = value_contents_for_printing (original_value).data ();
+  const gdb_byte *valaddr = original_value->contents_for_printing ().data ();
 
   print_floating (valaddr, type, stream);
 }
@@ -849,7 +849,7 @@  generic_val_print_fixed_point (struct value *val, struct ui_file *stream,
     {
       struct type *type = val->type ();
 
-      const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+      const gdb_byte *valaddr = val->contents_for_printing ().data ();
       gdb_mpf f;
 
       f.read_fixed_point (gdb::make_array_view (valaddr, type->length ()),
@@ -895,7 +895,7 @@  generic_value_print_memberptr
       /* Member pointers are essentially specific to C++, and so if we
 	 encounter one, we should print it according to C++ rules.  */
       struct type *type = check_typedef (val->type ());
-      const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+      const gdb_byte *valaddr = val->contents_for_printing ().data ();
       cp_print_class_member (valaddr, type, stream, "&");
     }
   else
@@ -1012,7 +1012,7 @@  generic_value_print (struct value *val, struct ui_file *stream, int recurse,
       break;
 
     case TYPE_CODE_METHODPTR:
-      cplus_print_method_ptr (value_contents_for_printing (val).data (), type,
+      cplus_print_method_ptr (val->contents_for_printing ().data (), type,
 			      stream);
       break;
 
@@ -1226,7 +1226,7 @@  static void
 val_print_type_code_flags (struct type *type, struct value *original_value,
 			   int embedded_offset, struct ui_file *stream)
 {
-  const gdb_byte *valaddr = (value_contents_for_printing (original_value).data ()
+  const gdb_byte *valaddr = (original_value->contents_for_printing ().data ()
 			     + embedded_offset);
   ULONGEST val = unpack_long (type, valaddr);
   int field, nfields = type->num_fields ();
@@ -1300,7 +1300,7 @@  value_print_scalar_formatted (struct value *val,
   /* value_contents_for_printing fetches all VAL's contents.  They are
      needed to check whether VAL is optimized-out or unavailable
      below.  */
-  const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+  const gdb_byte *valaddr = val->contents_for_printing ().data ();
 
   /* A scalar object that does not have all bits available can't be
      printed, because all bits contribute to its representation.  */
diff --git a/gdb/value.c b/gdb/value.c
index bd2a2b88b2b..a17a3bd8e8d 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -962,12 +962,12 @@  error_value_optimized_out (void)
   throw_error (OPTIMIZED_OUT_ERROR, _("value has been optimized out"));
 }
 
-static void
-require_not_optimized_out (const struct value *value)
+void
+value::require_not_optimized_out () const
 {
-  if (!value->m_optimized_out.empty ())
+  if (!m_optimized_out.empty ())
     {
-      if (value->m_lval == lval_register)
+      if (m_lval == lval_register)
 	throw_error (OPTIMIZED_OUT_ERROR,
 		     _("register has not been saved in frame"));
       else
@@ -975,38 +975,38 @@  require_not_optimized_out (const struct value *value)
     }
 }
 
-static void
-require_available (const struct value *value)
+void
+value::require_available () const
 {
-  if (!value->m_unavailable.empty ())
+  if (!m_unavailable.empty ())
     throw_error (NOT_AVAILABLE_ERROR, _("value is not available"));
 }
 
 gdb::array_view<const gdb_byte>
-value_contents_for_printing (struct value *value)
+value::contents_for_printing ()
 {
-  if (value->m_lazy)
-    value->fetch_lazy ();
+  if (m_lazy)
+    fetch_lazy ();
 
-  ULONGEST length = value->enclosing_type ()->length ();
-  return gdb::make_array_view (value->m_contents.get (), length);
+  ULONGEST length = enclosing_type ()->length ();
+  return gdb::make_array_view (m_contents.get (), length);
 }
 
 gdb::array_view<const gdb_byte>
-value_contents_for_printing_const (const struct value *value)
+value::contents_for_printing () const
 {
-  gdb_assert (!value->m_lazy);
+  gdb_assert (!m_lazy);
 
-  ULONGEST length = value->enclosing_type ()->length ();
-  return gdb::make_array_view (value->m_contents.get (), length);
+  ULONGEST length = enclosing_type ()->length ();
+  return gdb::make_array_view (m_contents.get (), length);
 }
 
 gdb::array_view<const gdb_byte>
-value_contents_all (struct value *value)
+value::contents_all ()
 {
-  gdb::array_view<const gdb_byte> result = value_contents_for_printing (value);
-  require_not_optimized_out (value);
-  require_available (value);
+  gdb::array_view<const gdb_byte> result = contents_for_printing ();
+  require_not_optimized_out ();
+  require_available ();
   return result;
 }
 
@@ -1158,11 +1158,11 @@  value_contents_copy (struct value *dst, LONGEST dst_offset,
 }
 
 gdb::array_view<const gdb_byte>
-value_contents (struct value *value)
+value::contents ()
 {
-  gdb::array_view<const gdb_byte> result = value->contents_writeable ();
-  require_not_optimized_out (value);
-  require_available (value);
+  gdb::array_view<const gdb_byte> result = contents_writeable ();
+  require_not_optimized_out ();
+  require_available ();
   return result;
 }
 
@@ -1468,7 +1468,7 @@  value_non_lval (struct value *arg)
       struct type *enc_type = arg->enclosing_type ();
       struct value *val = value::allocate (enc_type);
 
-      copy (value_contents_all (arg), val->contents_all_raw ());
+      copy (arg->contents_all (), val->contents_all_raw ());
       val->m_type = arg->m_type;
       val->set_embedded_offset (arg->embedded_offset ());
       val->set_pointed_to_offset (arg->pointed_to_offset ());
@@ -2025,7 +2025,7 @@  set_internalvar_component (struct internalvar *var,
 	modify_field (var->u.value->type (), addr + offset,
 		      value_as_long (newval), bitpos, bitsize);
       else
-	memcpy (addr + offset * unit_size, value_contents (newval).data (),
+	memcpy (addr + offset * unit_size, newval->contents ().data (),
 		newval->type ()->length ());
       break;
 
@@ -2429,7 +2429,7 @@  value_as_long (struct value *val)
      in disassemble_command).  It also dereferences references, which
      I suspect is the most logical thing to do.  */
   val = coerce_array (val);
-  return unpack_long (val->type (), value_contents (val).data ());
+  return unpack_long (val->type (), val->contents ().data ());
 }
 
 /* Extract a value as a C pointer.  Does not deallocate the value.
@@ -2532,9 +2532,9 @@  value_as_address (struct value *val)
   if (!val->type ()->is_pointer_or_reference ()
       && gdbarch_integer_to_address_p (gdbarch))
     return gdbarch_integer_to_address (gdbarch, val->type (),
-				       value_contents (val).data ());
+				       val->contents ().data ());
 
-  return unpack_long (val->type (), value_contents (val).data ());
+  return unpack_long (val->type (), val->contents ().data ());
 #endif
 }
 
@@ -2658,7 +2658,7 @@  is_floating_value (struct value *val)
 
   if (is_floating_type (type))
     {
-      if (!target_float_is_valid (value_contents (val).data (), type))
+      if (!target_float_is_valid (val->contents ().data (), type))
 	error (_("Invalid floating value found in program."));
       return true;
     }
@@ -2799,7 +2799,7 @@  value_primitive_field (struct value *arg1, LONGEST offset,
 	 for references to ordinary fields of unavailable values.  */
       if (BASETYPE_VIA_VIRTUAL (arg_type, fieldno))
 	boffset = baseclass_offset (arg_type, fieldno,
-				    value_contents (arg1).data (),
+				    arg1->contents ().data (),
 				    arg1->embedded_offset (),
 				    arg1->address (),
 				    arg1);
@@ -3547,7 +3547,7 @@  coerce_ref (struct value *arg)
   enc_type = check_typedef (arg->enclosing_type ());
   enc_type = enc_type->target_type ();
 
-  CORE_ADDR addr = unpack_pointer (arg->type (), value_contents (arg).data ());
+  CORE_ADDR addr = unpack_pointer (arg->type (), arg->contents ().data ());
   retval = value_at_lazy (enc_type, addr);
   enc_type = retval->type ();
   return readjust_indirect_value_type (retval, enc_type, value_type_arg_tmp,
@@ -3628,7 +3628,7 @@  value_fetch_lazy_bitfield (struct value *val)
     parent->fetch_lazy ();
 
   unpack_value_bitfield (val, val->bitpos (), val->bitsize (),
-			 value_contents_for_printing (parent).data (),
+			 parent->contents_for_printing ().data (),
 			 val->offset (), parent);
 }
 
@@ -3739,7 +3739,7 @@  value_fetch_lazy_register (struct value *val)
       else
 	{
 	  int i;
-	  gdb::array_view<const gdb_byte> buf = value_contents (new_val);
+	  gdb::array_view<const gdb_byte> buf = new_val->contents ();
 
 	  if (VALUE_LVAL (new_val) == lval_register)
 	    gdb_printf (&debug_file, " register=%d",
diff --git a/gdb/value.h b/gdb/value.h
index 2d1c489e245..7b034bba1e2 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -282,7 +282,7 @@  struct value
 
      When we store the entire object, `enclosing_type' is the run-time
      type -- the complete object -- and `embedded_offset' is the offset
-     of `type' within that larger type, in bytes.  The value_contents()
+     of `type' within that larger type, in bytes.  The ->contents()
      macro takes `embedded_offset' into account, so most GDB code
      continues to see the `type' portion of the value, just as the
      inferior would.
@@ -368,9 +368,31 @@  struct value
      get to the real subobject, if the value happens to represent
      something embedded in a larger run-time object.  */
   gdb::array_view<gdb_byte> contents_raw ();
+
+  /* Actual contents of the value.  For use of this value; setting it
+     uses the stuff above.  Not valid if lazy is nonzero.  Target
+     byte-order.  We force it to be aligned properly for any possible
+     value.  Note that a value therefore extends beyond what is
+     declared here.  */
+  gdb::array_view<const gdb_byte> contents ();
+
+  /* The ALL variants of the above two methods do not adjust the
+     returned pointer by the embedded_offset value.  */
+  gdb::array_view<const gdb_byte> contents_all ();
   gdb::array_view<gdb_byte> contents_all_raw ();
+
   gdb::array_view<gdb_byte> contents_writeable ();
 
+  /* Like contents_all, but does not require that the returned bits be
+     valid.  This should only be used in situations where you plan to
+     check the validity manually.  */
+  gdb::array_view<const gdb_byte> contents_for_printing ();
+
+  /* Like contents_for_printing, but accepts a constant value pointer.
+     Unlike contents_for_printing however, the pointed value must
+     _not_ be lazy.  */
+  gdb::array_view<const gdb_byte> contents_for_printing () const;
+
   /* Load the actual content of a lazy value.  Fetch the data from the
      user's process and clear the lazy flag to indicate that the data in
      the buffer is valid.
@@ -576,7 +598,7 @@  struct value
      When we store the entire object, `enclosing_type' is the run-time
      type -- the complete object -- and `embedded_offset' is the
      offset of `type' within that larger type, in target addressable memory
-     units.  The value_contents() macro takes `embedded_offset' into account,
+     units.  The ->contents() macro takes `embedded_offset' into account,
      so most GDB code continues to see the `type' portion of the value, just
      as the inferior would.
 
@@ -633,6 +655,9 @@  struct value
      Return true if the available bits match.  */
   bool contents_bits_eq (int offset1, const struct value *val2, int offset2,
 			 int length) const;
+
+  void require_not_optimized_out () const;
+  void require_available () const;
 };
 
 inline void
@@ -729,30 +754,6 @@  struct lval_funcs
 
 extern void error_value_optimized_out (void);
 
-/* Actual contents of the value.  For use of this value; setting it
-   uses the stuff above.  Not valid if lazy is nonzero.  Target
-   byte-order.  We force it to be aligned properly for any possible
-   value.  Note that a value therefore extends beyond what is
-   declared here.  */
-
-extern gdb::array_view<const gdb_byte> value_contents (struct value *);
-
-/* The ALL variants of the above two macros do not adjust the returned
-   pointer by the embedded_offset value.  */
-
-extern gdb::array_view<const gdb_byte> value_contents_all (struct value *);
-
-/* Like value_contents_all, but does not require that the returned
-   bits be valid.  This should only be used in situations where you
-   plan to check the validity manually.  */
-extern gdb::array_view<const gdb_byte> value_contents_for_printing (struct value *value);
-
-/* Like value_contents_for_printing, but accepts a constant value
-   pointer.  Unlike value_contents_for_printing however, the pointed
-   value must _not_ be lazy.  */
-extern gdb::array_view<const gdb_byte>
-  value_contents_for_printing_const (const struct value *value);
-
 /* If nonzero, this is the value of a variable which does not actually
    exist in the program, at least partially.  If the value is lazy,
    this may fetch it now.  */
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index c46010d0b13..0f92a469d6c 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -121,7 +121,7 @@  vax_store_arguments (struct regcache *regcache, int nargs,
 
       sp -= (len + 3) & ~3;
       count += (len + 3) / 4;
-      write_memory (sp, value_contents_all (args[i]).data (), len);
+      write_memory (sp, args[i]->contents_all ().data (), len);
     }
 
   /* Push argument count.  */
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index c12d83213ae..c505281622a 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -252,7 +252,7 @@  xstormy16_push_dummy_call (struct gdbarch *gdbarch,
 	break;
 
       /* Put argument into registers wordwise.  */
-      const gdb_byte *val = value_contents (args[i]).data ();
+      const gdb_byte *val = args[i]->contents ().data ();
       for (j = 0; j < typelen; j += xstormy16_reg_size)
 	{
 	  ULONGEST regval;
@@ -270,7 +270,7 @@  xstormy16_push_dummy_call (struct gdbarch *gdbarch,
      wordaligned.  */
   for (j = nargs - 1; j >= i; j--)
     {
-      const gdb_byte *bytes = value_contents (args[j]).data ();
+      const gdb_byte *bytes = args[j]->contents ().data ();
 
       typelen = args[j]->enclosing_type ()->length ();
       slacklen = typelen & 1;
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index c3d175adff6..092ae088932 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -1729,7 +1729,7 @@  xtensa_push_dummy_call (struct gdbarch *gdbarch,
 	      break;
 	    }
 	  gdb_printf (gdb_stdlog, " %s\n",
-		      host_address_to_string (value_contents (arg).data ()));
+		      host_address_to_string (arg->contents ().data ()));
 	}
     }
 
@@ -1785,7 +1785,7 @@  xtensa_push_dummy_call (struct gdbarch *gdbarch,
 	  break;
 	}
       info->length = arg_type->length ();
-      info->contents = value_contents (arg).data ();
+      info->contents = arg->contents ().data ();
 
       /* Align size and onstack_size.  */
       size = (size + info->align - 1) & ~(info->align - 1);