PATCH: New Optimization: Partitioning hot & cold basic blocks

law@redhat.com law@redhat.com
Thu Jan 29 18:17:00 GMT 2004


In message <20040129004836.GA4417@redhat.com>, Richard Henderson writes:
 >On Wed, Jan 28, 2004 at 04:23:05PM -0800, Caroline Tice wrote:
 >> I am sorry for my ignorance, but I don't quite understand what aspect of
 >> my optimization you are stating "most targets don't support".   I 
 >> *thought* you meant they didn't support long conditional branches,
 >> when I thought meant I needed to have code to convert conditional
 >> branches into unconditional branches in most cases where a conditional
 >> branch may attempt to cross between sections.  Which I do.
 >
 >Most targets don't support long unconditional branches either.
 >They have to be implemented by indirect branches.
Right.  In fact, in the case of the PA, a "long" branch only reaches
+-256kbytes from the branch site.  Beyond that you have to resort to
indirect branches.

[ That's a gross over-simplification of the PA, but it serves to show
  the issue at hand. ]

 >All three of these problems are made vastly easier if you arrange
 >for there to be exactly one transition between sections.  That is,
 >all of the code for ".text" comes first, and all of the code for
 >".text.cold" comes next, and not switch back and forth repeatedly.
I couldn't agree more.  The only question is how easily can that be
done.  There was a time when it was exceedingly difficult to switch
between sections on the fly like that.  Maybe things have changed...

 >I think all of the ugliness you add to final.c wrt insn addreses
 >can be removed if you require that targets implement special patterns
 >to explicitly transition between sections.  Thus we don't have to
 >come up with arbitrarily large numbers to satisfy the pc-dest test
 >in normal branch patterns.
Seems reasonable.  In fact, you could trigger this optimization to only
occur when the target provides such a pattern.


jeff



More information about the Gcc-patches mailing list