From patchwork Mon May 23 14:40:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Batuzov X-Patchwork-Id: 96949 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4D1CAB6F9A for ; Tue, 24 May 2011 00:41:44 +1000 (EST) Received: from localhost ([::1]:47872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOWKD-0001Ms-MG for incoming@patchwork.ozlabs.org; Mon, 23 May 2011 10:41:41 -0400 Received: from eggs.gnu.org ([140.186.70.92]:46075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOWJp-0001M6-BC for qemu-devel@nongnu.org; Mon, 23 May 2011 10:41:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOWJo-0001MR-B3 for qemu-devel@nongnu.org; Mon, 23 May 2011 10:41:17 -0400 Received: from smtp.ispras.ru ([83.149.198.202]:37595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOWJo-0001Lu-2G for qemu-devel@nongnu.org; Mon, 23 May 2011 10:41:16 -0400 Received: from bulbul.intra.ispras.ru (winnie.ispras.ru [83.149.198.236]) by smtp.ispras.ru (Postfix) with ESMTP id 59DD05D40C3; Mon, 23 May 2011 18:37:20 +0400 (MSD) From: Kirill Batuzov To: qemu-devel@nongnu.org Date: Mon, 23 May 2011 18:40:52 +0400 Message-Id: <1306161654-4388-7-git-send-email-batuzovk@ispras.ru> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1306161654-4388-1-git-send-email-batuzovk@ispras.ru> References: <1306161654-4388-1-git-send-email-batuzovk@ispras.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 83.149.198.202 Cc: zhur@ispras.ru Subject: [Qemu-devel] [RFC][PATCH v0 6/8] Spill globals early if their next use is in call. 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Spill globals early if their next use is in call. They'll be spilled anyway in this case. Signed-off-by: Kirill Batuzov --- tcg/tcg.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 8ab556d..ad5bd71 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1297,6 +1297,11 @@ static void tcg_liveness_analysis(TCGContext *s) if (!(call_flags & TCG_CALL_CONST)) { /* globals are live (they may be used by the call) */ memset(dead_temps, 0, s->nb_globals); +#ifdef USE_ADVANCED_REGALLOC + for (i = 0; i < s->nb_globals; i++) { + temp_next_use[i] = op_index; + } +#endif } /* input args are live */ @@ -1393,6 +1398,11 @@ static void tcg_liveness_analysis(TCGContext *s) } else if (def->flags & TCG_OPF_CALL_CLOBBER) { /* globals are live */ memset(dead_temps, 0, s->nb_globals); +#ifdef USE_ADVANCED_REGALLOC + for (i = 0; i < s->nb_globals; i++) { + temp_next_use[i] = op_index; + } +#endif } /* input args are live */ @@ -2190,6 +2200,14 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf, #endif dead_iargs = s->op_dead_iargs[op_index]; tcg_reg_alloc_mov(s, def, args, param_next_use_ptr, dead_iargs); +#ifdef USE_ADVANCED_REGALLOC + if (args[0] < s->nb_globals) { + if (tcg_op_defs[gen_opc_buf[param_next_use_ptr[0]]].flags + & TCG_OPF_CALL_CLOBBER) { + tcg_reg_free(s, s->temps[args[0]].reg); + } + } +#endif break; case INDEX_op_movi_i32: #if TCG_TARGET_REG_BITS == 64