author | pcpa <paulo.cesar.pereira.de.andrade@gmail.com> | 2012年12月11日 02:16:51 -0200 |
---|---|---|
committer | pcpa <paulo.cesar.pereira.de.andrade@gmail.com> | 2012年12月11日 02:16:51 -0200 |
commit | 7e3d863767300bc65ad8742eb9494e700dcebf19 (patch) | |
tree | 5ae70c6bcccf4e60b22f65e619dc4daa6c4a3925 /lib/jit_ppc-cpu.c | |
parent | a3fbc5da9683640b8f7e8b91ace4c1a1c6ab496d (diff) | |
download | lightning-7e3d863767300bc65ad8742eb9494e700dcebf19.tar.gz |
-rw-r--r-- | lib/jit_ppc-cpu.c | 42 |
diff --git a/lib/jit_ppc-cpu.c b/lib/jit_ppc-cpu.c index 4cfa561..729d275 100644 --- a/lib/jit_ppc-cpu.c +++ b/lib/jit_ppc-cpu.c @@ -16,10 +16,7 @@ */ #if PROTO -/* quite a lot of space for fixed computation of possible stack arguments - * this currently is done mostly to keep it simple, as the vm has only - * one function */ -# define stack_framesize 224 +# define stack_framesize 80 # define ii(i) *_jit->pc.ui++ = i # define can_sign_extend_short_p(im) ((im) >= -32768 && (im) <= 32767) # define can_zero_extend_short_p(im) ((im) >= 0 && (im) <= 65535) @@ -2209,46 +2206,37 @@ _calli_p(jit_state_t *_jit, jit_word_t i0) static void _prolog(jit_state_t *_jit, jit_node_t *node) { - unsigned long regno; + unsigned long regno; - subi(_SP_REGNO, _SP_REGNO, stack_framesize); /* return address */ MFLR(_R0_REGNO); - stxi(0, _SP_REGNO, _R0_REGNO); - /* save any clobbered callee save fpr register */ - /* FIXME actually, no "clean" interface to use these registers */ - for (regno = _F31; regno >= _F14; regno--) { - if (jit_regset_tstbit(_jit->function->regset, regno)) - stxi_d(stack_framesize - rn(regno) * 8, _SP_REGNO, regno); - } /* save any clobbered callee save gpr register */ regno = jit_regset_scan1(_jit->function->regset, _R14); if (regno == ULONG_MAX || regno > _R31) regno = _R31; /* aka _FP_REGNO */ - STMW(regno, _SP_REGNO, rn(regno) * 4 + 8); - movr(_FP_REGNO, _SP_REGNO); - /* alloca and/or space for excess parameters */ - subi(_SP_REGNO, _SP_REGNO, _jit->function->stack); + STMW(rn(regno), _SP_REGNO, -(32 * 4) + rn(regno) * 4); + + stxi(8, _SP_REGNO, _R0_REGNO); + STWU(_SP_REGNO, _SP_REGNO, -(stack_framesize + _jit->function->stack + 16)); + addi(_FP_REGNO, _SP_REGNO, _jit->function->stack + 16); } static void _epilog(jit_state_t *_jit, jit_node_t *node) { - unsigned long regno; + unsigned long regno; + + //ldxi(_SP_REGNO, _SP_REGNO, 0); + LWZ(_SP_REGNO, _SP_REGNO, 0); + ldxi(_R0_REGNO, _SP_REGNO, 8); + + MTLR(_R0_REGNO); - movr(_SP_REGNO, _FP_REGNO); - for (regno = _F31; regno >= _F14; regno--) { - if (jit_regset_tstbit(_jit->function->regset, regno)) - ldxi_d(regno, _SP_REGNO, stack_framesize - rn(regno) * 8); - } regno = jit_regset_scan1(_jit->function->regset, _R14); if (regno == ULONG_MAX || regno > _R31) regno = _R31; /* aka _FP_REGNO */ - LMW(rn(regno), _SP_REGNO, regno * 4 + 8); - ldxi(_R0_REGNO, _SP_REGNO, 0); - addi(_SP_REGNO, _SP_REGNO, stack_framesize); - MTLR(_R0_REGNO); + LMW(rn(regno), _SP_REGNO, -(32 * 4) + rn(regno) * 4); BLR(); } |