public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Faster compilation speed
@ 2002-08-09 12:17 Mike Stump
  2002-08-09 13:04 ` Noel Yap
                   ` (6 more replies)
  0 siblings, 7 replies; 173+ messages in thread
From: Mike Stump @ 2002-08-09 12:17 UTC (permalink / raw)
  To: gcc

I'd like to introduce lots of various changes to improve compiler 
speed.  I thought I should send out an email and see if others think 
this would be good to have in the tree.  Also, if it is, I'd like to 
solicit any ideas others have for me to pursue.  I'd be happy to do all 
the hard work, if you come up with the ideas!  The target is to be 6x 
faster.

The first realization I came to is that the only existing control for 
such things is -O[123], and having thought about it, I think it would 
be best to retain and use those flags.  For minimal user impact, I 
think it would be good to not perturb existing users of -O[0123] too 
much, or at leaast, not at first.  If we wanted to change them, I think 
-O0 should be the `fast' version, -O1 should be what -O0 does now with 
some additions around the edges, and -O2 and -O3 also slide over (at 
least one).  What do you think, slide them all over one or more, or 
just make -O0 do less, or...?  Maybe we have a -O0.0 to mean compile 
very quickly?

Another question would be how many knobs should we have?  At first, I 
am inclined to say just one.  If we want, we can later break them out 
into more choices.  I am mainly interested in a single knob at this 
point.

Another question is, what should the lower limit be on uglifying code 
for the sake of compilation speed.

Below are some concrete ideas so others can get a feel for the types of 
changes, and to comment on the flag and how it is used.
While I give a specific example, I'm more interested in the upper level 
comments, than discussion of not combining temp slots.

The use of a macro preprocessor symbol allows us to replace it with 0 
or 1, should we want to obtain a compiler that is unconditionally 
faster, or one that doesn't have any extra code in it.

This change yields a 0.9% speed improvement when compiling expr.c.  Not 
much, but if the compiler were 6x faster, this would be 5.5% change in 
compilation speed.  The resulting code is worse, but not by much.

So, let the discussion begin...


Doing diffs in flags.h.~1~:
*** flags.h.~1~ Fri Aug  9 10:17:36 2002
--- flags.h     Fri Aug  9 10:37:58 2002
*************** extern int flag_signaling_nans;
*** 696,699 ****
--- 696,705 ----
  #define HONOR_SIGN_DEPENDENT_ROUNDING(MODE) \
    (MODE_HAS_SIGN_DEPENDENT_ROUNDING (MODE) && 
!flag_unsafe_math_optimizations)

+ /* Nonzero for compiling as fast as we can.  */
+
+ extern int flag_speed_compile;
+
+ #define SPEEDCOMPILE flag_speed_compile
+
  #endif /* ! GCC_FLAGS_H */
--------------
Doing diffs in function.c.~1~:
*** function.c.~1~      Fri Aug  9 10:17:36 2002
--- function.c  Fri Aug  9 10:37:58 2002
*************** free_temp_slots ()
*** 1198,1203 ****
--- 1198,1206 ----
  {
    struct temp_slot *p;

+   if (SPEEDCOMPILE)
+     return;
+
    for (p = temp_slots; p; p = p->next)
      if (p->in_use && p->level == temp_slot_level && ! p->keep
        && p->rtl_expr == 0)
*************** free_temps_for_rtl_expr (t)
*** 1214,1219 ****
--- 1217,1225 ----
  {
    struct temp_slot *p;

+   if (SPEEDCOMPILE)
+     return;
+
    for (p = temp_slots; p; p = p->next)
      if (p->rtl_expr == t)
        {
*************** pop_temp_slots ()
*** 1301,1311 ****
  {
    struct temp_slot *p;

!   for (p = temp_slots; p; p = p->next)
!     if (p->in_use && p->level == temp_slot_level && p->rtl_expr == 0)
!       p->in_use = 0;

!   combine_temp_slots ();

    temp_slot_level--;
  }
--- 1307,1320 ----
  {
    struct temp_slot *p;

!   if (! SPEEDCOMPILE)
!     {
!       for (p = temp_slots; p; p = p->next)
!       if (p->in_use && p->level == temp_slot_level && p->rtl_expr == 
0)
!         p->in_use = 0;

!       combine_temp_slots ();
!     }

    temp_slot_level--;
  }
--------------
Doing diffs in toplev.c.~1~:
*** toplev.c.~1~        Fri Aug  9 10:17:40 2002
--- toplev.c    Fri Aug  9 11:31:50 2002
*************** int flag_new_regalloc = 0;
*** 894,899 ****
--- 894,903 ----

  int flag_tracer = 0;

+ /* If nonzero, speed-up the compile as fast as we can.  */
+
+ int flag_speed_compile = 0;
+
  /* Values of the -falign-* flags: how much to align labels in code.
     0 means `use default', 1 means `don't align'.
     For each variable, there is an _log variant which is the power
*************** display_help ()
*** 3679,3684 ****
--- 3683,3689 ----

    printf (_("  -O[number]              Set optimization level to 
[number]\n"));
    printf (_("  -Os                     Optimize for space rather than 
speed\n"));
+   printf (_("  -Of                     Compile as fast as 
possible\n"));
    for (i = LAST_PARAM; i--;)
      {
        const char *description = compiler_params[i].help;
*************** parse_options_and_default_flags (argc, a
*** 4772,4777 ****
--- 4777,4786 ----
              /* Optimizing for size forces optimize to be 2.  */
              optimize = 2;
            }
+         else if ((p[0] == 'f') && (p[1] == 0))
+           {
+             flag_speed_compile = 1;
+           }
          else
            {
              const int optimize_val = read_integral_parameter (p, p - 
2, -1);
--------------


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

end of thread, other threads:[~2002-08-23 15:39 UTC | newest]

Thread overview: 173+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-09 12:17 Faster compilation speed Mike Stump
2002-08-09 13:04 ` Noel Yap
2002-08-09 13:10   ` Matt Austern
2002-08-09 14:22   ` Neil Booth
2002-08-09 14:44     ` Noel Yap
2002-08-09 15:14       ` Neil Booth
2002-08-10 15:54         ` Noel Yap
2002-08-09 15:13   ` Stan Shebs
2002-08-09 15:18     ` Neil Booth
2002-08-10 16:12       ` Noel Yap
2002-08-10 18:00         ` Nix
2002-08-10 20:36           ` Noel Yap
2002-08-11  4:30             ` Nix
2002-08-12 15:08           ` Mike Stump
2002-08-09 15:19     ` Ziemowit Laski
2002-08-09 15:25       ` Neil Booth
2002-08-10 16:16       ` Noel Yap
2002-08-10 16:07     ` Noel Yap
2002-08-10 16:18       ` Neil Booth
2002-08-10 20:27         ` Noel Yap
2002-08-11  0:11           ` Neil Booth
2002-08-12 12:04             ` Devang Patel
2002-08-09 18:57   ` Linus Torvalds
2002-08-09 19:12     ` Phil Edwards
2002-08-09 19:34     ` Kevin Atkinson
2002-08-09 20:28       ` Linus Torvalds
2002-08-09 21:12         ` Daniel Berlin
2002-08-09 21:52           ` Linus Torvalds
2002-08-10  6:32         ` Robert Lipe
2002-08-10 14:26           ` Cyrille Chepelov
2002-08-10 17:33             ` Daniel Berlin
2002-08-10 18:21               ` Linus Torvalds
2002-08-10 18:38                 ` Daniel Berlin
2002-08-10 18:39                 ` Cyrille Chepelov
2002-08-10 18:28               ` Cyrille Chepelov
2002-08-10 18:30                 ` John Levon
2002-08-11  1:03             ` Florian Weimer
2002-08-10 19:20     ` Noel Yap
2002-08-09 13:10 ` Aldy Hernandez
2002-08-09 15:28   ` Mike Stump
2002-08-09 16:00     ` Aldy Hernandez
2002-08-09 16:26       ` Stan Shebs
2002-08-09 16:31         ` Aldy Hernandez
2002-08-09 16:51           ` Stan Shebs
2002-08-09 16:54             ` Aldy Hernandez
2002-08-09 17:44             ` Daniel Berlin
2002-08-09 18:35               ` David S. Miller
2002-08-09 18:39                 ` Aldy Hernandez
2002-08-09 18:59                   ` David S. Miller
2002-08-09 20:01                   ` Per Bothner
2002-08-09 18:25             ` David S. Miller
2002-08-13  0:50               ` Loren James Rittle
2002-08-13 21:46                 ` Fergus Henderson
2002-08-13 22:40                   ` David S. Miller
2002-08-13 23:44                     ` Fergus Henderson
2002-08-14  7:58                     ` Jeff Sturm
2002-08-14  9:52                     ` Richard Henderson
2002-08-14 10:00                       ` David Edelsohn
2002-08-14 12:01                         ` Andreas Schwab
2002-08-14 12:07                           ` David Edelsohn
2002-08-14 13:20                             ` Michael Matz
2002-08-14 16:31                               ` Faster compilation speed [zone allocation] Per Bothner
2002-08-15 11:34                                 ` Aldy Hernandez
2002-08-15 11:39                                   ` David Edelsohn
2002-08-15 12:01                                     ` Lynn Winebarger
2002-08-15 12:11                                       ` David Edelsohn
2002-08-15 11:41                                   ` Michael Matz
2002-08-16  8:44                                     ` Kai Henningsen
2002-08-15 11:43                                   ` Per Bothner
2002-08-15 11:57                                   ` Kevin Handy
2002-08-14 13:20                             ` Faster compilation speed Jamie Lokier
2002-08-14 16:01                               ` Nix
2002-08-14 10:15                       ` David Edelsohn
2002-08-14 16:35                         ` Richard Henderson
2002-08-14 17:02                           ` David Edelsohn
2002-08-20  4:15                         ` Richard Earnshaw
2002-08-20  5:38                           ` Jeff Sturm
2002-08-20  5:53                             ` Richard Earnshaw
2002-08-20 13:42                               ` Jeff Sturm
2002-08-22  1:55                                 ` Richard Earnshaw
2002-08-22  2:03                                   ` David S. Miller
2002-08-23 15:39                                   ` Jeff Sturm
2002-08-20  8:00                           ` David Edelsohn
2002-08-14  7:36                   ` Jeff Sturm
2002-08-10 10:02             ` Neil Booth
2002-08-09 17:36         ` Daniel Berlin
2002-08-12 16:23         ` Mike Stump
2002-08-12 16:05       ` Mike Stump
2002-08-09 19:07     ` David Edelsohn
2002-08-09 14:29 ` Neil Booth
2002-08-09 15:02   ` Nathan Sidwell
2002-08-09 17:05     ` Stan Shebs
2002-08-10  2:21     ` Gabriel Dos Reis
2002-08-12 12:11   ` Mike Stump
2002-08-12 12:41     ` David Edelsohn
2002-08-12 12:47       ` Matt Austern
2002-08-12 12:56         ` David S. Miller
2002-08-12 13:56           ` Matt Austern
2002-08-12 14:27             ` Daniel Berlin
2002-08-12 15:26               ` David Edelsohn
2002-08-13 10:49                 ` David Edelsohn
2002-08-13 10:52                   ` David S. Miller
2002-08-13 14:03                   ` David Edelsohn
2002-08-13 14:46                     ` Geoff Keating
2002-08-13 15:10                       ` David Edelsohn
2002-08-13 15:26                         ` Neil Booth
2002-08-14  9:25                     ` Kevin Handy
2002-08-18 12:58                     ` Jeff Sturm
2002-08-19 12:55                       ` Mike Stump
2002-08-20 11:22                       ` Will Cohen
2002-08-13 15:32                   ` Daniel Berlin
2002-08-13 15:58                     ` David Edelsohn
2002-08-13 16:49                       ` David S. Miller
2002-08-12 14:59             ` David S. Miller
2002-08-12 16:00             ` Geoff Keating
2002-08-13  2:58               ` Nick Ing-Simmons
2002-08-13 10:47               ` Richard Henderson
2002-08-12 14:28           ` Stan Shebs
2002-08-12 15:05             ` David S. Miller
2002-08-12 19:17     ` Mike Stump
2002-08-12 23:28       ` Neil Booth
2002-08-09 14:51 ` Stan Shebs
2002-08-09 15:03   ` David Edelsohn
2002-08-09 15:43     ` Stan Shebs
2002-08-09 16:43     ` Alan Lehotsky
2002-08-09 16:49       ` Matt Austern
2002-08-10  2:24         ` Gabriel Dos Reis
2002-08-09 15:26   ` Geoff Keating
2002-08-09 16:06     ` Stan Shebs
2002-08-09 16:14       ` Terry Flannery
2002-08-09 16:29         ` Neil Booth
2002-08-09 16:29       ` Phil Edwards
2002-08-12 16:24         ` Mike Stump
2002-08-12 18:38           ` Phil Edwards
2002-08-13  5:27           ` Theodore Papadopoulo
2002-08-13 10:03             ` Mike Stump
2002-08-12 15:55     ` Mike Stump
2002-08-09 14:59 ` Timothy J. Wood
2002-08-16 13:31   ` Problem with PFE approach [Was: Faster compilation speed] Timothy J. Wood
2002-08-16 13:44     ` Devang Patel
2002-08-16 14:31       ` Timothy J. Wood
2002-08-16 14:39         ` Neil Booth
2002-08-16 14:46         ` Devang Patel
2002-08-16 13:54     ` Devang Patel
2002-08-16 14:42       ` Neil Booth
2002-08-16 14:57         ` Devang Patel
2002-08-17 15:31           ` Timothy J. Wood
2002-08-17 20:04             ` Daniel Berlin
2002-08-17 20:07               ` Andrew Pinski
2002-08-17 20:14               ` Timothy J. Wood
2002-08-17 20:21                 ` Daniel Berlin
2002-08-18  3:17                   ` Kai Henningsen
2002-08-18  7:36                     ` Daniel Berlin
2002-08-18 11:20                       ` jepler
2002-08-18 13:20                         ` Daniel Berlin
2002-08-18 14:31                           ` Timothy J. Wood
2002-08-18 14:35                             ` Andrew Pinski
2002-08-18 14:55                               ` Timothy J. Wood
2002-08-19  2:41                             ` Michael Matz
2002-08-19  6:26                               ` jepler
2002-08-19  6:40                                 ` Daniel Berlin
2002-08-19 11:50                                 ` Devang Patel
2002-08-19 12:55                                   ` Jeff Epler
2002-08-19 13:03                                     ` Ziemowit Laski
2002-08-19 11:53                               ` Devang Patel
2002-08-19 11:59                 ` Devang Patel
2002-08-17 20:15             ` Daniel Berlin
2002-08-19  7:07             ` Stan Shebs
2002-08-19  8:52               ` Timothy J. Wood
2002-08-16 14:45       ` Timothy J. Wood
2002-08-09 16:01 ` Faster compilation speed Richard Henderson
2002-08-10 17:48 ` Aaron Lehmann
2002-08-12 10:36   ` Dale Johannesen

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