From patchwork Sun Jul 5 07:49:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 491277 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 BD0B21409A0 for ; Sun, 5 Jul 2015 17:49:40 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=aSK6a+En; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=LstdkyWPWKzVXL/T maevrpNghdtFGBD0XjS9MMus+qiNURIpbcUASsmS+ZaSxewzNU2h+mTffyCsWLEb X0VMsTfHTuT7UyUyaM3rYJG8CiqFMhNfDO6/nMBeCpenFEu5dYOPLNn6iFTMjKIX 1fhP4IvDVMFfdAFWsz6vthQ8DgY= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=kaIKnZE4Ti+UJxa4FRI3dH FtBF0=; b=aSK6a+EncFmlKYWfa/CSW1EcSNLjDkv/Rk/sTpbLsRHVCOP4+EhQBo /+FE2ySSZhnxB2XqSWyrELrsRup+tluji2/m0ldXVNnCp+JuZsGNawwN2K3McUpZ /sDUiJSalpmaciPIxhdQq38qYu2FTjQe/JleWK3s4wZ19E54oeLuE= Received: (qmail 110005 invoked by alias); 5 Jul 2015 07:49:33 -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 109966 invoked by uid 89); 5 Jul 2015 07:49:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL, BAYES_20, KAM_ASCII_DIVIDERS, SPF_PASS autolearn=no version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 05 Jul 2015 07:49:31 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-27-14suCjK0R0uy8ricHXr0Iw-1 Received: from localhost ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 5 Jul 2015 08:49:19 +0100 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [committed] Use target-insns.def for untyped call/return Date: Sun, 05 Jul 2015 08:49:20 +0100 Message-ID: <87io9zm4cf.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-MC-Unique: 14suCjK0R0uy8ricHXr0Iw-1 Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (untyped_call, untyped_return): New targetm instruction patterns. * builtins.c (expand_builtin_apply): Use them instead of HAVE_*/gen_* interface. (result_vector): Define unconditionally. Index: gcc/target-insns.def =================================================================== --- gcc/target-insns.def 2015-07-05 08:48:34.157410329 +0100 +++ gcc/target-insns.def 2015-07-05 08:48:34.157410329 +0100 @@ -50,3 +50,5 @@ DEF_TARGET_INSN (sibcall_epilogue, (void DEF_TARGET_INSN (simple_return, (void)) DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1)) +DEF_TARGET_INSN (untyped_call, (rtx x0, rtx x1, rtx x2)) +DEF_TARGET_INSN (untyped_return, (rtx x0, rtx x1)) Index: gcc/builtins.c =================================================================== --- gcc/builtins.c 2015-07-05 08:48:34.157410329 +0100 +++ gcc/builtins.c 2015-07-05 08:48:34.153410375 +0100 @@ -104,9 +104,7 @@ static int target_char_cast (tree, char static rtx get_memory_rtx (tree, tree); static int apply_args_size (void); static int apply_result_size (void); -#if defined (HAVE_untyped_call) || defined (HAVE_untyped_return) static rtx result_vector (int, rtx); -#endif static void expand_builtin_prefetch (tree); static rtx expand_builtin_apply_args (void); static rtx expand_builtin_apply_args_1 (void); @@ -1448,7 +1446,6 @@ apply_result_size (void) return size; } -#if defined (HAVE_untyped_call) || defined (HAVE_untyped_return) /* Create a vector describing the result block RESULT. If SAVEP is true, the result block is used to save the values; otherwise it is used to restore the values. */ @@ -1477,7 +1474,6 @@ result_vector (int savep, rtx result) } return gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelts, savevec)); } -#endif /* HAVE_untyped_call or HAVE_untyped_return */ /* Save the state required to perform an untyped call with the same arguments as were passed to the current function. */ @@ -1698,12 +1694,13 @@ expand_builtin_apply (rtx function, rtx function = memory_address (FUNCTION_MODE, function); /* Generate the actual call instruction and save the return value. */ -#ifdef HAVE_untyped_call - if (HAVE_untyped_call) - emit_call_insn (gen_untyped_call (gen_rtx_MEM (FUNCTION_MODE, function), - result, result_vector (1, result))); + if (targetm.have_untyped_call ()) + { + rtx mem = gen_rtx_MEM (FUNCTION_MODE, function); + emit_call_insn (targetm.gen_untyped_call (mem, result, + result_vector (1, result))); + } else -#endif #ifdef HAVE_call_value if (HAVE_call_value) { @@ -1767,14 +1764,13 @@ expand_builtin_return (rtx result) apply_result_size (); result = gen_rtx_MEM (BLKmode, result); -#ifdef HAVE_untyped_return - if (HAVE_untyped_return) + if (targetm.have_untyped_return ()) { - emit_jump_insn (gen_untyped_return (result, result_vector (0, result))); + rtx vector = result_vector (0, result); + emit_jump_insn (targetm.gen_untyped_return (result, vector)); emit_barrier (); return; } -#endif /* Restore the return value and note that each value is used. */ size = 0;