diff mbox

[DOC] Enhance documentation of -fipa-ra option.

Message ID 50188e44-5982-4a8a-7f66-52f6ba866d11@suse.cz
State New
Headers show

Commit Message

Martin Liška July 13, 2016, 4:28 p.m. UTC
Hello.

I accidentally learned that -fipa-ra option is disabled if:

 /* Do not use IPA optimizations for register allocation if profiler is active
    or port does not emit prologue and epilogue as RTL.  */
  if (profile_flag || !targetm.have_prologue () || !targetm.have_epilogue ())
    flag_ipa_ra = 0;

So I basically copied the comment to invoke.texi.

Apart from that, I've noticed that '-fprofile' (which is alias of '-p') is not documented.
Shouldn't it be documented as an alias?

Thanks,
Martin

Comments

Alexander Monakov July 13, 2016, 5:04 p.m. UTC | #1
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -7260,7 +7260,9 @@ any called function.  In that case it is not necessary to save and restore
>  them around calls.  This is only possible if called functions are part of
>  same compilation unit as current function and they are compiled before it.
>  
> -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
> +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
> +is disabled if profiler is active (@option{-p}, @option{-pg} or

I think this should say "if generated code will be instrumented for profiling"
(or "is instrumented") instead of "if profiler is active".  Internal comments
can be fuzzy, but user-facing documentation should be more rigorous.

> +@option{-fprofile})

Right now option -fprofile is not documented, so it's probably not ok to
mention it here (I realize it won't be so if you document it as an alias).

> or a port does not emit prologue and epilogue as RTL.

May I suggest "or if callee's register usage cannot be known exactly (this
happens on targets that do not expose prologues and epilogues in RTL)"?

(well, this is still not 100% helpful to the user because they can't easily know
which targets do, but still a bit of an improvement)

Thanks for bringing this forward!  The bit about profiling is especially not
obvious and nice to have documented.

Alexander
diff mbox

Patch

From e43eb357b986234e0454e6f6898ef5ae46a7a596 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 13 Jul 2016 18:25:09 +0200
Subject: [PATCH] Enhance documentation of -fipa-ra option.

gcc/ChangeLog:

2016-07-13  Martin Liska  <mliska@suse.cz>

	* doc/invoke.texi (-fipa-ra): Document when the option is
	disabled. Fix a typo.
---
 gcc/doc/invoke.texi | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 9a4db38..647caae 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -7260,7 +7260,9 @@  any called function.  In that case it is not necessary to save and restore
 them around calls.  This is only possible if called functions are part of
 same compilation unit as current function and they are compiled before it.
 
-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
+is disabled if profiler is active (@option{-p}, @option{-pg} or
+@option{-fprofile}) or a port does not emit prologue and epilogue as RTL.
 
 @item -fconserve-stack
 @opindex fconserve-stack
@@ -7280,7 +7282,7 @@  Perform code hoisting.  Code hoisting tries to move the
 evaluation of expressions executed on all paths to the function exit
 as early as possible.  This is especially useful as a code size
 optimization, but it often helps for code speed as well.
-This flag is enabled by defailt at @option{-O2} and higher.
+This flag is enabled by default at @option{-O2} and higher.
 
 @item -ftree-pre
 @opindex ftree-pre
-- 
2.8.4