qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 28/31] target-ppc/translate.c: LOG_DISAS macro


From: Eduardo Habkost
Subject: [Qemu-devel] [PATCH 28/31] target-ppc/translate.c: LOG_DISAS macro
Date: Fri, 12 Dec 2008 13:09:07 -0200

Create a LOG_DISAS macro and use it instead of #ifdef PPC_DEBUG_DISAS.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 target-ppc/translate.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 848cdf0..a5a3752 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -43,6 +43,14 @@
 //#define DO_PPC_STATISTICS
 //#define OPTIMIZE_FPRF_UPDATE
 
+#ifdef PPC_DEBUG_DISAS
+#  define LOG_DISAS(...) do {            \
+     if (loglevel & CPU_LOG_TB_IN_ASM)   \
+       fprintf(logfile, ## __VA_ARGS__); \
+   } while (0)
+#else
+#  define LOG_DISAS(...) do { } while (0)
+#endif
 /*****************************************************************************/
 /* Code translation helpers                                                  */
 
@@ -7784,13 +7792,9 @@ static always_inline void gen_intermediate_code_internal 
(CPUState *env,
                 gen_opc_icount[lj] = num_insns;
             }
         }
-#if defined PPC_DEBUG_DISAS
-        if (loglevel & CPU_LOG_TB_IN_ASM) {
-            fprintf(logfile, "----------------\n");
-            fprintf(logfile, "nip=" ADDRX " super=%d ir=%d\n",
-                    ctx.nip, ctx.mem_idx, (int)msr_ir);
-        }
-#endif
+        LOG_DISAS("----------------\n");
+        LOG_DISAS("nip=" ADDRX " super=%d ir=%d\n",
+                  ctx.nip, ctx.mem_idx, (int)msr_ir);
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
             gen_io_start();
         if (unlikely(ctx.le_mode)) {
@@ -7798,13 +7802,9 @@ static always_inline void gen_intermediate_code_internal 
(CPUState *env,
         } else {
             ctx.opcode = ldl_code(ctx.nip);
         }
-#if defined PPC_DEBUG_DISAS
-        if (loglevel & CPU_LOG_TB_IN_ASM) {
-            fprintf(logfile, "translate opcode %08x (%02x %02x %02x) (%s)\n",
+        LOG_DISAS("translate opcode %08x (%02x %02x %02x) (%s)\n",
                     ctx.opcode, opc1(ctx.opcode), opc2(ctx.opcode),
                     opc3(ctx.opcode), little_endian ? "little" : "big");
-        }
-#endif
         ctx.nip += 4;
         table = env->opcodes;
         num_insns++;
-- 
1.5.5.GIT





reply via email to

[Prev in Thread] Current Thread [Next in Thread]