From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LB9ew-0007nD-2T for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:31 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LB9eo-0007dp-Mj for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:25 -0500 Received: from [199.232.76.173] (port=50392 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LB9eo-0007dN-Ca for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:22 -0500 Received: from mx2.redhat.com ([66.187.237.31]:33019) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LB9en-0001eu-La for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:22 -0500 From: Eduardo Habkost Date: Fri, 12 Dec 2008 13:08:57 -0200 Message-Id: <1229094550-2022-19-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 18/31] target-mips/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 MIPS_DEBUG_DISAS. Signed-off-by: Eduardo Habkost --- target-mips/translate.c | 116 +++++++++-------------------------------------- 1 files changed, 22 insertions(+), 94 deletions(-) diff --git a/target-mips/translate.c b/target-mips/translate.c index 418b9ef..b6a9fa3 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -521,8 +521,14 @@ do { \ ctx->pc, ctx->opcode , ##args); \ } \ } while (0) +#define LOG_DISAS(...) \ + do { \ + if (loglevel & CPU_LOG_TB_IN_ASM) \ + fprintf(logfile, ## __VA_ARGS__); \ + } while (0) #else #define MIPS_DEBUG(fmt, args...) do { } while(0) +#define LOG_DISAS(...) do { } while (0) #endif #define MIPS_INVAL(op) \ @@ -758,12 +764,7 @@ static inline void gen_save_pc(target_ulong pc) static inline void save_cpu_state (DisasContext *ctx, int do_save_pc) { -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "hflags %08x saved %08x\n", - ctx->hflags, ctx->saved_hflags); - } -#endif + LOG_DISAS("hflags %08x saved %08x\n", ctx->hflags, ctx->saved_hflags); if (do_save_pc && ctx->pc != ctx->saved_pc) { gen_save_pc(ctx->pc); ctx->saved_pc = ctx->pc; @@ -2318,13 +2319,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, TCGv t1 = tcg_temp_local_new(); if (ctx->hflags & MIPS_HFLAG_BMASK) { -#ifdef MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, - "Branch in delay slot at PC 0x" TARGET_FMT_lx "\n", - ctx->pc); - } -#endif + LOG_DISAS("Branch in delay slot at PC 0x" TARGET_FMT_lx "\n", ctx->pc); generate_exception(ctx, EXCP_RI); goto out; } @@ -3300,21 +3295,11 @@ static void gen_mfc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int se default: goto die; } -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "mfc0 %s (reg %d sel %d)\n", - rn, reg, sel); - } -#endif + LOG_DISAS("mfc0 %s (reg %d sel %d)\n", rn, reg, sel); return; die: -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "mfc0 %s (reg %d sel %d)\n", - rn, reg, sel); - } -#endif + LOG_DISAS("mfc0 %s (reg %d sel %d)\n", rn, reg, sel); generate_exception(ctx, EXCP_RI); } @@ -3904,12 +3889,7 @@ static void gen_mtc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int se default: goto die; } -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "mtc0 %s (reg %d sel %d)\n", - rn, reg, sel); - } -#endif + LOG_DISAS("mtc0 %s (reg %d sel %d)\n", rn, reg, sel); /* For simplicity assume that all writes can cause interrupts. */ if (use_icount) { gen_io_end(); @@ -3918,12 +3898,7 @@ static void gen_mtc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int se return; die: -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "mtc0 %s (reg %d sel %d)\n", - rn, reg, sel); - } -#endif + LOG_DISAS("mtc0 %s (reg %d sel %d)\n", rn, reg, sel); generate_exception(ctx, EXCP_RI); } @@ -4486,21 +4461,11 @@ static void gen_dmfc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int s default: goto die; } -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "dmfc0 %s (reg %d sel %d)\n", - rn, reg, sel); - } -#endif + LOG_DISAS("dmfc0 %s (reg %d sel %d)\n", rn, reg, sel); return; die: -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "dmfc0 %s (reg %d sel %d)\n", - rn, reg, sel); - } -#endif + LOG_DISAS("dmfc0 %s (reg %d sel %d)\n", rn, reg, sel); generate_exception(ctx, EXCP_RI); } @@ -5077,12 +5042,7 @@ static void gen_dmtc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int s default: goto die; } -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "dmtc0 %s (reg %d sel %d)\n", - rn, reg, sel); - } -#endif + LOG_DISAS("dmtc0 %s (reg %d sel %d)\n", rn, reg, sel); /* For simplicity assume that all writes can cause interrupts. */ if (use_icount) { gen_io_end(); @@ -5091,12 +5051,7 @@ static void gen_dmtc0 (CPUState *env, DisasContext *ctx, TCGv t0, int reg, int s return; die: -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "dmtc0 %s (reg %d sel %d)\n", - rn, reg, sel); - } -#endif + LOG_DISAS("dmtc0 %s (reg %d sel %d)\n", rn, reg, sel); generate_exception(ctx, EXCP_RI); } #endif /* TARGET_MIPS64 */ @@ -5254,24 +5209,14 @@ static void gen_mftr(CPUState *env, DisasContext *ctx, int rt, int rd, default: goto die; } -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "mftr (reg %d u %d sel %d h %d)\n", - rt, u, sel, h); - } -#endif + LOG_DISAS("mftr (reg %d u %d sel %d h %d)\n", rt, u, sel, h); gen_store_gpr(t0, rd); tcg_temp_free(t0); return; die: tcg_temp_free(t0); -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "mftr (reg %d u %d sel %d h %d)\n", - rt, u, sel, h); - } -#endif + LOG_DISAS("mftr (reg %d u %d sel %d h %d)\n", rt, u, sel, h); generate_exception(ctx, EXCP_RI); } @@ -5429,23 +5374,13 @@ static void gen_mttr(CPUState *env, DisasContext *ctx, int rd, int rt, default: goto die; } -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "mttr (reg %d u %d sel %d h %d)\n", - rd, u, sel, h); - } -#endif + LOG_DISAS("mttr (reg %d u %d sel %d h %d)\n", rd, u, sel, h); tcg_temp_free(t0); return; die: tcg_temp_free(t0); -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) { - fprintf(logfile, "mttr (reg %d u %d sel %d h %d)\n", - rd, u, sel, h); - } -#endif + LOG_DISAS("mttr (reg %d u %d sel %d h %d)\n", rd, u, sel, h); generate_exception(ctx, EXCP_RI); } @@ -8279,11 +8214,7 @@ gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, cpu_dump_state(env, logfile, fprintf, 0); } #endif -#ifdef MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) - fprintf(logfile, "\ntb %p idx %d hflags %04x\n", - tb, ctx.mem_idx, ctx.hflags); -#endif + LOG_DISAS("\ntb %p idx %d hflags %04x\n", tb, ctx.mem_idx, ctx.hflags); gen_icount_start(); while (ctx.bstate == BS_NONE) { if (unlikely(!TAILQ_EMPTY(&env->breakpoints))) { @@ -8371,10 +8302,7 @@ done_generating: tb->icount = num_insns; } #ifdef DEBUG_DISAS -#if defined MIPS_DEBUG_DISAS - if (loglevel & CPU_LOG_TB_IN_ASM) - fprintf(logfile, "\n"); -#endif + LOG_DISAS("\n"); if (loglevel & CPU_LOG_TB_IN_ASM) { fprintf(logfile, "IN: %s\n", lookup_symbol(pc_start)); target_disas(logfile, pc_start, ctx.pc - pc_start, 0); -- 1.5.5.GIT