From patchwork Mon Aug 5 18:28:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 264738 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5EFF32C0040 for ; Tue, 6 Aug 2013 04:30:23 +1000 (EST) Received: from localhost ([::1]:48642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6PXu-0003li-Ld for incoming@patchwork.ozlabs.org; Mon, 05 Aug 2013 14:30:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6PXF-0003hg-HW for qemu-devel@nongnu.org; Mon, 05 Aug 2013 14:29:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6PX9-0001AW-Ig for qemu-devel@nongnu.org; Mon, 05 Aug 2013 14:29:37 -0400 Received: from mail-qc0-x234.google.com ([2607:f8b0:400d:c01::234]:53613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6PX9-0001AR-Eq for qemu-devel@nongnu.org; Mon, 05 Aug 2013 14:29:31 -0400 Received: by mail-qc0-f180.google.com with SMTP id j10so1860748qcx.25 for ; Mon, 05 Aug 2013 11:29:31 -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:x-mailer:in-reply-to :references; bh=VjXV7EOXjK5Ap14qj+PcZ0juvTjtnrVlwuJj3s5KUy8=; b=H1lcWF0rp5mwKozG2GR+s8t8wW8+HIPF7gsRGlca+L+D/vW0DoPaIa9rrU8DaW8Fbq W+NxDtU6dn9eoqLrjgbfmzxK/XwwSeeWHcv4B3zikjPYEg670khnXiZ6A4xPkfNkDlPO ILwkUAKTqNPWBM/m43CQglKLIzbacz3IhqYiJWcqDImd0a6Cqgp8+2ZGs0O/fER5Tz00 axh2/LdqmOVga/vbukqrATNdlZXeNzBHDEvEUSmoDO5y6RS0fAo06j94KmYFaCRVB0VC csbw75/iK5M8WbTaYBEap59Pa1KVJ22cS3YaS4GbMbLc748ucP6q0f7GJwe+HteSaoAC F02g== X-Received: by 10.229.99.193 with SMTP id v1mr6667911qcn.32.1375727371154; Mon, 05 Aug 2013 11:29:31 -0700 (PDT) Received: from pebble.com (cpe-66-91-180-52.hawaii.res.rr.com. [66.91.180.52]) by mx.google.com with ESMTPSA id n8sm574544qez.2.2013.08.05.11.29.29 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 05 Aug 2013 11:29:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 5 Aug 2013 08:28:37 -1000 Message-Id: <1375727330-30515-3-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1375727330-30515-1-git-send-email-rth@twiddle.net> References: <1375727330-30515-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c01::234 Cc: "Vassili Karpov \(malc\)" , Richard Henderson Subject: [Qemu-devel] [PATCH for-next 02/15] tcg-ppc64: Add an LK argument to tcg_out_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 This will enable the generation of tail-calls in a future patch. Signed-off-by: Richard Henderson --- tcg/ppc64/tcg-target.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c index 0e3147b..94960a3 100644 --- a/tcg/ppc64/tcg-target.c +++ b/tcg/ppc64/tcg-target.c @@ -702,30 +702,30 @@ static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target) } } -static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg) +/* Make a call to a function. LK = LK for a normal call, or 0 to avoid + setting the link register, making a tail call. */ +static void tcg_out_call(TCGContext *s, tcg_target_long arg, + int const_arg, int lk) { #ifdef __APPLE__ if (const_arg) { - tcg_out_b (s, LK, arg); - } - else { - tcg_out32 (s, MTSPR | RS (arg) | LR); - tcg_out32 (s, BCLR | BO_ALWAYS | LK); + tcg_out_b(s, lk, arg); + } else { + tcg_out32(s, MTSPR | RS(arg) | CTR); + tcg_out32(s, BCCTR | BO_ALWAYS | lk); } #else - int reg; - + TCGReg reg = arg; if (const_arg) { - reg = 2; - tcg_out_movi (s, TCG_TYPE_I64, reg, arg); + reg = TCG_REG_R2; + tcg_out_movi(s, TCG_TYPE_I64, reg, arg); } - else reg = arg; - tcg_out32 (s, LD | RT (0) | RA (reg)); - tcg_out32 (s, MTSPR | RA (0) | CTR); - tcg_out32 (s, LD | RT (11) | RA (reg) | 16); - tcg_out32 (s, LD | RT (2) | RA (reg) | 8); - tcg_out32 (s, BCCTR | BO_ALWAYS | LK); + tcg_out32(s, LD | TAI(TCG_REG_R0, reg, 0)); + tcg_out32(s, MTSPR | RA(TCG_REG_R0) | CTR); + tcg_out32(s, LD | TAI(TCG_REG_R11, reg, 16)); + tcg_out32(s, LD | TAI(TCG_REG_R2, reg, 8)); + tcg_out32(s, BCCTR | BO_ALWAYS | lk); #endif } @@ -869,7 +869,7 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) tcg_out_mov (s, TCG_TYPE_I64, ir++, addr_reg); tcg_out_movi (s, TCG_TYPE_I64, ir++, mem_index); - tcg_out_call (s, (tcg_target_long) qemu_ld_helpers[s_bits], 1); + tcg_out_call(s, (tcg_target_long)qemu_ld_helpers[s_bits], 1, LK); if (opc & 4) { insn = qemu_exts_opc[s_bits]; @@ -960,7 +960,7 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc) tcg_out_rld (s, RLDICL, ir++, data_reg, 0, 64 - (1 << (3 + opc))); tcg_out_movi (s, TCG_TYPE_I64, ir++, mem_index); - tcg_out_call (s, (tcg_target_long) qemu_st_helpers[opc], 1); + tcg_out_call(s, (tcg_target_long)qemu_st_helpers[opc], 1, LK); label2_ptr = s->code_ptr; tcg_out32 (s, B); @@ -1440,7 +1440,7 @@ static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args, } break; case INDEX_op_call: - tcg_out_call (s, args[0], const_args[0]); + tcg_out_call(s, args[0], const_args[0], LK); break; case INDEX_op_movi_i32: tcg_out_movi (s, TCG_TYPE_I32, args[0], args[1]);