[patch] Hookize SMALL_REGISTER_CLASSES
Alexander Strange
astrange@ithinksw.com
Mon May 3 00:43:00 GMT 2010
On May 2, 2010, at 6:07 PM, Steven Bosscher wrote:
> Take 4. The spam filter is apparently convinced that this patch is
> spam. Trying as .gz now...
>
> On Sun, May 2, 2010 at 10:42 PM, Steven Bosscher <stevenb dot gcc at
> gmail dot com> wrote:
>> Hi,
>>
>> This is a re-post of
>> http://gcc.gnu.org/ml/gcc-patches/2008-12/msg00590.html for GCC 4.6.
>>
>> The actual purpose of this patch is to make it possible to have
>> SMALL_REGISTER_CLASSES be false for some register classes but not for
>> all.
>>
>> In the current situation, SMALL_REGISTER_CLASSES is true or false, but
>> targets are not black and white. For x86-64, I've noticed we often
>> get better results with floating point code if I disable
>> SMALL_REGISTER_CLASSES, but it also results in lots of trouble with
>> INTEGRAL_MODE_P modes (similar to what happens if you enable
>> scheduling for x86-64).
>>
>> With the patch, a target can choose to allow more optimizations when
>> it has good reason to believe that registers in some machine modes
>> will not be allocated to small register classes.
>>
>> Bootstrapped&tested on x86_64-unknown-linux-gnu.
>> OK for trunk?
> + /* AMD64 has 16 registers for >=32 bits integers. This is not
> + large compared to RISC/VLIW architectures, but it is big
> + enough for us to consider it non-small. */
> + if (SCALAR_INT_MODE_P (mode) && GET_MODE_SIZE (mode) >= 32)
> + return false;
The new registers in AMD64 all have 8- and 16-bit subregs, so those register classes are just as large.
Although gcc always seems to do operations in at least 32-bit on x86 anyway, so this probably doesn't matter...
>>
>> Ciao!
>> Steven
>>
>> * doc/tm.texi (defmac SMALL_REGISTER_CLASSES): Remove.
>> (TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P): Add documentation,
>> based on the above, for new target hook.
>>
>> * hooks.c (hook_bool_mode_true): New generic hook.
>> * hooks.h (hook_bool_mode_true): Add prototype.
>>
>> * target.h (struct gcc_target): Add small_register_classes_for_mode_p
>> target hook.
>> * target-def.h (TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P): New default
>> target hook, set to hook_bool_mode_false.
>> * regs.h: Remove default definition of SMALL_REGISTER_CLASSES.
>> * reload.c (push_secondary_reload): Replace SMALL_REGISTER_CLASSES
>> with targetm.small_register_classes_for_mode_p.
>> (find_reusable_reload): Likewise.
>> (combine_reloads): Likewise.
>> * reload1.c (reload_as_needed): Likewise.
>> * cse.c (approx_reg_cost_1, hash_rtx_cb): Likewise.
>> * ifcvt.c (noce_process_if_block, check_cond_move_block,
>> dead_or_predicable): Likewise.
>> * regmove.c (optimize_reg_copy_1): Likewise.
>> * calls.c (prepare_call_address): Likewise.
>> (precompute_register_parameters): Likewise.
>>
>> * config/i386/i386.h: Replace SMALL_REGISTER_CLASSES with new target
>> hook definition.
>> * config/i386/i386.c (ix86_small_register_classes_for_mode_p): Add
>> implementation of the hook that considers SSE and 64-bit integer
>> register classes "not small".
>> * config/i386/i386-protos.h (ix86_small_register_classes_for_mode_p):
>> Add prototype.
>>
>> * config/sh/sh.h: Replace SMALL_REGISTER_CLASSES with new target
>> hook definition.
>> * config/sh/sh.c (sh_small_register_classes_for_mode_p): Add
>> implementation of the hook that considers all register classes
>> small except for SH64.
>> (sh_override_options): Use the new hook.
>> * config/sh/sh-protos.h (sh_small_register_classes_for_mode_p):
>> Add prototype.
>>
>> * config/arm/arm.h: Replace SMALL_REGISTER_CLASSES with new target
>> hook definition.
>> * config/arm/arm.c (arm_small_register_classes_for_mode_p): Add
>> implementation of the hook that considers all register classes
>> small for THUMB1.
>> * config/arm/arm-protos.h (arm_small_register_classes_for_mode_p):
>> Add prototype.
>>
>> * config/mips/mips.h: Replace SMALL_REGISTER_CLASSES with new target
>> hook definition.
>> * config/mips/mips.c (mips_small_register_classes_for_mode_p): Add
>> implementation of the hook that considers all register classes
>> small for MIPS16.
>> * config/mips/mips-protos.h (mips_small_register_classes_for_mode_p):
>> Add prototype.
>>
>> * config/m32c/m32c.h: Replace SMALL_REGISTER_CLASSES with new target
>> hook definition.
>> * config/pdp11/pdp11.h: Likewise.
>> * config/avr/avr.h: Likewise.
>> * config/xtensa/xtensa.h: Likewise.
>> * config/m68hc11/m68hc11.h: Likewise.
>> * config/mn10300/mn10300.h: Likewise.
>> * config/mcore/mcore.h: Likewise.
>> * config/h8300/h8300.h: Likewise.
>> * config/bfin/bfin.h: Likewise.
>>
>> * config/iq2000/iq2000.h: Remove SMALL_REGISTER_CLASSES definition.
>> * config/rx/rx.h: Remove SMALL_REGISTER_CLASSES definition.
>>
> <hookize_SMALL_REGISTER_CLASSES.diff.gz>
More information about the Gcc-patches
mailing list