From patchwork Thu Jun 11 14:11:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 7116 X-Patchwork-Delegate: vapier@gentoo.org Received: (qmail 45890 invoked by alias); 11 Jun 2015 14:11:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 45880 invoked by uid 89); 11 Jun 2015 14:11:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 11 Jun 2015 14:11:55 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 01D5E340CD3 for ; Thu, 11 Jun 2015 14:11:52 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: mn10300: delete unused memory code Date: Thu, 11 Jun 2015 10:11:51 -0400 Message-Id: <1434031911-8469-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes Only one place used get_word/put_word, so inline the usage there. All the rest is dead code so trim it. Committed. --- sim/mn10300/ChangeLog | 11 ++++++++++ sim/mn10300/interp.c | 55 +++++++---------------------------------------- sim/mn10300/mn10300_sim.h | 12 ----------- sim/mn10300/op_utils.c | 3 --- 4 files changed, 19 insertions(+), 62 deletions(-) diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog index 7cc0f32..d12997b 100644 --- a/sim/mn10300/ChangeLog +++ b/sim/mn10300/ChangeLog @@ -1,5 +1,16 @@ 2015-06-11 Mike Frysinger + * interp.c (get_byte, get_half, get_word, put_byte, put_half, + put_word): Delete. + (sim_fetch_register): Inline put_word call. + (sim_store_register): Inline get_word call. + * mn10300_sim.h (struct _state): Delete mem member. + (OP, Simops, get_byte, get_half, get_word, put_byte, put_half, + put_word, map): Delete. + * op_utils.c (MEMPTR): Delete. + +2015-06-11 Mike Frysinger + * interp.c (round_64, fpu_status_ok): Add static. 2015-06-11 Mike Frysinger diff --git a/sim/mn10300/interp.c b/sim/mn10300/interp.c index e24cbc5..14344fc 100644 --- a/sim/mn10300/interp.c +++ b/sim/mn10300/interp.c @@ -348,58 +348,18 @@ sim_create_inferior (SIM_DESC sd, /* FIXME These would more efficient to use than load_mem/store_mem, but need to be changed to use the memory map. */ -uint8 -get_byte (uint8 *x) -{ - return *x; -} - -uint16 -get_half (uint8 *x) -{ - uint8 *a = x; - return (a[1] << 8) + (a[0]); -} - -uint32 -get_word (uint8 *x) -{ - uint8 *a = x; - return (a[3]<<24) + (a[2]<<16) + (a[1]<<8) + (a[0]); -} - -void -put_byte (uint8 *addr, uint8 data) -{ - uint8 *a = addr; - a[0] = data; -} - -void -put_half (uint8 *addr, uint16 data) -{ - uint8 *a = addr; - a[0] = data & 0xff; - a[1] = (data >> 8) & 0xff; -} - -void -put_word (uint8 *addr, uint32 data) -{ - uint8 *a = addr; - a[0] = data & 0xff; - a[1] = (data >> 8) & 0xff; - a[2] = (data >> 16) & 0xff; - a[3] = (data >> 24) & 0xff; -} - int sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length) { - put_word (memory, State.regs[rn]); + reg_t reg = State.regs[rn]; + uint8 *a = memory; + a[0] = reg; + a[1] = reg >> 8; + a[2] = reg >> 16; + a[3] = reg >> 24; return length; } @@ -409,7 +369,8 @@ sim_store_register (SIM_DESC sd, unsigned char *memory, int length) { - State.regs[rn] = get_word (memory); + uint8 *a = memory; + State.regs[rn] = (a[3] << 24) + (a[2] << 16) + (a[1] << 8) + a[0]; return length; } diff --git a/sim/mn10300/mn10300_sim.h b/sim/mn10300/mn10300_sim.h index 23b8cc2..f021aee 100644 --- a/sim/mn10300/mn10300_sim.h +++ b/sim/mn10300/mn10300_sim.h @@ -47,7 +47,6 @@ struct _state reg_t fs[32]; /* FS0-31 */ dword fd[16]; /* FD0,2,...,30 */ } fpregs; - uint8 *mem; /* main memory */ /* All internal state modified by signal_exception() that may need to be rolled back for passing moment-of-exception image back to gdb. */ @@ -61,8 +60,6 @@ struct _state }; extern struct _state State; -extern uint32 OP[4]; -extern struct simops Simops[]; #define PC (State.regs[REG_PC]) #define SP (State.regs[REG_SP]) @@ -197,15 +194,6 @@ dw2u64 (dword data) /* Function declarations. */ -uint32 get_word (uint8 *); -uint16 get_half (uint8 *); -uint8 get_byte (uint8 *); -void put_word (uint8 *, uint32); -void put_half (uint8 *, uint16); -void put_byte (uint8 *, uint8); - -extern uint8 *map (SIM_ADDR addr); - INLINE_SIM_MAIN (void) genericAdd (unsigned32 source, unsigned32 destReg); INLINE_SIM_MAIN (void) genericSub (unsigned32 source, unsigned32 destReg); INLINE_SIM_MAIN (void) genericCmp (unsigned32 leftOpnd, unsigned32 rightOpnd); diff --git a/sim/mn10300/op_utils.c b/sim/mn10300/op_utils.c index 518df9b..316cf75 100644 --- a/sim/mn10300/op_utils.c +++ b/sim/mn10300/op_utils.c @@ -188,9 +188,6 @@ do_syscall (void) #define RETVAL State.regs[0] /* return value */ #define RETERR State.regs[1] /* return error code */ -/* Turn a pointer in a register into a pointer into real memory. */ -#define MEMPTR(x) (State.mem + x) - if ( FUNC == TARGET_SYS_exit ) { /* EXIT - caller can look in PARM1 to work out the reason */