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: 53072 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id 9E8142159E for ; Fri, 4 Sep 2015 09:29:08 +0000 (UTC) Received: by lbbmp1 with SMTP id mp1sf4907913lbb.2 for ; Fri, 04 Sep 2015 02:29:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding:x-original-sender :x-original-authentication-results; bh=BhmM//l1Q6TkH+cuByefqT8010LFw/PhwAgn4Ny4rig=; b=MzEQtGvfJzzQbaUAtaYo/+uJ7vpM6QrPCq9MIOMDqDaGuLIFCaJJKjHS4Dj6tNlqLT PCgK4OlCFyznc7fyqZjJ3/spHDjbg+LA9YAnB9p/btZtDwkicJ1FeGJPVQ7tr7iVKIv6 k+BZaixIl1CdTQetbA6fmR9+7OAUxfZIDJyh8L7PU/YT5CCFMM3ekZloopKUAG2Ecfw5 RvSKywR/cq/c4hb+evEewRxPhtujOQO5bLxfd+RvoOLEhpsZQiIqfGujcXncCV8JEABm yGyme1CLt73IzK/ze7iSUtqK4tweAsgpf4RGBV7+ZpH8YRHijaro2T0fPEldLqvINpqK hlLw== X-Gm-Message-State: ALoCoQlSnlb/3WVAm38ci4nGyShzkt9XoKF+E0rnNgMxNPwC7VGom2UB2L6lNDYAujZPbhC4Vit8 X-Received: by 10.152.45.101 with SMTP id l5mr763000lam.7.1441358947535; Fri, 04 Sep 2015 02:29:07 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.70 with SMTP id y6ls293437lay.55.gmail; Fri, 04 Sep 2015 02:29:07 -0700 (PDT) X-Received: by 10.112.14.8 with SMTP id l8mr2772502lbc.68.1441358947386; Fri, 04 Sep 2015 02:29:07 -0700 (PDT) Received: from mail-la0-x234.google.com (mail-la0-x234.google.com. [2a00:1450:4010:c03::234]) by mx.google.com with ESMTPS id e1si1772967lbs.96.2015.09.04.02.29.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Sep 2015 02:29:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::234 as permitted sender) client-ip=2a00:1450:4010:c03::234; Received: by laeb10 with SMTP id b10so9735486lae.1 for ; Fri, 04 Sep 2015 02:29:07 -0700 (PDT) X-Received: by 10.112.168.100 with SMTP id zv4mr2684411lbb.117.1441358947128; Fri, 04 Sep 2015 02:29:07 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.164.42 with SMTP id yn10csp1822060lbb; Fri, 4 Sep 2015 02:29:06 -0700 (PDT) X-Received: by 10.107.137.69 with SMTP id l66mr5161451iod.60.1441358945936; Fri, 04 Sep 2015 02:29:05 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id qc7si3304942pdb.245.2015.09.04.02.29.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Sep 2015 02:29:05 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-406702-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 124168 invoked by alias); 4 Sep 2015 09:28:53 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 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 X-Original-Sender: kyrylo.tkachov@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::234 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 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.