Commit 2bc25d82 authored by Matthias Braun's avatar Matthias Braun
Browse files

backends can specify costs for spill and reload

[r13914]
parent ae515d01
......@@ -351,6 +351,8 @@ static TEMPLATE_isa_t TEMPLATE_isa_template = {
&TEMPLATE_general_purpose_regs[REG_BP], /* base pointer register */
-1, /* stack direction */
NULL, /* main environment */
7, /* costs for a spill instruction */
5, /* costs for a reload instruction */
},
{ NULL, }, /* emitter environment */
};
......
......@@ -708,6 +708,8 @@ static arm_isa_t arm_isa_template = {
&arm_gp_regs[REG_R11], /* base pointer */
-1, /* stack direction */
NULL, /* main environment */
7, /* spill costs */
5, /* reload costs */
},
0, /* use generic register names instead of SP, LR, PC */
ARM_FPU_ARCH_FPE, /* FPU architecture */
......
......@@ -51,12 +51,14 @@ _arch_register_get_class(const arch_register_t *reg)
return reg->reg_class;
}
static INLINE int _arch_register_get_index(const arch_register_t *reg)
static INLINE
int _arch_register_get_index(const arch_register_t *reg)
{
return reg->index;
}
static INLINE const char *_arch_register_get_name(const arch_register_t *reg)
static INLINE
const char *_arch_register_get_name(const arch_register_t *reg)
{
return reg->name;
}
......@@ -396,8 +398,10 @@ struct arch_isa_t {
const arch_isa_if_t *impl;
const arch_register_t *sp; /** The stack pointer register. */
const arch_register_t *bp; /** The base pointer register. */
const int stack_dir; /** -1 for decreasing, 1 for increasing. */
const int stack_dir; /** -1 for decreasing, 1 for increasing. */
const be_main_env_t *main_env; /** the be main environment */
const int spill_cost; /** cost for a be_Spill node */
const int reload_cost; /** cost for a be_Reload node */
};
#define arch_isa_stack_dir(isa) ((isa)->stack_dir)
......@@ -498,7 +502,8 @@ struct arch_isa_if_t {
/**
* Returns an 2-dim array of execution units, @p irn can be executed on.
* The first dimension is the type, the second the allowed units of this type.
* The first dimension is the type, the second the allowed units of this
* type.
* Each dimension is a NULL terminated list.
* @param self The isa object.
* @param irn The node.
......@@ -520,8 +525,8 @@ struct arch_isa_if_t {
/**
* Return an ordered list of irgs where code should be generated for.
* If NULL is returned, all irg will be taken into account and they will be
* generated in an arbitrary order.
* If NULL is returned, all irg will be taken into account and they will be
* generated in an arbitrary order.
* @param self The isa object.
* @param irgs A flexible array ARR_F of length 0 where the backend can append the desired irgs.
* @return A flexible array ARR_F containing all desired irgs in the desired order.
......
......@@ -552,6 +552,8 @@ static mips_isa_t mips_isa_template = {
&mips_gp_regs[REG_FP],
-1, /* stack direction */
NULL, /* main environment */
7, /* spill costs */
5, /* reload costs */
},
{ NULL, }, /* emitter environment */
};
......
......@@ -625,6 +625,8 @@ static ppc32_isa_t ppc32_isa_template = {
&ppc32_gp_regs[REG_R31], /* base pointer */
-1, /* stack is decreasing */
NULL, /* main environment */
7, /* spill costs */
5, /* reload costs */
},
{ NULL, }, /* emitter environment */
NULL /* symbol set */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment