Since we're now using the var_info's vm type for register allocation, we
can use it for spill/reload too, which gets rid of machine_reg_type
entirely.

Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com>
---
 arch/mmix/include/arch/registers.h  |    2 --
 arch/mmix/register.c                |    5 -----
 arch/x86/include/arch/instruction.h |   26 ++++++++------------------
 include/jit/vars.h                  |    6 ------
 jit/compilation-unit.c              |   10 +++-------
 5 files changed, 11 insertions(+), 38 deletions(-)

diff --git a/arch/mmix/include/arch/registers.h 
b/arch/mmix/include/arch/registers.h
index d5c1d51..48634ee 100644
--- a/arch/mmix/include/arch/registers.h
+++ b/arch/mmix/include/arch/registers.h
@@ -19,8 +19,6 @@ enum machine_reg {
        MACH_REG_UNASSIGNED = ~0UL,
 };
 
-enum machine_reg_type reg_type(enum machine_reg reg);
-
 static inline bool reg_supports_type(enum machine_reg reg, enum vm_type type)
 {
        return true;
diff --git a/arch/mmix/register.c b/arch/mmix/register.c
index 53504af..1cde43d 100644
--- a/arch/mmix/register.c
+++ b/arch/mmix/register.c
@@ -1,7 +1,2 @@
 #include "arch/registers.h"
 #include "jit/vars.h"
-
-enum machine_reg_type reg_type(enum machine_reg reg)
-{
-       return REG_TYPE_GPR;
-}
diff --git a/arch/x86/include/arch/instruction.h 
b/arch/x86/include/arch/instruction.h
index 1932e47..3de5bcc 100644
--- a/arch/x86/include/arch/instruction.h
+++ b/arch/x86/include/arch/instruction.h
@@ -237,16 +237,11 @@ spill_insn(struct var_info *var, struct stack_slot *slot)
 
        assert(slot != NULL);
 
-       switch (var->type) {
-       case REG_TYPE_GPR:
-               insn_type = INSN_MOV_REG_MEMLOCAL;
-               break;
-       case REG_TYPE_FPU:
+       if (var->vm_type == J_FLOAT || var->vm_type == J_DOUBLE)
                insn_type = INSN_MOV_XMM_MEMLOCAL;
-               break;
-       default:
-               die("unknown register type: %d", var->type);
-       }
+       else
+               insn_type = INSN_MOV_REG_MEMLOCAL;
+
        return reg_memlocal_insn(insn_type, var, slot);
 }
 
@@ -257,16 +252,11 @@ reload_insn(struct stack_slot *slot, struct var_info *var)
 
        assert(slot != NULL);
 
-       switch (var->type) {
-       case REG_TYPE_GPR:
-               insn_type = INSN_MOV_MEMLOCAL_REG;
-               break;
-       case REG_TYPE_FPU:
+       if (var->vm_type == J_FLOAT || var->vm_type == J_DOUBLE)
                insn_type = INSN_MOV_MEMLOCAL_XMM;
-               break;
-       default:
-               die("unknown register type: %d", var->type);
-       }
+       else
+               insn_type = INSN_MOV_MEMLOCAL_REG;
+
        return memlocal_reg_insn(insn_type, slot, var);
 }
 
diff --git a/include/jit/vars.h b/include/jit/vars.h
index 07aa6be..177c283 100644
--- a/include/jit/vars.h
+++ b/include/jit/vars.h
@@ -48,16 +48,10 @@ static inline bool range_is_empty(struct live_range *range)
 
 struct live_interval;
 
-enum machine_reg_type {
-       REG_TYPE_GPR,
-       REG_TYPE_FPU,
-};
-
 struct var_info {
        unsigned long           vreg;
        struct var_info         *next;
        struct live_interval    *interval;
-       enum machine_reg_type   type;
        enum vm_type            vm_type;
 };
 
diff --git a/jit/compilation-unit.c b/jit/compilation-unit.c
index e8a044b..f067e11 100644
--- a/jit/compilation-unit.c
+++ b/jit/compilation-unit.c
@@ -41,7 +41,7 @@
 #include <string.h>
 
 static struct var_info *
-do_get_var(struct compilation_unit *cu, enum vm_type vm_type, enum 
machine_reg_type reg_type)
+do_get_var(struct compilation_unit *cu, enum vm_type vm_type)
 {
        struct var_info *ret;
 
@@ -58,7 +58,6 @@ do_get_var(struct compilation_unit *cu, enum vm_type vm_type, 
enum machine_reg_t
        ret->interval = alloc_interval(ret);
 
        ret->vm_type = vm_type;
-       ret->type = reg_type;
 
        cu->var_infos = ret;
   out:
@@ -101,7 +100,7 @@ struct compilation_unit *compilation_unit_alloc(struct 
vm_method *method)
                for (unsigned int i = 0; i < NR_FIXED_REGISTERS; ++i) {
                        struct var_info *ret;
 
-                       ret = do_get_var(cu, GPR_VM_TYPE, REG_TYPE_GPR);
+                       ret = do_get_var(cu, GPR_VM_TYPE);
                        if (ret) {
                                ret->interval->reg = i;
                                ret->interval->fixed_reg = true;
@@ -177,10 +176,7 @@ void free_compilation_unit(struct compilation_unit *cu)
 
 struct var_info *get_var(struct compilation_unit *cu, enum vm_type vm_type)
 {
-       if (vm_type == J_FLOAT || vm_type == J_DOUBLE)
-               return do_get_var(cu, vm_type, REG_TYPE_FPU);
-
-       return do_get_var(cu, vm_type, REG_TYPE_GPR);
+       return do_get_var(cu, vm_type);
 }
 
 struct var_info *get_fixed_var(struct compilation_unit *cu, enum machine_reg 
reg)
-- 
1.6.0.6


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to