automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Optimisation across source files.


From: Dr. David Kirkby
Subject: Optimisation across source files.
Date: Fri, 04 Apr 2003 21:44:07 +0100

Hi,
        I don't know about other programmers, but I tend to put one function
in each source file. So function foo() goes into foo.c. Looking
carefully at the documentation for Sun's c compiler, I not that the
optimiser will only try to inline functions in the same source file,
so my method of one source function/file, effectively stops the
optimiser from inlining any functions. However, Sun's compiler has an
option, -xcrossfile which will attempt to inline functions across
files. Great one thinks, just add that option. 

However, it the documentation then says "The files produced from this
compilation are interdependent due to possible inlining, and must be
used as a unit when they are linked into a program. If any one routine
is changed and the files recompiled, they must all be recompiled. As a
result, using this options affects the construction of make files

The default is -xcrossfile=0, and no crossfile optimizations are
performed. -xcrossfile is equivalent to -xcrossfile=1"

This suggests to me that automake should be aware of such a compiler
option. I don't know if this only affects Sun's compilers, or others
too. After thinking about this, I assume no compiler can inline code
in another file without rebuilding like this. 
Do others think this is within the scope of automake, or perhaps that
someone compiling with such an option should take care of this
entirely themselves? The easy options is the latter, but then someone
building from someone else's source code might not know exactly what
files are interdependent. 

Certainly reading the Sun compiler manual has made me re-think my
practice of putting each function (except very small ones) in their
own source file. 

It does not seem unreasonable for automake to keep a list of compiler
options like this (even if there is one per compiler), and if detected
build the makefile such that changes in any source file cause all
those files that are every linked with that file to be rebuilt, even
if their source has not changed. 

-- 
Dr. David Kirkby,
Senior Research Fellow,
Department of Medical Physics,
University College London,
11-20 Capper St, London, WC1E 6JA.
Tel: 020 7679 6408 Fax: 020 7679 6269
Internal telephone: ext 46408
e-mail address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]