This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][Middle-end][Version 2]Add a new option to control inlining only on static functions


On Fri, Sep 14, 2018 at 1:34 PM Qing Zhao <qing.zhao@oracle.com> wrote:
>
> Hi,
>
> this is the 2nd version of the patch to add a new first-class option
>
> -finline-only-static
>
> to guide inlining only on static functions.
>
> -finline-only-static
>   By default, GCC inlines functions without considering whether they are static
>   or not. This flag guides inliner to only inline static functions.
>
>   Off by default.
>
> The major purpose of this option is to provide a way for the user to disable inlining of global functions.
> this is mainly to help online patching users to control the memory consumption and ease the debugging.
>
> please take a look and let me know any comments and suggestions:

How does this interact with -finline-functions?  Or rather isn't this
just the opposite of -finline-functions?

Thanks,
Andrew

>
> thanks a lot.
>
> Qing
>
> gcc/ChangeLog
>
> +2018-09-13  Qing Zhao  <qing.zhao@oracle.com>
> +
> +       * cif-code.def (FUNCTION_EXTERN): New CIFCODE.
> +       * common.opt (-finline-only-static): New option.
> +       * doc/invoke.texi: Document -finline-only-static.
> +       * ipa-inline.c (can_inline_edge_p): Control inlining based on
> +       function's visibility.
>
> gcc/testsuite/ChangeLog
>
> +2018-09-13  Qing Zhao  <qing.zhao@oracle.com>
> +
> +       * gcc.dg/inline_only_static.c: New test.
> +
>
>
>
> > On Sep 11, 2018, at 10:12 AM, Qing Zhao <qing.zhao@oracle.com> wrote:
> >
> > Hi,
> >
> > This is a simple patch to add a new first-class option
> >
> > -finline-visibility={all|extern|static}
> >
> > to finer control inlining based on function’s visibility.
> >
> > '-finline-visibility=[all|extern|static]'
> >     By default, GCC inlines functions without considering their
> >     visibility.  This flag allows finer control of inlining based on
> >     their visibility.
> >
> >     The value 'extern' tells the compiler to only inline functions with
> >     external visibility.  The value 'static' tells the compiler to only
> >     inline functions with static visibility.  The value 'all' tells the
> >     compilers to inline functions without considering their visibility.
> >
> >     The default value of '-finline-visibility' is 'all'.
> >
> > The major purpose of this option is to provide a way for the user
> > to finer choose the inline candidates based on function’s visibility.
> > For example, some online patching users might want to limit the inlining
> > to only static functions to avoid patching the callers of global functions
> > in order to control the memory consumption caused by online patching.
> >
> > let me know any comments and suggestions.
> >
> > thanks.
> >
> > Qing
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]