+ reg_pref = NULL;
+
+ /* No more global register variables may be declared. */
+ no_global_reg_vars = 1;
+}
+\f
+/* Dump register costs. */
+static void
+dump_regclass (dump)
+ FILE *dump;
+{
+ static const char *const reg_class_names[] = REG_CLASS_NAMES;
+ int i;
+ for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
+ {
+ enum reg_class class;
+ if (REG_N_REFS (i))
+ {
+ fprintf (dump, " Register %i costs:", i);
+ for (class = 0; class < N_REG_CLASSES; class++)
+ fprintf (dump, " %s:%i", reg_class_names[(int) class],
+ costs[i].cost[class]);
+ fprintf (dump, " MEM:%i\n", costs[i].mem_cost);
+ }
+ }
+}
+\f
+
+/* Calculate the costs of insn operands. */
+
+static void
+record_operand_costs (insn, op_costs, reg_pref)
+ rtx insn;
+ struct costs *op_costs;
+ struct reg_pref *reg_pref;
+{
+ const char *constraints[MAX_RECOG_OPERANDS];
+ enum machine_mode modes[MAX_RECOG_OPERANDS];
+ int i;
+
+ for (i = 0; i < recog_data.n_operands; i++)
+ {
+ constraints[i] = recog_data.constraints[i];
+ modes[i] = recog_data.operand_mode[i];
+ }
+
+ /* If we get here, we are set up to record the costs of all the
+ operands for this insn. Start by initializing the costs.
+ Then handle any address registers. Finally record the desired
+ classes for any pseudos, doing it twice if some pair of
+ operands are commutative. */
+
+ for (i = 0; i < recog_data.n_operands; i++)
+ {
+ op_costs[i] = init_cost;
+
+ 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;
+ }
+
+ if (GET_CODE (recog_data.operand[i]) == MEM)
+ record_address_regs (XEXP (recog_data.operand[i], 0),
+ BASE_REG_CLASS, loop_cost * 2);
+ else if (constraints[i][0] == 'p')
+ record_address_regs (recog_data.operand[i],
+ BASE_REG_CLASS, loop_cost * 2);
+ }
+
+ /* Check for commutative in a separate loop so everything will
+ have been initialized. We must do this even if one operand
+ is a constant--see addsi3 in m68k.md. */
+
+ for (i = 0; i < (int) recog_data.n_operands - 1; i++)
+ if (constraints[i][0] == '%')
+ {
+ const char *xconstraints[MAX_RECOG_OPERANDS];
+ int j;
+
+ /* Handle commutative operands by swapping the constraints.
+ We assume the modes are the same. */
+
+ for (j = 0; j < recog_data.n_operands; j++)
+ xconstraints[j] = constraints[j];
+
+ xconstraints[i] = constraints[i+1];
+ xconstraints[i+1] = constraints[i];
+ record_reg_classes (recog_data.n_alternatives, recog_data.n_operands,
+ recog_data.operand, modes,
+ xconstraints, insn, op_costs, reg_pref);
+ }
+
+ record_reg_classes (recog_data.n_alternatives, recog_data.n_operands,
+ recog_data.operand, modes,
+ constraints, insn, op_costs, reg_pref);