public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [lto] PATCH: move -fwpa/-fltrans to lto1
@ 2008-10-02 11:10 Ollie Wild
  2008-10-02 11:50 ` Diego Novillo
  0 siblings, 1 reply; 4+ messages in thread
From: Ollie Wild @ 2008-10-02 11:10 UTC (permalink / raw)
  To: gcc-patches, Diego Novillo, Doug Kwan

[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]

This patch moves the -fwpa and -fltrans flags out of the common
options file and into the lto1 options file.  It moves
post-processing/validation of these options to the lto_post_options
function, and removes the RejectNegative attribute (which I believe
was only there because post-processing/validation was being
incorrectly done inline with option handling).

While I'm at it, this patch also moves -flto out of the common options
file, making it C/C++ specific.  Let's face it, by the time this
merges to mainline, we won't support any other languages, and -flto is
incompatible with -fwpa/-fltrans in the lto front end.

Tested with an i686-pc-linux-gnu C/C++/LTO bootstrap and testsuite.

Ollie


2008-10-02  Ollie Wild  <aaw@google.com>

        * lang.opt (fltrans): Moved from common.opt.  Remove RejectNegative
        and Init.
        (fwpa): Moved from common.opt.  Remove RejectNegative and Init.
        * lto-lang.c (lto_post_options): Add validation and fixups for
        -fltrans and -fwpa.

2008-10-02  Ollie Wild  <aaw@google.com>

        * c.opt (flto): Moved from common.opt.  Remove RejectNegative.
        * common.opt (flto): Moved to c.opt.
        (fltrans): Moved to lto/lang.opt.
        (fwpa): Moved to lto/lang.opt.
        * opts.c (common_handle_option): Remove -fltrans and -fwpa validation.

[-- Attachment #2: move-options.txt --]
[-- Type: text/plain, Size: 4212 bytes --]

commit 5bbe21a793f01393b0fb5d7493bf24c961a90a4c
Author: Ollie Wild <aaw@google.com>
Date:   Wed Oct 1 13:29:45 2008 -0700

    Option cleanup.
    
    Make -flto a C/C++ option.  Make -fwpa and -fltrans LTO options.
    Allow negative forms of all three.

diff --git a/gcc/c.opt b/gcc/c.opt
index d33fa46..d30e212 100644
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -624,6 +624,10 @@ flax-vector-conversions
 C ObjC C++ ObjC++
 Allow implicit conversions between vectors with differing numbers of subparts and/or differing element types.
 
+flto
+C C++ Var(flag_generate_lto)
+Enable link-time optimization.
+
 fms-extensions
 C ObjC C++ ObjC++
 Don't warn about uses of Microsoft extensions
diff --git a/gcc/common.opt b/gcc/common.opt
index fa0361e..e7f8159 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -717,14 +717,6 @@ floop-optimize
 Common
 Does nothing.  Preserved for backward compatibility.
 
-flto
-Common  RejectNegative Var(flag_generate_lto)
-Causes Link Time Optimization to be written into the object file. 
-
-fltrans
-Common  RejectNegative Report Var(flag_ltrans) Init(0) Optimization
-Run Link-time Optimizer in Local-Transformation mode
-
 fmath-errno
 Common Report Var(flag_errno_math) Init(1) Optimization
 Set errno after built-in math functions
@@ -1360,10 +1352,6 @@ fwhole-program
 Common Report Var(flag_whole_program) Init(0) Optimization
 Perform whole program optimizations
 
-fwpa
-Common RejectNegative Report Var(flag_wpa) Init(0) Optimization
-Run Link-time Optimizer in Whole-Program-Analysis mode
-
 fwrapv
 Common Report Var(flag_wrapv) Optimization
 Assume signed arithmetic overflow wraps around
diff --git a/gcc/lto/lang.opt b/gcc/lto/lang.opt
index 9b9830e..4afc2cb 100644
--- a/gcc/lto/lang.opt
+++ b/gcc/lto/lang.opt
@@ -24,6 +24,10 @@
 Language
 LTO
 
+fltrans
+LTO Report Var(flag_ltrans) Optimization
+Run the link-time optimizer in local transformation (LTRANS) mode.
+
 fltrans-driver=
 LTO Joined Var(ltrans_driver)
 Specify an executable for performing local transformations on WPA output.
@@ -32,6 +36,10 @@ fltrans-output-list=
 LTO Joined Var(ltrans_output_list)
 Specify a file to which a list of files output by LTRANS is written.
 
+fwpa
+LTO Report Var(flag_wpa) Optimization
+Run the link-time optimizer in whole program analysis (WPA) mode.
+
 resolution
 LTO Separate
 The resolution file
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index 14b860e..f936c67 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -709,6 +709,16 @@ lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
   write_symbols = NO_DEBUG;
   debug_info_level = DINFO_LEVEL_NONE;
 
+  /* -fltrans and -fwpa are mutually exclusive.  Check for that here.  */
+  if (flag_wpa && flag_ltrans)
+    error ("-fwpa and -fltrans are mutually exclusive.");
+
+  if (flag_ltrans)
+    flag_generate_lto = 0;
+
+  if (flag_wpa)
+    flag_generate_lto = 1;
+
   /* Initialize the compiler back end.  */
   return false;
 }
diff --git a/gcc/opts.c b/gcc/opts.c
index 49212cf..0496da6 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1766,26 +1766,6 @@ common_handle_option (size_t scode, const char *arg, int value,
     case OPT_ffast_math:
       set_fast_math_flags (value);
       break;
-
-    case OPT_flto:
-      /* -flto must not be given when -fltrans is given and not overriden. */
-      if (flag_ltrans)
-	error ("Cannot specify -flto when -fltrans is effective.");
-      break;
-
-    case OPT_fltrans:
-      if (lang_mask & CL_LTO)
-	{
-	  /* -fltrans implies -fno-lto and -fno-wpa. */
-	  flag_generate_lto = 0;
-	  flag_wpa = 0;
-	}
-      else
-	{
-	  flag_ltrans = 0; 
-	  return 0;
-	}
-      break;
  
     case OPT_funsafe_math_optimizations:
       set_unsafe_math_optimizations_flags (value);
@@ -2058,20 +2038,6 @@ common_handle_option (size_t scode, const char *arg, int value,
       flag_unroll_loops_set = true;
       break;
 
-    case OPT_fwpa:
-      if (lang_mask & CL_LTO)
-	{
-	  /* -fwpa implies -flto and -fno-ltrans. */
-	  flag_generate_lto = 1;
-	  flag_ltrans = 0;
-	}
-	else
-	  {
-	    flag_wpa = 0;
-	    return 0;
-	  }
-      break;
-
     case OPT_g:
       set_debug_level (NO_DEBUG, DEFAULT_GDB_EXTENSIONS, arg);
       break;

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

* Re: [lto] PATCH: move -fwpa/-fltrans to lto1
  2008-10-02 11:10 [lto] PATCH: move -fwpa/-fltrans to lto1 Ollie Wild
@ 2008-10-02 11:50 ` Diego Novillo
  2008-10-02 12:13   ` Richard Guenther
  0 siblings, 1 reply; 4+ messages in thread
From: Diego Novillo @ 2008-10-02 11:50 UTC (permalink / raw)
  To: Ollie Wild; +Cc: gcc-patches, Doug Kwan

On Thu, Oct 2, 2008 at 05:37, Ollie Wild <aaw@google.com> wrote:

> While I'm at it, this patch also moves -flto out of the common options
> file, making it C/C++ specific.  Let's face it, by the time this
> merges to mainline, we won't support any other languages, and -flto is
> incompatible with -fwpa/-fltrans in the lto front end.

Agreed.  Other front ends will should be trivially supported when we
add a proper type system to gimple, but for now it's not something we
can easily support.

> 2008-10-02  Ollie Wild  <aaw@google.com>
>
>        * lang.opt (fltrans): Moved from common.opt.  Remove RejectNegative
>        and Init.
>        (fwpa): Moved from common.opt.  Remove RejectNegative and Init.
>        * lto-lang.c (lto_post_options): Add validation and fixups for
>        -fltrans and -fwpa.
>
> 2008-10-02  Ollie Wild  <aaw@google.com>
>
>        * c.opt (flto): Moved from common.opt.  Remove RejectNegative.
>        * common.opt (flto): Moved to c.opt.
>        (fltrans): Moved to lto/lang.opt.
>        (fwpa): Moved to lto/lang.opt.
>        * opts.c (common_handle_option): Remove -fltrans and -fwpa validation.

OK, thanks.


Diego.

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

* Re: [lto] PATCH: move -fwpa/-fltrans to lto1
  2008-10-02 11:50 ` Diego Novillo
@ 2008-10-02 12:13   ` Richard Guenther
  2008-10-02 12:59     ` Diego Novillo
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Guenther @ 2008-10-02 12:13 UTC (permalink / raw)
  To: Diego Novillo; +Cc: Ollie Wild, gcc-patches, Doug Kwan

On Thu, Oct 2, 2008 at 1:09 PM, Diego Novillo <dnovillo@google.com> wrote:
> On Thu, Oct 2, 2008 at 05:37, Ollie Wild <aaw@google.com> wrote:
>
>> While I'm at it, this patch also moves -flto out of the common options
>> file, making it C/C++ specific.  Let's face it, by the time this
>> merges to mainline, we won't support any other languages, and -flto is
>> incompatible with -fwpa/-fltrans in the lto front end.
>
> Agreed.  Other front ends will should be trivially supported when we
> add a proper type system to gimple, but for now it's not something we
> can easily support.

*sigh*

And I thought for LTO we would properly make prerequesites happen instead
of hacking in yet another -combine thing.

Also I am scared by "by the time this merges to mainline" ...

:/

Richard.

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

* Re: [lto] PATCH: move -fwpa/-fltrans to lto1
  2008-10-02 12:13   ` Richard Guenther
@ 2008-10-02 12:59     ` Diego Novillo
  0 siblings, 0 replies; 4+ messages in thread
From: Diego Novillo @ 2008-10-02 12:59 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Ollie Wild, gcc-patches, Doug Kwan

On Thu, Oct 2, 2008 at 07:49, Richard Guenther
<richard.guenther@gmail.com> wrote:

> And I thought for LTO we would properly make prerequesites happen instead
> of hacking in yet another -combine thing.

We are.  But at the moment, the type system gimplification and
language dependencies removal are not fully realized, so it's
misleading to pretend that other languages will Just Work; they won't.

We will focus on C++/C for the next while.  If there is interest in
tackling type gimplification in other front ends, we can leave this
option in common.opt.  It's only a 2 line patch, after all.  Do you
think you'll be interested in working on the other front ends?

The only real obstacle to supporting arbitrary front ends is type
gimplification.  We have the beginnings of such a thing in
pass_ipa_free_lang_specifics, but that is very primitive and it only
really solves enough of the problem to produce workable output for
lto1.

Type gimplification would ideally be done independently of LTO.  It is
likely going to be a lot of work, as it has similar representation
issues as tuples and it also has major debugging issues to address.
Kenny had started working on this a couple of months ago, but I don't
know what the status of that work is.


Diego.

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

end of thread, other threads:[~2008-10-02 12:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-02 11:10 [lto] PATCH: move -fwpa/-fltrans to lto1 Ollie Wild
2008-10-02 11:50 ` Diego Novillo
2008-10-02 12:13   ` Richard Guenther
2008-10-02 12:59     ` Diego Novillo

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).