[PATCH] gen_lowpart_no_emit RTL hook

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Mon Mar 21 09:36:00 GMT 2005


This is another patch to prepare moving transformations from
combine.c to simplify-rtx.c.  gen_lowpart can emit instructions via
copy_to_reg or force_reg, and thus simplify-rtx.c must resort to either
gen_lowpart_common or gen_lowpart_SUBREG.

However, combine.c defines a version of gen_lowpart that is more
aggressive in generating possibly invalid rtx, but will not generate new
pseudos.  When transformations are moved to simplify-rtx.c, it is valid 
to use this version of gen_lowpart.

So, this patch turns this ``common'' (it occurs 3 times) pattern found 
in simplify-rtx.c, into a different RTL hook:

       rtx x = gen_lowpart_common (mode, op0);
       if (x)
         return x;
       if (mode != GET_MODE (op0) && GET_MODE (op0) != VOIDmode)
         return gen_lowpart_SUBREG (mode, op0);
       return op0;

This patch introduces no difference in behavior.  Subsequent patches
will involve:
- using gen_lowpart_for_combine as combine's gen_lowpart_no_emit hook
- investigating using lowpart_subreg instead of gen_lowpart_SUBREG.
- investigating merging gen_lowpart_if_possible with the generic 
implementation of the hook

Bootstrapped/regtested powerpc-apple-darwin7.8.0, ok for mainline?

Paolo



More information about the Gcc-patches mailing list