diff mbox

[v3,8/9] tcg: Include liveness info in the dumps

Message ID 1466740107-15042-9-git-send-email-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson June 24, 2016, 3:48 a.m. UTC
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/tcg.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

Aurelien Jarno July 25, 2016, 3:15 p.m. UTC | #1
On 2016-06-23 20:48, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  tcg/tcg.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Aurelien Jarno July 25, 2016, 4:16 p.m. UTC | #2
On 2016-06-23 20:48, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  tcg/tcg.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index fd92b06..3e4bc99 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -1009,6 +1009,7 @@ void tcg_dump_ops(TCGContext *s)
>          const TCGOpDef *def;
>          const TCGArg *args;
>          TCGOpcode c;
> +        long pos = ftell(qemu_logfile);
>  

Small additional note: ftell() doesn't work well when the logfile is the
terminal. As such when not dumping to the file, the alignment is wrong.
diff mbox

Patch

diff --git a/tcg/tcg.c b/tcg/tcg.c
index fd92b06..3e4bc99 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1009,6 +1009,7 @@  void tcg_dump_ops(TCGContext *s)
         const TCGOpDef *def;
         const TCGArg *args;
         TCGOpcode c;
+        long pos = ftell(qemu_logfile);
 
         op = &s->gen_op_buf[oi];
         c = op->opc;
@@ -1133,6 +1134,31 @@  void tcg_dump_ops(TCGContext *s)
                 qemu_log("%s$0x%" TCG_PRIlx, k ? "," : "", args[k]);
             }
         }
+        if (op->life) {
+            unsigned life = op->life;
+
+            for (i = ftell(qemu_logfile) - pos; i < 48; ++i) {
+                putc(' ', qemu_logfile);
+            }
+
+            if (life & (SYNC_ARG * 3)) {
+                qemu_log("  sync:");
+                for (i = 0; i < 2; ++i) {
+                    if (life & (SYNC_ARG << i)) {
+                        qemu_log(" %d", i);
+                    }
+                }
+            }
+            life /= DEAD_ARG;
+            if (life) {
+                qemu_log("  dead:");
+                for (i = 0; life; ++i, life >>= 1) {
+                    if (life & 1) {
+                        qemu_log(" %d", i);
+                    }
+                }
+            }
+        }
         qemu_log("\n");
     }
 }