qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PULL 3/7] tcg: Fold life data into TCGOp
Date: Sat,  6 Aug 2016 07:17:50 +0530	[thread overview]
Message-ID: <1470448074-20473-4-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1470448074-20473-1-git-send-email-rth@twiddle.net>

Reduce the size of other bitfields to make room.
This reduces the cache footprint of compilation.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/tcg.c |  9 +++------
 tcg/tcg.h | 26 ++++++++++++++------------
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/tcg/tcg.c b/tcg/tcg.c
index cd76e42..6bcf6e5 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1342,10 +1342,7 @@ static inline void tcg_la_bb_end(TCGContext *s, uint8_t *dead_temps,
 static void tcg_liveness_analysis(TCGContext *s)
 {
     uint8_t *dead_temps, *mem_temps;
-    int oi, oi_prev, nb_ops;
-
-    nb_ops = s->gen_next_op_idx;
-    s->op_arg_life = tcg_malloc(nb_ops * sizeof(TCGLifeData));
+    int oi, oi_prev;
 
     dead_temps = tcg_malloc(s->nb_temps);
     mem_temps = tcg_malloc(s->nb_temps);
@@ -1568,7 +1565,7 @@ static void tcg_liveness_analysis(TCGContext *s)
             }
             break;
         }
-        s->op_arg_life[oi] = arg_life;
+        op->life = arg_life;
     }
 }
 #else
@@ -2410,7 +2407,7 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)
         TCGArg * const args = &s->gen_opparam_buf[op->args];
         TCGOpcode opc = op->opc;
         const TCGOpDef *def = &tcg_op_defs[opc];
-        TCGLifeData arg_life = s->op_arg_life[oi];
+        TCGLifeData arg_life = op->life;
 
         oi_next = op->next;
 #ifdef CONFIG_PROFILER
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 007d7bc..ebf6867 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -583,25 +583,30 @@ typedef struct TCGTempSet {
 #define SYNC_ARG  1
 typedef uint16_t TCGLifeData;
 
+/* The layout here is designed to avoid crossing of a 32-bit boundary.
+   If we do so, gcc adds padding, expanding the size to 12.  */
 typedef struct TCGOp {
-    TCGOpcode opc   : 8;
+    TCGOpcode opc   : 8;        /*  8 */
+
+    /* Index of the prev/next op, or 0 for the end of the list.  */
+    unsigned prev   : 10;       /* 18 */
+    unsigned next   : 10;       /* 28 */
 
     /* The number of out and in parameter for a call.  */
-    unsigned callo  : 2;
-    unsigned calli  : 6;
+    unsigned calli  : 4;        /* 32 */
+    unsigned callo  : 2;        /* 34 */
 
     /* Index of the arguments for this op, or 0 for zero-operand ops.  */
-    unsigned args   : 16;
+    unsigned args   : 14;       /* 48 */
 
-    /* Index of the prev/next op, or 0 for the end of the list.  */
-    unsigned prev   : 16;
-    unsigned next   : 16;
+    /* Lifetime data of the operands.  */
+    unsigned life   : 16;       /* 64 */
 } TCGOp;
 
 /* Make sure operands fit in the bitfields above.  */
 QEMU_BUILD_BUG_ON(NB_OPS > (1 << 8));
-QEMU_BUILD_BUG_ON(OPC_BUF_SIZE > (1 << 16));
-QEMU_BUILD_BUG_ON(OPPARAM_BUF_SIZE > (1 << 16));
+QEMU_BUILD_BUG_ON(OPC_BUF_SIZE > (1 << 10));
+QEMU_BUILD_BUG_ON(OPPARAM_BUF_SIZE > (1 << 14));
 
 /* Make sure that we don't overflow 64 bits without noticing.  */
 QEMU_BUILD_BUG_ON(sizeof(TCGOp) > 8);
@@ -619,9 +624,6 @@ struct TCGContext {
     uint16_t *tb_jmp_insn_offset; /* tb->jmp_insn_offset if USE_DIRECT_JUMP */
     uintptr_t *tb_jmp_target_addr; /* tb->jmp_target_addr if !USE_DIRECT_JUMP */
 
-    /* liveness analysis */
-    TCGLifeData *op_arg_life;
-
     TCGRegSet reserved_regs;
     intptr_t current_frame_offset;
     intptr_t frame_start;
-- 
2.7.4

  parent reply	other threads:[~2016-08-06  1:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-06  1:47 [Qemu-devel] [PULL for-2.7 0/7] tcg: fix indirect register lowering Richard Henderson
2016-08-06  1:47 ` [Qemu-devel] [PULL 1/7] tcg: Compress liveness data to 16 bits Richard Henderson
2016-08-06  1:47 ` [Qemu-devel] [PULL 2/7] tcg: Reorg TCGOp chaining Richard Henderson
2016-08-06  1:47 ` Richard Henderson [this message]
2016-08-06  1:47 ` [Qemu-devel] [PULL 4/7] tcg: Compress dead_temps and mem_temps into a single array Richard Henderson
2016-08-06  1:47 ` [Qemu-devel] [PULL 5/7] tcg: Include liveness info in the dumps Richard Henderson
2016-08-06  1:47 ` [Qemu-devel] [PULL 6/7] tcg: Require liveness analysis Richard Henderson
2016-08-06  1:47 ` [Qemu-devel] [PULL 7/7] tcg: Lower indirect registers in a separate pass Richard Henderson
2016-08-08 10:31 ` [Qemu-devel] [PULL for-2.7 0/7] tcg: fix indirect register lowering Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470448074-20473-4-git-send-email-rth@twiddle.net \
    --to=rth@twiddle.net \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).