[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] libjit jit/jit-apply-alpha.c jit/jit-rules-alph...
From: |
Thomas Cort |
Subject: |
[dotgnu-pnet-commits] libjit jit/jit-apply-alpha.c jit/jit-rules-alph... |
Date: |
Sun, 20 Aug 2006 15:47:54 +0000 |
CVSROOT: /sources/dotgnu-pnet
Module name: libjit
Changes by: Thomas Cort <tcort> 06/08/20 15:47:54
Modified files:
jit : jit-apply-alpha.c jit-rules-alpha.c
jit-apply-alpha.h jit-gen-alpha.h
jit-rules-alpha.h jit-rules-alpha.ins
. : ChangeLog
Log message:
Remove unnecessary code from the prolog, epilog, redirector, and
closure. Implement > and >= opcodes for signed and unsigned values.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-apply-alpha.c?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-rules-alpha.c?cvsroot=dotgnu-pnet&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-apply-alpha.h?cvsroot=dotgnu-pnet&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-gen-alpha.h?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-rules-alpha.h?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-rules-alpha.ins?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/libjit/ChangeLog?cvsroot=dotgnu-pnet&r1=1.250&r2=1.251
Patches:
Index: jit/jit-apply-alpha.c
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-apply-alpha.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- jit/jit-apply-alpha.c 23 Jul 2006 04:45:36 -0000 1.4
+++ jit/jit-apply-alpha.c 20 Aug 2006 15:47:54 -0000 1.5
@@ -27,17 +27,17 @@
void _jit_create_closure(unsigned char *buf, void *func, void *closure, void
*_type) {
alpha_inst inst = (alpha_inst) buf;
- /* Compute and load the global pointer */
+ /* Compute and load the global pointer (2 instructions) */
alpha_ldah(inst,ALPHA_GP,ALPHA_PV,0);
alpha_lda( inst,ALPHA_GP,ALPHA_GP,0);
- /* Allocate space for a new stack frame. */
+ /* Allocate space for a new stack frame. (1 instruction) */
alpha_lda(inst,ALPHA_SP,ALPHA_SP,-(13*8));
- /* Save the return address. */
+ /* Save the return address. (1 instruction) */
alpha_stq(inst,ALPHA_RA,ALPHA_SP,0*8);
- /* Save integer register arguments as local variables */
+ /* Save integer register arguments as local variables (6 instructions)
*/
alpha_stq(inst,ALPHA_A0,ALPHA_SP,1*8);
alpha_stq(inst,ALPHA_A1,ALPHA_SP,2*8);
alpha_stq(inst,ALPHA_A2,ALPHA_SP,3*8);
@@ -45,7 +45,7 @@
alpha_stq(inst,ALPHA_A4,ALPHA_SP,5*8);
alpha_stq(inst,ALPHA_A5,ALPHA_SP,6*8);
- /* Save floating-point register arguments as local variables */
+ /* Save floating-point register arguments as local variables (8
instructions) */
alpha_stt(inst,ALPHA_FA0,ALPHA_SP, 7*8);
alpha_stt(inst,ALPHA_FA1,ALPHA_SP, 8*8);
alpha_stt(inst,ALPHA_FA2,ALPHA_SP, 9*8);
@@ -53,13 +53,13 @@
alpha_stt(inst,ALPHA_FA4,ALPHA_SP,11*8);
alpha_stt(inst,ALPHA_FA5,ALPHA_SP,12*8);
- /* Call the closure handling function */
+ /* Call the closure handling function (1 instruction) */
alpha_call(inst,func);
- /* Restore the return address */
+ /* Restore the return address (1 instruction) */
alpha_ldq(inst,ALPHA_RA,ALPHA_SP,0*8);
- /* Restore integer register arguments */
+ /* Restore integer register arguments (6 instructions) */
alpha_ldq(inst,ALPHA_A0,ALPHA_SP,1*8);
alpha_ldq(inst,ALPHA_A1,ALPHA_SP,2*8);
alpha_ldq(inst,ALPHA_A2,ALPHA_SP,3*8);
@@ -67,7 +67,7 @@
alpha_ldq(inst,ALPHA_A4,ALPHA_SP,5*8);
alpha_ldq(inst,ALPHA_A5,ALPHA_SP,6*8);
- /* Restore floating-point register arguments */
+ /* Restore floating-point register arguments (8 instructions) */
alpha_ldt(inst,ALPHA_FA0,ALPHA_SP, 7*8);
alpha_ldt(inst,ALPHA_FA1,ALPHA_SP, 8*8);
alpha_ldt(inst,ALPHA_FA2,ALPHA_SP, 9*8);
@@ -75,7 +75,7 @@
alpha_ldt(inst,ALPHA_FA4,ALPHA_SP,11*8);
alpha_ldt(inst,ALPHA_FA5,ALPHA_SP,12*8);
- /* restore the stack pointer */
+ /* restore the stack pointer (1 instruction) */
alpha_lda(inst,ALPHA_SP,ALPHA_SP,(13*8));
}
@@ -112,63 +112,16 @@
/* Set the frame pointer (1 instruction) */
alpha_mov(inst,ALPHA_SP,ALPHA_FP);
- /* Force any pending hardware exceptions to be raised. (1 instruction)
*/
- alpha_trapb(inst);
-
- /* Compute and load the global pointer */
+ /* Compute and load the global pointer (2 instructions) */
alpha_ldah(inst,ALPHA_GP,ALPHA_PV,0);
alpha_lda( inst,ALPHA_GP,ALPHA_GP,0);
- /* Allocate space for a new stack frame. */
- alpha_lda(inst,ALPHA_SP,ALPHA_SP,-(13*8));
-
- /* Save the return address. */
- alpha_stq(inst,ALPHA_RA,ALPHA_SP,0*8);
-
- /* Save integer register arguments as local variables */
- alpha_stq(inst,ALPHA_A0,ALPHA_SP,1*8);
- alpha_stq(inst,ALPHA_A1,ALPHA_SP,2*8);
- alpha_stq(inst,ALPHA_A2,ALPHA_SP,3*8);
- alpha_stq(inst,ALPHA_A3,ALPHA_SP,4*8);
- alpha_stq(inst,ALPHA_A4,ALPHA_SP,5*8);
- alpha_stq(inst,ALPHA_A5,ALPHA_SP,6*8);
-
- /* Save floating-point register arguments as local variables */
- alpha_stt(inst,ALPHA_FA0,ALPHA_SP, 7*8);
- alpha_stt(inst,ALPHA_FA1,ALPHA_SP, 8*8);
- alpha_stt(inst,ALPHA_FA2,ALPHA_SP, 9*8);
- alpha_stt(inst,ALPHA_FA3,ALPHA_SP,10*8);
- alpha_stt(inst,ALPHA_FA4,ALPHA_SP,11*8);
- alpha_stt(inst,ALPHA_FA5,ALPHA_SP,12*8);
+ /* Force any pending hardware exceptions to be raised. (1 instruction)
*/
+ alpha_trapb(inst);
- /* Call the redirector handling function */
+ /* Call the redirector handling function (1 instruction) */
alpha_call(inst, func);
- /* Restore the return address */
- alpha_ldq(inst,ALPHA_RA,ALPHA_SP,0*8);
-
- /* Restore integer register arguments */
- alpha_ldq(inst,ALPHA_A0,ALPHA_SP,1*8);
- alpha_ldq(inst,ALPHA_A1,ALPHA_SP,2*8);
- alpha_ldq(inst,ALPHA_A2,ALPHA_SP,3*8);
- alpha_ldq(inst,ALPHA_A3,ALPHA_SP,4*8);
- alpha_ldq(inst,ALPHA_A4,ALPHA_SP,5*8);
- alpha_ldq(inst,ALPHA_A5,ALPHA_SP,6*8);
-
- /* Restore floating-point register arguments */
- alpha_ldt(inst,ALPHA_FA0,ALPHA_SP, 7*8);
- alpha_ldt(inst,ALPHA_FA1,ALPHA_SP, 8*8);
- alpha_ldt(inst,ALPHA_FA2,ALPHA_SP, 9*8);
- alpha_ldt(inst,ALPHA_FA3,ALPHA_SP,10*8);
- alpha_ldt(inst,ALPHA_FA4,ALPHA_SP,11*8);
- alpha_ldt(inst,ALPHA_FA5,ALPHA_SP,12*8);
-
- /* restore the stack pointer */
- alpha_lda(inst,ALPHA_SP,ALPHA_SP,(13*8));
-
- /* Set the stack pointer */
- alpha_mov(inst,ALPHA_FP,ALPHA_SP);
-
/* Restore the return address. (1 instruction) */
alpha_ldq(inst,ALPHA_RA,ALPHA_SP,0*8);
@@ -199,7 +152,7 @@
/* Force any pending hardware exceptions to be raised. (1 instruction)
*/
alpha_trapb(inst);
- /* Jump to the function that the redirector indicated */
+ /* Jump to the function that the redirector indicated (1 instruction) */
alpha_jsr(inst,ALPHA_RA,ALPHA_V0,1);
/* Return the start of the buffer as the redirector entry point */
Index: jit/jit-rules-alpha.c
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-rules-alpha.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- jit/jit-rules-alpha.c 15 Aug 2006 01:09:00 -0000 1.6
+++ jit/jit-rules-alpha.c 20 Aug 2006 15:47:54 -0000 1.7
@@ -147,7 +147,7 @@
alpha_lda( inst,ALPHA_GP,ALPHA_GP,0);
/* Allocate space for a new stack frame. (1 instruction) */
- alpha_lda(inst,ALPHA_SP,ALPHA_SP,-(16*8));
+ alpha_lda(inst,ALPHA_SP,ALPHA_SP,-(2*8));
/* Save the return address. (1 instruction) */
alpha_stq(inst,ALPHA_RA,ALPHA_SP,0*8);
@@ -155,24 +155,6 @@
/* Save the frame pointer. (1 instruction) */
alpha_stq(inst,ALPHA_FP,ALPHA_SP,1*8);
- /* Save the integer save registers (6 instructions) */
- alpha_stq(inst,ALPHA_S0,ALPHA_SP,2*8);
- alpha_stq(inst,ALPHA_S1,ALPHA_SP,3*8);
- alpha_stq(inst,ALPHA_S2,ALPHA_SP,4*8);
- alpha_stq(inst,ALPHA_S3,ALPHA_SP,5*8);
- alpha_stq(inst,ALPHA_S4,ALPHA_SP,6*8);
- alpha_stq(inst,ALPHA_S5,ALPHA_SP,7*8);
-
- /* Save the floating point save registers (8 instructions) */
- alpha_stt(inst,ALPHA_FS0,ALPHA_SP, 8*8);
- alpha_stt(inst,ALPHA_FS1,ALPHA_SP, 9*8);
- alpha_stt(inst,ALPHA_FS2,ALPHA_SP,10*8);
- alpha_stt(inst,ALPHA_FS3,ALPHA_SP,11*8);
- alpha_stt(inst,ALPHA_FS4,ALPHA_SP,12*8);
- alpha_stt(inst,ALPHA_FS5,ALPHA_SP,13*8);
- alpha_stt(inst,ALPHA_FS6,ALPHA_SP,14*8);
- alpha_stt(inst,ALPHA_FS7,ALPHA_SP,15*8);
-
/* Set the frame pointer (1 instruction) */
alpha_mov(inst,ALPHA_SP,ALPHA_FP);
@@ -219,24 +201,6 @@
/* Restore the frame pointer. (1 instruction) */
alpha_ldq(inst,ALPHA_FP,ALPHA_SP,1*8);
- /* Restore the integer save registers (6 instructions) */
- alpha_ldq(inst,ALPHA_S0,ALPHA_SP,2*8);
- alpha_ldq(inst,ALPHA_S1,ALPHA_SP,3*8);
- alpha_ldq(inst,ALPHA_S2,ALPHA_SP,4*8);
- alpha_ldq(inst,ALPHA_S3,ALPHA_SP,5*8);
- alpha_ldq(inst,ALPHA_S4,ALPHA_SP,6*8);
- alpha_ldq(inst,ALPHA_S5,ALPHA_SP,7*8);
-
- /* Restore the floating point save registers (8 instructions) */
- alpha_ldt(inst,ALPHA_FS0,ALPHA_SP, 8*8);
- alpha_ldt(inst,ALPHA_FS1,ALPHA_SP, 9*8);
- alpha_ldt(inst,ALPHA_FS2,ALPHA_SP,10*8);
- alpha_ldt(inst,ALPHA_FS3,ALPHA_SP,11*8);
- alpha_ldt(inst,ALPHA_FS4,ALPHA_SP,12*8);
- alpha_ldt(inst,ALPHA_FS5,ALPHA_SP,13*8);
- alpha_ldt(inst,ALPHA_FS6,ALPHA_SP,14*8);
- alpha_ldt(inst,ALPHA_FS7,ALPHA_SP,15*8);
-
/* Restore the stack pointer (1 instruction) */
alpha_lda(inst,ALPHA_SP,ALPHA_SP,16*8);
Index: jit/jit-apply-alpha.h
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-apply-alpha.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- jit/jit-apply-alpha.h 23 Jul 2006 04:45:36 -0000 1.2
+++ jit/jit-apply-alpha.h 20 Aug 2006 15:47:54 -0000 1.3
@@ -25,14 +25,14 @@
* The maximum number of bytes that are needed to represent a closure,
* and the alignment to use for the closure.
*/
-#define jit_closure_size (32 /* instructions */ * 4 /* bytes
per instruction */)
+#define jit_closure_size (35 /* instructions */ * 4 /* bytes
per instruction */)
#define jit_closure_align 32
/*
* The number of bytes that are needed for a redirector stub.
* This includes any extra bytes that are needed for alignment.
*/
-#define jit_redirector_size (100 /* instructions */ * 4 /* bytes
per instruction */)
+#define jit_redirector_size (41 /* instructions */ * 4 /* bytes
per instruction */)
/*
* We should pad unused code space with NOP's.
Index: jit/jit-gen-alpha.h
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-gen-alpha.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- jit/jit-gen-alpha.h 23 Jul 2006 04:45:36 -0000 1.4
+++ jit/jit-gen-alpha.h 20 Aug 2006 15:47:54 -0000 1.5
@@ -500,6 +500,19 @@
#define alpha_subqv(inst,sreg0,sreg1,dreg)
alpha_encode_regops(inst,ALPHA_OP_SUBQV,ALPHA_FUNC_SUBQV,sreg0,sreg1,dreg)
#define alpha_cmple(inst,sreg0,sreg1,dreg)
alpha_encode_regops(inst,ALPHA_OP_CMPLE,ALPHA_FUNC_CMPLE,sreg0,sreg1,dreg)
+/*
+ * pseudo comparison operations
+ *
+ * Alpha doesn't have all possible comparison opcodes. For example, we
+ * have cmple for A <= B, but no cmpge for A >= B. So we make cmpge by
+ * using cmple with the operands switched. Example, A >= B becomes B <= A
+ */
+#define alpha_cmpble(inst,sreg0,sreg1,dreg)
alpha_encode_regops(inst,ALPHA_OP_CMPBGE,ALPHA_FUNC_CMPBGE,sreg1,sreg0,dreg)
+#define alpha_cmpugt(inst,sreg0,sreg1,dreg)
alpha_encode_regops(inst,ALPHA_OP_CMPULT,ALPHA_FUNC_CMPULT,sreg1,sreg0,dreg)
+#define alpha_cmpuge(inst,sreg0,sreg1,dreg)
alpha_encode_regops(inst,ALPHA_OP_CMPULE,ALPHA_FUNC_CMPULE,sreg1,sreg0,dreg)
+#define alpha_cmpgt(inst,sreg0,sreg1,dreg)
alpha_encode_regops(inst,ALPHA_OP_CMPLT,ALPHA_FUNC_CMPLT,sreg1,sreg0,dreg)
+#define alpha_cmpge(inst,sreg0,sreg1,dreg)
alpha_encode_regops(inst,ALPHA_OP_CMPLE,ALPHA_FUNC_CMPLE,sreg1,sreg0,dreg)
+
/* bitwise / move operations */
#define alpha_and(inst,sreg0,sreg1,dreg)
alpha_encode_regops(inst,ALPHA_OP_AND,ALPHA_FUNC_AND,sreg0,sreg1,dreg)
#define alpha_bic(inst,sreg0,sreg1,dreg)
alpha_encode_regops(inst,ALPHA_OP_BIC,ALPHA_FUNC_BIC,sreg0,sreg1,dreg)
Index: jit/jit-rules-alpha.h
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-rules-alpha.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- jit/jit-rules-alpha.h 15 Aug 2006 01:09:00 -0000 1.5
+++ jit/jit-rules-alpha.h 20 Aug 2006 15:47:54 -0000 1.6
@@ -153,7 +153,7 @@
* The maximum number of bytes to allocate for the prolog.
* This may be shortened once we know the true prolog size.
*/
-#define JIT_PROLOG_SIZE (21 /* instructions */ * 4 /*
bytes per instruction */)
+#define JIT_PROLOG_SIZE (7 /* instructions */ * 4 /*
bytes per instruction */)
/*
* Preferred alignment for the start of functions.
Index: jit/jit-rules-alpha.ins
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-rules-alpha.ins,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- jit/jit-rules-alpha.ins 15 Aug 2006 01:09:00 -0000 1.4
+++ jit/jit-rules-alpha.ins 20 Aug 2006 15:47:54 -0000 1.5
@@ -307,9 +307,41 @@
alpha_output_branch(func, inst, ALPHA_OP_BEQ, insn, ALPHA_AT);
}
+JIT_OP_BR_IGT:
+ [reg, reg] -> {
+ /* $1 <= $2 -> $at */
+ alpha_cmpgt(inst, $1, $2, ALPHA_AT);
-/* TODO: JIT_OP_BR_IGT JIT_OP_BR_IGT_UN */
-/* TODO: JIT_OP_BR_IGE JIT_OP_BR_IGE_UN */
+ /* branch if $at == 1 */
+ alpha_output_branch(func, inst, ALPHA_OP_BEQ, insn, ALPHA_AT);
+ }
+
+JIT_OP_BR_IGT_UN:
+ [reg, reg] -> {
+ /* $1 > $2 -> $at */
+ alpha_cmpugt(inst, $1, $2, ALPHA_AT);
+
+ /* branch if $at == 1 */
+ alpha_output_branch(func, inst, ALPHA_OP_BEQ, insn, ALPHA_AT);
+ }
+
+JIT_OP_BR_IGE:
+ [reg, reg] -> {
+ /* $1 >= $2 -> $at */
+ alpha_cmpge(inst, $1, $2, ALPHA_AT);
+
+ /* branch if $at == 1 */
+ alpha_output_branch(func, inst, ALPHA_OP_BEQ, insn, ALPHA_AT);
+ }
+
+JIT_OP_BR_IGE_UN:
+ [reg, reg] -> {
+ /* $1 >= $2 -> $at */
+ alpha_cmpuge(inst, $1, $2, ALPHA_AT);
+
+ /* branch if $at == 1 */
+ alpha_output_branch(func, inst, ALPHA_OP_BEQ, insn, ALPHA_AT);
+ }
/*
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/ChangeLog,v
retrieving revision 1.250
retrieving revision 1.251
diff -u -b -r1.250 -r1.251
--- ChangeLog 18 Aug 2006 18:14:27 -0000 1.250
+++ ChangeLog 20 Aug 2006 15:47:54 -0000 1.251
@@ -1,3 +1,10 @@
+2006-08-20 Thomas Cort <address@hidden>
+
+ * jit/jit-apply-alpha.c jit/jit-apply-alpha.h jit/jit-rules-alpha.h
+ jit/jit-rules-alpha.ins jit/jit-rules-alpha.c jit/jit-gen-alpha.h:
+ Remove unnecessary code from the prolog, epilog, redirector, and
+ closure. Implement > and >= opcodes for signed and unsigned values.
+
2006-08-19 Aleksey Demakov <address@hidden>
* jit/jit-reg-alloc.c (set_regdesc_flags): fix a problem with the
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] libjit jit/jit-apply-alpha.c jit/jit-rules-alph...,
Thomas Cort <=