From patchwork Sat Feb 6 00:09:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 8240731 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3D107BEEE5 for ; Sat, 6 Feb 2016 00:15:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7EF78203B4 for ; Sat, 6 Feb 2016 00:15:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3AFB203B1 for ; Sat, 6 Feb 2016 00:15:30 +0000 (UTC) Received: from localhost ([::1]:51016 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRqXB-0008Kj-T2 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 05 Feb 2016 19:15:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRqSK-00089i-K3 for qemu-devel@nongnu.org; Fri, 05 Feb 2016 19:10:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRqSJ-0006ua-Hw for qemu-devel@nongnu.org; Fri, 05 Feb 2016 19:10:28 -0500 Received: from mail-qg0-x22d.google.com ([2607:f8b0:400d:c04::22d]:35659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRqSJ-0006uW-CM for qemu-devel@nongnu.org; Fri, 05 Feb 2016 19:10:27 -0500 Received: by mail-qg0-x22d.google.com with SMTP id y89so7204050qge.2 for ; Fri, 05 Feb 2016 16:10:27 -0800 (PST) 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=9LthYJyGpGxSLPjiFLR02bGa92TegvTNoo+J9v7Buhw=; b=W75jXaiw47k3cShoHh9/P7yj3n533LoJPDZXTeb6Hby4umBPMAP8UA/+050SNcozQw GpfGs+IFhhSXEgPtmf+2ITYMaRM6JJOYyhhMTH/F8wTgQe9fR1UHOA/56Qffbp54D/2Q Yu95GFc+VOxLc1od83LxCl8RNWqmQQe5IlY2rMgqnuY+gkgoRA3HSwFN25r2p1SJ66Qo lsHbu1gs/m1VJUdPTQZKKoFwxlU/orI1ZFwwUf840bhhWomjm8SBNiEuaJz+qQ7jpT25 lQ59gK+JAnSPpTbjZ0TR+S6E7VUrxfbP4+Z9aDTo+r1QIaCYyMn2tz3PNWgE0x/nMxaE UXaQ== 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=9LthYJyGpGxSLPjiFLR02bGa92TegvTNoo+J9v7Buhw=; b=gJsVpkVc6QY4AgjZCnQITzJ2ScOmUnws2eYFdX3mNNmQ+CxABrDbqgM+xwm06FjUtx NiycrWkvK2M7XvQFsHghIQ8sQLPANSc6VOm3qQwOiluz4GbmGTZwLpeh9yTonHW5Zefm 5Mp5izNiHzg2UZ0Q2vKF+XFY0H39YwWBxOWnEcnGbO7hTCNXCte61ZoTihu3wd23uqD7 BwgJ/kpMXlzU+fnFET8GqtjYUhE9jIx+FIFzEVthbd7jqUOZJg5Q6WvNeIEtvgNf5G5f 6a35P1aov44cQ2pfXRercCQ9Q0zdu8ebE7ExeTgmRO98Kk6aglqM1fOkPze2nZPNUTYc /qyg== X-Gm-Message-State: AG10YORDuSGZBtkY7IrILRLeIOhV2M+Wid7UDkqHcaNThvt2MaDGjp/JyxsK9ptt77tIIg== X-Received: by 10.140.242.16 with SMTP id n16mr21751995qhc.2.1454717427102; Fri, 05 Feb 2016 16:10:27 -0800 (PST) Received: from bigtime.com ([1.129.57.172]) by smtp.gmail.com with ESMTPSA id w66sm9079564qhc.15.2016.02.05.16.10.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Feb 2016 16:10:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 6 Feb 2016 11:09:28 +1100 Message-Id: <1454717370-17516-11-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454717370-17516-1-git-send-email-rth@twiddle.net> References: <1454717370-17516-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:400d:c04::22d Cc: peter.maydell@linaro.org Subject: [Qemu-devel] [PULL 10/12] tcg: Change temp_sync argument to TCGTemp X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Aurelien Jarno Signed-off-by: Richard Henderson --- tcg/tcg.c | 55 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index bd3707b..ee3e9dd 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1722,29 +1722,28 @@ static inline void temp_dead(TCGContext *s, TCGTemp *ts) /* sync a temporary to memory. 'allocated_regs' is used in case a temporary registers needs to be allocated to store a constant. */ -static inline void temp_sync(TCGContext *s, int temp, TCGRegSet allocated_regs) +static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs) { - TCGTemp *ts = &s->temps[temp]; - - if (!ts->fixed_reg) { - switch(ts->val_type) { - case TEMP_VAL_CONST: - ts->reg = tcg_reg_alloc(s, tcg_target_available_regs[ts->type], - allocated_regs); - ts->val_type = TEMP_VAL_REG; - s->reg_to_temp[ts->reg] = ts; - ts->mem_coherent = 0; - tcg_out_movi(s, ts->type, ts->reg, ts->val); - /* fallthrough*/ - case TEMP_VAL_REG: - tcg_reg_sync(s, ts->reg); - break; - case TEMP_VAL_DEAD: - case TEMP_VAL_MEM: - break; - default: - tcg_abort(); - } + if (ts->fixed_reg) { + return; + } + switch (ts->val_type) { + case TEMP_VAL_CONST: + ts->reg = tcg_reg_alloc(s, tcg_target_available_regs[ts->type], + allocated_regs); + ts->val_type = TEMP_VAL_REG; + s->reg_to_temp[ts->reg] = ts; + ts->mem_coherent = 0; + tcg_out_movi(s, ts->type, ts->reg, ts->val); + /* fallthrough*/ + case TEMP_VAL_REG: + tcg_reg_sync(s, ts->reg); + break; + case TEMP_VAL_DEAD: + case TEMP_VAL_MEM: + break; + default: + tcg_abort(); } } @@ -1759,7 +1758,7 @@ static inline void temp_save(TCGContext *s, int temp, TCGRegSet allocated_regs) in memory. Keep an assert for safety. */ tcg_debug_assert(ts->val_type == TEMP_VAL_MEM || ts->fixed_reg); #else - temp_sync(s, temp, allocated_regs); + temp_sync(s, ts, allocated_regs); temp_dead(s, ts); #endif } @@ -1784,11 +1783,13 @@ static void sync_globals(TCGContext *s, TCGRegSet allocated_regs) int i; for (i = 0; i < s->nb_globals; i++) { + TCGTemp *ts = &s->temps[i]; #ifdef USE_LIVENESS_ANALYSIS - assert(s->temps[i].val_type != TEMP_VAL_REG || s->temps[i].fixed_reg || - s->temps[i].mem_coherent); + tcg_debug_assert(ts->val_type != TEMP_VAL_REG + || ts->fixed_reg + || ts->mem_coherent); #else - temp_sync(s, i, allocated_regs); + temp_sync(s, ts, allocated_regs); #endif } } @@ -1843,7 +1844,7 @@ static void tcg_reg_alloc_movi(TCGContext *s, const TCGArg *args, ots->val = val; } if (NEED_SYNC_ARG(0)) { - temp_sync(s, args[0], s->reserved_regs); + temp_sync(s, ots, s->reserved_regs); } if (IS_DEAD_ARG(0)) { temp_dead(s, ots);