+2002-03-15 Stephane Carrez <Stephane.Carrez@worldnet.fr>
+
+ * config/m68hc11/m68hc11.c (m6812_cost): Make cost of add higher
+ than a shift to avoid adding a register with itself.
+ (m68hc11_memory_move_cost): Take into account NO_REGS.
+ (m68hc11_register_move_cost): Update and use memory move cost
+ for soft registers.
+ (m68hc11_address_cost): Make cost of valid offset not 0 so that
+ it gives more opportunities to cse to optimize.
+ * config/m68hc11/m68hc11.h (REGISTER_MOVE_COST): Pass the mode.
+ * config/m68hc11/m68hc11-protos.h (m68hc11_register_move_cost): Update.
+
2002-03-15 Mark Mitchell <mark@codesourcery.com>
* c-common.c (statement_code_p): Handle CLEANUP_STMT.
/* Prototypes for exported functions defined in m68hc11.c
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@worldnet.fr)
This file is part of GNU CC.
#ifdef HAVE_MACHINE_MODES
extern int m68hc11_memory_move_cost PARAMS((enum machine_mode, enum reg_class,
int));
-extern int m68hc11_register_move_cost PARAMS((enum reg_class, enum reg_class));
+extern int m68hc11_register_move_cost PARAMS((enum machine_mode,
+ enum reg_class, enum reg_class));
extern int m68hc11_rtx_costs PARAMS((rtx, enum rtx_code, enum rtx_code));
extern int m68hc11_address_cost PARAMS((rtx));
/* Subroutines for code generation on Motorola 68HC11 and 68HC12.
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@worldnet.fr)
This file is part of GNU CC.
/* Costs for a 68HC12. */
static const struct processor_costs m6812_cost = {
/* add */
- COSTS_N_INSNS (1),
+ COSTS_N_INSNS (2),
/* logical */
- COSTS_N_INSNS (1),
+ COSTS_N_INSNS (2),
/* non-constant shift */
COSTS_N_INSNS (20),
/* shiftQI const */
handle calls to traps in a special manner (by issuing the trap).
This information is stored in SYMBOL_REF_FLAG. */
void
-m68hc11_encode_section_info (decl, first)
+m68hc11_encode_section_info (decl)
tree decl;
- int first ATTRIBUTE_UNUSED;
{
tree func_attr;
int trap_handler;
enum reg_class class;
int in ATTRIBUTE_UNUSED;
{
- if (class <= H_REGS)
+ if (class <= H_REGS && class > NO_REGS)
{
if (GET_MODE_SIZE (mode) <= 2)
return COSTS_N_INSNS (1) + (reload_completed | reload_in_progress);
have a move cost of 2. Setting a higher cost will force reload to check
the constraints. */
int
-m68hc11_register_move_cost (from, to)
+m68hc11_register_move_cost (mode, from, to)
+ enum machine_mode mode;
enum reg_class from;
enum reg_class to;
{
- if (from >= S_REGS && to >= S_REGS)
+ /* All costs are symmetric, so reduce cases by putting the
+ lower number class as the destination. */
+ if (from < to)
{
- return COSTS_N_INSNS (3);
+ enum reg_class tmp = to;
+ to = from, from = tmp;
}
- if (from <= S_REGS && to <= S_REGS)
- {
- return COSTS_N_INSNS (1) + (reload_completed | reload_in_progress);
- }
- return COSTS_N_INSNS (2);
+ if (to >= S_REGS)
+ return m68hc11_memory_move_cost (mode, S_REGS, 0);
+ else if (from <= S_REGS)
+ return COSTS_N_INSNS (1) + (reload_completed | reload_in_progress);
+ else
+ return COSTS_N_INSNS (2);
}
else if (INTVAL (plus1) >= m68hc11_max_offset)
cost = 2;
else
- cost = 0;
+ cost = 1;
if (REGNO (plus0) < FIRST_PSEUDO_REGISTER)
cost += 0;
else
/* Move costs between classes of registers */
#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
- (m68hc11_register_move_cost (CLASS1, CLASS2))
+ (m68hc11_register_move_cost (MODE, CLASS1, CLASS2))
/* Move cost between register and memory.
- Move to a 16-bit register is reasonable,