From 59b137d61db356ba854ef709bb36ae2bf08c3a32 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Mon, 28 Aug 2006 12:21:55 +0000 Subject: [PATCH] ask abi about ignore regs --- ir/be/bearch.h | 9 --------- ir/be/bespillmorgan.c | 10 +++++++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ir/be/bearch.h b/ir/be/bearch.h index 1804f77cf..80a70cb3c 100644 --- a/ir/be/bearch.h +++ b/ir/be/bearch.h @@ -424,15 +424,6 @@ extern int arch_get_allocatable_regs(const arch_env_t *env, const ir_node *irn, */ extern void arch_put_non_ignore_regs(const arch_env_t *env, const arch_register_class_t *cls, bitset_t *bs); -/** - * Return the number of registers in a register class which should not be - * ignored by the register allocator. - * @param env The architecture environment. - * @param cls The register class to consider - * @return The number of non-ignore registers in the register class - */ -extern int arch_count_non_ignore_regs(const arch_env_t *env, const arch_register_class_t *cls); - /** * Check, if a register is assignable to an operand of a node. * @param env The architecture environment. diff --git a/ir/be/bespillmorgan.c b/ir/be/bespillmorgan.c index db86172ae..2dfde6420 100644 --- a/ir/be/bespillmorgan.c +++ b/ir/be/bespillmorgan.c @@ -14,6 +14,7 @@ #include "bechordal_t.h" #include "bespill.h" #include "belive_t.h" +#include "beabi.h" #include "irgwalk.h" #include "besched.h" #include "beutil.h" @@ -452,6 +453,13 @@ static int reduce_register_pressure_in_loop(morgan_env_t *env, const ir_loop *lo return outer_spills_needed; } +static int count_available_registers(be_abi_irg_t *abi, const arch_register_class_t *cls) +{ + bitset_t* bs = bitset_alloca(cls->n_regs); + be_abi_put_ignore_regs(abi, cls, bs); + return bitset_popcnt(bs); +} + void be_spill_morgan(be_chordal_env_t *chordal_env) { morgan_env_t env; @@ -467,7 +475,7 @@ void be_spill_morgan(be_chordal_env_t *chordal_env) { obstack_init(&env.obst); - env.registers_available = arch_count_non_ignore_regs(env.arch, env.cls); + env.registers_available = count_available_registers(chordal_env->birg->abi, chordal_env->cls); env.loop_attr_set = new_set(loop_attr_cmp, 5); env.block_attr_set = new_set(block_attr_cmp, 20); -- 2.20.1