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]

Re: questions about improving i386 PIC code



  In message <199806062225.SAA06671@jwlab.FEITH.COM>you write:
  > It seems to me that local_function shouldn't need to reload
  > the pic register (%ebx) since it's only called from another
  > function in the same source file.
Presumably correct for whatever PIC scheme you're using.  The
particular GOT/PLT scheme drives exactly whether or not this
kind of optimization is safe.

  > What's the feasibility / ramifications of deferring generating
  > the assembler code for static functions until all other functions
  > have been compiled?  This way we can detect if the function is
  > only referenced in calls in which case the pic register doesn't
  > need to be reloaded.
It's expensive, as you'd basically have to use the inlining mechanism
to defer final compilation of such functions.  This means the
entire function has to be stored as RTL until you're done with the
current compilation unit.

  > Assuming that this makes sense ... any pointers at what code
  > I should be examining in order to:
  > 
  >   1) Defer outputting static functions.
-finline-functions effectively does this.  Of course, you'd want
to avoid actually inlining the function unless function inlining
was requested.


  >   2) Detect if a static function is used in some fashion
  >      other than by being called.
You might want to look as the rs6000 and alpha ports.  I believe
the alpha already does something of this nature for static functions.

jeff


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