From 27d58523cf1d493304a31e57adfdd0450d41230d Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 24 Jun 2004 04:11:46 +0000 Subject: [PATCH] Use separate JIT_REG_xxx flags for float32, float64, and nfloat because some platforms need to put these values in different types of registers (e.g. x86-64). --- ChangeLog | 8 +++++++ jit/jit-reg-alloc.c | 12 +++++++++- jit/jit-rules-arm.h | 3 ++- jit/jit-rules-interp.c | 8 ++++++- jit/jit-rules-interp.h | 50 +++++++++++++++--------------------------- jit/jit-rules-x86.h | 22 ++++++++++--------- jit/jit-rules.h | 22 +++++++++++-------- 7 files changed, 71 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index f350a76..d97fd13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,12 @@ +2004-06-24 Rhys Weatherley + + * jit/jit-reg-alloc.c, jit/jit-rules-arm.h, jit/jit-rules-interp.c, + jit/jit-rules-interp.h, jit/jit-rules-x86.h, jit/jit-rules.h: + use separate JIT_REG_xxx flags for float32, float64, and nfloat + because some platforms need to put these values in different + types of registers (e.g. x86-64). + 2004-06-22 Rhys Weatherley * jit/jit-insn.c: properly set the "may_throw" flag for opcodes diff --git a/jit/jit-reg-alloc.c b/jit/jit-reg-alloc.c index 4348f5c..6b34c4d 100644 --- a/jit/jit-reg-alloc.c +++ b/jit/jit-reg-alloc.c @@ -955,10 +955,20 @@ static int free_register_for_value break; case JIT_TYPE_FLOAT32: + { + type = JIT_REG_FLOAT32; + } + break; + case JIT_TYPE_FLOAT64: + { + type = JIT_REG_FLOAT64; + } + break; + case JIT_TYPE_NFLOAT: { - type = JIT_REG_FLOAT; + type = JIT_REG_NFLOAT; } break; diff --git a/jit/jit-rules-arm.h b/jit/jit-rules-arm.h index 0e9e642..9b400f1 100644 --- a/jit/jit-rules-arm.h +++ b/jit/jit-rules-arm.h @@ -43,7 +43,8 @@ extern "C" { * The floating-point registers are only present on some ARM cores. */ #ifdef JIT_ARM_HAS_FLOAT_REGS - #define JIT_REG_ARM_FLOAT JIT_REG_FLOAT | JIT_REG_CALL_USED + #define JIT_REG_ARM_FLOAT \ + (JIT_REG_FLOAT32 | JIT_REG_FLOAT64 | JIT_REG_NFLOAT | JIT_REG_CALL_USED) #else #define JIT_REG_ARM_FLOAT JIT_REG_FIXED #endif diff --git a/jit/jit-rules-interp.c b/jit/jit-rules-interp.c index 183a222..6242247 100644 --- a/jit/jit-rules-interp.c +++ b/jit/jit-rules-interp.c @@ -83,7 +83,13 @@ This register can hold an integer word value. This register can hold a 64-bit long value without needing a second register. Normally only used on 64-bit platforms. -@item JIT_REG_FLOAT +@item JIT_REG_FLOAT32 +This register can hold a 32-bit floating-point value. + +@item JIT_REG_FLOAT64 +This register can hold a 64-bit floating-point value. + +@item JIT_REG_NFLOAT This register can hold a native floating-point value. @item JIT_REG_FRAME diff --git a/jit/jit-rules-interp.h b/jit/jit-rules-interp.h index a6d0215..f46c71f 100644 --- a/jit/jit-rules-interp.h +++ b/jit/jit-rules-interp.h @@ -31,38 +31,24 @@ extern "C" { * Information about all of the registers, in allocation order. */ #define JIT_REG_INFO \ - {"r0", 0, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_START_STACK | JIT_REG_IN_STACK}, \ - {"r1", 1, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r2", 2, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r3", 3, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r4", 4, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r5", 5, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r6", 6, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r7", 7, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r8", 8, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r9", 9, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r10", 10, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r11", 11, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r12", 12, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r13", 13, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r14", 14, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"r15", 15, -1, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT | \ - JIT_REG_CALL_USED | JIT_REG_END_STACK | JIT_REG_IN_STACK}, + {"r0", 0, -1, JIT_REG_ALL | JIT_REG_CALL_USED | \ + JIT_REG_START_STACK | JIT_REG_IN_STACK}, \ + {"r1", 1, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r2", 2, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r3", 3, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r4", 4, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r5", 5, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r6", 6, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r7", 7, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r8", 8, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r9", 9, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r10", 10, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r11", 11, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r12", 12, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r13", 13, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r14", 14, -1, JIT_REG_ALL | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"r15", 15, -1, JIT_REG_ALL | JIT_REG_CALL_USED | \ + JIT_REG_END_STACK | JIT_REG_IN_STACK}, #define JIT_NUM_REGS 16 #define JIT_NUM_GLOBAL_REGS 0 diff --git a/jit/jit-rules-x86.h b/jit/jit-rules-x86.h index 74a2100..6d68a3b 100644 --- a/jit/jit-rules-x86.h +++ b/jit/jit-rules-x86.h @@ -28,6 +28,8 @@ extern "C" { /* * Information about all of the registers, in allocation order. */ +#define JIT_REG_X86_FLOAT \ + (JIT_REG_FLOAT32 | JIT_REG_FLOAT64 | JIT_REG_NFLOAT) #define JIT_REG_INFO \ {"eax", 0, 2, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_CALL_USED}, \ {"ecx", 1, 3, JIT_REG_WORD | JIT_REG_LONG | JIT_REG_CALL_USED}, \ @@ -37,16 +39,16 @@ extern "C" { {"edi", 7, -1, JIT_REG_WORD | JIT_REG_GLOBAL}, \ {"ebp", 4, -1, JIT_REG_FRAME | JIT_REG_FIXED}, \ {"esp", 5, -1, JIT_REG_STACK_PTR | JIT_REG_FIXED | JIT_REG_CALL_USED}, \ - {"st", 0, -1, JIT_REG_FLOAT | JIT_REG_CALL_USED | JIT_REG_START_STACK | \ - JIT_REG_IN_STACK}, \ - {"st1", 1, -1, JIT_REG_FLOAT | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"st2", 2, -1, JIT_REG_FLOAT | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"st3", 3, -1, JIT_REG_FLOAT | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"st4", 4, -1, JIT_REG_FLOAT | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"st5", 5, -1, JIT_REG_FLOAT | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"st6", 6, -1, JIT_REG_FLOAT | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ - {"st7", 7, -1, JIT_REG_FLOAT | JIT_REG_CALL_USED | JIT_REG_END_STACK | \ - JIT_REG_IN_STACK}, + {"st", 0, -1, JIT_REG_X86_FLOAT | JIT_REG_CALL_USED | \ + JIT_REG_START_STACK | JIT_REG_IN_STACK}, \ + {"st1", 1, -1, JIT_REG_X86_FLOAT | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"st2", 2, -1, JIT_REG_X86_FLOAT | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"st3", 3, -1, JIT_REG_X86_FLOAT | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"st4", 4, -1, JIT_REG_X86_FLOAT | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"st5", 5, -1, JIT_REG_X86_FLOAT | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"st6", 6, -1, JIT_REG_X86_FLOAT | JIT_REG_CALL_USED | JIT_REG_IN_STACK}, \ + {"st7", 7, -1, JIT_REG_X86_FLOAT | JIT_REG_CALL_USED | \ + JIT_REG_END_STACK | JIT_REG_IN_STACK}, #define JIT_NUM_REGS 16 #define JIT_NUM_GLOBAL_REGS 3 diff --git a/jit/jit-rules.h b/jit/jit-rules.h index 224830b..278daab 100644 --- a/jit/jit-rules.h +++ b/jit/jit-rules.h @@ -60,15 +60,19 @@ typedef struct */ #define JIT_REG_WORD (1 << 0) /* Can be used for word values */ #define JIT_REG_LONG (1 << 1) /* Can be used for long values */ -#define JIT_REG_FLOAT (1 << 2) /* Can be used for float values */ -#define JIT_REG_FRAME (1 << 3) /* Contains frame pointer */ -#define JIT_REG_STACK_PTR (1 << 4) /* Contains CPU stack pointer */ -#define JIT_REG_FIXED (1 << 5) /* Fixed use; not for allocation */ -#define JIT_REG_CALL_USED (1 << 6) /* Destroyed by a call */ -#define JIT_REG_START_STACK (1 << 7) /* Stack of stack-like allocation */ -#define JIT_REG_END_STACK (1 << 8) /* End of stack-like allocation */ -#define JIT_REG_IN_STACK (1 << 9) /* Middle of stack-like allocation */ -#define JIT_REG_GLOBAL (1 << 10) /* Candidate for global allocation */ +#define JIT_REG_FLOAT32 (1 << 2) /* Can be used for float32 values */ +#define JIT_REG_FLOAT64 (1 << 3) /* Can be used for float64 values */ +#define JIT_REG_NFLOAT (1 << 4) /* Can be used for nfloat values */ +#define JIT_REG_FRAME (1 << 5) /* Contains frame pointer */ +#define JIT_REG_STACK_PTR (1 << 6) /* Contains CPU stack pointer */ +#define JIT_REG_FIXED (1 << 7) /* Fixed use; not for allocation */ +#define JIT_REG_CALL_USED (1 << 8) /* Destroyed by a call */ +#define JIT_REG_START_STACK (1 << 9) /* Stack of stack-like allocation */ +#define JIT_REG_END_STACK (1 << 10) /* End of stack-like allocation */ +#define JIT_REG_IN_STACK (1 << 11) /* Middle of stack-like allocation */ +#define JIT_REG_GLOBAL (1 << 12) /* Candidate for global allocation */ +#define JIT_REG_ALL (JIT_REG_WORD | JIT_REG_LONG | JIT_REG_FLOAT32 | \ + JIT_REG_FLOAT64 | JIT_REG_NFLOAT) /* * Include definitions that are specific to the backend.