From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29659 invoked by alias); 3 May 2010 15:58:26 -0000 Received: (qmail 29650 invoked by uid 22791); 3 May 2010 15:58:25 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 03 May 2010 15:58:21 +0000 Received: (qmail 5027 invoked from network); 3 May 2010 15:58:19 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 3 May 2010 15:58:19 -0000 Date: Mon, 03 May 2010 15:58:00 -0000 From: Daniel Jacobowitz To: xingxing pan Cc: gdb@sourceware.org Subject: Re: In the NONSTOP implementation why dose gdb use register r0 and r1 as temp registers for rn and rd ? Message-ID: <20100503155813.GA12698@caradoc.them.org> Mail-Followup-To: xingxing pan , gdb@sourceware.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-05/txt/msg00003.txt.bz2 On Mon, May 03, 2010 at 01:27:53PM +0800, xingxing pan wrote: > hey guys, I'm porting NONSTOP to an ARM similar architechure. I found > the following comments in the source. > > Instruction is of form: > rd, [rn,] #imm > Rewrite as: > Preparation: > tmp1, tmp2 <- r0,r1 > r0,r1 <- rd,rn > Insn: r0,r1 #imm > Cleanup: rd <- r0; r0<-tmp1;r1<-tmp2 > > why dose gdb use register r0 and r1? why not use rd and rn directly? > Thank you! It was simpler to always use the same registers. That way you don't have to worry about, for instance, which registers to save and restore or whether rd and rn overlap. You could do it either way. -- Daniel Jacobowitz CodeSourcery