From patchwork Fri Sep 4 09:28:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 514359 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 7BA961401DA for ; Fri, 4 Sep 2015 19:29:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Ww1IrWrB; 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; q=dns; s= default; b=lrC/FnazKeEazcpq9cp6PrQTZwYbexJtoEevKciqm+CAm472q8tNw ZCaA/wg66lrVvUz0J2V626dN+szddI1V+XsTkmvpHUA7+DTfQkFuM854zWJcxbWM P38Sn3WS9T7nKzhtToXg7V+LLnwknKVbh2WXVMOy4ibfJAFddokEjg= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; s=default; bh=W2QU+iuGp94WzfP0r5uGGpuEub0=; b=Ww1IrWrBWkLjSuPLiaWDdw1W6Qd2 RdLy311d86cr+zPWydqUXmwKf3wOT380E5ytdUAkOZonn8pzbhwtAth6gAtHziW8 g3FuDnDuJEBROf2MLIKfXjIQ5JsVr4YLgowpW1FHEcr8TveXjp5pfholyPCQNMC5 2shqFdy/UgD9O+Y= Received: (qmail 124168 invoked by alias); 4 Sep 2015 09:28:53 -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 124149 invoked by uid 89); 4 Sep 2015 09:28:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham 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) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 04 Sep 2015 09:28:51 +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-10-yQjYSjDlQmuOydGpy1dA5A-1; Fri, 04 Sep 2015 10:28:46 +0100 Received: from [10.2.207.50] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 4 Sep 2015 10:28:46 +0100 Message-ID: <55E9644E.2080708@arm.com> Date: Fri, 04 Sep 2015 10:28:46 +0100 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Christian Bruel , Ramana Radhakrishnan CC: "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH, ARM]: Add TARGET_OPTION[RESTORE,SAVE,PRINT] hooks References: <55E6BD35.5020601@st.com> In-Reply-To: <55E6BD35.5020601@st.com> X-MC-Unique: yQjYSjDlQmuOydGpy1dA5A-1 X-IsSubscribed: yes Hi Christian, Thanks again for working on this! On 02/09/15 10:11, Christian Bruel wrote: > Hi, > > This patch uses TARGET_OPTION_RESTORE and SAVE to switch the attribute > target dependent params between functions. > > This is more efficient than arm_option_params_internal, and prepares the > ground for the other machine target attributes. To be honest, I'm reluctant to take this approach. The design I'd like to see is for us to figure out the minimal set of TargetSave variables (and options in arm.opt that require the tag Save) and use them to 'package' the backend state whenever needed, with the help of TARGET_OPTION_SAVE when appropriate. Then during TARGET_OPTION_RESTORE we would call arm_option_override_internal and arm_option_params_internal to restore all the different backend variables that we need. In my opinion that is the approach that would give the most maintainability. In any case, I see arm_option_params_internal is not particularly complicated at the moment, so I don't think your patch would show any noticeable speed improvement (unless you can share data to demonstrate that :)) Maybe we can make the roadmap for this more concrete if you post a description of what parameters you'd like to save and restore to achieve this goal and we can discuss that. Some that come to mind would be: CPU we're tuning for, architecture, FPU, and basically any option in arm.opt which we want to allow to vary on a per-function basis (i.e. no ABI-changing options). Hope this helps, Kyrill P.S. I recently implemented this functionality in the aarch64 backend. Maybe the implementation of these hooks over there could be of some help (though I appreciate the arm backend is more complicated with more legacy and option variations) > No regressions. OK for trunk ? > > many thanks > > Christian > That way it's easy to deduce that they implement TARGET_OPTION_{SAVE,RESTORE}. Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c (revision 227366) +++ gcc/config/arm/arm.c (working copy) @@ -245,9 +245,14 @@ static void arm_expand_builtin_va_start (tree, rtx); static tree arm_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); static void arm_option_override (void); +static void arm_option_print (FILE *, int, struct cl_target_option *); static void arm_set_current_function (tree); static bool arm_can_inline_p (tree, tree); static bool arm_valid_target_attribute_p (tree, tree, tree, int); +static void arm_function_specific_save (struct cl_target_option *, + struct gcc_options *); +static void arm_function_specific_restore (struct gcc_options *, + struct cl_target_option *); I'd rather call them arm_option_save and arm_option_restore.