From patchwork Sat Sep 9 12:45:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 811957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-461773-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Cn+ZcB2x"; dkim-atps=neutral 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 3xqDSv3jNJz9s3w for ; Sat, 9 Sep 2017 22:46:07 +1000 (AEST) 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=WP0ZydTvbhd6Gxi/ /5vc2zRfS1/2Qjhx+DSR6LjgG6bPbAkQ7Sx3FCi1WUT47bsGeT0aeoiY2eYb0V3A EvJ6ejBlHW19agOZnWN9CFh/E3wZU37DNx80pdSH76QmHTPDG3fMBWGA/p15V/Ab dj6jIY6GdRnhik1CnmGSwT9Pixs= 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=2iwXbr3+7vW5N9a/z7P4Ju 82c5I=; b=Cn+ZcB2xQD5oVxI2PkwOvHEwWrSKbAOg1/ldOb5wAP1DkM+REgn9L7 yFkahguneaG/fZB8hT4oyCHss4UK1yIniW4cy0nmiSAj+UGHH5Fr/LtP2dG/3587 SHU+YUw2H3sGCBrmF+p9CFKbfOubGhFqA6oshg++zlREwCrG9z6YQ= Received: (qmail 85995 invoked by alias); 9 Sep 2017 12:45:59 -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 85597 invoked by uid 89); 9 Sep 2017 12:45:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1476, Disregard X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 09 Sep 2017 12:45:57 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id BF46682338 for ; Sat, 9 Sep 2017 14:45:55 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OHlqRFK8CWEY for ; Sat, 9 Sep 2017 14:45:55 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 9521F8200B for ; Sat, 9 Sep 2017 14:45:55 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Override inlining heuristics for expression functions Date: Sat, 09 Sep 2017 14:45:49 +0200 Message-ID: <5514804.eF9LzFp7xH@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-53-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Expression functions are supposed to be very small so it makes sense to inline them in almost all cases. Tested on x86_64-suse-linux, applied on the mainline. 2017-09-09 Eric Botcazou * gcc-interface/trans.c (Subprogram_Body_to_gnu): Disregard inlining limits for expression functions. (gnat_to_gnu) : Fix formatting. Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 251927) +++ gcc-interface/trans.c (working copy) @@ -3777,6 +3777,11 @@ Subprogram_Body_to_gnu (Node_Id gnat_nod Sloc_to_locus (Sloc (gnat_node), &locus); DECL_SOURCE_LOCATION (gnu_subprog_decl) = locus; + /* If the body comes from an expression function, arrange it to be inlined + in almost all cases. */ + if (Was_Expression_Function (gnat_node)) + DECL_DISREGARD_INLINE_LIMITS (gnu_subprog_decl) = 1; + /* Initialize the information structure for the function. */ allocate_struct_function (gnu_subprog_decl, false); gnu_subprog_language = ggc_cleared_alloc (); @@ -6140,7 +6145,7 @@ gnat_to_gnu (Node_Id gnat_node) && (((Is_Array_Type (Etype (gnat_temp)) || Is_Record_Type (Etype (gnat_temp))) && !Is_Constrained (Etype (gnat_temp))) - || Is_Concurrent_Type (Etype (gnat_temp)))) + || Is_Concurrent_Type (Etype (gnat_temp)))) break; if (Present (Expression (gnat_node))