From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LB9ev-0007nM-Vt for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LB9eq-0007fI-Dz for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:25 -0500 Received: from [199.232.76.173] (port=50396 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LB9ep-0007eZ-A1 for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:23 -0500 Received: from mx2.redhat.com ([66.187.237.31]:33024) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LB9eo-0001fR-FC for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:22 -0500 From: Eduardo Habkost Date: Fri, 12 Dec 2008 13:09:09 -0200 Message-Id: <1229094550-2022-31-git-send-email-ehabkost@redhat.com> In-Reply-To: <1229094550-2022-1-git-send-email-ehabkost@redhat.com> References: <1229094550-2022-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 30/31] target-alpha/translate.c: LOG_DISAS macro Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eduardo Habkost Create a LOG_DISAS macro and use it instead of #ifdef ALPHA_DEBUG_DISAS. Signed-off-by: Eduardo Habkost --- target-alpha/translate.c | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) diff --git a/target-alpha/translate.c b/target-alpha/translate.c index 7e8e644..520e816 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -37,6 +37,16 @@ #define ALPHA_DEBUG_DISAS /* #define DO_TB_FLUSH */ + +#ifdef ALPHA_DEBUG_DISAS +# define LOG_DISAS(...) do { \ + if (logfile) \ + fprintf(logfile, ## __VA_ARGS__); \ + } while (0) +#else +# define LOG_DISAS(...) do { } while (0) +#endif + typedef struct DisasContext DisasContext; struct DisasContext { uint64_t pc; @@ -671,12 +681,8 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn) fn7 = (insn >> 5) & 0x0000007F; fn2 = (insn >> 5) & 0x00000003; ret = 0; -#if defined ALPHA_DEBUG_DISAS - if (logfile != NULL) { - fprintf(logfile, "opc %02x ra %d rb %d rc %d disp16 %04x\n", - opc, ra, rb, rc, disp16); - } -#endif + LOG_DISAS("opc %02x ra %d rb %d rc %d disp16 %04x\n", + opc, ra, rb, rc, disp16); switch (opc) { case 0x00: /* CALL_PAL */ @@ -2386,17 +2392,13 @@ static always_inline void gen_intermediate_code_internal (CPUState *env, gen_io_start(); #if defined ALPHA_DEBUG_DISAS insn_count++; - if (logfile != NULL) { - fprintf(logfile, "pc " TARGET_FMT_lx " mem_idx %d\n", - ctx.pc, ctx.mem_idx); - } + LOG_DISAS("pc " TARGET_FMT_lx " mem_idx %d\n", + ctx.pc, ctx.mem_idx); #endif insn = ldl_code(ctx.pc); #if defined ALPHA_DEBUG_DISAS insn_count++; - if (logfile != NULL) { - fprintf(logfile, "opcode %08x %d\n", insn, insn_count); - } + LOG_DISAS("opcode %08x %d\n", insn, insn_count); #endif num_insns++; ctx.pc += 4; -- 1.5.5.GIT