This is the mail archive of the gcc@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]

Re: Beginner's question:Are there any inter-procedural optimizationin GCC backend ?


Chunhua Liao wrote:
I am new in GCC development. I am wondering if there are any inter-procedural optimizations
on RTL representation in GCC backend. If yes, what are they(or function names)? Thanks

There isn't much.


There are political problems that have obstructed our implementation of inter procedural optimizations, as FSF policy forbids us from having a way to store/load RTL to/from files. This policy exists to prevent people from subverting the GPL, but as side effect is that it prevents us from having inter procedural optimizations, except within files.

We do have function inlining in RTL, and this has been around for a long time, but this is on the way out, because RTL is too low level for this optimization. It is being replaced with a tree level function inliner. The RTL function inliner is in integrate.c.

There is code in cgraph* that is enabled by the -funit-at-a-time option, which is now the default at -O2. This causes us to parse all functions before emitting any output, thus allowing some interprocedural optimizations within a file. However, this only does a few limited things. It can identify functions that are unused. It can identify functions which are good candidates for inlining. It probably doesn't do what you are looking for.

You might be interested in the tree-ssa project. This is adding a new higher level intermediate format to gcc, which is better for higher level optimizations. This might be a better place for interprocedural optimizations.

You might also be interested in LLVM, which has link time interprocedural optimizations. http://llvm.cs.uiuc.edu/
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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