From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32370 invoked by alias); 8 Jun 2011 08:42:31 -0000 Received: (qmail 32361 invoked by uid 22791); 8 Jun 2011 08:42:30 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_FN,TW_TM 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; Wed, 08 Jun 2011 08:42:16 +0000 Received: by wye20 with SMTP id 20so206505wye.20 for ; Wed, 08 Jun 2011 01:42:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.169.139 with SMTP id z11mr780985wby.60.1307522534701; Wed, 08 Jun 2011 01:42:14 -0700 (PDT) Received: by 10.227.37.152 with HTTP; Wed, 8 Jun 2011 01:42:14 -0700 (PDT) In-Reply-To: References: Date: Wed, 08 Jun 2011 09:06:00 -0000 Message-ID: Subject: Re: -fdump-passes -fenable-xxx=func_name_list From: Richard Guenther To: Xinliang David Li Cc: GCC Patches Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00621.txt.bz2 On Tue, Jun 7, 2011 at 10:20 PM, Xinliang David Li wro= te: > The dump-pass patch with test case. Ok. Thanks, Richard. > David > > On Tue, Jun 7, 2011 at 11:54 AM, Xinliang David Li w= rote: >> Please review the attached two patches. >> >> In the first patch, gate functions are cleaned up. All the per >> function legality checks are moved into the executor and the >> optimization heuristic checks (optimize for size) remain in the >> gators. These allow the the following overriding order: >> >> =A0 =A0common flags (O2, -ftree-vrp, -fgcse etc) =A0 <--- =A0compiler >> heuristic (optimize for size/speed) <--- -fdisable/enable forcing pass >> options =A0<--- legality check >> >> Testing under going. Ok for trunk? >> >> Thanks, >> >> David >> >> On Tue, Jun 7, 2011 at 9:24 AM, Xinliang David Li w= rote: >>> Ok -- that sounds good. >>> >>> David >>> >>> On Tue, Jun 7, 2011 at 3:10 AM, Richard Guenther >>> wrote: >>>> On Mon, Jun 6, 2011 at 6:00 PM, Xinliang David Li = wrote: >>>>> On Mon, Jun 6, 2011 at 4:38 AM, Richard Guenther >>>>> wrote: >>>>>> On Thu, Jun 2, 2011 at 9:12 AM, Xinliang David Li wrote: >>>>>>> This is the version of the patch that walks through pass lists. >>>>>>> >>>>>>> Ok with this one? >>>>>> >>>>>> +/* Dump all optimization passes. =A0*/ >>>>>> + >>>>>> +void >>>>>> +dump_passes (void) >>>>>> +{ >>>>>> + =A0struct cgraph_node *n, *node =3D NULL; >>>>>> + =A0tree save_fndecl =3D current_function_decl; >>>>>> + >>>>>> + =A0fprintf (stderr, "MAX_UID =3D %d\n", cgraph_max_uid); >>>>>> >>>>>> this isn't accurate info - cloning can cause more cgraph nodes to >>>>>> appear (it also looks completely unrelated to dump_passes ...). >>>>>> Please drop it. >>>>> >>>>> Ok. >>>>> >>>>> >>>>>> >>>>>> + =A0create_pass_tab(); >>>>>> + =A0gcc_assert (pass_tab); >>>>>> >>>>>> you have quite many asserts of this kind - we don't want them when >>>>>> the previous stmt as in this case indicates everything is ok. >>>>> >>>>> ok. >>>>> >>>>>> >>>>>> + =A0push_cfun (DECL_STRUCT_FUNCTION (node->decl)); >>>>>> >>>>>> this has side-effects, I'm not sure we want this here. =A0Why do you >>>>>> need it? =A0Probably because of >>>>>> >>>>>> + =A0is_really_on =3D override_gate_status (pass, current_function_d= ecl, is_on); >>>>>> >>>>>> ? =A0But that is dependent on the function given which should have no >>>>>> effect (unless it is overridden globally in which case override_gate= _status >>>>>> and friends should deal with a NULL cfun). >>>>> >>>>> As we discussed, currently some pass gate functions depend on per node >>>>> information -- those checks need to be pushed into execute functions. >>>>> I would like to clean those up later -- at which time, the push/pop >>>>> can be removed. >>>> >>>> I'd like to do it the other way around, first clean up the gate functi= ons then >>>> drop in this patch without the cfun push/pop. =A0The revised patch loo= ks ok >>>> to me with the cfun push/pop removed. >>>> >>>> Thanks, >>>> Richard. >>>> >>>>>> >>>>>> I don't understand why you need another table mapping pass to name >>>>>> when pass->name is available and the info is trivially re-constructi= ble. >>>>> >>>>> This is needed as the pass->name is not the canonicalized name (i.e., >>>>> not with number suffix etc), so the extra mapping from id to >>>>> normalized name is needed. >>>>> >>>>> Thanks, >>>>> >>>>> David >>>>> >>>>>> >>>>>> Thanks, >>>>>> Richard. >>>>>> >>>>>>> David >>>>>>> >>>>>>> On Wed, Jun 1, 2011 at 12:45 PM, Xinliang David Li wrote: >>>>>>>> On Wed, Jun 1, 2011 at 12:29 PM, Richard Guenther >>>>>>>> wrote: >>>>>>>>> On Wed, Jun 1, 2011 at 6:16 PM, Xinliang David Li wrote: >>>>>>>>>> On Wed, Jun 1, 2011 at 1:51 AM, Richard Guenther >>>>>>>>>> wrote: >>>>>>>>>>> On Wed, Jun 1, 2011 at 1:34 AM, Xinliang David Li wrote: >>>>>>>>>>>> The following patch implements the a new option that dumps gcc= PASS >>>>>>>>>>>> configuration. The sample output is attached. =A0There is one >>>>>>>>>>>> limitation: some placeholder passes that are named with '*xxx'= are >>>>>>>>>>>> note registered thus they are not listed. They are not importa= nt as >>>>>>>>>>>> they can not be turned on/off anyway. >>>>>>>>>>>> >>>>>>>>>>>> The patch also enhanced -fenable-xxx and -fdisable-xx to allow= a list >>>>>>>>>>>> of function assembler names to be specified. >>>>>>>>>>>> >>>>>>>>>>>> Ok for trunk? >>>>>>>>>>> >>>>>>>>>>> Please split the patch. >>>>>>>>>>> >>>>>>>>>>> I'm not too happy how you dump the pass configuration. =A0Why n= ot simply, >>>>>>>>>>> at a _single_ place, walk the pass tree? =A0Instead of doing pi= eces of it >>>>>>>>>>> at pass execution time when it's not already dumped - that real= ly looks >>>>>>>>>>> gross. >>>>>>>>>> >>>>>>>>>> Yes, that was the original plan -- but it has problems >>>>>>>>>> 1) the dumper needs to know the root pass lists -- which can cha= nge >>>>>>>>>> frequently -- it can be a long term maintanance burden; >>>>>>>>>> 2) the centralized dumper needs to be done after option processi= ng >>>>>>>>>> 3) not sure if gate functions have any side effects or have depe= ndencies on cfun >>>>>>>>>> >>>>>>>>>> The proposed solutions IMHO is not that intrusive -- just three = hooks >>>>>>>>>> to do the dumping and tracking indentation. >>>>>>>>> >>>>>>>>> Well, if you have a CU that is empty or optimized to nothing at s= ome point >>>>>>>>> you will not get a complete pass list. =A0I suppose optimize attr= ibutes might >>>>>>>>> also confuse output. =A0Your solution might not be that intrusive >>>>>>>>> but it is still ugly. =A0I don't see 1) as an issue, for 2) you c= an just call the >>>>>>>>> dumping from toplev_main before calling do_compile (), 3) gate fu= nctions >>>>>>>>> shouldn't have side-effects, but as they could gate on optimize_f= or_speed () >>>>>>>>> your option summary output will be bogus anyway. >>>>>>>>> >>>>>>>>> So - what is the output intended for if it isn't reliable? >>>>>>>> >>>>>>>> This needs to be cleaned up at some point -- the gate function sho= uld >>>>>>>> behave the same for all functions and per-function decisions need = to >>>>>>>> be pushed down to the executor body. =A0I will try to rework the p= atch >>>>>>>> as you suggested to see if there are problems. >>>>>>>> >>>>>>>> David >>>>>>>> >>>>>>>> >>>>>>>>> >>>>>>>>> Richard. >>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> The documentation should also link this option to the -fenable/= disable >>>>>>>>>>> options as obviously the pass names in that dump are those to be >>>>>>>>>>> used for those flags (and not readily available anywhere else). >>>>>>>>>> >>>>>>>>>> Ok. >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> I also think that it would be way more useful to note in the in= dividual >>>>>>>>>>> dump files the functions (at the place they would usually appea= r) that >>>>>>>>>>> have the pass explicitly enabled/disabled. >>>>>>>>>> >>>>>>>>>> Ok -- for ipa passes or tree/rtl passes where all functions are >>>>>>>>>> explicitly disabled. >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> >>>>>>>>>> David >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Richard. >>>>>>>>>>> >>>>>>>>>>>> Thanks, >>>>>>>>>>>> >>>>>>>>>>>> David >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >