Commit b18c2537 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

be: Move spill_cost and reload_cost from struct arch_env_t into struct arch_isa_if_t.

This removes the last attributes from struct arch_env_t.
parent 634830b6
......@@ -55,14 +55,6 @@ static void TEMPLATE_before_ra(ir_graph *irg)
(void)irg;
}
static TEMPLATE_isa_t TEMPLATE_isa_template = {
.base = {
.spill_cost = 7,
.reload_cost = 5,
},
};
static void TEMPLATE_init(void)
{
TEMPLATE_register_init();
......@@ -77,8 +69,6 @@ static void TEMPLATE_finish(void)
static arch_env_t *TEMPLATE_begin_codegeneration(void)
{
TEMPLATE_isa_t *isa = XMALLOC(TEMPLATE_isa_t);
*isa = TEMPLATE_isa_template;
return &isa->base;
}
......@@ -159,6 +149,8 @@ static arch_isa_if_t const TEMPLATE_isa_if = {
.registers = TEMPLATE_registers,
.n_register_classes = N_TEMPLATE_CLASSES,
.register_classes = TEMPLATE_reg_classes,
.spill_cost = 7,
.reload_cost = 5,
.init = TEMPLATE_init,
.finish = TEMPLATE_finish,
.get_params = TEMPLATE_get_backend_params,
......
......@@ -639,13 +639,6 @@ static void amd64_finish_graph(ir_graph *irg)
amd64_emit_function(irg);
}
static amd64_isa_t amd64_isa_template = {
.base = {
.spill_cost = 7,
.reload_cost = 5,
},
};
static void amd64_finish(void)
{
amd64_free_opcodes();
......@@ -654,8 +647,7 @@ static void amd64_finish(void)
static arch_env_t *amd64_begin_codegeneration(void)
{
amd64_isa_t *isa = XMALLOC(amd64_isa_t);
*isa = amd64_isa_template;
isa->constants = pmap_create();
isa->constants = pmap_create();
return &isa->base;
}
......@@ -792,6 +784,8 @@ static arch_isa_if_t const amd64_isa_if = {
.registers = amd64_registers,
.n_register_classes = N_AMD64_CLASSES,
.register_classes = amd64_reg_classes,
.spill_cost = 7,
.reload_cost = 5,
.init = amd64_init,
.finish = amd64_finish,
.get_params = amd64_get_backend_params,
......
......@@ -173,17 +173,9 @@ static void arm_handle_intrinsics(ir_graph *irg)
irg_walk_graph(irg, handle_intrinsic, NULL, NULL);
}
static arm_isa_t arm_isa_template = {
.base = {
.spill_cost = 7,
.reload_cost = 5,
},
};
static arch_env_t *arm_begin_codegeneration(void)
{
arm_isa_t *isa = XMALLOC(arm_isa_t);
*isa = arm_isa_template;
be_gas_emit_types = false;
be_gas_elf_type_char = '%';
......@@ -309,6 +301,8 @@ static arch_isa_if_t const arm_isa_if = {
.registers = arm_registers,
.n_register_classes = N_ARM_CLASSES,
.register_classes = arm_reg_classes,
.spill_cost = 7,
.reload_cost = 5,
.init = arm_init,
.finish = arm_finish,
.get_params = arm_get_libfirm_params,
......
......@@ -305,6 +305,8 @@ struct arch_isa_if_t {
arch_register_t const *registers; /**< register array */
unsigned n_register_classes; /**< number of register classes */
arch_register_class_t const *register_classes; /**< register classes */
unsigned spill_cost; /**< cost for a spill node */
unsigned reload_cost; /**< cost for a reload node */
/**
* Initializes the isa interface. This is necessary before calling any
......@@ -399,8 +401,6 @@ struct arch_isa_if_t {
* ISA base class.
*/
struct arch_env_t {
unsigned spill_cost; /**< cost for a be_Spill node */
unsigned reload_cost; /**< cost for a be_Reload node */
};
static inline bool arch_irn_is_ignore(const ir_node *irn)
......
......@@ -111,12 +111,10 @@ static spill_info_t *get_spillinfo(spill_env_t *env, ir_node *value)
spill_env_t *be_new_spill_env(ir_graph *irg)
{
const arch_env_t *arch_env = be_get_irg_arch_env(irg);
spill_env_t *env = XMALLOCZ(spill_env_t);
env->irg = irg;
env->spill_cost = arch_env->spill_cost;
env->reload_cost = arch_env->reload_cost;
env->spill_cost = isa_if->spill_cost;
env->reload_cost = isa_if->reload_cost;
ir_nodehashmap_init(&env->spillmap);
obstack_init(&env->obst);
return env;
......
......@@ -1439,23 +1439,9 @@ static void ia32_finish(void)
obstack_free(&opcodes_obst, NULL);
}
/**
* The template that generates a new ISA object.
* Note that this template can be changed by command line
* arguments.
*/
static ia32_isa_t ia32_isa_template = {
.base = {
.spill_cost = 7,
.reload_cost = 5,
},
};
static arch_env_t *ia32_begin_codegeneration(void)
{
ia32_isa_t *isa = XMALLOC(ia32_isa_t);
*isa = ia32_isa_template;
isa->tv_ent = pmap_create();
return &isa->base;
......@@ -1587,6 +1573,8 @@ static arch_isa_if_t const ia32_isa_if = {
.registers = ia32_registers,
.n_register_classes = N_IA32_CLASSES,
.register_classes = ia32_reg_classes,
.spill_cost = 7,
.reload_cost = 5,
.init = ia32_init,
.finish = ia32_finish,
.get_params = ia32_get_libfirm_params,
......
......@@ -38,13 +38,6 @@
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
static sparc_isa_t sparc_isa_template = {
.base = {
.spill_cost = 7,
.reload_cost = 5,
},
};
ir_mode *sparc_mode_Q;
typedef enum {
......@@ -389,7 +382,6 @@ static void sparc_finish(void)
static arch_env_t *sparc_begin_codegeneration(void)
{
sparc_isa_t *isa = XMALLOC(sparc_isa_t);
*isa = sparc_isa_template;
isa->constants = pmap_create();
be_gas_elf_type_char = '#';
......@@ -555,6 +547,8 @@ static arch_isa_if_t const sparc_isa_if = {
.registers = sparc_registers,
.n_register_classes = N_SPARC_CLASSES,
.register_classes = sparc_reg_classes,
.spill_cost = 7,
.reload_cost = 5,
.init = sparc_init,
.finish = sparc_finish,
.get_params = sparc_get_backend_params,
......
Markdown is supported
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