Mercurial > hg > CbC > old > device
changeset 841:7da123aa5a39
spu
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 05 Dec 2010 16:16:31 +0900 |
parents | 1547193bddde |
children | 3b2bdacc5a31 |
files | mc-code-spu.c |
diffstat | 1 files changed, 16 insertions(+), 107 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-code-spu.c Sat Dec 04 13:02:51 2010 +0900 +++ b/mc-code-spu.c Sun Dec 05 16:16:31 2010 +0900 @@ -577,51 +577,13 @@ return reg; } } -#if LONGLONG_CODE||FLOAT_CODE - /* search register stack */ - for(i=0;i<reg_sp;i++) { - if ((reg=reg_stack[i])>0) { - code_lassign_lvar( - (j=new_lvar(SIZE_OF_LONGLONG)),reg); - reg_stack[i]= j-REG_LVAR_OFFSET; - free_register(reg); - return get_register(); - } - } -#endif - /* PTR_CACHE をつぶす */ - for(i=MAX_TMP_REG;i>=MIN_TMP_REG;i--) { - if (regs[i]==PTRC_REG) { - clear_ptr_cache_reg(i); - } else - continue; - regs[i]=USING_REG; /* そのレジスタを使うことを宣言し */ - return i; /* その場所を表す番号を返す */ - } for(i=0;i<REG_VAR_MAX-REG_VAR_MIN;i++) { reg =REG_VAR_BASE+i; - /* PTR_CACHE をつぶす */ - if (regs[reg]==PTRC_REG) { - clear_ptr_cache_reg(reg); - regs[reg]=0; - return reg; /* その場所を表す番号を返す */ - } } /* あいている場所がないなら、エラー(いったい誰が使ってるの?) */ error(RGERR); return creg; } -#if 0 -int -get_register(void) -{ - int i = get_register0(); - printf("## get_register %d\n",i); - //printf("hoge:%d\n",i); - return i; -} -#endif - int pop_register(void) { /* レジスタから値を取り出す */ @@ -635,15 +597,6 @@ return get_register(); } -#if 0 -int -get_dregister(int d) -{ - int i = get_dregister0(d); -printf("## get_dregister %d\n",i); - return i; -} -#endif int pop_fregister(void) @@ -681,15 +634,7 @@ void free_register(int i) { /* いらなくなったレジスタを解放 */ -// printf("## free_register %d\n",i); regs[i]=0; - // if (is_longlong_reg(i)) { -// printf("## free lregister %d (%d)\n",i,lreg_count++); -// regs[(i)]=0; -// regs[(i)]=0; - //(i)=0; - //(i)=0; - // } } extern void @@ -756,19 +701,6 @@ return d?fcount:count; } -#if 0 -static int -register_full(void) -{ - int i; - for(i=0;i<MAX_REGISTER;i++) { - if (! regs[i]) { - return 0; - } - } - return 1; -} -#endif void free_all_register(void) @@ -979,11 +911,11 @@ // char *rn2 = register_name(r+1); char *drn; int dreg; - if (-32768<offset&&offset<32768) - printf("\tai\t%s, %s, %d\n",crn,rrn,offset); - else if (offset==0) { + if (offset==0) { if(r!=reg) printf("\tori\t%s, %s, 0\n",crn,rrn); + } else if (-32768<offset&&offset<32768) + printf("\tai\t%s, %s, %d\n",crn,rrn,offset); } else { drn = register_name(dreg = get_register()); code_const(offset, dreg); @@ -1060,7 +992,6 @@ use_int(reg); lvar_intro(e2); printf("\tlqd\t%s, ",register_name(reg)); - e2 *= 4; lvar(e2,""); } @@ -1160,8 +1091,8 @@ void code_not(int creg) { use_int(creg); - printf("\tori\t%s, %s, 0\n", - register_name(creg), register_name(creg)); + printf("\tnor\t%s, %s, %s\n", + register_name(creg), register_name(creg), register_name(creg)); } @@ -1169,7 +1100,7 @@ code_lnot(int creg) { use_int(creg); - printf("\tceqbi\t%s,%s,0\n",register_name(creg),register_name(creg)); + printf("\tceqi\t%s,%s,0\n",register_name(creg),register_name(creg)); } void @@ -1242,41 +1173,27 @@ /* save frame pointer */ if (is_code(fnptr)) { use_int(creg); - printf("\tori\t%s, fp, 0\n",register_name(creg)); - } else { + printf("\tori\t%s, $sp, 0\n",register_name(creg),trn); + } else { //int disp,label; - char *trn = register_name(REG_ip); use_int(creg); - printf("\ta\t%s, $sp, %s\n",register_name(creg),trn); + printf("\tori\t%s, $sp, 0\n",register_name(creg),trn); } } static int rexpr_bool(int e1, int reg); -#if LONGLONG_CODE -static int lrexpr_bool(int e1, int reg); -#endif void code_bool(int e1,int reg) { int e2,e3; char *xrn; if (rexpr_bool(e1, reg)) return; -#if LONGLONG_CODE - if (lrexpr_bool(e1, reg)) return; -#endif - b_expr(e1,1,e2=fwdlabel(),1); /* including > < ... */ if (use) { use_int(reg); xrn = register_name(reg); - //printf("\tmov\t%s, #0\n",xrn); - printf("\til\t%s, 0\n",xrn); - gen_jmp(e3=fwdlabel()); - fwddef(e2); - //printf("\tmov\t%s, #1\n",xrn); - printf("\til\t%s, 1\n",xrn); - fwddef(e3); - } else { - fwddef(e2); + printf("\tceqi\t%s, %s, 0\n",xrn,xrn); + printf("\tnor\t%s, %s, %s\n",xrn,xrn,xrn); + printf("\tsfi\t%s, %s, 0\n",xrn,xrn); } } @@ -1307,7 +1224,7 @@ void code_cmp_rgvar(int e1,int reg,int label,int cond) { use_int(reg); - code_ld("lqd",reg,cadr(e1),get_ptr_cache(ncaddr(e1))); + code_crvar(e1,reg,0,SIZE_OF_INT); code_cmp_register(reg,label,cond); } @@ -1319,8 +1236,7 @@ crn = register_name(reg); lvar_intro(e2); printf("\tlqd\t%s, ",crn); - e2 *= 4; - lvar(e2,""); + lvar(e2,""); code_cmp_register(reg,label,cond); } @@ -1935,8 +1851,7 @@ void code_frame_pointer(int e3) { use_int(e3); - //printf("\tmov\tfp, %s\n",register_name(e3)); - printf("\tori\t$sp,%s\n",register_name(e3)); + printf("\tori\t$sp,%s\n",register_name(e3)); } int @@ -1961,7 +1876,7 @@ trn = register_name(REG_ip); - printf("\tsf\tfp, fp, %s\n",trn); + printf("\tori\t$sp, $sp, %s\n",trn); } @@ -3538,12 +3453,6 @@ /* 64bit int part */ int -lrexpr_bool(int e1, int reg) -{ - return 0; -} - -int lrexpr(int e1, int e2,int l1, int op,int cond) { int reg,regh,regl,e3h,e3l;