From patchwork Fri Jun 24 03:48:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 639998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rbPfT5VcLz9sDG for ; Fri, 24 Jun 2016 13:57:05 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=hBLAm2b9; dkim-atps=neutral Received: from localhost ([::1]:40594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGIEp-000763-C6 for incoming@patchwork.ozlabs.org; Thu, 23 Jun 2016 23:57:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGI6k-0007aW-1X for qemu-devel@nongnu.org; Thu, 23 Jun 2016 23:48:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGI6d-0001oS-3S for qemu-devel@nongnu.org; Thu, 23 Jun 2016 23:48:41 -0400 Received: from mail-pa0-x242.google.com ([2607:f8b0:400e:c03::242]:35616) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGI6c-0001oO-Oh for qemu-devel@nongnu.org; Thu, 23 Jun 2016 23:48:35 -0400 Received: by mail-pa0-x242.google.com with SMTP id hf6so7895204pac.2 for ; Thu, 23 Jun 2016 20:48:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=1KIo6Vwpuwr0BxNN5EV+Ls0lAwrJeUydnapno0Qt/T0=; b=hBLAm2b9E3oh/d8gSj1hhbbukJf5GhgzZFvUxy+cOURPWMDsKBQsj1e5RY4H5WCVUF MctBN3v26I5DWgyno8aDNYuQ5X178CsuebhGghupWn54uZCyq/unwopCD0lu3oh0yT30 Mf8RrQrVjaDAh6VakmyjdFrjBEBM4n1wqlf6bBAZwyFU/ADi/giEBXH7h2Ol/bg0ElMh SibXhNZnD6JMykCvDMgS0auQKkujAcP6q4BxZJZLFZppRmeMPPC1seGGfyoVGlq+ZHdL 6CVO0aAyCN3m2JBkXRXDbEo++ibmlClYJoKUxb9F9cW/0YH17dpYHJDbmuirGPNbf2Pw bYjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=1KIo6Vwpuwr0BxNN5EV+Ls0lAwrJeUydnapno0Qt/T0=; b=kXn5Z6NHPDGUnNZm0tjzkrsmRb2AIPLJHcDqD6IJXGvQnIK64Fk6DOXI+0Wa1R2Bc/ P81MRu4XSXtd7GKvbUFwQgr4pMA+xQZom1ydL9iZQQEUuMA8+uFNXaxwPDmfrn3OA+mH 11Z9fBdmqFYveA8DmucXcp3+GxW03JY07jTnqQ4bf1FldbNzaAHGtZwqq5PCZ5/lC3eX 9Ww0rjP9VsU2Xbkqrzl3LHrZ03JXG01p+ztIusqWJ/SUNZuZCd3lO3mBPKoGf6fHRBZj q5Q/1dp1/c0Cx0/PjxupHEBmfDpZ5QSpfbTghEL4D4b4PC+Nd+xjA5PNus5HVxDoqjVi kamw== X-Gm-Message-State: ALyK8tLBtCVenTA8e+f/AtjacZd+0TnCCGbrxxfPzftw7QPwyE5zZgzRQXAk/V/tqMWipQ== X-Received: by 10.66.160.41 with SMTP id xh9mr3606268pab.85.1466740113993; Thu, 23 Jun 2016 20:48:33 -0700 (PDT) Received: from pike.twiddle.net (71-37-54-227.tukw.qwest.net. [71.37.54.227]) by smtp.gmail.com with ESMTPSA id p129sm3309134pfb.73.2016.06.23.20.48.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jun 2016 20:48:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 23 Jun 2016 20:48:24 -0700 Message-Id: <1466740107-15042-7-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466740107-15042-1-git-send-email-rth@twiddle.net> References: <1466740107-15042-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::242 Subject: [Qemu-devel] [PATCH v3 6/9] tcg: Fold life data into TCGOp X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.cave-ayland@ilande.co.uk, atar4qemu@gmail.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Reduce the size of other bitfields to make room. This reduces the cache footprint of compilation. Signed-off-by: Richard Henderson Reviewed-by: Aurelien Jarno --- 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 bb1efe2..c41640f 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1327,10 +1327,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); @@ -1553,7 +1550,7 @@ static void tcg_liveness_analysis(TCGContext *s) } break; } - s->op_arg_life[oi] = arg_life; + op->life = arg_life; } } @@ -2377,7 +2374,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 49b396d..2ff3ad2 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -513,25 +513,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 prex/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 prex/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); @@ -549,9 +554,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;