From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30876 invoked by alias); 7 Jun 2007 20:58:16 -0000 Received: (qmail 30861 invoked by uid 22791); 7 Jun 2007 20:58:15 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate5.de.ibm.com (HELO mtagate5.de.ibm.com) (195.212.29.154) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 07 Jun 2007 20:58:12 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate5.de.ibm.com (8.13.8/8.13.8) with ESMTP id l57Kw9m8506218 for ; Thu, 7 Jun 2007 20:58:09 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l57Kw9Y74141196 for ; Thu, 7 Jun 2007 22:58:09 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l57Kw9gC019665 for ; Thu, 7 Jun 2007 22:58:09 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id l57Kw9Z6019662 for ; Thu, 7 Jun 2007 22:58:09 +0200 Message-Id: <200706072058.l57Kw9Z6019662@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 7 Jun 2007 22:58:09 +0200 Subject: [rfc][3/13] Eliminate read_register: read_register in mep-tdep.c current_ routines To: gdb-patches@sourceware.org Date: Thu, 07 Jun 2007 20:58:00 -0000 From: "Ulrich Weigand" X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-06/txt/msg00082.txt.bz2 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, ®val); + 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, ®val); + 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