From patchwork Sat Nov 13 17:34:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 71062 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]) by ozlabs.org (Postfix) with SMTP id 1AE29B7119 for ; Sun, 14 Nov 2010 04:35:35 +1100 (EST) Received: (qmail 2105 invoked by alias); 13 Nov 2010 17:35:34 -0000 Received: (qmail 1893 invoked by uid 22791); 13 Nov 2010 17:35:33 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 13 Nov 2010 17:34:49 +0000 Received: by wyi11 with SMTP id 11so3591037wyi.20 for ; Sat, 13 Nov 2010 09:34:46 -0800 (PST) Received: by 10.227.132.206 with SMTP id c14mr3994963wbt.78.1289669686571; Sat, 13 Nov 2010 09:34:46 -0800 (PST) Received: from localhost (rsandifo.gotadsl.co.uk [82.133.89.107]) by mx.google.com with ESMTPS id ga16sm3743390wbb.19.2010.11.13.09.34.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 13 Nov 2010 09:34:45 -0800 (PST) From: Richard Sandiford To: Uros Bizjak Mail-Followup-To: Uros Bizjak , gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH, MIPS]: Remove ugly hack from "call_internal" splitter References: <87bp66gkzc.fsf@firetop.home> Date: Sat, 13 Nov 2010 17:34:43 +0000 In-Reply-To: (Uros Bizjak's message of "Wed, 3 Nov 2010 22:40:08 +0100") Message-ID: <87y68xxh3g.fsf@firetop.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 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 Uros Bizjak writes: > 2010-11-03 Uros Bizjak > > * config/mips/mips.md (call_internal): Pass curr_insn to > mips_split_call. > (call_internal_direct): Ditto. > (call_value_internal): Ditto. > (call_value_internal_direct): Ditto. > (call_value_multiple_internal): Ditto. > * config/mips/mips.c (mips_split_call): Do not copy > CALL_INSN_FUNCTION_USAGE here. > > Attached patch was tested by building a cross to mips-elf. > Unfortunatelly, I have no access to real mips target, so I would like > to ask somebody if can do a regression test of attached patch. Thanks, tested on mips64-linux-gnu. I had to make a trivial change (removing the new_insn variable to avoid a warning), so I applied the patch as tested. Richard 2010-11-13 Uros Bizjak * config/mips/mips.md (call_internal): Pass curr_insn to mips_split_call. (call_internal_direct): Ditto. (call_value_internal): Ditto. (call_value_internal_direct): Ditto. (call_value_multiple_internal): Ditto. * config/mips/mips.c (mips_split_call): Do not copy CALL_INSN_FUNCTION_USAGE here. Index: gcc/config/mips/mips.md =================================================================== --- gcc/config/mips/mips.md 2010-11-13 17:30:42.000000000 +0000 +++ gcc/config/mips/mips.md 2010-11-13 17:32:02.000000000 +0000 @@ -6051,18 +6051,16 @@ (define_expand "call" ;; But once we generate the separate insns, it becomes obvious that ;; $gp is not live on entry to the call. ;; -;; ??? The operands[2] = insn check is a hack to make the original insn -;; available to the splitter. (define_insn_and_split "call_internal" [(call (mem:SI (match_operand 0 "call_insn_operand" "c,S")) (match_operand 1 "" "")) (clobber (reg:SI RETURN_ADDR_REGNUM))] "" { return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 0, 1); } - "reload_completed && TARGET_SPLIT_CALLS && (operands[2] = insn)" + "reload_completed && TARGET_SPLIT_CALLS" [(const_int 0)] { - mips_split_call (operands[2], gen_call_split (operands[0], operands[1])); + mips_split_call (curr_insn, gen_call_split (operands[0], operands[1])); DONE; } [(set_attr "jal" "indirect,direct")]) @@ -6087,10 +6085,10 @@ (define_insn_and_split "call_internal_di (clobber (reg:SI RETURN_ADDR_REGNUM))] "" { return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 0, -1); } - "reload_completed && TARGET_SPLIT_CALLS && (operands[2] = insn)" + "reload_completed && TARGET_SPLIT_CALLS" [(const_int 0)] { - mips_split_call (operands[2], + mips_split_call (curr_insn, gen_call_direct_split (operands[0], operands[1])); DONE; } @@ -6126,10 +6124,10 @@ (define_insn_and_split "call_value_inter (clobber (reg:SI RETURN_ADDR_REGNUM))] "" { return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 1, 2); } - "reload_completed && TARGET_SPLIT_CALLS && (operands[3] = insn)" + "reload_completed && TARGET_SPLIT_CALLS" [(const_int 0)] { - mips_split_call (operands[3], + mips_split_call (curr_insn, gen_call_value_split (operands[0], operands[1], operands[2])); DONE; @@ -6155,10 +6153,10 @@ (define_insn_and_split "call_value_inter (clobber (reg:SI RETURN_ADDR_REGNUM))] "" { return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 1, -1); } - "reload_completed && TARGET_SPLIT_CALLS && (operands[3] = insn)" + "reload_completed && TARGET_SPLIT_CALLS" [(const_int 0)] { - mips_split_call (operands[3], + mips_split_call (curr_insn, gen_call_value_direct_split (operands[0], operands[1], operands[2])); DONE; @@ -6187,10 +6185,10 @@ (define_insn_and_split "call_value_multi (clobber (reg:SI RETURN_ADDR_REGNUM))] "" { return TARGET_SPLIT_CALLS ? "#" : MIPS_CALL ("jal", operands, 1, 2); } - "reload_completed && TARGET_SPLIT_CALLS && (operands[4] = insn)" + "reload_completed && TARGET_SPLIT_CALLS" [(const_int 0)] { - mips_split_call (operands[4], + mips_split_call (curr_insn, gen_call_value_multiple_split (operands[0], operands[1], operands[2], operands[3])); DONE; Index: gcc/config/mips/mips.c =================================================================== --- gcc/config/mips/mips.c 2010-11-13 17:30:42.000000000 +0000 +++ gcc/config/mips/mips.c 2010-11-13 17:32:02.000000000 +0000 @@ -6520,11 +6520,7 @@ mips_expand_call (enum mips_call_type ty void mips_split_call (rtx insn, rtx call_pattern) { - rtx new_insn; - - new_insn = emit_call_insn (call_pattern); - CALL_INSN_FUNCTION_USAGE (new_insn) - = copy_rtx (CALL_INSN_FUNCTION_USAGE (insn)); + emit_call_insn (call_pattern); if (!find_reg_note (insn, REG_NORETURN, 0)) /* Pick a temporary register that is suitable for both MIPS16 and non-MIPS16 code. $4 and $5 are used for returning complex double