Re: [google] Add options to pattern match function name for hotness attributes

2012-06-05 Thread Xinliang David Li
Also needs to get the attribute spec and call the attribute handler .. David On Tue, Jun 5, 2012 at 9:28 PM, Xinliang David Li wrote: > Please document it in doc/invoke.texi with examples. > > thanks, > > David > > On Tue, Jun 5, 2012 at 7:28 PM, Dehao Chen wrote: >> Patch updated: using regex

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-05 Thread Xinliang David Li
Please document it in doc/invoke.texi with examples. thanks, David On Tue, Jun 5, 2012 at 7:28 PM, Dehao Chen wrote: > Patch updated: using regex to match the function name: > > http://codereview.appspot.com/6281047 > > Thanks, > Dehao > > 2012-06-01  Dehao Chen   > >        * gcc/cgraph.c (cgr

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-05 Thread Dehao Chen
Patch updated: using regex to match the function name: http://codereview.appspot.com/6281047 Thanks, Dehao 2012-06-01 Dehao Chen * gcc/cgraph.c (cgraph_node): Add attribute to function decl. * gcc/opts-global.c (add_attribute_pattern): New function. (pattern_match_fun

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-04 Thread Dehao Chen
New patch attached. About using mangled name, I'm afraid this will make the command line too long for C++. And also, using bfd_name makes it easier to specify the pattern for common names. E.g. many class many have Log functions, but they are all likely to be cold. Using bfd_name, we only need to

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-04 Thread Xinliang David Li
On Mon, Jun 4, 2012 at 6:24 AM, Jan Hubicka wrote: >> On Sat, Jun 2, 2012 at 11:11 AM, Jan Hubicka wrote: >> >> Actually Dehao also plans to teach the static predictor to understand >> >> standard library functions more (e.g IO functions) and add more naming >> > >> > How this differ from annotat

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-04 Thread Xinliang David Li
On Sun, Jun 3, 2012 at 11:17 PM, Dehao Chen wrote: > I've updated the patch using deferred option. > > http://codereview.appspot.com/6281047 > > Thanks, > Dehao > > The new patch: > > 2012-06-01  Dehao Chen   > >        * gcc/cgraph.c (cgraph_match_attribute_by_name): New function. >        (cgrap

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-04 Thread Jan Hubicka
> On Sat, Jun 2, 2012 at 11:11 AM, Jan Hubicka wrote: > >> Actually Dehao also plans to teach the static predictor to understand > >> standard library functions more (e.g IO functions) and add more naming > > > > How this differ from annotating the library? > > I find them more suitable to be com

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-03 Thread Dehao Chen
I've updated the patch using deferred option. http://codereview.appspot.com/6281047 Thanks, Dehao The new patch: 2012-06-01 Dehao Chen * gcc/cgraph.c (cgraph_match_attribute_by_name): New function. (cgraph_node): Add attribute to function decl. * gcc/opts-global.c (a

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-03 Thread Dehao Chen
On Mon, Jun 4, 2012 at 9:34 AM, Andi Kleen wrote: > Dehao Chen writes: > >> Hi, >> >> This patch adds 4 flags to enable user to type in a list of name >> patterns. Compiler will match the function name with the given >> patterns, and add "hot", "cold", "likely_hot", "likely_cold" >> attributes to

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-03 Thread Andi Kleen
Dehao Chen writes: > Hi, > > This patch adds 4 flags to enable user to type in a list of name > patterns. Compiler will match the function name with the given > patterns, and add "hot", "cold", "likely_hot", "likely_cold" > attributes to function declaration. The static branch prediction > checks

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-03 Thread Xinliang David Li
Where is the patch -- the code review link is missing (in the original post). David On Sun, Jun 3, 2012 at 6:14 AM, Dehao Chen wrote: > Thank you guys for the comments, I'll update the patch to : > > 1. generalize the flag to enable other annotations such always_inline. > 2. change to use deferr

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-03 Thread Dehao Chen
Thank you guys for the comments, I'll update the patch to : 1. generalize the flag to enable other annotations such always_inline. 2. change to use deferred option. Thanks, Dehao On Sun, Jun 3, 2012 at 12:40 PM, Xinliang David Li wrote: > On Sat, Jun 2, 2012 at 11:11 AM, Jan Hubicka wrote: >>>

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-02 Thread Xinliang David Li
On Sat, Jun 2, 2012 at 11:11 AM, Jan Hubicka wrote: >> Actually Dehao also plans to teach the static predictor to understand >> standard library functions more (e.g IO functions) and add more naming > > How this differ from annotating the library? I find them more suitable to be compiler heuristi

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-02 Thread Jan Hubicka
> Actually Dehao also plans to teach the static predictor to understand > standard library functions more (e.g IO functions) and add more naming How this differ from annotating the library? There are indeed quite some possibilities to do about library calls One thing I always wondered about

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-02 Thread Xinliang David Li
Based on Honza's feedback, I think it is bettre to add command line interface such as this: -ffunction-attribute-list=: or -ffunction-attribute-filelist=: e.g, -ffunction-attribute-list=code:foo1,foo2,bar_*,blah It probably needs to be processed as deferred option to allow other option to be tr

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-02 Thread Xinliang David Li
On Sat, Jun 2, 2012 at 3:06 AM, Jan Hubicka wrote: >> On Sat, Jun 2, 2012 at 2:36 AM, Jan Hubicka wrote: >> >> Hi, >> >> >> >> This patch adds 4 flags to enable user to type in a list of name >> >> patterns. Compiler will match the function name with the given >> >> patterns, and add "hot", "cold

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-02 Thread Dehao Chen
On Sat, Jun 2, 2012 at 9:17 PM, Jan Hubicka wrote: >> > Well, perhaps the feature would be more useful with command line option >> > allowing >> > to add an attribute instead of having special case command line options >> > for individual >> > cases. >> >> Hi, Honza, I'm not sure what you mean b

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-02 Thread Jan Hubicka
> > Well, perhaps the feature would be more useful with command line option > > allowing > > to add an attribute instead of having special case command line options for > > individual > > cases. > > Hi, Honza, I'm not sure what you mean by "command line option allowing > to add an attribution".

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-02 Thread Dehao Chen
On Sat, Jun 2, 2012 at 6:06 PM, Jan Hubicka wrote: >> On Sat, Jun 2, 2012 at 2:36 AM, Jan Hubicka wrote: >> >> Hi, >> >> >> >> This patch adds 4 flags to enable user to type in a list of name >> >> patterns. Compiler will match the function name with the given >> >> patterns, and add "hot", "cold

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-02 Thread Jan Hubicka
> On Sat, Jun 2, 2012 at 2:36 AM, Jan Hubicka wrote: > >> Hi, > >> > >> This patch adds 4 flags to enable user to type in a list of name > >> patterns. Compiler will match the function name with the given > >> patterns, and add "hot", "cold", "likely_hot", "likely_cold" > >> attributes to function

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-02 Thread Xinliang David Li
On Sat, Jun 2, 2012 at 2:36 AM, Jan Hubicka wrote: >> Hi, >> >> This patch adds 4 flags to enable user to type in a list of name >> patterns. Compiler will match the function name with the given >> patterns, and add "hot", "cold", "likely_hot", "likely_cold" >> attributes to function declaration.

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-02 Thread Jan Hubicka
> Hi, > > This patch adds 4 flags to enable user to type in a list of name > patterns. Compiler will match the function name with the given > patterns, and add "hot", "cold", "likely_hot", "likely_cold" > attributes to function declaration. The static branch prediction > checks if a basic block co

Re: [google] Add options to pattern match function name for hotness attributes

2012-06-01 Thread Xinliang David Li
On Fri, Jun 1, 2012 at 1:26 AM, Dehao Chen wrote: > Hi, > > This patch adds 4 flags to enable user to type in a list of name > patterns. Compiler will match the function name with the given > patterns, and add "hot", "cold", "likely_hot", "likely_cold" > attributes to function declaration. The sta

[google] Add options to pattern match function name for hotness attributes

2012-06-01 Thread Dehao Chen
Hi, This patch adds 4 flags to enable user to type in a list of name patterns. Compiler will match the function name with the given patterns, and add "hot", "cold", "likely_hot", "likely_cold" attributes to function declaration. The static branch prediction checks if a basic block contains call to