This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: IPO over multiple source files
- From: Ian Lance Taylor <iant at google dot com>
- To: sroy <sroy at cse dot usf dot edu>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 18 May 2009 08:42:47 -0700
- Subject: Re: IPO over multiple source files
- References: <23589884.post@talk.nabble.com>
sroy <sroy@cse.usf.edu> writes:
> Does gcc (4.2 and above) have the capability to perform interprocedural
> analyses and optimizations over multiple source files? For example, there
> are two files a.c and b.c (shown below)
>
> File a.c:
> ------------
> #include<stdio.h>
> static int foo (int i, int j) {return i*j;}
> int main (void) {printf ("%d\n", foo (10, foo1 ()));return 0;}
>
> File b.c:
> ------------
> int foo1 (void) {return 10;}
>
> What options, if any, will enable inlining of the body of foo1 () into
> main()?
In gcc 4.2 there is the -combine option. It only works for C, not C++
or any other language. It can not handle very large programs.
There is active work on multiple source file work under the name LTO.
This work is currently being merged into the gcc development sources,
and will be available in gcc 4.5.
Ian