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]

[RFC] unit-at-time compilation mode


Hi,
I am attaching patch I made for unit-at-time compilation.  It misses
documentation but except that I hope it is in a quality acceptable for
mainline.  It also works for C only at the moment, in case the approach
is acceptable, I would like to continue by adding C++, Java and obj-C
support, but C++ one is quite nontrivial (I have working obj-C patch).

I am also attaching results.  I've implemented few basic optimizations -
backward inlining, inlining of functions called just once and using
custom calling convention for static functions whose address is not
taken and I do topologically sort the functions so we better propagate
data across them.

Overall it brings about 1% speedup for -O3 and 0.7% for -O2 for specint.
On -O2 compilation it also saves about 1% of code and does not seem to
make compiler slower.  In -O3 compilation compiler is slower because
more code is produced because we get more inlining.  Also bootstrap in
unit-at-time is about 9% slower - I believe it is because the -O2
balanced results are caused by the fact that compiler itself gets
faster.

The patch attempts to implement things common to any intraprocedural
optimizer for so we have something to base future discussion and
experiments on.  It has callgraph building code in a stand alone
datastructure that I hope will be easy to save into database once we get
intramodule IPO on place.

The main change it that it replaces function deffering mechanizm
implemented in frontend by generic code and uses hooks to control
frontends compilation.  This also seems to be major problem for C++,
where the decision when function is output is based on whether the
symbol has been used in asm output making it dificult to construct
explicit callgraph before expansion is done.

In the case there are no major complains against my approach, I would
like to split the patch into three parts (callgraph code, inlining and
calling convention change) and submit it for review to mainline.
Even when it is far from what I would like to see done in IPA, I think
other changes can be made incrementally.

Honza

Attachment: gopt-f6
Description: Text document

Attachment: o3int
Description: Text document

Attachment: o2int
Description: Text document

Attachment: o3fp
Description: Text document

Attachment: o2fp
Description: Text document


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