This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[rfc][3/13] Eliminate read_register: read_register in mep-tdep.c current_ routines


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]