[patch] Merge cfo-branch, RTL sequence abstraction (part 1)

Gabor Loki loki@gcc.gnu.org
Mon Jan 16 14:45:00 GMT 2006


Daniel Jacobowitz wrote:
> On Sat, Jan 07, 2006 at 12:17:43PM -0700, Roger Sayle wrote:
> 
>>On Sat, 7 Jan 2006, Daniel Jacobowitz wrote:
>>
>>>>Gabor's current approach of assuming constant length for each INSN_P
>>>
>>>I didn't suggest that.  I suggested using get_attr_length.
>>
>>This would only work for HAVE_ATTR_length targets.  You'll notice that
>>final.c's get_attr_length_1 implementation always returns zero for
>>other architectures.  Currently, there's no requirement for a backend
>>to provide length attributes.
> 
> 
> I foolishly assumed it was required.  There appear to be only a handful
> that don't: c4x, ia64, m32c, m68hc11, m68k, mn10300, vax.
> 
> 
>>Conversely, insn_rtx_cost is already used at several points in the
>>compiler do decide whether a transformation is beneficial.  So when
>>optimizing for size, combine won't transform one sequence into
>>another if the result is longer.  This function is called on insns
>>before splitting, register allocation, or instruction selection, so
>>get_attr_length isn't appropriate, and therefore rtx_cost should
>>honor the optimize_size flag as documented.
> 
> 
> Sure, I don't dispute that.  It just shouldn't be used where we
> unconditionally want lengths and not costs.  The other examples you
> sited all want "costs", depending on -O2 vs -Os.

I have been out of office for a week and I see that we have had quite
long discussions on rtx_cost. So, I am only to share my notes and
experiences about cost computation for size.

In sequence abstraction the real instruction length is needed for cost
computation. So, the rtx_cost isn't the best option (as you also said).
I have spent a lot pf  time testing/tweaking rtx_cost but I couldn't
achieve better results (code size) than with instruction counting. This
was the reason to choose instruction counting for cost computation.

I didn't try get_attr_length (because it is only used by back-ends). So,
I've rewritten the compute_rtx_cost. Currently, the cost function is
based on get_attr_length. If get_attr_length doesn't provide any
valuable length information we will use constant cost value as Roger
suggested.

I think this is the best we can do until there is not a common
and correct rtx_cost function for size.

The results are the following:

Average code size saves on CSiBE with -Os:
i686-linux:  1.48%
arm-elf:      0.91%
bfin-elf:      1.35%

Bootstraped and regtested on i686-linux.

OK for mainline?

br,
Gabor Loki


2006-01-16  Gabor Loki <loki@gcc.gnu.org>

           * rtl-factoring.c : Add sequence abstraction algorithm.
           * cfgcleanup.c (outgoing_edges_match): Extra checks.
           (try_crossjump_to_edge): Avoid deleting preserve label
           when redirecting ABNORMAL edges.
           (block_has_preserve_label): New function.
           * common.opt: Register new pass.
           * Makefile.in: Ditto.
           * passes.c: Ditto.
           * timevar.def: Ditto.
           * tree-pass.h: Ditto.
           * emit-rtl.c (make_jump_insn_raw): Remove forward decl.
           * rtl.h (make_jump_insn_raw): Add forward decl.
           * doc/invoke.texi: Add documentation for
           -frtl-abstract-sequences.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: CFO-rtl-seqabstr.patch
Type: text/x-patch
Size: 51695 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060116/8fd5d441/attachment.bin>


More information about the Gcc-patches mailing list