public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][MIPS] Add -minline-intermix to ignore compression flags when inlining
@ 2016-05-24 15:40 Robert Suchanek
  2016-05-25  7:47 ` Sandra Loosemore
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Suchanek @ 2016-05-24 15:40 UTC (permalink / raw)
  To: Catherine_Moore, Matthew Fortune; +Cc: gcc-patches

Hi,

The below allows us to inline functions that have different compression flags
for better tuning of performance/code size balance.

Ok to commit?

Regards,
Robert

2016-05-24  Matthew Fortune  <matthew.fortune@imgtec.com>

gcc/
	* config/mips/mips.c (mips_can_inline_p): Allow inlining of
	functions with opposing compression flags.
	* config/mips/mips.opt (minline-intermix): New option.
	* doc/invoke.texi: Document the new option.
---
 gcc/config/mips/mips.c   |  3 ++-
 gcc/config/mips/mips.opt |  4 ++++
 gcc/doc/invoke.texi      | 13 +++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 5ecde46..4312368 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -1476,7 +1476,8 @@ mips_merge_decl_attributes (tree olddecl, tree newdecl)
 static bool
 mips_can_inline_p (tree caller, tree callee)
 {
-  if (mips_get_compress_mode (callee) != mips_get_compress_mode (caller))
+  if (mips_get_compress_mode (callee) != mips_get_compress_mode (caller)
+      && !TARGET_INLINE_INTERMIX)
     return false;
   return default_target_can_inline_p (caller, callee);
 }
diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt
index 08dd83e..3b92ef5 100644
--- a/gcc/config/mips/mips.opt
+++ b/gcc/config/mips/mips.opt
@@ -443,3 +443,7 @@ Enum(mips_cb_setting) String(optimal) Value(MIPS_CB_OPTIMAL)
 
 EnumValue
 Enum(mips_cb_setting) String(always) Value(MIPS_CB_ALWAYS)
+
+minline-intermix
+Target Report Var(TARGET_INLINE_INTERMIX)
+Allow inlining even if the compression flags differ between caller and callee.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 73f1cb6..2f6195e 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -837,6 +837,7 @@ Objective-C and Objective-C++ Dialects}.
 -mips16  -mno-mips16  -mflip-mips16 @gol
 -minterlink-compressed -mno-interlink-compressed @gol
 -minterlink-mips16  -mno-interlink-mips16 @gol
+-minline-intermix -mno-inline-intermix @gol
 -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
 -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float @gol
@@ -17916,6 +17917,18 @@ Aliases of @option{-minterlink-compressed} and
 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
 and are retained for backwards compatibility.
 
+@item -minline-intermix
+@itemx -mno-inline-intermix
+@opindex minline-intermix
+@opindex mno-inline-intermix
+Enable inlining of functions which have opposing compression flags e.g.
+@code{mips16}/@code{nomips16} attributes.
+This is useful when using the @code{mips16} attribute to balance code size
+and performance so that a function will be compressed when not inlined or
+vice-versa.  When using this option it is necessary to protect functions
+that cannot be compiled as MIPS16 with a @code{noinline} attribute to ensure
+they are not inlined into a MIPS16 function.
+
 @item -mabi=32
 @itemx -mabi=o64
 @itemx -mabi=n32
-- 
2.8.2.396.g5fe494c

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][MIPS] Add -minline-intermix to ignore compression flags when inlining
  2016-05-24 15:40 [PATCH][MIPS] Add -minline-intermix to ignore compression flags when inlining Robert Suchanek
@ 2016-05-25  7:47 ` Sandra Loosemore
  2016-05-25 10:16   ` Robert Suchanek
  0 siblings, 1 reply; 4+ messages in thread
From: Sandra Loosemore @ 2016-05-25  7:47 UTC (permalink / raw)
  To: Robert Suchanek, Catherine_Moore, Matthew Fortune; +Cc: gcc-patches

On 05/24/2016 08:23 AM, Robert Suchanek wrote:
>
>
> [snip]
>
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 73f1cb6..2f6195e 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -837,6 +837,7 @@ Objective-C and Objective-C++ Dialects}.
>   -mips16  -mno-mips16  -mflip-mips16 @gol
>   -minterlink-compressed -mno-interlink-compressed @gol
>   -minterlink-mips16  -mno-interlink-mips16 @gol
> +-minline-intermix -mno-inline-intermix @gol

Funky indentation here....

>   -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
>   -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
>   -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float @gol
> @@ -17916,6 +17917,18 @@ Aliases of @option{-minterlink-compressed} and
>   @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
>   and are retained for backwards compatibility.
>
> +@item -minline-intermix
> +@itemx -mno-inline-intermix
> +@opindex minline-intermix
> +@opindex mno-inline-intermix
> +Enable inlining of functions which have opposing compression flags e.g.
> +@code{mips16}/@code{nomips16} attributes.
> +This is useful when using the @code{mips16} attribute to balance code size
> +and performance so that a function will be compressed when not inlined or
> +vice-versa.  When using this option it is necessary to protect functions
> +that cannot be compiled as MIPS16 with a @code{noinline} attribute to ensure
> +they are not inlined into a MIPS16 function.

This flag applies to microMIPS inlining, too, right?  It's confusing to 
only mention MIPS16.

Maybe you could say something like this instead:

Allow inlining even if the compression flags differ between caller and 
callee.  This is useful in conjunction with the @code{mips16}, 
@code{micromips}, or @code{nocompression} function attributes.  The code 
for the inlined function is compiled using the compression flags for the 
callee, so you may need to use the @code{noinline} attribute on 
functions that must be compiled with particular compression settings.

-Sandra

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH][MIPS] Add -minline-intermix to ignore compression flags when inlining
  2016-05-25  7:47 ` Sandra Loosemore
@ 2016-05-25 10:16   ` Robert Suchanek
  2016-06-09 15:16     ` Maciej W. Rozycki
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Suchanek @ 2016-05-25 10:16 UTC (permalink / raw)
  To: Sandra Loosemore, Catherine_Moore, Matthew Fortune; +Cc: gcc-patches

Hi Sandra,

> > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> > index 73f1cb6..2f6195e 100644
> > --- a/gcc/doc/invoke.texi
> > +++ b/gcc/doc/invoke.texi
> > @@ -837,6 +837,7 @@ Objective-C and Objective-C++ Dialects}.
> >   -mips16  -mno-mips16  -mflip-mips16 @gol
> >   -minterlink-compressed -mno-interlink-compressed @gol
> >   -minterlink-mips16  -mno-interlink-mips16 @gol
> > +-minline-intermix -mno-inline-intermix @gol
> 
> Funky indentation here....

I'm not sure what's wrong here, it's the diff I'd say.  There is no
indentation within "MIPS Options".

> 
> >   -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
> >   -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
> >   -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float @gol
> > @@ -17916,6 +17917,18 @@ Aliases of @option{-minterlink-compressed} and
> >   @option{-mno-interlink-compressed}.  These options predate the microMIPS
> ASE
> >   and are retained for backwards compatibility.
> >
> > +@item -minline-intermix
> > +@itemx -mno-inline-intermix
> > +@opindex minline-intermix
> > +@opindex mno-inline-intermix
> > +Enable inlining of functions which have opposing compression flags e.g.
> > +@code{mips16}/@code{nomips16} attributes.
> > +This is useful when using the @code{mips16} attribute to balance code size
> > +and performance so that a function will be compressed when not inlined or
> > +vice-versa.  When using this option it is necessary to protect functions
> > +that cannot be compiled as MIPS16 with a @code{noinline} attribute to ensure
> > +they are not inlined into a MIPS16 function.
> 
> This flag applies to microMIPS inlining, too, right? 

That's correct.

> It's confusing to only mention MIPS16.

Indeed.  The option originated from MIPS16 but it can be applied to microMIPS
and it's better to mention it.

> 
> Maybe you could say something like this instead:
> 
> Allow inlining even if the compression flags differ between caller and
> callee.  This is useful in conjunction with the @code{mips16},
> @code{micromips}, or @code{nocompression} function attributes.  The code
> for the inlined function is compiled using the compression flags for the
> callee, so you may need to use the @code{noinline} attribute on
> functions that must be compiled with particular compression settings.

This sounds better.

Thanks and regards,
Robert

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH][MIPS] Add -minline-intermix to ignore compression flags when inlining
  2016-05-25 10:16   ` Robert Suchanek
@ 2016-06-09 15:16     ` Maciej W. Rozycki
  0 siblings, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2016-06-09 15:16 UTC (permalink / raw)
  To: Robert Suchanek
  Cc: Sandra Loosemore, Catherine_Moore, Matthew Fortune, gcc-patches

On Wed, 25 May 2016, Robert Suchanek wrote:

> > > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> > > index 73f1cb6..2f6195e 100644
> > > --- a/gcc/doc/invoke.texi
> > > +++ b/gcc/doc/invoke.texi
> > > @@ -837,6 +837,7 @@ Objective-C and Objective-C++ Dialects}.
> > >   -mips16  -mno-mips16  -mflip-mips16 @gol
> > >   -minterlink-compressed -mno-interlink-compressed @gol
> > >   -minterlink-mips16  -mno-interlink-mips16 @gol
> > > +-minline-intermix -mno-inline-intermix @gol
> > 
> > Funky indentation here....
> 
> I'm not sure what's wrong here, it's the diff I'd say.  There is no
> indentation within "MIPS Options".

 Two spaces rather than one are used between individual options (modulo 
formatting errata in some previous additions).

  Maciej

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-09 15:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-24 15:40 [PATCH][MIPS] Add -minline-intermix to ignore compression flags when inlining Robert Suchanek
2016-05-25  7:47 ` Sandra Loosemore
2016-05-25 10:16   ` Robert Suchanek
2016-06-09 15:16     ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).