Received: from [140.186.70.92] (port=58524 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pmtji-0001TC-1E for qemu-devel@nongnu.org; Tue, 08 Feb 2011 15:00:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pmtjh-0002eS-2T for qemu-devel@nongnu.org; Tue, 08 Feb 2011 15:00:30 -0500 Received: from mail-ey0-f173.google.com ([209.85.215.173]:57898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pmtjg-0002eK-UL for qemu-devel@nongnu.org; Tue, 08 Feb 2011 15:00:29 -0500 Received: by eyg7 with SMTP id 7so3286248eyg.4 for ; Tue, 08 Feb 2011 12:00:27 -0800 (PST) Date: Tue, 8 Feb 2011 21:00:23 +0100 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] [PATCH 02/17] lm32: translation routines Message-ID: <20110208200023.GB9622@laped.lan> References: <1296433846-18097-1-git-send-email-michael@walle.cc> <1296433846-18097-3-git-send-email-michael@walle.cc> <4D517E49.3080309@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D517E49.3080309@twiddle.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Michael Walle , qemu-devel@nongnu.org, Alexander Graf On Tue, Feb 08, 2011 at 09:32:57AM -0800, Richard Henderson wrote: > On 01/30/2011 04:30 PM, Michael Walle wrote: > > + if (dc->format == OP_FMT_RI) { > > + tcg_gen_brcondi_tl(cond, cpu_R[rY], sign_extend(dc->imm16, 16), l1); > > + } else { > > + tcg_gen_brcond_tl(cond, cpu_R[rY], cpu_R[rZ], l1); > > + } > > + tcg_gen_movi_tl(cpu_R[rX], 0); > > + tcg_gen_br(l2); > > + gen_set_label(l1); > > + tcg_gen_movi_tl(cpu_R[rX], 1); > > + gen_set_label(l2); > > This is tcg_gen_setcond_tl. > > BTW, why the extensive extra LOG_DIS code? Why not just run the regular > disassembler, like other ports? FWIW, I used the same macros in the CRIS & MicroBlaze translators because I found using the translators decoding useful to compare with the regular disassembler's when looking for decoding errors. Also, some times I used the translators disasm because it is faster (it doesn't have to decode the insns twice), although not as readable. It was a while ago though... > > + if (!(dc->env->features & LM32_FEATURE_MULTIPLY)) { > > + cpu_abort(dc->env, "hardware multiplier is not available\n"); > > + } > > Aborting the VM, rather than raising an exception? > > > + tcg_gen_xor_tl(cpu_R[dc->r2], cpu_R[dc->r0], cpu_R[dc->r1]); > > + tcg_gen_not_tl(cpu_R[dc->r2], cpu_R[dc->r2]); > > This is tcg_gen_eqv_tl. > > > + /* Large switch for all insns. */ > > + for (i = 0; i < ARRAY_SIZE(decinfo); i++) { > > + if ((dc->opcode & decinfo[i].mask) == decinfo[i].bits) { > > + decinfo[i].dec(dc); > > + break; > > + } > > + } > > +} > > No check that *some* opcode matched? It would seem like a "return" > here instead of a break, and then an illegal opcode exception after > the loop would be in order. Good catch! Other ports using the same decoding approach have a "match all" entry in the decinfo table to catch illegal insns.. Cheers