+/* Deal with hard registers. */
+static int conflicting_hard_regs_p
+ PARAMS ((int reg1, int reg2));
+
+/* ssa_rename_to maps registers and machine modes to SSA pseudo registers. */
+
+/* Find the register associated with REG in the indicated mode. */
+
+static rtx
+ssa_rename_to_lookup (reg)
+ rtx reg;
+{
+ if (!HARD_REGISTER_P (reg))
+ return ssa_rename_to_pseudo[REGNO (reg) - FIRST_PSEUDO_REGISTER];
+ else
+ return ssa_rename_to_hard[REGNO (reg)][GET_MODE (reg)];
+}
+
+/* Store a new value mapping REG to R in ssa_rename_to. */
+
+static void
+ssa_rename_to_insert(reg, r)
+ rtx reg;
+ rtx r;
+{
+ if (!HARD_REGISTER_P (reg))
+ ssa_rename_to_pseudo[REGNO (reg) - FIRST_PSEUDO_REGISTER] = r;
+ else
+ ssa_rename_to_hard[REGNO (reg)][GET_MODE (reg)] = r;
+}
+
+/* Prepare ssa_rename_from for use. */
+
+static void
+ssa_rename_from_initialize ()
+{
+ /* We use an arbitrary initial hash table size of 64. */
+ ssa_rename_from_ht = htab_create (64,
+ &ssa_rename_from_hash_function,
+ &ssa_rename_from_equal,
+ &ssa_rename_from_delete);
+}
+
+/* Find the REG entry in ssa_rename_from. Return NULL_RTX if no entry is
+ found. */
+
+static rtx
+ssa_rename_from_lookup (reg)
+ int reg;
+{
+ ssa_rename_from_pair srfp;
+ ssa_rename_from_pair *answer;
+ srfp.reg = reg;
+ srfp.original = NULL_RTX;
+ answer = (ssa_rename_from_pair *)
+ htab_find_with_hash (ssa_rename_from_ht, (void *) &srfp, reg);
+ return (answer == 0 ? NULL_RTX : answer->original);
+}
+
+/* Find the number of the original register specified by REGNO. If
+ the register is a pseudo, return the original register's number.
+ Otherwise, return this register number REGNO. */
+
+static unsigned int
+original_register (regno)
+ unsigned int regno;
+{
+ rtx original_rtx = ssa_rename_from_lookup (regno);
+ return original_rtx != NULL_RTX ? REGNO (original_rtx) : regno;
+}
+
+/* Add mapping from R to REG to ssa_rename_from even if already present. */
+
+static void
+ssa_rename_from_insert (reg, r)
+ unsigned int reg;
+ rtx r;
+{
+ void **slot;
+ ssa_rename_from_pair *srfp = xmalloc (sizeof (ssa_rename_from_pair));
+ srfp->reg = reg;
+ srfp->original = r;
+ slot = htab_find_slot_with_hash (ssa_rename_from_ht, (const void *) srfp,
+ reg, INSERT);
+ if (*slot != 0)
+ free ((void *) *slot);
+ *slot = srfp;
+}
+
+/* Apply the CALLBACK_FUNCTION to each element in ssa_rename_from.
+ CANONICAL_ELEMENTS and REG_PARTITION pass data needed by the only
+ current use of this function. */
+
+static void
+ssa_rename_from_traverse (callback_function,
+ canonical_elements, reg_partition)
+ htab_trav callback_function;
+ sbitmap canonical_elements;
+ partition reg_partition;
+{
+ struct ssa_rename_from_hash_table_data srfhd;
+ srfhd.canonical_elements = canonical_elements;
+ srfhd.reg_partition = reg_partition;
+ htab_traverse (ssa_rename_from_ht, callback_function, (void *) &srfhd);
+}
+
+/* Destroy ssa_rename_from. */
+
+static void
+ssa_rename_from_free ()
+{
+ htab_delete (ssa_rename_from_ht);
+}
+
+/* Print the contents of ssa_rename_from. */
+
+/* static Avoid erroneous error message. */
+void
+ssa_rename_from_print ()
+{
+ printf ("ssa_rename_from's hash table contents:\n");
+ htab_traverse (ssa_rename_from_ht, &ssa_rename_from_print_1, NULL);
+}
+
+/* Print the contents of the hash table entry SLOT, passing the unused
+ sttribute DATA. Used as a callback function with htab_traverse (). */
+
+static int
+ssa_rename_from_print_1 (slot, data)
+ void **slot;
+ void *data ATTRIBUTE_UNUSED;
+{
+ ssa_rename_from_pair * p = *slot;
+ printf ("ssa_rename_from maps pseudo %i to original %i.\n",
+ p->reg, REGNO (p->original));
+ return 1;
+}
+
+/* Given a hash entry SRFP, yield a hash value. */
+
+static hashval_t
+ssa_rename_from_hash_function (srfp)
+ const void *srfp;
+{
+ return ((const ssa_rename_from_pair *) srfp)->reg;
+}
+
+/* Test whether two hash table entries SRFP1 and SRFP2 are equal. */
+
+static int
+ssa_rename_from_equal (srfp1, srfp2)
+ const void *srfp1;
+ const void *srfp2;
+{
+ return ssa_rename_from_hash_function (srfp1) ==
+ ssa_rename_from_hash_function (srfp2);
+}
+
+/* Delete the hash table entry SRFP. */
+
+static void
+ssa_rename_from_delete (srfp)
+ void *srfp;
+{
+ free (srfp);
+}