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]

Re: i386 PIC improvement for static functions.


The SGI Irix5 tools perform a similar optimization in the linker.
At that time it is easy to tell whether a function ever has its address taken,
there will be a relocation using it.  It is however more difficult to do
the optimization then, as the linker needs to rewrite the code a bit,
and you need to hack the linker instead of hacking the compiler.  This
does avoid the memory usage problems though if we try to do this in
gcc.

Alternatively, maybe we can do some kind of two pass compilation.  If we
parse the input file (throwing away trees and RTL) just to figure out what
functions have their addresses taken, and then parse it for real a second
time, this avoids needing to keep all of the trees and/or RTL in memory
until the end.  This does mean we pay the cost of parsing it twice though.
I think the Chill front end does something like this, because variables can
be used before their types have been declared or something like that.

If we do defer all static functions, I think there will be serious memory
usage problems.

Jim


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