Mercurial > hg > CbC > old > device
changeset 112:fc7de4faedfd
*** empty log message ***
author | kono |
---|---|
date | Wed, 19 Mar 2003 20:41:14 +0900 |
parents | 7aa449aff3e6 |
children | a9261154cde9 |
files | Changes mc-code-powerpc.c test/float.c |
diffstat | 3 files changed, 25 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Wed Mar 19 18:33:25 2003 +0900 +++ b/Changes Wed Mar 19 20:41:14 2003 +0900 @@ -2347,3 +2347,6 @@ (なんか風邪ひいた... 家内がくるというのに...) 浮動小数点のバグも順調に取れています。 + +なんか、save_stack が余計なsaveしてない? +まぁ、一時変数を良く使うのでfree listを作った方が良いかもね。
--- a/mc-code-powerpc.c Wed Mar 19 18:33:25 2003 +0900 +++ b/mc-code-powerpc.c Wed Mar 19 20:41:14 2003 +0900 @@ -457,11 +457,12 @@ int emit_pop(int type) { - int xreg; + int xreg,reg; xreg=pop_register(); if (xreg<= -REG_LVAR_OFFSET) { - xreg = get_register(); - code_rlvar(lvar(REG_LVAR_OFFSET+xreg),xreg); + reg = get_register(); + code_rlvar(lvar(REG_LVAR_OFFSET+xreg),reg); + xreg = reg; regv[xreg]=1; } return xreg; @@ -855,27 +856,27 @@ char * code_gt(int cond) { - return (cond?"gt":"le"); + return (!cond?"gt":"le"); } char * code_ugt(int cond) { - return (cond?"gt":"le"); + return (!cond?"gt":"le"); } char * code_ge(int cond) { - return (cond?"ge":"lt"); + return (!cond?"ge":"lt"); } char * code_uge(int cond) { - return (cond?"ge":"lt"); + return (!cond?"ge":"lt"); } char * code_eq(int cond) { - return (cond?"eq":"ne"); + return (!cond?"eq":"ne"); } void @@ -1115,6 +1116,7 @@ int lvar; int t; /* fnptr->dsp=list4(type,fnptr->dsp,(int)n,0); */ + int reg_offset = 0; for(args = fnptr->dsp;args;args = cadr(args)) { n = (NMTBL *)caddr(args); @@ -1125,15 +1127,17 @@ /* regs[reg]==INPUT_REG case should be considered */ n->dsp = new_lvar(size_of_int); t = INT; + reg += reg_offset; /* for duplicated floating point argument */ } else if (tag==DREGISTER) { /* fregs[reg]==INPUT_REG case should be considered */ n->dsp = new_lvar(size_of_double); t = DOUBLE; + reg_offset+=2; } else continue; n->sc = LVAR; lvar = list2(LVAR,n->dsp); - g_expr_u(assign_expr0(list2(LVAR,n->dsp),list3(tag,reg,(int)n),t,t)); + g_expr_u(assign_expr0(list2(LVAR,n->dsp),list3(tag,reg,(int)n),n->ty,t)); if (tag==REGISTER) { free_register(reg); } else if (tag==DREGISTER) { @@ -1437,6 +1441,9 @@ case SUB: printf("\tsub %s,%s,%s\n",crn,orn,crn); break; + case CMP: + printf("\tcmpw cr0,%s,%s\n",orn,crn); + break; case BAND: printf("\tand %s,%s,%s\n",crn,orn,crn); break; @@ -1474,6 +1481,8 @@ free_register(creg); creg=dx; break; + default: + error(-1); } if(oreg!=creg) free_register(oreg); } @@ -2422,7 +2431,7 @@ for(i=0;i<reg_sp;i++) { if ((reg=reg_stack[i])>=0) { code_assign_lvar( - lvar(reg_stack[i]=new_lvar(size_of_int)),reg,1); + lvar(reg_stack[i]=new_lvar(size_of_int)),reg,0); reg_stack[i]= reg_stack[i]-REG_LVAR_OFFSET; } }