CLASS_CANNOT_CHANGE_MODE

Alan Modra alan@linuxcare.com.au
Tue Feb 13 17:05:00 GMT 2001


Is this code in regclass.c:record_operand_costs in error?

      if (GET_CODE (recog_data.operand[i]) == SUBREG)
	{
	  rtx inner = SUBREG_REG (recog_data.operand[i]);
#ifdef CLASS_CANNOT_CHANGE_MODE
	  if (GET_CODE (inner) == REG
	      && CLASS_CANNOT_CHANGE_MODE_P (modes[i], GET_MODE (inner)))
	    SET_REGNO_REG_SET (reg_changes_mode, REGNO (inner));
#endif
	  recog_data.operand[i] = inner;
	}

What seems to be missing is any sort of test on the register class before
calling CLASS_CANNOT_CHANGE_MODE_P, which is wrong according to tm.texi


On pa64 (pa/pa64-regs.h), we have

#define CLASS_CANNOT_CHANGE_MODE	(FP_REGS)

#define CLASS_CANNOT_CHANGE_MODE_P(FROM,TO) \
  (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO))

so we decide that something simple like (subreg:SI (reg:DI)) cannot change
its mode.

Alan Modra
-- 
Linuxcare.  Support for the Revolution.



More information about the Gcc-bugs mailing list