From patchwork Thu May 22 21:33:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Tietz X-Patchwork-Id: 351619 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 20B3F14007C for ; Fri, 23 May 2014 07:33:51 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:message-id:subject:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=pHvht+MqFCF1FkeD hCbck4eCW96x9WVysJYTK3HfhcwnzDYUU8a7fr2NswY7N0XUwgOwIo0ZpmJ7DV0N Nc/wzLMENZ7YIj7GkWpd2v7Vlsl6QjE7fm555T4mYYI/9mfDZCi2y2F3oT/f6hYt txQpXXrXa54lYYsbr4PoEa88joo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:message-id:subject:mime-version:content-type :content-transfer-encoding; s=default; bh=PX3YUUOkRorzWUYBXpJjdO pU80o=; b=cWpZyth35zVwADgVykogzQ067OElyQ2FSsuUnIBwS+4G+3uvDIsSu8 cVUZrUQWplkHsexv7nKA+clDb4+XdT9OzoVXZ+euRom80BxcgxgvFkCmfEDiTWlo BdtGonQ8aZHP7+lvITmXDFuGwfVtJLhBRhYbtx/xq5zTYPOWqtsnw= Received: (qmail 10185 invoked by alias); 22 May 2014 21:33:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 10171 invoked by uid 89); 22 May 2014 21:33:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx3-phx2.redhat.com Received: from mx3-phx2.redhat.com (HELO mx3-phx2.redhat.com) (209.132.183.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 May 2014 21:33:43 +0000 Received: from zmail14.collab.prod.int.phx2.redhat.com (zmail14.collab.prod.int.phx2.redhat.com [10.5.83.16]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s4MLXgb6006830; Thu, 22 May 2014 17:33:42 -0400 Date: Thu, 22 May 2014 17:33:42 -0400 (EDT) From: Kai Tietz To: GCC Patches Cc: Richard Henderson Message-ID: <356718653.5712706.1400794422397.JavaMail.zimbra@redhat.com> Subject: [patch i386]: Expand sibling-tail-calls via accumulator register MIME-Version: 1.0 X-IsSubscribed: yes Hello, This patch avoids for sibling-tail-calls the use of pseudo-register. Instead it uses for load of memory-address the accumulator-register. By this we avoid that IRA/LRA need to choose a register. So we reduce register-pressure. The accumulator-register is always a valid register on tail-call case. All other registers might be callee-saved, or used for argument-passing. The only case where we would use the accumulator on call is the variadic-case for x86_64 ABI. Just that this function never is a candidate for sibling-tail-calls. ChangeLog 2014-05-22 Kai Tietz * config/i386/i386.c (ix86_expand_call): Enforce for sibcalls on memory the use of accumulator-register. Regression tested for x86_64-unknown-linux-gnu, x86_64-w64-mingw32, and i686-pc-cygwin. Ok for apply? Regards, Kai Index: i386.c =================================================================== --- i386.c (Revision 210412) +++ i386.c (Arbeitskopie) @@ -24898,8 +24898,19 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx call ? !sibcall_insn_operand (XEXP (fnaddr, 0), word_mode) : !call_insn_operand (XEXP (fnaddr, 0), word_mode)) { + rtx r; fnaddr = convert_to_mode (word_mode, XEXP (fnaddr, 0), 1); - fnaddr = gen_rtx_MEM (QImode, copy_to_mode_reg (word_mode, fnaddr)); + if (!sibcall) + r = copy_to_mode_reg (word_mode, fnaddr); + else + { + r = gen_rtx_REG (word_mode, AX_REG); + if (! general_operand (fnaddr, VOIDmode)) + fnaddr = force_operand (fnaddr, r); + if (fnaddr != r) + emit_move_insn (r, fnaddr); + } + fnaddr = gen_rtx_MEM (QImode, r); } call = gen_rtx_CALL (VOIDmode, fnaddr, callarg1);