Mercurial > hg > CbC > old > device
changeset 726:f3fccac64cbe
fix ppc goto with env
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 20 Aug 2009 17:03:35 +0900 |
parents | 3f1f6c0610c1 |
children | 13e540e7d9bf |
files | mc-code-powerpc.c |
diffstat | 1 files changed, 38 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-code-powerpc.c Thu Aug 20 16:39:02 2009 +0900 +++ b/mc-code-powerpc.c Thu Aug 20 17:03:35 2009 +0900 @@ -3522,13 +3522,48 @@ }; #endif +static void +make_return_continuation() +{ +#if R1SAVE + retcont1 = fwdlabel(); +#endif + fwddef(retcont); + if (cadr(fnptr->ty)==FLOAT||cadr(fnptr->ty)==DOUBLE) { + printf("\tfmr %s,%s\n",fregister_name(1),fregister_name(31)); + printf("\tmr %s,%s\n",register_name(30),register_name(28)); + } else if (cadr(fnptr->ty)>0&&( + car(cadr(fnptr->ty))==STRUCT || + car(cadr(fnptr->ty))==UNION)) { + int sz = size(cadr(fnptr->ty)); +#ifdef __APPLE__ + printf("\tli r7,%d\n",sz); + printf("\tsubl r6,r7,r30\n"); + printf("\tlwz r3,lo16(%d)(r30)\n",(my_func_args-1)*SIZE_OF_INT); + // emit_copy(6,3,sz,0,1,1); +#else + printf("\tli 7,%d\n",sz); + printf("\tsubl 6,7,%d\n",REG_fp); + printf("\tlwz 3,%d@l(%d)\n",(my_func_args-1)*SIZE_OF_INT,REG_fp); + // emit_copy(6,3,sz,0,1,1); +#endif + printf("\tmr %s,%s\n",register_name(30),register_name(28)); + } else if (cadr(fnptr->ty)!=VOID) { + printf("\tmr %s,%s\n",register_name(3),register_name(29)); + printf("\tmr %s,%s\n",register_name(30),register_name(28)); + } +#if R1SAVE + jmp(retcont1); +#else +#endif +} + void leave(int control, char *name) { #if R1SAVE - int retcont1=0,sz; + int retcont1=0; #else - int sz; #endif if (max_freg_var>=0 && max_freg_var<=3) max_freg_var=3; @@ -3539,34 +3574,7 @@ } if (retcont) { if (control) jmp(retlabel); -#if R1SAVE - retcont1 = fwdlabel(); -#endif - fwddef(retcont); - if (cadr(fnptr->ty)==FLOAT||cadr(fnptr->ty)==DOUBLE) { - printf("\tfmr %s,%s\n",fregister_name(1),fregister_name(31)); - } else if (cadr(fnptr->ty)>0&&( - car(cadr(fnptr->ty))==STRUCT || - car(cadr(fnptr->ty))==UNION)) { - sz = size(cadr(fnptr->ty)); -#ifdef __APPLE__ - printf("\tli r7,%d\n",sz); - printf("\tsubl r6,r7,r30\n"); - printf("\tlwz r3,lo16(%d)(r30)\n",(my_func_args-1)*SIZE_OF_INT); - emit_copy(6,3,sz,0,1,1); -#else - printf("\tli 7,%d\n",sz); - printf("\tsubl 6,7,%d\n",REG_fp); - printf("\tlwz 3,%d@l(%d)\n",(my_func_args-1)*SIZE_OF_INT,REG_fp); - emit_copy(6,3,sz,0,1,1); -#endif - } else if (cadr(fnptr->ty)!=VOID) { - printf("\tmr %s,%s\n",register_name(3),register_name(29)); - } -#if R1SAVE - jmp(retcont1); -#else -#endif + make_return_continuation(); } fwddef(retlabel); #if R1SAVE