s/get_regcache_arch (regcache)/regcache->arch ()/g

Message ID 1508488843-31532-1-git-send-email-yao.qi@linaro.org
State New, archived
Headers

Commit Message

Yao Qi Oct. 20, 2017, 8:40 a.m. UTC
  This patches removes get_regcache_arch, and use regache->arch () instead.
The motivation of this change is that I am going to move some basic stuff
into a base class of regcache.  I don't need to update "client" code
regcache->arch ().  On the other hand, this patch shortens the code a
little bit.

Rebuild GDB with all targets enabled on x86_64-linux.  Also rebuild GDB
for native arm-linux, aarch64-linux, x86_64-w64-mingw32, and
i686-w64-mingw32.

gdb:

2017-10-20  Yao Qi  <yao.qi@linaro.org>

	* aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use
	regcache->arch () instead get_regcache_arch.
	* aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers):
	Likewise.
	(aarch64_fbsd_store_inferior_registers): Likewise.
	* aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise.
	(store_gregs_to_thread): Likewise.
	(fetch_fpregs_from_thread): Likewise.
	(store_fpregs_to_thread): Likewise.
	* aarch64-tdep.c (aarch64_extract_return_value): Likewise.
	(aarch64_store_return_value): Likewise.
	(aarch64_software_single_step): Likewise.
	* aix-thread.c (aix_thread_wait): Likewise.
	(supply_reg32): Likewise.
	(supply_sprs64): Likewise.
	(supply_sprs32): Likewise.
	(fill_gprs64): Likewise.
	(fill_gprs32): Likewise.
	(fill_sprs64): Likewise.
	(fill_sprs32): Likewise.
	(store_regs_user_thread): Likewise.
	(store_regs_kernel_thread): Likewise.
	* alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise.
	(alphabsd_store_inferior_registers): Likewise.
	* alpha-tdep.c (alpha_extract_return_value): Likewise.
	(alpha_store_return_value): Likewise.
	(alpha_deal_with_atomic_sequence): Likewise.
	(alpha_next_pc): Likewise.
	(alpha_software_single_step): Likewise.
	* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise.
	(amd64bsd_store_inferior_registers): Likewise.
	* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers):
	Likewise.
	(amd64_linux_store_inferior_registers): Likewise.
	* amd64-nat.c (amd64_supply_native_gregset): Likewise.
	(amd64_collect_native_gregset): Likewise.
	* amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise.
	(amd64obsd_collect_uthread): Likewise.
	* amd64-tdep.c (amd64_supply_fpregset): Likewise.
	(amd64_collect_fpregset): Likewise.
	(amd64_supply_fxsave): Likewise.
	(amd64_supply_xsave): Likewise.
	(amd64_collect_fxsave): Likewise.
	(amd64_collect_xsave): Likewise.
	* arc-tdep.c (arc_write_pc): Likewise.
	* arch-utils.c (default_skip_permanent_breakpoint): Likewise.
	* arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise.
	(arm_fbsd_store_inferior_registers): Likewise.
	* arm-linux-nat.c (fetch_vfp_regs): Likewise.
	(store_vfp_regs): Likewise.
	(arm_linux_fetch_inferior_registers): Likewise.
	(arm_linux_store_inferior_registers): Likewise.
	* arm-linux-tdep.c (arm_linux_supply_gregset): Likewise.
	(arm_linux_sigreturn_next_pc): Likewise.
	(arm_linux_get_next_pcs_syscall_next_pc): Likewise.
	* arm-nbsd-nat.c (arm_supply_gregset): Likewise.
	(fetch_register): Likewise.
	(store_register): Likewise.
	* arm-tdep.c (arm_is_thumb): Likewise.
	(displaced_in_arm_mode): Likewise.
	(bx_write_pc): Likewise.
	(arm_get_next_pcs_addr_bits_remove): Likewise.
	(arm_software_single_step): Likewise.
	(arm_extract_return_value): Likewise.
	(arm_store_return_value): Likewise.
	(arm_write_pc): Likewise.
	* bfin-tdep.c (bfin_extract_return_value): Likewise.
	* bsd-uthread.c (bsd_uthread_fetch_registers): Likewise.
	(bsd_uthread_store_registers): Likewise.
	* core-regset.c (fetch_core_registers): Likewise.
	* corelow.c (get_core_registers): Likewise.
	* cris-tdep.c (cris_store_return_value): Likewise.
	(cris_extract_return_value): Likewise.
	(find_step_target): Likewise.
	(find_step_target): Likewise.
	(cris_software_single_step): Likewise.
	* ctf.c (ctf_fetch_registers): Likewise.
	* darwin-nat.c (cancel_breakpoint): Likewise.
	* fbsd-tdep.c (fbsd_collect_thread_registers): Likewise.
	* frv-tdep.c (frv_extract_return_value): Likewise.
	* ft32-tdep.c (ft32_store_return_value): Likewise.
	(ft32_extract_return_value): Likewise.
	* go32-nat.c (fetch_register): Likewise.
	(go32_fetch_registers): Likewise.
	(go32_store_registers): Likewise.
	(store_register): Likewise.
	* h8300-tdep.c (h8300_extract_return_value): Likewise.
	(h8300_store_return_value): Likewise.
	* hppa-linux-nat.c (fetch_register): Likewise.
	(store_register): Likewise.
	(hppa_linux_fetch_inferior_registers): Likewise.
	(hppa_linux_store_inferior_registers): Likewise.
	* i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise.
	(i386_darwin_store_inferior_registers): Likewise.
	* i386-gnu-nat.c (gnu_fetch_registers): Likewise.
	(gnu_store_registers): Likewise.
	* i386-linux-nat.c (fetch_register): Likewise.
	(store_register): Likewise.
	(supply_gregset): Likewise.
	(fill_gregset): Likewise.
	(i386_linux_fetch_inferior_registers): Likewise.
	(i386_linux_store_inferior_registers): Likewise.
	(i386_linux_resume): Likewise.
	* i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache):
	Likewise.
	* i386-nto-tdep.c (i386nto_supply_gregset): Likewise.
	* i386-obsd-nat.c (i386obsd_supply_pcb): Likewise.
	* i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise.
	(i386obsd_collect_uthread): Likewise.
	* i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise.
	(i386_supply_gregset): Likewise.
	(i386_collect_gregset): Likewise.
	(i386_supply_fpregset): Likewise.
	(i386_collect_fpregset): Likewise.
	(i386_mpx_bd_base): Likewise.
	* i386-v4-nat.c	(supply_fpregset): Likewise.
	(fill_fpregset): Likewise.
	* i387-tdep.c (i387_supply_fsave): Likewise.
	(i387_collect_fsave): Likewise.
	(i387_supply_fxsave): Likewise.
	(i387_collect_fxsave): Likewise.
	(i387_supply_xsave): Likewise.
	(i387_collect_xsave): Likewise.
	* ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise.
	(ia64_linux_store_registers): Likewise.
	* ia64-tdep.c (ia64_access_rse_reg): Likewise.
	(ia64_extract_return_value): Likewise.
	(ia64_store_return_value): Likewise.
	(find_func_descr): Likewise.
	* inf-child.c (inf_child_fetch_inferior_registers): Likewise.
	* inf-ptrace.c (inf_ptrace_fetch_registers): Likewise.
	(inf_ptrace_store_registers): Likewise.
	* infrun.c (use_displaced_stepping): Likewise.
	(displaced_step_prepare_throw): Likewise.
	(resume): Likewise.
	(proceed): Likewise.
	(do_target_wait): Likewise.
	(adjust_pc_after_break): Likewise.
	(handle_inferior_event_1): Likewise.
	(handle_signal_stop): Likewise.
	(save_infcall_suspend_state): Likewise.
	(restore_infcall_suspend_state): Likewise.
	* iq2000-tdep.c (iq2000_extract_return_value): Likewise.
	* jit.c (jit_frame_prev_register): Likewise.
	* linux-nat.c (save_stop_reason): Likewise.
	(linux_nat_wait_1): Likewise.
	(resume_stopped_resumed_lwps): Likewise.
	* linux-record.c (record_linux_sockaddr): Likewise.
	(record_linux_msghdr): Likewise.
	(record_linux_system_call): Likewise.
	* linux-tdep.c (linux_collect_thread_registers): Likewise.
	* lm32-tdep.c (lm32_extract_return_value): Likewise.
	(lm32_store_return_value): Likewise.
	* m32c-tdep.c (m32c_read_flg): Likewise.
	(m32c_pseudo_register_read): Likewise.
	(m32c_pseudo_register_write): Likewise.
	* m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise.
	(m32r_linux_collect_gregset): Likewise.
	* m32r-tdep.c (m32r_store_return_value): Likewise.
	(m32r_extract_return_value): Likewise.
	* m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise.
	(m68kbsd_collect_fpregset): Likewise.
	* m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise.
	* m68k-linux-nat.c (fetch_register): Likewise.
	(old_fetch_inferior_registers): Likewise.
	(old_store_inferior_registers): Likewise.
	(store_regs): Likewise.
	* m68k-tdep.c (m68k_svr4_extract_return_value): Likewise.
	(m68k_svr4_store_return_value): Likewise.
	* m88k-tdep.c (m88k_store_arguments): Likewise.
	* mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise.
	(mi_cmd_data_write_register_values): Likewise.
	* mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise.
	(mips_fbsd_store_inferior_registers): Likewise.
	* mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise.
	(mips_fbsd_supply_gregs): Likewise.
	(mips_fbsd_collect_fpregs): Likewise.
	(mips_fbsd_collect_gregs): Likewise.
	(mips_fbsd_supply_fpregset): Likewise.
	(mips_fbsd_collect_fpregset): Likewise.
	(mips_fbsd_supply_gregset): Likewise.
	(mips_fbsd_collect_gregset): Likewise.
	* mips-linux-nat.c (supply_gregset): Likewise.
	(fill_gregset): Likewise.
	(supply_fpregset): Likewise.
	(fill_fpregset): Likewise.
	* mips-linux-tdep.c (mips_supply_gregset): Likewise.
	(mips_fill_gregset): Likewise.
	(mips_supply_fpregset): Likewise.
	(mips_fill_fpregset): Likewise.
	(mips64_supply_gregset): Likewise.
	(micromips_linux_sigframe_validate): Likewise.
	* mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise.
	(mipsnbsd_fetch_inferior_registers): Likewise.
	(mipsnbsd_store_inferior_registers): Likewise.
	* mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise.
	(mipsnbsd_supply_gregset): Likewise.
	(mipsnbsd_iterate_over_regset_sections): Likewise.
	(mipsnbsd_supply_reg): Likewise.
	(mipsnbsd_supply_fpreg): Likewise.
	* mips-tdep.c (mips_in_frame_stub): Likewise.
	(mips_dummy_id): Likewise.
	(is_octeon_bbit_op): Likewise.
	(micromips_bc1_pc): Likewise.
	(extended_mips16_next_pc): Likewise.
	(mips16_next_pc): Likewise.
	(deal_with_atomic_sequence): Likewise.
	* moxie-tdep.c (moxie_process_readu): Likewise.
	* nios2-tdep.c (nios2_get_next_pc): Likewise.
	* nto-procfs.c (procfs_store_registers): Likewise.
	* ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise.
	(ppcfbsd_store_inferior_registers): Likewise.
	* ppc-linux-nat.c (fetch_vsx_register): Likewise.
	(fetch_altivec_register): Likewise.
	(get_spe_registers): Likewise.
	(fetch_spe_register): Likewise.
	(fetch_altivec_registers): Likewise.
	(fetch_all_gp_regs): Likewise.
	(fetch_all_fp_regs): Likewise.
	(store_vsx_register): Likewise.
	(store_altivec_register): Likewise.
	(set_spe_registers): Likewise.
	(store_spe_register): Likewise.
	(store_altivec_registers): Likewise.
	(store_all_gp_regs): Likewise.
	(store_all_fp_regs): Likewise.
	* ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise.
	(ppc_linux_collect_gregset): Likewise.
	(ppc_canonicalize_syscall): Likewise.
	(ppc_linux_record_signal): Likewise.
	(ppu2spu_prev_register): Likewise.
	* ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
	* ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise.
	(ppcobsd_store_registers): Likewise.
	* ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers):
	Likewise.
	(ppc_ravenscar_generic_store_registers): Likewise.
	* procfs.c (procfs_fetch_registers): Likewise.
	(procfs_store_registers): Likewise.
	* ravenscar-thread.c (ravenscar_fetch_registers): Likewise.
	(ravenscar_store_registers): Likewise.
	(ravenscar_prepare_to_store): Likewise.
	* record-btrace.c (record_btrace_fetch_registers): Likewise.
	* record-full.c (record_full_wait_1): Likewise.
	(record_full_registers_change): Likewise.
	(record_full_store_registers): Likewise.
	(record_full_core_fetch_registers): Likewise.
	(record_full_save): Likewise.
	(record_full_goto_insn): Likewise.
	* regcache.c (regcache_register_size): Likewise.
	(get_regcache_arch): Remove.
	(regcache_read_pc): Likewise.
	* regcache.h (get_regcache_arch): Remove.
	* remote-sim.c (gdbsim_fetch_register): Likewise.
	(gdbsim_store_register): Likewise.
	* remote.c (fetch_register_using_p): Likewise.
	(send_g_packet): Likewise.
	(remote_prepare_to_store): Likewise.
	(store_registers_using_G): Likewise.
	* reverse.c (save_bookmark_command): Likewise.
	(goto_bookmark_command): Likewise.
	* rs6000-aix-tdep.c (branch_dest): Likewise.
	* rs6000-nat.c (rs6000_ptrace64): Likewise.
	(fetch_register): Likewise.
	* rs6000-tdep.c (ppc_supply_reg): Likewise.
	(ppc_collect_reg): Likewise.
	(ppc_collect_gregset): Likewise.
	(ppc_collect_fpregset): Likewise.
	(ppc_collect_vsxregset): Likewise.
	(ppc_collect_vrregset): Likewise.
	(ppc_displaced_step_hw_singlestep): Likewise.
	(rs6000_pseudo_register_read): Likewise.
	(rs6000_pseudo_register_write): Likewise.
	* s390-linux-nat.c (supply_gregset): Likewise.
	(fill_gregset): Likewise.
	(s390_linux_fetch_inferior_registers): Likewise.
	* s390-linux-tdep.c (s390_write_pc): Likewise.
	(s390_software_single_step): Likewise.
	(s390_all_but_pc_registers_record): Likewise.
	(s390_linux_syscall_record): Likewise.
	* sentinel-frame.c (sentinel_frame_prev_arch): Likewise.
	* sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise.
	(shnbsd_store_inferior_registers): Likewise.
	* sh-tdep.c (sh_extract_return_value_nofpu): Likewise.
	(sh_extract_return_value_fpu): Likewise.
	(sh_store_return_value_nofpu): Likewise.
	(sh_corefile_supply_regset): Likewise.
	(sh_corefile_collect_regset): Likewise.
	* sh64-tdep.c (sh64_extract_return_value): Likewise.
	(sh64_store_return_value): Likewise.
	* sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise.
	* sparc-nat.c (sparc_fetch_inferior_registers): Likewise.
	(sparc_store_inferior_registers): Likewise.
	* sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise.
	(sparc_ravenscar_prepare_to_store): Likewise.
	* sparc-tdep.c (sparc32_store_arguments): Likewise.
	(sparc_analyze_control_transfer): Likewise.
	(sparc_step_trap): Likewise.
	(sparc_software_single_step): Likewise.
	(sparc32_gdbarch_init): Likewise.
	(sparc_supply_rwindow): Likewise.
	(sparc_collect_rwindow): Likewise.
	* sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise.
	* sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise.
	(sparc64nbsd_collect_gregset): Likewise.
	(sparc64nbsd_supply_fpregset): Likewise.
	(sparc64nbsd_collect_fpregset): Likewise.
	* sparc64-tdep.c (sparc64_store_arguments): Likewise.
	(sparc64_supply_gregset): Likewise.
	(sparc64_collect_gregset): Likewise.
	(sparc64_supply_fpregset): Likewise.
	(sparc64_collect_fpregset): Likewise.
	* spu-linux-nat.c (spu_fetch_inferior_registers): Likewise.
	* spu-tdep.c (spu_unwind_sp): Likewise.
	(spu2ppu_prev_register): Likewise.
	(spu_memory_remove_breakpoint): Likewise.
	* stack.c (return_command): Likewise.
	* tic6x-tdep.c (tic6x_extract_signed_field): Likewise.
	* tracefile-tfile.c (tfile_fetch_registers): Likewise.
	* tracefile.c (trace_save_ctf): Likewise.
	* windows-nat.c (do_windows_fetch_inferior_registers): Likewise.
	(do_windows_store_inferior_registers): Likewise.
	(windows_resume): Likewise.
	* xtensa-linux-nat.c (fill_gregset): Likewise.
	(supply_gregset_reg): Likewise.
	* xtensa-tdep.c (xtensa_register_write_masked): Likewise.
	(xtensa_register_read_masked): Likewise.
	(xtensa_supply_gregset): Likewise.
	(xtensa_extract_return_value): Likewise.
	(xtensa_store_return_value): Likewise.
---
 gdb/aarch32-linux-nat.c      |  2 +-
 gdb/aarch64-fbsd-nat.c       |  4 ++--
 gdb/aarch64-linux-nat.c      |  8 ++++----
 gdb/aarch64-tdep.c           |  6 +++---
 gdb/aix-thread.c             | 28 ++++++++++++++--------------
 gdb/alpha-bsd-nat.c          |  4 ++--
 gdb/alpha-tdep.c             | 10 +++++-----
 gdb/amd64-bsd-nat.c          |  4 ++--
 gdb/amd64-linux-nat.c        |  4 ++--
 gdb/amd64-nat.c              |  4 ++--
 gdb/amd64-obsd-tdep.c        |  4 ++--
 gdb/amd64-tdep.c             | 12 ++++++------
 gdb/arc-tdep.c               |  2 +-
 gdb/arch-utils.c             |  2 +-
 gdb/arm-fbsd-nat.c           |  4 ++--
 gdb/arm-linux-nat.c          |  8 ++++----
 gdb/arm-linux-tdep.c         |  8 ++++----
 gdb/arm-nbsd-nat.c           |  8 ++++----
 gdb/arm-tdep.c               | 16 ++++++++--------
 gdb/bfin-tdep.c              |  2 +-
 gdb/bsd-uthread.c            |  4 ++--
 gdb/core-regset.c            |  2 +-
 gdb/corelow.c                |  4 ++--
 gdb/cris-tdep.c              | 10 +++++-----
 gdb/ctf.c                    |  2 +-
 gdb/darwin-nat.c             |  2 +-
 gdb/fbsd-tdep.c              |  2 +-
 gdb/frv-tdep.c               |  2 +-
 gdb/ft32-tdep.c              |  4 ++--
 gdb/go32-nat.c               |  8 ++++----
 gdb/h8300-tdep.c             |  8 ++++----
 gdb/hppa-linux-nat.c         |  8 ++++----
 gdb/i386-darwin-nat.c        |  4 ++--
 gdb/i386-gnu-nat.c           |  4 ++--
 gdb/i386-linux-nat.c         | 14 +++++++-------
 gdb/i386-linux-tdep.c        |  2 +-
 gdb/i386-nto-tdep.c          |  2 +-
 gdb/i386-obsd-nat.c          |  2 +-
 gdb/i386-obsd-tdep.c         |  4 ++--
 gdb/i386-tdep.c              | 12 ++++++------
 gdb/i386-v4-nat.c            |  4 ++--
 gdb/i387-tdep.c              | 12 ++++++------
 gdb/ia64-linux-nat.c         |  8 ++++----
 gdb/ia64-tdep.c              |  8 ++++----
 gdb/inf-child.c              |  2 +-
 gdb/inf-ptrace.c             |  8 ++++----
 gdb/infrun.c                 | 28 ++++++++++++++--------------
 gdb/iq2000-tdep.c            |  2 +-
 gdb/jit.c                    |  2 +-
 gdb/linux-nat.c              |  6 +++---
 gdb/linux-record.c           |  8 ++++----
 gdb/linux-tdep.c             |  2 +-
 gdb/lm32-tdep.c              |  4 ++--
 gdb/m32c-tdep.c              |  6 +++---
 gdb/m32r-linux-tdep.c        |  4 ++--
 gdb/m32r-tdep.c              |  4 ++--
 gdb/m68k-bsd-nat.c           |  4 ++--
 gdb/m68k-bsd-tdep.c          |  2 +-
 gdb/m68k-linux-nat.c         | 14 +++++++-------
 gdb/m68k-tdep.c              |  4 ++--
 gdb/m88k-tdep.c              |  2 +-
 gdb/mi/mi-main.c             |  8 ++++----
 gdb/mips-fbsd-nat.c          |  4 ++--
 gdb/mips-fbsd-tdep.c         | 16 ++++++++--------
 gdb/mips-linux-nat.c         | 12 ++++++------
 gdb/mips-linux-tdep.c        | 20 ++++++++++----------
 gdb/mips-nbsd-nat.c          |  8 ++++----
 gdb/mips-nbsd-tdep.c         | 12 ++++++------
 gdb/mips-tdep.c              | 16 ++++++++--------
 gdb/moxie-tdep.c             |  6 +++---
 gdb/nios2-tdep.c             |  4 ++--
 gdb/nto-procfs.c             |  2 +-
 gdb/ppc-fbsd-nat.c           |  6 +++---
 gdb/ppc-linux-nat.c          | 40 ++++++++++++++++++++--------------------
 gdb/ppc-linux-tdep.c         | 12 ++++++------
 gdb/ppc-nbsd-nat.c           |  6 +++---
 gdb/ppc-obsd-nat.c           |  6 +++---
 gdb/ppc-ravenscar-thread.c   |  6 +++---
 gdb/procfs.c                 |  4 ++--
 gdb/ravenscar-thread.c       |  6 +++---
 gdb/record-btrace.c          |  2 +-
 gdb/record-full.c            | 20 ++++++++++----------
 gdb/regcache.c               | 14 +++-----------
 gdb/regcache.h               |  5 +----
 gdb/remote-sim.c             |  4 ++--
 gdb/remote.c                 | 14 +++++++-------
 gdb/reverse.c                |  4 ++--
 gdb/rs6000-aix-tdep.c        |  4 ++--
 gdb/rs6000-nat.c             |  8 ++++----
 gdb/rs6000-tdep.c            | 28 ++++++++++++++--------------
 gdb/s390-linux-nat.c         |  6 +++---
 gdb/s390-linux-tdep.c        |  8 ++++----
 gdb/sentinel-frame.c         |  2 +-
 gdb/sh-nbsd-nat.c            |  4 ++--
 gdb/sh-tdep.c                | 12 ++++++------
 gdb/sh64-tdep.c              |  4 ++--
 gdb/sparc-linux-tdep.c       |  2 +-
 gdb/sparc-nat.c              |  4 ++--
 gdb/sparc-obsd-tdep.c        |  4 ++--
 gdb/sparc-ravenscar-thread.c |  6 +++---
 gdb/sparc-tdep.c             | 16 ++++++++--------
 gdb/sparc64-linux-tdep.c     |  2 +-
 gdb/sparc64-nbsd-nat.c       |  8 ++++----
 gdb/sparc64-obsd-tdep.c      |  4 ++--
 gdb/sparc64-tdep.c           | 14 +++++++-------
 gdb/spu-linux-nat.c          |  2 +-
 gdb/spu-multiarch.c          |  4 ++--
 gdb/spu-tdep.c               | 12 ++++++------
 gdb/stack.c                  |  2 +-
 gdb/tic6x-tdep.c             |  2 +-
 gdb/tracefile-tfile.c        |  4 ++--
 gdb/tracefile.c              |  2 +-
 gdb/v850-tdep.c              |  4 ++--
 gdb/vax-tdep.c               |  2 +-
 gdb/windows-nat.c            |  6 +++---
 gdb/xtensa-linux-nat.c       |  4 ++--
 gdb/xtensa-tdep.c            | 10 +++++-----
 117 files changed, 405 insertions(+), 416 deletions(-)
  

Comments

Yao Qi Oct. 25, 2017, 3:41 p.m. UTC | #1
On Fri, Oct 20, 2017 at 9:40 AM, Yao Qi <qiyaoltc@gmail.com> wrote:
> This patches removes get_regcache_arch, and use regache->arch () instead.
> The motivation of this change is that I am going to move some basic stuff
> into a base class of regcache.  I don't need to update "client" code
> regcache->arch ().  On the other hand, this patch shortens the code a
> little bit.
>
> Rebuild GDB with all targets enabled on x86_64-linux.  Also rebuild GDB
> for native arm-linux, aarch64-linux, x86_64-w64-mingw32, and
> i686-w64-mingw32.
>

I pushed it in.
  

Patch

diff --git a/gdb/aarch32-linux-nat.c b/gdb/aarch32-linux-nat.c
index 94e348f..48e3a97 100644
--- a/gdb/aarch32-linux-nat.c
+++ b/gdb/aarch32-linux-nat.c
@@ -46,7 +46,7 @@  aarch32_gp_regcache_supply (struct regcache *regcache, uint32_t *regs,
     regcache_raw_supply (regcache, ARM_PS_REGNUM, &regs[ARM_PC_REGNUM]);
 
   regs[ARM_PC_REGNUM] = gdbarch_addr_bits_remove
-			  (get_regcache_arch (regcache), regs[ARM_PC_REGNUM]);
+			  (regcache->arch (), regs[ARM_PC_REGNUM]);
   regcache_raw_supply (regcache, ARM_PC_REGNUM, &regs[ARM_PC_REGNUM]);
 }
 
diff --git a/gdb/aarch64-fbsd-nat.c b/gdb/aarch64-fbsd-nat.c
index ffe7d5b..73aff9c 100644
--- a/gdb/aarch64-fbsd-nat.c
+++ b/gdb/aarch64-fbsd-nat.c
@@ -54,7 +54,7 @@  aarch64_fbsd_fetch_inferior_registers (struct target_ops *ops,
 {
   pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
 
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (regnum == -1 || getregs_supplies (gdbarch, regnum))
     {
       struct reg regs;
@@ -87,7 +87,7 @@  aarch64_fbsd_store_inferior_registers (struct target_ops *ops,
 {
   pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
 
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (regnum == -1 || getregs_supplies (gdbarch, regnum))
     {
       struct reg regs;
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 4feaec3..de18edd 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -155,7 +155,7 @@  static void
 fetch_gregs_from_thread (struct regcache *regcache)
 {
   int ret, tid;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   elf_gregset_t regs;
   struct iovec iovec;
 
@@ -195,7 +195,7 @@  store_gregs_to_thread (const struct regcache *regcache)
   int ret, tid;
   elf_gregset_t regs;
   struct iovec iovec;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   /* Make sure REGS can hold all registers contents on both aarch64
      and arm.  */
@@ -238,7 +238,7 @@  fetch_fpregs_from_thread (struct regcache *regcache)
   int ret, tid;
   elf_fpregset_t regs;
   struct iovec iovec;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   /* Make sure REGS can hold all VFP registers contents on both aarch64
      and arm.  */
@@ -286,7 +286,7 @@  store_fpregs_to_thread (const struct regcache *regcache)
   int ret, tid;
   elf_fpregset_t regs;
   struct iovec iovec;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   /* Make sure REGS can hold all VFP registers contents on both aarch64
      and arm.  */
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index a40dc69..aa8460b 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1785,7 +1785,7 @@  static void
 aarch64_extract_return_value (struct type *type, struct regcache *regs,
 			      gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regs);
+  struct gdbarch *gdbarch = regs->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
@@ -1923,7 +1923,7 @@  static void
 aarch64_store_return_value (struct type *type, struct regcache *regs,
 			    const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regs);
+  struct gdbarch *gdbarch = regs->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
@@ -2410,7 +2410,7 @@  value_of_aarch64_user_reg (struct frame_info *frame, const void *baton)
 static std::vector<CORE_ADDR>
 aarch64_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
   const int insn_size = 4;
   const int atomic_sequence_length = 16; /* Instruction sequence length.  */
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index f9ec864..b5c9f3b 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -1040,7 +1040,7 @@  aix_thread_wait (struct target_ops *ops,
       && status->value.sig == GDB_SIGNAL_TRAP)
     {
       struct regcache *regcache = get_thread_regcache (ptid);
-      struct gdbarch *gdbarch = get_regcache_arch (regcache);
+      struct gdbarch *gdbarch = regcache->arch ();
 
       if (regcache_read_pc (regcache)
 	  - gdbarch_decr_pc_after_break (gdbarch) == pd_brk_addr)
@@ -1055,7 +1055,7 @@  aix_thread_wait (struct target_ops *ops,
 static void
 supply_gprs64 (struct regcache *regcache, uint64_t *vals)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
   int regno;
 
   for (regno = 0; regno < ppc_num_gprs; regno++)
@@ -1076,7 +1076,7 @@  supply_reg32 (struct regcache *regcache, int regno, uint32_t val)
 static void
 supply_fprs (struct regcache *regcache, double *vals)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int regno;
 
@@ -1117,7 +1117,7 @@  supply_sprs64 (struct regcache *regcache,
 	       uint64_t lr, uint64_t ctr, uint32_t xer,
 	       uint32_t fpscr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch),
@@ -1141,7 +1141,7 @@  supply_sprs32 (struct regcache *regcache,
 	       uint32_t lr, uint32_t ctr, uint32_t xer,
 	       uint32_t fpscr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch),
@@ -1166,7 +1166,7 @@  supply_sprs32 (struct regcache *regcache,
 static void
 fetch_regs_user_thread (struct regcache *regcache, pthdb_pthread_t pdtid)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int status, i;
   pthdb_context_t ctx;
@@ -1221,7 +1221,7 @@  static void
 fetch_regs_kernel_thread (struct regcache *regcache, int regno,
 			  pthdb_tid_t tid)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   uint64_t gprs64[ppc_num_gprs];
   uint32_t gprs32[ppc_num_gprs];
@@ -1328,7 +1328,7 @@  aix_thread_fetch_registers (struct target_ops *ops,
 static void
 fill_gprs64 (const struct regcache *regcache, uint64_t *vals)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
   int regno;
 
   for (regno = 0; regno < ppc_num_gprs; regno++)
@@ -1341,7 +1341,7 @@  fill_gprs64 (const struct regcache *regcache, uint64_t *vals)
 static void 
 fill_gprs32 (const struct regcache *regcache, uint32_t *vals)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
   int regno;
 
   for (regno = 0; regno < ppc_num_gprs; regno++)
@@ -1355,7 +1355,7 @@  fill_gprs32 (const struct regcache *regcache, uint32_t *vals)
 static void
 fill_fprs (const struct regcache *regcache, double *vals)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int regno;
 
@@ -1380,7 +1380,7 @@  fill_sprs64 (const struct regcache *regcache,
 	     uint64_t *lr, uint64_t *ctr, uint32_t *xer,
 	     uint32_t *fpscr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   /* Verify that the size of the size of the IAR buffer is the
@@ -1416,7 +1416,7 @@  fill_sprs32 (const struct regcache *regcache,
 	     uint32_t *lr, uint32_t *ctr, uint32_t *xer,
 	     uint32_t *fpscr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   /* Verify that the size of the size of the IAR buffer is the
@@ -1454,7 +1454,7 @@  fill_sprs32 (const struct regcache *regcache,
 static void
 store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int status, i;
   pthdb_context_t ctx;
@@ -1551,7 +1551,7 @@  static void
 store_regs_kernel_thread (const struct regcache *regcache, int regno,
 			  pthdb_tid_t tid)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   uint64_t gprs64[ppc_num_gprs];
   uint32_t gprs32[ppc_num_gprs];
diff --git a/gdb/alpha-bsd-nat.c b/gdb/alpha-bsd-nat.c
index 8a67bb0..7e8c40d 100644
--- a/gdb/alpha-bsd-nat.c
+++ b/gdb/alpha-bsd-nat.c
@@ -101,7 +101,7 @@  alphabsd_fetch_inferior_registers (struct target_ops *ops,
     }
 
   if (regno == -1
-      || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache)))
+      || regno >= gdbarch_fp0_regnum (regcache->arch ()))
     {
       struct fpreg fpregs;
 
@@ -138,7 +138,7 @@  alphabsd_store_inferior_registers (struct target_ops *ops,
     }
 
   if (regno == -1
-      || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache)))
+      || regno >= gdbarch_fp0_regnum (regcache->arch ()))
     {
       struct fpreg fpregs;
 
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 8955695..4331422 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -474,7 +474,7 @@  static void
 alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
 			    gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
   ULONGEST l;
@@ -543,7 +543,7 @@  static void
 alpha_store_return_value (struct type *valtype, struct regcache *regcache,
 			  const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
   ULONGEST l;
 
@@ -769,7 +769,7 @@  static const int stq_c_opcode = 0x2f;
 static std::vector<CORE_ADDR>
 alpha_deal_with_atomic_sequence (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR pc = regcache_read_pc (regcache);
   CORE_ADDR breaks[2] = {-1, -1};
   CORE_ADDR loc = pc;
@@ -1601,7 +1601,7 @@  fp_register_sign_bit (LONGEST reg)
 static CORE_ADDR
 alpha_next_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   unsigned int insn;
   unsigned int op;
   int regno;
@@ -1722,7 +1722,7 @@  alpha_next_pc (struct regcache *regcache, CORE_ADDR pc)
 std::vector<CORE_ADDR>
 alpha_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR pc;
 
   pc = alpha_next_pc (regcache, regcache_read_pc (regcache));
diff --git a/gdb/amd64-bsd-nat.c b/gdb/amd64-bsd-nat.c
index 41dee84..81cb59d 100644
--- a/gdb/amd64-bsd-nat.c
+++ b/gdb/amd64-bsd-nat.c
@@ -42,7 +42,7 @@  static void
 amd64bsd_fetch_inferior_registers (struct target_ops *ops,
 				   struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
 
   if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
@@ -116,7 +116,7 @@  static void
 amd64bsd_store_inferior_registers (struct target_ops *ops,
 				   struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
 
   if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index a83ad8b..035ce25 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -134,7 +134,7 @@  static void
 amd64_linux_fetch_inferior_registers (struct target_ops *ops,
 				      struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int tid;
 
   /* GNU/Linux LWP ID's are process ID's.  */
@@ -213,7 +213,7 @@  static void
 amd64_linux_store_inferior_registers (struct target_ops *ops,
 				      struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int tid;
 
   /* GNU/Linux LWP ID's are process ID's.  */
diff --git a/gdb/amd64-nat.c b/gdb/amd64-nat.c
index ff04339..b046052 100644
--- a/gdb/amd64-nat.c
+++ b/gdb/amd64-nat.c
@@ -96,7 +96,7 @@  amd64_supply_native_gregset (struct regcache *regcache,
 			     const void *gregs, int regnum)
 {
   const char *regs = (const char *) gregs;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int num_regs = amd64_native_gregset64_num_regs;
   int i;
 
@@ -127,7 +127,7 @@  amd64_collect_native_gregset (const struct regcache *regcache,
 			      void *gregs, int regnum)
 {
   char *regs = (char *) gregs;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int num_regs = amd64_native_gregset64_num_regs;
   int i;
 
diff --git a/gdb/amd64-obsd-tdep.c b/gdb/amd64-obsd-tdep.c
index 729342e..d51bc14 100644
--- a/gdb/amd64-obsd-tdep.c
+++ b/gdb/amd64-obsd-tdep.c
@@ -221,7 +221,7 @@  static void
 amd64obsd_supply_uthread (struct regcache *regcache,
 			  int regnum, CORE_ADDR addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp_addr = addr + AMD64OBSD_UTHREAD_RSP_OFFSET;
   CORE_ADDR sp = 0;
@@ -265,7 +265,7 @@  static void
 amd64obsd_collect_uthread (const struct regcache *regcache,
 			   int regnum, CORE_ADDR addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp_addr = addr + AMD64OBSD_UTHREAD_RSP_OFFSET;
   CORE_ADDR sp = 0;
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index e56c388..8c68664 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2924,7 +2924,7 @@  static void
 amd64_supply_fpregset (const struct regset *regset, struct regcache *regcache,
 		       int regnum, const void *fpregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   gdb_assert (len >= tdep->sizeof_fpregset);
@@ -2941,7 +2941,7 @@  amd64_collect_fpregset (const struct regset *regset,
 			const struct regcache *regcache,
 			int regnum, void *fpregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   gdb_assert (len >= tdep->sizeof_fpregset);
@@ -3266,7 +3266,7 @@  void
 amd64_supply_fxsave (struct regcache *regcache, int regnum,
 		     const void *fxsave)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   i387_supply_fxsave (regcache, regnum, fxsave);
@@ -3289,7 +3289,7 @@  void
 amd64_supply_xsave (struct regcache *regcache, int regnum,
 		    const void *xsave)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   i387_supply_xsave (regcache, regnum, xsave);
@@ -3317,7 +3317,7 @@  void
 amd64_collect_fxsave (const struct regcache *regcache, int regnum,
 		      void *fxsave)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   gdb_byte *regs = (gdb_byte *) fxsave;
 
@@ -3338,7 +3338,7 @@  void
 amd64_collect_xsave (const struct regcache *regcache, int regnum,
 		     void *xsave, int gcore)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   gdb_byte *regs = (gdb_byte *) xsave;
 
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 9927910..09572ac 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -447,7 +447,7 @@  arc_insn_get_linear_next_pc (const struct arc_instruction &insn)
 static void
 arc_write_pc (struct regcache *regcache, CORE_ADDR new_pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   if (arc_debug)
     debug_printf ("arc: Writing PC, new value=%s\n",
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 6bdcc01..a25dcd1 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -874,7 +874,7 @@  int default_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
 void
 default_skip_permanent_breakpoint (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR current_pc = regcache_read_pc (regcache);
   int bp_len;
 
diff --git a/gdb/arm-fbsd-nat.c b/gdb/arm-fbsd-nat.c
index b1c5c36..993743e 100644
--- a/gdb/arm-fbsd-nat.c
+++ b/gdb/arm-fbsd-nat.c
@@ -58,7 +58,7 @@  arm_fbsd_fetch_inferior_registers (struct target_ops *ops,
 {
   pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
 
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (regnum == -1 || getregs_supplies (gdbarch, regnum))
     {
       struct reg regs;
@@ -93,7 +93,7 @@  arm_fbsd_store_inferior_registers (struct target_ops *ops,
 {
   pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
 
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (regnum == -1 || getregs_supplies (gdbarch, regnum))
     {
       struct reg regs;
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 8b25ff7..cc7a67a 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -303,7 +303,7 @@  fetch_vfp_regs (struct regcache *regcache)
 {
   gdb_byte regbuf[VFP_REGS_SIZE];
   int ret, regno, tid;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   /* Get the thread id for the ptrace call.  */
@@ -332,7 +332,7 @@  store_vfp_regs (const struct regcache *regcache)
 {
   gdb_byte regbuf[VFP_REGS_SIZE];
   int ret, regno, tid;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   /* Get the thread id for the ptrace call.  */
@@ -378,7 +378,7 @@  static void
 arm_linux_fetch_inferior_registers (struct target_ops *ops,
 				    struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (-1 == regno)
@@ -416,7 +416,7 @@  static void
 arm_linux_store_inferior_registers (struct target_ops *ops,
 				    struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (-1 == regno)
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 056c1b9..0c387e7 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -478,7 +478,7 @@  arm_linux_supply_gregset (const struct regset *regset,
 			  struct regcache *regcache,
 			  int regnum, const void *gregs_buf, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   const gdb_byte *gregs = (const gdb_byte *) gregs_buf;
   int regno;
@@ -790,7 +790,7 @@  arm_linux_sigreturn_next_pc (struct regcache *regcache,
   ULONGEST sp;
   unsigned long sp_data;
   CORE_ADDR next_pc = 0;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int pc_offset = 0;
   int is_sigreturn = 0;
@@ -882,7 +882,7 @@  arm_linux_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self)
     }
   else
     {
-      struct gdbarch *gdbarch = get_regcache_arch (self->regcache);
+      struct gdbarch *gdbarch = self->regcache->arch ();
       enum bfd_endian byte_order_for_code = 
 	gdbarch_byte_order_for_code (gdbarch);
       unsigned long this_instr = 
@@ -922,7 +922,7 @@  arm_linux_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self)
 static std::vector<CORE_ADDR>
 arm_linux_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct arm_get_next_pcs next_pcs_ctx;
 
   /* If the target does have hardware single step, GDB doesn't have
diff --git a/gdb/arm-nbsd-nat.c b/gdb/arm-nbsd-nat.c
index f066528..0f29ebf 100644
--- a/gdb/arm-nbsd-nat.c
+++ b/gdb/arm-nbsd-nat.c
@@ -47,7 +47,7 @@  arm_supply_gregset (struct regcache *regcache, struct reg *gregset)
   regcache_raw_supply (regcache, ARM_LR_REGNUM,
 		       (char *) &gregset->r_lr);
   /* This is ok: we're running native...  */
-  r_pc = gdbarch_addr_bits_remove (get_regcache_arch (regcache), gregset->r_pc);
+  r_pc = gdbarch_addr_bits_remove (regcache->arch (), gregset->r_pc);
   regcache_raw_supply (regcache, ARM_PC_REGNUM, (char *) &r_pc);
 
   if (arm_apcs_32)
@@ -101,7 +101,7 @@  fetch_register (struct regcache *regcache, int regno)
     case ARM_PC_REGNUM:
       /* This is ok: we're running native...  */
       inferior_registers.r_pc = gdbarch_addr_bits_remove
-				  (get_regcache_arch (regcache),
+				  (regcache->arch (),
 				   inferior_registers.r_pc);
       regcache_raw_supply (regcache, ARM_PC_REGNUM,
 			   (char *) &inferior_registers.r_pc);
@@ -212,7 +212,7 @@  armnbsd_fetch_registers (struct target_ops *ops,
 static void
 store_register (const struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct reg inferior_registers;
   int ret;
 
@@ -289,7 +289,7 @@  store_register (const struct regcache *regcache, int regno)
 static void
 store_regs (const struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct reg inferior_registers;
   int ret;
   int regno;
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 960696d..f562cb7 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -297,7 +297,7 @@  int
 arm_is_thumb (struct regcache *regcache)
 {
   ULONGEST cpsr;
-  ULONGEST t_bit = arm_psr_thumb_bit (get_regcache_arch (regcache));
+  ULONGEST t_bit = arm_psr_thumb_bit (regcache->arch ());
 
   cpsr = regcache_raw_get_unsigned (regcache, ARM_PS_REGNUM);
 
@@ -4451,7 +4451,7 @@  static int
 displaced_in_arm_mode (struct regcache *regs)
 {
   ULONGEST ps;
-  ULONGEST t_bit = arm_psr_thumb_bit (get_regcache_arch (regs));
+  ULONGEST t_bit = arm_psr_thumb_bit (regs->arch ());
 
   regcache_cooked_read_unsigned (regs, ARM_PS_REGNUM, &ps);
 
@@ -4480,7 +4480,7 @@  static void
 bx_write_pc (struct regcache *regs, ULONGEST val)
 {
   ULONGEST ps;
-  ULONGEST t_bit = arm_psr_thumb_bit (get_regcache_arch (regs));
+  ULONGEST t_bit = arm_psr_thumb_bit (regs->arch ());
 
   regcache_cooked_read_unsigned (regs, ARM_PS_REGNUM, &ps);
 
@@ -6222,7 +6222,7 @@  CORE_ADDR
 arm_get_next_pcs_addr_bits_remove (struct arm_get_next_pcs *self,
 				   CORE_ADDR val)
 {
-  return gdbarch_addr_bits_remove (get_regcache_arch (self->regcache), val);
+  return gdbarch_addr_bits_remove (self->regcache->arch (), val);
 }
 
 /* Wrapper over syscall_next_pc for use in get_next_pcs.  */
@@ -6249,7 +6249,7 @@  arm_get_next_pcs_is_thumb (struct arm_get_next_pcs *self)
 std::vector<CORE_ADDR>
 arm_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct arm_get_next_pcs next_pcs_ctx;
 
   arm_get_next_pcs_ctor (&next_pcs_ctx,
@@ -7884,7 +7884,7 @@  static void
 arm_extract_return_value (struct type *type, struct regcache *regs,
 			  gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regs);
+  struct gdbarch *gdbarch = regs->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
   if (TYPE_CODE_FLT == TYPE_CODE (type))
@@ -8093,7 +8093,7 @@  static void
 arm_store_return_value (struct type *type, struct regcache *regs,
 			const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regs);
+  struct gdbarch *gdbarch = regs->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
@@ -8649,7 +8649,7 @@  arm_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile,
 static void
 arm_write_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   regcache_cooked_write_unsigned (regcache, ARM_PC_REGNUM, pc);
 
   /* If necessary, set the T bit.  */
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index 2e99418..f9594d7 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -608,7 +608,7 @@  bfin_extract_return_value (struct type *type,
 			   struct regcache *regs,
 			   gdb_byte *dst)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regs);
+  struct gdbarch *gdbarch = regs->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   bfd_byte *valbuf = dst;
   int len = TYPE_LENGTH (type);
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index c97dd34..8018f5a 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -287,7 +287,7 @@  static void
 bsd_uthread_fetch_registers (struct target_ops *ops,
 			     struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct bsd_uthread_ops *uthread_ops
     = (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
   ptid_t ptid = regcache_get_ptid (regcache);
@@ -321,7 +321,7 @@  static void
 bsd_uthread_store_registers (struct target_ops *ops,
 			     struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct bsd_uthread_ops *uthread_ops
     = (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
   struct target_ops *beneath = find_target_beneath (ops);
diff --git a/gdb/core-regset.c b/gdb/core-regset.c
index 9d2b914..77ae85b 100644
--- a/gdb/core-regset.c
+++ b/gdb/core-regset.c
@@ -84,7 +84,7 @@  fetch_core_registers (struct regcache *regcache,
       else
 	{
 	  memcpy (&fpregset, core_reg_sect, sizeof (fpregset));
-	  if (gdbarch_fp0_regnum (get_regcache_arch (regcache)) >= 0)
+	  if (gdbarch_fp0_regnum (regcache->arch ()) >= 0)
 	    supply_fpregset (regcache,
 			     (const gdb_fpregset_t *) fpregset_p);
 	}
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 594db1d..6800905 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -603,7 +603,7 @@  get_core_registers (struct target_ops *ops,
       return;
     }
 
-  gdbarch = get_regcache_arch (regcache);
+  gdbarch = regcache->arch ();
   if (gdbarch_iterate_over_regset_sections_p (gdbarch))
     gdbarch_iterate_over_regset_sections (gdbarch,
 					  get_core_registers_cb,
@@ -617,7 +617,7 @@  get_core_registers (struct target_ops *ops,
     }
 
   /* Mark all registers not found in the core as unavailable.  */
-  for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
+  for (i = 0; i < gdbarch_num_regs (regcache->arch ()); i++)
     if (regcache_register_status (regcache, i) == REG_UNKNOWN)
       regcache_raw_supply (regcache, i, NULL);
 }
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index d64c99a..d623eb6 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -1643,7 +1643,7 @@  static void
 cris_store_return_value (struct type *type, struct regcache *regcache,
 			 const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   ULONGEST val;
   int len = TYPE_LENGTH (type);
@@ -1811,7 +1811,7 @@  static void
 cris_extract_return_value (struct type *type, struct regcache *regcache,
 			   gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   ULONGEST val;
   int len = TYPE_LENGTH (type);
@@ -1994,7 +1994,7 @@  find_step_target (struct regcache *regcache, inst_env_type *inst_env)
   int i;
   int offset;
   unsigned short insn;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
   /* Create a local register image and set the initial state.  */
@@ -2063,7 +2063,7 @@  find_step_target (struct regcache *regcache, inst_env_type *inst_env)
 static std::vector<CORE_ADDR>
 cris_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   inst_env_type inst_env;
   std::vector<CORE_ADDR> next_pcs;
 
@@ -3800,7 +3800,7 @@  typedef cris_elf_greg_t crisv32_elf_gregset_t[CRISV32_ELF_NGREG];
 static void 
 cris_supply_gregset (struct regcache *regcache, cris_elf_gregset_t *gregsetp)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int i;
   cris_elf_greg_t *regp = *gregsetp;
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 21ed113..35cf78c 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1186,7 +1186,7 @@  static void
 ctf_fetch_registers (struct target_ops *ops,
 		     struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct bt_ctf_event *event = NULL;
   struct bt_iter_pos *pos;
 
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index e96f24d..dc47c73 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1191,7 +1191,7 @@  cancel_breakpoint (ptid_t ptid)
      tripped on it.  */
 
   struct regcache *regcache = get_thread_regcache (ptid);
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR pc;
 
   pc = regcache_read_pc (regcache) - gdbarch_decr_pc_after_break (gdbarch);
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index fa70f7c..f89b520 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -246,7 +246,7 @@  fbsd_collect_thread_registers (const struct regcache *regcache,
 			       char *note_data, int *note_size,
 			       enum gdb_signal stop_signal)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct fbsd_collect_regset_section_cb_data data;
 
   data.regcache = regcache;
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 8a3a893..bae0e18 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1110,7 +1110,7 @@  static void
 frv_extract_return_value (struct type *type, struct regcache *regcache,
                           gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int len = TYPE_LENGTH (type);
 
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index 0e61a4b..757301a 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -123,7 +123,7 @@  static void
 ft32_store_return_value (struct type *type, struct regcache *regcache,
 			 const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR regval;
   int len = TYPE_LENGTH (type);
@@ -400,7 +400,7 @@  static void
 ft32_extract_return_value (struct type *type, struct regcache *regcache,
 			   gdb_byte *dst)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   bfd_byte *valbuf = dst;
   int len = TYPE_LENGTH (type);
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 582b007..6abd734 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -493,7 +493,7 @@  go32_wait (struct target_ops *ops,
 static void
 fetch_register (struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (regno < gdbarch_fp0_regnum (gdbarch))
     regcache_raw_supply (regcache, regno,
 			 (char *) &a_tss + regno_mapping[regno].tss_ofs);
@@ -514,7 +514,7 @@  go32_fetch_registers (struct target_ops *ops,
   else
     {
       for (regno = 0;
-	   regno < gdbarch_fp0_regnum (get_regcache_arch (regcache));
+	   regno < gdbarch_fp0_regnum (regcache->arch ());
 	   regno++)
 	fetch_register (regcache, regno);
       i387_supply_fsave (regcache, -1, &npx);
@@ -524,7 +524,7 @@  go32_fetch_registers (struct target_ops *ops,
 static void
 store_register (const struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (regno < gdbarch_fp0_regnum (gdbarch))
     regcache_raw_collect (regcache, regno,
 			  (char *) &a_tss + regno_mapping[regno].tss_ofs);
@@ -546,7 +546,7 @@  go32_store_registers (struct target_ops *ops,
     store_register (regcache, regno);
   else
     {
-      for (r = 0; r < gdbarch_fp0_regnum (get_regcache_arch (regcache)); r++)
+      for (r = 0; r < gdbarch_fp0_regnum (regcache->arch ()); r++)
 	store_register (regcache, r);
       i387_collect_fsave (regcache, -1, &npx);
     }
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 7edc3cc..011afca 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -742,7 +742,7 @@  static void
 h8300_extract_return_value (struct type *type, struct regcache *regcache,
 			    gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int len = TYPE_LENGTH (type);
   ULONGEST c, addr;
@@ -779,7 +779,7 @@  static void
 h8300h_extract_return_value (struct type *type, struct regcache *regcache,
 			     gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   ULONGEST c;
 
@@ -844,7 +844,7 @@  static void
 h8300_store_return_value (struct type *type, struct regcache *regcache,
 			  const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   ULONGEST val;
 
@@ -873,7 +873,7 @@  static void
 h8300h_store_return_value (struct type *type, struct regcache *regcache,
 			   const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   ULONGEST val;
 
diff --git a/gdb/hppa-linux-nat.c b/gdb/hppa-linux-nat.c
index c190a4b..67f51e7 100644
--- a/gdb/hppa-linux-nat.c
+++ b/gdb/hppa-linux-nat.c
@@ -213,7 +213,7 @@  static const int greg_map[] =
 static void
 fetch_register (struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   pid_t tid;
   int val;
 
@@ -240,7 +240,7 @@  fetch_register (struct regcache *regcache, int regno)
 static void
 store_register (const struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   pid_t tid;
   int val;
 
@@ -269,7 +269,7 @@  hppa_linux_fetch_inferior_registers (struct target_ops *ops,
   if (-1 == regno)
     {
       for (regno = 0;
-	   regno < gdbarch_num_regs (get_regcache_arch (regcache));
+	   regno < gdbarch_num_regs (regcache->arch ());
 	   regno++)
         fetch_register (regcache, regno);
     }
@@ -290,7 +290,7 @@  hppa_linux_store_inferior_registers (struct target_ops *ops,
   if (-1 == regno)
     {
       for (regno = 0;
-	   regno < gdbarch_num_regs (get_regcache_arch (regcache));
+	   regno < gdbarch_num_regs (regcache->arch ());
 	   regno++)
 	store_register (regcache, regno);
     }
diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c
index dc7ce32..08a706b 100644
--- a/gdb/i386-darwin-nat.c
+++ b/gdb/i386-darwin-nat.c
@@ -52,7 +52,7 @@  i386_darwin_fetch_inferior_registers (struct target_ops *ops,
 {
   thread_t current_thread = ptid_get_tid (regcache_get_ptid (regcache));
   int fetched = 0;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
 #ifdef BFD64
   if (gdbarch_ptr_bit (gdbarch) == 64)
@@ -168,7 +168,7 @@  i386_darwin_store_inferior_registers (struct target_ops *ops,
 				      struct regcache *regcache, int regno)
 {
   thread_t current_thread = ptid_get_tid (regcache_get_ptid (regcache));
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
 #ifdef BFD64
   if (gdbarch_ptr_bit (gdbarch) == 64)
diff --git a/gdb/i386-gnu-nat.c b/gdb/i386-gnu-nat.c
index 07e3a83..68e6293 100644
--- a/gdb/i386-gnu-nat.c
+++ b/gdb/i386-gnu-nat.c
@@ -127,7 +127,7 @@  gnu_fetch_registers (struct target_ops *ops,
       else
 	{
 	  proc_debug (thread, "fetching register %s",
-		      gdbarch_register_name (get_regcache_arch (regcache),
+		      gdbarch_register_name (regcache->arch (),
 					     regno));
 
 	  regcache_raw_supply (regcache, regno,
@@ -183,7 +183,7 @@  gnu_store_registers (struct target_ops *ops,
 		     struct regcache *regcache, int regno)
 {
   struct proc *thread;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   ptid_t ptid = regcache_get_ptid (regcache);
 
   /* Make sure we know about new threads.  */
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index dd86c2f..a4c1c4a 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -112,7 +112,7 @@  fetch_register (struct regcache *regcache, int regno)
 		i386_linux_gregset_reg_offset[regno], 0);
   if (errno != 0)
     error (_("Couldn't read register %s (#%d): %s."), 
-	   gdbarch_register_name (get_regcache_arch (regcache), regno),
+	   gdbarch_register_name (regcache->arch (), regno),
 	   regno, safe_strerror (errno));
 
   regcache_raw_supply (regcache, regno, &val);
@@ -138,7 +138,7 @@  store_register (const struct regcache *regcache, int regno)
 	  i386_linux_gregset_reg_offset[regno], val);
   if (errno != 0)
     error (_("Couldn't write register %s (#%d): %s."),
-	   gdbarch_register_name (get_regcache_arch (regcache), regno),
+	   gdbarch_register_name (regcache->arch (), regno),
 	   regno, safe_strerror (errno));
 }
 
@@ -160,7 +160,7 @@  supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
 			 regp + i386_linux_gregset_reg_offset[i]);
 
   if (I386_LINUX_ORIG_EAX_REGNUM
-	< gdbarch_num_regs (get_regcache_arch (regcache)))
+	< gdbarch_num_regs (regcache->arch ()))
     regcache_raw_supply (regcache, I386_LINUX_ORIG_EAX_REGNUM, regp
 			 + i386_linux_gregset_reg_offset[I386_LINUX_ORIG_EAX_REGNUM]);
 }
@@ -183,7 +183,7 @@  fill_gregset (const struct regcache *regcache,
 
   if ((regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
       && I386_LINUX_ORIG_EAX_REGNUM
-	   < gdbarch_num_regs (get_regcache_arch (regcache)))
+	   < gdbarch_num_regs (regcache->arch ()))
     regcache_raw_collect (regcache, I386_LINUX_ORIG_EAX_REGNUM, regp
 			  + i386_linux_gregset_reg_offset[I386_LINUX_ORIG_EAX_REGNUM]);
 }
@@ -458,7 +458,7 @@  i386_linux_fetch_inferior_registers (struct target_ops *ops,
     {
       int i;
 
-      for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
+      for (i = 0; i < gdbarch_num_regs (regcache->arch ()); i++)
 	if (regno == -1 || regno == i)
 	  fetch_register (regcache, i);
 
@@ -536,7 +536,7 @@  i386_linux_store_inferior_registers (struct target_ops *ops,
     {
       int i;
 
-      for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
+      for (i = 0; i < gdbarch_num_regs (regcache->arch ()); i++)
 	if (regno == -1 || regno == i)
 	  store_register (regcache, i);
 
@@ -650,7 +650,7 @@  i386_linux_resume (struct target_ops *ops,
   if (step)
     {
       struct regcache *regcache = get_thread_regcache (ptid);
-      struct gdbarch *gdbarch = get_regcache_arch (regcache);
+      struct gdbarch *gdbarch = regcache->arch ();
       enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
       ULONGEST pc;
       gdb_byte buf[LINUX_SYSCALL_LEN];
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 8cec675..159c83f 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -537,7 +537,7 @@  i386_linux_record_signal (struct gdbarch *gdbarch,
 static LONGEST
 i386_linux_get_syscall_number_from_regcache (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   /* The content of a register.  */
   gdb_byte buf[4];
diff --git a/gdb/i386-nto-tdep.c b/gdb/i386-nto-tdep.c
index 5f0b886..f9cab3f 100644
--- a/gdb/i386-nto-tdep.c
+++ b/gdb/i386-nto-tdep.c
@@ -76,7 +76,7 @@  nto_reg_offset (int regnum)
 static void
 i386nto_supply_gregset (struct regcache *regcache, char *gpregs)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   gdb_assert (tdep->gregset_reg_offset == i386nto_gregset_reg_offset);
diff --git a/gdb/i386-obsd-nat.c b/gdb/i386-obsd-nat.c
index 76079af..f3a68de 100644
--- a/gdb/i386-obsd-nat.c
+++ b/gdb/i386-obsd-nat.c
@@ -34,7 +34,7 @@ 
 static int
 i386obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   struct switchframe sf;
 
diff --git a/gdb/i386-obsd-tdep.c b/gdb/i386-obsd-tdep.c
index 5dfda15..b9c5738 100644
--- a/gdb/i386-obsd-tdep.c
+++ b/gdb/i386-obsd-tdep.c
@@ -190,7 +190,7 @@  static void
 i386obsd_supply_uthread (struct regcache *regcache,
 			 int regnum, CORE_ADDR addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp_addr = addr + I386OBSD_UTHREAD_ESP_OFFSET;
   CORE_ADDR sp = 0;
@@ -234,7 +234,7 @@  static void
 i386obsd_collect_uthread (const struct regcache *regcache,
 			  int regnum, CORE_ADDR addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp_addr = addr + I386OBSD_UTHREAD_ESP_OFFSET;
   CORE_ADDR sp = 0;
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 46e5e32..c6de43e 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -3248,7 +3248,7 @@  i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
 static int
 i386_mmx_regnum_to_fp_regnum (struct regcache *regcache, int regnum)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
   int mmxreg, fpreg;
   ULONGEST fstat;
   int tos;
@@ -3837,7 +3837,7 @@  void
 i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
 		     int regnum, const void *gregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   const gdb_byte *regs = (const gdb_byte *) gregs;
   int i;
@@ -3862,7 +3862,7 @@  i386_collect_gregset (const struct regset *regset,
 		      const struct regcache *regcache,
 		      int regnum, void *gregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   gdb_byte *regs = (gdb_byte *) gregs;
   int i;
@@ -3885,7 +3885,7 @@  static void
 i386_supply_fpregset (const struct regset *regset, struct regcache *regcache,
 		      int regnum, const void *fpregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (len == I387_SIZEOF_FXSAVE)
@@ -3908,7 +3908,7 @@  i386_collect_fpregset (const struct regset *regset,
 		       const struct regcache *regcache,
 		       int regnum, void *fpregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (len == I387_SIZEOF_FXSAVE)
@@ -8740,7 +8740,7 @@  i386_mpx_bd_base (void)
   enum register_status regstatus;
 
   rcache = get_current_regcache ();
-  tdep = gdbarch_tdep (get_regcache_arch (rcache));
+  tdep = gdbarch_tdep (rcache->arch ());
 
   regstatus = regcache_raw_read_unsigned (rcache, tdep->bndcfgu_regnum, &ret);
 
diff --git a/gdb/i386-v4-nat.c b/gdb/i386-v4-nat.c
index ac2d9cd..de9d241 100644
--- a/gdb/i386-v4-nat.c
+++ b/gdb/i386-v4-nat.c
@@ -136,7 +136,7 @@  fill_gregset (const struct regcache *regcache,
 void
 supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
 {
-  if (gdbarch_fp0_regnum (get_regcache_arch (regcache)) == 0)
+  if (gdbarch_fp0_regnum (regcache->arch ()) == 0)
     return;
 
   i387_supply_fsave (regcache, -1, fpregsetp);
@@ -150,7 +150,7 @@  void
 fill_fpregset (const struct regcache *regcache,
 	       fpregset_t *fpregsetp, int regno)
 {
-  if (gdbarch_fp0_regnum (get_regcache_arch (regcache)) == 0)
+  if (gdbarch_fp0_regnum (regcache->arch ()) == 0)
     return;
 
   i387_collect_fsave (regcache, regno, fpregsetp);
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 3de7c62..6183591 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -447,7 +447,7 @@  static int fsave_offset[] =
 void
 i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   const gdb_byte *regs = (const gdb_byte *) fsave;
@@ -502,7 +502,7 @@  i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave)
 void
 i387_collect_fsave (const struct regcache *regcache, int regnum, void *fsave)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
   gdb_byte *regs = (gdb_byte *) fsave;
   int i;
 
@@ -595,7 +595,7 @@  static int i387_tag (const gdb_byte *raw);
 void
 i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
   const gdb_byte *regs = (const gdb_byte *) fxsave;
   int i;
 
@@ -678,7 +678,7 @@  i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
 void
 i387_collect_fxsave (const struct regcache *regcache, int regnum, void *fxsave)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
   gdb_byte *regs = (gdb_byte *) fxsave;
   int i;
 
@@ -908,7 +908,7 @@  void
 i387_supply_xsave (struct regcache *regcache, int regnum,
 		   const void *xsave)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   const gdb_byte *regs = (const gdb_byte *) xsave;
   int i;
@@ -1316,7 +1316,7 @@  void
 i387_collect_xsave (const struct regcache *regcache, int regnum,
 		    void *xsave, int gcore)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   gdb_byte *regs = (gdb_byte *) xsave;
   int i;
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 14b6843..277e7cb 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -694,7 +694,7 @@  ia64_linux_can_use_hw_breakpoint (struct target_ops *self,
 static void
 ia64_linux_fetch_register (struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR addr;
   size_t size;
   PTRACE_TYPE_RET *buf;
@@ -771,7 +771,7 @@  ia64_linux_fetch_registers (struct target_ops *ops,
 {
   if (regnum == -1)
     for (regnum = 0;
-	 regnum < gdbarch_num_regs (get_regcache_arch (regcache));
+	 regnum < gdbarch_num_regs (regcache->arch ());
 	 regnum++)
       ia64_linux_fetch_register (regcache, regnum);
   else
@@ -783,7 +783,7 @@  ia64_linux_fetch_registers (struct target_ops *ops,
 static void
 ia64_linux_store_register (const struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR addr;
   size_t size;
   PTRACE_TYPE_RET *buf;
@@ -826,7 +826,7 @@  ia64_linux_store_registers (struct target_ops *ops,
 {
   if (regnum == -1)
     for (regnum = 0;
-	 regnum < gdbarch_num_regs (get_regcache_arch (regcache));
+	 regnum < gdbarch_num_regs (regcache->arch ());
 	 regnum++)
       ia64_linux_store_register (regcache, regnum);
   else
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 222bb33..7007560 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -2553,7 +2553,7 @@  ia64_access_rse_reg (unw_addr_space_t as, unw_regnum_t uw_regnum,
   int regnum = ia64_uw2gdb_regnum (uw_regnum);
   unw_word_t bsp, sof, cfm, psr, ip;
   struct regcache *regcache = (struct regcache *) arg;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   long new_sof, old_sof;
   
@@ -3195,7 +3195,7 @@  static void
 ia64_extract_return_value (struct type *type, struct regcache *regcache,
 			   gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct type *float_elt_type;
 
   float_elt_type = is_float_or_hfa_type (type);
@@ -3260,7 +3260,7 @@  static void
 ia64_store_return_value (struct type *type, struct regcache *regcache, 
 			 const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct type *float_elt_type;
 
   float_elt_type = is_float_or_hfa_type (type);
@@ -3560,7 +3560,7 @@  find_extant_func_descr (struct gdbarch *gdbarch, CORE_ADDR faddr)
 static CORE_ADDR
 find_func_descr (struct regcache *regcache, CORE_ADDR faddr, CORE_ADDR *fdaptr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR fdesc;
 
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index b04b52e..a712613 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -77,7 +77,7 @@  inf_child_fetch_inferior_registers (struct target_ops *ops,
   if (regnum == -1)
     {
       for (regnum = 0;
-	   regnum < gdbarch_num_regs (get_regcache_arch (regcache));
+	   regnum < gdbarch_num_regs (regcache->arch ());
 	   regnum++)
 	regcache_raw_supply (regcache, regnum, NULL);
     }
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index af181f0..e127741 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -713,7 +713,7 @@  static CORE_ADDR (*inf_ptrace_register_u_offset)(struct gdbarch *, int, int);
 static void
 inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR addr;
   size_t size;
   PTRACE_TYPE_RET *buf;
@@ -759,7 +759,7 @@  inf_ptrace_fetch_registers (struct target_ops *ops,
 {
   if (regnum == -1)
     for (regnum = 0;
-	 regnum < gdbarch_num_regs (get_regcache_arch (regcache));
+	 regnum < gdbarch_num_regs (regcache->arch ());
 	 regnum++)
       inf_ptrace_fetch_register (regcache, regnum);
   else
@@ -771,7 +771,7 @@  inf_ptrace_fetch_registers (struct target_ops *ops,
 static void
 inf_ptrace_store_register (const struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR addr;
   size_t size;
   PTRACE_TYPE_RET *buf;
@@ -814,7 +814,7 @@  inf_ptrace_store_registers (struct target_ops *ops,
 {
   if (regnum == -1)
     for (regnum = 0;
-	 regnum < gdbarch_num_regs (get_regcache_arch (regcache));
+	 regnum < gdbarch_num_regs (regcache->arch ());
 	 regnum++)
       inf_ptrace_store_register (regcache, regnum);
   else
diff --git a/gdb/infrun.c b/gdb/infrun.c
index d00c5f6..8a40159 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1688,7 +1688,7 @@  static int
 use_displaced_stepping (struct thread_info *tp)
 {
   struct regcache *regcache = get_thread_regcache (tp->ptid);
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct displaced_step_inferior_state *displaced_state;
 
   displaced_state = get_displaced_stepping_state (ptid_get_pid (tp->ptid));
@@ -1757,7 +1757,7 @@  displaced_step_prepare_throw (ptid_t ptid)
   struct cleanup *ignore_cleanups;
   struct thread_info *tp = find_thread_ptid (ptid);
   struct regcache *regcache = get_thread_regcache (ptid);
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct address_space *aspace = get_regcache_aspace (regcache);
   CORE_ADDR original, copy;
   ULONGEST len;
@@ -2383,7 +2383,7 @@  resume (enum gdb_signal sig)
 {
   struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
   struct regcache *regcache = get_current_regcache ();
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct thread_info *tp = inferior_thread ();
   CORE_ADDR pc = regcache_read_pc (regcache);
   struct address_space *aspace = get_regcache_aspace (regcache);
@@ -2734,7 +2734,7 @@  resume (enum gdb_signal sig)
       && !step_over_info_valid_p ())
     {
       struct regcache *resume_regcache = get_thread_regcache (tp->ptid);
-      struct gdbarch *resume_gdbarch = get_regcache_arch (resume_regcache);
+      struct gdbarch *resume_gdbarch = resume_regcache->arch ();
       CORE_ADDR actual_pc = regcache_read_pc (resume_regcache);
       gdb_byte buf[4];
 
@@ -3004,7 +3004,7 @@  proceed (CORE_ADDR addr, enum gdb_signal siggnal)
   previous_inferior_ptid = inferior_ptid;
 
   regcache = get_current_regcache ();
-  gdbarch = get_regcache_arch (regcache);
+  gdbarch = regcache->arch ();
   aspace = get_regcache_aspace (regcache);
   pc = regcache_read_pc (regcache);
   tp = inferior_thread ();
@@ -3517,7 +3517,7 @@  do_target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
 	  || tp->suspend.stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT))
     {
       struct regcache *regcache = get_thread_regcache (tp->ptid);
-      struct gdbarch *gdbarch = get_regcache_arch (regcache);
+      struct gdbarch *gdbarch = regcache->arch ();
       CORE_ADDR pc;
       int discard = 0;
 
@@ -3580,7 +3580,7 @@  do_target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
 	  int decr_pc;
 
 	  regcache = get_thread_regcache (tp->ptid);
-	  gdbarch = get_regcache_arch (regcache);
+	  gdbarch = regcache->arch ();
 
 	  decr_pc = gdbarch_decr_pc_after_break (gdbarch);
 	  if (decr_pc != 0)
@@ -4142,7 +4142,7 @@  adjust_pc_after_break (struct thread_info *thread,
   /* If this target does not decrement the PC after breakpoints, then
      we have nothing to do.  */
   regcache = get_thread_regcache (thread->ptid);
-  gdbarch = get_regcache_arch (regcache);
+  gdbarch = regcache->arch ();
 
   decr_pc = gdbarch_decr_pc_after_break (gdbarch);
   if (decr_pc == 0)
@@ -5075,7 +5075,7 @@  handle_inferior_event_1 (struct execution_control_state *ecs)
       else
 	{
 	  struct regcache *regcache = get_thread_regcache (ecs->ptid);
-	  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+	  struct gdbarch *gdbarch = regcache->arch ();
 
 	  if (gdbarch_gdb_signal_to_target_p (gdbarch))
 	    {
@@ -5123,7 +5123,7 @@  Cannot fill $_exitsignal with the correct signal number.\n"));
       /* Check whether the inferior is displaced stepping.  */
       {
 	struct regcache *regcache = get_thread_regcache (ecs->ptid);
-	struct gdbarch *gdbarch = get_regcache_arch (regcache);
+	struct gdbarch *gdbarch = regcache->arch ();
 
 	/* If checking displaced stepping is supported, and thread
 	   ecs->ptid is displaced stepping.  */
@@ -5685,7 +5685,7 @@  handle_signal_stop (struct execution_control_state *ecs)
   if (debug_infrun)
     {
       struct regcache *regcache = get_thread_regcache (ecs->ptid);
-      struct gdbarch *gdbarch = get_regcache_arch (regcache);
+      struct gdbarch *gdbarch = regcache->arch ();
       scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
       inferior_ptid = ecs->ptid;
@@ -7920,7 +7920,7 @@  static void
 handle_segmentation_fault (struct ui_out *uiout)
 {
   struct regcache *regcache = get_current_regcache ();
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   if (gdbarch_handle_segmentation_fault_p (gdbarch))
     gdbarch_handle_segmentation_fault (gdbarch, uiout);
@@ -8829,7 +8829,7 @@  save_infcall_suspend_state (void)
   struct infcall_suspend_state *inf_state;
   struct thread_info *tp = inferior_thread ();
   struct regcache *regcache = get_current_regcache ();
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   gdb_byte *siginfo_data = NULL;
 
   if (gdbarch_get_siginfo_type_p (gdbarch))
@@ -8880,7 +8880,7 @@  restore_infcall_suspend_state (struct infcall_suspend_state *inf_state)
 {
   struct thread_info *tp = inferior_thread ();
   struct regcache *regcache = get_current_regcache ();
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   tp->suspend = inf_state->thread_suspend;
 
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index deafaaa..e47cc06 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -539,7 +539,7 @@  static void
 iq2000_extract_return_value (struct type *type, struct regcache *regcache,
 			     gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
   /* If the function's return value is 8 bytes or less, it is
diff --git a/gdb/jit.c b/gdb/jit.c
index 556bcb6..a2d1f6d 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -1270,7 +1270,7 @@  jit_frame_prev_register (struct frame_info *this_frame, void **cache, int reg)
   if (priv == NULL)
     return frame_unwind_got_optimized (this_frame, reg);
 
-  gdbarch = get_regcache_arch (priv->regcache);
+  gdbarch = priv->regcache->arch ();
   if (reg < gdbarch_num_regs (gdbarch))
     {
       gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, reg));
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index c89303c..5d8f9f3 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -2750,7 +2750,7 @@  save_stop_reason (struct lwp_info *lp)
     return;
 
   regcache = get_thread_regcache (lp->ptid);
-  gdbarch = get_regcache_arch (regcache);
+  gdbarch = regcache->arch ();
 
   pc = regcache_read_pc (regcache);
   sw_bp_pc = pc - gdbarch_decr_pc_after_break (gdbarch);
@@ -3460,7 +3460,7 @@  linux_nat_wait_1 (struct target_ops *ops,
       && !USE_SIGTRAP_SIGINFO)
     {
       struct regcache *regcache = get_thread_regcache (lp->ptid);
-      struct gdbarch *gdbarch = get_regcache_arch (regcache);
+      struct gdbarch *gdbarch = regcache->arch ();
       int decr_pc = gdbarch_decr_pc_after_break (gdbarch);
 
       if (decr_pc != 0)
@@ -3563,7 +3563,7 @@  resume_stopped_resumed_lwps (struct lwp_info *lp, void *data)
   else
     {
       struct regcache *regcache = get_thread_regcache (lp->ptid);
-      struct gdbarch *gdbarch = get_regcache_arch (regcache);
+      struct gdbarch *gdbarch = regcache->arch ();
 
       TRY
 	{
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index 59fb337..15a0d9f 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -83,7 +83,7 @@ 
 #define RECORD_Q_XGETQUOTA	(('3' << 8) + 3)
 
 #define OUTPUT_REG(val, num)      phex_nz ((val), \
-    TYPE_LENGTH (gdbarch_register_type (get_regcache_arch (regcache), (num))))
+    TYPE_LENGTH (gdbarch_register_type (regcache->arch (), (num))))
 
 /* Record a memory area of length LEN pointed to by register
    REGNUM.  */
@@ -104,7 +104,7 @@  record_linux_sockaddr (struct regcache *regcache,
 {
   gdb_byte *a;
   int addrlen;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
   if (!addr)
@@ -141,7 +141,7 @@  record_linux_msghdr (struct regcache *regcache,
 		     struct linux_record_tdep *tdep, ULONGEST addr)
 {
   gdb_byte *a;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR tmpaddr;
   int tmpint;
@@ -242,7 +242,7 @@  record_linux_system_call (enum gdb_syscall syscall,
 			  struct regcache *regcache,
 			  struct linux_record_tdep *tdep)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   ULONGEST tmpulongest;
   CORE_ADDR tmpaddr;
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 459386f..83ff59f 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1618,7 +1618,7 @@  linux_collect_thread_registers (const struct regcache *regcache,
 				char *note_data, int *note_size,
 				enum gdb_signal stop_signal)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct linux_collect_regset_section_cb_data data;
 
   data.gdbarch = gdbarch;
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 24bc5c2..42dbb92 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -303,7 +303,7 @@  static void
 lm32_extract_return_value (struct type *type, struct regcache *regcache,
 			   gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   ULONGEST l;
   CORE_ADDR return_buffer;
@@ -340,7 +340,7 @@  static void
 lm32_store_return_value (struct type *type, struct regcache *regcache,
 			 const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   ULONGEST val;
   int len = TYPE_LENGTH (type);
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 39f9ec0..8f40777 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -331,7 +331,7 @@  m32c_raw_write (struct m32c_reg *reg, struct regcache *cache,
 static int
 m32c_read_flg (struct regcache *cache)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (cache));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (cache->arch ());
   ULONGEST flg;
   regcache_raw_read_unsigned (cache, tdep->flg->num, &flg);
   return flg & 0xffff;
@@ -598,7 +598,7 @@  m32c_pseudo_register_read (struct gdbarch *arch,
   struct m32c_reg *reg;
 
   gdb_assert (0 <= cookednum && cookednum < tdep->num_regs);
-  gdb_assert (arch == get_regcache_arch (cache));
+  gdb_assert (arch == cache->arch ());
   gdb_assert (arch == tdep->regs[cookednum].arch);
   reg = &tdep->regs[cookednum];
 
@@ -616,7 +616,7 @@  m32c_pseudo_register_write (struct gdbarch *arch,
   struct m32c_reg *reg;
 
   gdb_assert (0 <= cookednum && cookednum < tdep->num_regs);
-  gdb_assert (arch == get_regcache_arch (cache));
+  gdb_assert (arch == cache->arch ());
   gdb_assert (arch == tdep->regs[cookednum].arch);
   reg = &tdep->regs[cookednum];
 
diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
index c61f2e3..af0f863 100644
--- a/gdb/m32r-linux-tdep.c
+++ b/gdb/m32r-linux-tdep.c
@@ -353,7 +353,7 @@  m32r_linux_supply_gregset (const struct regset *regset,
 {
   const gdb_byte *regs = (const gdb_byte *) gregs;
   enum bfd_endian byte_order =
-    gdbarch_byte_order (get_regcache_arch (regcache));
+    gdbarch_byte_order (regcache->arch ());
   ULONGEST psw, bbpsw;
   gdb_byte buf[4];
   const gdb_byte *p;
@@ -397,7 +397,7 @@  m32r_linux_collect_gregset (const struct regset *regset,
   gdb_byte *regs = (gdb_byte *) gregs;
   int i;
   enum bfd_endian byte_order =
-    gdbarch_byte_order (get_regcache_arch (regcache));
+    gdbarch_byte_order (regcache->arch ());
   ULONGEST psw;
   gdb_byte buf[4];
 
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index d40c390..c00455b 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -245,7 +245,7 @@  static void
 m32r_store_return_value (struct type *type, struct regcache *regcache,
 			 const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR regval;
   int len = TYPE_LENGTH (type);
@@ -770,7 +770,7 @@  static void
 m32r_extract_return_value (struct type *type, struct regcache *regcache,
 			   gdb_byte *dst)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int len = TYPE_LENGTH (type);
   ULONGEST tmp;
diff --git a/gdb/m68k-bsd-nat.c b/gdb/m68k-bsd-nat.c
index bdd00b9..c890970 100644
--- a/gdb/m68k-bsd-nat.c
+++ b/gdb/m68k-bsd-nat.c
@@ -58,7 +58,7 @@  m68kbsd_supply_gregset (struct regcache *regcache, const void *gregs)
 static void
 m68kbsd_supply_fpregset (struct regcache *regcache, const void *fpregs)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const char *regs = fpregs;
   int regnum;
 
@@ -91,7 +91,7 @@  static void
 m68kbsd_collect_fpregset (struct regcache *regcache,
 			  void *fpregs, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   char *regs = fpregs;
   int i;
 
diff --git a/gdb/m68k-bsd-tdep.c b/gdb/m68k-bsd-tdep.c
index 6b7cb3c..665d33c 100644
--- a/gdb/m68k-bsd-tdep.c
+++ b/gdb/m68k-bsd-tdep.c
@@ -58,7 +58,7 @@  m68kbsd_supply_fpregset (const struct regset *regset,
 			 struct regcache *regcache,
 			 int regnum, const void *fpregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const gdb_byte *regs = (const gdb_byte *) fpregs;
   int i;
 
diff --git a/gdb/m68k-linux-nat.c b/gdb/m68k-linux-nat.c
index 0915cbe..4a05bf1 100644
--- a/gdb/m68k-linux-nat.c
+++ b/gdb/m68k-linux-nat.c
@@ -104,7 +104,7 @@  static int have_ptrace_getregs =
 static void
 fetch_register (struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   long regaddr, val;
   int i;
   gdb_byte buf[M68K_MAX_REGISTER_SIZE];
@@ -139,7 +139,7 @@  old_fetch_inferior_registers (struct regcache *regcache, int regno)
   else
     {
       for (regno = 0;
-	   regno < gdbarch_num_regs (get_regcache_arch (regcache));
+	   regno < gdbarch_num_regs (regcache->arch ());
 	   regno++)
 	{
 	  fetch_register (regcache, regno);
@@ -152,7 +152,7 @@  old_fetch_inferior_registers (struct regcache *regcache, int regno)
 static void
 store_register (const struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   long regaddr, val;
   int i;
   gdb_byte buf[M68K_MAX_REGISTER_SIZE];
@@ -191,7 +191,7 @@  old_store_inferior_registers (const struct regcache *regcache, int regno)
   else
     {
       for (regno = 0;
-	   regno < gdbarch_num_regs (get_regcache_arch (regcache));
+	   regno < gdbarch_num_regs (regcache->arch ());
 	   regno++)
 	{
 	  store_register (regcache, regno);
@@ -206,7 +206,7 @@  old_store_inferior_registers (const struct regcache *regcache, int regno)
 void
 supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const elf_greg_t *regp = (const elf_greg_t *) gregsetp;
   int regi;
 
@@ -302,7 +302,7 @@  static void store_regs (const struct regcache *regcache, int tid, int regno)
 void
 supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int regi;
 
   for (regi = gdbarch_fp0_regnum (gdbarch);
@@ -323,7 +323,7 @@  void
 fill_fpregset (const struct regcache *regcache,
 	       elf_fpregset_t *fpregsetp, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int i;
 
   /* Fill in the floating-point registers.  */
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 37df9d5..274ba61 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -304,7 +304,7 @@  m68k_svr4_extract_return_value (struct type *type, struct regcache *regcache,
 				gdb_byte *valbuf)
 {
   gdb_byte buf[M68K_MAX_REGISTER_SIZE];
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (tdep->float_return && TYPE_CODE (type) == TYPE_CODE_FLT)
@@ -344,7 +344,7 @@  static void
 m68k_svr4_store_return_value (struct type *type, struct regcache *regcache,
 			      const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (tdep->float_return && TYPE_CODE (type) == TYPE_CODE_FLT)
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index 9f1688a..6be27a9 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -252,7 +252,7 @@  static CORE_ADDR
 m88k_store_arguments (struct regcache *regcache, int nargs,
 		      struct value **args, CORE_ADDR sp)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int num_register_words = 0;
   int num_stack_words = 0;
   int i;
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 8dc955d..98fd51f 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1006,7 +1006,7 @@  mi_cmd_data_list_changed_registers (const char *command, char **argv, int argc)
      will change depending upon the particular processor being
      debugged.  */
 
-  gdbarch = get_regcache_arch (this_regs.get ());
+  gdbarch = this_regs->arch ();
   numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
 
   ui_out_emit_list list_emitter (uiout, "changed-registers");
@@ -1058,13 +1058,13 @@  static int
 register_changed_p (int regnum, struct regcache *prev_regs,
 		    struct regcache *this_regs)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (this_regs);
+  struct gdbarch *gdbarch = this_regs->arch ();
   struct value *prev_value, *this_value;
   int ret;
 
   /* First time through or after gdbarch change consider all registers
      as changed.  */
-  if (!prev_regs || get_regcache_arch (prev_regs) != gdbarch)
+  if (!prev_regs || prev_regs->arch () != gdbarch)
     return 1;
 
   /* Get register contents and compare.  */
@@ -1231,7 +1231,7 @@  mi_cmd_data_write_register_values (const char *command, char **argv, int argc)
      debugged.  */
 
   regcache = get_current_regcache ();
-  gdbarch = get_regcache_arch (regcache);
+  gdbarch = regcache->arch ();
   numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
 
   if (argc == 0)
diff --git a/gdb/mips-fbsd-nat.c b/gdb/mips-fbsd-nat.c
index f86d447..c296f05 100644
--- a/gdb/mips-fbsd-nat.c
+++ b/gdb/mips-fbsd-nat.c
@@ -58,7 +58,7 @@  mips_fbsd_fetch_inferior_registers (struct target_ops *ops,
 {
   pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
 
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (regnum == -1 || getregs_supplies (gdbarch, regnum))
     {
       struct reg regs;
@@ -90,7 +90,7 @@  mips_fbsd_store_inferior_registers (struct target_ops *ops,
 {
   pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
 
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (regnum == -1 || getregs_supplies (gdbarch, regnum))
     {
       struct reg regs;
diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c
index b1578d0..b6b47ee 100644
--- a/gdb/mips-fbsd-tdep.c
+++ b/gdb/mips-fbsd-tdep.c
@@ -71,7 +71,7 @@  void
 mips_fbsd_supply_fpregs (struct regcache *regcache, int regnum,
 			 const void *fpregs, size_t regsize)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const gdb_byte *regs = (const gdb_byte *) fpregs;
   int i, fp0num;
 
@@ -100,7 +100,7 @@  void
 mips_fbsd_supply_gregs (struct regcache *regcache, int regnum,
 			const void *gregs, size_t regsize)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const gdb_byte *regs = (const gdb_byte *) gregs;
   int i;
 
@@ -117,7 +117,7 @@  void
 mips_fbsd_collect_fpregs (const struct regcache *regcache, int regnum,
 			  void *fpregs, size_t regsize)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   gdb_byte *regs = (gdb_byte *) fpregs;
   int i, fp0num;
 
@@ -144,7 +144,7 @@  void
 mips_fbsd_collect_gregs (const struct regcache *regcache, int regnum,
 			 void *gregs, size_t regsize)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   gdb_byte *regs = (gdb_byte *) gregs;
   int i;
 
@@ -162,7 +162,7 @@  mips_fbsd_supply_fpregset (const struct regset *regset,
 			   struct regcache *regcache,
 			   int regnum, const void *fpregs, size_t len)
 {
-  size_t regsize = mips_abi_regsize (get_regcache_arch (regcache));
+  size_t regsize = mips_abi_regsize (regcache->arch ());
 
   gdb_assert (len >= MIPS_FBSD_NUM_FPREGS * regsize);
 
@@ -179,7 +179,7 @@  mips_fbsd_collect_fpregset (const struct regset *regset,
 			    const struct regcache *regcache,
 			    int regnum, void *fpregs, size_t len)
 {
-  size_t regsize = mips_abi_regsize (get_regcache_arch (regcache));
+  size_t regsize = mips_abi_regsize (regcache->arch ());
 
   gdb_assert (len >= MIPS_FBSD_NUM_FPREGS * regsize);
 
@@ -195,7 +195,7 @@  mips_fbsd_supply_gregset (const struct regset *regset,
 			  struct regcache *regcache, int regnum,
 			  const void *gregs, size_t len)
 {
-  size_t regsize = mips_abi_regsize (get_regcache_arch (regcache));
+  size_t regsize = mips_abi_regsize (regcache->arch ());
 
   gdb_assert (len >= MIPS_FBSD_NUM_GREGS * regsize);
 
@@ -212,7 +212,7 @@  mips_fbsd_collect_gregset (const struct regset *regset,
 			   const struct regcache *regcache,
 			   int regnum, void *gregs, size_t len)
 {
-  size_t regsize = mips_abi_regsize (get_regcache_arch (regcache));
+  size_t regsize = mips_abi_regsize (regcache->arch ());
 
   gdb_assert (len >= MIPS_FBSD_NUM_GREGS * regsize);
 
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index a86963d..e6ef5a6 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -167,7 +167,7 @@  ps_get_thread_area (struct ps_prochandle *ph,
 void
 supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
 {
-  if (mips_isa_regsize (get_regcache_arch (regcache)) == 4)
+  if (mips_isa_regsize (regcache->arch ()) == 4)
     mips_supply_gregset (regcache, (const mips_elf_gregset_t *) gregsetp);
   else
     mips64_supply_gregset (regcache, (const mips64_elf_gregset_t *) gregsetp);
@@ -177,7 +177,7 @@  void
 fill_gregset (const struct regcache *regcache,
 	      gdb_gregset_t *gregsetp, int regno)
 {
-  if (mips_isa_regsize (get_regcache_arch (regcache)) == 4)
+  if (mips_isa_regsize (regcache->arch ()) == 4)
     mips_fill_gregset (regcache, (mips_elf_gregset_t *) gregsetp, regno);
   else
     mips64_fill_gregset (regcache, (mips64_elf_gregset_t *) gregsetp, regno);
@@ -186,7 +186,7 @@  fill_gregset (const struct regcache *regcache,
 void
 supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
 {
-  if (mips_isa_regsize (get_regcache_arch (regcache)) == 4)
+  if (mips_isa_regsize (regcache->arch ()) == 4)
     mips_supply_fpregset (regcache, (const mips_elf_fpregset_t *) fpregsetp);
   else
     mips64_supply_fpregset (regcache,
@@ -197,7 +197,7 @@  void
 fill_fpregset (const struct regcache *regcache,
 	       gdb_fpregset_t *fpregsetp, int regno)
 {
-  if (mips_isa_regsize (get_regcache_arch (regcache)) == 4)
+  if (mips_isa_regsize (regcache->arch ()) == 4)
     mips_fill_fpregset (regcache, (mips_elf_fpregset_t *) fpregsetp, regno);
   else
     mips64_fill_fpregset (regcache,
@@ -212,7 +212,7 @@  static void
 mips64_linux_regsets_fetch_registers (struct target_ops *ops,
 				      struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int is_fp, is_dsp;
   int have_dsp;
   int regi;
@@ -298,7 +298,7 @@  static void
 mips64_linux_regsets_store_registers (struct target_ops *ops,
 				      struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int is_fp, is_dsp;
   int have_dsp;
   int regi;
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 20d9001..ebdacd9 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -132,7 +132,7 @@  mips_supply_gregset (struct regcache *regcache,
 {
   int regi;
   const mips_elf_greg_t *regp = *gregsetp;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   for (regi = EF_REG0 + 1; regi <= EF_REG31; regi++)
     supply_32bit_reg (regcache, regi - EF_REG0, regp + regi);
@@ -171,7 +171,7 @@  void
 mips_fill_gregset (const struct regcache *regcache,
 		   mips_elf_gregset_t *gregsetp, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int regaddr, regi;
   mips_elf_greg_t *regp = *gregsetp;
   void *dst;
@@ -239,7 +239,7 @@  void
 mips_supply_fpregset (struct regcache *regcache,
 		      const mips_elf_fpregset_t *fpregsetp)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int regi;
 
   for (regi = 0; regi < 32; regi++)
@@ -273,7 +273,7 @@  void
 mips_fill_fpregset (const struct regcache *regcache,
 		    mips_elf_fpregset_t *fpregsetp, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   char *to;
 
   if ((regno >= gdbarch_fp0_regnum (gdbarch))
@@ -355,7 +355,7 @@  static void
 supply_64bit_reg (struct regcache *regcache, int regnum,
 		  const gdb_byte *buf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
       && register_size (gdbarch, regnum) == 4)
     regcache_raw_supply (regcache, regnum, buf + 4);
@@ -371,7 +371,7 @@  mips64_supply_gregset (struct regcache *regcache,
 {
   int regi;
   const mips64_elf_greg_t *regp = *gregsetp;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   for (regi = MIPS64_EF_REG0 + 1; regi <= MIPS64_EF_REG31; regi++)
     supply_64bit_reg (regcache, regi - MIPS64_EF_REG0,
@@ -415,7 +415,7 @@  void
 mips64_fill_gregset (const struct regcache *regcache,
 		     mips64_elf_gregset_t *gregsetp, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int regaddr, regi;
   mips64_elf_greg_t *regp = *gregsetp;
   void *dst;
@@ -479,7 +479,7 @@  void
 mips64_supply_fpregset (struct regcache *regcache,
 			const mips64_elf_fpregset_t *fpregsetp)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int regi;
 
   /* See mips_linux_o32_sigframe_init for a description of the
@@ -529,7 +529,7 @@  void
 mips64_fill_fpregset (const struct regcache *regcache,
 		      mips64_elf_fpregset_t *fpregsetp, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   gdb_byte *to;
 
@@ -1352,7 +1352,7 @@  micromips_linux_sigframe_validate (const struct tramp_frame *self,
 static void
 mips_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   mips_write_pc (regcache, pc);
 
diff --git a/gdb/mips-nbsd-nat.c b/gdb/mips-nbsd-nat.c
index c6e9828..8e19439 100644
--- a/gdb/mips-nbsd-nat.c
+++ b/gdb/mips-nbsd-nat.c
@@ -44,7 +44,7 @@  mipsnbsd_fetch_inferior_registers (struct target_ops *ops,
 {
   pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
 
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (regno == -1 || getregs_supplies (gdbarch, regno))
     {
       struct reg regs;
@@ -58,7 +58,7 @@  mipsnbsd_fetch_inferior_registers (struct target_ops *ops,
     }
 
   if (regno == -1
-      || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache)))
+      || regno >= gdbarch_fp0_regnum (regcache->arch ()))
     {
       struct fpreg fpregs;
 
@@ -75,7 +75,7 @@  mipsnbsd_store_inferior_registers (struct target_ops *ops,
 {
   pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
 
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (regno == -1 || getregs_supplies (gdbarch, regno))
     {
       struct reg regs;
@@ -93,7 +93,7 @@  mipsnbsd_store_inferior_registers (struct target_ops *ops,
     }
 
   if (regno == -1
-      || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache)))
+      || regno >= gdbarch_fp0_regnum (regcache->arch ()))
     {
       struct fpreg fpregs; 
 
diff --git a/gdb/mips-nbsd-tdep.c b/gdb/mips-nbsd-tdep.c
index 222ba54..7207f57 100644
--- a/gdb/mips-nbsd-tdep.c
+++ b/gdb/mips-nbsd-tdep.c
@@ -55,7 +55,7 @@  mipsnbsd_supply_fpregset (const struct regset *regset,
 			  struct regcache *regcache,
 			  int regnum, const void *fpregs, size_t len)
 {
-  size_t regsize = mips_isa_regsize (get_regcache_arch (regcache));
+  size_t regsize = mips_isa_regsize (regcache->arch ());
   const char *regs = (const char *) fpregs;
   int i;
 
@@ -78,7 +78,7 @@  mipsnbsd_supply_gregset (const struct regset *regset,
 			 struct regcache *regcache, int regnum,
 			 const void *gregs, size_t len)
 {
-  size_t regsize = mips_isa_regsize (get_regcache_arch (regcache));
+  size_t regsize = mips_isa_regsize (regcache->arch ());
   const char *regs = (const char *) gregs;
   int i;
 
@@ -137,7 +137,7 @@  mipsnbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
 void
 mipsnbsd_supply_reg (struct regcache *regcache, const char *regs, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int i;
 
   for (i = 0; i <= gdbarch_pc_regnum (gdbarch); i++)
@@ -156,7 +156,7 @@  mipsnbsd_supply_reg (struct regcache *regcache, const char *regs, int regno)
 void
 mipsnbsd_fill_reg (const struct regcache *regcache, char *regs, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int i;
 
   for (i = 0; i <= gdbarch_pc_regnum (gdbarch); i++)
@@ -170,7 +170,7 @@  void
 mipsnbsd_supply_fpreg (struct regcache *regcache,
 		       const char *fpregs, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int i;
 
   for (i = gdbarch_fp0_regnum (gdbarch);
@@ -193,7 +193,7 @@  mipsnbsd_supply_fpreg (struct regcache *regcache,
 void
 mipsnbsd_fill_fpreg (const struct regcache *regcache, char *fpregs, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int i;
 
   for (i = gdbarch_fp0_regnum (gdbarch);
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 4eafe3e..fc1fe82 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1365,7 +1365,7 @@  mips_in_frame_stub (CORE_ADDR pc)
 static CORE_ADDR
 mips_read_pc (struct regcache *regcache)
 {
-  int regnum = gdbarch_pc_regnum (get_regcache_arch (regcache));
+  int regnum = gdbarch_pc_regnum (regcache->arch ());
   LONGEST pc;
 
   regcache_cooked_read_signed (regcache, regnum, &pc);
@@ -1421,7 +1421,7 @@  mips_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 void
 mips_write_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  int regnum = gdbarch_pc_regnum (get_regcache_arch (regcache));
+  int regnum = gdbarch_pc_regnum (regcache->arch ());
 
   regcache_cooked_write_unsigned (regcache, regnum, pc);
 }
@@ -1607,7 +1607,7 @@  is_octeon_bbit_op (int op, struct gdbarch *gdbarch)
 static CORE_ADDR
 mips32_next_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   unsigned long inst;
   int op;
   inst = mips_fetch_instruction (gdbarch, ISA_MIPS, pc, NULL);
@@ -1874,7 +1874,7 @@  micromips_bc1_pc (struct gdbarch *gdbarch, struct regcache *regcache,
 static CORE_ADDR
 micromips_next_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   ULONGEST insn;
 
   insn = mips_fetch_instruction (gdbarch, ISA_MICROMIPS, pc, NULL);
@@ -2228,7 +2228,7 @@  static CORE_ADDR
 extended_mips16_next_pc (regcache *regcache, CORE_ADDR pc,
 			 unsigned int extension, unsigned int insn)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int op = (insn >> 11);
   switch (op)
     {
@@ -2332,7 +2332,7 @@  extended_mips16_next_pc (regcache *regcache, CORE_ADDR pc,
 static CORE_ADDR
 mips16_next_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   unsigned int insn = fetch_mips_16 (gdbarch, pc);
   return extended_mips16_next_pc (regcache, pc, 0, insn);
 }
@@ -2345,7 +2345,7 @@  mips16_next_pc (struct regcache *regcache, CORE_ADDR pc)
 static CORE_ADDR
 mips_next_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   if (mips_pc_is_mips16 (gdbarch, pc))
     return mips16_next_pc (regcache, pc);
@@ -4156,7 +4156,7 @@  deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
 std::vector<CORE_ADDR>
 mips_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR pc, next_pc;
 
   pc = regcache_read_pc (regcache);
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 81b1976..710bb90 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -108,7 +108,7 @@  static void
 moxie_store_return_value (struct type *type, struct regcache *regcache,
 			 const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR regval;
   int len = TYPE_LENGTH (type);
@@ -298,7 +298,7 @@  moxie_process_readu (CORE_ADDR addr, gdb_byte *buf,
 static std::vector<CORE_ADDR>
 moxie_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR addr;
   gdb_byte buf[4];
   uint16_t inst;
@@ -482,7 +482,7 @@  static void
 moxie_extract_return_value (struct type *type, struct regcache *regcache,
 			    gdb_byte *dst)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int len = TYPE_LENGTH (type);
   ULONGEST tmp;
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index cf60337..0a9f138 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -2115,7 +2115,7 @@  static const struct frame_unwind nios2_stub_frame_unwind =
 static CORE_ADDR
 nios2_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach;
   unsigned int insn;
@@ -2209,7 +2209,7 @@  nios2_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
 static std::vector<CORE_ADDR>
 nios2_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR next_pc = nios2_get_next_pc (regcache, regcache_read_pc (regcache));
 
   return {next_pc};
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index cabec0f..eb74c71 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -1386,7 +1386,7 @@  procfs_store_registers (struct target_ops *ops,
       if (dev_set == -1)
 	return;
 
-      len = nto_register_area (get_regcache_arch (regcache),
+      len = nto_register_area (regcache->arch (),
 			       regno, regset, &off);
 
       if (len < 1)
diff --git a/gdb/ppc-fbsd-nat.c b/gdb/ppc-fbsd-nat.c
index df8de14..bf6e2a5 100644
--- a/gdb/ppc-fbsd-nat.c
+++ b/gdb/ppc-fbsd-nat.c
@@ -127,7 +127,7 @@  ppcfbsd_fetch_inferior_registers (struct target_ops *ops,
 
   supply_gregset (regcache, &regs);
 
-  if (regno == -1 || getfpregs_supplies (get_regcache_arch (regcache), regno))
+  if (regno == -1 || getfpregs_supplies (regcache->arch (), regno))
     {
       const struct regset *fpregset = ppc_fbsd_fpregset ();
       gdb_fpregset_t fpregs;
@@ -157,7 +157,7 @@  ppcfbsd_store_inferior_registers (struct target_ops *ops,
   if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name (_("Couldn't write registers"));
 
-  if (regno == -1 || getfpregs_supplies (get_regcache_arch (regcache), regno))
+  if (regno == -1 || getfpregs_supplies (regcache->arch (), regno))
     {
       gdb_fpregset_t fpregs;
 
@@ -178,7 +178,7 @@  ppcfbsd_store_inferior_registers (struct target_ops *ops,
 static int
 ppcfbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int i, regnum;
 
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 7c8ab6c..f645221 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -359,7 +359,7 @@  fetch_vsx_register (struct regcache *regcache, int tid, int regno)
 {
   int ret;
   gdb_vsxregset_t regs;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int vsxregsize = register_size (gdbarch, tdep->ppc_vsr0_upper_regnum);
 
@@ -388,7 +388,7 @@  fetch_altivec_register (struct regcache *regcache, int tid, int regno)
   int ret;
   int offset = 0;
   gdb_vrregset_t regs;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
 
@@ -452,7 +452,7 @@  get_spe_registers (int tid, struct gdb_evrregset_t *evrregset)
 static void
 fetch_spe_register (struct regcache *regcache, int tid, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   struct gdb_evrregset_t evrregs;
 
@@ -491,7 +491,7 @@  fetch_spe_register (struct regcache *regcache, int tid, int regno)
 static void
 fetch_register (struct regcache *regcache, int tid, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   /* This isn't really an address.  But ptrace thinks of it as one.  */
   CORE_ADDR regaddr = ppc_register_u_addr (gdbarch, regno);
@@ -583,7 +583,7 @@  static void
 supply_vsxregset (struct regcache *regcache, gdb_vsxregset_t *vsxregsetp)
 {
   int i;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int vsxregsize = register_size (gdbarch, tdep->ppc_vsr0_upper_regnum);
 
@@ -598,7 +598,7 @@  static void
 supply_vrregset (struct regcache *regcache, gdb_vrregset_t *vrregsetp)
 {
   int i;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1;
   int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
@@ -668,7 +668,7 @@  fetch_altivec_registers (struct regcache *regcache, int tid)
 static int
 fetch_all_gp_regs (struct regcache *regcache, int tid)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   gdb_gregset_t gregset;
 
@@ -696,7 +696,7 @@  fetch_all_gp_regs (struct regcache *regcache, int tid)
 static void
 fetch_gp_regs (struct regcache *regcache, int tid)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int i;
 
@@ -748,7 +748,7 @@  fetch_all_fp_regs (struct regcache *regcache, int tid)
 static void
 fetch_fp_regs (struct regcache *regcache, int tid)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int i;
 
@@ -767,7 +767,7 @@  static void
 fetch_ppc_registers (struct regcache *regcache, int tid)
 {
   int i;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   fetch_gp_regs (regcache, tid);
@@ -824,7 +824,7 @@  store_vsx_register (const struct regcache *regcache, int tid, int regno)
 {
   int ret;
   gdb_vsxregset_t regs;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int vsxregsize = register_size (gdbarch, tdep->ppc_vsr0_upper_regnum);
 
@@ -854,7 +854,7 @@  store_altivec_register (const struct regcache *regcache, int tid, int regno)
   int ret;
   int offset = 0;
   gdb_vrregset_t regs;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
 
@@ -918,7 +918,7 @@  set_spe_registers (int tid, struct gdb_evrregset_t *evrregset)
 static void
 store_spe_register (const struct regcache *regcache, int tid, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   struct gdb_evrregset_t evrregs;
 
@@ -973,7 +973,7 @@  store_spe_register (const struct regcache *regcache, int tid, int regno)
 static void
 store_register (const struct regcache *regcache, int tid, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   /* This isn't really an address.  But ptrace thinks of it as one.  */
   CORE_ADDR regaddr = ppc_register_u_addr (gdbarch, regno);
@@ -1050,7 +1050,7 @@  static void
 fill_vsxregset (const struct regcache *regcache, gdb_vsxregset_t *vsxregsetp)
 {
   int i;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int vsxregsize = register_size (gdbarch, tdep->ppc_vsr0_upper_regnum);
 
@@ -1063,7 +1063,7 @@  static void
 fill_vrregset (const struct regcache *regcache, gdb_vrregset_t *vrregsetp)
 {
   int i;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1;
   int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
@@ -1139,7 +1139,7 @@  store_altivec_registers (const struct regcache *regcache, int tid)
 static int
 store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   gdb_gregset_t gregset;
 
@@ -1177,7 +1177,7 @@  store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
 static void
 store_gp_regs (const struct regcache *regcache, int tid, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int i;
 
@@ -1239,7 +1239,7 @@  store_all_fp_regs (const struct regcache *regcache, int tid, int regno)
 static void
 store_fp_regs (const struct regcache *regcache, int tid, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int i;
 
@@ -1258,7 +1258,7 @@  static void
 store_ppc_registers (const struct regcache *regcache, int tid)
 {
   int i;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
  
   store_gp_regs (regcache, tid, -1);
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index fe5c8db..67d8305 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -375,7 +375,7 @@  ppc_linux_supply_gregset (const struct regset *regset,
 
   ppc_supply_gregset (regset, regcache, regnum, gregs, len);
 
-  if (ppc_linux_trap_reg_p (get_regcache_arch (regcache)))
+  if (ppc_linux_trap_reg_p (regcache->arch ()))
     {
       /* "orig_r3" is stored 2 slots after "pc".  */
       if (regnum == -1 || regnum == PPC_ORIG_R3_REGNUM)
@@ -405,7 +405,7 @@  ppc_linux_collect_gregset (const struct regset *regset,
 
   ppc_collect_gregset (regset, regcache, regnum, gregs, len);
 
-  if (ppc_linux_trap_reg_p (get_regcache_arch (regcache)))
+  if (ppc_linux_trap_reg_p (regcache->arch ()))
     {
       /* "orig_r3" is stored 2 slots after "pc".  */
       if (regnum == -1 || regnum == PPC_ORIG_R3_REGNUM)
@@ -798,7 +798,7 @@  ppc_canonicalize_syscall (int syscall)
 static int
 ppc_linux_syscall_record (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   ULONGEST scnum;
   enum gdb_syscall syscall_gdb;
@@ -927,7 +927,7 @@  ppc_linux_record_signal (struct gdbarch *gdbarch, struct regcache *regcache,
 static void
 ppc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   regcache_cooked_write_unsigned (regcache, gdbarch_pc_regnum (gdbarch), pc);
 
@@ -1257,7 +1257,7 @@  static struct gdbarch *
 ppu2spu_prev_arch (struct frame_info *this_frame, void **this_cache)
 {
   struct ppu2spu_cache *cache = (struct ppu2spu_cache *) *this_cache;
-  return get_regcache_arch (cache->regcache);
+  return cache->regcache->arch ();
 }
 
 static void
@@ -1273,7 +1273,7 @@  ppu2spu_prev_register (struct frame_info *this_frame,
 		       void **this_cache, int regnum)
 {
   struct ppu2spu_cache *cache = (struct ppu2spu_cache *) *this_cache;
-  struct gdbarch *gdbarch = get_regcache_arch (cache->regcache);
+  struct gdbarch *gdbarch = cache->regcache->arch ();
   gdb_byte *buf;
 
   buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
diff --git a/gdb/ppc-nbsd-nat.c b/gdb/ppc-nbsd-nat.c
index 98a8a7c..2a83241 100644
--- a/gdb/ppc-nbsd-nat.c
+++ b/gdb/ppc-nbsd-nat.c
@@ -80,7 +80,7 @@  static void
 ppcnbsd_fetch_inferior_registers (struct target_ops *ops,
 				  struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
 
   if (regnum == -1 || getregs_supplies (gdbarch, regnum))
@@ -110,7 +110,7 @@  static void
 ppcnbsd_store_inferior_registers (struct target_ops *ops,
 				  struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
 
   if (regnum == -1 || getregs_supplies (gdbarch, regnum))
@@ -147,7 +147,7 @@  ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
 {
   struct switchframe sf;
   struct callframe cf;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int i;
 
diff --git a/gdb/ppc-obsd-nat.c b/gdb/ppc-obsd-nat.c
index 60f6a4f..cd75b92 100644
--- a/gdb/ppc-obsd-nat.c
+++ b/gdb/ppc-obsd-nat.c
@@ -89,7 +89,7 @@  ppcobsd_fetch_registers (struct target_ops *ops,
 
 #ifdef PT_GETFPREGS
   if (regnum == -1
-      || getfpregs_supplies (get_regcache_arch (regcache), regnum))
+      || getfpregs_supplies (regcache->arch (), regnum))
     {
       struct fpreg fpregs;
 
@@ -127,7 +127,7 @@  ppcobsd_store_registers (struct target_ops *ops,
 
 #ifdef PT_GETFPREGS
   if (regnum == -1
-      || getfpregs_supplies (get_regcache_arch (regcache), regnum))
+      || getfpregs_supplies (regcache->arch (), regnum))
     {
       struct fpreg fpregs;
 
@@ -147,7 +147,7 @@  ppcobsd_store_registers (struct target_ops *ops,
 static int
 ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   struct switchframe sf;
   struct callframe cf;
diff --git a/gdb/ppc-ravenscar-thread.c b/gdb/ppc-ravenscar-thread.c
index 795dae7..3221d6e 100644
--- a/gdb/ppc-ravenscar-thread.c
+++ b/gdb/ppc-ravenscar-thread.c
@@ -119,7 +119,7 @@  static void
 supply_register_at_address (struct regcache *regcache, int regnum,
                             CORE_ADDR register_addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int buf_size = register_size (gdbarch, regnum);
   gdb_byte *buf;
 
@@ -147,7 +147,7 @@  ppc_ravenscar_generic_fetch_registers
   (const struct ravenscar_reg_info *reg_info,
    struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const int num_regs = gdbarch_num_regs (gdbarch);
   int current_regnum;
   CORE_ADDR current_address;
@@ -186,7 +186,7 @@  ppc_ravenscar_generic_store_registers
   (const struct ravenscar_reg_info *reg_info,
    struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int buf_size = register_size (gdbarch, regnum);
   gdb_byte buf[buf_size];
   ULONGEST register_address;
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 34515a0..fb3fa58 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -3223,7 +3223,7 @@  procfs_fetch_registers (struct target_ops *ops,
   ptid_t ptid = regcache_get_ptid (regcache);
   int pid = ptid_get_pid (ptid);
   int tid = ptid_get_lwp (ptid);
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   pi = find_procinfo_or_die (pid, tid);
 
@@ -3273,7 +3273,7 @@  procfs_store_registers (struct target_ops *ops,
   ptid_t ptid = regcache_get_ptid (regcache);
   int pid = ptid_get_pid (ptid);
   int tid = ptid_get_lwp (ptid);
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   pi = find_procinfo_or_die (pid, tid);
 
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 7e3015d..850b84d 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -276,7 +276,7 @@  ravenscar_fetch_registers (struct target_ops *ops,
     beneath->to_fetch_registers (beneath, regcache, regnum);
   else
     {
-      struct gdbarch *gdbarch = get_regcache_arch (regcache);
+      struct gdbarch *gdbarch = regcache->arch ();
       struct ravenscar_arch_ops *arch_ops
 	= gdbarch_ravenscar_ops (gdbarch);
 
@@ -297,7 +297,7 @@  ravenscar_store_registers (struct target_ops *ops,
     beneath->to_store_registers (beneath, regcache, regnum);
   else
     {
-      struct gdbarch *gdbarch = get_regcache_arch (regcache);
+      struct gdbarch *gdbarch = regcache->arch ();
       struct ravenscar_arch_ops *arch_ops
 	= gdbarch_ravenscar_ops (gdbarch);
 
@@ -318,7 +318,7 @@  ravenscar_prepare_to_store (struct target_ops *self,
     beneath->to_prepare_to_store (beneath, regcache);
   else
     {
-      struct gdbarch *gdbarch = get_regcache_arch (regcache);
+      struct gdbarch *gdbarch = regcache->arch ();
       struct ravenscar_arch_ops *arch_ops
 	= gdbarch_ravenscar_ops (gdbarch);
 
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 36ddf1c..b7e379b 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1423,7 +1423,7 @@  record_btrace_fetch_registers (struct target_ops *ops,
       struct gdbarch *gdbarch;
       int pcreg;
 
-      gdbarch = get_regcache_arch (regcache);
+      gdbarch = regcache->arch ();
       pcreg = gdbarch_pc_regnum (gdbarch);
       if (pcreg < 0)
 	return;
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 37836e7..8c5e36b 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -244,7 +244,7 @@  static inline struct record_full_entry *
 record_full_reg_alloc (struct regcache *regcache, int regnum)
 {
   struct record_full_entry *rec;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   rec = XCNEW (struct record_full_entry);
   rec->type = record_full_reg;
@@ -569,7 +569,7 @@  static void
 record_full_message (struct regcache *regcache, enum gdb_signal signal)
 {
   int ret;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct cleanup *old_cleanups
     = make_cleanup (record_full_arch_list_cleanups, 0);
 
@@ -775,7 +775,7 @@  static void
 record_full_core_open_1 (const char *name, int from_tty)
 {
   struct regcache *regcache = get_current_regcache ();
-  int regnum = gdbarch_num_regs (get_regcache_arch (regcache));
+  int regnum = gdbarch_num_regs (regcache->arch ());
   int i;
 
   /* Get record_full_core_regbuf.  */
@@ -1171,7 +1171,7 @@  record_full_wait_1 (struct target_ops *ops,
   else
     {
       struct regcache *regcache = get_current_regcache ();
-      struct gdbarch *gdbarch = get_regcache_arch (regcache);
+      struct gdbarch *gdbarch = regcache->arch ();
       struct address_space *aspace = get_regcache_aspace (regcache);
       int continue_flag = 1;
       int first_record_full_end = 1;
@@ -1405,7 +1405,7 @@  record_full_registers_change (struct regcache *regcache, int regnum)
     {
       int i;
 
-      for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
+      for (i = 0; i < gdbarch_num_regs (regcache->arch ()); i++)
 	{
 	  if (record_full_arch_list_add_reg (regcache, i))
 	    {
@@ -1462,7 +1462,7 @@  record_full_store_registers (struct target_ops *ops,
 	      query (_("Because GDB is in replay mode, changing the value "
 		       "of a register will make the execution log unusable "
 		       "from this point onward.  Change register %s?"),
-		      gdbarch_register_name (get_regcache_arch (regcache),
+		      gdbarch_register_name (regcache->arch (),
 					       regno));
 
 	  if (!n)
@@ -1474,7 +1474,7 @@  record_full_store_registers (struct target_ops *ops,
 		  int i;
 
 		  for (i = 0;
-		       i < gdbarch_num_regs (get_regcache_arch (regcache));
+		       i < gdbarch_num_regs (regcache->arch ());
 		       i++)
 		    regcache_invalidate (regcache, i);
 		}
@@ -2029,7 +2029,7 @@  record_full_core_fetch_registers (struct target_ops *ops,
 {
   if (regno < 0)
     {
-      int num = gdbarch_num_regs (get_regcache_arch (regcache));
+      int num = gdbarch_num_regs (regcache->arch ());
       int i;
 
       for (i = 0; i < num; i ++)
@@ -2548,7 +2548,7 @@  record_full_save (struct target_ops *self, const char *recfilename)
 
   /* Get the values of regcache and gdbarch.  */
   regcache = get_current_regcache ();
-  gdbarch = get_regcache_arch (regcache);
+  gdbarch = regcache->arch ();
 
   /* Disable the GDB operation record.  */
   scoped_restore restore_operation_disable
@@ -2734,7 +2734,7 @@  record_full_goto_insn (struct record_full_entry *entry,
   scoped_restore restore_operation_disable
     = record_full_gdb_operation_disable_set ();
   struct regcache *regcache = get_current_regcache ();
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   /* Assume everything is valid: we will hit the entry,
      and we will not hit the end of the recording.  */
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 603d2f2..1ba49ad 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -185,7 +185,7 @@  register_size (struct gdbarch *gdbarch, int regnum)
 int
 regcache_register_size (const struct regcache *regcache, int n)
 {
-  return register_size (get_regcache_arch (regcache), n);
+  return register_size (regcache->arch (), n);
 }
 
 regcache::regcache (gdbarch *gdbarch, address_space *aspace_,
@@ -272,14 +272,6 @@  private:
   int m_regnum;
 };
 
-/* Return REGCACHE's architecture.  */
-
-struct gdbarch *
-get_regcache_arch (const struct regcache *regcache)
-{
-  return regcache->arch ();
-}
-
 struct address_space *
 get_regcache_aspace (const struct regcache *regcache)
 {
@@ -1245,7 +1237,7 @@  regcache::collect_regset (const struct regset *regset,
 CORE_ADDR
 regcache_read_pc (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   CORE_ADDR pc_val;
 
@@ -1272,7 +1264,7 @@  regcache_read_pc (struct regcache *regcache)
 void
 regcache_write_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   if (gdbarch_write_pc_p (gdbarch))
     gdbarch_write_pc (gdbarch, regcache, pc);
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 460d83f..0eea042 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -39,10 +39,6 @@  extern struct regcache *get_thread_arch_aspace_regcache (ptid_t,
 
 extern ptid_t regcache_get_ptid (const struct regcache *regcache);
 
-/* Return REGCACHE's architecture.  */
-
-extern struct gdbarch *get_regcache_arch (const struct regcache *regcache);
-
 /* Return REGCACHE's address space.  */
 
 extern struct address_space *get_regcache_aspace (const struct regcache *);
@@ -258,6 +254,7 @@  public:
     xfree (m_register_status);
   }
 
+  /* Return regcache's architecture.  */
   gdbarch *arch () const;
 
   address_space *aspace () const
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 48fa503..d6efa75 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -427,7 +427,7 @@  static void
 gdbsim_fetch_register (struct target_ops *ops,
 		       struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct inferior *inf = find_inferior_ptid (regcache_get_ptid (regcache));
   struct sim_inferior_data *sim_data
     = get_sim_inferior_data (inf, SIM_INSTANCE_NEEDED);
@@ -497,7 +497,7 @@  static void
 gdbsim_store_register (struct target_ops *ops,
 		       struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct inferior *inf = find_inferior_ptid (regcache_get_ptid (regcache));
   struct sim_inferior_data *sim_data
     = get_sim_inferior_data (inf, SIM_INSTANCE_NEEDED);
diff --git a/gdb/remote.c b/gdb/remote.c
index 9ee4645..49a73d8 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -7549,7 +7549,7 @@  remote_wait (struct target_ops *ops,
 static int
 fetch_register_using_p (struct regcache *regcache, struct packet_reg *reg)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct remote_state *rs = get_remote_state ();
   char *buf, *p;
   gdb_byte *regp = (gdb_byte *) alloca (register_size (gdbarch, reg->regnum));
@@ -7578,7 +7578,7 @@  fetch_register_using_p (struct regcache *regcache, struct packet_reg *reg)
       return 0;
     case PACKET_ERROR:
       error (_("Could not fetch register \"%s\"; remote failure reply '%s'"),
-	     gdbarch_register_name (get_regcache_arch (regcache), 
+	     gdbarch_register_name (regcache->arch (), 
 				    reg->regnum), 
 	     buf);
     }
@@ -7642,7 +7642,7 @@  send_g_packet (void)
 static void
 process_g_packet (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct remote_state *rs = get_remote_state ();
   remote_arch_state *rsa = get_remote_arch_state (gdbarch);
   int i, buf_len;
@@ -7778,7 +7778,7 @@  static void
 remote_fetch_registers (struct target_ops *ops,
 			struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   remote_arch_state *rsa = get_remote_arch_state (gdbarch);
   int i;
 
@@ -7838,7 +7838,7 @@  remote_prepare_to_store (struct target_ops *self, struct regcache *regcache)
     case PACKET_DISABLE:
     case PACKET_SUPPORT_UNKNOWN:
       /* Make sure all the necessary registers are cached.  */
-      for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
+      for (i = 0; i < gdbarch_num_regs (regcache->arch ()); i++)
 	if (rsa->regs[i].in_g_packet)
 	  regcache_raw_update (regcache, rsa->regs[i].regnum);
       break;
@@ -7854,7 +7854,7 @@  static int
 store_register_using_P (const struct regcache *regcache, 
 			struct packet_reg *reg)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct remote_state *rs = get_remote_state ();
   /* Try storing a single register.  */
   char *buf = rs->buf;
@@ -7906,7 +7906,7 @@  store_registers_using_G (const struct regcache *regcache)
 
     regs = (gdb_byte *) alloca (rsa->sizeof_g_packet);
     memset (regs, 0, rsa->sizeof_g_packet);
-    for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
+    for (i = 0; i < gdbarch_num_regs (regcache->arch ()); i++)
       {
 	struct packet_reg *r = &rsa->regs[i];
 
diff --git a/gdb/reverse.c b/gdb/reverse.c
index e7ef5c3..2b303f7 100644
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -121,7 +121,7 @@  save_bookmark_command (char *args, int from_tty)
 {
   /* Get target's idea of a bookmark.  */
   gdb_byte *bookmark_id = target_get_bookmark (args, from_tty);
-  struct gdbarch *gdbarch = get_regcache_arch (get_current_regcache ());
+  struct gdbarch *gdbarch = get_current_regcache ()->arch ();
 
   /* CR should not cause another identical bookmark.  */
   dont_repeat ();
@@ -280,7 +280,7 @@  goto_bookmark_command (char *args, int from_tty)
 static int
 bookmark_1 (int bnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (get_current_regcache ());
+  struct gdbarch *gdbarch = get_current_regcache ()->arch ();
   struct bookmark *b;
   int matched = 0;
 
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index fc37d6c..2399677 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -600,7 +600,7 @@  static CORE_ADDR
 branch_dest (struct regcache *regcache, int opcode, int instr,
 	     CORE_ADDR pc, CORE_ADDR safety)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR dest;
@@ -676,7 +676,7 @@  branch_dest (struct regcache *regcache, int opcode, int instr,
 static std::vector<CORE_ADDR>
 rs6000_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int ii, insn;
   CORE_ADDR loc;
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index af9273a..d985fce 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -161,7 +161,7 @@  rs6000_ptrace64 (int req, int id, long long addr, int data, void *buf)
 static void
 fetch_register (struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int addr[PPC_MAX_REGISTER_SIZE];
   int nr, isfloat;
   pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
@@ -220,7 +220,7 @@  fetch_register (struct regcache *regcache, int regno)
 static void
 store_register (struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int addr[PPC_MAX_REGISTER_SIZE];
   int nr, isfloat;
   pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
@@ -281,7 +281,7 @@  static void
 rs6000_fetch_inferior_registers (struct target_ops *ops,
 				 struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (regno != -1)
     fetch_register (regcache, regno);
 
@@ -324,7 +324,7 @@  static void
 rs6000_store_inferior_registers (struct target_ops *ops,
 				 struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (regno != -1)
     store_register (regcache, regno);
 
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index df1a84d..35f8ad7 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -393,7 +393,7 @@  ppc_supply_reg (struct regcache *regcache, int regnum,
     {
       if (regsize > 4)
 	{
-	  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+	  struct gdbarch *gdbarch = regcache->arch ();
 	  int gdb_regsize = register_size (gdbarch, regnum);
 	  if (gdb_regsize < regsize
 	      && gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
@@ -414,7 +414,7 @@  ppc_collect_reg (const struct regcache *regcache, int regnum,
     {
       if (regsize > 4)
 	{
-	  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+	  struct gdbarch *gdbarch = regcache->arch ();
 	  int gdb_regsize = register_size (gdbarch, regnum);
 	  if (gdb_regsize < regsize)
 	    {
@@ -511,7 +511,7 @@  void
 ppc_supply_gregset (const struct regset *regset, struct regcache *regcache,
 		    int regnum, const void *gregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   const struct ppc_reg_offsets *offsets
     = (const struct ppc_reg_offsets *) regset->regmap;
@@ -561,7 +561,7 @@  void
 ppc_supply_fpregset (const struct regset *regset, struct regcache *regcache,
 		     int regnum, const void *fpregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep;
   const struct ppc_reg_offsets *offsets;
   size_t offset;
@@ -599,7 +599,7 @@  void
 ppc_supply_vsxregset (const struct regset *regset, struct regcache *regcache,
 		     int regnum, const void *vsxregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep;
 
   if (!ppc_vsx_support_p (gdbarch))
@@ -630,7 +630,7 @@  void
 ppc_supply_vrregset (const struct regset *regset, struct regcache *regcache,
 		     int regnum, const void *vrregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep;
   const struct ppc_reg_offsets *offsets;
   size_t offset;
@@ -676,7 +676,7 @@  ppc_collect_gregset (const struct regset *regset,
 		     const struct regcache *regcache,
 		     int regnum, void *gregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   const struct ppc_reg_offsets *offsets
     = (const struct ppc_reg_offsets *) regset->regmap;
@@ -727,7 +727,7 @@  ppc_collect_fpregset (const struct regset *regset,
 		      const struct regcache *regcache,
 		      int regnum, void *fpregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep;
   const struct ppc_reg_offsets *offsets;
   size_t offset;
@@ -767,7 +767,7 @@  ppc_collect_vsxregset (const struct regset *regset,
 		      const struct regcache *regcache,
 		      int regnum, void *vsxregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep;
 
   if (!ppc_vsx_support_p (gdbarch))
@@ -801,7 +801,7 @@  ppc_collect_vrregset (const struct regset *regset,
 		      const struct regcache *regcache,
 		      int regnum, void *vrregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep;
   const struct ppc_reg_offsets *offsets;
   size_t offset;
@@ -1167,7 +1167,7 @@  ppc_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
 std::vector<CORE_ADDR>
 ppc_deal_with_atomic_sequence (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR pc = regcache_read_pc (regcache);
   CORE_ADDR breaks[2] = {-1, -1};
@@ -2674,7 +2674,7 @@  static enum register_status
 e500_move_ev_register (move_ev_register_func move,
 		       struct regcache *regcache, int ev_reg, void *buffer)
 {
-  struct gdbarch *arch = get_regcache_arch (regcache);
+  struct gdbarch *arch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (arch); 
   int reg_index;
   gdb_byte *byte_buffer = (gdb_byte *) buffer;
@@ -2888,7 +2888,7 @@  rs6000_pseudo_register_read (struct gdbarch *gdbarch,
 			     struct regcache *regcache,
 			     int reg_nr, gdb_byte *buffer)
 {
-  struct gdbarch *regcache_arch = get_regcache_arch (regcache);
+  struct gdbarch *regcache_arch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 
 
   gdb_assert (regcache_arch == gdbarch);
@@ -2913,7 +2913,7 @@  rs6000_pseudo_register_write (struct gdbarch *gdbarch,
 			      struct regcache *regcache,
 			      int reg_nr, const gdb_byte *buffer)
 {
-  struct gdbarch *regcache_arch = get_regcache_arch (regcache);
+  struct gdbarch *regcache_arch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 
 
   gdb_assert (regcache_arch == gdbarch);
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index 88ae575..03b14a9 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -119,7 +119,7 @@  void
 supply_gregset (struct regcache *regcache, const gregset_t *regp)
 {
 #ifdef __s390x__
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (gdbarch_ptr_bit (gdbarch) == 32)
     {
       enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -153,7 +153,7 @@  void
 fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno)
 {
 #ifdef __s390x__
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (gdbarch_ptr_bit (gdbarch) == 32)
     {
       regcache_collect_regset (&s390_64_gregset, regcache, regno,
@@ -383,7 +383,7 @@  s390_linux_fetch_inferior_registers (struct target_ops *ops,
   if (have_regset_last_break)
     if (regnum == -1 || regnum == S390_LAST_BREAK_REGNUM)
       fetch_regset (regcache, tid, NT_S390_LAST_BREAK, 8,
-		    (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32
+		    (gdbarch_ptr_bit (regcache->arch ()) == 32
 		     ? &s390_last_break_regset : &s390x_last_break_regset));
 
   if (have_regset_system_call)
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index d48364b..9bfc575 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -157,7 +157,7 @@  s390_cannot_store_register (struct gdbarch *gdbarch, int regnum)
 static void
 s390_write_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
@@ -730,7 +730,7 @@  s390_is_partial_instruction (struct gdbarch *gdbarch, CORE_ADDR loc, int *len)
 static std::vector<CORE_ADDR>
 s390_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR loc = regcache_read_pc (regcache);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int len;
@@ -2693,7 +2693,7 @@  static struct linux_record_tdep s390x_linux_record_tdep;
 static int
 s390_all_but_pc_registers_record (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int i;
 
@@ -2895,7 +2895,7 @@  s390_canonicalize_syscall (int syscall, enum s390_abi_kind abi)
 static int
 s390_linux_syscall_record (struct regcache *regcache, LONGEST syscall_native)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int ret;
   enum gdb_syscall syscall_gdb;
diff --git a/gdb/sentinel-frame.c b/gdb/sentinel-frame.c
index 925a0aa..12f1cac 100644
--- a/gdb/sentinel-frame.c
+++ b/gdb/sentinel-frame.c
@@ -74,7 +74,7 @@  sentinel_frame_prev_arch (struct frame_info *this_frame,
   struct frame_unwind_cache *cache
     = (struct frame_unwind_cache *) *this_prologue_cache;
 
-  return get_regcache_arch (cache->regcache);
+  return cache->regcache->arch ();
 }
 
 const struct frame_unwind sentinel_frame_unwind =
diff --git a/gdb/sh-nbsd-nat.c b/gdb/sh-nbsd-nat.c
index 7cf7a99..11c26be 100644
--- a/gdb/sh-nbsd-nat.c
+++ b/gdb/sh-nbsd-nat.c
@@ -47,7 +47,7 @@  shnbsd_fetch_inferior_registers (struct target_ops *ops,
 {
   pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
 
-  if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno))
+  if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno))
     {
       struct reg inferior_registers;
 
@@ -70,7 +70,7 @@  shnbsd_store_inferior_registers (struct target_ops *ops,
 {
   pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
 
-  if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno))
+  if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno))
     {
       struct reg inferior_registers;
 
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index dc89cae..6258825 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1310,7 +1310,7 @@  static void
 sh_extract_return_value_nofpu (struct type *type, struct regcache *regcache,
 			       gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int len = TYPE_LENGTH (type);
 
@@ -1335,7 +1335,7 @@  static void
 sh_extract_return_value_fpu (struct type *type, struct regcache *regcache,
 			     gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (sh_treat_as_flt_p (type))
     {
       int len = TYPE_LENGTH (type);
@@ -1361,7 +1361,7 @@  static void
 sh_store_return_value_nofpu (struct type *type, struct regcache *regcache,
 			     const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   ULONGEST val;
   int len = TYPE_LENGTH (type);
@@ -1383,7 +1383,7 @@  static void
 sh_store_return_value_fpu (struct type *type, struct regcache *regcache,
 			   const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   if (sh_treat_as_flt_p (type))
     {
       int len = TYPE_LENGTH (type);
@@ -2165,7 +2165,7 @@  sh_corefile_supply_regset (const struct regset *regset,
 			   struct regcache *regcache,
 			   int regnum, const void *regs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   const struct sh_corefile_regmap *regmap = (regset == &sh_corefile_gregset
 					     ? tdep->core_gregmap
@@ -2191,7 +2191,7 @@  sh_corefile_collect_regset (const struct regset *regset,
 			    const struct regcache *regcache,
 			    int regnum, void *regs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   const struct sh_corefile_regmap *regmap = (regset == &sh_corefile_gregset
 					     ? tdep->core_gregmap
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 586490b..c504e21 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -1241,7 +1241,7 @@  static void
 sh64_extract_return_value (struct type *type, struct regcache *regcache,
 			   gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int len = TYPE_LENGTH (type);
 
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
@@ -1295,7 +1295,7 @@  static void
 sh64_store_return_value (struct type *type, struct regcache *regcache,
 			 const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   gdb_byte buf[64];	/* more than enough...  */
   int len = TYPE_LENGTH (type);
 
diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
index 6ed717a..7db5eed 100644
--- a/gdb/sparc-linux-tdep.c
+++ b/gdb/sparc-linux-tdep.c
@@ -253,7 +253,7 @@  sparc32_linux_collect_core_fpregset (const struct regset *regset,
 static void
 sparc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
   ULONGEST psr;
 
   regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index fe9dca3..e41f164 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -137,7 +137,7 @@  void
 sparc_fetch_inferior_registers (struct target_ops *ops,
 				struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   pid_t pid;
 
   /* NOTE: cagney/2002-12-03: This code assumes that the currently
@@ -190,7 +190,7 @@  void
 sparc_store_inferior_registers (struct target_ops *ops,
 				struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   pid_t pid;
 
   /* NOTE: cagney/2002-12-02: See comment in fetch_inferior_registers
diff --git a/gdb/sparc-obsd-tdep.c b/gdb/sparc-obsd-tdep.c
index d495f71..88a381b 100644
--- a/gdb/sparc-obsd-tdep.c
+++ b/gdb/sparc-obsd-tdep.c
@@ -152,7 +152,7 @@  static void
 sparc32obsd_supply_uthread (struct regcache *regcache,
 			    int regnum, CORE_ADDR addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR fp, fp_addr = addr + SPARC32OBSD_UTHREAD_FP_OFFSET;
   gdb_byte buf[4];
@@ -197,7 +197,7 @@  static void
 sparc32obsd_collect_uthread(const struct regcache *regcache,
 			    int regnum, CORE_ADDR addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp;
   gdb_byte buf[4];
diff --git a/gdb/sparc-ravenscar-thread.c b/gdb/sparc-ravenscar-thread.c
index 89f960a..28d64f9 100644
--- a/gdb/sparc-ravenscar-thread.c
+++ b/gdb/sparc-ravenscar-thread.c
@@ -62,7 +62,7 @@  static void
 supply_register_at_address (struct regcache *regcache, int regnum,
                             CORE_ADDR register_addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int buf_size = register_size (gdbarch, regnum);
   gdb_byte *buf;
 
@@ -103,7 +103,7 @@  register_in_thread_descriptor_p (int regnum)
 static void
 sparc_ravenscar_fetch_registers (struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const int sp_regnum = gdbarch_sp_regnum (gdbarch);
   const int num_regs = gdbarch_num_regs (gdbarch);
   int current_regnum;
@@ -155,7 +155,7 @@  sparc_ravenscar_prepare_to_store (struct regcache *regcache)
 static void
 sparc_ravenscar_store_registers (struct regcache *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int buf_size = register_size (gdbarch, regnum);
   gdb_byte buf[buf_size];
   ULONGEST register_address;
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 353b33c..809cb9a 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -594,7 +594,7 @@  sparc32_store_arguments (struct regcache *regcache, int nargs,
 			 struct value **args, CORE_ADDR sp,
 			 int struct_return, CORE_ADDR struct_addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   /* Number of words in the "parameter array".  */
   int num_elements = 0;
@@ -1662,7 +1662,7 @@  sparc_analyze_control_transfer (struct regcache *regcache,
       struct frame_info *frame = get_current_frame ();
 
       /* Trap instruction (TRAP).  */
-      return gdbarch_tdep (get_regcache_arch (regcache))->step_trap (frame,
+      return gdbarch_tdep (regcache->arch ())->step_trap (frame,
 								     insn);
     }
 
@@ -1712,7 +1712,7 @@  sparc_step_trap (struct frame_info *frame, unsigned long insn)
 static std::vector<CORE_ADDR>
 sparc_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *arch = get_regcache_arch (regcache);
+  struct gdbarch *arch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
   CORE_ADDR npc, nnpc;
 
@@ -1742,7 +1742,7 @@  sparc_software_single_step (struct regcache *regcache)
 static void
 sparc_write_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
 
   regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
   regcache_cooked_write_unsigned (regcache, tdep->npc_regnum, pc + 4);
@@ -1924,7 +1924,7 @@  sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 void
 sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int offset = 0;
   gdb_byte buf[8];
@@ -1964,7 +1964,7 @@  sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp, int regnum)
 
       /* Clear out the top half of the temporary buffer, and put the
 	 register value in the bottom half if we're in 64-bit mode.  */
-      if (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 64)
+      if (gdbarch_ptr_bit (regcache->arch ()) == 64)
 	{
 	  memset (buf, 0, 4);
 	  offset = 4;
@@ -1998,7 +1998,7 @@  void
 sparc_collect_rwindow (const struct regcache *regcache,
 		       CORE_ADDR sp, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int offset = 0;
   gdb_byte buf[8];
@@ -2036,7 +2036,7 @@  sparc_collect_rwindow (const struct regcache *regcache,
       sp &= 0xffffffffUL;
 
       /* Only use the bottom half if we're in 64-bit mode.  */
-      if (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 64)
+      if (gdbarch_ptr_bit (regcache->arch ()) == 64)
 	offset = 4;
 
       for (i = SPARC_L0_REGNUM; i <= SPARC_I7_REGNUM; i++)
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
index 8c61072..04cb62b 100644
--- a/gdb/sparc64-linux-tdep.c
+++ b/gdb/sparc64-linux-tdep.c
@@ -261,7 +261,7 @@  sparc64_linux_collect_core_fpregset (const struct regset *regset,
 static void
 sparc64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
   ULONGEST state;
 
   regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
diff --git a/gdb/sparc64-nbsd-nat.c b/gdb/sparc64-nbsd-nat.c
index 44e54f5..35b83c4 100644
--- a/gdb/sparc64-nbsd-nat.c
+++ b/gdb/sparc64-nbsd-nat.c
@@ -34,7 +34,7 @@  sparc64nbsd_supply_gregset (const struct sparc_gregmap *gregmap,
 			    struct regcache *regcache,
 			    int regnum, const void *gregs)
 {
-  int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
+  int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
 
   if (sparc32)
     sparc32_supply_gregset (&sparc32nbsd_gregmap, regcache, regnum, gregs);
@@ -47,7 +47,7 @@  sparc64nbsd_collect_gregset (const struct sparc_gregmap *gregmap,
 			     const struct regcache *regcache,
 			     int regnum, void *gregs)
 {
-  int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
+  int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
 
   if (sparc32)
     sparc32_collect_gregset (&sparc32nbsd_gregmap, regcache, regnum, gregs);
@@ -60,7 +60,7 @@  sparc64nbsd_supply_fpregset (const struct sparc_fpregmap *fpregmap,
 			     struct regcache *regcache,
 			     int regnum, const void *fpregs)
 {
-  int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
+  int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
 
   if (sparc32)
     sparc32_supply_fpregset (&sparc32_bsd_fpregmap, regcache, regnum, fpregs);
@@ -73,7 +73,7 @@  sparc64nbsd_collect_fpregset (const struct sparc_fpregmap *fpregmap,
 			      const struct regcache *regcache,
 			      int regnum, void *fpregs)
 {
-  int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
+  int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
 
   if (sparc32)
     sparc32_collect_fpregset (&sparc32_bsd_fpregmap, regcache, regnum, fpregs);
diff --git a/gdb/sparc64-obsd-tdep.c b/gdb/sparc64-obsd-tdep.c
index e86872e..8757930 100644
--- a/gdb/sparc64-obsd-tdep.c
+++ b/gdb/sparc64-obsd-tdep.c
@@ -323,7 +323,7 @@  static void
 sparc64obsd_supply_uthread (struct regcache *regcache,
 			    int regnum, CORE_ADDR addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR fp, fp_addr = addr + SPARC64OBSD_UTHREAD_FP_OFFSET;
   gdb_byte buf[8];
@@ -368,7 +368,7 @@  static void
 sparc64obsd_collect_uthread(const struct regcache *regcache,
 			    int regnum, CORE_ADDR addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp;
   gdb_byte buf[8];
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 6a1d963..a756834 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -1211,7 +1211,7 @@  static void
 sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
 			       const gdb_byte *valbuf, int element, int bitpos)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int len = TYPE_LENGTH (type);
 
   gdb_assert (element < 16);
@@ -1303,7 +1303,7 @@  static void
 sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
 				 gdb_byte *valbuf, int bitpos)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
     {
@@ -1372,7 +1372,7 @@  sparc64_store_arguments (struct regcache *regcache, int nargs,
 			 struct value **args, CORE_ADDR sp,
 			 int struct_return, CORE_ADDR struct_addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   /* Number of extended words in the "parameter array".  */
   int num_elements = 0;
   int element = 0;
@@ -1883,7 +1883,7 @@  sparc64_supply_gregset (const struct sparc_gregmap *gregmap,
 			struct regcache *regcache,
 			int regnum, const void *gregs)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int sparc32 = (gdbarch_ptr_bit (gdbarch) == 32);
   const gdb_byte *regs = (const gdb_byte *) gregs;
@@ -2000,7 +2000,7 @@  sparc64_collect_gregset (const struct sparc_gregmap *gregmap,
 			 const struct regcache *regcache,
 			 int regnum, void *gregs)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int sparc32 = (gdbarch_ptr_bit (gdbarch) == 32);
   gdb_byte *regs = (gdb_byte *) gregs;
@@ -2110,7 +2110,7 @@  sparc64_supply_fpregset (const struct sparc_fpregmap *fpregmap,
 			 struct regcache *regcache,
 			 int regnum, const void *fpregs)
 {
-  int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
+  int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
   const gdb_byte *regs = (const gdb_byte *) fpregs;
   int i;
 
@@ -2148,7 +2148,7 @@  sparc64_collect_fpregset (const struct sparc_fpregmap *fpregmap,
 			  const struct regcache *regcache,
 			  int regnum, void *fpregs)
 {
-  int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
+  int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
   gdb_byte *regs = (gdb_byte *) fpregs;
   int i;
 
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index 77f5620..bf15a8c 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -504,7 +504,7 @@  spu_fetch_inferior_registers (struct target_ops *ops,
   /* The ID register holds the spufs file handle.  */
   if (regno == -1 || regno == SPU_ID_REGNUM)
     {
-      struct gdbarch *gdbarch = get_regcache_arch (regcache);
+      struct gdbarch *gdbarch = regcache->arch ();
       enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
       gdb_byte buf[4];
       store_unsigned_integer (buf, 4, byte_order, fd);
diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c
index e521c7e..3929959 100644
--- a/gdb/spu-multiarch.c
+++ b/gdb/spu-multiarch.c
@@ -144,7 +144,7 @@  static void
 spu_fetch_registers (struct target_ops *ops,
 		     struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   struct target_ops *ops_beneath = find_target_beneath (ops);
   int spufs_fd;
@@ -204,7 +204,7 @@  static void
 spu_store_registers (struct target_ops *ops,
 		     struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct target_ops *ops_beneath = find_target_beneath (ops);
   int spufs_fd;
   CORE_ADDR spufs_addr;
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 736993e..ecdc7fc 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -185,7 +185,7 @@  static enum register_status
 spu_pseudo_register_read_spu (struct regcache *regcache, const char *regname,
 			      gdb_byte *buf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   enum register_status status;
   gdb_byte reg[32];
@@ -253,7 +253,7 @@  static void
 spu_pseudo_register_write_spu (struct regcache *regcache, const char *regname,
 			       const gdb_byte *buf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   char reg[32];
   char annex[32];
@@ -1178,7 +1178,7 @@  spu_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 static CORE_ADDR
 spu_read_pc (struct regcache *regcache)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
   ULONGEST pc;
   regcache_cooked_read_unsigned (regcache, SPU_PC_REGNUM, &pc);
   /* Mask off interrupt enable bit.  */
@@ -1209,7 +1209,7 @@  static struct gdbarch *
 spu2ppu_prev_arch (struct frame_info *this_frame, void **this_cache)
 {
   struct spu2ppu_cache *cache = (struct spu2ppu_cache *) *this_cache;
-  return get_regcache_arch (cache->regcache);
+  return cache->regcache->arch ();
 }
 
 static void
@@ -1225,7 +1225,7 @@  spu2ppu_prev_register (struct frame_info *this_frame,
 		       void **this_cache, int regnum)
 {
   struct spu2ppu_cache *cache = (struct spu2ppu_cache *) *this_cache;
-  struct gdbarch *gdbarch = get_regcache_arch (cache->regcache);
+  struct gdbarch *gdbarch = cache->regcache->arch ();
   gdb_byte *buf;
 
   buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
@@ -1614,7 +1614,7 @@  spu_memory_remove_breakpoint (struct gdbarch *gdbarch,
 static std::vector<CORE_ADDR>
 spu_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR pc, next_pc;
   unsigned int insn;
diff --git a/gdb/stack.c b/gdb/stack.c
index 4e40e32..42cb736 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2472,7 +2472,7 @@  return_command (char *retval_exp, int from_tty)
   if (return_value != NULL)
     {
       struct type *return_type = value_type (return_value);
-      struct gdbarch *gdbarch = get_regcache_arch (get_current_regcache ());
+      struct gdbarch *gdbarch = get_current_regcache ()->arch ();
 
       gdb_assert (rv_conv != RETURN_VALUE_STRUCT_CONVENTION
 		  && rv_conv != RETURN_VALUE_ABI_RETURNS_ADDRESS);
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index f477f38..66f2259 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -593,7 +593,7 @@  tic6x_extract_signed_field (int value, int low_bit, int bits)
 static CORE_ADDR
 tic6x_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   unsigned long inst;
   int register_number;
   int last = 0;
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 727570c..6ef904d 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -843,7 +843,7 @@  static void
 tfile_fetch_registers (struct target_ops *ops,
 		       struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int offset, regn, regsize, dummy;
 
   /* An uninitialized reg size says we're not going to be
@@ -859,7 +859,7 @@  tfile_fetch_registers (struct target_ops *ops,
 
       for (regn = 0; regn < gdbarch_num_regs (gdbarch); regn++)
 	{
-	  if (!remote_register_number_and_offset (get_regcache_arch (regcache),
+	  if (!remote_register_number_and_offset (regcache->arch (),
 						  regn, &dummy, &offset))
 	    continue;
 
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
index b6a800c..93d8816 100644
--- a/gdb/tracefile.c
+++ b/gdb/tracefile.c
@@ -387,7 +387,7 @@  trace_save_ctf (const char *dirname, int target_does_save)
 void
 tracefile_fetch_registers (struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct tracepoint *tp = get_tracepoint (get_tracepoint_number ());
   int regn;
 
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 46a74aa..065cc9b 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1111,7 +1111,7 @@  static void
 v850_extract_return_value (struct type *type, struct regcache *regcache,
 			   gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int len = TYPE_LENGTH (type);
 
@@ -1138,7 +1138,7 @@  static void
 v850_store_return_value (struct type *type, struct regcache *regcache,
 			 const gdb_byte *valbuf)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int len = TYPE_LENGTH (type);
 
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 04203de..c1f10c8 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -107,7 +107,7 @@  static CORE_ADDR
 vax_store_arguments (struct regcache *regcache, int nargs,
 		     struct value **args, CORE_ADDR sp)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   gdb_byte buf[4];
   int count = 0;
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 58d7e11..128edc2 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -466,7 +466,7 @@  do_windows_fetch_inferior_registers (struct regcache *regcache,
 				     windows_thread_info *th, int r)
 {
   char *context_offset = ((char *) &th->context) + mappings[r];
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   long l;
 
@@ -553,7 +553,7 @@  do_windows_store_inferior_registers (const struct regcache *regcache,
 			  ((char *) &th->context) + mappings[r]);
   else
     {
-      for (r = 0; r < gdbarch_num_regs (get_regcache_arch (regcache)); r++)
+      for (r = 0; r < gdbarch_num_regs (regcache->arch ()); r++)
 	do_windows_store_inferior_registers (regcache, th, r);
     }
 }
@@ -1376,7 +1376,7 @@  windows_resume (struct target_ops *ops,
 	{
 	  /* Single step by setting t bit.  */
 	  struct regcache *regcache = get_current_regcache ();
-	  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+	  struct gdbarch *gdbarch = regcache->arch ();
 	  windows_fetch_inferior_registers (ops, regcache,
 					    gdbarch_ps_regnum (gdbarch));
 	  th->context.EFlags |= FLAG_TRACE_BIT;
diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index b8366c5..ad411f1 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -51,7 +51,7 @@  fill_gregset (const struct regcache *regcache,
 {
   int i;
   xtensa_elf_gregset_t *regs = (xtensa_elf_gregset_t *) gregsetp;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
     regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), &regs->pc);
@@ -121,7 +121,7 @@  supply_gregset_reg (struct regcache *regcache,
   int i;
   xtensa_elf_gregset_t *regs = (xtensa_elf_gregset_t *) gregsetp;
 
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
     regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), &regs->pc);
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index e8f6eb2..0b0ec2e 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -388,7 +388,7 @@  xtensa_register_write_masked (struct regcache *regcache,
   DEBUGTRACE ("xtensa_register_write_masked ()\n");
 
   /* Copy the masked register to host byte-order.  */
-  if (gdbarch_byte_order (get_regcache_arch (regcache)) == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (regcache->arch ()) == BFD_ENDIAN_BIG)
     for (i = 0; i < bytesize; i++)
       {
 	mem >>= 8;
@@ -522,7 +522,7 @@  xtensa_register_read_masked (struct regcache *regcache,
   ptr = value;
   mem = *ptr;
 
-  if (gdbarch_byte_order (get_regcache_arch (regcache)) == BFD_ENDIAN_BIG)
+  if (gdbarch_byte_order (regcache->arch ()) == BFD_ENDIAN_BIG)
     for (i = 0; i < bytesize; i++)
       {
 	if ((i & 3) == 0)
@@ -847,7 +847,7 @@  xtensa_supply_gregset (const struct regset *regset,
 		       size_t len)
 {
   const xtensa_elf_gregset_t *regs = (const xtensa_elf_gregset_t *) gregs;
-  struct gdbarch *gdbarch = get_regcache_arch (rc);
+  struct gdbarch *gdbarch = rc->arch ();
   int i;
 
   DEBUGTRACE ("xtensa_supply_gregset (..., regnum==%d, ...)\n", regnum);
@@ -1557,7 +1557,7 @@  xtensa_extract_return_value (struct type *type,
 			     struct regcache *regcache,
 			     void *dst)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   bfd_byte *valbuf = (bfd_byte *) dst;
   int len = TYPE_LENGTH (type);
   ULONGEST pc, wb;
@@ -1613,7 +1613,7 @@  xtensa_store_return_value (struct type *type,
 			   struct regcache *regcache,
 			   const void *dst)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   const bfd_byte *valbuf = (const bfd_byte *) dst;
   unsigned int areg;
   ULONGEST pc, wb;