+
+void
+record_subregs_of_mode (rtx subreg)
+{
+ struct subregs_of_mode_node dummy, *node;
+ enum machine_mode mode;
+ unsigned int regno;
+ void **slot;
+
+ if (!REG_P (SUBREG_REG (subreg)))
+ return;
+
+ regno = REGNO (SUBREG_REG (subreg));
+ mode = GET_MODE (subreg);
+
+ if (regno < FIRST_PSEUDO_REGISTER)
+ return;
+
+ dummy.block = regno & -8;
+ slot = htab_find_slot_with_hash (subregs_of_mode, &dummy,
+ dummy.block, INSERT);
+ node = *slot;
+ if (node == NULL)
+ {
+ node = XCNEW (struct subregs_of_mode_node);
+ node->block = regno & -8;
+ *slot = node;
+ }
+
+ node->modes[mode] |= 1 << (regno & 7);
+}
+
+/* Set bits in *USED which correspond to registers which can't change
+ their mode from FROM to any mode in which REGNO was encountered. */
+
+void
+cannot_change_mode_set_regs (HARD_REG_SET *used, enum machine_mode from,
+ unsigned int regno)
+{
+ struct subregs_of_mode_node dummy, *node;
+ enum machine_mode to;
+ unsigned char mask;
+ unsigned int i;
+
+ dummy.block = regno & -8;
+ node = htab_find_with_hash (subregs_of_mode, &dummy, dummy.block);
+ if (node == NULL)
+ return;
+
+ mask = 1 << (regno & 7);
+ for (to = VOIDmode; to < NUM_MACHINE_MODES; to++)
+ if (node->modes[to] & mask)
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (!TEST_HARD_REG_BIT (*used, i)
+ && REG_CANNOT_CHANGE_MODE_P (i, from, to))
+ SET_HARD_REG_BIT (*used, i);
+}
+
+/* Return 1 if REGNO has had an invalid mode change in CLASS from FROM
+ mode. */
+
+bool
+invalid_mode_change_p (unsigned int regno, enum reg_class class,
+ enum machine_mode from)
+{
+ struct subregs_of_mode_node dummy, *node;
+ enum machine_mode to;
+ unsigned char mask;
+
+ dummy.block = regno & -8;
+ node = htab_find_with_hash (subregs_of_mode, &dummy, dummy.block);
+ if (node == NULL)
+ return false;
+
+ mask = 1 << (regno & 7);
+ for (to = VOIDmode; to < NUM_MACHINE_MODES; to++)
+ if (node->modes[to] & mask)
+ if (CANNOT_CHANGE_MODE_CLASS (from, to, class))
+ return true;
+
+ return false;
+}
+#endif /* CANNOT_CHANGE_MODE_CLASS */
+
+#include "gt-regclass.h"