Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc][3/13] Eliminate read_register: read_register in mep-tdep.c current_ routines
@ 2007-06-07 20:58 Ulrich Weigand
  0 siblings, 0 replies; only message in thread
From: Ulrich Weigand @ 2007-06-07 20:58 UTC (permalink / raw)
  To: gdb-patches

Hello,

another place in a tdep file where global register state is accessed
in a way that isn't easily eliminable: current_me_module and 
current_options in mep-tdep.c.


To be able to continue elimination of read_register, this patch simply
inlines the definition and reads from current_regcache.  This should
obviously have no change in behaviour.


Bye,
Ulrich


ChangeLog:

	* mep-tdep.c (current_me_module): Read from current regcache
	instead of calling read_register.
	(current_options): Likewise.

diff -urNp gdb-orig/gdb/mep-tdep.c gdb-head/gdb/mep-tdep.c
--- gdb-orig/gdb/mep-tdep.c	2007-06-01 18:21:39.968990155 +0200
+++ gdb-head/gdb/mep-tdep.c	2007-06-01 18:26:33.486246442 +0200
@@ -850,7 +850,12 @@ static CONFIG_ATTR
 current_me_module ()
 {
   if (target_has_registers)
-    return read_register (MEP_MODULE_REGNUM);
+    {
+      ULONGEST regval;
+      regcache_cooked_read_unsigned (current_regcache,
+				     MEP_MODULE_REGNUM, &regval);
+      return regval;
+    }
   else
     return gdbarch_tdep (current_gdbarch)->me_module;
 }
@@ -868,7 +873,12 @@ static unsigned int
 current_options ()
 {
   if (target_has_registers)
-    return read_register (MEP_OPT_REGNUM);
+    {
+      ULONGEST regval;
+      regcache_cooked_read_unsigned (current_regcache,
+				     MEP_OPT_REGNUM, &regval);
+      return regval;
+    }
   else
     return me_module_opt (current_me_module ());
 }
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-07 20:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-07 20:58 [rfc][3/13] Eliminate read_register: read_register in mep-tdep.c current_ routines Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox