+2010-08-14 Anatoly Sokolov <aesok@post.ru>
+
+ * reload.h (register_move_cost, memory_move_secondary_cost,
+ secondary_reload_class): Adjust prototype.
+ * rtl.h (reg_class_subset_p): Adjust prototype.
+ * reload.c (secondary_reload_class): Change arguments type from
+ enum reg_class to reg_class_t. Change result type to reg_class_t.
+ * reginfo.c (register_move_cost, reg_class_subset_p): Change
+ arguments type from enum reg_class to reg_class_t.
+ (memory_move_secondary_cost): Change arguments type from
+ enum reg_class to reg_class_t. Change type of saved_flags to
+ reg_class_t.
+
+ * config/mips/mips.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST):
+ Remove macros.
+ (mips_cost): Remove.
+ (struct mips_rtx_cost_data): Moved to mips.c.
+ * config/mips/mips-protos.h (mips_register_move_cost): Remove.
+ * config/mips/mips.c (struct mips_rtx_cost_data): Moved from mips.h.
+ (mips_cost): Make static.
+ (mips_canonicalize_move_class): Change argument type to reg_class_t.
+ Change result type to reg_class_t.
+ (mips_move_to_gpr_cost, mips_move_from_gpr_cost): Change arguments
+ type from enum reg_class to reg_class_t.
+ (mips_register_move_cost): Make static. Change arguments
+ type from enum reg_class to reg_class_t.
+ (mips_memory_move_cost): New function.
+ (TARGET_REGISTER_MOVE_COST, TARGET_MEMORY_MOVE_COST): Define.
+
2010-08-14 Richard Sandiford <rdsandiford@googlemail.com>
PR rtl-optimization/43358
enum machine_mode,
rtx, bool);
extern int mips_class_max_nregs (enum reg_class, enum machine_mode);
-extern int mips_register_move_cost (enum machine_mode, enum reg_class,
- enum reg_class);
extern int mips_adjust_insn_length (rtx, int);
extern void mips_output_load_label (rtx);
HOST_WIDE_INT size;
};
+/* Costs of various operations on the different architectures. */
+
+struct mips_rtx_cost_data
+{
+ unsigned short fp_add;
+ unsigned short fp_mult_sf;
+ unsigned short fp_mult_df;
+ unsigned short fp_div_sf;
+ unsigned short fp_div_df;
+ unsigned short int_mult_si;
+ unsigned short int_mult_di;
+ unsigned short int_div_si;
+ unsigned short int_div_di;
+ unsigned short branch_cost;
+ unsigned short memory_latency;
+};
+
/* Global variables for machine-dependent things. */
/* The -G setting, or the configuration's default small-data limit if
int mips_abi = MIPS_ABI_DEFAULT;
/* Which cost information to use. */
-const struct mips_rtx_cost_data *mips_cost;
+static const struct mips_rtx_cost_data *mips_cost;
/* The ambient target flags, excluding MASK_MIPS16. */
static int mips_base_target_flags;
};
\f
static rtx mips_find_pic_call_symbol (rtx, rtx);
+static int mips_register_move_cost (enum machine_mode, reg_class_t,
+ reg_class_t);
\f
/* This hash table keeps track of implicit "mips16" and "nomips16" attributes
for -mflip_mips16. It maps decl names onto a boolean mode setting. */
/* RCLASS is a class involved in a REGISTER_MOVE_COST calculation.
Return a "canonical" class to represent it in later calculations. */
-static enum reg_class
-mips_canonicalize_move_class (enum reg_class rclass)
+static reg_class_t
+mips_canonicalize_move_class (reg_class_t rclass)
{
/* All moves involving accumulator registers have the same cost. */
if (reg_class_subset_p (rclass, ACC_REGS))
static int
mips_move_to_gpr_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
- enum reg_class from)
+ reg_class_t from)
{
switch (from)
{
other classes handled by this function. */
static int
-mips_move_from_gpr_cost (enum machine_mode mode, enum reg_class to)
+mips_move_from_gpr_cost (enum machine_mode mode, reg_class_t to)
{
switch (to)
{
}
}
-/* Implement REGISTER_MOVE_COST. Return 0 for classes that are the
+/* Implement TARGET_REGISTER_MOVE_COST. Return 0 for classes that are the
maximum of the move costs for subclasses; regclass will work out
the maximum for us. */
-int
+static int
mips_register_move_cost (enum machine_mode mode,
- enum reg_class from, enum reg_class to)
+ reg_class_t from, reg_class_t to)
{
- enum reg_class dregs;
+ reg_class_t dregs;
int cost1, cost2;
from = mips_canonicalize_move_class (from);
return 0;
}
+/* Implement TARGET_MEMORY_MOVE_COST. */
+
+static int
+mips_memory_move_cost (enum machine_mode mode, reg_class_t rclass, bool in)
+{
+ return (mips_cost->memory_latency
+ + memory_move_secondary_cost (mode, rclass, in));
+}
+
/* Implement TARGET_IRA_COVER_CLASSES. */
static const reg_class_t *
#undef TARGET_VALID_POINTER_MODE
#define TARGET_VALID_POINTER_MODE mips_valid_pointer_mode
+#undef TARGET_REGISTER_MOVE_COST
+#define TARGET_REGISTER_MOVE_COST mips_register_move_cost
+#undef TARGET_MEMORY_MOVE_COST
+#define TARGET_MEMORY_MOVE_COST mips_memory_move_cost
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS mips_rtx_costs
#undef TARGET_ADDRESS_COST
/* MIPS external variables defined in mips.c. */
-/* Costs of various operations on the different architectures. */
-
-struct mips_rtx_cost_data
-{
- unsigned short fp_add;
- unsigned short fp_mult_sf;
- unsigned short fp_mult_df;
- unsigned short fp_div_sf;
- unsigned short fp_div_df;
- unsigned short int_mult_si;
- unsigned short int_mult_di;
- unsigned short int_div_si;
- unsigned short int_div_di;
- unsigned short branch_cost;
- unsigned short memory_latency;
-};
-
/* Which ABI to use. ABI_32 (original 32, or o32), ABI_N32 (n32),
ABI_64 (n64) are all defined by SGI. ABI_O64 is o32 extended
to work on a 64-bit machine. */
#define FUNCTION_MODE SImode
\f
-/* A C expression for the cost of moving data from a register in
- class FROM to one in class TO. The classes are expressed using
- the enumeration values such as `GENERAL_REGS'. A value of 2 is
- the default; other values are interpreted relative to that.
-
- It is not required that the cost always equal 2 when FROM is the
- same as TO; on some machines it is expensive to move between
- registers if they are not general registers.
-
- If reload sees an insn consisting of a single `set' between two
- hard registers, and if `REGISTER_MOVE_COST' applied to their
- classes returns a value of 2, reload does not check to ensure
- that the constraints of the insn are met. Setting a cost of
- other than 2 will allow reload to verify that the constraints are
- met. You should do this if the `movM' pattern's constraints do
- not allow such copying. */
-
-#define REGISTER_MOVE_COST(MODE, FROM, TO) \
- mips_register_move_cost (MODE, FROM, TO)
-
-#define MEMORY_MOVE_COST(MODE,CLASS,TO_P) \
- (mips_cost->memory_latency \
- + memory_move_secondary_cost ((MODE), (CLASS), (TO_P)))
/* Define if copies to/from condition code registers should be avoided.
extern int mips_abi; /* which ABI to use */
extern const struct mips_cpu_info *mips_arch_info;
extern const struct mips_cpu_info *mips_tune_info;
-extern const struct mips_rtx_cost_data *mips_cost;
extern bool mips_base_mips16;
extern enum mips_code_readable_setting mips_code_readable;
extern GTY(()) struct target_globals *mips16_globals;
TO, using MODE. */
int
-register_move_cost (enum machine_mode mode, enum reg_class from,
- enum reg_class to)
+register_move_cost (enum machine_mode mode, reg_class_t from, reg_class_t to)
{
return targetm.register_move_cost (mode, from, to);
}
/* Compute extra cost of moving registers to/from memory due to reloads.
Only needed if secondary reloads are required for memory moves. */
int
-memory_move_secondary_cost (enum machine_mode mode, enum reg_class rclass,
+memory_move_secondary_cost (enum machine_mode mode, reg_class_t rclass,
bool in)
{
- enum reg_class altclass;
+ reg_class_t altclass;
int partial_cost = 0;
/* We need a memory reference to feed to SECONDARY... macros. */
/* mem may be unused even if the SECONDARY_ macros are defined. */
/* Return nonzero if C1 is a subset of C2, i.e., if every register in C1
is also in C2. */
int
-reg_class_subset_p (enum reg_class c1, enum reg_class c2)
+reg_class_subset_p (reg_class_t c1, reg_class_t c2)
{
return (c1 == c2
|| c2 == ALL_REGS
/* If a secondary reload is needed, return its class. If both an intermediate
register and a scratch register is needed, we return the class of the
intermediate register. */
-enum reg_class
-secondary_reload_class (bool in_p, enum reg_class rclass,
- enum machine_mode mode, rtx x)
+reg_class_t
+secondary_reload_class (bool in_p, reg_class_t rclass, enum machine_mode mode,
+ rtx x)
{
enum insn_code icode;
secondary_reload_info sri;
SECONDARY_RELOAD_CLASS (CLASS, MODE, X)
#endif
-extern int register_move_cost (enum machine_mode, enum reg_class,
- enum reg_class);
+extern int register_move_cost (enum machine_mode, reg_class_t, reg_class_t);
extern int memory_move_cost (enum machine_mode, enum reg_class, bool);
-extern int memory_move_secondary_cost (enum machine_mode, enum reg_class,
- bool);
+extern int memory_move_secondary_cost (enum machine_mode, reg_class_t, bool);
/* Maximum number of reloads we can need. */
#define MAX_RELOADS (2 * MAX_RECOG_OPERANDS * (MAX_REGS_PER_ADDRESS + 1))
/* Functions from reload.c: */
-extern enum reg_class secondary_reload_class (bool, enum reg_class,
- enum machine_mode, rtx);
+extern reg_class_t secondary_reload_class (bool, reg_class_t,
+ enum machine_mode, rtx);
#ifdef GCC_INSN_CODES_H
extern enum reg_class scratch_reload_class (enum insn_code);
/* In reginfo.c */
extern int reg_classes_intersect_p (reg_class_t, reg_class_t);
-extern int reg_class_subset_p (enum reg_class, enum reg_class);
+extern int reg_class_subset_p (reg_class_t, reg_class_t);
extern void globalize_reg (int);
extern void init_reg_modes_target (void);
extern void init_regs (void);