ask abi about ignore regs
authorMatthias Braun <matze@braunis.de>
Mon, 28 Aug 2006 12:21:55 +0000 (12:21 +0000)
committerMatthias Braun <matze@braunis.de>
Mon, 28 Aug 2006 12:21:55 +0000 (12:21 +0000)
ir/be/bearch.h
ir/be/bespillmorgan.c

index 1804f77..80a70cb 100644 (file)
@@ -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.
index db86172..2dfde64 100644 (file)
@@ -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);