Jeff Law <l...@redhat.com> writes: > On 09/18/14 04:25, Richard Sandiford wrote: >> This is the main patch for the bug. We should treat a register as invalid >> for a mode change if simplify_subreg_regno cannot provide a new register >> number for the result. We should treat a class as invalid for a mode change >> if all registers in the class are invalid. This is an extension of the old >> CANNOT_CHANGE_MODE_CLASS-based check (simplify_subreg_regno checks C_C_C_M). >> >> I forgot to say that the patch is a prerequisite to removing aarch64's >> C_C_C_M. There are other prerequisites too, but removing C_C_C_M without >> this patch caused regressions in the existing testsuite, which is why no >> new tests are needed. >> >> >> gcc/ >> * hard-reg-set.h: Include hash-table.h. >> (target_hard_regs): Add a finalize method and a x_simplifiable_subregs >> field. >> * target-globals.c (target_globals::~target_globals): Handle >> hard_regs->finalize. >> * rtl.h (subreg_shape): New structure. >> (shape_of_subreg): New function. >> (simplifiable_subregs): Declare. >> * reginfo.c (simplifiable_subreg): New structure. >> (simplifiable_subregs_hasher): Likewise. >> (simplifiable_subregs): New function. >> (invalid_mode_changes): Delete. >> (alid_mode_changes, valid_mode_changes_obstack): New variables. >> (record_subregs_of_mode): Remove subregs_of_mode parameter. >> Record valid mode changes in valid_mode_changes. >> (find_subregs_of_mode): Remove subregs_of_mode parameter. >> Update calls to record_subregs_of_mode. >> (init_subregs_of_mode): Remove invalid_mode_changes and bitmap >> handling. Initialize new variables. Update call to >> find_subregs_of_mode. >> (invalid_mode_change_p): Check new variables instead of >> invalid_mode_changes. >> (finish_subregs_of_mode): Finalize new variables instead of >> invalid_mode_changes. >> (target_hard_regs::finalize): New function. >> * ira-costs.c (print_allocno_costs): Call invalid_mode_change_p >> even when CLASS_CANNOT_CHANGE_MODE is undefined. >> >> Index: gcc/rtl.h >> =================================================================== >> --- gcc/rtl.h 2014-09-15 11:55:40.459855161 +0100 >> +++ gcc/rtl.h 2014-09-15 12:26:21.249077760 +0100 >> +/* Return the shape of a SUBREG rtx. */ >> + >> +static inline subreg_shape >> +shape_of_subreg (const_rtx x) >> +{ >> + return subreg_shape (GET_MODE (SUBREG_REG (x)), >> + SUBREG_BYTE (x), GET_MODE (x)); >> +} >> + > Is there some reason you don't have a constructor that accepts a > const_rtx?
I was worried that by allowing implicit const_rtx->subreg_shape conversions, it would be less obvious that the rtx has to have code SUBREG. I.e. a checked conversion would be hidden in the constructor rather than being explicit. If with David's new rtx hierarchy we end up with an rtx_subreg subclass then I agree we should have a constructor that takes one of those. Thanks, Richard